UNPKG

zent

Version:

一套前端设计语言和基于React的实现

1,781 lines (1,490 loc) 71 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof define === 'function' && define.amd) define(["react"], factory); else if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react")); else if(typeof exports === 'object') exports["zent-tree"] = factory(require("react")); else root["zent-tree"] = factory(root["React"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_2__) { 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] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = 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; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1); /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports['default'] = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _class, _temp; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _assign = __webpack_require__(3); var _assign2 = _interopRequireDefault(_assign); var _classnames2 = __webpack_require__(55); var _classnames3 = _interopRequireDefault(_classnames2); var _Checkbox = __webpack_require__(58); var _Checkbox2 = _interopRequireDefault(_Checkbox); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 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; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // 记录是否已经触发收起展开逻辑 // 防止出现闪烁的bug var isTriggerSlide = false; var deepClone = function deepClone(arr) { var i = void 0; var copy = void 0; if (Array.isArray(arr)) { copy = arr.slice(0); for (i = 0; i < copy.length; i += 1) { copy[i] = deepClone(copy[i]); } return copy; } else if ((typeof arr === 'undefined' ? 'undefined' : _typeof(arr)) === 'object') { return (0, _assign2['default'])({}, arr); } return arr; }; var toggleSlide = function toggleSlide(el, isClose) { if (!isClose) { el.style.display = 'block'; el.style.height = 0; } var maxDelay = 300; var height = el.scrollHeight; var speed = Math.max(height / maxDelay, 0.5); // px/ms var sum = 0; var start = null; var animate = function animate(timestamp) { if (!start) start = timestamp; var progress = timestamp - start; sum = progress * speed; el.style.height = (isClose ? height - sum : sum) + 'px'; if (height < sum) { if (isClose) { el.style.display = 'none'; } el.style.height = ''; isTriggerSlide = false; } else { window.requestAnimationFrame(animate); } }; window.requestAnimationFrame(animate); }; var Tree = (_temp = _class = function (_Component) { _inherits(Tree, _Component); function Tree(props) { _classCallCheck(this, Tree); var _this = _possibleConstructorReturn(this, (Tree.__proto__ || Object.getPrototypeOf(Tree)).call(this, props)); _this.isInitial = true; _this.isDataUpdate = false; _this.state = { checkedTree: {} }; return _this; } _createClass(Tree, [{ key: 'componentWillMount', value: function componentWillMount() { // init checkedTree var _props = this.props, data = _props.data, dataType = _props.dataType; var formatData = this.formatDataIntoTree(data, dataType); this.setState({ checkedTree: this.formatDataIntoCheckedTree(formatData) }); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if (nextProps.data !== this.props.data) { // update checkTree this.isDataUpdate = true; var data = this.formatDataIntoTree(nextProps.data, nextProps.dataType); this.setState({ checkedTree: this.formatDataIntoCheckedTree(data) }); } } }, { key: 'formatDataIntoTree', value: function formatDataIntoTree(data, dataType) { var roots = []; if (dataType === 'plain') { var isRoot = this.props.isRoot; var map = {}; data.forEach(function (node) { if (!node.isLeaf) { node.children = []; } map[node.id] = node; }); Object.keys(map).forEach(function (key) { var node = map[key]; var isRootNode = isRoot && isRoot(node) || node.parentId === 0 || node.parentId === undefined || node.parentId === '0'; if (isRootNode) { roots.push(node); } else if (map[node.parentId]) { // 防止只删除父节点没有子节点的情况 map[node.parentId].children.push(node); } }); } else if (dataType === 'tree') { roots = data; } else { // console.error(`The dataType should be declared as plain/tree, but your dataType is ${dataType}, Please check your config.`) } return roots; } }, { key: 'formatDataIntoCheckedTree', value: function formatDataIntoCheckedTree(data) { var checkedTree = {}; if (this.isInitial) { checkedTree = this.initialCheckedTree(data); this.isInitial = false; } else if (this.isDataUpdate) { checkedTree = this.reloadCheckedTree(data); this.isDataUpdate = false; } this.updateWholeCheckedTree(checkedTree); return checkedTree; } }, { key: 'isSwitcherExpanded', value: function isSwitcherExpanded(node) { return !node.parentNode.classList.contains('off'); } }, { key: 'handleExpandClick', value: function handleExpandClick(root, e) { var _this2 = this; var loadMore = this.props.loadMore; if (loadMore) { if (!root.children || root.children.length === 0) { e.persist(); loadMore(root).then(function () { _this2.handleFoldClick(root, e); })['catch'](function () {}); return; } } this.handleFoldClick(root, e); } }, { key: 'handleFoldClick', value: function handleFoldClick(root, e) { if (!isTriggerSlide) { var onExpand = this.props.onExpand; var switcher = e.target; var elp = switcher.parentNode; elp.classList.toggle('off'); var isClose = !this.isSwitcherExpanded(switcher); if (onExpand) { onExpand(root, { isExpanded: !isClose }); } var el = elp.nextSibling; // no content, unmount switcher if (!el) { switcher.remove(); return; } isTriggerSlide = true; toggleSlide(el, isClose); } } }, { key: 'triggerSwitcherClick', value: function triggerSwitcherClick(root, e) { var _props2 = this.props, autoExpandOnSelect = _props2.autoExpandOnSelect, onSelect = _props2.onSelect; var target = e.currentTarget; if (onSelect) { onSelect(root, target); } if (target && autoExpandOnSelect) { var switcher = target.parentNode.previousSibling; if (switcher) { switcher.click(); } } } }, { key: 'handleCheckboxClick', value: function handleCheckboxClick(root) { var onCheck = this.props.onCheck; var checkedTree = this.state.checkedTree; this.updateCheckedTree(root.id, checkedTree[root.id].t !== 2 ? 2 : 0); if (onCheck) { onCheck(Object.keys(checkedTree).filter(function (k) { return checkedTree[k].t === 2; }).map(function (x) { if (typeof root.id === 'number') { x = +x; } return x; })); } } }, { key: 'updateUpstream', value: function updateUpstream(id, type, checkedTree) { if (!id) return; if (type === 2) { checkedTree[id].t = Object.keys(checkedTree).filter(function (x) { return checkedTree[x].p === id; }).every(function (x) { return checkedTree[x].t === 2; }) ? 2 : 1; } else if (type === 1) { checkedTree[id].t = 1; } else if (type === 0) { checkedTree[id].t = Object.keys(checkedTree).filter(function (x) { return checkedTree[x].p === id; }).every(function (x) { return checkedTree[x].t === 0; }) ? 0 : 1; } if (checkedTree[id].p) { this.updateUpstream(checkedTree[id].p, checkedTree[id].t, checkedTree); } } }, { key: 'updateDownstream', value: function updateDownstream(id, type, checkedTree) { var _this3 = this; if (!id) return; checkedTree[id].t = type; var childrenId = Object.keys(checkedTree).filter(function (x) { return checkedTree[x].p === id; }); if (childrenId.length > 0) { childrenId.forEach(function (childId) { _this3.updateDownstream(childId, type, checkedTree); }); } } }, { key: 'updateCheckedTree', value: function updateCheckedTree(id, type) { var _this4 = this; var checkedTree = this.state.checkedTree; var parentId = checkedTree[id].p; var childrenId = Object.keys(checkedTree).filter(function (x) { return checkedTree[x].p === id.toString(); }); checkedTree[id].t = type; this.updateUpstream(parentId, type, checkedTree); childrenId.forEach(function (childId) { _this4.updateDownstream(childId, type, checkedTree); }); this.setState({ checkedTree: checkedTree }); } }, { key: 'updateCheckedTreeRecursive', value: function updateCheckedTreeRecursive(root, parentId, func) { var _this5 = this; func(root, parentId); if (root.children && root.children.length > 0) { root.children.forEach(function (child) { _this5.updateCheckedTreeRecursive(child, root.id, func); }); } } }, { key: 'updateWholeCheckedTree', value: function updateWholeCheckedTree(checkedTree) { var _this6 = this; Object.keys(checkedTree).forEach(function (id) { if (checkedTree[id].t === 2) { _this6.updateUpstream(id, 2, checkedTree); _this6.updateDownstream(id, 2, checkedTree); } }); } }, { key: 'initialCheckedTree', value: function initialCheckedTree(data) { var _this7 = this; var newCheckedTree = {}; var defaultCheckedKeys = this.props.defaultCheckedKeys; data.forEach(function (tree) { _this7.updateCheckedTreeRecursive(tree, '', function (root, parentId) { var isSetDefault = defaultCheckedKeys && defaultCheckedKeys.find(function (x) { return x === root.id; }) >= 0; newCheckedTree[root.id] = { p: parentId.toString(), t: isSetDefault ? 2 : 0 }; }); }); return newCheckedTree; } }, { key: 'reloadCheckedTree', value: function reloadCheckedTree(data) { var _this8 = this; var newCheckedTree = {}; var checkedTree = this.state.checkedTree; data.forEach(function (tree) { _this8.updateCheckedTreeRecursive(tree, '', function (root, parentId) { newCheckedTree[root.id] = { p: parentId.toString(), t: checkedTree[root.id] ? checkedTree[root.id].t : 0 }; }); }); return newCheckedTree; } }, { key: 'renderSwitcher', value: function renderSwitcher(root) { var _props3 = this.props, foldable = _props3.foldable, loadMore = _props3.loadMore; var className = (0, _classnames3['default'])('switcher'); if (!root.isLeaf && (loadMore || root.children && root.children.length > 0)) { return _react2['default'].createElement('icon', { className: className, onClick: foldable && this.handleExpandClick.bind(this, root) }); } } }, { key: 'renderCheckbox', value: function renderCheckbox(root) { var _props4 = this.props, checkable = _props4.checkable, disabledCheckedKeys = _props4.disabledCheckedKeys; var isDisabled = (disabledCheckedKeys || []).find(function (key) { return key === root.id; }) >= 0; if (checkable) { return _react2['default'].createElement(_Checkbox2['default'], { onCheck: this.handleCheckboxClick.bind(this, root), type: this.state.checkedTree[root.id].t, disabled: isDisabled }); } } }, { key: 'renderOperations', value: function renderOperations(root) { var opts = this.props.operations; if (opts) { var optNodes = opts.map(function (opt) { var shouldRender = opt.shouldRender || function () { return true; }; return shouldRender(root) && _react2['default'].createElement( 'span', { key: opt.name + '-' + root.id, onClick: opt.action.bind(null, root), className: 'opt' }, _react2['default'].createElement('icon', { className: opt.icon }), opt.name ); }); return _react2['default'].createElement( 'div', { className: 'operation' }, optNodes ); } } // TODO: // Support selectable // Support disable select // Custom switcher // Add Cursor Style // make style beautiful }, { key: 'renderTreeNodes', value: function renderTreeNodes(roots) { var _this9 = this; var _props5 = this.props, loadMore = _props5.loadMore, prefix = _props5.prefix, expandAll = _props5.expandAll; if (roots && roots.length > 0) { return roots.map(function (root) { // 单独节点的expand属性具有最高优先级,如果expand没有设置会根据是否设置loadMore // 来判断是否收起,因为需要loadMore的节点是没有内容的,需要收起。在以上情况都不发生 // 的情况下以expandAll为准 var isShowChildren = expandAll; if (loadMore) { isShowChildren = root.expand; } var barClassName = (0, _classnames3['default'])(prefix + '-tree-bar', { off: !isShowChildren }); return _react2['default'].createElement( 'li', { key: '' + root.id }, _react2['default'].createElement( 'div', { className: barClassName }, _this9.renderSwitcher(root), _react2['default'].createElement( 'div', { className: 'zent-tree-node' }, _this9.renderCheckbox(root), _react2['default'].createElement( 'span', { className: 'content', onClick: _this9.triggerSwitcherClick.bind(_this9, root) }, _this9.props.render ? _this9.props.render(root) : root.title ), _this9.renderOperations(root) ) ), root.children && root.children.length > 0 && _react2['default'].createElement( 'ul', { key: 'ul-' + root.id, className: prefix + '-tree-child', style: isShowChildren ? {} : { display: 'none' } }, _this9.renderTreeNodes(root.children) ) ); }); } } }, { key: 'render', value: function render() { var _props6 = this.props, commonStyle = _props6.commonStyle, data = _props6.data, dataType = _props6.dataType, prefix = _props6.prefix, size = _props6.size; var roots = this.formatDataIntoTree(deepClone(data), dataType); var treeNodes = this.renderTreeNodes(roots); var classNames = (0, _classnames3['default'])(prefix + '-tree', _defineProperty({}, prefix + '-tree-' + size, size !== 'medium')); return _react2['default'].createElement( 'ul', { className: classNames, style: commonStyle }, treeNodes ); } }]); return Tree; }(_react.Component), _class.propTypes = { dataType: _react.PropTypes.oneOf(['plain', 'tree']), data: _react.PropTypes.arrayOf(_react.PropTypes.object), isRoot: _react.PropTypes.func, loadMore: _react.PropTypes.func, foldable: _react.PropTypes.bool, checkable: _react.PropTypes.bool, autoExpandOnSelect: _react.PropTypes.bool, defaultCheckedKeys: _react.PropTypes.arrayOf(_react.PropTypes.any), disabledCheckedKeys: _react.PropTypes.arrayOf(_react.PropTypes.any), onCheck: _react.PropTypes.func, onExpand: _react.PropTypes.func, onSelect: _react.PropTypes.func, size: _react.PropTypes.oneOf(['large', 'medium', 'small']), operations: _react.PropTypes.arrayOf(_react.PropTypes.object), render: _react.PropTypes.func, prefix: _react.PropTypes.string }, _class.defaultProps = { autoExpandOnSelect: true, dataType: 'tree', foldable: true, checkable: false, size: 'medium', prefix: 'zent' }, _temp); exports['default'] = Tree; module.exports = exports['default']; /***/ }, /* 2 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_2__; /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; /* DO NOT EDIT!! Auto genetated wrapper for lodash/assign. */ var assign = __webpack_require__(4); module.exports = assign; /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var assignValue = __webpack_require__(5), copyObject = __webpack_require__(23), createAssigner = __webpack_require__(24), isArrayLike = __webpack_require__(34), isPrototype = __webpack_require__(37), keys = __webpack_require__(38); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Assigns own enumerable string keyed properties of source objects to the * destination object. Source objects are applied from left to right. * Subsequent sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ * @since 0.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.assignIn * @example * * function Foo() { * this.a = 1; * } * * function Bar() { * this.c = 3; * } * * Foo.prototype.b = 2; * Bar.prototype.d = 4; * * _.assign({ 'a': 0 }, new Foo, new Bar); * // => { 'a': 1, 'c': 3 } */ var assign = createAssigner(function (object, source) { if (isPrototype(source) || isArrayLike(source)) { copyObject(source, keys(source), object); return; } for (var key in source) { if (hasOwnProperty.call(source, key)) { assignValue(object, key, source[key]); } } }); module.exports = assign; /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var baseAssignValue = __webpack_require__(6), eq = __webpack_require__(22); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) { baseAssignValue(object, key, value); } } module.exports = assignValue; /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var defineProperty = __webpack_require__(7); /** * The base implementation of `assignValue` and `assignMergeValue` without * value checks. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function baseAssignValue(object, key, value) { if (key == '__proto__' && defineProperty) { defineProperty(object, key, { 'configurable': true, 'enumerable': true, 'value': value, 'writable': true }); } else { object[key] = value; } } module.exports = baseAssignValue; /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var getNative = __webpack_require__(8); var defineProperty = function () { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }(); module.exports = defineProperty; /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var baseIsNative = __webpack_require__(9), getValue = __webpack_require__(21); /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } module.exports = getNative; /***/ }, /* 9 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var isFunction = __webpack_require__(10), isMasked = __webpack_require__(18), isObject = __webpack_require__(17), toSource = __webpack_require__(20); /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used for built-in method references. */ var funcProto = Function.prototype, objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } module.exports = baseIsNative; /***/ }, /* 10 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var baseGetTag = __webpack_require__(11), isObject = __webpack_require__(17); /** `Object#toString` result references. */ var asyncTag = '[object AsyncFunction]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', proxyTag = '[object Proxy]'; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } module.exports = isFunction; /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _Symbol = __webpack_require__(12), getRawTag = __webpack_require__(15), objectToString = __webpack_require__(16); /** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]'; /** Built-in value references. */ var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); } module.exports = baseGetTag; /***/ }, /* 12 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var root = __webpack_require__(13); /** Built-in value references. */ var _Symbol = root.Symbol; module.exports = _Symbol; /***/ }, /* 13 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var freeGlobal = __webpack_require__(14); /** Detect free variable `self`. */ var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); module.exports = root; /***/ }, /* 14 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** Detect free variable `global` from Node.js. */ var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global; module.exports = freeGlobal; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _Symbol = __webpack_require__(12); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Built-in value references. */ var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } module.exports = getRawTag; /***/ }, /* 16 */ /***/ function(module, exports) { "use strict"; /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } module.exports = objectToString; /***/ }, /* 17 */ /***/ function(module, exports) { 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); return value != null && (type == 'object' || type == 'function'); } module.exports = isObject; /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var coreJsData = __webpack_require__(19); /** Used to detect methods masquerading as native. */ var maskSrcKey = function () { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? 'Symbol(src)_1.' + uid : ''; }(); /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } module.exports = isMasked; /***/ }, /* 19 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var root = __webpack_require__(13); /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; module.exports = coreJsData; /***/ }, /* 20 */ /***/ function(module, exports) { 'use strict'; /** Used for built-in method references. */ var funcProto = Function.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** * Converts `func` to its source code. * * @private * @param {Function} func The function to convert. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return func + ''; } catch (e) {} } return ''; } module.exports = toSource; /***/ }, /* 21 */ /***/ function(module, exports) { "use strict"; /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } module.exports = getValue; /***/ }, /* 22 */ /***/ function(module, exports) { "use strict"; /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || value !== value && other !== other; } module.exports = eq; /***/ }, /* 23 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var assignValue = __webpack_require__(5), baseAssignValue = __webpack_require__(6); /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; if (newValue === undefined) { newValue = source[key]; } if (isNew) { baseAssignValue(object, key, newValue); } else { assignValue(object, key, newValue); } } return object; } module.exports = copyObject; /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var baseRest = __webpack_require__(25), isIterateeCall = __webpack_require__(33); /** * Creates a function like `_.assign`. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return baseRest(function (object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } module.exports = createAssigner; /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var identity = __webpack_require__(26), overRest = __webpack_require__(27), setToString = __webpack_require__(29); /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. */ function baseRest(func, start) { return setToString(overRest(func, start, identity), func + ''); } module.exports = baseRest; /***/ }, /* 26 */ /***/ function(module, exports) { "use strict"; /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } module.exports = identity; /***/ }, /* 27 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var apply = __webpack_require__(28); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; /** * A specialized version of `baseRest` which transforms the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @param {Function} transform The rest array transform. * @returns {Function} Returns the new function. */ function overRest(func, start, transform) { start = nativeMax(start === undefined ? func.length - 1 : start, 0); return function () { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform(array); return apply(func, this, otherArgs); }; } module.exports = overRest; /***/ }, /* 28 */ /***/ function(module, exports) { "use strict"; /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } module.exports = apply; /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var baseSetToString = __webpack_require__(30), shortOut = __webpack_require__(32); /** * Sets the `toString` method of `func` to return `string`. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var setToString = shortOut(baseSetToString); module.exports = setToString; /***/ }, /* 30 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var constant = __webpack_require__(31), defineProperty = __webpack_require__(7), identity = __webpack_require__(26); /** * The base implementation of `setToString` without support for hot loop shorting. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var baseSetToString = !defineProperty ? identity : function (func, string) { return defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': constant(string), 'writable': true }); }; module.exports = baseSetToString; /***/ }, /* 31 */ /***/ function(module, exports) { "use strict"; /** * Creates a function that returns `value`. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new constant function. * @example * * var objects = _.times(2, _.constant({ 'a': 1 })); * * console.log(objects); * // => [{ 'a': 1 }, { 'a': 1 }] * * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { return function () { return value; }; } module.exports = constant; /***/ }, /* 32 */ /***/ function(module, exports) { "use strict"; /** Used to detect hot functions by number of calls within a span of milliseconds. */ var HOT_COUNT = 800, HOT_SPAN = 16; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeNow = Date.now; /** * Creates a function that'll short out and invoke `identity` instead * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` * milliseconds. * * @private * @param {Function} func The function to restrict. * @returns {Function} Returns the new shortable function. */ function shortOut(func) { var count = 0, lastCalled = 0; return function () { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return arguments[0]; } } else { count = 0; } return func.apply(undefined, arguments); }; } module.exports = shortOut; /***/ }, /* 33 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var eq = __webpack_require__(22), isArrayLike = __webpack_require__(34), isIndex = __webpack_require__(36), isObject = __webpack_require__(17); /** * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, * else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index === 'undefined' ? 'undefined' : _typeof(index); if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) { return eq(object[index], value); } return false; } module.exports = isIterateeCall; /***/ }, /* 34 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var isFunction = __webpack_require__(10), isLength = __webpack_require__(35); /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } module.exports = isArrayLike; /***/ }, /* 35 */ /***/ function(module, exports) { 'use strict'; /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } module.exports = isLength; /***/ }, /* 36 */ /***/ function(module, exports) { 'use strict'; /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length; } module.exports = isIndex; /***/ }, /* 37 */ /***/ function(module, exports) { 'use strict'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = typeof Ctor == 'function' && Ctor.prototype || objectProto; return value === proto; } module.exports = isPrototype; /***/ }, /* 38 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var arrayLikeKeys = __webpack_require__(39), baseKeys = __webpack_require__(52), isArrayLike = __webpack_require__(34); /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * th