UNPKG

zent

Version:

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

1,803 lines (1,488 loc) 280 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof define === 'function' && define.amd) define(["react", "react-dom"], factory); else if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react"), require("react-dom")); else if(typeof exports === 'object') exports["zent-table"] = factory(require("react"), require("react-dom")); else root["zent-table"] = factory(root["React"], root["ReactDOM"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__) { 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 _Table = __webpack_require__(2); var _Table2 = _interopRequireDefault(_Table); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = _Table2['default']; module.exports = exports['default']; /***/ }, /* 2 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(3); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(4); var _reactDom2 = _interopRequireDefault(_reactDom); var _Head = __webpack_require__(5); var _Head2 = _interopRequireDefault(_Head); var _Body = __webpack_require__(71); var _Body2 = _interopRequireDefault(_Body); var _zentPagination = __webpack_require__(73); var _zentPagination2 = _interopRequireDefault(_zentPagination); var _zentLoading = __webpack_require__(199); var _zentLoading2 = _interopRequireDefault(_zentLoading); var _isBrowser = __webpack_require__(201); var _isBrowser2 = _interopRequireDefault(_isBrowser); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _React$PropTypes = _react2['default'].PropTypes, func = _React$PropTypes.func, bool = _React$PropTypes.bool, string = _React$PropTypes.string, array = _React$PropTypes.array, oneOf = _React$PropTypes.oneOf, object = _React$PropTypes.object; var relativeTop = void 0; var Table = _react2['default'].createClass({ displayName: 'Table', propTypes: { className: string, prefix: string, columns: array, datasets: array, onChange: func, sortBy: string, sortType: oneOf(['desc', 'asc']), pageInfo: object, rowKey: string, loading: bool, autoScroll: bool, autoStick: bool, selection: object }, getDefaultProps: function getDefaultProps() { return { prefix: 'zent', pageSize: 10, className: '', datasets: [], columns: [], emptyLabel: '没有更多数据了', rowKey: 'id', sortType: 'desc', loading: false, autoScroll: false, autoStick: false, selection: null }; }, getInitialState: function getInitialState() { return { current: this.props.pageInfo ? this.props.pageInfo.current : 1, placeHolderHeight: false, fixStyle: {} }; }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { this.setState({ current: nextProps.pageInfo ? nextProps.pageInfo.current : 1 }); }, componentDidMount: function componentDidMount() { var tableRectTop = _reactDom2['default'].findDOMNode(this).getBoundingClientRect().top; relativeTop = tableRectTop - document.body.getBoundingClientRect().top; }, // 对外部传进来的onChange进行封装 wrapPropsOnChange: function wrapPropsOnChange(conf) { if (typeof this.props.onChange !== 'function') { throw new Error('请传入一个onChange方法'); } this.props.onChange(conf); }, onChange: function onChange(conf) { this.setState(conf); this.wrapPropsOnChange(conf); }, onSort: function onSort(conf) { // 排序的时候也要触发 this.wrapPropsOnChange(conf); }, onPageChange: function onPageChange(current) { this.wrapPropsOnChange({ current: current }); if (this.props.autoScroll) { this.scrollToTop(400); } }, /* * Head上的选中会全选所有的行 * @param isSelect {Boolean} 表示是否全选 */ onSelectAllRows: function onSelectAllRows(isSelect) { var allRowKeys = []; var allRows = []; var _props = this.props, rowKey = _props.rowKey, datasets = _props.datasets, selection = _props.selection, _props$getRowConf = _props.getRowConf, getRowConf = _props$getRowConf === undefined ? function () { return { canSelect: true }; } : _props$getRowConf; if (isSelect) { // 找出所有canSelect为true的row,才能选中 for (var i = 0, len = datasets.length; i < len; i++) { var _getRowConf = getRowConf(datasets[i], i), _getRowConf$canSelect = _getRowConf.canSelect, canSelect = _getRowConf$canSelect === undefined ? true : _getRowConf$canSelect; if (canSelect) { allRowKeys.push(datasets[i][rowKey]); allRows.push(datasets[i]); } } } selection.onSelect(allRowKeys, allRows); }, /** * 选了一行 * @param rowKey {String} 某一行的key * @param isSelect {Boolean} 是否被选中 */ onSelectOneRow: function onSelectOneRow(rowKey, isSelect) { var selectedRowKeys = this.props.selection.selectedRowKeys.slice(0); // copy 一份数组 var index = selectedRowKeys.indexOf(rowKey); if (isSelect) { if (index === -1) { selectedRowKeys.push(rowKey); } } else { if (index !== -1) { selectedRowKeys.splice(index, 1); } } var selectedRows = this.getSelectedRowsByKeys(selectedRowKeys); this.props.selection.onSelect(selectedRowKeys, selectedRows); }, /** * 根据选择的keys拼装一个选好的列 * @param rowKeys Array 一个keys的数组 * @return rows Array 一个每行的数据的数组 */ getSelectedRowsByKeys: function getSelectedRowsByKeys(rowKeys) { var rows = []; var self = this; this.props.datasets.forEach(function (item) { if (rowKeys.indexOf(item[self.props.rowKey]) >= 0) { rows.push(item); } }); return rows; }, scrollToTop: function scrollToTop(scrollDuration) { if (!_isBrowser2['default']) return; var scrollHeight = window.scrollY; var scrollStep = Math.PI / (scrollDuration / 15); var cosParameter = scrollHeight / 2; var scrollCount = 0; var scrollMargin = void 0; var scrollInterval = setInterval(function () { if (window.scrollY > relativeTop) { scrollCount = scrollCount + 1; scrollMargin = cosParameter - cosParameter * Math.cos(scrollCount * scrollStep); window.scrollTo(0, scrollHeight - scrollMargin); } else { clearInterval(scrollInterval); } }, 15); }, render: function render() { var _this = this; var _props2 = this.props, selection = _props2.selection, prefix = _props2.prefix, columns = _props2.columns, className = _props2.className, sortBy = _props2.sortBy, autoStick = _props2.autoStick, sortType = _props2.sortType, datasets = _props2.datasets, rowKey = _props2.rowKey, pageInfo = _props2.pageInfo, emptyLabel = _props2.emptyLabel, _props2$getRowConf = _props2.getRowConf, getRowConf = _props2$getRowConf === undefined ? function () { return { canSelect: true, rowClass: '' }; } : _props2$getRowConf; var needSelect = selection !== null; var selectedRowKeys = []; var isSelectAll = false; var isSelectPart = false; if (needSelect) { var canSelectRowsCount = 0; datasets.forEach(function (item, index) { var _getRowConf2 = getRowConf(item, index), _getRowConf2$canSelec = _getRowConf2.canSelect, canSelect = _getRowConf2$canSelec === undefined ? true : _getRowConf2$canSelec; if (canSelect) { canSelectRowsCount += 1; } }); isSelectAll = canSelectRowsCount > 0 && selection.selectedRowKeys.length === canSelectRowsCount; isSelectPart = canSelectRowsCount > 0 && selection.selectedRowKeys.length > 0 && !isSelectAll; selectedRowKeys = selection.selectedRowKeys; } return _react2['default'].createElement( 'div', { className: prefix + '-table-container' }, _react2['default'].createElement( _zentLoading2['default'], { show: this.props.loading, 'static': true }, columns && _react2['default'].createElement( 'div', { className: prefix + '-table ' + className }, this.state.placeHolderHeight && _react2['default'].createElement( 'div', { className: 'thead place-holder' }, _react2['default'].createElement( 'div', { className: 'tr' }, this.cloneHeaderContent() ) ), _react2['default'].createElement(_Head2['default'], { ref: function ref(c) { return _this.head = c; }, columns: columns, sortBy: sortBy, sortType: sortType, onSort: this.onSort, selection: { needSelect: needSelect, onSelectAll: this.onSelectAllRows, isSelectAll: isSelectAll, isSelectPart: isSelectPart }, autoStick: autoStick, style: this.state.fixStyle }), _react2['default'].createElement(_Body2['default'], { datasets: datasets, columns: columns, emptyLabel: emptyLabel, rowKey: rowKey, getRowConf: getRowConf, selection: { needSelect: needSelect, selectedRowKeys: selectedRowKeys, onSelect: this.onSelectOneRow } }) ) ), pageInfo && _react2['default'].createElement(_zentPagination2['default'], { current: this.state.current, totalItem: pageInfo.total, pageSize: pageInfo.limit, maxPageToShow: pageInfo.maxPageToShow, onChange: this.onPageChange }) ); } }); exports['default'] = Table; module.exports = exports['default']; /***/ }, /* 3 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }, /* 4 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_4__; /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(3); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(4); var _reactDom2 = _interopRequireDefault(_reactDom); var _throttle = __webpack_require__(6); var _throttle2 = _interopRequireDefault(_throttle); var _helper = __webpack_require__(20); var _helper2 = _interopRequireDefault(_helper); var _assign = __webpack_require__(21); var _assign2 = _interopRequireDefault(_assign); var _zentCheckbox = __webpack_require__(65); var _zentCheckbox2 = _interopRequireDefault(_zentCheckbox); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var rect = void 0; var relativeTop = void 0; var stickRowClass = 'stickrow'; var fixRowClass = 'fixrow'; var Head = _react2['default'].createClass({ displayName: 'Head', getInitialState: function getInitialState() { return { isShowFixRow: false }; }, componentDidMount: function componentDidMount() { if (this.props.autoStick) { this.throttleSetHeadStyle = (0, _throttle2['default'])(this.setHeadStyle, 100, { leading: true }); window.addEventListener('scroll', this.throttleSetHeadStyle, true); window.addEventListener('resize', this.throttleSetHeadStyle, true); } }, componentWillUnmount: function componentWillUnmount() { if (this.props.autoStick) { window.removeEventListener('scroll', this.throttleSetHeadStyle, true); window.removeEventListener('resize', this.throttleSetHeadStyle, true); } }, getRect: function getRect() { // clientrect can't be clone var tmpRect = _reactDom2['default'].findDOMNode(this).getBoundingClientRect(); rect = { top: tmpRect.top, height: tmpRect.height - 1, width: tmpRect.width }; relativeTop = rect.top - document.body.getBoundingClientRect().top; }, setHeadStyle: function setHeadStyle() { this.getRect(); if (window.scrollY > relativeTop) { this.setState({ isShowFixRow: true, fixStyle: { position: 'fixed', top: 0, left: rect.left + 'px', height: rect.height + 'px', width: rect.width + 'px', zIndex: 1000 } }); } else { this.setState({ isShowFixRow: false, fixStyle: {} }); } }, getChild: function getChild(item) { if (item.needSort) { return _react2['default'].createElement( 'a', { onClick: this.sort.bind(this, item) }, item.title, item.name === this.props.sortBy && _react2['default'].createElement('span', { className: this.props.sortType }) ); } return item.title; }, sort: function sort(item) { var sortType = void 0; var name = item.name; if (name === this.props.sortBy) { sortType = this.props.sortType === 'desc' ? 'asc' : 'desc'; // toggble current sortType } else { sortType = 'desc'; // desc sort by default } this.props.onSort({ sortBy: name, sortType: sortType }); }, onSelect: function onSelect(e) { var isChecked = false; if (e.target.checked) { isChecked = true; } this.props.selection.onSelectAll(isChecked); }, renderTr: function renderTr(isFixTr) { var _this = this; var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var selection = this.props.selection; var needSelect = selection.needSelect; var className = isFixTr ? fixRowClass : stickRowClass; return _react2['default'].createElement( 'div', { className: className + ' tr', style: style, ref: function ref(c) { _this[className] = c; } }, this.props.columns.map(function (item, index) { var cellClass = 'cell'; var isMoney = item.isMoney, textAlign = item.textAlign, width = item.width; if (index === 0 && needSelect) { cellClass += ' cell--selection'; } if (isMoney) { cellClass += ' cell--money'; } width = _helper2['default'].getCalculatedWidth(width); var styleObj = {}; if (width) { styleObj = { width: width, flex: '0 1 auto' }; } if (textAlign) { if (['left', 'center', 'right'].indexOf(textAlign)) { styleObj = (0, _assign2['default'])(styleObj, { textAlign: textAlign }); } } return _react2['default'].createElement( 'div', { key: index, className: cellClass, style: styleObj }, index === 0 && needSelect && _react2['default'].createElement(_zentCheckbox2['default'], { className: 'select-check', onChange: _this.onSelect, checked: selection.isSelectAll, indeterminate: selection.isSelectPart }), _this.getChild(item) ); }) ); }, render: function render() { var style = this.props.style; var _state = this.state, isShowFixRow = _state.isShowFixRow, fixStyle = _state.fixStyle; return _react2['default'].createElement( 'div', { className: 'thead', style: style }, this.renderTr(false), isShowFixRow && this.renderTr(true, fixStyle) ); } }); exports['default'] = Head; module.exports = exports['default']; /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; /* DO NOT EDIT!! Auto genetated wrapper for lodash/throttle. */ var throttle = __webpack_require__(7); module.exports = throttle; /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var debounce = __webpack_require__(8), isObject = __webpack_require__(9); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to * immediately invoke them. Provide `options` to indicate whether `func` * should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the throttled function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to throttle. * @param {number} [wait=0] The number of milliseconds to throttle invocations to. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=true] * Specify invoking on the leading edge of the timeout. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * * // Avoid excessively updating the position while scrolling. * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); * * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); * jQuery(element).on('click', throttled); * * // Cancel the trailing throttled invocation. * jQuery(window).on('popstate', throttled.cancel); */ function throttle(func, wait, options) { var leading = true, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (isObject(options)) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); } module.exports = throttle; /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var isObject = __webpack_require__(9), now = __webpack_require__(10), toNumber = __webpack_require__(13); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max, nativeMin = Math.min; /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide `options` to indicate whether `func` should be invoked on the * leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent * calls to the debounced function return the result of the last `func` * invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=false] * Specify invoking on the leading edge of the timeout. * @param {number} [options.maxWait] * The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; maxing = 'maxWait' in options; maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, result = wait - timeSinceLastCall; return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; } function timerExpired() { var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { if (timerId !== undefined) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { return timerId === undefined ? result : trailingEdge(now()); } function debounced() { var time = now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } module.exports = debounce; /***/ }, /* 9 */ /***/ 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; /***/ }, /* 10 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var root = __webpack_require__(11); /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @since 2.4.0 * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => Logs the number of milliseconds it took for the deferred invocation. */ var now = function now() { return root.Date.now(); }; module.exports = now; /***/ }, /* 11 */ /***/ 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__(12); /** 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; /***/ }, /* 12 */ /***/ 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; }()))) /***/ }, /* 13 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var isObject = __webpack_require__(9), isSymbol = __webpack_require__(14); /** Used as references for various `Number` constants. */ var NAN = 0 / 0; /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? other + '' : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; } module.exports = toNumber; /***/ }, /* 14 */ /***/ 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 baseGetTag = __webpack_require__(15), isObjectLike = __webpack_require__(19); /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag; } module.exports = isSymbol; /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _Symbol = __webpack_require__(16), getRawTag = __webpack_require__(17), objectToString = __webpack_require__(18); /** `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; /***/ }, /* 16 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var root = __webpack_require__(11); /** Built-in value references. */ var _Symbol = root.Symbol; module.exports = _Symbol; /***/ }, /* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _Symbol = __webpack_require__(16); /** 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; /***/ }, /* 18 */ /***/ 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; /***/ }, /* 19 */ /***/ 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 object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object'; } module.exports = isObjectLike; /***/ }, /* 20 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var helper = { getCalculatedWidth: function getCalculatedWidth(width) { var res = void 0; if (typeof width === 'number') { res = width + '%'; } else if (typeof width === 'string') { res = width; } return res; } }; exports['default'] = helper; module.exports = exports['default']; /***/ }, /* 21 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; /* DO NOT EDIT!! Auto genetated wrapper for lodash/assign. */ var assign = __webpack_require__(22); module.exports = assign; /***/ }, /* 22 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var assignValue = __webpack_require__(23), copyObject = __webpack_require__(34), createAssigner = __webpack_require__(35), isArrayLike = __webpack_require__(45), isPrototype = __webpack_require__(48), keys = __webpack_require__(49); /** 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; /***/ }, /* 23 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var baseAssignValue = __webpack_require__(24), eq = __webpack_require__(33); /** 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; /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var defineProperty = __webpack_require__(25); /** * 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; /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var getNative = __webpack_require__(26); var defineProperty = function () { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }(); module.exports = defineProperty; /***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var baseIsNative = __webpack_require__(27), getValue = __webpack_require__(32); /** * 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; /***/ }, /* 27 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var isFunction = __webpack_require__(28), isMasked = __webpack_require__(29), isObject = __webpack_require__(9), toSource = __webpack_require__(31); /** * 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; /***/ }, /* 28 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var baseGetTag = __webpack_require__(15), isObject = __webpack_require__(9); /** `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; /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var coreJsData = __webpack_require__(30); /** 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; /***/ }, /* 30 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var root = __webpack_require__(11); /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; module.exports = coreJsData; /***/ }, /* 31 */ /***/ 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; /***/ }, /* 32 */ /***/ 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; /***/ }, /* 33 */ /***/ 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; /***/ }, /* 34 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var assignValue = __webpack_require__(23), baseAssignValue = __webpack_require__(24); /** * 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; /***/ }, /* 35 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var baseRest = __webpack_require__(36), isIterateeCall = __webpack_require__(44); /** * 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) : undefin