UNPKG

react-advanced-form

Version:

Functional reactive forms in React. Multi-layer validation, field grouping, reactive props, and much more.

1,573 lines (1,374 loc) 414 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react")); else if(typeof define === 'function' && define.amd) define("reactAdvancedForm", ["react"], factory); else if(typeof exports === 'object') exports["reactAdvancedForm"] = factory(require("react")); else root["reactAdvancedForm"] = factory(root["react"]); })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE__18__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 92); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { var _curry1 = /*#__PURE__*/__webpack_require__(1); var _isPlaceholder = /*#__PURE__*/__webpack_require__(25); /** * Optimized internal two-arity curry function. * * @private * @category Function * @param {Function} fn The function to curry. * @return {Function} The curried function. */ function _curry2(fn) { return function f2(a, b) { switch (arguments.length) { case 0: return f2; case 1: return _isPlaceholder(a) ? f2 : _curry1(function (_b) { return fn(a, _b); }); default: return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) { return fn(_a, b); }) : _isPlaceholder(b) ? _curry1(function (_b) { return fn(a, _b); }) : fn(a, b); } }; } module.exports = _curry2; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { var _isPlaceholder = /*#__PURE__*/__webpack_require__(25); /** * Optimized internal one-arity curry function. * * @private * @category Function * @param {Function} fn The function to curry. * @return {Function} The curried function. */ function _curry1(fn) { return function f1(a) { if (arguments.length === 0 || _isPlaceholder(a)) { return f1; } else { return fn.apply(this, arguments); } }; } module.exports = _curry1; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { var _curry2 = /*#__PURE__*/__webpack_require__(0); /** * Retrieve the value at a given path. * * @func * @memberOf R * @since v0.2.0 * @category Object * @typedefn Idx = String | Int * @sig [Idx] -> {a} -> a | Undefined * @param {Array} path The path to use. * @param {Object} obj The object to retrieve the nested property from. * @return {*} The data at `path`. * @see R.prop * @example * * R.path(['a', 'b'], {a: {b: 2}}); //=> 2 * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined */ var path = /*#__PURE__*/_curry2(function path(paths, obj) { var val = obj; var idx = 0; while (idx < paths.length) { if (val == null) { return; } val = val[paths[idx]]; idx += 1; } return val; }); module.exports = path; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setPristine = exports.setTouched = exports.setFocused = exports.reset = exports.resetValidationState = exports.updateValidityState = exports.resetValidityState = exports.setErrors = exports.hasValue = exports.setValue = exports.getValue = exports.updateCollectionWith = exports.createField = void 0; var _compose2 = _interopRequireDefault(__webpack_require__(4)); var _mergeDeepLeft2 = _interopRequireDefault(__webpack_require__(60)); var _assoc2 = _interopRequireDefault(__webpack_require__(6)); var _prop2 = _interopRequireDefault(__webpack_require__(42)); var _assocPath2 = _interopRequireDefault(__webpack_require__(11)); var _curry2 = _interopRequireDefault(__webpack_require__(7)); var _isNil2 = _interopRequireDefault(__webpack_require__(14)); var _complement2 = _interopRequireDefault(__webpack_require__(22)); var _always2 = _interopRequireDefault(__webpack_require__(32)); var _invariant = _interopRequireDefault(__webpack_require__(44)); var _enforceArray = _interopRequireDefault(__webpack_require__(45)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } 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; } return obj; } /** * Creates a new field based on its initial state. * @param {Object} initialState * @returns {Object} */ var createField = function createField(initialState) { var _objectSpread2; var valuePropName = initialState.valuePropName || 'value'; var value = initialState[valuePropName]; return _objectSpread((_objectSpread2 = { /* Internal */ fieldGroup: null, fieldPath: null, mapValue: _always2["default"], assertValue: (0, _complement2["default"])(_isNil2["default"]), serialize: _always2["default"], /* Basic */ initialValue: value }, _defineProperty(_objectSpread2, valuePropName, value), _defineProperty(_objectSpread2, "valuePropName", valuePropName), _defineProperty(_objectSpread2, "focused", false), _defineProperty(_objectSpread2, "pristine", true), _defineProperty(_objectSpread2, "touched", false), _defineProperty(_objectSpread2, "required", false), _defineProperty(_objectSpread2, "skip", false), _defineProperty(_objectSpread2, "rule", null), _defineProperty(_objectSpread2, "asyncRule", null), _defineProperty(_objectSpread2, "pendingAsyncValidation", null), _defineProperty(_objectSpread2, "debounceValidate", null), _defineProperty(_objectSpread2, "errors", null), _defineProperty(_objectSpread2, "expected", true), _defineProperty(_objectSpread2, "valid", false), _defineProperty(_objectSpread2, "invalid", false), _defineProperty(_objectSpread2, "validating", false), _defineProperty(_objectSpread2, "validated", false), _defineProperty(_objectSpread2, "validatedSync", false), _defineProperty(_objectSpread2, "validSync", false), _defineProperty(_objectSpread2, "validatedAsync", false), _defineProperty(_objectSpread2, "validAsync", false), _defineProperty(_objectSpread2, "reactiveProps", null), _defineProperty(_objectSpread2, "onFocus", null), _defineProperty(_objectSpread2, "onChange", null), _defineProperty(_objectSpread2, "onBlur", null), _objectSpread2), initialState); }; /** * Updates the given collection with the given field props. * @param {Object} fieldProps * @param {Object} collection */ exports.createField = createField; var updateCollectionWith = (0, _curry2["default"])(function (fieldProps, collection) { return (0, _assocPath2["default"])(fieldProps.fieldPath, fieldProps, collection); }); /** * Returns the value of the given field. * @param {Object} fieldProps * @returns {any} */ exports.updateCollectionWith = updateCollectionWith; var getValue = function getValue(fieldProps) { var fieldPath = fieldProps.fieldPath, valuePropName = fieldProps.valuePropName; (0, _invariant["default"])(fieldPath, 'Failed to get field value: provided object is not a field: %s', Object.keys(fieldProps).join()); (0, _invariant["default"])(valuePropName, 'Failed to get value of the `%s`: field has no `valuePropName` property.', fieldPath && fieldPath.join('.')); return (0, _prop2["default"])(valuePropName, fieldProps); }; /** * Updates the value prop of the given field with the given next value. * Beware that this function references "valuePropName" prop of the given field. * Thus, it cannot be used on non-field object. * @param {Function|any} nextValueGetter * @param {Object} fieldProps */ exports.getValue = getValue; var setValue = (0, _curry2["default"])(function (nextValueGetter, fieldProps) { var fieldPath = fieldProps.fieldPath, valuePropName = fieldProps.valuePropName; /* Accept "nextValue" as a function to be able to make "setValue" composable */ var nextValue = typeof nextValueGetter === 'function' ? nextValueGetter(fieldProps) : nextValueGetter; (0, _invariant["default"])(valuePropName, 'Failed to set value to `%s` on `%s`: field has no `valuePropName` property.', nextValue, fieldPath && fieldPath.join('.')); return (0, _assoc2["default"])(valuePropName, nextValue, fieldProps); }); /** * Returns boolean stating if the given field contains value. * @param {Object} fieldProps */ exports.setValue = setValue; var hasValue = function hasValue(fieldProps) { return fieldProps.assertValue(getValue(fieldProps)); }; /** * Sets the given error messages to the given field. * When no errors are provided, returns field props intact. * @param {string[]} errors * @param {Object} fieldProps */ exports.hasValue = hasValue; var setErrors = (0, _curry2["default"])(function (errors, fieldProps) { /* Allow explicit "null" for empty "errors" value */ return typeof errors !== 'undefined' ? (0, _assoc2["default"])('errors', errors && (0, _enforceArray["default"])(errors), fieldProps) : fieldProps; }); /** * Resets the validity state (valid/invalid) of the given field. * @param {Object} fieldProps * @returns {Object} */ exports.setErrors = setErrors; var resetValidityState = (0, _mergeDeepLeft2["default"])({ valid: false, invalid: false }); /** * Sets the validity state props (valid/invalid) on the given field. * @param {Object} fieldProps * @param {boolean} shouldValidate * @returns {Object} */ exports.resetValidityState = resetValidityState; var updateValidityState = (0, _curry2["default"])(function (shouldValidate, fieldProps) { if (!shouldValidate) { return resetValidityState(fieldProps); } var validated = fieldProps.validated, expected = fieldProps.expected, errors = fieldProps.errors; var value = getValue(fieldProps); var nextValid = !!value && validated && expected; var nextInvalid = validated && !expected; var nextErrors = !expected && errors; return (0, _mergeDeepLeft2["default"])({ errors: nextErrors, valid: nextValid, invalid: nextInvalid }, fieldProps); }); /** * Resets the validation state of the given field. * @param {Object} fieldProps * @returns {Object} */ exports.updateValidityState = updateValidityState; var resetValidationState = (0, _mergeDeepLeft2["default"])({ validating: false, validated: false, validatedSync: false, validatedAsync: false, validSync: false, validAsync: false }); /** * Resets the given field to its initial state. * @param {Function} nextValueGetter * @param {Object} fieldProps * @returns {Object} */ exports.resetValidationState = resetValidationState; var reset = (0, _curry2["default"])(function (nextValueGetter, fieldProps) { return (0, _compose2["default"])( // Beware that this will set value to "undefined" when no "initialValue" is found setValue(fieldProps.mapValue(nextValueGetter(fieldProps))), setErrors(null), setPristine(true), setTouched(false), resetValidationState, resetValidityState)(fieldProps); }); /** * Sets the focus of the given field to the next value. * @param {boolean} isFocused * @param {Object} fieldProps * @returns {Object} */ exports.reset = reset; var setFocused = (0, _assoc2["default"])('focused'); /** * Marks the given field as touched. * @param {boolean} touched * @param {Object} fieldProps * @returns {Object} */ exports.setFocused = setFocused; var setTouched = (0, _assoc2["default"])('touched'); /** * Sets the next value of a field's "pristine" property. * @param {boolean} pristine * @param {Object} fieldState * @returns {Object} */ exports.setTouched = setTouched; var setPristine = (0, _assoc2["default"])('pristine'); exports.setPristine = setPristine; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { var pipe = /*#__PURE__*/__webpack_require__(104); var reverse = /*#__PURE__*/__webpack_require__(110); /** * Performs right-to-left function composition. The rightmost function may have * any arity; the remaining functions must be unary. * * **Note:** The result of compose is not automatically curried. * * @func * @memberOf R * @since v0.1.0 * @category Function * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z) * @param {...Function} ...functions The functions to compose * @return {Function} * @see R.pipe * @example * * const classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName * const yellGreeting = R.compose(R.toUpper, classyGreeting); * yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND" * * R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7 * * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b))) */ function compose() { if (arguments.length === 0) { throw new Error('compose requires at least one argument'); } return pipe.apply(this, reverse(arguments)); } module.exports = compose; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { var _curry1 = /*#__PURE__*/__webpack_require__(1); var _curry2 = /*#__PURE__*/__webpack_require__(0); var _isPlaceholder = /*#__PURE__*/__webpack_require__(25); /** * Optimized internal three-arity curry function. * * @private * @category Function * @param {Function} fn The function to curry. * @return {Function} The curried function. */ function _curry3(fn) { return function f3(a, b, c) { switch (arguments.length) { case 0: return f3; case 1: return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) { return fn(a, _b, _c); }); case 2: return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) { return fn(_a, b, _c); }) : _isPlaceholder(b) ? _curry2(function (_b, _c) { return fn(a, _b, _c); }) : _curry1(function (_c) { return fn(a, b, _c); }); default: return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) { return fn(_a, _b, c); }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) { return fn(_a, b, _c); }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) { return fn(a, _b, _c); }) : _isPlaceholder(a) ? _curry1(function (_a) { return fn(_a, b, c); }) : _isPlaceholder(b) ? _curry1(function (_b) { return fn(a, _b, c); }) : _isPlaceholder(c) ? _curry1(function (_c) { return fn(a, b, _c); }) : fn(a, b, c); } }; } module.exports = _curry3; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { var _curry3 = /*#__PURE__*/__webpack_require__(5); /** * Makes a shallow clone of an object, setting or overriding the specified * property with the given value. Note that this copies and flattens prototype * properties onto the new object as well. All non-primitive properties are * copied by reference. * * @func * @memberOf R * @since v0.8.0 * @category Object * @sig String -> a -> {k: v} -> {k: v} * @param {String} prop The property name to set * @param {*} val The new value * @param {Object} obj The object to clone * @return {Object} A new object equivalent to the original except for the changed property. * @see R.dissoc, R.pick * @example * * R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3} */ var assoc = /*#__PURE__*/_curry3(function assoc(prop, val, obj) { var result = {}; for (var p in obj) { result[p] = obj[p]; } result[prop] = val; return result; }); module.exports = assoc; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { var _curry1 = /*#__PURE__*/__webpack_require__(1); var curryN = /*#__PURE__*/__webpack_require__(15); /** * Returns a curried equivalent of the provided function. The curried function * has two unusual capabilities. First, its arguments needn't be provided one * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the * following are equivalent: * * - `g(1)(2)(3)` * - `g(1)(2, 3)` * - `g(1, 2)(3)` * - `g(1, 2, 3)` * * Secondly, the special placeholder value [`R.__`](#__) may be used to specify * "gaps", allowing partial application of any combination of arguments, * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), * the following are equivalent: * * - `g(1, 2, 3)` * - `g(_, 2, 3)(1)` * - `g(_, _, 3)(1)(2)` * - `g(_, _, 3)(1, 2)` * - `g(_, 2)(1)(3)` * - `g(_, 2)(1, 3)` * - `g(_, 2)(_, 3)(1)` * * @func * @memberOf R * @since v0.1.0 * @category Function * @sig (* -> a) -> (* -> a) * @param {Function} fn The function to curry. * @return {Function} A new, curried function. * @see R.curryN, R.partial * @example * * const addFourNumbers = (a, b, c, d) => a + b + c + d; * * const curriedAddFourNumbers = R.curry(addFourNumbers); * const f = curriedAddFourNumbers(1, 2); * const g = f(3); * g(4); //=> 10 */ var curry = /*#__PURE__*/_curry1(function curry(fn) { return curryN(fn.length, fn); }); module.exports = curry; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; /** * Dispatches the given function when the following exists. * Returns the return of the given function. */ var dispatch = function dispatch(func, args) { return func && func(args); }; var _default = dispatch; exports["default"] = _default; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { var _curry2 = /*#__PURE__*/__webpack_require__(0); var _dispatchable = /*#__PURE__*/__webpack_require__(30); var _map = /*#__PURE__*/__webpack_require__(62); var _reduce = /*#__PURE__*/__webpack_require__(12); var _xmap = /*#__PURE__*/__webpack_require__(118); var curryN = /*#__PURE__*/__webpack_require__(15); var keys = /*#__PURE__*/__webpack_require__(16); /** * Takes a function and * a [functor](https://github.com/fantasyland/fantasy-land#functor), * applies the function to each of the functor's values, and returns * a functor of the same shape. * * Ramda provides suitable `map` implementations for `Array` and `Object`, * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`. * * Dispatches to the `map` method of the second argument, if present. * * Acts as a transducer if a transformer is given in list position. * * Also treats functions as functors and will compose them together. * * @func * @memberOf R * @since v0.1.0 * @category List * @sig Functor f => (a -> b) -> f a -> f b * @param {Function} fn The function to be called on every element of the input `list`. * @param {Array} list The list to be iterated over. * @return {Array} The new list. * @see R.transduce, R.addIndex * @example * * const double = x => x * 2; * * R.map(double, [1, 2, 3]); //=> [2, 4, 6] * * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6} * @symb R.map(f, [a, b]) = [f(a), f(b)] * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) } * @symb R.map(f, functor_o) = functor_o.map(f) */ var map = /*#__PURE__*/_curry2( /*#__PURE__*/_dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) { switch (Object.prototype.toString.call(functor)) { case '[object Function]': return curryN(functor.length, function () { return fn.call(this, functor.apply(this, arguments)); }); case '[object Object]': return _reduce(function (acc, key) { acc[key] = fn(functor[key]); return acc; }, {}, keys(functor)); default: return _map(fn, functor); } })); module.exports = map; /***/ }), /* 10 */ /***/ (function(module, exports) { function _has(prop, obj) { return Object.prototype.hasOwnProperty.call(obj, prop); } module.exports = _has; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { var _curry3 = /*#__PURE__*/__webpack_require__(5); var _has = /*#__PURE__*/__webpack_require__(10); var _isArray = /*#__PURE__*/__webpack_require__(13); var _isInteger = /*#__PURE__*/__webpack_require__(112); var assoc = /*#__PURE__*/__webpack_require__(6); var isNil = /*#__PURE__*/__webpack_require__(14); /** * Makes a shallow clone of an object, setting or overriding the nodes required * to create the given path, and placing the specific value at the tail end of * that path. Note that this copies and flattens prototype properties onto the * new object as well. All non-primitive properties are copied by reference. * * @func * @memberOf R * @since v0.8.0 * @category Object * @typedefn Idx = String | Int * @sig [Idx] -> a -> {a} -> {a} * @param {Array} path the path to set * @param {*} val The new value * @param {Object} obj The object to clone * @return {Object} A new object equivalent to the original except along the specified path. * @see R.dissocPath * @example * * R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} * * // Any missing or non-object keys in path will be overridden * R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}} */ var assocPath = /*#__PURE__*/_curry3(function assocPath(path, val, obj) { if (path.length === 0) { return val; } var idx = path[0]; if (path.length > 1) { var nextObj = !isNil(obj) && _has(idx, obj) ? obj[idx] : _isInteger(path[1]) ? [] : {}; val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj); } if (_isInteger(idx) && _isArray(obj)) { var arr = [].concat(obj); arr[idx] = val; return arr; } else { return assoc(idx, val, obj); } }); module.exports = assocPath; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { var _isArrayLike = /*#__PURE__*/__webpack_require__(40); var _xwrap = /*#__PURE__*/__webpack_require__(106); var bind = /*#__PURE__*/__webpack_require__(107); function _arrayReduce(xf, acc, list) { var idx = 0; var len = list.length; while (idx < len) { acc = xf['@@transducer/step'](acc, list[idx]); if (acc && acc['@@transducer/reduced']) { acc = acc['@@transducer/value']; break; } idx += 1; } return xf['@@transducer/result'](acc); } function _iterableReduce(xf, acc, iter) { var step = iter.next(); while (!step.done) { acc = xf['@@transducer/step'](acc, step.value); if (acc && acc['@@transducer/reduced']) { acc = acc['@@transducer/value']; break; } step = iter.next(); } return xf['@@transducer/result'](acc); } function _methodReduce(xf, acc, obj, methodName) { return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc)); } var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator'; function _reduce(fn, acc, list) { if (typeof fn === 'function') { fn = _xwrap(fn); } if (_isArrayLike(list)) { return _arrayReduce(fn, acc, list); } if (typeof list['fantasy-land/reduce'] === 'function') { return _methodReduce(fn, acc, list, 'fantasy-land/reduce'); } if (list[symIterator] != null) { return _iterableReduce(fn, acc, list[symIterator]()); } if (typeof list.next === 'function') { return _iterableReduce(fn, acc, list); } if (typeof list.reduce === 'function') { return _methodReduce(fn, acc, list, 'reduce'); } throw new TypeError('reduce: list must be array or iterable'); } module.exports = _reduce; /***/ }), /* 13 */ /***/ (function(module, exports) { /** * Tests whether or not an object is an array. * * @private * @param {*} val The object to test. * @return {Boolean} `true` if `val` is an array, `false` otherwise. * @example * * _isArray([]); //=> true * _isArray(null); //=> false * _isArray({}); //=> false */ module.exports = Array.isArray || function _isArray(val) { return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]'; }; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { var _curry1 = /*#__PURE__*/__webpack_require__(1); /** * Checks if the input value is `null` or `undefined`. * * @func * @memberOf R * @since v0.9.0 * @category Type * @sig * -> Boolean * @param {*} x The value to test. * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`. * @example * * R.isNil(null); //=> true * R.isNil(undefined); //=> true * R.isNil(0); //=> false * R.isNil([]); //=> false */ var isNil = /*#__PURE__*/_curry1(function isNil(x) { return x == null; }); module.exports = isNil; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { var _arity = /*#__PURE__*/__webpack_require__(29); var _curry1 = /*#__PURE__*/__webpack_require__(1); var _curry2 = /*#__PURE__*/__webpack_require__(0); var _curryN = /*#__PURE__*/__webpack_require__(113); /** * Returns a curried equivalent of the provided function, with the specified * arity. The curried function has two unusual capabilities. First, its * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the * following are equivalent: * * - `g(1)(2)(3)` * - `g(1)(2, 3)` * - `g(1, 2)(3)` * - `g(1, 2, 3)` * * Secondly, the special placeholder value [`R.__`](#__) may be used to specify * "gaps", allowing partial application of any combination of arguments, * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), * the following are equivalent: * * - `g(1, 2, 3)` * - `g(_, 2, 3)(1)` * - `g(_, _, 3)(1)(2)` * - `g(_, _, 3)(1, 2)` * - `g(_, 2)(1)(3)` * - `g(_, 2)(1, 3)` * - `g(_, 2)(_, 3)(1)` * * @func * @memberOf R * @since v0.5.0 * @category Function * @sig Number -> (* -> a) -> (* -> a) * @param {Number} length The arity for the returned function. * @param {Function} fn The function to curry. * @return {Function} A new, curried function. * @see R.curry * @example * * const sumArgs = (...args) => R.sum(args); * * const curriedAddFourNumbers = R.curryN(4, sumArgs); * const f = curriedAddFourNumbers(1, 2); * const g = f(3); * g(4); //=> 10 */ var curryN = /*#__PURE__*/_curry2(function curryN(length, fn) { if (length === 1) { return _curry1(fn); } return _arity(length, _curryN(length, [], fn)); }); module.exports = curryN; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { var _curry1 = /*#__PURE__*/__webpack_require__(1); var _has = /*#__PURE__*/__webpack_require__(10); var _isArguments = /*#__PURE__*/__webpack_require__(63); // cover IE < 9 keys issues var hasEnumBug = ! /*#__PURE__*/{ toString: null }.propertyIsEnumerable('toString'); var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug var hasArgsEnumBug = /*#__PURE__*/function () { 'use strict'; return arguments.propertyIsEnumerable('length'); }(); var contains = function contains(list, item) { var idx = 0; while (idx < list.length) { if (list[idx] === item) { return true; } idx += 1; } return false; }; /** * Returns a list containing the names of all the enumerable own properties of * the supplied object. * Note that the order of the output array is not guaranteed to be consistent * across different JS platforms. * * @func * @memberOf R * @since v0.1.0 * @category Object * @sig {k: v} -> [k] * @param {Object} obj The object to extract properties from * @return {Array} An array of the object's own properties. * @see R.keysIn, R.values * @example * * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c'] */ var keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? /*#__PURE__*/_curry1(function keys(obj) { return Object(obj) !== obj ? [] : Object.keys(obj); }) : /*#__PURE__*/_curry1(function keys(obj) { if (Object(obj) !== obj) { return []; } var prop, nIdx; var ks = []; var checkArgsLength = hasArgsEnumBug && _isArguments(obj); for (prop in obj) { if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) { ks[ks.length] = prop; } } if (hasEnumBug) { nIdx = nonEnumerableProps.length - 1; while (nIdx >= 0) { prop = nonEnumerableProps[nIdx]; if (_has(prop, obj) && !contains(ks, prop)) { ks[ks.length] = prop; } nIdx -= 1; } } return ks; }); module.exports = keys; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { var _curry1 = /*#__PURE__*/__webpack_require__(1); var curryN = /*#__PURE__*/__webpack_require__(15); var max = /*#__PURE__*/__webpack_require__(68); var pluck = /*#__PURE__*/__webpack_require__(69); var reduce = /*#__PURE__*/__webpack_require__(20); /** * Takes a list of predicates and returns a predicate that returns true for a * given list of arguments if every one of the provided predicates is satisfied * by those arguments. * * The function returned is a curried function whose arity matches that of the * highest-arity predicate. * * @func * @memberOf R * @since v0.9.0 * @category Logic * @sig [(*... -> Boolean)] -> (*... -> Boolean) * @param {Array} predicates An array of predicates to check * @return {Function} The combined predicate * @see R.anyPass * @example * * const isQueen = R.propEq('rank', 'Q'); * const isSpade = R.propEq('suit', '♠︎'); * const isQueenOfSpades = R.allPass([isQueen, isSpade]); * * isQueenOfSpades({rank: 'Q', suit: '♣︎'}); //=> false * isQueenOfSpades({rank: 'Q', suit: '♠︎'}); //=> true */ var allPass = /*#__PURE__*/_curry1(function allPass(preds) { return curryN(reduce(max, 0, pluck('length', preds)), function () { var idx = 0; var len = preds.length; while (idx < len) { if (!preds[idx].apply(this, arguments)) { return false; } idx += 1; } return true; }); }); module.exports = allPass; /***/ }), /* 18 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__18__; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (false) { var throwOnDirectAccess, ReactIs; } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = __webpack_require__(96)(); } /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { var _curry3 = /*#__PURE__*/__webpack_require__(5); var _reduce = /*#__PURE__*/__webpack_require__(12); /** * Returns a single item by iterating through the list, successively calling * the iterator function and passing it an accumulator value and the current * value from the array, and then passing the result to the next call. * * The iterator function receives two values: *(acc, value)*. It may use * [`R.reduced`](#reduced) to shortcut the iteration. * * The arguments' order of [`reduceRight`](#reduceRight)'s iterator function * is *(value, acc)*. * * Note: `R.reduce` does not skip deleted or unassigned indices (sparse * arrays), unlike the native `Array.prototype.reduce` method. For more details * on this behavior, see: * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description * * Dispatches to the `reduce` method of the third argument, if present. When * doing so, it is up to the user to handle the [`R.reduced`](#reduced) * shortcuting, as this is not implemented by `reduce`. * * @func * @memberOf R * @since v0.1.0 * @category List * @sig ((a, b) -> a) -> a -> [b] -> a * @param {Function} fn The iterator function. Receives two values, the accumulator and the * current element from the array. * @param {*} acc The accumulator value. * @param {Array} list The list to iterate over. * @return {*} The final, accumulated value. * @see R.reduced, R.addIndex, R.reduceRight * @example * * R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10 * // - -10 * // / \ / \ * // - 4 -6 4 * // / \ / \ * // - 3 ==> -3 3 * // / \ / \ * // - 2 -1 2 * // / \ / \ * // 0 1 0 1 * * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d) */ var reduce = /*#__PURE__*/_curry3(_reduce); module.exports = reduce; /***/ }), /* 21 */ /***/ (function(module, exports) { function _isString(x) { return Object.prototype.toString.call(x) === '[object String]'; } module.exports = _isString; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { var lift = /*#__PURE__*/__webpack_require__(114); var not = /*#__PURE__*/__webpack_require__(119); /** * Takes a function `f` and returns a function `g` such that if called with the same arguments * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`. * * `R.complement` may be applied to any functor * * @func * @memberOf R * @since v0.12.0 * @category Logic * @sig (*... -> *) -> (*... -> Boolean) * @param {Function} f * @return {Function} * @see R.not * @example * * const isNotNil = R.complement(R.isNil); * isNil(null); //=> true * isNotNil(null); //=> false * isNil(7); //=> false * isNotNil(7); //=> true */ var complement = /*#__PURE__*/lift(not); module.exports = complement; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); } return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var isFunction_1 = __webpack_require__(50); var Observer_1 = __webpack_require__(73); var Subscription_1 = __webpack_require__(75); var rxSubscriber_1 = __webpack_require__(77); var config_1 = __webpack_require__(51); var hostReportError_1 = __webpack_require__(74); var Subscriber = (function (_super) { __extends(Subscriber, _super); function Subscriber(destinationOrNext, error, complete) { var _this = _super.call(this) || this; _this.syncErrorValue = null; _this.syncErrorThrown = false; _this.syncErrorThrowable = false; _this.isStopped = false; switch (arguments.length) { case 0: _this.destination = Observer_1.empty; break; case 1: if (!destinationOrNext) { _this.destination = Observer_1.empty; break; } if (typeof destinationOrNext === 'object') { if (destinationOrNext instanceof Subscriber) { _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable; _this.destination = destinationOrNext; destinationOrNext.add(_this); } else { _this.syncErrorThrowable = true; _this.destination = new SafeSubscriber(_this, destinationOrNext); } break; } default: _this.syncErrorThrowable = true; _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete); break; } return _this; } Subscriber.prototype[rxSubscriber_1.rxSubscriber] = function () { return this; }; Subscriber.create = function (next, error, complete) { var subscriber = new Subscriber(next, error, complete); subscriber.syncErrorThrowable = false; return subscriber; }; Subscriber.prototype.next = function (value) { if (!this.isStopped) { this._next(value); } }; Subscriber.prototype.error = function (err) { if (!this.isStopped) { this.isStopped = true; this._error(err); } }; Subscriber.prototype.complete = function () { if (!this.isStopped) { this.isStopped = true; this._complete(); } }; Subscriber.prototype.unsubscribe = function () { if (this.closed) { return; } this.isStopped = true; _super.prototype.unsubscribe.call(this); }; Subscriber.prototype._next = function (value) { this.destination.next(value); }; Subscriber.prototype._error = function (err) { this.destination.error(err); this.unsubscribe(); }; Subscriber.prototype._complete = function () { this.destination.complete(); this.unsubscribe(); }; Subscriber.prototype._unsubscribeAndRecycle = function () { var _parentOrParents = this._parentOrParents; this._parentOrParents = null; this.unsubscribe(); this.closed = false; this.isStopped = false; this._parentOrParents = _parentOrParents; return this; }; return Subscriber; }(Subscription_1.Subscription)); exports.Subscriber = Subscriber; var SafeSubscriber = (function (_super) { __extends(SafeSubscriber, _super); function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) { var _this = _super.call(this) || this; _this._parentSubscriber = _parentSubscriber; var next; var context = _this; if (isFunction_1.isFunction(observerOrNext)) { next = observerOrNext; } else if (observerOrNext) { next = observerOrNext.next; error = observerOrNext.error; complete = observerOrNext.complete; if (observerOrNext !== Observer_1.empty) { context = Object.create(observerOrNext); if (isFunction_1.isFunction(context.unsubscribe)) { _this.add(context.unsubscribe.bind(context)); } context.unsubscribe = _this.unsubscribe.bind(_this); } } _this._context = context; _this._next = next; _this._error = error; _this._complete = complete; return _this; } SafeSubscriber.prototype.next = function (value) { if (!this.isStopped && this._next) { var _parentSubscriber = this._parentSubscriber; if (!config_1.config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._next, value); } else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { this.unsubscribe(); } } }; SafeSubscriber.prototype.error = function (err) { if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; var useDeprecatedSynchronousErrorHandling = config_1.config.useDeprecatedSynchronousErrorHandling; if (this._error) { if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._error, err); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, this._error, err); this.unsubscribe(); } } else if (!_parentSubscriber.syncErrorThrowable) { this.unsubscribe(); if (useDeprecatedSynchronousErrorHandling) { throw err; } hostReportError_1.hostReportError(err); } else { if (useDeprecatedSynchronousErrorHandling) { _parentSubscriber.syncErrorValue = err; _parentSubscriber.syncErrorThrown = true; } else { hostReportError_1.hostReportError(err); } this.unsubscribe(); } } }; SafeSubscriber.prototype.complete = function () { var _this = this; if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; if (this._complete) { var wrappedComplete = function () { return _this._complete.call(_this._context); }; if (!config_1.config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(wrappedComplete); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, wrappedComplete); this.unsubscribe(); } } else { this.unsubscribe(); } } }; SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) { try { fn.call(this._context, value); } catch (err) { this.unsubscribe(); if (config_1.config.useDeprecatedSynchronousErrorHandling) { throw err; } else { hostReportError_1.hostReportError(err); } } }; SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) { if (!config_1.config.useDeprecatedSynchronousErrorHandling) { throw new Error('bad call'); } try { fn.call(this._context, value); } catch (err) { if (config_1.config.useDeprecatedSynchronousErrorHandling) { parent.syncErrorValue = err; parent.syncErrorThrown = true; return true; } else { hostReportError_1.hostReportError(err); return true; } } return false; }; SafeSubscriber.prototype._unsubscribe = function () { var _parentSubscriber = this._parentSubscriber; this._context = null; this._parentSubscriber = null; _parentSubscriber.unsubscribe(); }; return SafeSubscriber; }(Subscriber)); exports.SafeSubscriber = SafeSubscriber; //# sourceMappingURL=Subscriber.js.map /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { var _curry2 = /*#__PURE__*/__webpack_require__(0); var _equals = /*#__PURE__*/__webpack_require__(154); /** * Returns `true` if its arguments are equivalent, `false` otherwise. Handles * cyclical data structures. * * Dispatches symmetrically to the `equals` methods of both arguments, if * present. * * @func * @memberOf R * @since v0.15.0 * @category Relation * @sig a -> b -> Boolean * @param {*} a * @param {*} b * @return {Boolean} * @example * * R.equals(1, 1); //=> true * R.equals(1, '1'); //=> false * R.equals([1, 2, 3], [1, 2, 3]); //=> true * * const a = {}; a.v = a; * const b = {}; b.v = b; * R.equals(a, b); //=> true */ var equals = /*#__PURE__*/_curry2(function equals(a, b) { return _equals(a, b, [], []); }); module.exports = equals; /***/ }), /* 25 */ /***/ (function(module, exports) { function _isPlaceholder(a) { return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true; } module.exports = _isPlaceholder; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = camelize; /** * Takes the given string and returns it formatted it in cammelCase. */ function camelize() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return args.join('-').replace(/-(.)/g, function (_, _char) { return _char.toUpperCase(); }); } /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = flushFieldRefs; var _dispatch = _interopRequireDefault(__webpack_require__(8)); var _createPropGetter = _interopRequireDefault(__webpack_require__(39)); var _createRuleResolverArgs = _interopRequireDefault(__webpack_require__(28)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: