var Walkontable = /******/ (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; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // 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 = 147); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3) , core = __webpack_require__(26) , hide = __webpack_require__(15) , redefine = __webpack_require__(16) , ctx = __webpack_require__(12) , PROTOTYPE = 'prototype'; var $export = function(type, name, source){ var IS_FORCED = type & $export.F , IS_GLOBAL = type & $export.G , IS_STATIC = type & $export.S , IS_PROTO = type & $export.P , IS_BIND = type & $export.B , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE] , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}) , key, own, out, exp; if(IS_GLOBAL)source = name; for(key in source){ // contains in native own = !IS_FORCED && target && target[key] !== undefined; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // extend global if(target)redefine(target, key, out, type & $export.U); // export if(exports[key] != out)hide(exports, key, exp); if(IS_PROTO && expProto[key] != out)expProto[key] = out; } }; global.core = core; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` module.exports = $export; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { var store = __webpack_require__(55)('wks') , uid = __webpack_require__(31) , Symbol = __webpack_require__(3).Symbol , USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function(name){ return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; $exports.store = store; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.HTML_CHARACTERS = undefined; exports.getParent = getParent; exports.closest = closest; exports.closestDown = closestDown; exports.isChildOf = isChildOf; exports.isChildOfWebComponentTable = isChildOfWebComponentTable; exports.polymerWrap = polymerWrap; exports.polymerUnwrap = polymerUnwrap; exports.index = index; exports.overlayContainsElement = overlayContainsElement; exports.hasClass = hasClass; exports.addClass = addClass; exports.removeClass = removeClass; exports.removeTextNodes = removeTextNodes; exports.empty = empty; exports.fastInnerHTML = fastInnerHTML; exports.fastInnerText = fastInnerText; exports.isVisible = isVisible; exports.offset = offset; exports.getWindowScrollTop = getWindowScrollTop; exports.getWindowScrollLeft = getWindowScrollLeft; exports.getScrollTop = getScrollTop; exports.getScrollLeft = getScrollLeft; exports.getScrollableElement = getScrollableElement; exports.getTrimmingContainer = getTrimmingContainer; exports.getStyle = getStyle; exports.getComputedStyle = getComputedStyle; exports.outerWidth = outerWidth; exports.outerHeight = outerHeight; exports.innerHeight = innerHeight; exports.innerWidth = innerWidth; exports.addEvent = addEvent; exports.removeEvent = removeEvent; exports.getCaretPosition = getCaretPosition; exports.getSelectionEndPosition = getSelectionEndPosition; exports.getSelectionText = getSelectionText; exports.setCaretPosition = setCaretPosition; exports.getScrollbarWidth = getScrollbarWidth; exports.hasVerticalScrollbar = hasVerticalScrollbar; exports.hasHorizontalScrollbar = hasHorizontalScrollbar; exports.setOverlayPosition = setOverlayPosition; exports.getCssTransform = getCssTransform; exports.resetCssTransform = resetCssTransform; exports.isInput = isInput; exports.isOutsideInput = isOutsideInput; var _browser = __webpack_require__(32); var _feature = __webpack_require__(74); /** * Get the parent of the specified node in the DOM tree. * * @param {HTMLElement} element Element from which traversing is started. * @param {Number} [level=0] Traversing deep level. * @return {HTMLElement|null} */ function getParent(element) { var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var iteration = -1; var parent = null; while (element != null) { if (iteration === level) { parent = element; break; } if (element.host && element.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { element = element.host; } else { iteration++; element = element.parentNode; } } return parent; } /** * Goes up the DOM tree (including given element) until it finds an element that matches the nodes or nodes name. * This method goes up through web components. * * @param {HTMLElement} element Element from which traversing is started * @param {Array} nodes Array of elements or Array of elements name * @param {HTMLElement} [until] * @returns {HTMLElement|null} */ function closest(element, nodes, until) { while (element != null && element !== until) { if (element.nodeType === Node.ELEMENT_NODE && (nodes.indexOf(element.nodeName) > -1 || nodes.indexOf(element) > -1)) { return element; } if (element.host && element.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { element = element.host; } else { element = element.parentNode; } } return null; } /** * Goes "down" the DOM tree (including given element) until it finds an element that matches the nodes or nodes name. * * @param {HTMLElement} element Element from which traversing is started * @param {Array} nodes Array of elements or Array of elements name * @param {HTMLElement} [until] * @returns {HTMLElement|null} */ function closestDown(element, nodes, until) { var matched = []; while (element) { element = closest(element, nodes, until); if (!element || until && !until.contains(element)) { break; } matched.push(element); if (element.host && element.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { element = element.host; } else { element = element.parentNode; } } var length = matched.length; return length ? matched[length - 1] : null; } /** * Goes up the DOM tree and checks if element is child of another element. * * @param child Child element * @param {Object|String} parent Parent element OR selector of the parent element. * If string provided, function returns `true` for the first occurrence of element with that class. * @returns {Boolean} */ function isChildOf(child, parent) { var node = child.parentNode; var queriedParents = []; if (typeof parent === 'string') { queriedParents = Array.prototype.slice.call(document.querySelectorAll(parent), 0); } else { queriedParents.push(parent); } while (node != null) { if (queriedParents.indexOf(node) > -1) { return true; } node = node.parentNode; } return false; } /** * Check if an element is part of `hot-table` web component. * * @param {Element} element * @returns {Boolean} */ function isChildOfWebComponentTable(element) { var hotTableName = 'hot-table', result = false, parentNode; parentNode = polymerWrap(element); function isHotTable(element) { return element.nodeType === Node.ELEMENT_NODE && element.nodeName === hotTableName.toUpperCase(); } while (parentNode != null) { if (isHotTable(parentNode)) { result = true; break; } else if (parentNode.host && parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { result = isHotTable(parentNode.host); if (result) { break; } parentNode = parentNode.host; } parentNode = parentNode.parentNode; } return result; } /** * Wrap element into polymer/webcomponent container if exists * * @param element * @returns {*} */ function polymerWrap(element) { /* global Polymer */ return typeof Polymer !== 'undefined' && typeof wrap === 'function' ? wrap(element) : element; } /** * Unwrap element from polymer/webcomponent container if exists * * @param element * @returns {*} */ function polymerUnwrap(element) { /* global Polymer */ return typeof Polymer !== 'undefined' && typeof unwrap === 'function' ? unwrap(element) : element; } /** * Counts index of element within its parent * WARNING: for performance reasons, assumes there are only element nodes (no text nodes). This is true for Walkotnable * Otherwise would need to check for nodeType or use previousElementSibling * * @see http://jsperf.com/sibling-index/10 * @param {Element} element * @return {Number} */ function index(element) { var i = 0; if (element.previousSibling) { /* eslint-disable no-cond-assign */ while (element = element.previousSibling) { ++i; } } return i; } /** * Check if the provided overlay contains the provided element * * @param {String} overlay * @param {HTMLElement} element * @returns {boolean} */ function overlayContainsElement(overlayType, element) { var overlayElement = document.querySelector('.ht_clone_' + overlayType); return overlayElement ? overlayElement.contains(element) : null; } var classListSupport = !!document.documentElement.classList; var _hasClass, _addClass, _removeClass; function filterEmptyClassNames(classNames) { var len = 0, result = []; if (!classNames || !classNames.length) { return result; } while (classNames[len]) { result.push(classNames[len]); len++; } return result; } if (classListSupport) { var isSupportMultipleClassesArg = function () { var element = document.createElement('div'); element.classList.add('test', 'test2'); return element.classList.contains('test2'); }(); _hasClass = function _hasClass(element, className) { if (className === '') { return false; } return element.classList.contains(className); }; _addClass = function _addClass(element, className) { var len = 0; if (typeof className === 'string') { className = className.split(' '); } className = filterEmptyClassNames(className); if (isSupportMultipleClassesArg) { element.classList.add.apply(element.classList, className); } else { while (className && className[len]) { element.classList.add(className[len]); len++; } } }; _removeClass = function _removeClass(element, className) { var len = 0; if (typeof className === 'string') { className = className.split(' '); } className = filterEmptyClassNames(className); if (isSupportMultipleClassesArg) { element.classList.remove.apply(element.classList, className); } else { while (className && className[len]) { element.classList.remove(className[len]); len++; } } }; } else { var createClassNameRegExp = function createClassNameRegExp(className) { return new RegExp('(\\s|^)' + className + '(\\s|$)'); }; _hasClass = function _hasClass(element, className) { // http://snipplr.com/view/3561/addclass-removeclass-hasclass/ return !!element.className.match(createClassNameRegExp(className)); }; _addClass = function _addClass(element, className) { var len = 0, _className = element.className; if (typeof className === 'string') { className = className.split(' '); } if (_className === '') { _className = className.join(' '); } else { while (className && className[len]) { if (!createClassNameRegExp(className[len]).test(_className)) { _className += ' ' + className[len]; } len++; } } element.className = _className; }; _removeClass = function _removeClass(element, className) { var len = 0, _className = element.className; if (typeof className === 'string') { className = className.split(' '); } while (className && className[len]) { // String.prototype.trim is defined in polyfill.js _className = _className.replace(createClassNameRegExp(className[len]), ' ').trim(); len++; } if (element.className !== _className) { element.className = _className; } }; } /** * Checks if element has class name * * @param {HTMLElement} element * @param {String} className Class name to check * @returns {Boolean} */ function hasClass(element, className) { return _hasClass(element, className); } /** * Add class name to an element * * @param {HTMLElement} element * @param {String|Array} className Class name as string or array of strings */ function addClass(element, className) { return _addClass(element, className); } /** * Remove class name from an element * * @param {HTMLElement} element * @param {String|Array} className Class name as string or array of strings */ function removeClass(element, className) { return _removeClass(element, className); } function removeTextNodes(element, parent) { if (element.nodeType === 3) { parent.removeChild(element); // bye text nodes! } else if (['TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TR'].indexOf(element.nodeName) > -1) { var childs = element.childNodes; for (var i = childs.length - 1; i >= 0; i--) { removeTextNodes(childs[i], element); } } } /** * Remove childs function * WARNING - this doesn't unload events and data attached by jQuery * http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/9 * http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/11 - no siginificant improvement with Chrome remove() method * * @param element * @returns {void} */ // function empty(element) { var child; /* eslint-disable no-cond-assign */ while (child = element.lastChild) { element.removeChild(child); } } var HTML_CHARACTERS = exports.HTML_CHARACTERS = /(<(.*)>|&(.*);)/; /** * Insert content into element trying avoid innerHTML method. * @return {void} */ function fastInnerHTML(element, content) { if (HTML_CHARACTERS.test(content)) { element.innerHTML = content; } else { fastInnerText(element, content); } } /** * Insert text content into element * @return {void} */ var textContextSupport = !!document.createTextNode('test').textContent; function fastInnerText(element, content) { var child = element.firstChild; if (child && child.nodeType === 3 && child.nextSibling === null) { // fast lane - replace existing text node if (textContextSupport) { // http://jsperf.com/replace-text-vs-reuse child.textContent = content; } else { // http://jsperf.com/replace-text-vs-reuse child.data = content; } } else { // slow lane - empty element and insert a text node empty(element); element.appendChild(document.createTextNode(content)); } } /** * Returns true if element is attached to the DOM and visible, false otherwise * @param elem * @returns {boolean} */ function isVisible(elem) { var next = elem; while (polymerUnwrap(next) !== document.documentElement) { // until reached if (next === null) { // parent detached from DOM return false; } else if (next.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { if (next.host) { // this is Web Components Shadow DOM // see: http://w3c.github.io/webcomponents/spec/shadow/#encapsulation // according to spec, should be if (next.ownerDocument !== window.document), but that doesn't work yet if (next.host.impl) { // Chrome 33.0.1723.0 canary (2013-11-29) Web Platform features disabled return isVisible(next.host.impl); } else if (next.host) { // Chrome 33.0.1723.0 canary (2013-11-29) Web Platform features enabled return isVisible(next.host); } throw new Error('Lost in Web Components world'); } else { return false; // this is a node detached from document in IE8 } } else if (next.style.display === 'none') { return false; } next = next.parentNode; } return true; } /** * Returns elements top and left offset relative to the document. Function is not compatible with jQuery offset. * * @param {HTMLElement} elem * @return {Object} Returns object with `top` and `left` props */ function offset(elem) { var offsetLeft, offsetTop, lastElem, docElem, box; docElem = document.documentElement; if ((0, _feature.hasCaptionProblem)() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') { // fixes problem with Firefox ignoring in TABLE offset (see also export outerHeight) // http://jsperf.com/offset-vs-getboundingclientrect/8 box = elem.getBoundingClientRect(); return { top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0), left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0) }; } offsetLeft = elem.offsetLeft; offsetTop = elem.offsetTop; lastElem = elem; /* eslint-disable no-cond-assign */ while (elem = elem.offsetParent) { // from my observation, document.body always has scrollLeft/scrollTop == 0 if (elem === document.body) { break; } offsetLeft += elem.offsetLeft; offsetTop += elem.offsetTop; lastElem = elem; } // slow - http://jsperf.com/offset-vs-getboundingclientrect/6 if (lastElem && lastElem.style.position === 'fixed') { // if(lastElem !== document.body) { //faster but does gives false positive in Firefox offsetLeft += window.pageXOffset || docElem.scrollLeft; offsetTop += window.pageYOffset || docElem.scrollTop; } return { left: offsetLeft, top: offsetTop }; } /** * Returns the document's scrollTop property. * * @returns {Number} */ function getWindowScrollTop() { var res = window.scrollY; if (res === void 0) { // IE8-11 res = document.documentElement.scrollTop; } return res; } /** * Returns the document's scrollLeft property. * * @returns {Number} */ function getWindowScrollLeft() { var res = window.scrollX; if (res === void 0) { // IE8-11 res = document.documentElement.scrollLeft; } return res; } /** * Returns the provided element's scrollTop property. * * @param element * @returns {Number} */ function getScrollTop(element) { if (element === window) { return getWindowScrollTop(); } return element.scrollTop; } /** * Returns the provided element's scrollLeft property. * * @param element * @returns {Number} */ function getScrollLeft(element) { if (element === window) { return getWindowScrollLeft(); } return element.scrollLeft; } /** * Returns a DOM element responsible for scrolling of the provided element. * * @param {HTMLElement} element * @returns {HTMLElement} Element's scrollable parent */ function getScrollableElement(element) { var el = element.parentNode, props = ['auto', 'scroll'], overflow, overflowX, overflowY, computedStyle = '', computedOverflow = '', computedOverflowY = '', computedOverflowX = ''; while (el && el.style && document.body !== el) { overflow = el.style.overflow; overflowX = el.style.overflowX; overflowY = el.style.overflowY; if (overflow == 'scroll' || overflowX == 'scroll' || overflowY == 'scroll') { return el; } else if (window.getComputedStyle) { computedStyle = window.getComputedStyle(el); computedOverflow = computedStyle.getPropertyValue('overflow'); computedOverflowY = computedStyle.getPropertyValue('overflow-y'); computedOverflowX = computedStyle.getPropertyValue('overflow-x'); if (computedOverflow === 'scroll' || computedOverflowX === 'scroll' || computedOverflowY === 'scroll') { return el; } } if (el.clientHeight <= el.scrollHeight && (props.indexOf(overflowY) !== -1 || props.indexOf(overflow) !== -1 || props.indexOf(computedOverflow) !== -1 || props.indexOf(computedOverflowY) !== -1)) { return el; } if (el.clientWidth <= el.scrollWidth && (props.indexOf(overflowX) !== -1 || props.indexOf(overflow) !== -1 || props.indexOf(computedOverflow) !== -1 || props.indexOf(computedOverflowX) !== -1)) { return el; } el = el.parentNode; } return window; } /** * Returns a DOM element responsible for trimming the provided element. * * @param {HTMLElement} base Base element * @returns {HTMLElement} Base element's trimming parent */ function getTrimmingContainer(base) { var el = base.parentNode; while (el && el.style && document.body !== el) { if (el.style.overflow !== 'visible' && el.style.overflow !== '') { return el; } else if (window.getComputedStyle) { var computedStyle = window.getComputedStyle(el); if (computedStyle.getPropertyValue('overflow') !== 'visible' && computedStyle.getPropertyValue('overflow') !== '') { return el; } } el = el.parentNode; } return window; } /** * Returns a style property for the provided element. (Be it an inline or external style). * * @param {HTMLElement} element * @param {String} prop Wanted property * @returns {String|undefined} Element's style property */ function getStyle(element, prop) { /* eslint-disable */ if (!element) { return; } else if (element === window) { if (prop === 'width') { return window.innerWidth + 'px'; } else if (prop === 'height') { return window.innerHeight + 'px'; } return; } var styleProp = element.style[prop], computedStyle; if (styleProp !== '' && styleProp !== void 0) { return styleProp; } else { computedStyle = getComputedStyle(element); if (computedStyle[prop] !== '' && computedStyle[prop] !== void 0) { return computedStyle[prop]; } } } /** * Returns a computed style object for the provided element. (Needed if style is declared in external stylesheet). * * @param element * @returns {IEElementStyle|CssStyle} Elements computed style object */ function getComputedStyle(element) { return element.currentStyle || document.defaultView.getComputedStyle(element); } /** * Returns the element's outer width. * * @param element * @returns {number} Element's outer width */ function outerWidth(element) { return element.offsetWidth; } /** * Returns the element's outer height * * @param elem * @returns {number} Element's outer height */ function outerHeight(elem) { if ((0, _feature.hasCaptionProblem)() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') { // fixes problem with Firefox ignoring in TABLE.offsetHeight // jQuery (1.10.1) still has this unsolved // may be better to just switch to getBoundingClientRect // http://bililite.com/blog/2009/03/27/finding-the-size-of-a-table/ // http://lists.w3.org/Archives/Public/www-style/2009Oct/0089.html // http://bugs.jquery.com/ticket/2196 // http://lists.w3.org/Archives/Public/www-style/2009Oct/0140.html#start140 return elem.offsetHeight + elem.firstChild.offsetHeight; } return elem.offsetHeight; } /** * Returns the element's inner height. * * @param element * @returns {number} Element's inner height */ function innerHeight(element) { return element.clientHeight || element.innerHeight; } /** * Returns the element's inner width. * * @param element * @returns {number} Element's inner width */ function innerWidth(element) { return element.clientWidth || element.innerWidth; } function addEvent(element, event, callback) { if (window.addEventListener) { element.addEventListener(event, callback, false); } else { element.attachEvent('on' + event, callback); } } function removeEvent(element, event, callback) { if (window.removeEventListener) { element.removeEventListener(event, callback, false); } else { element.detachEvent('on' + event, callback); } } /** * Returns caret position in text input * * @author http://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea * @return {Number} */ function getCaretPosition(el) { if (el.selectionStart) { return el.selectionStart; } else if (document.selection) { // IE8 el.focus(); var r = document.selection.createRange(); if (r == null) { return 0; } var re = el.createTextRange(); var rc = re.duplicate(); re.moveToBookmark(r.getBookmark()); rc.setEndPoint('EndToStart', re); return rc.text.length; } return 0; } /** * Returns end of the selection in text input * * @return {Number} */ function getSelectionEndPosition(el) { if (el.selectionEnd) { return el.selectionEnd; } else if (document.selection) { // IE8 var r = document.selection.createRange(); if (r == null) { return 0; } var re = el.createTextRange(); return re.text.indexOf(r.text) + r.text.length; } return 0; } /** * Returns text under selection. * * @returns {String} */ function getSelectionText() { var text = ''; if (window.getSelection) { text = window.getSelection().toString(); } else if (document.selection && document.selection.type !== 'Control') { text = document.selection.createRange().text; } return text; } /** * Sets caret position in text input. * * @author http://blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/ * @param {Element} element * @param {Number} pos * @param {Number} endPos */ function setCaretPosition(element, pos, endPos) { if (endPos === void 0) { endPos = pos; } if (element.setSelectionRange) { element.focus(); try { element.setSelectionRange(pos, endPos); } catch (err) { var elementParent = element.parentNode; var parentDisplayValue = elementParent.style.display; elementParent.style.display = 'block'; element.setSelectionRange(pos, endPos); elementParent.style.display = parentDisplayValue; } } else if (element.createTextRange) { // IE8 var range = element.createTextRange(); range.collapse(true); range.moveEnd('character', endPos); range.moveStart('character', pos); range.select(); } } var cachedScrollbarWidth; // http://stackoverflow.com/questions/986937/how-can-i-get-the-browsers-scrollbar-sizes function walkontableCalculateScrollbarWidth() { var inner = document.createElement('div'); inner.style.height = '200px'; inner.style.width = '100%'; var outer = document.createElement('div'); outer.style.boxSizing = 'content-box'; outer.style.height = '150px'; outer.style.left = '0px'; outer.style.overflow = 'hidden'; outer.style.position = 'absolute'; outer.style.top = '0px'; outer.style.width = '200px'; outer.style.visibility = 'hidden'; outer.appendChild(inner); (document.body || document.documentElement).appendChild(outer); var w1 = inner.offsetWidth; outer.style.overflow = 'scroll'; var w2 = inner.offsetWidth; if (w1 == w2) { w2 = outer.clientWidth; } (document.body || document.documentElement).removeChild(outer); return w1 - w2; } /** * Returns the computed width of the native browser scroll bar. * * @return {Number} width */ function getScrollbarWidth() { if (cachedScrollbarWidth === void 0) { cachedScrollbarWidth = walkontableCalculateScrollbarWidth(); } return cachedScrollbarWidth; } /** * Checks if the provided element has a vertical scrollbar. * * @param {HTMLElement} element * @returns {Boolean} */ function hasVerticalScrollbar(element) { return element.offsetWidth !== element.clientWidth; } /** * Checks if the provided element has a vertical scrollbar. * * @param {HTMLElement} element * @returns {Boolean} */ function hasHorizontalScrollbar(element) { return element.offsetHeight !== element.clientHeight; } /** * Sets overlay position depending on it's type and used browser */ function setOverlayPosition(overlayElem, left, top) { if ((0, _browser.isIE8)() || (0, _browser.isIE9)()) { overlayElem.style.top = top; overlayElem.style.left = left; } else if ((0, _browser.isSafari)()) { overlayElem.style['-webkit-transform'] = 'translate3d(' + left + ',' + top + ',0)'; } else { overlayElem.style.transform = 'translate3d(' + left + ',' + top + ',0)'; } } function getCssTransform(element) { var transform; if (element.style.transform && (transform = element.style.transform) !== '') { return ['transform', transform]; } else if (element.style['-webkit-transform'] && (transform = element.style['-webkit-transform']) !== '') { return ['-webkit-transform', transform]; } return -1; } function resetCssTransform(element) { if (element.style.transform && element.style.transform !== '') { element.style.transform = ''; } else if (element.style['-webkit-transform'] && element.style['-webkit-transform'] !== '') { element.style['-webkit-transform'] = ''; } } /** * Determines if the given DOM element is an input field. * Notice: By 'input' we mean input, textarea and select nodes * * @param {HTMLElement} element - DOM element * @returns {Boolean} */ function isInput(element) { var inputs = ['INPUT', 'SELECT', 'TEXTAREA']; return element && (inputs.indexOf(element.nodeName) > -1 || element.contentEditable === 'true'); } /** * Determines if the given DOM element is an input field placed OUTSIDE of HOT. * Notice: By 'input' we mean input, textarea and select nodes * * @param {HTMLElement} element - DOM element * @returns {Boolean} */ function isOutsideInput(element) { return isInput(element) && element.className.indexOf('handsontableInput') == -1 && element.className.indexOf('copyPaste') == -1; } /***/ }), /* 3 */ /***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef /***/ }), /* 4 */ /***/ (function(module, exports) { module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(4); module.exports = function(it){ if(!isObject(it))throw TypeError(it + ' is not an object!'); return it; }; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(5) , IE8_DOM_DEFINE = __webpack_require__(82) , toPrimitive = __webpack_require__(58) , dP = Object.defineProperty; exports.f = __webpack_require__(7) ? Object.defineProperty : function defineProperty(O, P, Attributes){ anObject(O); P = toPrimitive(P, true); anObject(Attributes); if(IE8_DOM_DEFINE)try { return dP(O, P, Attributes); } catch(e){ /* empty */ } if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); if('value' in Attributes)O[P] = Attributes.value; return O; }; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(14)(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }), /* 8 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function(it, key){ return hasOwnProperty.call(it, key); }; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(49) , defined = __webpack_require__(13); module.exports = function(it){ return IObject(defined(it)); }; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.15 ToLength var toInteger = __webpack_require__(42) , min = Math.min; module.exports = function(it){ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _object = __webpack_require__(25); var _array = __webpack_require__(24); var _eventManager = __webpack_require__(23); var _eventManager2 = _interopRequireDefault(_eventManager); var _core = __webpack_require__(62); var _core2 = _interopRequireDefault(_core); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var registeredOverlays = {}; /** * Creates an overlay over the original Walkontable instance. The overlay renders the clone of the original Walkontable * and (optionally) implements behavior needed for native horizontal and vertical scrolling. * * @class Overlay */ var Overlay = function () { _createClass(Overlay, null, [{ key: 'registerOverlay', /** * Register overlay class. * * @param {String} type Overlay type, one of the CLONE_TYPES value * @param {Overlay} overlayClass Overlay class extended from base overlay class {@link Overlay} */ value: function registerOverlay(type, overlayClass) { if (Overlay.CLONE_TYPES.indexOf(type) === -1) { throw new Error('Unsupported overlay (' + type + ').'); } registeredOverlays[type] = overlayClass; } /** * Create new instance of overlay type. * * @param {String} type Overlay type, one of the CLONE_TYPES value * @param {Walkontable} wot Walkontable instance */ }, { key: 'createOverlay', value: function createOverlay(type, wot) { return new registeredOverlays[type](wot); } /** * Check if specified overlay was registered. * * @param {String} type Overlay type, one of the CLONE_TYPES value * @returns {Boolean} */ }, { key: 'hasOverlay', value: function hasOverlay(type) { return registeredOverlays[type] !== void 0; } /** * Checks if overlay object (`overlay`) is instance of overlay type (`type`). * * @param {Overlay} overlay Overlay object * @param {String} type Overlay type, one of the CLONE_TYPES value * @returns {Boolean} */ }, { key: 'isOverlayTypeOf', value: function isOverlayTypeOf(overlay, type) { if (!overlay || !registeredOverlays[type]) { return false; } return overlay instanceof registeredOverlays[type]; } /** * @param {Walkontable} wotInstance */ }, { key: 'CLONE_TOP', /** * @type {String} */ get: function get() { return 'top'; } /** * @type {String} */ }, { key: 'CLONE_BOTTOM', get: function get() { return 'bottom'; } /** * @type {String} */ }, { key: 'CLONE_LEFT', get: function get() { return 'left'; } /** * @type {String} */ }, { key: 'CLONE_TOP_LEFT_CORNER', get: function get() { return 'top_left_corner'; } /** * @type {String} */ }, { key: 'CLONE_BOTTOM_LEFT_CORNER', get: function get() { return 'bottom_left_corner'; } /** * @type {String} */ }, { key: 'CLONE_DEBUG', get: function get() { return 'debug'; } /** * List of all availables clone types * * @type {Array} */ }, { key: 'CLONE_TYPES', get: function get() { return [Overlay.CLONE_TOP, Overlay.CLONE_BOTTOM, Overlay.CLONE_LEFT, Overlay.CLONE_TOP_LEFT_CORNER, Overlay.CLONE_BOTTOM_LEFT_CORNER, Overlay.CLONE_DEBUG]; } }]); function Overlay(wotInstance) { _classCallCheck(this, Overlay); (0, _object.defineGetter)(this, 'wot', wotInstance, { writable: false }); // legacy support, deprecated in the future this.instance = this.wot; this.type = ''; this.mainTableScrollableElement = null; this.TABLE = this.wot.wtTable.TABLE; this.hider = this.wot.wtTable.hider; this.spreader = this.wot.wtTable.spreader; this.holder = this.wot.wtTable.holder; this.wtRootElement = this.wot.wtTable.wtRootElement; this.trimmingContainer = (0, _element.getTrimmingContainer)(this.hider.parentNode.parentNode); this.areElementSizesAdjusted = false; this.updateStateOfRendering(); } /** * Update internal state of object with an information about the need of full rendering of the overlay. * * @returns {Boolean} Returns `true` if the state has changed since the last check. */ _createClass(Overlay, [{ key: 'updateStateOfRendering', value: function updateStateOfRendering() { var previousState = this.needFullRender; this.needFullRender = this.shouldBeRendered(); var changed = previousState !== this.needFullRender; if (changed && !this.needFullRender) { this.reset(); } return changed; } /** * Checks if overlay should be fully rendered * * @returns {Boolean} */ }, { key: 'shouldBeRendered', value: function shouldBeRendered() { return true; } /** * Update the trimming container. */ }, { key: 'updateTrimmingContainer', value: function updateTrimmingContainer() { this.trimmingContainer = (0, _element.getTrimmingContainer)(this.hider.parentNode.parentNode); } /** * Update the main scrollable element. */ }, { key: 'updateMainScrollableElement', value: function updateMainScrollableElement() { this.mainTableScrollableElement = (0, _element.getScrollableElement)(this.wot.wtTable.TABLE); } /** * Make a clone of table for overlay * * @param {String} direction Can be `Overlay.CLONE_TOP`, `Overlay.CLONE_LEFT`, * `Overlay.CLONE_TOP_LEFT_CORNER`, `Overlay.CLONE_DEBUG` * @returns {Walkontable} */ }, { key: 'makeClone', value: function makeClone(direction) { if (Overlay.CLONE_TYPES.indexOf(direction) === -1) { throw new Error('Clone type "' + direction + '" is not supported.'); } var clone = document.createElement('DIV'); var clonedTable = document.createElement('TABLE'); clone.className = 'ht_clone_' + direction + ' handsontable'; clone.style.position = 'absolute'; clone.style.top = 0; clone.style.left = 0; clone.style.overflow = 'hidden'; clonedTable.className = this.wot.wtTable.TABLE.className; clone.appendChild(clonedTable); this.type = direction; this.wot.wtTable.wtRootElement.parentNode.appendChild(clone); var preventOverflow = this.wot.getSetting('preventOverflow'); if (preventOverflow === true || preventOverflow === 'horizontal' && this.type === Overlay.CLONE_TOP || preventOverflow === 'vertical' && this.type === Overlay.CLONE_LEFT) { this.mainTableScrollableElement = window; } else { this.mainTableScrollableElement = (0, _element.getScrollableElement)(this.wot.wtTable.TABLE); } return new _core2.default({ cloneSource: this.wot, cloneOverlay: this, table: clonedTable }); } /** * Refresh/Redraw overlay * * @param {Boolean} [fastDraw=false] */ }, { key: 'refresh', value: function refresh() { var fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; // When hot settings are changed we allow to refresh overlay once before blocking var nextCycleRenderFlag = this.shouldBeRendered(); if (this.clone && (this.needFullRender || nextCycleRenderFlag)) { this.clone.draw(fastDraw); } this.needFullRender = nextCycleRenderFlag; } /** * Reset overlay styles to initial values. */ }, { key: 'reset', value: function reset() { if (!this.clone) { return; } var holder = this.clone.wtTable.holder; var hider = this.clone.wtTable.hider; var holderStyle = holder.style; var hidderStyle = hider.style; var rootStyle = holder.parentNode.style; (0, _array.arrayEach)([holderStyle, hidderStyle, rootStyle], function (style) { style.width = ''; style.height = ''; }); } /** * Destroy overlay instance */ }, { key: 'destroy', value: function destroy() { new _eventManager2.default(this.clone).destroy(); } }]); return Overlay; }(); exports.default = Overlay; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(44); module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; switch(length){ case 1: return function(a){ return fn.call(that, a); }; case 2: return function(a, b){ return fn.call(that, a, b); }; case 3: return function(a, b, c){ return fn.call(that, a, b, c); }; } return function(/* ...args */){ return fn.apply(that, arguments); }; }; /***/ }), /* 13 */ /***/ (function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) module.exports = function(it){ if(it == undefined)throw TypeError("Can't call method on " + it); return it; }; /***/ }), /* 14 */ /***/ (function(module, exports) { module.exports = function(exec){ try { return !!exec(); } catch(e){ return true; } }; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(6) , createDesc = __webpack_require__(20); module.exports = __webpack_require__(7) ? function(object, key, value){ return dP.f(object, key, createDesc(1, value)); } : function(object, key, value){ object[key] = value; return object; }; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3) , hide = __webpack_require__(15) , has = __webpack_require__(8) , SRC = __webpack_require__(31)('src') , TO_STRING = 'toString' , $toString = Function[TO_STRING] , TPL = ('' + $toString).split(TO_STRING); __webpack_require__(26).inspectSource = function(it){ return $toString.call(it); }; (module.exports = function(O, key, val, safe){ var isFunction = typeof val == 'function'; if(isFunction)has(val, 'name') || hide(val, 'name', key); if(O[key] === val)return; if(isFunction)has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); if(O === global){ O[key] = val; } else { if(!safe){ delete O[key]; hide(O, key, val); } else { if(O[key])O[key] = val; else hide(O, key, val); } } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString(){ return typeof this == 'function' && this[SRC] || $toString.call(this); }); /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { // 22.1.3.31 Array.prototype[@@unscopables] var UNSCOPABLES = __webpack_require__(1)('unscopables') , ArrayProto = Array.prototype; if(ArrayProto[UNSCOPABLES] == undefined)__webpack_require__(15)(ArrayProto, UNSCOPABLES, {}); module.exports = function(key){ ArrayProto[UNSCOPABLES][key] = true; }; /***/ }), /* 18 */ /***/ (function(module, exports) { var toString = {}.toString; module.exports = function(it){ return toString.call(it).slice(8, -1); }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = __webpack_require__(91) , enumBugKeys = __webpack_require__(47); module.exports = Object.keys || function keys(O){ return $keys(O, enumBugKeys); }; /***/ }), /* 20 */ /***/ (function(module, exports) { module.exports = function(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value }; }; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) var defined = __webpack_require__(13); module.exports = function(it){ return Object(defined(it)); }; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * CellCoords holds cell coordinates (row, column) and few method to validate them and * retrieve as an array or an object * * @class CellCoords */ var CellCoords = function () { /** * @param {Number} row Row index * @param {Number} col Column index */ function CellCoords(row, col) { _classCallCheck(this, CellCoords); if (typeof row !== 'undefined' && typeof col !== 'undefined') { this.row = row; this.col = col; } else { this.row = null; this.col = null; } } /** * Checks if given set of coordinates is valid in context of a given Walkontable instance * * @param {Walkontable} wotInstance * @returns {Boolean} */ _createClass(CellCoords, [{ key: 'isValid', value: function isValid(wotInstance) { // is it a valid cell index (0 or higher) if (this.row < 0 || this.col < 0) { return false; } // is selection within total rows and columns if (this.row >= wotInstance.getSetting('totalRows') || this.col >= wotInstance.getSetting('totalColumns')) { return false; } return true; } /** * Checks if this cell coords are the same as cell coords given as a parameter * * @param {CellCoords} cellCoords * @returns {Boolean} */ }, { key: 'isEqual', value: function isEqual(cellCoords) { if (cellCoords === this) { return true; } return this.row === cellCoords.row && this.col === cellCoords.col; } /** * Checks if tested coordinates are positioned in south-east from this cell coords * * @param {Object} testedCoords * @returns {Boolean} */ }, { key: 'isSouthEastOf', value: function isSouthEastOf(testedCoords) { return this.row >= testedCoords.row && this.col >= testedCoords.col; } /** * Checks if tested coordinates are positioned in north-east from this cell coords * * @param {Object} testedCoords * @returns {Boolean} */ }, { key: 'isNorthWestOf', value: function isNorthWestOf(testedCoords) { return this.row <= testedCoords.row && this.col <= testedCoords.col; } /** * Checks if tested coordinates are positioned in south-west from this cell coords * * @param {Object} testedCoords * @returns {Boolean} */ }, { key: 'isSouthWestOf', value: function isSouthWestOf(testedCoords) { return this.row >= testedCoords.row && this.col <= testedCoords.col; } /** * Checks if tested coordinates are positioned in north-east from this cell coords * * @param {Object} testedCoords * @returns {Boolean} */ }, { key: 'isNorthEastOf', value: function isNorthEastOf(testedCoords) { return this.row <= testedCoords.row && this.col >= testedCoords.col; } }]); return CellCoords; }(); exports.default = CellCoords; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; }(); // import Core from './core'; exports.getListenersCounter = getListenersCounter; var _element = __webpack_require__(2); var _feature = __webpack_require__(74); var _event = __webpack_require__(73); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Counter which tracks unregistered listeners (useful for detecting memory leaks). * * @type {Number} */ var listenersCounter = 0; /** * Event DOM manager for internal use in Handsontable. * * @class EventManager * @util */ var EventManager = function () { /** * @param {Object} [context=null] * @private */ function EventManager() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; _classCallCheck(this, EventManager); this.context = context || this; if (!this.context.eventListeners) { this.context.eventListeners = []; } } /** * Register specified listener (`eventName`) to the element. * * @param {Element} element Target element. * @param {String} eventName Event name. * @param {Function} callback Function which will be called after event occur. * @returns {Function} Returns function which you can easily call to remove that event */ _createClass(EventManager, [{ key: 'addEventListener', value: function addEventListener(element, eventName, callback) { var _this = this; var context = this.context; function callbackProxy(event) { event = extendEvent(context, event); callback.call(this, event); } this.context.eventListeners.push({ element: element, event: eventName, callback: callback, callbackProxy: callbackProxy }); if (window.addEventListener) { element.addEventListener(eventName, callbackProxy, false); } else { element.attachEvent('on' + eventName, callbackProxy); } listenersCounter++; return function () { _this.removeEventListener(element, eventName, callback); }; } /** * Remove the event listener previously registered. * * @param {Element} element Target element. * @param {String} eventName Event name. * @param {Function} callback Function to remove from the event target. It must be the same as during registration listener. */ }, { key: 'removeEventListener', value: function removeEventListener(element, eventName, callback) { var len = this.context.eventListeners.length; var tmpEvent = void 0; while (len--) { tmpEvent = this.context.eventListeners[len]; if (tmpEvent.event == eventName && tmpEvent.element == element) { if (callback && callback != tmpEvent.callback) { /* eslint-disable no-continue */ continue; } this.context.eventListeners.splice(len, 1); if (tmpEvent.element.removeEventListener) { tmpEvent.element.removeEventListener(tmpEvent.event, tmpEvent.callbackProxy, false); } else { tmpEvent.element.detachEvent('on' + tmpEvent.event, tmpEvent.callbackProxy); } listenersCounter--; } } } /** * Clear all previously registered events. * * @private * @since 0.15.0-beta3 */ }, { key: 'clearEvents', value: function clearEvents() { if (!this.context) { return; } var len = this.context.eventListeners.length; while (len--) { var event = this.context.eventListeners[len]; if (event) { this.removeEventListener(event.element, event.event, event.callback); } } } /** * Clear all previously registered events. */ }, { key: 'clear', value: function clear() { this.clearEvents(); } /** * Destroy instance of EventManager. */ }, { key: 'destroy', value: function destroy() { this.clearEvents(); this.context = null; } /** * Trigger event at the specified target element. * * @param {Element} element Target element. * @param {String} eventName Event name. */ }, { key: 'fireEvent', value: function fireEvent(element, eventName) { var options = { bubbles: true, cancelable: eventName !== 'mousemove', view: window, detail: 0, screenX: 0, screenY: 0, clientX: 1, clientY: 1, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false, button: 0, relatedTarget: undefined }; var event; if (document.createEvent) { event = document.createEvent('MouseEvents'); event.initMouseEvent(eventName, options.bubbles, options.cancelable, options.view, options.detail, options.screenX, options.screenY, options.clientX, options.clientY, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, options.relatedTarget || document.body.parentNode); } else { event = document.createEventObject(); } if (element.dispatchEvent) { element.dispatchEvent(event); } else { element.fireEvent('on' + eventName, event); } } }]); return EventManager; }(); /** * @param {Object} context * @param {Event} event * @private * @returns {*} */ function extendEvent(context, event) { var componentName = 'HOT-TABLE'; var isHotTableSpotted = void 0; var fromElement = void 0; var realTarget = void 0; var target = void 0; var len = void 0; var nativeStopImmediatePropagation = void 0; event.isTargetWebComponent = false; event.realTarget = event.target; nativeStopImmediatePropagation = event.stopImmediatePropagation; event.stopImmediatePropagation = function () { nativeStopImmediatePropagation.apply(this); (0, _event.stopImmediatePropagation)(this); }; if (!EventManager.isHotTableEnv) { return event; } event = (0, _element.polymerWrap)(event); len = event.path ? event.path.length : 0; while (len--) { if (event.path[len].nodeName === componentName) { isHotTableSpotted = true; } else if (isHotTableSpotted && event.path[len].shadowRoot) { target = event.path[len]; break; } if (len === 0 && !target) { target = event.path[len]; } } if (!target) { target = event.target; } event.isTargetWebComponent = true; if ((0, _feature.isWebComponentSupportedNatively)()) { event.realTarget = event.srcElement || event.toElement; } else if (context instanceof Core || context instanceof Walkontable) { // Polymer doesn't support `event.target` property properly we must emulate it ourselves if (context instanceof Core) { fromElement = context.view ? context.view.wt.wtTable.TABLE : null; } else if (context instanceof Walkontable) { // .wtHider fromElement = context.wtTable.TABLE.parentNode.parentNode; } realTarget = (0, _element.closest)(event.target, [componentName], fromElement); if (realTarget) { event.realTarget = fromElement.querySelector(componentName) || event.target; } else { event.realTarget = event.target; } } Object.defineProperty(event, 'target', { get: function get() { return (0, _element.polymerWrap)(target); }, enumerable: true, configurable: true }); return event; } exports.default = EventManager; function getListenersCounter() { return listenersCounter; }; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.to2dArray = to2dArray; exports.extendArray = extendArray; exports.pivot = pivot; exports.arrayReduce = arrayReduce; exports.arrayFilter = arrayFilter; exports.arrayMap = arrayMap; exports.arrayEach = arrayEach; exports.arraySum = arraySum; exports.arrayMax = arrayMax; exports.arrayMin = arrayMin; exports.arrayAvg = arrayAvg; exports.arrayFlatten = arrayFlatten; exports.arrayUnique = arrayUnique; function to2dArray(arr) { var i = 0, ilen = arr.length; while (i < ilen) { arr[i] = [arr[i]]; i++; } } function extendArray(arr, extension) { var i = 0, ilen = extension.length; while (i < ilen) { arr.push(extension[i]); i++; } } function pivot(arr) { var pivotedArr = []; if (!arr || arr.length === 0 || !arr[0] || arr[0].length === 0) { return pivotedArr; } var rowCount = arr.length; var colCount = arr[0].length; for (var i = 0; i < rowCount; i++) { for (var j = 0; j < colCount; j++) { if (!pivotedArr[j]) { pivotedArr[j] = []; } pivotedArr[j][i] = arr[i][j]; } } return pivotedArr; } /** * A specialized version of `.reduce` for arrays without support for callback * shorthands and `this` binding. * * {@link https://github.com/lodash/lodash/blob/master/lodash.js} * * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {Boolean} [initFromArray] Specify using the first element of `array` as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initFromArray) { var index = -1, length = array.length; if (initFromArray && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * A specialized version of `.filter` for arrays without support for callback * shorthands and `this` binding. * * {@link https://github.com/lodash/lodash/blob/master/lodash.js} * * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[++resIndex] = value; } } return result; } /** * A specialized version of `.map` for arrays without support for callback * shorthands and `this` binding. * * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayMap(array, iteratee) { var index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { var value = array[index]; result[++resIndex] = iteratee(value, index, array); } return result; } /** * A specialized version of `.forEach` for arrays without support for callback * shorthands and `this` binding. * * {@link https://github.com/lodash/lodash/blob/master/lodash.js} * * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, length = array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } /** * Calculate sum value for each item of the array. * * @param {Array} array The array to process. * @returns {Number} Returns calculated sum value. */ function arraySum(array) { return arrayReduce(array, function (a, b) { return a + b; }, 0); } /** * Returns the highest value from an array. Can be array of numbers or array of strings. * NOTICE: Mixed values is not supported. * * @param {Array} array The array to process. * @returns {Number} Returns the highest value from an array. */ function arrayMax(array) { return arrayReduce(array, function (a, b) { return a > b ? a : b; }, Array.isArray(array) ? array[0] : void 0); } /** * Returns the lowest value from an array. Can be array of numbers or array of strings. * NOTICE: Mixed values is not supported. * * @param {Array} array The array to process. * @returns {Number} Returns the lowest value from an array. */ function arrayMin(array) { return arrayReduce(array, function (a, b) { return a < b ? a : b; }, Array.isArray(array) ? array[0] : void 0); } /** * Calculate average value for each item of the array. * * @param {Array} array The array to process. * @returns {Number} Returns calculated average value. */ function arrayAvg(array) { if (!array.length) { return 0; } return arraySum(array) / array.length; } /** * Flatten multidimensional array. * * @param {Array} array Array of Arrays * @returns {Array} */ function arrayFlatten(array) { return arrayReduce(array, function (initial, value) { return initial.concat(Array.isArray(value) ? arrayFlatten(value) : value); }, []); } /** * Unique values in the array. * * @param {Array} array The array to process. * @returns {Array} */ function arrayUnique(array) { var unique = []; arrayEach(array, function (value) { if (unique.indexOf(value) === -1) { unique.push(value); } }); return unique; } /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; exports.duckSchema = duckSchema; exports.inherit = inherit; exports.extend = extend; exports.deepExtend = deepExtend; exports.deepClone = deepClone; exports.clone = clone; exports.mixin = mixin; exports.isObjectEquals = isObjectEquals; exports.isObject = isObject; exports.defineGetter = defineGetter; exports.objectEach = objectEach; exports.getProperty = getProperty; exports.deepObjectSize = deepObjectSize; exports.createObjectPropListener = createObjectPropListener; exports.hasOwnProperty = hasOwnProperty; var _array = __webpack_require__(24); 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; } /** * Generate schema for passed object. * * @param {Array|Object} object * @returns {Array|Object} */ function duckSchema(object) { var schema; if (Array.isArray(object)) { schema = []; } else { schema = {}; objectEach(object, function (value, key) { if (key === '__children') { return; } if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && !Array.isArray(value)) { schema[key] = duckSchema(value); } else if (Array.isArray(value)) { if (value.length && _typeof(value[0]) === 'object' && !Array.isArray(value[0])) { schema[key] = [duckSchema(value[0])]; } else { schema[key] = []; } } else { schema[key] = null; } }); } return schema; } /** * Inherit without without calling parent constructor, and setting `Child.prototype.constructor` to `Child` instead of `Parent`. * Creates temporary dummy function to call it as constructor. * Described in ticket: https://github.com/handsontable/handsontable/pull/516 * * @param {Object} Child child class * @param {Object} Parent parent class * @return {Object} extended Child */ function inherit(Child, Parent) { Parent.prototype.constructor = Parent; Child.prototype = new Parent(); Child.prototype.constructor = Child; return Child; } /** * Perform shallow extend of a target object with extension's own properties. * * @param {Object} target An object that will receive the new properties. * @param {Object} extension An object containing additional properties to merge into the target. */ function extend(target, extension) { objectEach(extension, function (value, key) { target[key] = value; }); return target; } /** * Perform deep extend of a target object with extension's own properties. * * @param {Object} target An object that will receive the new properties. * @param {Object} extension An object containing additional properties to merge into the target. */ function deepExtend(target, extension) { objectEach(extension, function (value, key) { if (extension[key] && _typeof(extension[key]) === 'object') { if (!target[key]) { if (Array.isArray(extension[key])) { target[key] = []; } else if (Object.prototype.toString.call(extension[key]) === '[object Date]') { target[key] = extension[key]; } else { target[key] = {}; } } deepExtend(target[key], extension[key]); } else { target[key] = extension[key]; } }); } /** * Perform deep clone of an object. * WARNING! Only clones JSON properties. Will cause error when `obj` contains a function, Date, etc. * * @param {Object} obj An object that will be cloned * @return {Object} */ function deepClone(obj) { if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object') { return JSON.parse(JSON.stringify(obj)); } return obj; } /** * Shallow clone object. * * @param {Object} object * @returns {Object} */ function clone(object) { var result = {}; objectEach(object, function (value, key) { result[key] = value; }); return result; } /** * Extend the Base object (usually prototype) of the functionality the `mixins` objects. * * @param {Object} Base Base object which will be extended. * @param {Object} mixins The object of the functionality will be "copied". * @returns {Object} */ function mixin(Base) { if (!Base.MIXINS) { Base.MIXINS = []; } for (var _len = arguments.length, mixins = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { mixins[_key - 1] = arguments[_key]; } (0, _array.arrayEach)(mixins, function (mixin) { Base.MIXINS.push(mixin.MIXIN_NAME); objectEach(mixin, function (value, key) { if (Base.prototype[key] !== void 0) { throw new Error('Mixin conflict. Property \'' + key + '\' already exist and cannot be overwritten.'); } if (typeof value === 'function') { Base.prototype[key] = value; } else { var getter = function _getter(propertyName, initialValue) { propertyName = '_' + propertyName; var initValue = function initValue(value) { if (Array.isArray(value) || isObject(value)) { value = deepClone(value); } return value; }; return function () { if (this[propertyName] === void 0) { this[propertyName] = initValue(initialValue); } return this[propertyName]; }; }; var setter = function _setter(propertyName) { propertyName = '_' + propertyName; return function (value) { this[propertyName] = value; }; }; Object.defineProperty(Base.prototype, key, { get: getter(key, value), set: setter(key), configurable: true }); } }); }); return Base; } /** * Checks if two objects or arrays are (deep) equal * * @param {Object|Array} object1 * @param {Object|Array} object2 * @returns {Boolean} */ function isObjectEquals(object1, object2) { return JSON.stringify(object1) === JSON.stringify(object2); } /** * Determines whether given object is a plain Object. * Note: String and Array are not plain Objects * @param {*} obj * @returns {boolean} */ function isObject(obj) { return Object.prototype.toString.call(obj) == '[object Object]'; } function defineGetter(object, property, value, options) { options.value = value; options.writable = options.writable !== false; options.enumerable = options.enumerable !== false; options.configurable = options.configurable !== false; Object.defineProperty(object, property, options); } /** * A specialized version of `.forEach` for objects. * * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function objectEach(object, iteratee) { for (var key in object) { if (!object.hasOwnProperty || object.hasOwnProperty && Object.prototype.hasOwnProperty.call(object, key)) { if (iteratee(object[key], key, object) === false) { break; } } } return object; } /** * Get object property by its name. Access to sub properties can be achieved by dot notation (e.q. `'foo.bar.baz'`). * * @param {Object} object Object which value will be exported. * @param {String} name Object property name. * @returns {*} */ function getProperty(object, name) { var names = name.split('.'); var result = object; objectEach(names, function (name) { result = result[name]; if (result === void 0) { result = void 0; return false; } }); return result; } /** * Return object length (recursively). * * @param {*} object Object for which we want get length. * @returns {Number} */ function deepObjectSize(object) { if (!isObject(object)) { return 0; } var recursObjLen = function recursObjLen(obj) { var result = 0; if (isObject(obj)) { objectEach(obj, function (key) { result += recursObjLen(key); }); } else { result++; } return result; }; return recursObjLen(object); } /** * Create object with property where its value change will be observed. * * @param {*} [defaultValue=undefined] Default value. * @param {String} [propertyToListen='value'] Property to listen. * @returns {Object} */ function createObjectPropListener(defaultValue) { var _holder; var propertyToListen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value'; var privateProperty = '_' + propertyToListen; var holder = (_holder = { _touched: false }, _defineProperty(_holder, privateProperty, defaultValue), _defineProperty(_holder, 'isTouched', function isTouched() { return this._touched; }), _holder); Object.defineProperty(holder, propertyToListen, { get: function get() { return this[privateProperty]; }, set: function set(value) { this._touched = true; this[privateProperty] = value; }, enumerable: true, configurable: true }); return holder; } /** * Check if at specified `key` there is any value for `object`. * * @param {Object} object Object to search value at specyfic key. * @param {String} key String key to check. */ function hasOwnProperty(object, key) { return Object.prototype.hasOwnProperty.call(object, key); } /***/ }), /* 26 */ /***/ (function(module, exports) { var core = module.exports = {version: '2.4.0'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef /***/ }), /* 27 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { var META = __webpack_require__(31)('meta') , isObject = __webpack_require__(4) , has = __webpack_require__(8) , setDesc = __webpack_require__(6).f , id = 0; var isExtensible = Object.isExtensible || function(){ return true; }; var FREEZE = !__webpack_require__(14)(function(){ return isExtensible(Object.preventExtensions({})); }); var setMeta = function(it){ setDesc(it, META, {value: { i: 'O' + ++id, // object ID w: {} // weak collections IDs }}); }; var fastKey = function(it, create){ // return primitive with prefix if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if(!has(it, META)){ // can't set metadata to uncaught frozen object if(!isExtensible(it))return 'F'; // not necessary to add metadata if(!create)return 'E'; // add missing metadata setMeta(it); // return object ID } return it[META].i; }; var getWeak = function(it, create){ if(!has(it, META)){ // can't set metadata to uncaught frozen object if(!isExtensible(it))return true; // not necessary to add metadata if(!create)return false; // add missing metadata setMeta(it); // return hash weak collections IDs } return it[META].w; }; // add metadata on freeze-family methods calling var onFreeze = function(it){ if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); return it; }; var meta = module.exports = { KEY: META, NEED: false, fastKey: fastKey, getWeak: getWeak, onFreeze: onFreeze }; /***/ }), /* 29 */ /***/ (function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { var def = __webpack_require__(6).f , has = __webpack_require__(8) , TAG = __webpack_require__(1)('toStringTag'); module.exports = function(it, tag, stat){ if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); }; /***/ }), /* 31 */ /***/ (function(module, exports) { var id = 0 , px = Math.random(); module.exports = function(key){ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.isIE8 = isIE8; exports.isIE9 = isIE9; exports.isSafari = isSafari; exports.isChrome = isChrome; exports.isMobileBrowser = isMobileBrowser; var _isIE8 = !document.createTextNode('test').textContent; function isIE8() { return _isIE8; } var _isIE9 = !!document.documentMode; function isIE9() { return _isIE9; } var _isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor); function isSafari() { return _isSafari; } var _isChrome = /Chrome/.test(navigator.userAgent) && /Google/.test(navigator.vendor); function isChrome() { return _isChrome; } function isMobileBrowser(userAgent) { if (!userAgent) { userAgent = navigator.userAgent; } return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) ); } /***/ }), /* 33 */ /***/ (function(module, exports) { module.exports = function(it, Constructor, name, forbiddenField){ if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){ throw TypeError(name + ': incorrect invocation!'); } return it; }; /***/ }), /* 34 */ /***/ (function(module, exports, __webpack_require__) { // 0 -> Array#forEach // 1 -> Array#map // 2 -> Array#filter // 3 -> Array#some // 4 -> Array#every // 5 -> Array#find // 6 -> Array#findIndex var ctx = __webpack_require__(12) , IObject = __webpack_require__(49) , toObject = __webpack_require__(21) , toLength = __webpack_require__(10) , asc = __webpack_require__(154); module.exports = function(TYPE, $create){ var IS_MAP = TYPE == 1 , IS_FILTER = TYPE == 2 , IS_SOME = TYPE == 3 , IS_EVERY = TYPE == 4 , IS_FIND_INDEX = TYPE == 6 , NO_HOLES = TYPE == 5 || IS_FIND_INDEX , create = $create || asc; return function($this, callbackfn, that){ var O = toObject($this) , self = IObject(O) , f = ctx(callbackfn, that, 3) , length = toLength(self.length) , index = 0 , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined , val, res; for(;length > index; index++)if(NO_HOLES || index in self){ val = self[index]; res = f(val, index, O); if(TYPE){ if(IS_MAP)result[index] = res; // map else if(res)switch(TYPE){ case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if(IS_EVERY)return false; // every } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; }; }; /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3) , $export = __webpack_require__(0) , redefine = __webpack_require__(16) , redefineAll = __webpack_require__(40) , meta = __webpack_require__(28) , forOf = __webpack_require__(37) , anInstance = __webpack_require__(33) , isObject = __webpack_require__(4) , fails = __webpack_require__(14) , $iterDetect = __webpack_require__(50) , setToStringTag = __webpack_require__(30) , inheritIfRequired = __webpack_require__(157); module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ var Base = global[NAME] , C = Base , ADDER = IS_MAP ? 'set' : 'add' , proto = C && C.prototype , O = {}; var fixMethod = function(KEY){ var fn = proto[KEY]; redefine(proto, KEY, KEY == 'delete' ? function(a){ return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); } : KEY == 'has' ? function has(a){ return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); } : KEY == 'get' ? function get(a){ return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; } : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; } ); }; if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){ new C().entries().next(); }))){ // create collection constructor C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); redefineAll(C.prototype, methods); meta.NEED = true; } else { var instance = new C // early implementations not supports chaining , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); }) // most early implementations doesn't supports iterables, most modern - not close it correctly , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new // for early implementations -0 and +0 not the same , BUGGY_ZERO = !IS_WEAK && fails(function(){ // V8 ~ Chromium 42- fails only with 5+ elements var $instance = new C() , index = 5; while(index--)$instance[ADDER](index, index); return !$instance.has(-0); }); if(!ACCEPT_ITERABLES){ C = wrapper(function(target, iterable){ anInstance(target, C, NAME); var that = inheritIfRequired(new Base, target, C); if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); return that; }); C.prototype = proto; proto.constructor = C; } if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){ fixMethod('delete'); fixMethod('has'); IS_MAP && fixMethod('get'); } if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER); // weak collections should not contains .clear method if(IS_WEAK && proto.clear)delete proto.clear; } setToStringTag(C, NAME); O[NAME] = C; $export($export.G + $export.W + $export.F * (C != Base), O); if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP); return C; }; /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var hide = __webpack_require__(15) , redefine = __webpack_require__(16) , fails = __webpack_require__(14) , defined = __webpack_require__(13) , wks = __webpack_require__(1); module.exports = function(KEY, length, exec){ var SYMBOL = wks(KEY) , fns = exec(defined, SYMBOL, ''[KEY]) , strfn = fns[0] , rxfn = fns[1]; if(fails(function(){ var O = {}; O[SYMBOL] = function(){ return 7; }; return ''[KEY](O) != 7; })){ redefine(String.prototype, KEY, strfn); hide(RegExp.prototype, SYMBOL, length == 2 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) // 21.2.5.11 RegExp.prototype[@@split](string, limit) ? function(string, arg){ return rxfn.call(string, this, arg); } // 21.2.5.6 RegExp.prototype[@@match](string) // 21.2.5.9 RegExp.prototype[@@search](string) : function(string){ return rxfn.call(string, this); } ); } }; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { var ctx = __webpack_require__(12) , call = __webpack_require__(87) , isArrayIter = __webpack_require__(83) , anObject = __webpack_require__(5) , toLength = __webpack_require__(10) , getIterFn = __webpack_require__(98) , BREAK = {} , RETURN = {}; var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){ var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable) , f = ctx(fn, that, entries ? 2 : 1) , index = 0 , length, step, iterator, result; if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); // fast case for arrays with default iterator if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); if(result === BREAK || result === RETURN)return result; } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ result = call(iterator, f, step.value, entries); if(result === BREAK || result === RETURN)return result; } }; exports.BREAK = BREAK; exports.RETURN = RETURN; /***/ }), /* 38 */ /***/ (function(module, exports) { module.exports = false; /***/ }), /* 39 */ /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { var redefine = __webpack_require__(16); module.exports = function(target, src, safe){ for(var key in src)redefine(target, key, src[key], safe); return target; }; /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(42) , max = Math.max , min = Math.min; module.exports = function(index, length){ index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; /***/ }), /* 42 */ /***/ (function(module, exports) { // 7.1.4 ToInteger var ceil = Math.ceil , floor = Math.floor; module.exports = function(it){ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _coords = __webpack_require__(22); var _coords2 = _interopRequireDefault(_coords); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * A cell range is a set of exactly two CellCoords (that can be the same or different) * * @class CellRange */ var CellRange = function () { /** * @param {CellCoords} highlight Used to draw bold border around a cell where selection was * started and to edit the cell when you press Enter * @param {CellCoords} from Usually the same as highlight, but in Excel there is distinction - one can change * highlight within a selection * @param {CellCoords} to End selection */ function CellRange(highlight, from, to) { _classCallCheck(this, CellRange); this.highlight = highlight; this.from = from; this.to = to; } /** * Checks if given coords are valid in context of a given Walkontable instance * * @param {Walkontable} wotInstance * @returns {Boolean} */ _createClass(CellRange, [{ key: 'isValid', value: function isValid(wotInstance) { return this.from.isValid(wotInstance) && this.to.isValid(wotInstance); } /** * Checks if this cell range is restricted to one cell * * @returns {Boolean} */ }, { key: 'isSingle', value: function isSingle() { return this.from.row === this.to.row && this.from.col === this.to.col; } /** * Returns selected range height (in number of rows) * * @returns {Number} */ }, { key: 'getHeight', value: function getHeight() { return Math.max(this.from.row, this.to.row) - Math.min(this.from.row, this.to.row) + 1; } /** * Returns selected range width (in number of columns) * * @returns {Number} */ }, { key: 'getWidth', value: function getWidth() { return Math.max(this.from.col, this.to.col) - Math.min(this.from.col, this.to.col) + 1; } /** * Checks if given cell coords is within `from` and `to` cell coords of this range * * @param {CellCoords} cellCoords * @returns {Boolean} */ }, { key: 'includes', value: function includes(cellCoords) { var row = cellCoords.row, col = cellCoords.col; var topLeft = this.getTopLeftCorner(); var bottomRight = this.getBottomRightCorner(); return topLeft.row <= row && bottomRight.row >= row && topLeft.col <= col && bottomRight.col >= col; } /** * Checks if given range is within of this range * * @param {CellRange} testedRange * @returns {Boolean} */ }, { key: 'includesRange', value: function includesRange(testedRange) { return this.includes(testedRange.getTopLeftCorner()) && this.includes(testedRange.getBottomRightCorner()); } /** * Checks if given range is equal to this range * * @param {CellRange} testedRange * @returns {Boolean} */ }, { key: 'isEqual', value: function isEqual(testedRange) { return Math.min(this.from.row, this.to.row) == Math.min(testedRange.from.row, testedRange.to.row) && Math.max(this.from.row, this.to.row) == Math.max(testedRange.from.row, testedRange.to.row) && Math.min(this.from.col, this.to.col) == Math.min(testedRange.from.col, testedRange.to.col) && Math.max(this.from.col, this.to.col) == Math.max(testedRange.from.col, testedRange.to.col); } /** * Checks if tested range overlaps with the range. * Range A is considered to to be overlapping with range B if intersection of A and B or B and A is not empty. * * @param {CellRange} testedRange * @returns {Boolean} */ }, { key: 'overlaps', value: function overlaps(testedRange) { return testedRange.isSouthEastOf(this.getTopLeftCorner()) && testedRange.isNorthWestOf(this.getBottomRightCorner()); } /** * @param {CellRange} testedCoords * @returns {Boolean} */ }, { key: 'isSouthEastOf', value: function isSouthEastOf(testedCoords) { return this.getTopLeftCorner().isSouthEastOf(testedCoords) || this.getBottomRightCorner().isSouthEastOf(testedCoords); } /** * @param {CellRange} testedCoords * @returns {Boolean} */ }, { key: 'isNorthWestOf', value: function isNorthWestOf(testedCoords) { return this.getTopLeftCorner().isNorthWestOf(testedCoords) || this.getBottomRightCorner().isNorthWestOf(testedCoords); } /** * Adds a cell to a range (only if exceeds corners of the range). Returns information if range was expanded * * @param {CellCoords} cellCoords * @returns {Boolean} */ }, { key: 'expand', value: function expand(cellCoords) { var topLeft = this.getTopLeftCorner(); var bottomRight = this.getBottomRightCorner(); if (cellCoords.row < topLeft.row || cellCoords.col < topLeft.col || cellCoords.row > bottomRight.row || cellCoords.col > bottomRight.col) { this.from = new _coords2.default(Math.min(topLeft.row, cellCoords.row), Math.min(topLeft.col, cellCoords.col)); this.to = new _coords2.default(Math.max(bottomRight.row, cellCoords.row), Math.max(bottomRight.col, cellCoords.col)); return true; } return false; } /** * @param {CellRange} expandingRange * @returns {Boolean} */ }, { key: 'expandByRange', value: function expandByRange(expandingRange) { if (this.includesRange(expandingRange) || !this.overlaps(expandingRange)) { return false; } var topLeft = this.getTopLeftCorner(); var bottomRight = this.getBottomRightCorner(); var topRight = this.getTopRightCorner(); var bottomLeft = this.getBottomLeftCorner(); var expandingTopLeft = expandingRange.getTopLeftCorner(); var expandingBottomRight = expandingRange.getBottomRightCorner(); var resultTopRow = Math.min(topLeft.row, expandingTopLeft.row); var resultTopCol = Math.min(topLeft.col, expandingTopLeft.col); var resultBottomRow = Math.max(bottomRight.row, expandingBottomRight.row); var resultBottomCol = Math.max(bottomRight.col, expandingBottomRight.col); var finalFrom = new _coords2.default(resultTopRow, resultTopCol), finalTo = new _coords2.default(resultBottomRow, resultBottomCol); var isCorner = new CellRange(finalFrom, finalFrom, finalTo).isCorner(this.from, expandingRange), onlyMerge = expandingRange.isEqual(new CellRange(finalFrom, finalFrom, finalTo)); if (isCorner && !onlyMerge) { if (this.from.col > finalFrom.col) { finalFrom.col = resultBottomCol; finalTo.col = resultTopCol; } if (this.from.row > finalFrom.row) { finalFrom.row = resultBottomRow; finalTo.row = resultTopRow; } } this.from = finalFrom; this.to = finalTo; return true; } /** * @returns {String} */ }, { key: 'getDirection', value: function getDirection() { if (this.from.isNorthWestOf(this.to)) { // NorthWest - SouthEast return 'NW-SE'; } else if (this.from.isNorthEastOf(this.to)) { // NorthEast - SouthWest return 'NE-SW'; } else if (this.from.isSouthEastOf(this.to)) { // SouthEast - NorthWest return 'SE-NW'; } else if (this.from.isSouthWestOf(this.to)) { // SouthWest - NorthEast return 'SW-NE'; } } /** * @param {String} direction */ }, { key: 'setDirection', value: function setDirection(direction) { switch (direction) { case 'NW-SE': var _ref = [this.getTopLeftCorner(), this.getBottomRightCorner()]; this.from = _ref[0]; this.to = _ref[1]; break; case 'NE-SW': var _ref2 = [this.getTopRightCorner(), this.getBottomLeftCorner()]; this.from = _ref2[0]; this.to = _ref2[1]; break; case 'SE-NW': var _ref3 = [this.getBottomRightCorner(), this.getTopLeftCorner()]; this.from = _ref3[0]; this.to = _ref3[1]; break; case 'SW-NE': var _ref4 = [this.getBottomLeftCorner(), this.getTopRightCorner()]; this.from = _ref4[0]; this.to = _ref4[1]; break; default: break; } } /** * Get top left corner of this range * * @returns {CellCoords} */ }, { key: 'getTopLeftCorner', value: function getTopLeftCorner() { return new _coords2.default(Math.min(this.from.row, this.to.row), Math.min(this.from.col, this.to.col)); } /** * Get bottom right corner of this range * * @returns {CellCoords} */ }, { key: 'getBottomRightCorner', value: function getBottomRightCorner() { return new _coords2.default(Math.max(this.from.row, this.to.row), Math.max(this.from.col, this.to.col)); } /** * Get top right corner of this range * * @returns {CellCoords} */ }, { key: 'getTopRightCorner', value: function getTopRightCorner() { return new _coords2.default(Math.min(this.from.row, this.to.row), Math.max(this.from.col, this.to.col)); } /** * Get bottom left corner of this range * * @returns {CellCoords} */ }, { key: 'getBottomLeftCorner', value: function getBottomLeftCorner() { return new _coords2.default(Math.max(this.from.row, this.to.row), Math.min(this.from.col, this.to.col)); } /** * @param {CellCoords} coords * @param {CellRange} expandedRange * @returns {*} */ }, { key: 'isCorner', value: function isCorner(coords, expandedRange) { if (expandedRange) { if (expandedRange.includes(coords)) { if (this.getTopLeftCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.from.col)) || this.getTopRightCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.to.col)) || this.getBottomLeftCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.from.col)) || this.getBottomRightCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.to.col))) { return true; } } } return coords.isEqual(this.getTopLeftCorner()) || coords.isEqual(this.getTopRightCorner()) || coords.isEqual(this.getBottomLeftCorner()) || coords.isEqual(this.getBottomRightCorner()); } /** * @param {CellCoords} coords * @param {CellRange} expandedRange * @returns {CellCoords} */ }, { key: 'getOppositeCorner', value: function getOppositeCorner(coords, expandedRange) { if (!(coords instanceof _coords2.default)) { return false; } if (expandedRange) { if (expandedRange.includes(coords)) { if (this.getTopLeftCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.from.col))) { return this.getBottomRightCorner(); } if (this.getTopRightCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.to.col))) { return this.getBottomLeftCorner(); } if (this.getBottomLeftCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.from.col))) { return this.getTopRightCorner(); } if (this.getBottomRightCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.to.col))) { return this.getTopLeftCorner(); } } } if (coords.isEqual(this.getBottomRightCorner())) { return this.getTopLeftCorner(); } else if (coords.isEqual(this.getTopLeftCorner())) { return this.getBottomRightCorner(); } else if (coords.isEqual(this.getTopRightCorner())) { return this.getBottomLeftCorner(); } else if (coords.isEqual(this.getBottomLeftCorner())) { return this.getTopRightCorner(); } } /** * @param {CellRange} range * @returns {Array} */ }, { key: 'getBordersSharedWith', value: function getBordersSharedWith(range) { if (!this.includesRange(range)) { return []; } var thisBorders = { top: Math.min(this.from.row, this.to.row), bottom: Math.max(this.from.row, this.to.row), left: Math.min(this.from.col, this.to.col), right: Math.max(this.from.col, this.to.col) }; var rangeBorders = { top: Math.min(range.from.row, range.to.row), bottom: Math.max(range.from.row, range.to.row), left: Math.min(range.from.col, range.to.col), right: Math.max(range.from.col, range.to.col) }; var result = []; if (thisBorders.top == rangeBorders.top) { result.push('top'); } if (thisBorders.right == rangeBorders.right) { result.push('right'); } if (thisBorders.bottom == rangeBorders.bottom) { result.push('bottom'); } if (thisBorders.left == rangeBorders.left) { result.push('left'); } return result; } /** * Get inner selected cell coords defined by this range * * @returns {Array} */ }, { key: 'getInner', value: function getInner() { var topLeft = this.getTopLeftCorner(); var bottomRight = this.getBottomRightCorner(); var out = []; for (var r = topLeft.row; r <= bottomRight.row; r++) { for (var c = topLeft.col; c <= bottomRight.col; c++) { if (!(this.from.row === r && this.from.col === c) && !(this.to.row === r && this.to.col === c)) { out.push(new _coords2.default(r, c)); } } } return out; } /** * Get all selected cell coords defined by this range * * @returns {Array} */ }, { key: 'getAll', value: function getAll() { var topLeft = this.getTopLeftCorner(); var bottomRight = this.getBottomRightCorner(); var out = []; for (var r = topLeft.row; r <= bottomRight.row; r++) { for (var c = topLeft.col; c <= bottomRight.col; c++) { if (topLeft.row === r && topLeft.col === c) { out.push(topLeft); } else if (bottomRight.row === r && bottomRight.col === c) { out.push(bottomRight); } else { out.push(new _coords2.default(r, c)); } } } return out; } /** * Runs a callback function against all cells in the range. You can break the iteration by returning * `false` in the callback function * * @param callback {Function} */ }, { key: 'forAll', value: function forAll(callback) { var topLeft = this.getTopLeftCorner(); var bottomRight = this.getBottomRightCorner(); for (var r = topLeft.row; r <= bottomRight.row; r++) { for (var c = topLeft.col; c <= bottomRight.col; c++) { var breakIteration = callback(r, c); if (breakIteration === false) { return; } } } } }]); return CellRange; }(); exports.default = CellRange; /***/ }), /* 44 */ /***/ (function(module, exports) { module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; }; /***/ }), /* 45 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $defineProperty = __webpack_require__(6) , createDesc = __webpack_require__(20); module.exports = function(object, index, value){ if(index in object)$defineProperty.f(object, index, createDesc(0, value)); else object[index] = value; }; /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(4) , document = __webpack_require__(3).document // in old IE typeof document.createElement is 'object' , is = isObject(document) && isObject(document.createElement); module.exports = function(it){ return is ? document.createElement(it) : {}; }; /***/ }), /* 47 */ /***/ (function(module, exports) { // IE 8- don't enum bug keys module.exports = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); /***/ }), /* 48 */ /***/ (function(module, exports, __webpack_require__) { var MATCH = __webpack_require__(1)('match'); module.exports = function(KEY){ var re = /./; try { '/./'[KEY](re); } catch(e){ try { re[MATCH] = false; return !'/./'[KEY](re); } catch(f){ /* empty */ } } return true; }; /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __webpack_require__(18); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }), /* 50 */ /***/ (function(module, exports, __webpack_require__) { var ITERATOR = __webpack_require__(1)('iterator') , SAFE_CLOSING = false; try { var riter = [7][ITERATOR](); riter['return'] = function(){ SAFE_CLOSING = true; }; Array.from(riter, function(){ throw 2; }); } catch(e){ /* empty */ } module.exports = function(exec, skipClosing){ if(!skipClosing && !SAFE_CLOSING)return false; var safe = false; try { var arr = [7] , iter = arr[ITERATOR](); iter.next = function(){ return {done: safe = true}; }; arr[ITERATOR] = function(){ return iter; }; exec(arr); } catch(e){ /* empty */ } return safe; }; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject = __webpack_require__(5) , dPs = __webpack_require__(162) , enumBugKeys = __webpack_require__(47) , IE_PROTO = __webpack_require__(54)('IE_PROTO') , Empty = function(){ /* empty */ } , PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function(){ // Thrash, waste and sodomy: IE GC bug var iframe = __webpack_require__(46)('iframe') , i = enumBugKeys.length , lt = '<' , gt = '>' , iframeDocument; iframe.style.display = 'none'; __webpack_require__(81).appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; return createDict(); }; module.exports = Object.create || function create(O, Properties){ var result; if(O !== null){ Empty[PROTOTYPE] = anObject(O); result = new Empty; Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = createDict(); return Properties === undefined ? result : dPs(result, Properties); }; /***/ }), /* 52 */ /***/ (function(module, exports, __webpack_require__) { var pIE = __webpack_require__(29) , createDesc = __webpack_require__(20) , toIObject = __webpack_require__(9) , toPrimitive = __webpack_require__(58) , has = __webpack_require__(8) , IE8_DOM_DEFINE = __webpack_require__(82) , gOPD = Object.getOwnPropertyDescriptor; exports.f = __webpack_require__(7) ? gOPD : function getOwnPropertyDescriptor(O, P){ O = toIObject(O); P = toPrimitive(P, true); if(IE8_DOM_DEFINE)try { return gOPD(O, P); } catch(e){ /* empty */ } if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); }; /***/ }), /* 53 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) var $keys = __webpack_require__(91) , hiddenKeys = __webpack_require__(47).concat('length', 'prototype'); exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ return $keys(O, hiddenKeys); }; /***/ }), /* 54 */ /***/ (function(module, exports, __webpack_require__) { var shared = __webpack_require__(55)('keys') , uid = __webpack_require__(31); module.exports = function(key){ return shared[key] || (shared[key] = uid(key)); }; /***/ }), /* 55 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3) , SHARED = '__core-js_shared__' , store = global[SHARED] || (global[SHARED] = {}); module.exports = function(key){ return store[key] || (store[key] = {}); }; /***/ }), /* 56 */ /***/ (function(module, exports, __webpack_require__) { // helper for String#{startsWith, endsWith, includes} var isRegExp = __webpack_require__(86) , defined = __webpack_require__(13); module.exports = function(that, searchString, NAME){ if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!"); return String(defined(that)); }; /***/ }), /* 57 */ /***/ (function(module, exports, __webpack_require__) { var ctx = __webpack_require__(12) , invoke = __webpack_require__(158) , html = __webpack_require__(81) , cel = __webpack_require__(46) , global = __webpack_require__(3) , process = global.process , setTask = global.setImmediate , clearTask = global.clearImmediate , MessageChannel = global.MessageChannel , counter = 0 , queue = {} , ONREADYSTATECHANGE = 'onreadystatechange' , defer, channel, port; var run = function(){ var id = +this; if(queue.hasOwnProperty(id)){ var fn = queue[id]; delete queue[id]; fn(); } }; var listener = function(event){ run.call(event.data); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if(!setTask || !clearTask){ setTask = function setImmediate(fn){ var args = [], i = 1; while(arguments.length > i)args.push(arguments[i++]); queue[++counter] = function(){ invoke(typeof fn == 'function' ? fn : Function(fn), args); }; defer(counter); return counter; }; clearTask = function clearImmediate(id){ delete queue[id]; }; // Node.js 0.8- if(__webpack_require__(18)(process) == 'process'){ defer = function(id){ process.nextTick(ctx(run, id, 1)); }; // Browsers with MessageChannel, includes WebWorkers } else if(MessageChannel){ channel = new MessageChannel; port = channel.port2; channel.port1.onmessage = listener; defer = ctx(port.postMessage, port, 1); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){ defer = function(id){ global.postMessage(id + '', '*'); }; global.addEventListener('message', listener, false); // IE8- } else if(ONREADYSTATECHANGE in cel('script')){ defer = function(id){ html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){ html.removeChild(this); run.call(id); }; }; // Rest old browsers } else { defer = function(id){ setTimeout(ctx(run, id, 1), 0); }; } } module.exports = { set: setTask, clear: clearTask }; /***/ }), /* 58 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = __webpack_require__(4); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function(it, S){ if(!isObject(it))return it; var fn, val; if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _event = __webpack_require__(73); var _object = __webpack_require__(25); var _browser = __webpack_require__(32); var _eventManager = __webpack_require__(23); var _eventManager2 = _interopRequireDefault(_eventManager); var _coords = __webpack_require__(22); var _coords2 = _interopRequireDefault(_coords); var _base = __webpack_require__(11); var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * */ var Border = function () { /** * @param {Walkontable} wotInstance * @param {Object} settings */ function Border(wotInstance, settings) { _classCallCheck(this, Border); if (!settings) { return; } this.eventManager = new _eventManager2.default(wotInstance); this.instance = wotInstance; this.wot = wotInstance; this.settings = settings; this.mouseDown = false; this.main = null; this.top = null; this.left = null; this.bottom = null; this.right = null; this.topStyle = null; this.leftStyle = null; this.bottomStyle = null; this.rightStyle = null; this.cornerDefaultStyle = { width: '5px', height: '5px', borderWidth: '2px', borderStyle: 'solid', borderColor: '#FFF' }; this.corner = null; this.cornerStyle = null; this.createBorders(settings); this.registerListeners(); } /** * Register all necessary events */ _createClass(Border, [{ key: 'registerListeners', value: function registerListeners() { var _this2 = this; this.eventManager.addEventListener(document.body, 'mousedown', function () { return _this2.onMouseDown(); }); this.eventManager.addEventListener(document.body, 'mouseup', function () { return _this2.onMouseUp(); }); var _loop = function _loop(c, len) { _this2.eventManager.addEventListener(_this2.main.childNodes[c], 'mouseenter', function (event) { return _this2.onMouseEnter(event, _this2.main.childNodes[c]); }); }; for (var c = 0, len = this.main.childNodes.length; c < len; c++) { _loop(c, len); } } /** * Mouse down listener * * @private */ }, { key: 'onMouseDown', value: function onMouseDown() { this.mouseDown = true; } /** * Mouse up listener * * @private */ }, { key: 'onMouseUp', value: function onMouseUp() { this.mouseDown = false; } /** * Mouse enter listener for fragment selection functionality. * * @private * @param {Event} event Dom event * @param {HTMLElement} parentElement Part of border element. */ }, { key: 'onMouseEnter', value: function onMouseEnter(event, parentElement) { if (!this.mouseDown || !this.wot.getSetting('hideBorderOnMouseDownOver')) { return; } event.preventDefault(); (0, _event.stopImmediatePropagation)(event); var _this = this; var bounds = parentElement.getBoundingClientRect(); // Hide border to prevents selection jumping when fragmentSelection is enabled. parentElement.style.display = 'none'; function isOutside(event) { if (event.clientY < Math.floor(bounds.top)) { return true; } if (event.clientY > Math.ceil(bounds.top + bounds.height)) { return true; } if (event.clientX < Math.floor(bounds.left)) { return true; } if (event.clientX > Math.ceil(bounds.left + bounds.width)) { return true; } } function handler(event) { if (isOutside(event)) { _this.eventManager.removeEventListener(document.body, 'mousemove', handler); parentElement.style.display = 'block'; } } this.eventManager.addEventListener(document.body, 'mousemove', handler); } /** * Create border elements * * @param {Object} settings */ }, { key: 'createBorders', value: function createBorders(settings) { this.main = document.createElement('div'); var borderDivs = ['top', 'left', 'bottom', 'right', 'corner']; var style = this.main.style; style.position = 'absolute'; style.top = 0; style.left = 0; for (var i = 0; i < 5; i++) { var position = borderDivs[i]; var div = document.createElement('div'); div.className = 'wtBorder ' + (this.settings.className || ''); // + borderDivs[i]; if (this.settings[position] && this.settings[position].hide) { div.className += ' hidden'; } style = div.style; style.backgroundColor = this.settings[position] && this.settings[position].color ? this.settings[position].color : settings.border.color; style.height = this.settings[position] && this.settings[position].width ? this.settings[position].width + 'px' : settings.border.width + 'px'; style.width = this.settings[position] && this.settings[position].width ? this.settings[position].width + 'px' : settings.border.width + 'px'; this.main.appendChild(div); } this.top = this.main.childNodes[0]; this.left = this.main.childNodes[1]; this.bottom = this.main.childNodes[2]; this.right = this.main.childNodes[3]; this.topStyle = this.top.style; this.leftStyle = this.left.style; this.bottomStyle = this.bottom.style; this.rightStyle = this.right.style; this.corner = this.main.childNodes[4]; this.corner.className += ' corner'; this.cornerStyle = this.corner.style; this.cornerStyle.width = this.cornerDefaultStyle.width; this.cornerStyle.height = this.cornerDefaultStyle.height; this.cornerStyle.border = [this.cornerDefaultStyle.borderWidth, this.cornerDefaultStyle.borderStyle, this.cornerDefaultStyle.borderColor].join(' '); if ((0, _browser.isMobileBrowser)()) { this.createMultipleSelectorHandles(); } this.disappear(); if (!this.wot.wtTable.bordersHolder) { this.wot.wtTable.bordersHolder = document.createElement('div'); this.wot.wtTable.bordersHolder.className = 'htBorders'; this.wot.wtTable.spreader.appendChild(this.wot.wtTable.bordersHolder); } this.wot.wtTable.bordersHolder.insertBefore(this.main, this.wot.wtTable.bordersHolder.firstChild); } /** * Create multiple selector handler for mobile devices */ }, { key: 'createMultipleSelectorHandles', value: function createMultipleSelectorHandles() { this.selectionHandles = { topLeft: document.createElement('DIV'), topLeftHitArea: document.createElement('DIV'), bottomRight: document.createElement('DIV'), bottomRightHitArea: document.createElement('DIV') }; var width = 10; var hitAreaWidth = 40; this.selectionHandles.topLeft.className = 'topLeftSelectionHandle'; this.selectionHandles.topLeftHitArea.className = 'topLeftSelectionHandle-HitArea'; this.selectionHandles.bottomRight.className = 'bottomRightSelectionHandle'; this.selectionHandles.bottomRightHitArea.className = 'bottomRightSelectionHandle-HitArea'; this.selectionHandles.styles = { topLeft: this.selectionHandles.topLeft.style, topLeftHitArea: this.selectionHandles.topLeftHitArea.style, bottomRight: this.selectionHandles.bottomRight.style, bottomRightHitArea: this.selectionHandles.bottomRightHitArea.style }; var hitAreaStyle = { position: 'absolute', height: hitAreaWidth + 'px', width: hitAreaWidth + 'px', 'border-radius': parseInt(hitAreaWidth / 1.5, 10) + 'px' }; for (var prop in hitAreaStyle) { if ((0, _object.hasOwnProperty)(hitAreaStyle, prop)) { this.selectionHandles.styles.bottomRightHitArea[prop] = hitAreaStyle[prop]; this.selectionHandles.styles.topLeftHitArea[prop] = hitAreaStyle[prop]; } } var handleStyle = { position: 'absolute', height: width + 'px', width: width + 'px', 'border-radius': parseInt(width / 1.5, 10) + 'px', background: '#F5F5FF', border: '1px solid #4285c8' }; for (var _prop in handleStyle) { if ((0, _object.hasOwnProperty)(handleStyle, _prop)) { this.selectionHandles.styles.bottomRight[_prop] = handleStyle[_prop]; this.selectionHandles.styles.topLeft[_prop] = handleStyle[_prop]; } } this.main.appendChild(this.selectionHandles.topLeft); this.main.appendChild(this.selectionHandles.bottomRight); this.main.appendChild(this.selectionHandles.topLeftHitArea); this.main.appendChild(this.selectionHandles.bottomRightHitArea); } }, { key: 'isPartRange', value: function isPartRange(row, col) { if (this.wot.selections.area.cellRange) { if (row != this.wot.selections.area.cellRange.to.row || col != this.wot.selections.area.cellRange.to.col) { return true; } } return false; } }, { key: 'updateMultipleSelectionHandlesPosition', value: function updateMultipleSelectionHandlesPosition(row, col, top, left, width, height) { var handleWidth = parseInt(this.selectionHandles.styles.topLeft.width, 10); var hitAreaWidth = parseInt(this.selectionHandles.styles.topLeftHitArea.width, 10); this.selectionHandles.styles.topLeft.top = parseInt(top - handleWidth, 10) + 'px'; this.selectionHandles.styles.topLeft.left = parseInt(left - handleWidth, 10) + 'px'; this.selectionHandles.styles.topLeftHitArea.top = parseInt(top - hitAreaWidth / 4 * 3, 10) + 'px'; this.selectionHandles.styles.topLeftHitArea.left = parseInt(left - hitAreaWidth / 4 * 3, 10) + 'px'; this.selectionHandles.styles.bottomRight.top = parseInt(top + height, 10) + 'px'; this.selectionHandles.styles.bottomRight.left = parseInt(left + width, 10) + 'px'; this.selectionHandles.styles.bottomRightHitArea.top = parseInt(top + height - hitAreaWidth / 4, 10) + 'px'; this.selectionHandles.styles.bottomRightHitArea.left = parseInt(left + width - hitAreaWidth / 4, 10) + 'px'; if (this.settings.border.multipleSelectionHandlesVisible && this.settings.border.multipleSelectionHandlesVisible()) { this.selectionHandles.styles.topLeft.display = 'block'; this.selectionHandles.styles.topLeftHitArea.display = 'block'; if (this.isPartRange(row, col)) { this.selectionHandles.styles.bottomRight.display = 'none'; this.selectionHandles.styles.bottomRightHitArea.display = 'none'; } else { this.selectionHandles.styles.bottomRight.display = 'block'; this.selectionHandles.styles.bottomRightHitArea.display = 'block'; } } else { this.selectionHandles.styles.topLeft.display = 'none'; this.selectionHandles.styles.bottomRight.display = 'none'; this.selectionHandles.styles.topLeftHitArea.display = 'none'; this.selectionHandles.styles.bottomRightHitArea.display = 'none'; } if (row == this.wot.wtSettings.getSetting('fixedRowsTop') || col == this.wot.wtSettings.getSetting('fixedColumnsLeft')) { this.selectionHandles.styles.topLeft.zIndex = '9999'; this.selectionHandles.styles.topLeftHitArea.zIndex = '9999'; } else { this.selectionHandles.styles.topLeft.zIndex = ''; this.selectionHandles.styles.topLeftHitArea.zIndex = ''; } } /** * Show border around one or many cells * * @param {Array} corners */ }, { key: 'appear', value: function appear(corners) { if (this.disabled) { return; } var isMultiple, fromTD, toTD, fromOffset, toOffset, containerOffset, top, minTop, left, minLeft, height, width, fromRow, fromColumn, toRow, toColumn, trimmingContainer, cornerOverlappingContainer, ilen; ilen = this.wot.wtTable.getRenderedRowsCount(); for (var i = 0; i < ilen; i++) { var s = this.wot.wtTable.rowFilter.renderedToSource(i); if (s >= corners[0] && s <= corners[2]) { fromRow = s; break; } } for (var _i = ilen - 1; _i >= 0; _i--) { var _s = this.wot.wtTable.rowFilter.renderedToSource(_i); if (_s >= corners[0] && _s <= corners[2]) { toRow = _s; break; } } ilen = this.wot.wtTable.getRenderedColumnsCount(); for (var _i2 = 0; _i2 < ilen; _i2++) { var _s2 = this.wot.wtTable.columnFilter.renderedToSource(_i2); if (_s2 >= corners[1] && _s2 <= corners[3]) { fromColumn = _s2; break; } } for (var _i3 = ilen - 1; _i3 >= 0; _i3--) { var _s3 = this.wot.wtTable.columnFilter.renderedToSource(_i3); if (_s3 >= corners[1] && _s3 <= corners[3]) { toColumn = _s3; break; } } if (fromRow === void 0 || fromColumn === void 0) { this.disappear(); return; } isMultiple = fromRow !== toRow || fromColumn !== toColumn; fromTD = this.wot.wtTable.getCell(new _coords2.default(fromRow, fromColumn)); toTD = isMultiple ? this.wot.wtTable.getCell(new _coords2.default(toRow, toColumn)) : fromTD; fromOffset = (0, _element.offset)(fromTD); toOffset = isMultiple ? (0, _element.offset)(toTD) : fromOffset; containerOffset = (0, _element.offset)(this.wot.wtTable.TABLE); minTop = fromOffset.top; height = toOffset.top + (0, _element.outerHeight)(toTD) - minTop; minLeft = fromOffset.left; width = toOffset.left + (0, _element.outerWidth)(toTD) - minLeft; top = minTop - containerOffset.top - 1; left = minLeft - containerOffset.left - 1; var style = (0, _element.getComputedStyle)(fromTD); if (parseInt(style.borderTopWidth, 10) > 0) { top += 1; height = height > 0 ? height - 1 : 0; } if (parseInt(style.borderLeftWidth, 10) > 0) { left += 1; width = width > 0 ? width - 1 : 0; } this.topStyle.top = top + 'px'; this.topStyle.left = left + 'px'; this.topStyle.width = width + 'px'; this.topStyle.display = 'block'; this.leftStyle.top = top + 'px'; this.leftStyle.left = left + 'px'; this.leftStyle.height = height + 'px'; this.leftStyle.display = 'block'; var delta = Math.floor(this.settings.border.width / 2); this.bottomStyle.top = top + height - delta + 'px'; this.bottomStyle.left = left + 'px'; this.bottomStyle.width = width + 'px'; this.bottomStyle.display = 'block'; this.rightStyle.top = top + 'px'; this.rightStyle.left = left + width - delta + 'px'; this.rightStyle.height = height + 1 + 'px'; this.rightStyle.display = 'block'; if ((0, _browser.isMobileBrowser)() || !this.hasSetting(this.settings.border.cornerVisible) || this.isPartRange(toRow, toColumn)) { this.cornerStyle.display = 'none'; } else { this.cornerStyle.top = top + height - 4 + 'px'; this.cornerStyle.left = left + width - 4 + 'px'; this.cornerStyle.borderRightWidth = this.cornerDefaultStyle.borderWidth; this.cornerStyle.width = this.cornerDefaultStyle.width; // Hide the fill handle, so the possible further adjustments won't force unneeded scrollbars. this.cornerStyle.display = 'none'; trimmingContainer = (0, _element.getTrimmingContainer)(this.wot.wtTable.TABLE); if (toColumn === this.wot.getSetting('totalColumns') - 1) { cornerOverlappingContainer = toTD.offsetLeft + (0, _element.outerWidth)(toTD) + parseInt(this.cornerDefaultStyle.width, 10) / 2 >= (0, _element.innerWidth)(trimmingContainer); if (cornerOverlappingContainer) { this.cornerStyle.left = Math.floor(left + width - 3 - parseInt(this.cornerDefaultStyle.width, 10) / 2) + 'px'; this.cornerStyle.borderRightWidth = 0; } } if (toRow === this.wot.getSetting('totalRows') - 1) { cornerOverlappingContainer = toTD.offsetTop + (0, _element.outerHeight)(toTD) + parseInt(this.cornerDefaultStyle.height, 10) / 2 >= (0, _element.innerHeight)(trimmingContainer); if (cornerOverlappingContainer) { this.cornerStyle.top = Math.floor(top + height - 3 - parseInt(this.cornerDefaultStyle.height, 10) / 2) + 'px'; this.cornerStyle.borderBottomWidth = 0; } } this.cornerStyle.display = 'block'; } if ((0, _browser.isMobileBrowser)()) { this.updateMultipleSelectionHandlesPosition(fromRow, fromColumn, top, left, width, height); } } /** * Hide border */ }, { key: 'disappear', value: function disappear() { this.topStyle.display = 'none'; this.leftStyle.display = 'none'; this.bottomStyle.display = 'none'; this.rightStyle.display = 'none'; this.cornerStyle.display = 'none'; if ((0, _browser.isMobileBrowser)()) { this.selectionHandles.styles.topLeft.display = 'none'; this.selectionHandles.styles.bottomRight.display = 'none'; } } /** * @param {Function} setting * @returns {*} */ }, { key: 'hasSetting', value: function hasSetting(setting) { if (typeof setting === 'function') { return setting(); } return !!setting; } }]); return Border; }(); exports.default = Border; /***/ }), /* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var privatePool = new WeakMap(); /** * Calculates indexes of columns to render OR columns that are visible. * To redo the calculation, you need to create a new calculator. * * @class ViewportColumnsCalculator */ var ViewportColumnsCalculator = function () { _createClass(ViewportColumnsCalculator, null, [{ key: 'DEFAULT_WIDTH', /** * Default column width * * @type {Number} */ get: function get() { return 50; } /** * @param {Number} viewportWidth Width of the viewport * @param {Number} scrollOffset Current horizontal scroll position of the viewport * @param {Number} totalColumns Total number of rows * @param {Function} columnWidthFn Function that returns the width of the column at a given index (in px) * @param {Function} overrideFn Function that changes calculated this.startRow, this.endRow (used by MergeCells plugin) * @param {Boolean} onlyFullyVisible if `true`, only startRow and endRow will be indexes of rows that are fully in viewport * @param {Boolean} stretchH * @param {Function} [stretchingColumnWidthFn] Function that returns the new width of the stretched column. */ }]); function ViewportColumnsCalculator(viewportWidth, scrollOffset, totalColumns, columnWidthFn, overrideFn, onlyFullyVisible, stretchH) { var stretchingColumnWidthFn = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : function (width) { return width; }; _classCallCheck(this, ViewportColumnsCalculator); privatePool.set(this, { viewportWidth: viewportWidth, scrollOffset: scrollOffset, totalColumns: totalColumns, columnWidthFn: columnWidthFn, overrideFn: overrideFn, onlyFullyVisible: onlyFullyVisible, stretchingColumnWidthFn: stretchingColumnWidthFn }); /** * Number of rendered/visible columns * * @type {Number} */ this.count = 0; /** * Index of the first rendered/visible column (can be overwritten using overrideFn) * * @type {Number|null} */ this.startColumn = null; /** * Index of the last rendered/visible column (can be overwritten using overrideFn) * * @type {null} */ this.endColumn = null; /** * Position of the first rendered/visible column (in px) * * @type {Number|null} */ this.startPosition = null; this.stretchAllRatio = 0; this.stretchLastWidth = 0; this.stretch = stretchH; this.totalTargetWidth = 0; this.needVerifyLastColumnWidth = true; this.stretchAllColumnsWidth = []; this.calculate(); } /** * Calculates viewport */ _createClass(ViewportColumnsCalculator, [{ key: 'calculate', value: function calculate() { var sum = 0; var needReverse = true; var startPositions = []; var columnWidth = void 0; var priv = privatePool.get(this); var onlyFullyVisible = priv.onlyFullyVisible; var overrideFn = priv.overrideFn; var scrollOffset = priv.scrollOffset; var totalColumns = priv.totalColumns; var viewportWidth = priv.viewportWidth; for (var i = 0; i < totalColumns; i++) { columnWidth = this._getColumnWidth(i); if (sum <= scrollOffset && !onlyFullyVisible) { this.startColumn = i; } // +1 pixel for row header width compensation for horizontal scroll > 0 var compensatedViewportWidth = scrollOffset > 0 ? viewportWidth + 1 : viewportWidth; if (sum >= scrollOffset && sum + columnWidth <= scrollOffset + compensatedViewportWidth) { if (this.startColumn == null) { this.startColumn = i; } this.endColumn = i; } startPositions.push(sum); sum += columnWidth; if (!onlyFullyVisible) { this.endColumn = i; } if (sum >= scrollOffset + viewportWidth) { needReverse = false; break; } } if (this.endColumn === totalColumns - 1 && needReverse) { this.startColumn = this.endColumn; while (this.startColumn > 0) { var viewportSum = startPositions[this.endColumn] + columnWidth - startPositions[this.startColumn - 1]; if (viewportSum <= viewportWidth || !onlyFullyVisible) { this.startColumn--; } if (viewportSum > viewportWidth) { break; } } } if (this.startColumn !== null && overrideFn) { overrideFn(this); } this.startPosition = startPositions[this.startColumn]; if (this.startPosition == void 0) { this.startPosition = null; } if (this.startColumn !== null) { this.count = this.endColumn - this.startColumn + 1; } } /** * Recalculate columns stretching. * * @param {Number} totalWidth */ }, { key: 'refreshStretching', value: function refreshStretching(totalWidth) { if (this.stretch === 'none') { return; } this.totalTargetWidth = totalWidth; var priv = privatePool.get(this); var totalColumns = priv.totalColumns; var sumAll = 0; for (var i = 0; i < totalColumns; i++) { var columnWidth = this._getColumnWidth(i); var permanentColumnWidth = priv.stretchingColumnWidthFn(void 0, i); if (typeof permanentColumnWidth === 'number') { totalWidth -= permanentColumnWidth; } else { sumAll += columnWidth; } } var remainingSize = totalWidth - sumAll; if (this.stretch === 'all' && remainingSize > 0) { this.stretchAllRatio = totalWidth / sumAll; this.stretchAllColumnsWidth = []; this.needVerifyLastColumnWidth = true; } else if (this.stretch === 'last' && totalWidth !== Infinity) { var _columnWidth = this._getColumnWidth(totalColumns - 1); var lastColumnWidth = remainingSize + _columnWidth; this.stretchLastWidth = lastColumnWidth >= 0 ? lastColumnWidth : _columnWidth; } } /** * Get stretched column width based on stretchH (all or last) setting passed in handsontable instance. * * @param {Number} column * @param {Number} baseWidth * @returns {Number|null} */ }, { key: 'getStretchedColumnWidth', value: function getStretchedColumnWidth(column, baseWidth) { var result = null; if (this.stretch === 'all' && this.stretchAllRatio !== 0) { result = this._getStretchedAllColumnWidth(column, baseWidth); } else if (this.stretch === 'last' && this.stretchLastWidth !== 0) { result = this._getStretchedLastColumnWidth(column); } return result; } /** * @param {Number} column * @param {Number} baseWidth * @returns {Number} * @private */ }, { key: '_getStretchedAllColumnWidth', value: function _getStretchedAllColumnWidth(column, baseWidth) { var sumRatioWidth = 0; var priv = privatePool.get(this); var totalColumns = priv.totalColumns; if (!this.stretchAllColumnsWidth[column]) { var stretchedWidth = Math.round(baseWidth * this.stretchAllRatio); var newStretchedWidth = priv.stretchingColumnWidthFn(stretchedWidth, column); if (newStretchedWidth === void 0) { this.stretchAllColumnsWidth[column] = stretchedWidth; } else { this.stretchAllColumnsWidth[column] = isNaN(newStretchedWidth) ? this._getColumnWidth(column) : newStretchedWidth; } } if (this.stretchAllColumnsWidth.length === totalColumns && this.needVerifyLastColumnWidth) { this.needVerifyLastColumnWidth = false; for (var i = 0; i < this.stretchAllColumnsWidth.length; i++) { sumRatioWidth += this.stretchAllColumnsWidth[i]; } if (sumRatioWidth !== this.totalTargetWidth) { this.stretchAllColumnsWidth[this.stretchAllColumnsWidth.length - 1] += this.totalTargetWidth - sumRatioWidth; } } return this.stretchAllColumnsWidth[column]; } /** * @param {Number} column * @returns {Number|null} * @private */ }, { key: '_getStretchedLastColumnWidth', value: function _getStretchedLastColumnWidth(column) { var priv = privatePool.get(this); var totalColumns = priv.totalColumns; if (column === totalColumns - 1) { return this.stretchLastWidth; } return null; } /** * @param {Number} column Column index. * @returns {Number} * @private */ }, { key: '_getColumnWidth', value: function _getColumnWidth(column) { var width = privatePool.get(this).columnWidthFn(column); if (width === void 0) { width = ViewportColumnsCalculator.DEFAULT_WIDTH; } return width; } }]); return ViewportColumnsCalculator; }(); exports.default = ViewportColumnsCalculator; /***/ }), /* 61 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var privatePool = new WeakMap(); /** * Calculates indexes of rows to render OR rows that are visible. * To redo the calculation, you need to create a new calculator. * * @class ViewportRowsCalculator */ var ViewportRowsCalculator = function () { _createClass(ViewportRowsCalculator, null, [{ key: "DEFAULT_HEIGHT", /** * Default row height * * @type {Number} */ get: function get() { return 23; } /** * @param {Number} viewportHeight Height of the viewport * @param {Number} scrollOffset Current vertical scroll position of the viewport * @param {Number} totalRows Total number of rows * @param {Function} rowHeightFn Function that returns the height of the row at a given index (in px) * @param {Function} overrideFn Function that changes calculated this.startRow, this.endRow (used by MergeCells plugin) * @param {Boolean} onlyFullyVisible if `true`, only startRow and endRow will be indexes of rows that are fully in viewport * @param {Number} horizontalScrollbarHeight */ }]); function ViewportRowsCalculator(viewportHeight, scrollOffset, totalRows, rowHeightFn, overrideFn, onlyFullyVisible, horizontalScrollbarHeight) { _classCallCheck(this, ViewportRowsCalculator); privatePool.set(this, { viewportHeight: viewportHeight, scrollOffset: scrollOffset, totalRows: totalRows, rowHeightFn: rowHeightFn, overrideFn: overrideFn, onlyFullyVisible: onlyFullyVisible, horizontalScrollbarHeight: horizontalScrollbarHeight }); /** * Number of rendered/visible rows * * @type {Number} */ this.count = 0; /** * Index of the first rendered/visible row (can be overwritten using overrideFn) * * @type {Number|null} */ this.startRow = null; /** * Index of the last rendered/visible row (can be overwritten using overrideFn) * * @type {null} */ this.endRow = null; /** * Position of the first rendered/visible row (in px) * * @type {Number|null} */ this.startPosition = null; this.calculate(); } /** * Calculates viewport */ _createClass(ViewportRowsCalculator, [{ key: "calculate", value: function calculate() { var sum = 0; var needReverse = true; var startPositions = []; var priv = privatePool.get(this); var onlyFullyVisible = priv.onlyFullyVisible; var overrideFn = priv.overrideFn; var rowHeightFn = priv.rowHeightFn; var scrollOffset = priv.scrollOffset; var totalRows = priv.totalRows; var viewportHeight = priv.viewportHeight; var horizontalScrollbarHeight = priv.horizontalScrollbarHeight || 0; var rowHeight = void 0; // Calculate the number (start and end index) of rows needed for (var i = 0; i < totalRows; i++) { rowHeight = rowHeightFn(i); if (rowHeight === undefined) { rowHeight = ViewportRowsCalculator.DEFAULT_HEIGHT; } if (sum <= scrollOffset && !onlyFullyVisible) { this.startRow = i; } // the row is within the "visible range" if (sum >= scrollOffset && sum + rowHeight <= scrollOffset + viewportHeight - horizontalScrollbarHeight) { if (this.startRow === null) { this.startRow = i; } this.endRow = i; } startPositions.push(sum); sum += rowHeight; if (!onlyFullyVisible) { this.endRow = i; } if (sum >= scrollOffset + viewportHeight - horizontalScrollbarHeight) { needReverse = false; break; } } // If the estimation has reached the last row and there is still some space available in the viewport, // we need to render in reverse in order to fill the whole viewport with rows if (this.endRow === totalRows - 1 && needReverse) { this.startRow = this.endRow; while (this.startRow > 0) { // rowHeight is the height of the last row var viewportSum = startPositions[this.endRow] + rowHeight - startPositions[this.startRow - 1]; if (viewportSum <= viewportHeight - horizontalScrollbarHeight || !onlyFullyVisible) { this.startRow--; } if (viewportSum >= viewportHeight - horizontalScrollbarHeight) { break; } } } if (this.startRow !== null && overrideFn) { overrideFn(this); } this.startPosition = startPositions[this.startRow]; if (this.startPosition == void 0) { this.startPosition = null; } if (this.startRow !== null) { this.count = this.endRow - this.startRow + 1; } } }]); return ViewportRowsCalculator; }(); exports.default = ViewportRowsCalculator; /***/ }), /* 62 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _object = __webpack_require__(25); var _string = __webpack_require__(149); var _event = __webpack_require__(63); var _event2 = _interopRequireDefault(_event); var _overlays = __webpack_require__(66); var _overlays2 = _interopRequireDefault(_overlays); var _scroll = __webpack_require__(67); var _scroll2 = _interopRequireDefault(_scroll); var _settings = __webpack_require__(68); var _settings2 = _interopRequireDefault(_settings); var _table = __webpack_require__(69); var _table2 = _interopRequireDefault(_table); var _viewport = __webpack_require__(71); var _viewport2 = _interopRequireDefault(_viewport); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @class Walkontable */ var Walkontable = function () { /** * @param {Object} settings */ function Walkontable(settings) { _classCallCheck(this, Walkontable); var originalHeaders = []; // this is the namespace for global events this.guid = 'wt_' + (0, _string.randomString)(); // bootstrap from settings if (settings.cloneSource) { this.cloneSource = settings.cloneSource; this.cloneOverlay = settings.cloneOverlay; this.wtSettings = settings.cloneSource.wtSettings; this.wtTable = new _table2.default(this, settings.table, settings.wtRootElement); this.wtScroll = new _scroll2.default(this); this.wtViewport = settings.cloneSource.wtViewport; this.wtEvent = new _event2.default(this); this.selections = this.cloneSource.selections; } else { this.wtSettings = new _settings2.default(this, settings); this.wtTable = new _table2.default(this, settings.table); this.wtScroll = new _scroll2.default(this); this.wtViewport = new _viewport2.default(this); this.wtEvent = new _event2.default(this); this.selections = this.getSetting('selections'); this.wtOverlays = new _overlays2.default(this); this.exportSettingsAsClassNames(); } // find original headers if (this.wtTable.THEAD.childNodes.length && this.wtTable.THEAD.childNodes[0].childNodes.length) { for (var c = 0, clen = this.wtTable.THEAD.childNodes[0].childNodes.length; c < clen; c++) { originalHeaders.push(this.wtTable.THEAD.childNodes[0].childNodes[c].innerHTML); } if (!this.getSetting('columnHeaders').length) { this.update('columnHeaders', [function (column, TH) { (0, _element.fastInnerText)(TH, originalHeaders[column]); }]); } } this.drawn = false; this.drawInterrupted = false; } /** * Force rerender of Walkontable * * @param {Boolean} [fastDraw=false] When `true`, try to refresh only the positions of borders without rerendering * the data. It will only work if Table.draw() does not force * rendering anyway * @returns {Walkontable} */ _createClass(Walkontable, [{ key: 'draw', value: function draw() { var fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; this.drawInterrupted = false; if (!fastDraw && !(0, _element.isVisible)(this.wtTable.TABLE)) { // draw interrupted because TABLE is not visible this.drawInterrupted = true; } else { this.wtTable.draw(fastDraw); } return this; } /** * Returns the TD at coords. If topmost is set to true, returns TD from the topmost overlay layer, * if not set or set to false, returns TD from the master table. * * @param {CellCoords} coords * @param {Boolean} [topmost=false] * @returns {Object} */ }, { key: 'getCell', value: function getCell(coords) { var topmost = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (!topmost) { return this.wtTable.getCell(coords); } var totalRows = this.wtSettings.getSetting('totalRows'); var fixedRowsTop = this.wtSettings.getSetting('fixedRowsTop'); var fixedRowsBottom = this.wtSettings.getSetting('fixedRowsBottom'); var fixedColumns = this.wtSettings.getSetting('fixedColumnsLeft'); if (coords.row < fixedRowsTop && coords.col < fixedColumns) { return this.wtOverlays.topLeftCornerOverlay.clone.wtTable.getCell(coords); } else if (coords.row < fixedRowsTop) { return this.wtOverlays.topOverlay.clone.wtTable.getCell(coords); } else if (coords.col < fixedColumns && coords.row >= totalRows - fixedRowsBottom) { if (this.wtOverlays.bottomLeftCornerOverlay && this.wtOverlays.bottomLeftCornerOverlay.clone) { return this.wtOverlays.bottomLeftCornerOverlay.clone.wtTable.getCell(coords); } } else if (coords.col < fixedColumns) { return this.wtOverlays.leftOverlay.clone.wtTable.getCell(coords); } else if (coords.row < totalRows && coords.row > totalRows - fixedRowsBottom) { if (this.wtOverlays.bottomOverlay && this.wtOverlays.bottomOverlay.clone) { return this.wtOverlays.bottomOverlay.clone.wtTable.getCell(coords); } } return this.wtTable.getCell(coords); } /** * @param {Object} settings * @param {*} value * @returns {Walkontable} */ }, { key: 'update', value: function update(settings, value) { return this.wtSettings.update(settings, value); } /** * Scroll the viewport to a row at the given index in the data source * * @param {Number} row * @returns {Walkontable} */ }, { key: 'scrollVertical', value: function scrollVertical(row) { this.wtOverlays.topOverlay.scrollTo(row); this.getSetting('onScrollVertically'); return this; } /** * Scroll the viewport to a column at the given index in the data source * * @param {Number} column * @returns {Walkontable} */ }, { key: 'scrollHorizontal', value: function scrollHorizontal(column) { this.wtOverlays.leftOverlay.scrollTo(column); this.getSetting('onScrollHorizontally'); return this; } /** * Scrolls the viewport to a cell (rerenders if needed) * * @param {CellCoords} coords * @returns {Walkontable} */ }, { key: 'scrollViewport', value: function scrollViewport(coords) { this.wtScroll.scrollViewport(coords); return this; } /** * @returns {Array} */ }, { key: 'getViewport', value: function getViewport() { return [this.wtTable.getFirstVisibleRow(), this.wtTable.getFirstVisibleColumn(), this.wtTable.getLastVisibleRow(), this.wtTable.getLastVisibleColumn()]; } /** * Get overlay name * * @returns {String} */ }, { key: 'getOverlayName', value: function getOverlayName() { return this.cloneOverlay ? this.cloneOverlay.type : 'master'; } /** * Check overlay type of this Walkontable instance. * * @param {String} name Clone type @see {Overlay.CLONE_TYPES}. * @returns {Boolean} */ }, { key: 'isOverlayName', value: function isOverlayName(name) { if (this.cloneOverlay) { return this.cloneOverlay.type === name; } return false; } /** * Export settings as class names added to the parent element of the table. */ }, { key: 'exportSettingsAsClassNames', value: function exportSettingsAsClassNames() { var _this = this; var toExport = { rowHeaders: ['array'], columnHeaders: ['array'] }; var allClassNames = []; var newClassNames = []; (0, _object.objectEach)(toExport, function (optionType, key) { if (optionType.indexOf('array') > -1 && _this.getSetting(key).length) { newClassNames.push('ht' + (0, _string.toUpperCaseFirst)(key)); } allClassNames.push('ht' + (0, _string.toUpperCaseFirst)(key)); }); (0, _element.removeClass)(this.wtTable.wtRootElement.parentNode, allClassNames); (0, _element.addClass)(this.wtTable.wtRootElement.parentNode, newClassNames); } /** * Get/Set Walkontable instance setting * * @param {String} key * @param {*} [param1] * @param {*} [param2] * @param {*} [param3] * @param {*} [param4] * @returns {*} */ }, { key: 'getSetting', value: function getSetting(key, param1, param2, param3, param4) { // this is faster than .apply - https://github.com/handsontable/handsontable/wiki/JavaScript-&-DOM-performance-tips return this.wtSettings.getSetting(key, param1, param2, param3, param4); } /** * Checks if setting exists * * @param {String} key * @returns {Boolean} */ }, { key: 'hasSetting', value: function hasSetting(key) { return this.wtSettings.has(key); } /** * Destroy instance */ }, { key: 'destroy', value: function destroy() { this.wtOverlays.destroy(); this.wtEvent.destroy(); } }]); return Walkontable; }(); exports.default = Walkontable; /***/ }), /* 63 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _element = __webpack_require__(2); var _function = __webpack_require__(75); var _browser = __webpack_require__(32); var _eventManager = __webpack_require__(23); var _eventManager2 = _interopRequireDefault(_eventManager); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * */ function Event(instance) { var that = this; var eventManager = new _eventManager2.default(instance); this.instance = instance; var dblClickOrigin = [null, null]; this.dblClickTimeout = [null, null]; var onMouseDown = function onMouseDown(event) { var activeElement = document.activeElement; var getParentNode = (0, _function.partial)(_element.getParent, event.realTarget); var realTarget = event.realTarget; // ignore focusable element from mouse down processing (https://github.com/handsontable/handsontable/issues/3555) if (realTarget === activeElement || getParentNode(0) === activeElement || getParentNode(1) === activeElement) { return; } var cell = that.parentCell(realTarget); if ((0, _element.hasClass)(realTarget, 'corner')) { that.instance.getSetting('onCellCornerMouseDown', event, realTarget); } else if (cell.TD) { if (that.instance.hasSetting('onCellMouseDown')) { that.instance.getSetting('onCellMouseDown', event, cell.coords, cell.TD, that.instance); } } if (event.button !== 2) { // if not right mouse button if (cell.TD) { dblClickOrigin[0] = cell.TD; clearTimeout(that.dblClickTimeout[0]); that.dblClickTimeout[0] = setTimeout(function () { dblClickOrigin[0] = null; }, 1000); } } }; var onTouchMove = function onTouchMove(event) { that.instance.touchMoving = true; }; var longTouchTimeout; var onTouchStart = function onTouchStart(event) { var container = this; eventManager.addEventListener(this, 'touchmove', onTouchMove); // Prevent cell selection when scrolling with touch event - not the best solution performance-wise that.checkIfTouchMove = setTimeout(function () { if (that.instance.touchMoving === true) { that.instance.touchMoving = void 0; eventManager.removeEventListener('touchmove', onTouchMove, false); } onMouseDown(event); }, 30); }; var onMouseOver = function onMouseOver(event) { var table, td, mainWOT; if (that.instance.hasSetting('onCellMouseOver')) { table = that.instance.wtTable.TABLE; td = (0, _element.closestDown)(event.realTarget, ['TD', 'TH'], table); mainWOT = that.instance.cloneSource || that.instance; if (td && td !== mainWOT.lastMouseOver && (0, _element.isChildOf)(td, table)) { mainWOT.lastMouseOver = td; that.instance.getSetting('onCellMouseOver', event, that.instance.wtTable.getCoords(td), td, that.instance); } } }; var onMouseOut = function onMouseOut(event) { var table = void 0; var lastTD = void 0; var nextTD = void 0; if (that.instance.hasSetting('onCellMouseOut')) { table = that.instance.wtTable.TABLE; lastTD = (0, _element.closestDown)(event.realTarget, ['TD', 'TH'], table); nextTD = (0, _element.closestDown)(event.relatedTarget, ['TD', 'TH'], table); if (lastTD && lastTD !== nextTD && (0, _element.isChildOf)(lastTD, table)) { that.instance.getSetting('onCellMouseOut', event, that.instance.wtTable.getCoords(lastTD), lastTD, that.instance); } } }; var onMouseUp = function onMouseUp(event) { if (event.button !== 2) { // if not right mouse button var cell = that.parentCell(event.realTarget); if (cell.TD === dblClickOrigin[0] && cell.TD === dblClickOrigin[1]) { if ((0, _element.hasClass)(event.realTarget, 'corner')) { that.instance.getSetting('onCellCornerDblClick', event, cell.coords, cell.TD, that.instance); } else { that.instance.getSetting('onCellDblClick', event, cell.coords, cell.TD, that.instance); } dblClickOrigin[0] = null; dblClickOrigin[1] = null; } else if (cell.TD === dblClickOrigin[0]) { that.instance.getSetting('onCellMouseUp', event, cell.coords, cell.TD, that.instance); dblClickOrigin[1] = cell.TD; clearTimeout(that.dblClickTimeout[1]); that.dblClickTimeout[1] = setTimeout(function () { dblClickOrigin[1] = null; }, 500); } else if (cell.TD && that.instance.hasSetting('onCellMouseUp')) { that.instance.getSetting('onCellMouseUp', event, cell.coords, cell.TD, that.instance); } } }; var onTouchEnd = function onTouchEnd(event) { clearTimeout(longTouchTimeout); // that.instance.longTouch == void 0; event.preventDefault(); onMouseUp(event); // eventManager.removeEventListener(that.instance.wtTable.holder, "mouseup", onMouseUp); }; eventManager.addEventListener(this.instance.wtTable.holder, 'mousedown', onMouseDown); eventManager.addEventListener(this.instance.wtTable.TABLE, 'mouseover', onMouseOver); eventManager.addEventListener(this.instance.wtTable.TABLE, 'mouseout', onMouseOut); eventManager.addEventListener(this.instance.wtTable.holder, 'mouseup', onMouseUp); // check if full HOT instance, or detached WOT AND run on mobile device if (this.instance.wtTable.holder.parentNode.parentNode && (0, _browser.isMobileBrowser)() && !that.instance.wtTable.isWorkingOnClone()) { var classSelector = '.' + this.instance.wtTable.holder.parentNode.className.split(' ').join('.'); eventManager.addEventListener(this.instance.wtTable.holder, 'touchstart', function (event) { that.instance.touchApplied = true; if ((0, _element.isChildOf)(event.target, classSelector)) { onTouchStart.call(event.target, event); } }); eventManager.addEventListener(this.instance.wtTable.holder, 'touchend', function (event) { that.instance.touchApplied = false; if ((0, _element.isChildOf)(event.target, classSelector)) { onTouchEnd.call(event.target, event); } }); if (!that.instance.momentumScrolling) { that.instance.momentumScrolling = {}; } eventManager.addEventListener(this.instance.wtTable.holder, 'scroll', function (event) { clearTimeout(that.instance.momentumScrolling._timeout); if (!that.instance.momentumScrolling.ongoing) { that.instance.getSetting('onBeforeTouchScroll'); } that.instance.momentumScrolling.ongoing = true; that.instance.momentumScrolling._timeout = setTimeout(function () { if (!that.instance.touchApplied) { that.instance.momentumScrolling.ongoing = false; that.instance.getSetting('onAfterMomentumScroll'); } }, 200); }); } eventManager.addEventListener(window, 'resize', function () { if (that.instance.getSetting('stretchH') !== 'none') { that.instance.draw(); } }); this.destroy = function () { clearTimeout(this.dblClickTimeout[0]); clearTimeout(this.dblClickTimeout[1]); eventManager.destroy(); }; } Event.prototype.parentCell = function (elem) { var cell = {}; var TABLE = this.instance.wtTable.TABLE; var TD = (0, _element.closestDown)(elem, ['TD', 'TH'], TABLE); if (TD) { cell.coords = this.instance.wtTable.getCoords(TD); cell.TD = TD; } else if ((0, _element.hasClass)(elem, 'wtBorder') && (0, _element.hasClass)(elem, 'current')) { cell.coords = this.instance.selections.current.cellRange.highlight; // selections.current is current selected cell cell.TD = this.instance.wtTable.getCell(cell.coords); } else if ((0, _element.hasClass)(elem, 'wtBorder') && (0, _element.hasClass)(elem, 'area')) { if (this.instance.selections.area.cellRange) { cell.coords = this.instance.selections.area.cellRange.to; // selections.area is area selected cells cell.TD = this.instance.wtTable.getCell(cell.coords); } } return cell; }; exports.default = Event; /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @class ColumnFilter */ var ColumnFilter = function () { /** * @param {Number} offset * @param {Number} total * @param {Number} countTH */ function ColumnFilter(offset, total, countTH) { _classCallCheck(this, ColumnFilter); this.offset = offset; this.total = total; this.countTH = countTH; } /** * @param index * @returns {Number} */ _createClass(ColumnFilter, [{ key: "offsetted", value: function offsetted(index) { return index + this.offset; } /** * @param index * @returns {Number} */ }, { key: "unOffsetted", value: function unOffsetted(index) { return index - this.offset; } /** * @param index * @returns {Number} */ }, { key: "renderedToSource", value: function renderedToSource(index) { return this.offsetted(index); } /** * @param index * @returns {Number} */ }, { key: "sourceToRendered", value: function sourceToRendered(index) { return this.unOffsetted(index); } /** * @param index * @returns {Number} */ }, { key: "offsettedTH", value: function offsettedTH(index) { return index - this.countTH; } /** * @param index * @returns {Number} */ }, { key: "unOffsettedTH", value: function unOffsettedTH(index) { return index + this.countTH; } /** * @param index * @returns {Number} */ }, { key: "visibleRowHeadedColumnToSourceColumn", value: function visibleRowHeadedColumnToSourceColumn(index) { return this.renderedToSource(this.offsettedTH(index)); } /** * @param index * @returns {Number} */ }, { key: "sourceColumnToVisibleRowHeadedColumn", value: function sourceColumnToVisibleRowHeadedColumn(index) { return this.unOffsettedTH(this.sourceToRendered(index)); } }]); return ColumnFilter; }(); exports.default = ColumnFilter; /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @class RowFilter */ var RowFilter = function () { /** * @param {Number} offset * @param {Number} total * @param {Number} countTH */ function RowFilter(offset, total, countTH) { _classCallCheck(this, RowFilter); this.offset = offset; this.total = total; this.countTH = countTH; } /** * @param index * @returns {Number} */ _createClass(RowFilter, [{ key: "offsetted", value: function offsetted(index) { return index + this.offset; } /** * @param index * @returns {Number} */ }, { key: "unOffsetted", value: function unOffsetted(index) { return index - this.offset; } /** * @param index * @returns {Number} */ }, { key: "renderedToSource", value: function renderedToSource(index) { return this.offsetted(index); } /** * @param index * @returns {Number} */ }, { key: "sourceToRendered", value: function sourceToRendered(index) { return this.unOffsetted(index); } /** * @param index * @returns {Number} */ }, { key: "offsettedTH", value: function offsettedTH(index) { return index - this.countTH; } /** * @param index * @returns {Number} */ }, { key: "unOffsettedTH", value: function unOffsettedTH(index) { return index + this.countTH; } /** * @param index * @returns {Number} */ }, { key: "visibleColHeadedRowToSourceRow", value: function visibleColHeadedRowToSourceRow(index) { return this.renderedToSource(this.offsettedTH(index)); } /** * @param index * @returns {Number} */ }, { key: "sourceRowToVisibleColHeadedRow", value: function sourceRowToVisibleColHeadedRow(index) { return this.unOffsettedTH(this.sourceToRendered(index)); } }]); return RowFilter; }(); exports.default = RowFilter; /***/ }), /* 66 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _array = __webpack_require__(24); var _unicode = __webpack_require__(150); var _browser = __webpack_require__(32); var _eventManager = __webpack_require__(23); var _eventManager2 = _interopRequireDefault(_eventManager); var _base = __webpack_require__(11); var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @class Overlays */ var Overlays = function () { /** * @param {Walkontable} wotInstance */ function Overlays(wotInstance) { _classCallCheck(this, Overlays); this.wot = wotInstance; // legacy support this.instance = this.wot; this.eventManager = new _eventManager2.default(this.wot); this.wot.update('scrollbarWidth', (0, _element.getScrollbarWidth)()); this.wot.update('scrollbarHeight', (0, _element.getScrollbarWidth)()); this.scrollableElement = (0, _element.getScrollableElement)(this.wot.wtTable.TABLE); this.prepareOverlays(); this.destroyed = false; this.keyPressed = false; this.spreaderLastSize = { width: null, height: null }; this.overlayScrollPositions = { master: { top: 0, left: 0 }, top: { top: null, left: 0 }, bottom: { top: null, left: 0 }, left: { top: 0, left: null } }; this.pendingScrollCallbacks = { master: { top: 0, left: 0 }, top: { left: 0 }, bottom: { left: 0 }, left: { top: 0 } }; this.verticalScrolling = false; this.horizontalScrolling = false; this.delegatedScrollCallback = false; this.registeredListeners = []; this.registerListeners(); } /** * Prepare overlays based on user settings. * * @returns {Boolean} Returns `true` if changes applied to overlay needs scroll synchronization. */ _createClass(Overlays, [{ key: 'prepareOverlays', value: function prepareOverlays() { var syncScroll = false; if (this.topOverlay) { syncScroll = this.topOverlay.updateStateOfRendering() || syncScroll; } else { this.topOverlay = _base2.default.createOverlay(_base2.default.CLONE_TOP, this.wot); } if (!_base2.default.hasOverlay(_base2.default.CLONE_BOTTOM)) { this.bottomOverlay = { needFullRender: false, updateStateOfRendering: function updateStateOfRendering() { return false; } }; } if (!_base2.default.hasOverlay(_base2.default.CLONE_BOTTOM_LEFT_CORNER)) { this.bottomLeftCornerOverlay = { needFullRender: false, updateStateOfRendering: function updateStateOfRendering() { return false; } }; } if (this.bottomOverlay) { syncScroll = this.bottomOverlay.updateStateOfRendering() || syncScroll; } else { this.bottomOverlay = _base2.default.createOverlay(_base2.default.CLONE_BOTTOM, this.wot); } if (this.leftOverlay) { syncScroll = this.leftOverlay.updateStateOfRendering() || syncScroll; } else { this.leftOverlay = _base2.default.createOverlay(_base2.default.CLONE_LEFT, this.wot); } if (this.topOverlay.needFullRender && this.leftOverlay.needFullRender) { if (this.topLeftCornerOverlay) { syncScroll = this.topLeftCornerOverlay.updateStateOfRendering() || syncScroll; } else { this.topLeftCornerOverlay = _base2.default.createOverlay(_base2.default.CLONE_TOP_LEFT_CORNER, this.wot); } } if (this.bottomOverlay.needFullRender && this.leftOverlay.needFullRender) { if (this.bottomLeftCornerOverlay) { syncScroll = this.bottomLeftCornerOverlay.updateStateOfRendering() || syncScroll; } else { this.bottomLeftCornerOverlay = _base2.default.createOverlay(_base2.default.CLONE_BOTTOM_LEFT_CORNER, this.wot); } } if (this.wot.getSetting('debug') && !this.debug) { this.debug = _base2.default.createOverlay(_base2.default.CLONE_DEBUG, this.wot); } return syncScroll; } /** * Refresh and redraw table */ }, { key: 'refreshAll', value: function refreshAll() { if (!this.wot.drawn) { return; } if (!this.wot.wtTable.holder.parentNode) { // Walkontable was detached from DOM, but this handler was not removed this.destroy(); return; } this.wot.draw(true); if (this.verticalScrolling) { this.leftOverlay.onScroll(); } if (this.horizontalScrolling) { this.topOverlay.onScroll(); } this.verticalScrolling = false; this.horizontalScrolling = false; } /** * Register all necessary event listeners. */ }, { key: 'registerListeners', value: function registerListeners() { var _this = this; var topOverlayScrollable = this.topOverlay.mainTableScrollableElement; var leftOverlayScrollable = this.leftOverlay.mainTableScrollableElement; var listenersToRegister = []; listenersToRegister.push([document.documentElement, 'keydown', function (event) { return _this.onKeyDown(event); }]); listenersToRegister.push([document.documentElement, 'keyup', function () { return _this.onKeyUp(); }]); listenersToRegister.push([document, 'visibilitychange', function () { return _this.onKeyUp(); }]); listenersToRegister.push([topOverlayScrollable, 'scroll', function (event) { return _this.onTableScroll(event); }]); if (topOverlayScrollable !== leftOverlayScrollable) { listenersToRegister.push([leftOverlayScrollable, 'scroll', function (event) { return _this.onTableScroll(event); }]); } if (this.topOverlay.needFullRender) { listenersToRegister.push([this.topOverlay.clone.wtTable.holder, 'scroll', function (event) { return _this.onTableScroll(event); }]); listenersToRegister.push([this.topOverlay.clone.wtTable.holder, 'wheel', function (event) { return _this.onTableScroll(event); }]); } if (this.bottomOverlay.needFullRender) { listenersToRegister.push([this.bottomOverlay.clone.wtTable.holder, 'scroll', function (event) { return _this.onTableScroll(event); }]); listenersToRegister.push([this.bottomOverlay.clone.wtTable.holder, 'wheel', function (event) { return _this.onTableScroll(event); }]); } if (this.leftOverlay.needFullRender) { listenersToRegister.push([this.leftOverlay.clone.wtTable.holder, 'scroll', function (event) { return _this.onTableScroll(event); }]); listenersToRegister.push([this.leftOverlay.clone.wtTable.holder, 'wheel', function (event) { return _this.onTableScroll(event); }]); } if (this.topLeftCornerOverlay && this.topLeftCornerOverlay.needFullRender) { listenersToRegister.push([this.topLeftCornerOverlay.clone.wtTable.holder, 'wheel', function (event) { return _this.onTableScroll(event); }]); } if (this.bottomLeftCornerOverlay && this.bottomLeftCornerOverlay.needFullRender) { listenersToRegister.push([this.bottomLeftCornerOverlay.clone.wtTable.holder, 'wheel', function (event) { return _this.onTableScroll(event); }]); } if (this.topOverlay.trimmingContainer !== window && this.leftOverlay.trimmingContainer !== window) { // This is necessary? // eventManager.addEventListener(window, 'scroll', (event) => this.refreshAll(event)); listenersToRegister.push([window, 'wheel', function (event) { var overlay = void 0; var deltaY = event.wheelDeltaY || event.deltaY; var deltaX = event.wheelDeltaX || event.deltaX; if (_this.topOverlay.clone.wtTable.holder.contains(event.realTarget)) { overlay = 'top'; } else if (_this.bottomOverlay.clone && _this.bottomOverlay.clone.wtTable.holder.contains(event.realTarget)) { overlay = 'bottom'; } else if (_this.leftOverlay.clone.wtTable.holder.contains(event.realTarget)) { overlay = 'left'; } else if (_this.topLeftCornerOverlay && _this.topLeftCornerOverlay.clone && _this.topLeftCornerOverlay.clone.wtTable.holder.contains(event.realTarget)) { overlay = 'topLeft'; } else if (_this.bottomLeftCornerOverlay && _this.bottomLeftCornerOverlay.clone && _this.bottomLeftCornerOverlay.clone.wtTable.holder.contains(event.realTarget)) { overlay = 'bottomLeft'; } if (overlay == 'top' && deltaY !== 0 || overlay == 'left' && deltaX !== 0 || overlay == 'bottom' && deltaY !== 0 || (overlay === 'topLeft' || overlay === 'bottomLeft') && (deltaY !== 0 || deltaX !== 0)) { event.preventDefault(); } }]); } while (listenersToRegister.length) { var listener = listenersToRegister.pop(); this.eventManager.addEventListener(listener[0], listener[1], listener[2]); this.registeredListeners.push(listener); } } /** * Deregister all previously registered listeners. */ }, { key: 'deregisterListeners', value: function deregisterListeners() { while (this.registeredListeners.length) { var listener = this.registeredListeners.pop(); this.eventManager.removeEventListener(listener[0], listener[1], listener[2]); } } /** * Scroll listener * * @param {Event} event */ }, { key: 'onTableScroll', value: function onTableScroll(event) { // if mobile browser, do not update scroll positions, as the overlays are hidden during the scroll if ((0, _browser.isMobileBrowser)()) { return; } var masterHorizontal = this.leftOverlay.mainTableScrollableElement; var masterVertical = this.topOverlay.mainTableScrollableElement; var target = event.target; // For key press, sync only master -> overlay position because while pressing Walkontable.render is triggered // by hot.refreshBorder if (this.keyPressed) { if (masterVertical !== window && target !== window && !event.target.contains(masterVertical) || masterHorizontal !== window && target !== window && !event.target.contains(masterHorizontal)) { return; } } if (event.type === 'scroll') { this.syncScrollPositions(event); } else { this.translateMouseWheelToScroll(event); } } /** * Key down listener */ }, { key: 'onKeyDown', value: function onKeyDown(event) { this.keyPressed = (0, _unicode.isKey)(event.keyCode, 'ARROW_UP|ARROW_RIGHT|ARROW_DOWN|ARROW_LEFT'); } /** * Key up listener */ }, { key: 'onKeyUp', value: function onKeyUp() { this.keyPressed = false; } /** * Translate wheel event into scroll event and sync scroll overlays position * * @private * @param {Event} event * @returns {Boolean} */ }, { key: 'translateMouseWheelToScroll', value: function translateMouseWheelToScroll(event) { var topOverlay = this.topOverlay.clone.wtTable.holder; var bottomOverlay = this.bottomOverlay.clone ? this.bottomOverlay.clone.wtTable.holder : null; var leftOverlay = this.leftOverlay.clone.wtTable.holder; var topLeftCornerOverlay = this.topLeftCornerOverlay && this.topLeftCornerOverlay.clone ? this.topLeftCornerOverlay.clone.wtTable.holder : null; var bottomLeftCornerOverlay = this.bottomLeftCornerOverlay && this.bottomLeftCornerOverlay.clone ? this.bottomLeftCornerOverlay.clone.wtTable.holder : null; var mouseWheelSpeedRatio = -0.2; var deltaY = event.wheelDeltaY || -1 * event.deltaY; var deltaX = event.wheelDeltaX || -1 * event.deltaX; var parentHolder = null; var eventMockup = { type: 'wheel' }; var tempElem = event.target; var delta = null; // Fix for extremely slow header scrolling with a mousewheel on Firefox if (event.deltaMode === 1) { deltaY *= 120; deltaX *= 120; } while (tempElem != document && tempElem != null) { if (tempElem.className.indexOf('wtHolder') > -1) { parentHolder = tempElem; break; } tempElem = tempElem.parentNode; } eventMockup.target = parentHolder; if (parentHolder === topLeftCornerOverlay || parentHolder === bottomLeftCornerOverlay) { this.syncScrollPositions(eventMockup, mouseWheelSpeedRatio * deltaX, 'x'); this.syncScrollPositions(eventMockup, mouseWheelSpeedRatio * deltaY, 'y'); } else { if (parentHolder === topOverlay || parentHolder === bottomOverlay) { delta = deltaY; } else if (parentHolder === leftOverlay) { delta = deltaX; } this.syncScrollPositions(eventMockup, mouseWheelSpeedRatio * delta); } return false; } /** * Synchronize scroll position between master table and overlay table. * * @private * @param {Event|Object} event * @param {Number} [fakeScrollValue=null] * @param {String} [fakeScrollDirection=null] `x` or `y`. */ }, { key: 'syncScrollPositions', value: function syncScrollPositions(event) { var fakeScrollValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var fakeScrollDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; if (this.destroyed) { return; } if (arguments.length === 0) { this.syncScrollWithMaster(); return; } var masterHorizontal = this.leftOverlay.mainTableScrollableElement; var masterVertical = this.topOverlay.mainTableScrollableElement; var target = event.target; var tempScrollValue = 0; var scrollValueChanged = false; var topOverlay = void 0; var leftOverlay = void 0; var topLeftCornerOverlay = void 0; var bottomLeftCornerOverlay = void 0; var bottomOverlay = void 0; var delegatedScroll = false; var preventOverflow = this.wot.getSetting('preventOverflow'); if (this.topOverlay.needFullRender) { topOverlay = this.topOverlay.clone.wtTable.holder; } if (this.bottomOverlay.needFullRender) { bottomOverlay = this.bottomOverlay.clone.wtTable.holder; } if (this.leftOverlay.needFullRender) { leftOverlay = this.leftOverlay.clone.wtTable.holder; } if (this.leftOverlay.needFullRender && this.topOverlay.needFullRender) { topLeftCornerOverlay = this.topLeftCornerOverlay.clone.wtTable.holder; } if (this.leftOverlay.needFullRender && this.bottomOverlay.needFullRender) { bottomLeftCornerOverlay = this.bottomLeftCornerOverlay.clone.wtTable.holder; } if (target === document) { target = window; } if (target === masterHorizontal || target === masterVertical) { if (preventOverflow) { tempScrollValue = (0, _element.getScrollLeft)(this.scrollableElement); } else { tempScrollValue = (0, _element.getScrollLeft)(target); } // if scrolling the master table - populate the scroll values to both top and left overlays this.horizontalScrolling = true; this.overlayScrollPositions.master.left = tempScrollValue; scrollValueChanged = true; if (this.pendingScrollCallbacks.master.left > 0) { this.pendingScrollCallbacks.master.left--; } else { if (topOverlay && topOverlay.scrollLeft !== tempScrollValue) { if (fakeScrollValue == null) { this.pendingScrollCallbacks.top.left++; } topOverlay.scrollLeft = tempScrollValue; delegatedScroll = masterHorizontal !== window; } if (bottomOverlay && bottomOverlay.scrollLeft !== tempScrollValue) { if (fakeScrollValue == null) { this.pendingScrollCallbacks.bottom.left++; } bottomOverlay.scrollLeft = tempScrollValue; delegatedScroll = masterHorizontal !== window; } } tempScrollValue = (0, _element.getScrollTop)(target); this.verticalScrolling = true; this.overlayScrollPositions.master.top = tempScrollValue; scrollValueChanged = true; if (this.pendingScrollCallbacks.master.top > 0) { this.pendingScrollCallbacks.master.top--; } else if (leftOverlay && leftOverlay.scrollTop !== tempScrollValue) { if (fakeScrollValue == null) { this.pendingScrollCallbacks.left.top++; } leftOverlay.scrollTop = tempScrollValue; delegatedScroll = masterVertical !== window; } } else if (target === bottomOverlay) { tempScrollValue = (0, _element.getScrollLeft)(target); // if scrolling the bottom overlay - populate the horizontal scroll to the master table this.horizontalScrolling = true; this.overlayScrollPositions.bottom.left = tempScrollValue; scrollValueChanged = true; if (this.pendingScrollCallbacks.bottom.left > 0) { this.pendingScrollCallbacks.bottom.left--; } else { if (fakeScrollValue == null) { this.pendingScrollCallbacks.master.left++; } masterHorizontal.scrollLeft = tempScrollValue; if (topOverlay && topOverlay.scrollLeft !== tempScrollValue) { if (fakeScrollValue == null) { this.pendingScrollCallbacks.top.left++; } topOverlay.scrollLeft = tempScrollValue; delegatedScroll = masterVertical !== window; } } // "fake" scroll value calculated from the mousewheel event if (fakeScrollValue !== null) { scrollValueChanged = true; masterVertical.scrollTop += fakeScrollValue; } } else if (target === topOverlay) { tempScrollValue = (0, _element.getScrollLeft)(target); // if scrolling the top overlay - populate the horizontal scroll to the master table this.horizontalScrolling = true; this.overlayScrollPositions.top.left = tempScrollValue; scrollValueChanged = true; if (this.pendingScrollCallbacks.top.left > 0) { this.pendingScrollCallbacks.top.left--; } else { if (fakeScrollValue == null) { this.pendingScrollCallbacks.master.left++; } masterHorizontal.scrollLeft = tempScrollValue; } // "fake" scroll value calculated from the mousewheel event if (fakeScrollValue !== null) { scrollValueChanged = true; masterVertical.scrollTop += fakeScrollValue; } if (bottomOverlay && bottomOverlay.scrollLeft !== tempScrollValue) { if (fakeScrollValue == null) { this.pendingScrollCallbacks.bottom.left++; } bottomOverlay.scrollLeft = tempScrollValue; delegatedScroll = masterVertical !== window; } } else if (target === leftOverlay) { tempScrollValue = (0, _element.getScrollTop)(target); // if scrolling the left overlay - populate the vertical scroll to the master table if (this.overlayScrollPositions.left.top !== tempScrollValue) { this.verticalScrolling = true; this.overlayScrollPositions.left.top = tempScrollValue; scrollValueChanged = true; if (this.pendingScrollCallbacks.left.top > 0) { this.pendingScrollCallbacks.left.top--; } else { if (fakeScrollValue == null) { this.pendingScrollCallbacks.master.top++; } masterVertical.scrollTop = tempScrollValue; } } // "fake" scroll value calculated from the mousewheel event if (fakeScrollValue !== null) { scrollValueChanged = true; masterVertical.scrollLeft += fakeScrollValue; } } else if (target === topLeftCornerOverlay || target === bottomLeftCornerOverlay) { if (fakeScrollValue !== null) { scrollValueChanged = true; if (fakeScrollDirection === 'x') { masterVertical.scrollLeft += fakeScrollValue; } else if (fakeScrollDirection === 'y') { masterVertical.scrollTop += fakeScrollValue; } } } if (!this.keyPressed && scrollValueChanged && event.type === 'scroll') { if (this.delegatedScrollCallback) { this.delegatedScrollCallback = false; } else { this.refreshAll(); } if (delegatedScroll) { this.delegatedScrollCallback = true; } } } /** * Synchronize overlay scrollbars with the master scrollbar */ }, { key: 'syncScrollWithMaster', value: function syncScrollWithMaster() { var master = this.topOverlay.mainTableScrollableElement; var scrollLeft = master.scrollLeft, scrollTop = master.scrollTop; if (this.topOverlay.needFullRender) { this.topOverlay.clone.wtTable.holder.scrollLeft = scrollLeft; } if (this.bottomOverlay.needFullRender) { this.bottomOverlay.clone.wtTable.holder.scrollLeft = scrollLeft; } if (this.leftOverlay.needFullRender) { this.leftOverlay.clone.wtTable.holder.scrollTop = scrollTop; } } /** * Update the main scrollable elements for all the overlays. */ }, { key: 'updateMainScrollableElements', value: function updateMainScrollableElements() { this.deregisterListeners(); this.leftOverlay.updateMainScrollableElement(); this.topOverlay.updateMainScrollableElement(); if (this.bottomOverlay.needFullRender) { this.bottomOverlay.updateMainScrollableElement(); } this.scrollableElement = (0, _element.getScrollableElement)(this.wot.wtTable.TABLE); this.registerListeners(); } /** * */ }, { key: 'destroy', value: function destroy() { this.eventManager.destroy(); this.topOverlay.destroy(); if (this.bottomOverlay.clone) { this.bottomOverlay.destroy(); } this.leftOverlay.destroy(); if (this.topLeftCornerOverlay) { this.topLeftCornerOverlay.destroy(); } if (this.bottomLeftCornerOverlay && this.bottomLeftCornerOverlay.clone) { this.bottomLeftCornerOverlay.destroy(); } if (this.debug) { this.debug.destroy(); } this.destroyed = true; } /** * @param {Boolean} [fastDraw=false] */ }, { key: 'refresh', value: function refresh() { var fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (this.topOverlay.areElementSizesAdjusted && this.leftOverlay.areElementSizesAdjusted) { var container = this.wot.wtTable.wtRootElement.parentNode || this.wot.wtTable.wtRootElement; var width = container.clientWidth; var height = container.clientHeight; if (width !== this.spreaderLastSize.width || height !== this.spreaderLastSize.height) { this.spreaderLastSize.width = width; this.spreaderLastSize.height = height; this.adjustElementsSize(); } } if (this.bottomOverlay.clone) { this.bottomOverlay.refresh(fastDraw); } this.leftOverlay.refresh(fastDraw); this.topOverlay.refresh(fastDraw); if (this.topLeftCornerOverlay) { this.topLeftCornerOverlay.refresh(fastDraw); } if (this.bottomLeftCornerOverlay && this.bottomLeftCornerOverlay.clone) { this.bottomLeftCornerOverlay.refresh(fastDraw); } if (this.debug) { this.debug.refresh(fastDraw); } } /** * Adjust overlays elements size and master table size * * @param {Boolean} [force=false] */ }, { key: 'adjustElementsSize', value: function adjustElementsSize() { var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var totalColumns = this.wot.getSetting('totalColumns'); var totalRows = this.wot.getSetting('totalRows'); var headerRowSize = this.wot.wtViewport.getRowHeaderWidth(); var headerColumnSize = this.wot.wtViewport.getColumnHeaderHeight(); var hiderStyle = this.wot.wtTable.hider.style; hiderStyle.width = headerRowSize + this.leftOverlay.sumCellSizes(0, totalColumns) + 'px'; hiderStyle.height = headerColumnSize + this.topOverlay.sumCellSizes(0, totalRows) + 1 + 'px'; this.topOverlay.adjustElementsSize(force); this.leftOverlay.adjustElementsSize(force); if (this.bottomOverlay.clone) { this.bottomOverlay.adjustElementsSize(force); } } /** * */ }, { key: 'applyToDOM', value: function applyToDOM() { if (!this.topOverlay.areElementSizesAdjusted || !this.leftOverlay.areElementSizesAdjusted) { this.adjustElementsSize(); } this.topOverlay.applyToDOM(); if (this.bottomOverlay.clone) { this.bottomOverlay.applyToDOM(); } this.leftOverlay.applyToDOM(); } /** * Get the parent overlay of the provided element. * * @param {HTMLElement} element * @returns {Object|null} */ }, { key: 'getParentOverlay', value: function getParentOverlay(element) { if (!element) { return null; } var overlays = [this.topOverlay, this.leftOverlay, this.bottomOverlay, this.topLeftCornerOverlay, this.bottomLeftCornerOverlay]; var result = null; (0, _array.arrayEach)(overlays, function (elem, i) { if (!elem) { return; } if (elem.clone && elem.clone.wtTable.TABLE.contains(element)) { result = elem.clone; } }); return result; } }]); return Overlays; }(); exports.default = Overlays; /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _number = __webpack_require__(76); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @class Scroll */ var Scroll = function () { /** * @param {Walkontable} wotInstance */ function Scroll(wotInstance) { _classCallCheck(this, Scroll); this.wot = wotInstance; // legacy support this.instance = wotInstance; } /** * Scrolls viewport to a cell by minimum number of cells * * @param {CellCoords} coords */ _createClass(Scroll, [{ key: 'scrollViewport', value: function scrollViewport(coords) { if (!this.wot.drawn) { return; } var _getVariables2 = this._getVariables(), topOverlay = _getVariables2.topOverlay, leftOverlay = _getVariables2.leftOverlay, totalRows = _getVariables2.totalRows, totalColumns = _getVariables2.totalColumns, fixedRowsTop = _getVariables2.fixedRowsTop, fixedRowsBottom = _getVariables2.fixedRowsBottom, fixedColumnsLeft = _getVariables2.fixedColumnsLeft; if (coords.row < 0 || coords.row > Math.max(totalRows - 1, 0)) { throw new Error('row ' + coords.row + ' does not exist'); } if (coords.col < 0 || coords.col > Math.max(totalColumns - 1, 0)) { throw new Error('column ' + coords.col + ' does not exist'); } if (coords.row >= fixedRowsTop && coords.row < this.getFirstVisibleRow()) { topOverlay.scrollTo(coords.row); } else if (coords.row > this.getLastVisibleRow() && coords.row < totalRows - fixedRowsBottom) { topOverlay.scrollTo(coords.row, true); } if (coords.col >= fixedColumnsLeft && coords.col < this.getFirstVisibleColumn()) { leftOverlay.scrollTo(coords.col); } else if (coords.col > this.getLastVisibleColumn()) { leftOverlay.scrollTo(coords.col, true); } } /** * Get first visible row based on virtual dom and how table is visible in browser window viewport. * * @returns {Number} */ }, { key: 'getFirstVisibleRow', value: function getFirstVisibleRow() { var _getVariables3 = this._getVariables(), topOverlay = _getVariables3.topOverlay, wtTable = _getVariables3.wtTable, wtViewport = _getVariables3.wtViewport, totalRows = _getVariables3.totalRows, fixedRowsTop = _getVariables3.fixedRowsTop; var firstVisibleRow = wtTable.getFirstVisibleRow(); if (topOverlay.mainTableScrollableElement === window) { var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement); var totalTableHeight = (0, _element.innerHeight)(wtTable.hider); var windowHeight = (0, _element.innerHeight)(window); var windowScrollTop = (0, _element.getScrollTop)(window); // Only calculate firstVisibleRow when table didn't filled (from up) whole viewport space if (rootElementOffset.top + totalTableHeight - windowHeight <= windowScrollTop) { var rowsHeight = wtViewport.getColumnHeaderHeight(); rowsHeight += topOverlay.sumCellSizes(0, fixedRowsTop); (0, _number.rangeEachReverse)(totalRows, 1, function (row) { rowsHeight += topOverlay.sumCellSizes(row - 1, row); if (rootElementOffset.top + totalTableHeight - rowsHeight <= windowScrollTop) { // Return physical row + 1 firstVisibleRow = row; return false; } }); } } return firstVisibleRow; } /** * Get last visible row based on virtual dom and how table is visible in browser window viewport. * * @returns {Number} */ }, { key: 'getLastVisibleRow', value: function getLastVisibleRow() { var _getVariables4 = this._getVariables(), topOverlay = _getVariables4.topOverlay, wtTable = _getVariables4.wtTable, wtViewport = _getVariables4.wtViewport, totalRows = _getVariables4.totalRows; var lastVisibleRow = wtTable.getLastVisibleRow(); if (topOverlay.mainTableScrollableElement === window) { var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement); var windowHeight = (0, _element.innerHeight)(window); var windowScrollTop = (0, _element.getScrollTop)(window); // Only calculate lastVisibleRow when table didn't filled (from bottom) whole viewport space if (rootElementOffset.top > windowScrollTop) { var rowsHeight = wtViewport.getColumnHeaderHeight(); (0, _number.rangeEach)(1, totalRows, function (row) { rowsHeight += topOverlay.sumCellSizes(row - 1, row); if (rootElementOffset.top + rowsHeight - windowScrollTop >= windowHeight) { // Return physical row - 1 (-2 because rangeEach gives row index + 1 - sumCellSizes requirements) lastVisibleRow = row - 2; return false; } }); } } return lastVisibleRow; } /** * Get first visible column based on virtual dom and how table is visible in browser window viewport. * * @returns {Number} */ }, { key: 'getFirstVisibleColumn', value: function getFirstVisibleColumn() { var _getVariables5 = this._getVariables(), leftOverlay = _getVariables5.leftOverlay, wtTable = _getVariables5.wtTable, wtViewport = _getVariables5.wtViewport, totalColumns = _getVariables5.totalColumns, fixedColumnsLeft = _getVariables5.fixedColumnsLeft; var firstVisibleColumn = wtTable.getFirstVisibleColumn(); if (leftOverlay.mainTableScrollableElement === window) { var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement); var totalTableWidth = (0, _element.innerWidth)(wtTable.hider); var windowWidth = (0, _element.innerWidth)(window); var windowScrollLeft = (0, _element.getScrollLeft)(window); // Only calculate firstVisibleColumn when table didn't filled (from left) whole viewport space if (rootElementOffset.left + totalTableWidth - windowWidth <= windowScrollLeft) { var columnsWidth = wtViewport.getRowHeaderWidth(); (0, _number.rangeEachReverse)(totalColumns, 1, function (column) { columnsWidth += leftOverlay.sumCellSizes(column - 1, column); if (rootElementOffset.left + totalTableWidth - columnsWidth <= windowScrollLeft) { // Return physical column + 1 firstVisibleColumn = column; return false; } }); } } return firstVisibleColumn; } /** * Get last visible column based on virtual dom and how table is visible in browser window viewport. * * @returns {Number} */ }, { key: 'getLastVisibleColumn', value: function getLastVisibleColumn() { var _getVariables6 = this._getVariables(), leftOverlay = _getVariables6.leftOverlay, wtTable = _getVariables6.wtTable, wtViewport = _getVariables6.wtViewport, totalColumns = _getVariables6.totalColumns; var lastVisibleColumn = wtTable.getLastVisibleColumn(); if (leftOverlay.mainTableScrollableElement === window) { var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement); var windowWidth = (0, _element.innerWidth)(window); var windowScrollLeft = (0, _element.getScrollLeft)(window); // Only calculate lastVisibleColumn when table didn't filled (from right) whole viewport space if (rootElementOffset.left > windowScrollLeft) { var columnsWidth = wtViewport.getRowHeaderWidth(); (0, _number.rangeEach)(1, totalColumns, function (column) { columnsWidth += leftOverlay.sumCellSizes(column - 1, column); if (rootElementOffset.left + columnsWidth - windowScrollLeft >= windowWidth) { // Return physical column - 1 (-2 because rangeEach gives column index + 1 - sumCellSizes requirements) lastVisibleColumn = column - 2; return false; } }); } } return lastVisibleColumn; } /** * Returns collection of variables used to rows and columns visibility calculations. * * @returns {Object} * @private */ }, { key: '_getVariables', value: function _getVariables() { var wot = this.wot; var topOverlay = wot.wtOverlays.topOverlay; var leftOverlay = wot.wtOverlays.leftOverlay; var wtTable = wot.wtTable; var wtViewport = wot.wtViewport; var totalRows = wot.getSetting('totalRows'); var totalColumns = wot.getSetting('totalColumns'); var fixedRowsTop = wot.getSetting('fixedRowsTop'); var fixedRowsBottom = wot.getSetting('fixedRowsBottom'); var fixedColumnsLeft = wot.getSetting('fixedColumnsLeft'); return { topOverlay: topOverlay, leftOverlay: leftOverlay, wtTable: wtTable, wtViewport: wtViewport, totalRows: totalRows, totalColumns: totalColumns, fixedRowsTop: fixedRowsTop, fixedRowsBottom: fixedRowsBottom, fixedColumnsLeft: fixedColumnsLeft }; } }]); return Scroll; }(); exports.default = Scroll; /***/ }), /* 68 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _object = __webpack_require__(25); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @class Settings */ var Settings = function () { /** * @param {Walkontable} wotInstance * @param {Object} settings */ function Settings(wotInstance, settings) { var _this = this; _classCallCheck(this, Settings); this.wot = wotInstance; // legacy support this.instance = wotInstance; // default settings. void 0 means it is required, null means it can be empty this.defaults = { table: void 0, debug: false, // shows WalkontableDebugOverlay // presentation mode externalRowCalculator: false, stretchH: 'none', // values: all, last, none currentRowClassName: null, currentColumnClassName: null, preventOverflow: function preventOverflow() { return false; }, // data source data: void 0, freezeOverlays: false, fixedColumnsLeft: 0, fixedRowsTop: 0, fixedRowsBottom: 0, minSpareRows: 0, // this must be array of functions: [function (row, TH) {}] rowHeaders: function rowHeaders() { return []; }, // this must be array of functions: [function (column, TH) {}] columnHeaders: function columnHeaders() { return []; }, totalRows: void 0, totalColumns: void 0, cellRenderer: function cellRenderer(row, column, TD) { var cellData = _this.getSetting('data', row, column); (0, _element.fastInnerText)(TD, cellData === void 0 || cellData === null ? '' : cellData); }, // columnWidth: 50, columnWidth: function columnWidth(col) { // return undefined means use default size for the rendered cell content }, rowHeight: function rowHeight(row) { // return undefined means use default size for the rendered cell content }, defaultRowHeight: 23, defaultColumnWidth: 50, selections: null, hideBorderOnMouseDownOver: false, viewportRowCalculatorOverride: null, viewportColumnCalculatorOverride: null, // callbacks onCellMouseDown: null, onCellMouseOver: null, onCellMouseOut: null, onCellMouseUp: null, // onCellMouseOut: null, onCellDblClick: null, onCellCornerMouseDown: null, onCellCornerDblClick: null, beforeDraw: null, onDraw: null, onBeforeDrawBorders: null, onScrollVertically: null, onScrollHorizontally: null, onBeforeTouchScroll: null, onAfterMomentumScroll: null, onBeforeStretchingColumnWidth: function onBeforeStretchingColumnWidth(width) { return width; }, onModifyRowHeaderWidth: null, // constants scrollbarWidth: 10, scrollbarHeight: 10, renderAllRows: false, groups: false, rowHeaderWidth: null, columnHeaderHeight: null, headerClassName: null }; // reference to settings this.settings = {}; for (var i in this.defaults) { if ((0, _object.hasOwnProperty)(this.defaults, i)) { if (settings[i] !== void 0) { this.settings[i] = settings[i]; } else if (this.defaults[i] === void 0) { throw new Error('A required setting "' + i + '" was not provided'); } else { this.settings[i] = this.defaults[i]; } } } } /** * Update settings * * @param {Object} settings * @param {*} value * @returns {Walkontable} */ _createClass(Settings, [{ key: 'update', value: function update(settings, value) { if (value === void 0) { // settings is object for (var i in settings) { if ((0, _object.hasOwnProperty)(settings, i)) { this.settings[i] = settings[i]; } } } else { // if value is defined then settings is the key this.settings[settings] = value; } return this.wot; } /** * Get setting by name * * @param {String} key * @param {*} param1 * @param {*} param2 * @param {*} param3 * @param {*} param4 * @returns {*} */ }, { key: 'getSetting', value: function getSetting(key, param1, param2, param3, param4) { if (typeof this.settings[key] === 'function') { // this is faster than .apply - https://github.com/handsontable/handsontable/wiki/JavaScript-&-DOM-performance-tips return this.settings[key](param1, param2, param3, param4); } else if (param1 !== void 0 && Array.isArray(this.settings[key])) { // perhaps this can be removed, it is only used in tests return this.settings[key][param1]; } return this.settings[key]; } /** * Checks if setting exists * * @param {Boolean} key * @returns {Boolean} */ }, { key: 'has', value: function has(key) { return !!this.settings[key]; } }]); return Settings; }(); exports.default = Settings; /***/ }), /* 69 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _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 _element = __webpack_require__(2); var _function = __webpack_require__(75); var _coords = __webpack_require__(22); var _coords2 = _interopRequireDefault(_coords); var _range = __webpack_require__(43); var _range2 = _interopRequireDefault(_range); var _column = __webpack_require__(64); var _column2 = _interopRequireDefault(_column); var _row = __webpack_require__(65); var _row2 = _interopRequireDefault(_row); var _tableRenderer = __webpack_require__(70); var _tableRenderer2 = _interopRequireDefault(_tableRenderer); var _base = __webpack_require__(11); var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * */ var Table = function () { /** * @param {Walkontable} wotInstance * @param {HTMLTableElement} table */ function Table(wotInstance, table) { var _this = this; _classCallCheck(this, Table); this.wot = wotInstance; // legacy support this.instance = this.wot; this.TABLE = table; this.TBODY = null; this.THEAD = null; this.COLGROUP = null; this.tableOffset = 0; this.holderOffset = 0; (0, _element.removeTextNodes)(this.TABLE); this.spreader = this.createSpreader(this.TABLE); this.hider = this.createHider(this.spreader); this.holder = this.createHolder(this.hider); this.wtRootElement = this.holder.parentNode; this.alignOverlaysWithTrimmingContainer(); this.fixTableDomTree(); this.colgroupChildrenLength = this.COLGROUP.childNodes.length; this.theadChildrenLength = this.THEAD.firstChild ? this.THEAD.firstChild.childNodes.length : 0; this.tbodyChildrenLength = this.TBODY.childNodes.length; this.rowFilter = null; this.columnFilter = null; this.correctHeaderWidth = false; var origRowHeaderWidth = this.wot.wtSettings.settings.rowHeaderWidth; // Fix for jumping row headers (https://github.com/handsontable/handsontable/issues/3850) this.wot.wtSettings.settings.rowHeaderWidth = function () { return _this._modifyRowHeaderWidth(origRowHeaderWidth); }; } /** * */ _createClass(Table, [{ key: 'fixTableDomTree', value: function fixTableDomTree() { this.TBODY = this.TABLE.querySelector('tbody'); if (!this.TBODY) { this.TBODY = document.createElement('tbody'); this.TABLE.appendChild(this.TBODY); } this.THEAD = this.TABLE.querySelector('thead'); if (!this.THEAD) { this.THEAD = document.createElement('thead'); this.TABLE.insertBefore(this.THEAD, this.TBODY); } this.COLGROUP = this.TABLE.querySelector('colgroup'); if (!this.COLGROUP) { this.COLGROUP = document.createElement('colgroup'); this.TABLE.insertBefore(this.COLGROUP, this.THEAD); } if (this.wot.getSetting('columnHeaders').length && !this.THEAD.childNodes.length) { this.THEAD.appendChild(document.createElement('TR')); } } /** * @param table * @returns {HTMLElement} */ }, { key: 'createSpreader', value: function createSpreader(table) { var parent = table.parentNode; var spreader = void 0; if (!parent || parent.nodeType !== 1 || !(0, _element.hasClass)(parent, 'wtHolder')) { spreader = document.createElement('div'); spreader.className = 'wtSpreader'; if (parent) { // if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it parent.insertBefore(spreader, table); } spreader.appendChild(table); } spreader.style.position = 'relative'; return spreader; } /** * @param spreader * @returns {HTMLElement} */ }, { key: 'createHider', value: function createHider(spreader) { var parent = spreader.parentNode; var hider = void 0; if (!parent || parent.nodeType !== 1 || !(0, _element.hasClass)(parent, 'wtHolder')) { hider = document.createElement('div'); hider.className = 'wtHider'; if (parent) { // if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it parent.insertBefore(hider, spreader); } hider.appendChild(spreader); } return hider; } /** * * @param hider * @returns {HTMLElement} */ }, { key: 'createHolder', value: function createHolder(hider) { var parent = hider.parentNode; var holder = void 0; if (!parent || parent.nodeType !== 1 || !(0, _element.hasClass)(parent, 'wtHolder')) { holder = document.createElement('div'); holder.style.position = 'relative'; holder.className = 'wtHolder'; if (parent) { // if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it parent.insertBefore(holder, hider); } if (!this.isWorkingOnClone()) { holder.parentNode.className += 'ht_master handsontable'; } holder.appendChild(hider); } return holder; } }, { key: 'alignOverlaysWithTrimmingContainer', value: function alignOverlaysWithTrimmingContainer() { var trimmingElement = (0, _element.getTrimmingContainer)(this.wtRootElement); if (!this.isWorkingOnClone()) { this.holder.parentNode.style.position = 'relative'; if (trimmingElement === window) { var preventOverflow = this.wot.getSetting('preventOverflow'); if (!preventOverflow) { this.holder.style.overflow = 'visible'; this.wtRootElement.style.overflow = 'visible'; } } else { this.holder.style.width = (0, _element.getStyle)(trimmingElement, 'width'); this.holder.style.height = (0, _element.getStyle)(trimmingElement, 'height'); this.holder.style.overflow = ''; } } } }, { key: 'isWorkingOnClone', value: function isWorkingOnClone() { return !!this.wot.cloneSource; } /** * Redraws the table * * @param {Boolean} fastDraw If TRUE, will try to avoid full redraw and only update the border positions. If FALSE or UNDEFINED, will perform a full redraw * @returns {Table} */ }, { key: 'draw', value: function draw(fastDraw) { var _wot = this.wot, wtOverlays = _wot.wtOverlays, wtViewport = _wot.wtViewport; var totalRows = this.instance.getSetting('totalRows'); var rowHeaders = this.wot.getSetting('rowHeaders').length; var columnHeaders = this.wot.getSetting('columnHeaders').length; var syncScroll = false; if (!this.isWorkingOnClone()) { this.holderOffset = (0, _element.offset)(this.holder); fastDraw = wtViewport.createRenderCalculators(fastDraw); if (rowHeaders && !this.wot.getSetting('fixedColumnsLeft')) { var leftScrollPos = wtOverlays.leftOverlay.getScrollPosition(); var previousState = this.correctHeaderWidth; this.correctHeaderWidth = leftScrollPos > 0; if (previousState !== this.correctHeaderWidth) { fastDraw = false; } } } if (!this.isWorkingOnClone()) { syncScroll = wtOverlays.prepareOverlays(); } if (fastDraw) { if (!this.isWorkingOnClone()) { // in case we only scrolled without redraw, update visible rows information in oldRowsCalculator wtViewport.createVisibleCalculators(); } if (wtOverlays) { wtOverlays.refresh(true); } } else { if (this.isWorkingOnClone()) { this.tableOffset = this.wot.cloneSource.wtTable.tableOffset; } else { this.tableOffset = (0, _element.offset)(this.TABLE); } var startRow = void 0; if (_base2.default.isOverlayTypeOf(this.wot.cloneOverlay, _base2.default.CLONE_DEBUG) || _base2.default.isOverlayTypeOf(this.wot.cloneOverlay, _base2.default.CLONE_TOP) || _base2.default.isOverlayTypeOf(this.wot.cloneOverlay, _base2.default.CLONE_TOP_LEFT_CORNER)) { startRow = 0; } else if (_base2.default.isOverlayTypeOf(this.instance.cloneOverlay, _base2.default.CLONE_BOTTOM) || _base2.default.isOverlayTypeOf(this.instance.cloneOverlay, _base2.default.CLONE_BOTTOM_LEFT_CORNER)) { startRow = Math.max(totalRows - this.wot.getSetting('fixedRowsBottom'), 0); } else { startRow = wtViewport.rowsRenderCalculator.startRow; } var startColumn = void 0; if (_base2.default.isOverlayTypeOf(this.wot.cloneOverlay, _base2.default.CLONE_DEBUG) || _base2.default.isOverlayTypeOf(this.wot.cloneOverlay, _base2.default.CLONE_LEFT) || _base2.default.isOverlayTypeOf(this.wot.cloneOverlay, _base2.default.CLONE_TOP_LEFT_CORNER) || _base2.default.isOverlayTypeOf(this.wot.cloneOverlay, _base2.default.CLONE_BOTTOM_LEFT_CORNER)) { startColumn = 0; } else { startColumn = wtViewport.columnsRenderCalculator.startColumn; } this.rowFilter = new _row2.default(startRow, totalRows, columnHeaders); this.columnFilter = new _column2.default(startColumn, this.wot.getSetting('totalColumns'), rowHeaders); this.alignOverlaysWithTrimmingContainer(); this._doDraw(); // creates calculator after draw } this.refreshSelections(fastDraw); if (!this.isWorkingOnClone()) { wtOverlays.topOverlay.resetFixedPosition(); if (wtOverlays.bottomOverlay.clone) { wtOverlays.bottomOverlay.resetFixedPosition(); } wtOverlays.leftOverlay.resetFixedPosition(); if (wtOverlays.topLeftCornerOverlay) { wtOverlays.topLeftCornerOverlay.resetFixedPosition(); } if (wtOverlays.bottomLeftCornerOverlay && wtOverlays.bottomLeftCornerOverlay.clone) { wtOverlays.bottomLeftCornerOverlay.resetFixedPosition(); } } if (syncScroll) { wtOverlays.syncScrollWithMaster(); } this.wot.drawn = true; return this; } }, { key: '_doDraw', value: function _doDraw() { var wtRenderer = new _tableRenderer2.default(this); wtRenderer.render(); } }, { key: 'removeClassFromCells', value: function removeClassFromCells(className) { var nodes = this.TABLE.querySelectorAll('.' + className); for (var i = 0, len = nodes.length; i < len; i++) { (0, _element.removeClass)(nodes[i], className); } } }, { key: 'refreshSelections', value: function refreshSelections(fastDraw) { if (!this.wot.selections) { return; } var len = this.wot.selections.length; if (fastDraw) { for (var i = 0; i < len; i++) { // there was no rerender, so we need to remove classNames by ourselves if (this.wot.selections[i].settings.className) { this.removeClassFromCells(this.wot.selections[i].settings.className); } if (this.wot.selections[i].settings.highlightHeaderClassName) { this.removeClassFromCells(this.wot.selections[i].settings.highlightHeaderClassName); } if (this.wot.selections[i].settings.highlightRowClassName) { this.removeClassFromCells(this.wot.selections[i].settings.highlightRowClassName); } if (this.wot.selections[i].settings.highlightColumnClassName) { this.removeClassFromCells(this.wot.selections[i].settings.highlightColumnClassName); } } } for (var _i = 0; _i < len; _i++) { this.wot.selections[_i].draw(this.wot, fastDraw); } } /** * Get cell element at coords. * * @param {CellCoords} coords * @returns {HTMLElement|Number} HTMLElement on success or Number one of the exit codes on error: * -1 row before viewport * -2 row after viewport */ }, { key: 'getCell', value: function getCell(coords) { if (this.isRowBeforeRenderedRows(coords.row)) { // row before rendered rows return -1; } else if (this.isRowAfterRenderedRows(coords.row)) { // row after rendered rows return -2; } var TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(coords.row)]; if (TR) { return TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(coords.col)]; } } /** * getColumnHeader * * @param {Number} col Column index * @param {Number} [level=0] Header level (0 = most distant to the table) * @returns {Object} HTMLElement on success or undefined on error */ }, { key: 'getColumnHeader', value: function getColumnHeader(col) { var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var TR = this.THEAD.childNodes[level]; if (TR) { return TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(col)]; } } /** * getRowHeader * * @param {Number} row Row index * @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have row headers` */ }, { key: 'getRowHeader', value: function getRowHeader(row) { if (this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0) === 0) { return null; } var TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)]; if (TR) { return TR.childNodes[0]; } } /** * Returns cell coords object for a given TD (or a child element of a TD element). * * @param {HTMLTableCellElement} TD A cell DOM element (or a child of one). * @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the provided element is not applicable. */ }, { key: 'getCoords', value: function getCoords(TD) { if (TD.nodeName !== 'TD' && TD.nodeName !== 'TH') { TD = (0, _element.closest)(TD, ['TD', 'TH']); } if (TD === null) { return null; } var TR = TD.parentNode; var CONTAINER = TR.parentNode; var row = (0, _element.index)(TR); var col = TD.cellIndex; if ((0, _element.overlayContainsElement)(_base2.default.CLONE_TOP_LEFT_CORNER, TD) || (0, _element.overlayContainsElement)(_base2.default.CLONE_TOP, TD)) { if (CONTAINER.nodeName === 'THEAD') { row -= CONTAINER.childNodes.length; } } else if (CONTAINER === this.THEAD) { row = this.rowFilter.visibleColHeadedRowToSourceRow(row); } else { row = this.rowFilter.renderedToSource(row); } if ((0, _element.overlayContainsElement)(_base2.default.CLONE_TOP_LEFT_CORNER, TD) || (0, _element.overlayContainsElement)(_base2.default.CLONE_LEFT, TD)) { col = this.columnFilter.offsettedTH(col); } else { col = this.columnFilter.visibleRowHeadedColumnToSourceColumn(col); } return new _coords2.default(row, col); } }, { key: 'getTrForRow', value: function getTrForRow(row) { return this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)]; } }, { key: 'getFirstRenderedRow', value: function getFirstRenderedRow() { return this.wot.wtViewport.rowsRenderCalculator.startRow; } }, { key: 'getFirstVisibleRow', value: function getFirstVisibleRow() { return this.wot.wtViewport.rowsVisibleCalculator.startRow; } }, { key: 'getFirstRenderedColumn', value: function getFirstRenderedColumn() { return this.wot.wtViewport.columnsRenderCalculator.startColumn; } /** * @returns {Number} Returns -1 if no row is visible */ }, { key: 'getFirstVisibleColumn', value: function getFirstVisibleColumn() { return this.wot.wtViewport.columnsVisibleCalculator.startColumn; } /** * @returns {Number} Returns -1 if no row is visible */ }, { key: 'getLastRenderedRow', value: function getLastRenderedRow() { return this.wot.wtViewport.rowsRenderCalculator.endRow; } }, { key: 'getLastVisibleRow', value: function getLastVisibleRow() { return this.wot.wtViewport.rowsVisibleCalculator.endRow; } }, { key: 'getLastRenderedColumn', value: function getLastRenderedColumn() { return this.wot.wtViewport.columnsRenderCalculator.endColumn; } /** * @returns {Number} Returns -1 if no column is visible */ }, { key: 'getLastVisibleColumn', value: function getLastVisibleColumn() { return this.wot.wtViewport.columnsVisibleCalculator.endColumn; } }, { key: 'isRowBeforeRenderedRows', value: function isRowBeforeRenderedRows(row) { return this.rowFilter && this.rowFilter.sourceToRendered(row) < 0 && row >= 0; } }, { key: 'isRowAfterViewport', value: function isRowAfterViewport(row) { return this.rowFilter && this.rowFilter.sourceToRendered(row) > this.getLastVisibleRow(); } }, { key: 'isRowAfterRenderedRows', value: function isRowAfterRenderedRows(row) { return this.rowFilter && this.rowFilter.sourceToRendered(row) > this.getLastRenderedRow(); } }, { key: 'isColumnBeforeViewport', value: function isColumnBeforeViewport(column) { return this.columnFilter && this.columnFilter.sourceToRendered(column) < 0 && column >= 0; } }, { key: 'isColumnAfterViewport', value: function isColumnAfterViewport(column) { return this.columnFilter && this.columnFilter.sourceToRendered(column) > this.getLastVisibleColumn(); } }, { key: 'isLastRowFullyVisible', value: function isLastRowFullyVisible() { return this.getLastVisibleRow() === this.getLastRenderedRow(); } }, { key: 'isLastColumnFullyVisible', value: function isLastColumnFullyVisible() { return this.getLastVisibleColumn() === this.getLastRenderedColumn(); } }, { key: 'getRenderedColumnsCount', value: function getRenderedColumnsCount() { var columnsCount = this.wot.wtViewport.columnsRenderCalculator.count; var totalColumns = this.wot.getSetting('totalColumns'); if (this.wot.isOverlayName(_base2.default.CLONE_DEBUG)) { columnsCount = totalColumns; } else if (this.wot.isOverlayName(_base2.default.CLONE_LEFT) || this.wot.isOverlayName(_base2.default.CLONE_TOP_LEFT_CORNER) || this.wot.isOverlayName(_base2.default.CLONE_BOTTOM_LEFT_CORNER)) { return Math.min(this.wot.getSetting('fixedColumnsLeft'), totalColumns); } return columnsCount; } }, { key: 'getRenderedRowsCount', value: function getRenderedRowsCount() { var rowsCount = this.wot.wtViewport.rowsRenderCalculator.count; var totalRows = this.wot.getSetting('totalRows'); if (this.wot.isOverlayName(_base2.default.CLONE_DEBUG)) { rowsCount = totalRows; } else if (this.wot.isOverlayName(_base2.default.CLONE_TOP) || this.wot.isOverlayName(_base2.default.CLONE_TOP_LEFT_CORNER)) { rowsCount = Math.min(this.wot.getSetting('fixedRowsTop'), totalRows); } else if (this.wot.isOverlayName(_base2.default.CLONE_BOTTOM) || this.wot.isOverlayName(_base2.default.CLONE_BOTTOM_LEFT_CORNER)) { rowsCount = Math.min(this.wot.getSetting('fixedRowsBottom'), totalRows); } return rowsCount; } }, { key: 'getVisibleRowsCount', value: function getVisibleRowsCount() { return this.wot.wtViewport.rowsVisibleCalculator.count; } }, { key: 'allRowsInViewport', value: function allRowsInViewport() { return this.wot.getSetting('totalRows') == this.getVisibleRowsCount(); } /** * Checks if any of the row's cells content exceeds its initial height, and if so, returns the oversized height * * @param {Number} sourceRow * @returns {Number} */ }, { key: 'getRowHeight', value: function getRowHeight(sourceRow) { var height = this.wot.wtSettings.settings.rowHeight(sourceRow); var oversizedHeight = this.wot.wtViewport.oversizedRows[sourceRow]; if (oversizedHeight !== void 0) { height = height === void 0 ? oversizedHeight : Math.max(height, oversizedHeight); } return height; } }, { key: 'getColumnHeaderHeight', value: function getColumnHeaderHeight(level) { var height = this.wot.wtSettings.settings.defaultRowHeight; var oversizedHeight = this.wot.wtViewport.oversizedColumnHeaders[level]; if (oversizedHeight !== void 0) { height = height ? Math.max(height, oversizedHeight) : oversizedHeight; } return height; } }, { key: 'getVisibleColumnsCount', value: function getVisibleColumnsCount() { return this.wot.wtViewport.columnsVisibleCalculator.count; } }, { key: 'allColumnsInViewport', value: function allColumnsInViewport() { return this.wot.getSetting('totalColumns') == this.getVisibleColumnsCount(); } }, { key: 'getColumnWidth', value: function getColumnWidth(sourceColumn) { var width = this.wot.wtSettings.settings.columnWidth; if (typeof width === 'function') { width = width(sourceColumn); } else if ((typeof width === 'undefined' ? 'undefined' : _typeof(width)) === 'object') { width = width[sourceColumn]; } return width || this.wot.wtSettings.settings.defaultColumnWidth; } }, { key: 'getStretchedColumnWidth', value: function getStretchedColumnWidth(sourceColumn) { var columnWidth = this.getColumnWidth(sourceColumn); var width = columnWidth == null ? this.instance.wtSettings.settings.defaultColumnWidth : columnWidth; var calculator = this.wot.wtViewport.columnsRenderCalculator; if (calculator) { var stretchedWidth = calculator.getStretchedColumnWidth(sourceColumn, width); if (stretchedWidth) { width = stretchedWidth; } } return width; } /** * Modify row header widths provided by user in class contructor. * * @private */ }, { key: '_modifyRowHeaderWidth', value: function _modifyRowHeaderWidth(rowHeaderWidthFactory) { var widths = (0, _function.isFunction)(rowHeaderWidthFactory) ? rowHeaderWidthFactory() : null; if (Array.isArray(widths)) { widths = [].concat(_toConsumableArray(widths)); widths[widths.length - 1] = this._correctRowHeaderWidth(widths[widths.length - 1]); } else { widths = this._correctRowHeaderWidth(widths); } return widths; } /** * Correct row header width if necessary. * * @private */ }, { key: '_correctRowHeaderWidth', value: function _correctRowHeaderWidth(width) { if (typeof width !== 'number') { width = this.wot.getSetting('defaultColumnWidth'); } if (this.correctHeaderWidth) { width++; } return width; } }]); return Table; }(); exports.default = Table; /***/ }), /* 70 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _base = __webpack_require__(11); var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var performanceWarningAppeared = false; /** * @class TableRenderer */ var TableRenderer = function () { /** * @param {WalkontableTable} wtTable */ function TableRenderer(wtTable) { _classCallCheck(this, TableRenderer); this.wtTable = wtTable; this.wot = wtTable.instance; // legacy support this.instance = wtTable.instance; this.rowFilter = wtTable.rowFilter; this.columnFilter = wtTable.columnFilter; this.TABLE = wtTable.TABLE; this.THEAD = wtTable.THEAD; this.TBODY = wtTable.TBODY; this.COLGROUP = wtTable.COLGROUP; this.rowHeaders = []; this.rowHeaderCount = 0; this.columnHeaders = []; this.columnHeaderCount = 0; this.fixedRowsTop = 0; this.fixedRowsBottom = 0; } /** * */ _createClass(TableRenderer, [{ key: 'render', value: function render() { if (!this.wtTable.isWorkingOnClone()) { var skipRender = {}; this.wot.getSetting('beforeDraw', true, skipRender); if (skipRender.skipRender === true) { return; } } this.rowHeaders = this.wot.getSetting('rowHeaders'); this.rowHeaderCount = this.rowHeaders.length; this.fixedRowsTop = this.wot.getSetting('fixedRowsTop'); this.fixedRowsBottom = this.wot.getSetting('fixedRowsBottom'); this.columnHeaders = this.wot.getSetting('columnHeaders'); this.columnHeaderCount = this.columnHeaders.length; var columnsToRender = this.wtTable.getRenderedColumnsCount(); var rowsToRender = this.wtTable.getRenderedRowsCount(); var totalColumns = this.wot.getSetting('totalColumns'); var totalRows = this.wot.getSetting('totalRows'); var workspaceWidth = void 0; var adjusted = false; if (_base2.default.isOverlayTypeOf(this.wot.cloneOverlay, _base2.default.CLONE_BOTTOM) || _base2.default.isOverlayTypeOf(this.wot.cloneOverlay, _base2.default.CLONE_BOTTOM_LEFT_CORNER)) { // do NOT render headers on the bottom or bottom-left corner overlay this.columnHeaders = []; this.columnHeaderCount = 0; } if (totalColumns >= 0) { // prepare COL and TH elements for rendering this.adjustAvailableNodes(); adjusted = true; // adjust column widths according to user widths settings this.renderColumnHeaders(); // Render table rows this.renderRows(totalRows, rowsToRender, columnsToRender); if (!this.wtTable.isWorkingOnClone()) { workspaceWidth = this.wot.wtViewport.getWorkspaceWidth(); this.wot.wtViewport.containerWidth = null; } this.adjustColumnWidths(columnsToRender); this.markOversizedColumnHeaders(); this.adjustColumnHeaderHeights(); } if (!adjusted) { this.adjustAvailableNodes(); } this.removeRedundantRows(rowsToRender); if (!this.wtTable.isWorkingOnClone() || this.wot.isOverlayName(_base2.default.CLONE_BOTTOM)) { this.markOversizedRows(); } if (!this.wtTable.isWorkingOnClone()) { this.wot.wtViewport.createVisibleCalculators(); this.wot.wtOverlays.refresh(false); this.wot.wtOverlays.applyToDOM(); var hiderWidth = (0, _element.outerWidth)(this.wtTable.hider); var tableWidth = (0, _element.outerWidth)(this.wtTable.TABLE); if (hiderWidth !== 0 && tableWidth !== hiderWidth) { // Recalculate the column widths, if width changes made in the overlays removed the scrollbar, thus changing the viewport width. this.adjustColumnWidths(columnsToRender); } if (workspaceWidth !== this.wot.wtViewport.getWorkspaceWidth()) { // workspace width changed though to shown/hidden vertical scrollbar. Let's reapply stretching this.wot.wtViewport.containerWidth = null; var firstRendered = this.wtTable.getFirstRenderedColumn(); var lastRendered = this.wtTable.getLastRenderedColumn(); var defaultColumnWidth = this.wot.getSetting('defaultColumnWidth'); var rowHeaderWidthSetting = this.wot.getSetting('rowHeaderWidth'); rowHeaderWidthSetting = this.instance.getSetting('onModifyRowHeaderWidth', rowHeaderWidthSetting); if (rowHeaderWidthSetting != null) { for (var i = 0; i < this.rowHeaderCount; i++) { var width = Array.isArray(rowHeaderWidthSetting) ? rowHeaderWidthSetting[i] : rowHeaderWidthSetting; width = width == null ? defaultColumnWidth : width; this.COLGROUP.childNodes[i].style.width = width + 'px'; } } for (var _i = firstRendered; _i < lastRendered; _i++) { var _width = this.wtTable.getStretchedColumnWidth(_i); var renderedIndex = this.columnFilter.sourceToRendered(_i); this.COLGROUP.childNodes[renderedIndex + this.rowHeaderCount].style.width = _width + 'px'; } } this.wot.getSetting('onDraw', true); } else if (this.wot.isOverlayName(_base2.default.CLONE_BOTTOM)) { this.wot.cloneSource.wtOverlays.adjustElementsSize(); } } /** * @param {Number} renderedRowsCount */ }, { key: 'removeRedundantRows', value: function removeRedundantRows(renderedRowsCount) { while (this.wtTable.tbodyChildrenLength > renderedRowsCount) { this.TBODY.removeChild(this.TBODY.lastChild); this.wtTable.tbodyChildrenLength--; } } /** * @param {Number} totalRows * @param {Number} rowsToRender * @param {Number} columnsToRender */ }, { key: 'renderRows', value: function renderRows(totalRows, rowsToRender, columnsToRender) { var lastTD = void 0, TR = void 0; var visibleRowIndex = 0; var sourceRowIndex = this.rowFilter.renderedToSource(visibleRowIndex); var isWorkingOnClone = this.wtTable.isWorkingOnClone(); while (sourceRowIndex < totalRows && sourceRowIndex >= 0) { if (!performanceWarningAppeared && visibleRowIndex > 1000) { performanceWarningAppeared = true; console.warn('Performance tip: Handsontable rendered more than 1000 visible rows. Consider limiting the number ' + 'of rendered rows by specifying the table height and/or turning off the "renderAllRows" option.'); } if (rowsToRender !== void 0 && visibleRowIndex === rowsToRender) { // We have as much rows as needed for this clone break; } TR = this.getOrCreateTrForRow(visibleRowIndex, TR); // Render row headers this.renderRowHeaders(sourceRowIndex, TR); // Add and/or remove TDs to TR to match the desired number this.adjustColumns(TR, columnsToRender + this.rowHeaderCount); lastTD = this.renderCells(sourceRowIndex, TR, columnsToRender); if (!isWorkingOnClone || // Necessary to refresh oversized row heights after editing cell in overlays this.wot.isOverlayName(_base2.default.CLONE_BOTTOM)) { // Reset the oversized row cache for this row this.resetOversizedRow(sourceRowIndex); } if (TR.firstChild) { // if I have 2 fixed columns with one-line content and the 3rd column has a multiline content, this is // the way to make sure that the overlay will has same row height var height = this.wot.wtTable.getRowHeight(sourceRowIndex); if (height) { // Decrease height. 1 pixel will be "replaced" by 1px border top height--; TR.firstChild.style.height = height + 'px'; } else { TR.firstChild.style.height = ''; } } visibleRowIndex++; sourceRowIndex = this.rowFilter.renderedToSource(visibleRowIndex); } } /** * Reset the oversized row cache for the provided index * * @param {Number} sourceRow Row index */ }, { key: 'resetOversizedRow', value: function resetOversizedRow(sourceRow) { if (this.wot.getSetting('externalRowCalculator')) { return; } if (this.wot.wtViewport.oversizedRows && this.wot.wtViewport.oversizedRows[sourceRow]) { this.wot.wtViewport.oversizedRows[sourceRow] = void 0; } } /** * Check if any of the rendered rows is higher than expected, and if so, cache them */ }, { key: 'markOversizedRows', value: function markOversizedRows() { if (this.wot.getSetting('externalRowCalculator')) { return; } var rowCount = this.instance.wtTable.TBODY.childNodes.length; var expectedTableHeight = rowCount * this.instance.wtSettings.settings.defaultRowHeight; var actualTableHeight = (0, _element.innerHeight)(this.instance.wtTable.TBODY) - 1; var previousRowHeight = void 0; var rowInnerHeight = void 0; var sourceRowIndex = void 0; var currentTr = void 0; var rowHeader = void 0; var totalRows = this.instance.getSetting('totalRows'); if (expectedTableHeight === actualTableHeight && !this.instance.getSetting('fixedRowsBottom')) { // If the actual table height equals rowCount * default single row height, no row is oversized -> no need to iterate over them return; } while (rowCount) { rowCount--; sourceRowIndex = this.instance.wtTable.rowFilter.renderedToSource(rowCount); previousRowHeight = this.instance.wtTable.getRowHeight(sourceRowIndex); currentTr = this.instance.wtTable.getTrForRow(sourceRowIndex); rowHeader = currentTr.querySelector('th'); if (rowHeader) { rowInnerHeight = (0, _element.innerHeight)(rowHeader); } else { rowInnerHeight = (0, _element.innerHeight)(currentTr) - 1; } if (!previousRowHeight && this.instance.wtSettings.settings.defaultRowHeight < rowInnerHeight || previousRowHeight < rowInnerHeight) { this.instance.wtViewport.oversizedRows[sourceRowIndex] = ++rowInnerHeight; } } } /** * Check if any of the rendered columns is higher than expected, and if so, cache them. */ }, { key: 'markOversizedColumnHeaders', value: function markOversizedColumnHeaders() { var overlayName = this.wot.getOverlayName(); if (!this.columnHeaderCount || this.wot.wtViewport.hasOversizedColumnHeadersMarked[overlayName] || this.wtTable.isWorkingOnClone()) { return; } var columnCount = this.wtTable.getRenderedColumnsCount(); for (var i = 0; i < this.columnHeaderCount; i++) { for (var renderedColumnIndex = -1 * this.rowHeaderCount; renderedColumnIndex < columnCount; renderedColumnIndex++) { this.markIfOversizedColumnHeader(renderedColumnIndex); } } this.wot.wtViewport.hasOversizedColumnHeadersMarked[overlayName] = true; } /** * */ }, { key: 'adjustColumnHeaderHeights', value: function adjustColumnHeaderHeights() { var columnHeaders = this.wot.getSetting('columnHeaders'); var children = this.wot.wtTable.THEAD.childNodes; var oversizedColumnHeaders = this.wot.wtViewport.oversizedColumnHeaders; for (var i = 0, len = columnHeaders.length; i < len; i++) { if (oversizedColumnHeaders[i]) { if (!children[i] || children[i].childNodes.length === 0) { return; } children[i].childNodes[0].style.height = oversizedColumnHeaders[i] + 'px'; } } } /** * Check if column header for the specified column is higher than expected, and if so, cache it * * @param {Number} col Index of column */ }, { key: 'markIfOversizedColumnHeader', value: function markIfOversizedColumnHeader(col) { var sourceColIndex = this.wot.wtTable.columnFilter.renderedToSource(col); var level = this.columnHeaderCount; var defaultRowHeight = this.wot.wtSettings.settings.defaultRowHeight; var previousColHeaderHeight = void 0; var currentHeader = void 0; var currentHeaderHeight = void 0; var columnHeaderHeightSetting = this.wot.getSetting('columnHeaderHeight') || []; while (level) { level--; previousColHeaderHeight = this.wot.wtTable.getColumnHeaderHeight(level); currentHeader = this.wot.wtTable.getColumnHeader(sourceColIndex, level); if (!currentHeader) { /* eslint-disable no-continue */ continue; } currentHeaderHeight = (0, _element.innerHeight)(currentHeader); if (!previousColHeaderHeight && defaultRowHeight < currentHeaderHeight || previousColHeaderHeight < currentHeaderHeight) { this.wot.wtViewport.oversizedColumnHeaders[level] = currentHeaderHeight; } if (Array.isArray(columnHeaderHeightSetting)) { if (columnHeaderHeightSetting[level] != null) { this.wot.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting[level]; } } else if (!isNaN(columnHeaderHeightSetting)) { this.wot.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting; } if (this.wot.wtViewport.oversizedColumnHeaders[level] < (columnHeaderHeightSetting[level] || columnHeaderHeightSetting)) { this.wot.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting[level] || columnHeaderHeightSetting; } } } /** * @param {Number} sourceRowIndex * @param {HTMLTableRowElement} TR * @param {Number} columnsToRender * @returns {HTMLTableCellElement} */ }, { key: 'renderCells', value: function renderCells(sourceRowIndex, TR, columnsToRender) { var TD = void 0; var sourceColIndex = void 0; for (var visibleColIndex = 0; visibleColIndex < columnsToRender; visibleColIndex++) { sourceColIndex = this.columnFilter.renderedToSource(visibleColIndex); if (visibleColIndex === 0) { TD = TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(sourceColIndex)]; } else { TD = TD.nextSibling; // http://jsperf.com/nextsibling-vs-indexed-childnodes } // If the number of headers has been reduced, we need to replace excess TH with TD if (TD.nodeName == 'TH') { TD = replaceThWithTd(TD, TR); } if (!(0, _element.hasClass)(TD, 'hide')) { TD.className = ''; } TD.removeAttribute('style'); this.wot.wtSettings.settings.cellRenderer(sourceRowIndex, sourceColIndex, TD); } return TD; } /** * @param {Number} columnsToRender Number of columns to render. */ }, { key: 'adjustColumnWidths', value: function adjustColumnWidths(columnsToRender) { var scrollbarCompensation = 0; var sourceInstance = this.wot.cloneSource ? this.wot.cloneSource : this.wot; var mainHolder = sourceInstance.wtTable.holder; var defaultColumnWidth = this.wot.getSetting('defaultColumnWidth'); var rowHeaderWidthSetting = this.wot.getSetting('rowHeaderWidth'); if (mainHolder.offsetHeight < mainHolder.scrollHeight) { scrollbarCompensation = (0, _element.getScrollbarWidth)(); } this.wot.wtViewport.columnsRenderCalculator.refreshStretching(this.wot.wtViewport.getViewportWidth() - scrollbarCompensation); rowHeaderWidthSetting = this.instance.getSetting('onModifyRowHeaderWidth', rowHeaderWidthSetting); if (rowHeaderWidthSetting != null) { for (var i = 0; i < this.rowHeaderCount; i++) { var width = Array.isArray(rowHeaderWidthSetting) ? rowHeaderWidthSetting[i] : rowHeaderWidthSetting; width = width == null ? defaultColumnWidth : width; this.COLGROUP.childNodes[i].style.width = width + 'px'; } } for (var renderedColIndex = 0; renderedColIndex < columnsToRender; renderedColIndex++) { var _width2 = this.wtTable.getStretchedColumnWidth(this.columnFilter.renderedToSource(renderedColIndex)); this.COLGROUP.childNodes[renderedColIndex + this.rowHeaderCount].style.width = _width2 + 'px'; } } /** * @param {HTMLTableCellElement} TR */ }, { key: 'appendToTbody', value: function appendToTbody(TR) { this.TBODY.appendChild(TR); this.wtTable.tbodyChildrenLength++; } /** * @param {Number} rowIndex * @param {HTMLTableRowElement} currentTr * @returns {HTMLTableCellElement} */ }, { key: 'getOrCreateTrForRow', value: function getOrCreateTrForRow(rowIndex, currentTr) { var TR = void 0; if (rowIndex >= this.wtTable.tbodyChildrenLength) { TR = this.createRow(); this.appendToTbody(TR); } else if (rowIndex === 0) { TR = this.TBODY.firstChild; } else { // http://jsperf.com/nextsibling-vs-indexed-childnodes TR = currentTr.nextSibling; } if (TR.className) { TR.removeAttribute('class'); } return TR; } /** * @returns {HTMLTableCellElement} */ }, { key: 'createRow', value: function createRow() { var TR = document.createElement('TR'); for (var visibleColIndex = 0; visibleColIndex < this.rowHeaderCount; visibleColIndex++) { TR.appendChild(document.createElement('TH')); } return TR; } /** * @param {Number} row * @param {Number} col * @param {HTMLTableCellElement} TH */ }, { key: 'renderRowHeader', value: function renderRowHeader(row, col, TH) { TH.className = ''; TH.removeAttribute('style'); this.rowHeaders[col](row, TH, col); } /** * @param {Number} row * @param {HTMLTableCellElement} TR */ }, { key: 'renderRowHeaders', value: function renderRowHeaders(row, TR) { for (var TH = TR.firstChild, visibleColIndex = 0; visibleColIndex < this.rowHeaderCount; visibleColIndex++) { // If the number of row headers increased we need to create TH or replace an existing TD node with TH if (!TH) { TH = document.createElement('TH'); TR.appendChild(TH); } else if (TH.nodeName == 'TD') { TH = replaceTdWithTh(TH, TR); } this.renderRowHeader(row, visibleColIndex, TH); // http://jsperf.com/nextsibling-vs-indexed-childnodes TH = TH.nextSibling; } } /** * Adjust the number of COL and TH elements to match the number of columns and headers that need to be rendered */ }, { key: 'adjustAvailableNodes', value: function adjustAvailableNodes() { this.adjustColGroups(); this.adjustThead(); } /** * Renders the column headers */ }, { key: 'renderColumnHeaders', value: function renderColumnHeaders() { if (!this.columnHeaderCount) { return; } var columnCount = this.wtTable.getRenderedColumnsCount(); for (var i = 0; i < this.columnHeaderCount; i++) { var TR = this.getTrForColumnHeaders(i); for (var renderedColumnIndex = -1 * this.rowHeaderCount; renderedColumnIndex < columnCount; renderedColumnIndex++) { var sourceCol = this.columnFilter.renderedToSource(renderedColumnIndex); this.renderColumnHeader(i, sourceCol, TR.childNodes[renderedColumnIndex + this.rowHeaderCount]); } } } /** * Adjusts the number of COL elements to match the number of columns that need to be rendered */ }, { key: 'adjustColGroups', value: function adjustColGroups() { var columnCount = this.wtTable.getRenderedColumnsCount(); while (this.wtTable.colgroupChildrenLength < columnCount + this.rowHeaderCount) { this.COLGROUP.appendChild(document.createElement('COL')); this.wtTable.colgroupChildrenLength++; } while (this.wtTable.colgroupChildrenLength > columnCount + this.rowHeaderCount) { this.COLGROUP.removeChild(this.COLGROUP.lastChild); this.wtTable.colgroupChildrenLength--; } if (this.rowHeaderCount) { (0, _element.addClass)(this.COLGROUP.childNodes[0], 'rowHeader'); } } /** * Adjusts the number of TH elements in THEAD to match the number of headers and columns that need to be rendered */ }, { key: 'adjustThead', value: function adjustThead() { var columnCount = this.wtTable.getRenderedColumnsCount(); var TR = this.THEAD.firstChild; if (this.columnHeaders.length) { for (var i = 0, len = this.columnHeaders.length; i < len; i++) { TR = this.THEAD.childNodes[i]; if (!TR) { TR = document.createElement('TR'); this.THEAD.appendChild(TR); } this.theadChildrenLength = TR.childNodes.length; while (this.theadChildrenLength < columnCount + this.rowHeaderCount) { TR.appendChild(document.createElement('TH')); this.theadChildrenLength++; } while (this.theadChildrenLength > columnCount + this.rowHeaderCount) { TR.removeChild(TR.lastChild); this.theadChildrenLength--; } } var theadChildrenLength = this.THEAD.childNodes.length; if (theadChildrenLength > this.columnHeaders.length) { for (var _i2 = this.columnHeaders.length; _i2 < theadChildrenLength; _i2++) { this.THEAD.removeChild(this.THEAD.lastChild); } } } else if (TR) { (0, _element.empty)(TR); } } /** * @param {Number} index * @returns {HTMLTableCellElement} */ }, { key: 'getTrForColumnHeaders', value: function getTrForColumnHeaders(index) { return this.THEAD.childNodes[index]; } /** * @param {Number} row * @param {Number} col * @param {HTMLTableCellElement} TH * @returns {*} */ }, { key: 'renderColumnHeader', value: function renderColumnHeader(row, col, TH) { TH.className = ''; TH.removeAttribute('style'); return this.columnHeaders[row](col, TH, row); } /** * Add and/or remove the TDs to match the desired number * * @param {HTMLTableCellElement} TR Table row in question * @param {Number} desiredCount The desired number of TDs in the TR */ }, { key: 'adjustColumns', value: function adjustColumns(TR, desiredCount) { var count = TR.childNodes.length; while (count < desiredCount) { var TD = document.createElement('TD'); TR.appendChild(TD); count++; } while (count > desiredCount) { TR.removeChild(TR.lastChild); count--; } } /** * @param {Number} columnsToRender */ }, { key: 'removeRedundantColumns', value: function removeRedundantColumns(columnsToRender) { while (this.wtTable.tbodyChildrenLength > columnsToRender) { this.TBODY.removeChild(this.TBODY.lastChild); this.wtTable.tbodyChildrenLength--; } } }]); return TableRenderer; }(); function replaceTdWithTh(TD, TR) { var TH = document.createElement('TH'); TR.insertBefore(TH, TD); TR.removeChild(TD); return TH; } function replaceThWithTd(TH, TR) { var TD = document.createElement('TD'); TR.insertBefore(TD, TH); TR.removeChild(TH); return TD; } exports.default = TableRenderer; /***/ }), /* 71 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _object = __webpack_require__(25); var _eventManager = __webpack_require__(23); var _eventManager2 = _interopRequireDefault(_eventManager); var _viewportColumns = __webpack_require__(60); var _viewportColumns2 = _interopRequireDefault(_viewportColumns); var _viewportRows = __webpack_require__(61); var _viewportRows2 = _interopRequireDefault(_viewportRows); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @class Viewport */ var Viewport = function () { /** * @param wotInstance */ function Viewport(wotInstance) { var _this = this; _classCallCheck(this, Viewport); this.wot = wotInstance; // legacy support this.instance = this.wot; this.oversizedRows = []; this.oversizedColumnHeaders = []; this.hasOversizedColumnHeadersMarked = {}; this.clientHeight = 0; this.containerWidth = NaN; this.rowHeaderWidth = NaN; this.rowsVisibleCalculator = null; this.columnsVisibleCalculator = null; this.eventManager = new _eventManager2.default(this.wot); this.eventManager.addEventListener(window, 'resize', function () { _this.clientHeight = _this.getWorkspaceHeight(); }); } /** * @returns {number} */ _createClass(Viewport, [{ key: 'getWorkspaceHeight', value: function getWorkspaceHeight() { var trimmingContainer = this.instance.wtOverlays.topOverlay.trimmingContainer; var elemHeight = void 0; var height = 0; if (trimmingContainer === window) { height = document.documentElement.clientHeight; } else { elemHeight = (0, _element.outerHeight)(trimmingContainer); // returns height without DIV scrollbar height = elemHeight > 0 && trimmingContainer.clientHeight > 0 ? trimmingContainer.clientHeight : Infinity; } return height; } }, { key: 'getWorkspaceWidth', value: function getWorkspaceWidth() { var width = void 0; var totalColumns = this.wot.getSetting('totalColumns'); var trimmingContainer = this.instance.wtOverlays.leftOverlay.trimmingContainer; var overflow = void 0; var stretchSetting = this.wot.getSetting('stretchH'); var docOffsetWidth = document.documentElement.offsetWidth; var preventOverflow = this.wot.getSetting('preventOverflow'); if (preventOverflow) { return (0, _element.outerWidth)(this.instance.wtTable.wtRootElement); } if (this.wot.getSetting('freezeOverlays')) { width = Math.min(docOffsetWidth - this.getWorkspaceOffset().left, docOffsetWidth); } else { width = Math.min(this.getContainerFillWidth(), docOffsetWidth - this.getWorkspaceOffset().left, docOffsetWidth); } if (trimmingContainer === window && totalColumns > 0 && this.sumColumnWidths(0, totalColumns - 1) > width) { // in case sum of column widths is higher than available stylesheet width, let's assume using the whole window // otherwise continue below, which will allow stretching // this is used in `scroll_window.html` // TODO test me return document.documentElement.clientWidth; } if (trimmingContainer !== window) { overflow = (0, _element.getStyle)(this.instance.wtOverlays.leftOverlay.trimmingContainer, 'overflow'); if (overflow == 'scroll' || overflow == 'hidden' || overflow == 'auto') { // this is used in `scroll.html` // TODO test me return Math.max(width, trimmingContainer.clientWidth); } } if (stretchSetting === 'none' || !stretchSetting) { // if no stretching is used, return the maximum used workspace width return Math.max(width, (0, _element.outerWidth)(this.instance.wtTable.TABLE)); } // if stretching is used, return the actual container width, so the columns can fit inside it return width; } /** * Checks if viewport has vertical scroll * * @returns {Boolean} */ }, { key: 'hasVerticalScroll', value: function hasVerticalScroll() { return this.getWorkspaceActualHeight() > this.getWorkspaceHeight(); } /** * Checks if viewport has horizontal scroll * * @returns {Boolean} */ }, { key: 'hasHorizontalScroll', value: function hasHorizontalScroll() { return this.getWorkspaceActualWidth() > this.getWorkspaceWidth(); } /** * @param from * @param length * @returns {Number} */ }, { key: 'sumColumnWidths', value: function sumColumnWidths(from, length) { var sum = 0; while (from < length) { sum += this.wot.wtTable.getColumnWidth(from); from++; } return sum; } /** * @returns {Number} */ }, { key: 'getContainerFillWidth', value: function getContainerFillWidth() { if (this.containerWidth) { return this.containerWidth; } var mainContainer = this.instance.wtTable.holder; var fillWidth = void 0; var dummyElement = void 0; dummyElement = document.createElement('div'); dummyElement.style.width = '100%'; dummyElement.style.height = '1px'; mainContainer.appendChild(dummyElement); fillWidth = dummyElement.offsetWidth; this.containerWidth = fillWidth; mainContainer.removeChild(dummyElement); return fillWidth; } /** * @returns {Number} */ }, { key: 'getWorkspaceOffset', value: function getWorkspaceOffset() { return (0, _element.offset)(this.wot.wtTable.TABLE); } /** * @returns {Number} */ }, { key: 'getWorkspaceActualHeight', value: function getWorkspaceActualHeight() { return (0, _element.outerHeight)(this.wot.wtTable.TABLE); } /** * @returns {Number} */ }, { key: 'getWorkspaceActualWidth', value: function getWorkspaceActualWidth() { return (0, _element.outerWidth)(this.wot.wtTable.TABLE) || (0, _element.outerWidth)(this.wot.wtTable.TBODY) || (0, _element.outerWidth)(this.wot.wtTable.THEAD); // IE8 reports 0 as offsetWidth; } /** * @returns {Number} */ }, { key: 'getColumnHeaderHeight', value: function getColumnHeaderHeight() { if (isNaN(this.columnHeaderHeight)) { this.columnHeaderHeight = (0, _element.outerHeight)(this.wot.wtTable.THEAD); } return this.columnHeaderHeight; } /** * @returns {Number} */ }, { key: 'getViewportHeight', value: function getViewportHeight() { var containerHeight = this.getWorkspaceHeight(); var columnHeaderHeight = void 0; if (containerHeight === Infinity) { return containerHeight; } columnHeaderHeight = this.getColumnHeaderHeight(); if (columnHeaderHeight > 0) { containerHeight -= columnHeaderHeight; } return containerHeight; } /** * @returns {Number} */ }, { key: 'getRowHeaderWidth', value: function getRowHeaderWidth() { var rowHeadersHeightSetting = this.instance.getSetting('rowHeaderWidth'); var rowHeaders = this.instance.getSetting('rowHeaders'); if (rowHeadersHeightSetting) { this.rowHeaderWidth = 0; for (var i = 0, len = rowHeaders.length; i < len; i++) { this.rowHeaderWidth += rowHeadersHeightSetting[i] || rowHeadersHeightSetting; } } if (this.wot.cloneSource) { return this.wot.cloneSource.wtViewport.getRowHeaderWidth(); } if (isNaN(this.rowHeaderWidth)) { if (rowHeaders.length) { var TH = this.instance.wtTable.TABLE.querySelector('TH'); this.rowHeaderWidth = 0; for (var _i = 0, _len = rowHeaders.length; _i < _len; _i++) { if (TH) { this.rowHeaderWidth += (0, _element.outerWidth)(TH); TH = TH.nextSibling; } else { // yes this is a cheat but it worked like that before, just taking assumption from CSS instead of measuring. // TODO: proper fix this.rowHeaderWidth += 50; } } } else { this.rowHeaderWidth = 0; } } this.rowHeaderWidth = this.instance.getSetting('onModifyRowHeaderWidth', this.rowHeaderWidth) || this.rowHeaderWidth; return this.rowHeaderWidth; } /** * @returns {Number} */ }, { key: 'getViewportWidth', value: function getViewportWidth() { var containerWidth = this.getWorkspaceWidth(); var rowHeaderWidth = void 0; if (containerWidth === Infinity) { return containerWidth; } rowHeaderWidth = this.getRowHeaderWidth(); if (rowHeaderWidth > 0) { return containerWidth - rowHeaderWidth; } return containerWidth; } /** * Creates: * - rowsRenderCalculator (before draw, to qualify rows for rendering) * - rowsVisibleCalculator (after draw, to measure which rows are actually visible) * * @returns {ViewportRowsCalculator} */ }, { key: 'createRowsCalculator', value: function createRowsCalculator() { var _this2 = this; var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var height = void 0; var pos = void 0; var fixedRowsTop = void 0; var scrollbarHeight = void 0; var fixedRowsBottom = void 0; var fixedRowsHeight = void 0; var totalRows = void 0; this.rowHeaderWidth = NaN; if (this.wot.wtSettings.settings.renderAllRows) { height = Infinity; } else { height = this.getViewportHeight(); } pos = this.wot.wtOverlays.topOverlay.getScrollPosition() - this.wot.wtOverlays.topOverlay.getTableParentOffset(); if (pos < 0) { pos = 0; } fixedRowsTop = this.wot.getSetting('fixedRowsTop'); fixedRowsBottom = this.wot.getSetting('fixedRowsBottom'); totalRows = this.wot.getSetting('totalRows'); if (fixedRowsTop) { fixedRowsHeight = this.wot.wtOverlays.topOverlay.sumCellSizes(0, fixedRowsTop); pos += fixedRowsHeight; height -= fixedRowsHeight; } if (fixedRowsBottom && this.wot.wtOverlays.bottomOverlay.clone) { fixedRowsHeight = this.wot.wtOverlays.bottomOverlay.sumCellSizes(totalRows - fixedRowsBottom, totalRows); height -= fixedRowsHeight; } if (this.wot.wtTable.holder.clientHeight === this.wot.wtTable.holder.offsetHeight) { scrollbarHeight = 0; } else { scrollbarHeight = (0, _element.getScrollbarWidth)(); } return new _viewportRows2.default(height, pos, this.wot.getSetting('totalRows'), function (sourceRow) { return _this2.wot.wtTable.getRowHeight(sourceRow); }, visible ? null : this.wot.wtSettings.settings.viewportRowCalculatorOverride, visible, scrollbarHeight); } /** * Creates: * - columnsRenderCalculator (before draw, to qualify columns for rendering) * - columnsVisibleCalculator (after draw, to measure which columns are actually visible) * * @returns {ViewportRowsCalculator} */ }, { key: 'createColumnsCalculator', value: function createColumnsCalculator() { var _this3 = this; var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var width = this.getViewportWidth(); var pos = void 0; var fixedColumnsLeft = void 0; this.columnHeaderHeight = NaN; pos = this.wot.wtOverlays.leftOverlay.getScrollPosition() - this.wot.wtOverlays.leftOverlay.getTableParentOffset(); if (pos < 0) { pos = 0; } fixedColumnsLeft = this.wot.getSetting('fixedColumnsLeft'); if (fixedColumnsLeft) { var fixedColumnsWidth = this.wot.wtOverlays.leftOverlay.sumCellSizes(0, fixedColumnsLeft); pos += fixedColumnsWidth; width -= fixedColumnsWidth; } if (this.wot.wtTable.holder.clientWidth !== this.wot.wtTable.holder.offsetWidth) { width -= (0, _element.getScrollbarWidth)(); } return new _viewportColumns2.default(width, pos, this.wot.getSetting('totalColumns'), function (sourceCol) { return _this3.wot.wtTable.getColumnWidth(sourceCol); }, visible ? null : this.wot.wtSettings.settings.viewportColumnCalculatorOverride, visible, this.wot.getSetting('stretchH'), function (stretchedWidth, column) { return _this3.wot.getSetting('onBeforeStretchingColumnWidth', stretchedWidth, column); }); } /** * Creates rowsRenderCalculator and columnsRenderCalculator (before draw, to determine what rows and * cols should be rendered) * * @param fastDraw {Boolean} If `true`, will try to avoid full redraw and only update the border positions. * If `false` or `undefined`, will perform a full redraw * @returns fastDraw {Boolean} The fastDraw value, possibly modified */ }, { key: 'createRenderCalculators', value: function createRenderCalculators() { var fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (fastDraw) { var proposedRowsVisibleCalculator = this.createRowsCalculator(true); var proposedColumnsVisibleCalculator = this.createColumnsCalculator(true); if (!(this.areAllProposedVisibleRowsAlreadyRendered(proposedRowsVisibleCalculator) && this.areAllProposedVisibleColumnsAlreadyRendered(proposedColumnsVisibleCalculator))) { fastDraw = false; } } if (!fastDraw) { this.rowsRenderCalculator = this.createRowsCalculator(); this.columnsRenderCalculator = this.createColumnsCalculator(); } // delete temporarily to make sure that renderers always use rowsRenderCalculator, not rowsVisibleCalculator this.rowsVisibleCalculator = null; this.columnsVisibleCalculator = null; return fastDraw; } /** * Creates rowsVisibleCalculator and columnsVisibleCalculator (after draw, to determine what are * the actually visible rows and columns) */ }, { key: 'createVisibleCalculators', value: function createVisibleCalculators() { this.rowsVisibleCalculator = this.createRowsCalculator(true); this.columnsVisibleCalculator = this.createColumnsCalculator(true); } /** * Returns information whether proposedRowsVisibleCalculator viewport * is contained inside rows rendered in previous draw (cached in rowsRenderCalculator) * * @param {Object} proposedRowsVisibleCalculator * @returns {Boolean} Returns `true` if all proposed visible rows are already rendered (meaning: redraw is not needed). * Returns `false` if at least one proposed visible row is not already rendered (meaning: redraw is needed) */ }, { key: 'areAllProposedVisibleRowsAlreadyRendered', value: function areAllProposedVisibleRowsAlreadyRendered(proposedRowsVisibleCalculator) { if (this.rowsVisibleCalculator) { if (proposedRowsVisibleCalculator.startRow < this.rowsRenderCalculator.startRow || proposedRowsVisibleCalculator.startRow === this.rowsRenderCalculator.startRow && proposedRowsVisibleCalculator.startRow > 0) { return false; } else if (proposedRowsVisibleCalculator.endRow > this.rowsRenderCalculator.endRow || proposedRowsVisibleCalculator.endRow === this.rowsRenderCalculator.endRow && proposedRowsVisibleCalculator.endRow < this.wot.getSetting('totalRows') - 1) { return false; } return true; } return false; } /** * Returns information whether proposedColumnsVisibleCalculator viewport * is contained inside column rendered in previous draw (cached in columnsRenderCalculator) * * @param {Object} proposedColumnsVisibleCalculator * @returns {Boolean} Returns `true` if all proposed visible columns are already rendered (meaning: redraw is not needed). * Returns `false` if at least one proposed visible column is not already rendered (meaning: redraw is needed) */ }, { key: 'areAllProposedVisibleColumnsAlreadyRendered', value: function areAllProposedVisibleColumnsAlreadyRendered(proposedColumnsVisibleCalculator) { if (this.columnsVisibleCalculator) { if (proposedColumnsVisibleCalculator.startColumn < this.columnsRenderCalculator.startColumn || proposedColumnsVisibleCalculator.startColumn === this.columnsRenderCalculator.startColumn && proposedColumnsVisibleCalculator.startColumn > 0) { return false; } else if (proposedColumnsVisibleCalculator.endColumn > this.columnsRenderCalculator.endColumn || proposedColumnsVisibleCalculator.endColumn === this.columnsRenderCalculator.endColumn && proposedColumnsVisibleCalculator.endColumn < this.wot.getSetting('totalColumns') - 1) { return false; } return true; } return false; } /** * Resets values in keys of the hasOversizedColumnHeadersMarked object after updateSettings. */ }, { key: 'resetHasOversizedColumnHeadersMarked', value: function resetHasOversizedColumnHeadersMarked() { (0, _object.objectEach)(this.hasOversizedColumnHeadersMarked, function (value, key, object) { object[key] = void 0; }); } }]); return Viewport; }(); exports.default = Viewport; /***/ }), /* 72 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var addToUnscopables = __webpack_require__(17) , step = __webpack_require__(89) , Iterators = __webpack_require__(27) , toIObject = __webpack_require__(9); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() module.exports = __webpack_require__(88)(Array, 'Array', function(iterated, kind){ this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function(){ var O = this._t , kind = this._k , index = this._i++; if(!O || index >= O.length){ this._t = undefined; return step(1); } if(kind == 'keys' )return step(0, index); if(kind == 'values')return step(0, O[index]); return step(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators.Arguments = Iterators.Array; addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); /***/ }), /* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.stopImmediatePropagation = stopImmediatePropagation; exports.isImmediatePropagationStopped = isImmediatePropagationStopped; exports.stopPropagation = stopPropagation; exports.pageX = pageX; exports.pageY = pageY; exports.isRightClick = isRightClick; exports.isLeftClick = isLeftClick; var _element = __webpack_require__(2); /** * Prevent other listeners of the same event from being called. * * @param {Event} event */ function stopImmediatePropagation(event) { event.isImmediatePropagationEnabled = false; event.cancelBubble = true; } /** * Check if event was stopped by `stopImmediatePropagation`. * * @param event {Event} * @returns {Boolean} */ function isImmediatePropagationStopped(event) { return event.isImmediatePropagationEnabled === false; } /** * Prevent further propagation of the current event (prevent bubbling). * * @param event {Event} */ function stopPropagation(event) { // ie8 // http://msdn.microsoft.com/en-us/library/ie/ff975462(v=vs.85).aspx if (typeof event.stopPropagation === 'function') { event.stopPropagation(); } else { event.cancelBubble = true; } } /** * Get horizontal coordinate of the event object relative to the whole document. * * @param {Event} event * @returns {Number} */ function pageX(event) { if (event.pageX) { return event.pageX; } return event.clientX + (0, _element.getWindowScrollLeft)(); } /** * Get vertical coordinate of the event object relative to the whole document. * * @param {Event} event * @returns {Number} */ function pageY(event) { if (event.pageY) { return event.pageY; } return event.clientY + (0, _element.getWindowScrollTop)(); } /** * Check if provided event was triggered by clicking the right mouse button. * * @param {Event} event DOM Event. * @returns {Boolean} */ function isRightClick(event) { return event.button === 2; } /** * Check if provided event was triggered by clicking the left mouse button. * * @param {Event} event DOM Event. * @returns {Boolean} */ function isLeftClick(event) { return event.button === 0; } /***/ }), /* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; exports.requestAnimationFrame = requestAnimationFrame; exports.cancelAnimationFrame = cancelAnimationFrame; exports.isTouchSupported = isTouchSupported; exports.isWebComponentSupportedNatively = isWebComponentSupportedNatively; exports.hasCaptionProblem = hasCaptionProblem; exports.getComparisonFunction = getComparisonFunction; // https://gist.github.com/paulirish/1579671 var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; var _requestAnimationFrame = window.requestAnimationFrame; var _cancelAnimationFrame = window.cancelAnimationFrame; for (var x = 0; x < vendors.length && !_requestAnimationFrame; ++x) { _requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; _cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; } if (!_requestAnimationFrame) { _requestAnimationFrame = function _requestAnimationFrame(callback) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; } if (!_cancelAnimationFrame) { _cancelAnimationFrame = function _cancelAnimationFrame(id) { clearTimeout(id); }; } /** * Polyfill for requestAnimationFrame * * @param {Function} callback * @returns {Number} */ function requestAnimationFrame(callback) { return _requestAnimationFrame.call(window, callback); } /** * Polyfill for cancelAnimationFrame * * @param {Number} id */ function cancelAnimationFrame(id) { _cancelAnimationFrame.call(window, id); } function isTouchSupported() { return 'ontouchstart' in window; } /** * Checks if browser is support web components natively * * @returns {Boolean} */ function isWebComponentSupportedNatively() { var test = document.createElement('div'); return !!(test.createShadowRoot && test.createShadowRoot.toString().match(/\[native code\]/)); } var _hasCaptionProblem; function detectCaptionProblem() { var TABLE = document.createElement('TABLE'); TABLE.style.borderSpacing = 0; TABLE.style.borderWidth = 0; TABLE.style.padding = 0; var TBODY = document.createElement('TBODY'); TABLE.appendChild(TBODY); TBODY.appendChild(document.createElement('TR')); TBODY.firstChild.appendChild(document.createElement('TD')); TBODY.firstChild.firstChild.innerHTML = ''; var CAPTION = document.createElement('CAPTION'); CAPTION.innerHTML = 'c
c
c
c'; CAPTION.style.padding = 0; CAPTION.style.margin = 0; TABLE.insertBefore(CAPTION, TBODY); document.body.appendChild(TABLE); _hasCaptionProblem = TABLE.offsetHeight < 2 * TABLE.lastChild.offsetHeight; // boolean document.body.removeChild(TABLE); } function hasCaptionProblem() { if (_hasCaptionProblem === void 0) { detectCaptionProblem(); } return _hasCaptionProblem; } var comparisonFunction = void 0; /** * Get string comparison function for sorting purposes. It supports multilingual string comparison base on Internationalization API. * * @param {String} [language] * @param {Object} [options] * @returns {*} */ function getComparisonFunction(language) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (comparisonFunction) { return comparisonFunction; } if ((typeof Intl === 'undefined' ? 'undefined' : _typeof(Intl)) === 'object') { comparisonFunction = new Intl.Collator(language, options).compare; } else if (typeof String.prototype.localeCompare === 'function') { comparisonFunction = function comparisonFunction(a, b) { return ('' + a).localeCompare(b); }; } else { comparisonFunction = function comparisonFunction(a, b) { if (a === b) { return 0; } return a > b ? -1 : 1; }; } return comparisonFunction; } /***/ }), /* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.isFunction = isFunction; exports.throttle = throttle; exports.throttleAfterHits = throttleAfterHits; exports.debounce = debounce; exports.pipe = pipe; exports.partial = partial; exports.curry = curry; exports.curryRight = curryRight; var _array = __webpack_require__(24); /** * Checks if given variable is function. * * @param {*} func Variable to check. * @returns {Boolean} */ function isFunction(func) { return typeof func === 'function'; } /** * Creates throttle function that enforces a maximum number of times a function (`func`) can be called over time (`wait`). * * @param {Function} func Function to invoke. * @param {Number} wait Delay in miliseconds. * @returns {Function} */ function throttle(func) { var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; var lastCalled = 0; var result = { lastCallThrottled: true }; var lastTimer = null; function _throttle() { var _this = this; var args = arguments; var stamp = Date.now(); var needCall = false; result.lastCallThrottled = true; if (!lastCalled) { lastCalled = stamp; needCall = true; } var remaining = wait - (stamp - lastCalled); if (needCall) { result.lastCallThrottled = false; func.apply(this, args); } else { if (lastTimer) { clearTimeout(lastTimer); } lastTimer = setTimeout(function () { result.lastCallThrottled = false; func.apply(_this, args); lastCalled = 0; lastTimer = void 0; }, remaining); } return result; } return _throttle; } /** * Creates throttle function that enforces a maximum number of times a function (`func`) can be called over * time (`wait`) after specified hits. * * @param {Function} func Function to invoke. * @param {Number} wait Delay in miliseconds. * @param {Number} hits Number of hits after throttling will be applied. * @returns {Function} */ function throttleAfterHits(func) { var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; var hits = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10; var funcThrottle = throttle(func, wait); var remainHits = hits; function _clearHits() { remainHits = hits; } function _throttleAfterHits() { if (remainHits) { remainHits--; return func.apply(this, arguments); } return funcThrottle.apply(this, arguments); } _throttleAfterHits.clearHits = _clearHits; return _throttleAfterHits; } /** * Creates debounce function that enforces a function (`func`) not be called again until a certain amount of time (`wait`) * has passed without it being called. * * @param {Function} func Function to invoke. * @param {Number} wait Delay in milliseconds. * @returns {Function} */ function debounce(func) { var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; var lastTimer = null; var result = void 0; function _debounce() { var _this2 = this; var args = arguments; if (lastTimer) { clearTimeout(lastTimer); } lastTimer = setTimeout(function () { result = func.apply(_this2, args); }, wait); return result; } return _debounce; } /** * Creates the function that returns the result of calling the given functions. Result of the first function is passed to * the second as an argument and so on. Only first function in the chain can handle multiple arguments. * * @param {Function} functions Functions to compose. * @returns {Function} */ function pipe() { for (var _len = arguments.length, functions = Array(_len), _key = 0; _key < _len; _key++) { functions[_key] = arguments[_key]; } var firstFunc = functions[0], restFunc = functions.slice(1); return function _pipe() { return (0, _array.arrayReduce)(restFunc, function (acc, fn) { return fn(acc); }, firstFunc.apply(this, arguments)); }; } /** * Creates the function that returns the function with cached arguments. * * @param {Function} func Function to partialization. * @param {Array} params Function arguments to cache. * @returns {Function} */ function partial(func) { for (var _len2 = arguments.length, params = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { params[_key2 - 1] = arguments[_key2]; } return function _partial() { for (var _len3 = arguments.length, restParams = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { restParams[_key3] = arguments[_key3]; } return func.apply(this, params.concat(restParams)); }; } /** * Creates the functions that returns the function with cached arguments. If count if passed arguments will be matched * to the arguments defined in `func` then function will be invoked. * Arguments are added to the stack in direction from the left to the right. * * @example * ``` * var replace = curry(function(find, replace, string) { * return string.replace(find, replace); * }); * * // returns function with bounded first argument * var replace = replace('foo') * * // returns replaced string - all arguments was passed so function was invoked * replace('bar', 'Some test with foo...'); * * ``` * * @param {Function} func Function to currying. * @returns {Function} */ function curry(func) { var argsLength = func.length; function given(argsSoFar) { return function _curry() { for (var _len4 = arguments.length, params = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { params[_key4] = arguments[_key4]; } var passedArgsSoFar = argsSoFar.concat(params); var result = void 0; if (passedArgsSoFar.length >= argsLength) { result = func.apply(this, passedArgsSoFar); } else { result = given(passedArgsSoFar); } return result; }; } return given([]); } /** * Creates the functions that returns the function with cached arguments. If count if passed arguments will be matched * to the arguments defined in `func` then function will be invoked. * Arguments are added to the stack in direction from the right to the left. * * @example * ``` * var replace = curry(function(find, replace, string) { * return string.replace(find, replace); * }); * * // returns function with bounded first argument * var replace = replace('Some test with foo...') * * // returns replaced string - all arguments was passed so function was invoked * replace('bar', 'foo'); * * ``` * * @param {Function} func Function to currying. * @returns {Function} */ function curryRight(func) { var argsLength = func.length; function given(argsSoFar) { return function _curry() { for (var _len5 = arguments.length, params = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { params[_key5] = arguments[_key5]; } var passedArgsSoFar = argsSoFar.concat(params.reverse()); var result = void 0; if (passedArgsSoFar.length >= argsLength) { result = func.apply(this, passedArgsSoFar); } else { result = given(passedArgsSoFar); } return result; }; } return given([]); } /***/ }), /* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; exports.isNumeric = isNumeric; exports.rangeEach = rangeEach; exports.rangeEachReverse = rangeEachReverse; exports.valueAccordingPercent = valueAccordingPercent; /** * Checks if value of n is a numeric one * http://jsperf.com/isnan-vs-isnumeric/4 * @param n * @returns {boolean} */ function isNumeric(n) { /* eslint-disable */ var t = typeof n === 'undefined' ? 'undefined' : _typeof(n); return t == 'number' ? !isNaN(n) && isFinite(n) : t == 'string' ? !n.length ? false : n.length == 1 ? /\d/.test(n) : /^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(n) : t == 'object' ? !!n && typeof n.valueOf() == 'number' && !(n instanceof Date) : false; } /** * A specialized version of `.forEach` defined by ranges. * * @param {Number} rangeFrom The number from start iterate. * @param {Number|Function} rangeTo The number where finish iterate or function as a iteratee. * @param {Function} [iteratee] The function invoked per iteration. */ function rangeEach(rangeFrom, rangeTo, iteratee) { var index = -1; if (typeof rangeTo === 'function') { iteratee = rangeTo; rangeTo = rangeFrom; } else { index = rangeFrom - 1; } while (++index <= rangeTo) { if (iteratee(index) === false) { break; } } } /** * A specialized version of `.forEach` defined by ranges iterable in reverse order. * * @param {Number} rangeFrom The number from start iterate. * @param {Number} rangeTo The number where finish iterate. * @param {Function} iteratee The function invoked per iteration. */ function rangeEachReverse(rangeFrom, rangeTo, iteratee) { var index = rangeFrom + 1; if (typeof rangeTo === 'function') { iteratee = rangeTo; rangeTo = 0; } while (--index >= rangeTo) { if (iteratee(index) === false) { break; } } } /** * Calculate value from percent. * * @param {Number} value Base value from percent will be calculated. * @param {String|Number} percent Can be Number or String (eq. `'33%'`). * @returns {Number} */ function valueAccordingPercent(value, percent) { percent = parseInt(percent.toString().replace('%', ''), 10); percent = parseInt(value * percent / 100, 10); return percent; } /***/ }), /* 77 */ /***/ (function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes var toIObject = __webpack_require__(9) , toLength = __webpack_require__(10) , toIndex = __webpack_require__(41); module.exports = function(IS_INCLUDES){ return function($this, el, fromIndex){ var O = toIObject($this) , length = toLength(O.length) , index = toIndex(fromIndex, length) , value; // Array#includes uses SameValueZero equality algorithm if(IS_INCLUDES && el != el)while(length > index){ value = O[index++]; if(value != value)return true; // Array#toIndex ignores holes, Array#includes - not } else for(;length > index; index++)if(IS_INCLUDES || index in O){ if(O[index] === el)return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; /***/ }), /* 78 */ /***/ (function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() var cof = __webpack_require__(18) , TAG = __webpack_require__(1)('toStringTag') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function(it, key){ try { return it[key]; } catch(e){ /* empty */ } }; module.exports = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }), /* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var dP = __webpack_require__(6).f , create = __webpack_require__(51) , redefineAll = __webpack_require__(40) , ctx = __webpack_require__(12) , anInstance = __webpack_require__(33) , defined = __webpack_require__(13) , forOf = __webpack_require__(37) , $iterDefine = __webpack_require__(88) , step = __webpack_require__(89) , setSpecies = __webpack_require__(94) , DESCRIPTORS = __webpack_require__(7) , fastKey = __webpack_require__(28).fastKey , SIZE = DESCRIPTORS ? '_s' : 'size'; var getEntry = function(that, key){ // fast case var index = fastKey(key), entry; if(index !== 'F')return that._i[index]; // frozen object case for(entry = that._f; entry; entry = entry.n){ if(entry.k == key)return entry; } }; module.exports = { getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ var C = wrapper(function(that, iterable){ anInstance(that, C, NAME, '_i'); that._i = create(null); // index that._f = undefined; // first entry that._l = undefined; // last entry that[SIZE] = 0; // size if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { // 23.1.3.1 Map.prototype.clear() // 23.2.3.2 Set.prototype.clear() clear: function clear(){ for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){ entry.r = true; if(entry.p)entry.p = entry.p.n = undefined; delete data[entry.i]; } that._f = that._l = undefined; that[SIZE] = 0; }, // 23.1.3.3 Map.prototype.delete(key) // 23.2.3.4 Set.prototype.delete(value) 'delete': function(key){ var that = this , entry = getEntry(that, key); if(entry){ var next = entry.n , prev = entry.p; delete that._i[entry.i]; entry.r = true; if(prev)prev.n = next; if(next)next.p = prev; if(that._f == entry)that._f = next; if(that._l == entry)that._l = prev; that[SIZE]--; } return !!entry; }, // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) forEach: function forEach(callbackfn /*, that = undefined */){ anInstance(this, C, 'forEach'); var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3) , entry; while(entry = entry ? entry.n : this._f){ f(entry.v, entry.k, this); // revert to the last existing entry while(entry && entry.r)entry = entry.p; } }, // 23.1.3.7 Map.prototype.has(key) // 23.2.3.7 Set.prototype.has(value) has: function has(key){ return !!getEntry(this, key); } }); if(DESCRIPTORS)dP(C.prototype, 'size', { get: function(){ return defined(this[SIZE]); } }); return C; }, def: function(that, key, value){ var entry = getEntry(that, key) , prev, index; // change existing entry if(entry){ entry.v = value; // create new entry } else { that._l = entry = { i: index = fastKey(key, true), // <- index k: key, // <- key v: value, // <- value p: prev = that._l, // <- previous entry n: undefined, // <- next entry r: false // <- removed }; if(!that._f)that._f = entry; if(prev)prev.n = entry; that[SIZE]++; // add to index if(index !== 'F')that._i[index] = entry; } return that; }, getEntry: getEntry, setStrong: function(C, NAME, IS_MAP){ // add .keys, .values, .entries, [@@iterator] // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 $iterDefine(C, NAME, function(iterated, kind){ this._t = iterated; // target this._k = kind; // kind this._l = undefined; // previous }, function(){ var that = this , kind = that._k , entry = that._l; // revert to the last existing entry while(entry && entry.r)entry = entry.p; // get next entry if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){ // or finish the iteration that._t = undefined; return step(1); } // return step by kind if(kind == 'keys' )return step(0, entry.k); if(kind == 'values')return step(0, entry.v); return step(0, [entry.k, entry.v]); }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true); // add [@@species], 23.1.2.2, 23.2.2.2 setSpecies(NAME); } }; /***/ }), /* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var redefineAll = __webpack_require__(40) , getWeak = __webpack_require__(28).getWeak , anObject = __webpack_require__(5) , isObject = __webpack_require__(4) , anInstance = __webpack_require__(33) , forOf = __webpack_require__(37) , createArrayMethod = __webpack_require__(34) , $has = __webpack_require__(8) , arrayFind = createArrayMethod(5) , arrayFindIndex = createArrayMethod(6) , id = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function(that){ return that._l || (that._l = new UncaughtFrozenStore); }; var UncaughtFrozenStore = function(){ this.a = []; }; var findUncaughtFrozen = function(store, key){ return arrayFind(store.a, function(it){ return it[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function(key){ var entry = findUncaughtFrozen(this, key); if(entry)return entry[1]; }, has: function(key){ return !!findUncaughtFrozen(this, key); }, set: function(key, value){ var entry = findUncaughtFrozen(this, key); if(entry)entry[1] = value; else this.a.push([key, value]); }, 'delete': function(key){ var index = arrayFindIndex(this.a, function(it){ return it[0] === key; }); if(~index)this.a.splice(index, 1); return !!~index; } }; module.exports = { getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ var C = wrapper(function(that, iterable){ anInstance(that, C, NAME, '_i'); that._i = id++; // collection id that._l = undefined; // leak store for uncaught frozen objects if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { // 23.3.3.2 WeakMap.prototype.delete(key) // 23.4.3.3 WeakSet.prototype.delete(value) 'delete': function(key){ if(!isObject(key))return false; var data = getWeak(key); if(data === true)return uncaughtFrozenStore(this)['delete'](key); return data && $has(data, this._i) && delete data[this._i]; }, // 23.3.3.4 WeakMap.prototype.has(key) // 23.4.3.4 WeakSet.prototype.has(value) has: function has(key){ if(!isObject(key))return false; var data = getWeak(key); if(data === true)return uncaughtFrozenStore(this).has(key); return data && $has(data, this._i); } }); return C; }, def: function(that, key, value){ var data = getWeak(anObject(key), true); if(data === true)uncaughtFrozenStore(that).set(key, value); else data[that._i] = value; return that; }, ufstore: uncaughtFrozenStore }; /***/ }), /* 81 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(3).document && document.documentElement; /***/ }), /* 82 */ /***/ (function(module, exports, __webpack_require__) { module.exports = !__webpack_require__(7) && !__webpack_require__(14)(function(){ return Object.defineProperty(__webpack_require__(46)('div'), 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }), /* 83 */ /***/ (function(module, exports, __webpack_require__) { // check on default Array iterator var Iterators = __webpack_require__(27) , ITERATOR = __webpack_require__(1)('iterator') , ArrayProto = Array.prototype; module.exports = function(it){ return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); }; /***/ }), /* 84 */ /***/ (function(module, exports, __webpack_require__) { // 7.2.2 IsArray(argument) var cof = __webpack_require__(18); module.exports = Array.isArray || function isArray(arg){ return cof(arg) == 'Array'; }; /***/ }), /* 85 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.3 Number.isInteger(number) var isObject = __webpack_require__(4) , floor = Math.floor; module.exports = function isInteger(it){ return !isObject(it) && isFinite(it) && floor(it) === it; }; /***/ }), /* 86 */ /***/ (function(module, exports, __webpack_require__) { // 7.2.8 IsRegExp(argument) var isObject = __webpack_require__(4) , cof = __webpack_require__(18) , MATCH = __webpack_require__(1)('match'); module.exports = function(it){ var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); }; /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { // call something on iterator step with safe closing on error var anObject = __webpack_require__(5); module.exports = function(iterator, fn, value, entries){ try { return entries ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch(e){ var ret = iterator['return']; if(ret !== undefined)anObject(ret.call(iterator)); throw e; } }; /***/ }), /* 88 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var LIBRARY = __webpack_require__(38) , $export = __webpack_require__(0) , redefine = __webpack_require__(16) , hide = __webpack_require__(15) , has = __webpack_require__(8) , Iterators = __webpack_require__(27) , $iterCreate = __webpack_require__(159) , setToStringTag = __webpack_require__(30) , getPrototypeOf = __webpack_require__(164) , ITERATOR = __webpack_require__(1)('iterator') , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` , FF_ITERATOR = '@@iterator' , KEYS = 'keys' , VALUES = 'values'; var returnThis = function(){ return this; }; module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ $iterCreate(Constructor, NAME, next); var getMethod = function(kind){ if(!BUGGY && kind in proto)return proto[kind]; switch(kind){ case KEYS: return function keys(){ return new Constructor(this, kind); }; case VALUES: return function values(){ return new Constructor(this, kind); }; } return function entries(){ return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator' , DEF_VALUES = DEFAULT == VALUES , VALUES_BUG = false , proto = Base.prototype , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] , $default = $native || getMethod(DEFAULT) , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined , $anyNative = NAME == 'Array' ? proto.entries || $native : $native , methods, key, IteratorPrototype; // Fix native if($anyNative){ IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); if(IteratorPrototype !== Object.prototype){ // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF if(DEF_VALUES && $native && $native.name !== VALUES){ VALUES_BUG = true; $default = function values(){ return $native.call(this); }; } // Define iterator if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ hide(proto, ITERATOR, $default); } // Plug for library Iterators[NAME] = $default; Iterators[TAG] = returnThis; if(DEFAULT){ methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if(FORCED)for(key in methods){ if(!(key in proto))redefine(proto, key, methods[key]); } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; /***/ }), /* 89 */ /***/ (function(module, exports) { module.exports = function(done, value){ return {value: value, done: !!done}; }; /***/ }), /* 90 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.2.1 Object.assign(target, source, ...) var getKeys = __webpack_require__(19) , gOPS = __webpack_require__(39) , pIE = __webpack_require__(29) , toObject = __webpack_require__(21) , IObject = __webpack_require__(49) , $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) module.exports = !$assign || __webpack_require__(14)(function(){ var A = {} , B = {} , S = Symbol() , K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function(k){ B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; }) ? function assign(target, source){ // eslint-disable-line no-unused-vars var T = toObject(target) , aLen = arguments.length , index = 1 , getSymbols = gOPS.f , isEnum = pIE.f; while(aLen > index){ var S = IObject(arguments[index++]) , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) , length = keys.length , j = 0 , key; while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; } return T; } : $assign; /***/ }), /* 91 */ /***/ (function(module, exports, __webpack_require__) { var has = __webpack_require__(8) , toIObject = __webpack_require__(9) , arrayIndexOf = __webpack_require__(77)(false) , IE_PROTO = __webpack_require__(54)('IE_PROTO'); module.exports = function(object, names){ var O = toIObject(object) , i = 0 , result = [] , key; for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); // Don't enum bug & hidden keys while(names.length > i)if(has(O, key = names[i++])){ ~arrayIndexOf(result, key) || result.push(key); } return result; }; /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { var getKeys = __webpack_require__(19) , toIObject = __webpack_require__(9) , isEnum = __webpack_require__(29).f; module.exports = function(isEntries){ return function(it){ var O = toIObject(it) , keys = getKeys(O) , length = keys.length , i = 0 , result = [] , key; while(length > i)if(isEnum.call(O, key = keys[i++])){ result.push(isEntries ? [key, O[key]] : O[key]); } return result; }; }; /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ var isObject = __webpack_require__(4) , anObject = __webpack_require__(5); var check = function(O, proto){ anObject(O); if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); }; module.exports = { set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line function(test, buggy, set){ try { set = __webpack_require__(12)(Function.call, __webpack_require__(52).f(Object.prototype, '__proto__').set, 2); set(test, []); buggy = !(test instanceof Array); } catch(e){ buggy = true; } return function setPrototypeOf(O, proto){ check(O, proto); if(buggy)O.__proto__ = proto; else set(O, proto); return O; }; }({}, false) : undefined), check: check }; /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3) , dP = __webpack_require__(6) , DESCRIPTORS = __webpack_require__(7) , SPECIES = __webpack_require__(1)('species'); module.exports = function(KEY){ var C = global[KEY]; if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, { configurable: true, get: function(){ return this; } }); }; /***/ }), /* 95 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-string-pad-start-end var toLength = __webpack_require__(10) , repeat = __webpack_require__(96) , defined = __webpack_require__(13); module.exports = function(that, maxLength, fillString, left){ var S = String(defined(that)) , stringLength = S.length , fillStr = fillString === undefined ? ' ' : String(fillString) , intMaxLength = toLength(maxLength); if(intMaxLength <= stringLength || fillStr == '')return S; var fillLen = intMaxLength - stringLength , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen); return left ? stringFiller + S : S + stringFiller; }; /***/ }), /* 96 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toInteger = __webpack_require__(42) , defined = __webpack_require__(13); module.exports = function repeat(count){ var str = String(defined(this)) , res = '' , n = toInteger(count); if(n < 0 || n == Infinity)throw RangeError("Count can't be negative"); for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str; return res; }; /***/ }), /* 97 */ /***/ (function(module, exports, __webpack_require__) { exports.f = __webpack_require__(1); /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(78) , ITERATOR = __webpack_require__(1)('iterator') , Iterators = __webpack_require__(27); module.exports = __webpack_require__(26).getIteratorMethod = function(it){ if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _element = __webpack_require__(2); var _base = __webpack_require__(11); var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; } /** * A overlay that renders ALL available rows & columns positioned on top of the original Walkontable instance and all other overlays. * Used for debugging purposes to see if the other overlays (that render only part of the rows & columns) are positioned correctly * * @class DebugOverlay */ var DebugOverlay = function (_Overlay) { _inherits(DebugOverlay, _Overlay); /** * @param {Walkontable} wotInstance */ function DebugOverlay(wotInstance) { _classCallCheck(this, DebugOverlay); var _this = _possibleConstructorReturn(this, (DebugOverlay.__proto__ || Object.getPrototypeOf(DebugOverlay)).call(this, wotInstance)); _this.clone = _this.makeClone(_base2.default.CLONE_DEBUG); _this.clone.wtTable.holder.style.opacity = 0.4; _this.clone.wtTable.holder.style.textShadow = '0 0 2px #ff0000'; (0, _element.addClass)(_this.clone.wtTable.holder.parentNode, 'wtDebugVisible'); return _this; } return DebugOverlay; }(_base2.default); _base2.default.registerOverlay(_base2.default.CLONE_DEBUG, DebugOverlay); exports.default = DebugOverlay; /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _base = __webpack_require__(11); var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; } /** * @class LeftOverlay */ var LeftOverlay = function (_Overlay) { _inherits(LeftOverlay, _Overlay); /** * @param {Walkontable} wotInstance */ function LeftOverlay(wotInstance) { _classCallCheck(this, LeftOverlay); var _this = _possibleConstructorReturn(this, (LeftOverlay.__proto__ || Object.getPrototypeOf(LeftOverlay)).call(this, wotInstance)); _this.clone = _this.makeClone(_base2.default.CLONE_LEFT); return _this; } /** * Checks if overlay should be fully rendered * * @returns {Boolean} */ _createClass(LeftOverlay, [{ key: 'shouldBeRendered', value: function shouldBeRendered() { return !!(this.wot.getSetting('fixedColumnsLeft') || this.wot.getSetting('rowHeaders').length); } /** * Updates the left overlay position */ }, { key: 'resetFixedPosition', value: function resetFixedPosition() { if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) { // removed from DOM return; } var overlayRoot = this.clone.wtTable.holder.parentNode; var headerPosition = 0; var preventOverflow = this.wot.getSetting('preventOverflow'); if (this.trimmingContainer === window && (!preventOverflow || preventOverflow !== 'horizontal')) { var box = this.wot.wtTable.hider.getBoundingClientRect(); var left = Math.ceil(box.left); var right = Math.ceil(box.right); var finalLeft = void 0; var finalTop = void 0; finalTop = this.wot.wtTable.hider.style.top; finalTop = finalTop === '' ? 0 : finalTop; if (left < 0 && right - overlayRoot.offsetWidth > 0) { finalLeft = -left; } else { finalLeft = 0; } headerPosition = finalLeft; finalLeft += 'px'; (0, _element.setOverlayPosition)(overlayRoot, finalLeft, finalTop); } else { headerPosition = this.getScrollPosition(); (0, _element.resetCssTransform)(overlayRoot); } this.adjustHeaderBordersPosition(headerPosition); this.adjustElementsSize(); } /** * Sets the main overlay's horizontal scroll position * * @param {Number} pos */ }, { key: 'setScrollPosition', value: function setScrollPosition(pos) { if (this.mainTableScrollableElement === window) { window.scrollTo(pos, (0, _element.getWindowScrollTop)()); } else { this.mainTableScrollableElement.scrollLeft = pos; } } /** * Triggers onScroll hook callback */ }, { key: 'onScroll', value: function onScroll() { this.wot.getSetting('onScrollVertically'); } /** * Calculates total sum cells width * * @param {Number} from Column index which calculates started from * @param {Number} to Column index where calculation is finished * @returns {Number} Width sum */ }, { key: 'sumCellSizes', value: function sumCellSizes(from, to) { var sum = 0; var defaultColumnWidth = this.wot.wtSettings.defaultColumnWidth; while (from < to) { sum += this.wot.wtTable.getStretchedColumnWidth(from) || defaultColumnWidth; from++; } return sum; } /** * Adjust overlay root element, childs and master table element sizes (width, height). * * @param {Boolean} [force=false] */ }, { key: 'adjustElementsSize', value: function adjustElementsSize() { var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; this.updateTrimmingContainer(); if (this.needFullRender || force) { this.adjustRootElementSize(); this.adjustRootChildrenSize(); if (!force) { this.areElementSizesAdjusted = true; } } } /** * Adjust overlay root element size (width and height). */ }, { key: 'adjustRootElementSize', value: function adjustRootElementSize() { var masterHolder = this.wot.wtTable.holder; var scrollbarHeight = masterHolder.clientHeight === masterHolder.offsetHeight ? 0 : (0, _element.getScrollbarWidth)(); var overlayRoot = this.clone.wtTable.holder.parentNode; var overlayRootStyle = overlayRoot.style; var preventOverflow = this.wot.getSetting('preventOverflow'); var tableWidth = void 0; if (this.trimmingContainer !== window || preventOverflow === 'vertical') { var height = this.wot.wtViewport.getWorkspaceHeight() - scrollbarHeight; height = Math.min(height, (0, _element.innerHeight)(this.wot.wtTable.wtRootElement)); overlayRootStyle.height = height + 'px'; } else { overlayRootStyle.height = ''; } this.clone.wtTable.holder.style.height = overlayRootStyle.height; tableWidth = (0, _element.outerWidth)(this.clone.wtTable.TABLE); overlayRootStyle.width = (tableWidth === 0 ? tableWidth : tableWidth + 4) + 'px'; } /** * Adjust overlay root childs size */ }, { key: 'adjustRootChildrenSize', value: function adjustRootChildrenSize() { var scrollbarWidth = (0, _element.getScrollbarWidth)(); this.clone.wtTable.hider.style.height = this.hider.style.height; this.clone.wtTable.holder.style.height = this.clone.wtTable.holder.parentNode.style.height; if (scrollbarWidth === 0) { scrollbarWidth = 30; } this.clone.wtTable.holder.style.width = parseInt(this.clone.wtTable.holder.parentNode.style.width, 10) + scrollbarWidth + 'px'; } /** * Adjust the overlay dimensions and position */ }, { key: 'applyToDOM', value: function applyToDOM() { var total = this.wot.getSetting('totalColumns'); if (!this.areElementSizesAdjusted) { this.adjustElementsSize(); } if (typeof this.wot.wtViewport.columnsRenderCalculator.startPosition === 'number') { this.spreader.style.left = this.wot.wtViewport.columnsRenderCalculator.startPosition + 'px'; } else if (total === 0) { this.spreader.style.left = '0'; } else { throw new Error('Incorrect value of the columnsRenderCalculator'); } this.spreader.style.right = ''; if (this.needFullRender) { this.syncOverlayOffset(); } } /** * Synchronize calculated top position to an element */ }, { key: 'syncOverlayOffset', value: function syncOverlayOffset() { if (typeof this.wot.wtViewport.rowsRenderCalculator.startPosition === 'number') { this.clone.wtTable.spreader.style.top = this.wot.wtViewport.rowsRenderCalculator.startPosition + 'px'; } else { this.clone.wtTable.spreader.style.top = ''; } } /** * Scrolls horizontally to a column at the left edge of the viewport * * @param sourceCol {Number} Column index which you want to scroll to * @param [beyondRendered=false] {Boolean} if `true`, scrolls according to the bottom edge (top edge is by default) */ }, { key: 'scrollTo', value: function scrollTo(sourceCol, beyondRendered) { var newX = this.getTableParentOffset(); var sourceInstance = this.wot.cloneSource ? this.wot.cloneSource : this.wot; var mainHolder = sourceInstance.wtTable.holder; var scrollbarCompensation = 0; if (beyondRendered && mainHolder.offsetWidth !== mainHolder.clientWidth) { scrollbarCompensation = (0, _element.getScrollbarWidth)(); } if (beyondRendered) { newX += this.sumCellSizes(0, sourceCol + 1); newX -= this.wot.wtViewport.getViewportWidth(); } else { newX += this.sumCellSizes(this.wot.getSetting('fixedColumnsLeft'), sourceCol); } newX += scrollbarCompensation; this.setScrollPosition(newX); } /** * Gets table parent left position * * @returns {Number} */ }, { key: 'getTableParentOffset', value: function getTableParentOffset() { var preventOverflow = this.wot.getSetting('preventOverflow'); var offset = 0; if (!preventOverflow && this.trimmingContainer === window) { offset = this.wot.wtTable.holderOffset.left; } return offset; } /** * Gets the main overlay's horizontal scroll position * * @returns {Number} Main table's vertical scroll position */ }, { key: 'getScrollPosition', value: function getScrollPosition() { return (0, _element.getScrollLeft)(this.mainTableScrollableElement); } /** * Adds css classes to hide the header border's header (cell-selection border hiding issue) * * @param {Number} position Header X position if trimming container is window or scroll top if not */ }, { key: 'adjustHeaderBordersPosition', value: function adjustHeaderBordersPosition(position) { var masterParent = this.wot.wtTable.holder.parentNode; var rowHeaders = this.wot.getSetting('rowHeaders'); var fixedColumnsLeft = this.wot.getSetting('fixedColumnsLeft'); var totalRows = this.wot.getSetting('totalRows'); if (totalRows) { (0, _element.removeClass)(masterParent, 'emptyRows'); } else { (0, _element.addClass)(masterParent, 'emptyRows'); } if (fixedColumnsLeft && !rowHeaders.length) { (0, _element.addClass)(masterParent, 'innerBorderLeft'); } else if (!fixedColumnsLeft && rowHeaders.length) { var previousState = (0, _element.hasClass)(masterParent, 'innerBorderLeft'); if (position) { (0, _element.addClass)(masterParent, 'innerBorderLeft'); } else { (0, _element.removeClass)(masterParent, 'innerBorderLeft'); } if (!previousState && position || previousState && !position) { this.wot.wtOverlays.adjustElementsSize(); } } } }]); return LeftOverlay; }(_base2.default); _base2.default.registerOverlay(_base2.default.CLONE_LEFT, LeftOverlay); exports.default = LeftOverlay; /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _base = __webpack_require__(11); var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; } /** * @class TopOverlay */ var TopOverlay = function (_Overlay) { _inherits(TopOverlay, _Overlay); /** * @param {Walkontable} wotInstance */ function TopOverlay(wotInstance) { _classCallCheck(this, TopOverlay); var _this = _possibleConstructorReturn(this, (TopOverlay.__proto__ || Object.getPrototypeOf(TopOverlay)).call(this, wotInstance)); _this.clone = _this.makeClone(_base2.default.CLONE_TOP); return _this; } /** * Checks if overlay should be fully rendered * * @returns {Boolean} */ _createClass(TopOverlay, [{ key: 'shouldBeRendered', value: function shouldBeRendered() { return !!(this.wot.getSetting('fixedRowsTop') || this.wot.getSetting('columnHeaders').length); } /** * Updates the top overlay position */ }, { key: 'resetFixedPosition', value: function resetFixedPosition() { if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) { // removed from DOM return; } var overlayRoot = this.clone.wtTable.holder.parentNode; var headerPosition = 0; var preventOverflow = this.wot.getSetting('preventOverflow'); if (this.trimmingContainer === window && (!preventOverflow || preventOverflow !== 'vertical')) { var box = this.wot.wtTable.hider.getBoundingClientRect(); var top = Math.ceil(box.top); var bottom = Math.ceil(box.bottom); var finalLeft = void 0; var finalTop = void 0; finalLeft = this.wot.wtTable.hider.style.left; finalLeft = finalLeft === '' ? 0 : finalLeft; if (top < 0 && bottom - overlayRoot.offsetHeight > 0) { finalTop = -top; } else { finalTop = 0; } headerPosition = finalTop; finalTop += 'px'; (0, _element.setOverlayPosition)(overlayRoot, finalLeft, finalTop); } else { headerPosition = this.getScrollPosition(); (0, _element.resetCssTransform)(overlayRoot); } this.adjustHeaderBordersPosition(headerPosition); this.adjustElementsSize(); } /** * Sets the main overlay's vertical scroll position * * @param {Number} pos */ }, { key: 'setScrollPosition', value: function setScrollPosition(pos) { if (this.mainTableScrollableElement === window) { window.scrollTo((0, _element.getWindowScrollLeft)(), pos); } else { this.mainTableScrollableElement.scrollTop = pos; } } /** * Triggers onScroll hook callback */ }, { key: 'onScroll', value: function onScroll() { this.wot.getSetting('onScrollHorizontally'); } /** * Calculates total sum cells height * * @param {Number} from Row index which calculates started from * @param {Number} to Row index where calculation is finished * @returns {Number} Height sum */ }, { key: 'sumCellSizes', value: function sumCellSizes(from, to) { var sum = 0; var defaultRowHeight = this.wot.wtSettings.settings.defaultRowHeight; while (from < to) { var height = this.wot.wtTable.getRowHeight(from); sum += height === void 0 ? defaultRowHeight : height; from++; } return sum; } /** * Adjust overlay root element, childs and master table element sizes (width, height). * * @param {Boolean} [force=false] */ }, { key: 'adjustElementsSize', value: function adjustElementsSize() { var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; this.updateTrimmingContainer(); if (this.needFullRender || force) { this.adjustRootElementSize(); this.adjustRootChildrenSize(); if (!force) { this.areElementSizesAdjusted = true; } } } /** * Adjust overlay root element size (width and height). */ }, { key: 'adjustRootElementSize', value: function adjustRootElementSize() { var masterHolder = this.wot.wtTable.holder; var scrollbarWidth = masterHolder.clientWidth === masterHolder.offsetWidth ? 0 : (0, _element.getScrollbarWidth)(); var overlayRoot = this.clone.wtTable.holder.parentNode; var overlayRootStyle = overlayRoot.style; var preventOverflow = this.wot.getSetting('preventOverflow'); var tableHeight = void 0; if (this.trimmingContainer !== window || preventOverflow === 'horizontal') { var width = this.wot.wtViewport.getWorkspaceWidth() - scrollbarWidth; width = Math.min(width, (0, _element.innerWidth)(this.wot.wtTable.wtRootElement)); overlayRootStyle.width = width + 'px'; } else { overlayRootStyle.width = ''; } this.clone.wtTable.holder.style.width = overlayRootStyle.width; tableHeight = (0, _element.outerHeight)(this.clone.wtTable.TABLE); overlayRootStyle.height = (tableHeight === 0 ? tableHeight : tableHeight + 4) + 'px'; } /** * Adjust overlay root childs size */ }, { key: 'adjustRootChildrenSize', value: function adjustRootChildrenSize() { var scrollbarWidth = (0, _element.getScrollbarWidth)(); this.clone.wtTable.hider.style.width = this.hider.style.width; this.clone.wtTable.holder.style.width = this.clone.wtTable.holder.parentNode.style.width; if (scrollbarWidth === 0) { scrollbarWidth = 30; } this.clone.wtTable.holder.style.height = parseInt(this.clone.wtTable.holder.parentNode.style.height, 10) + scrollbarWidth + 'px'; } /** * Adjust the overlay dimensions and position */ }, { key: 'applyToDOM', value: function applyToDOM() { var total = this.wot.getSetting('totalRows'); if (!this.areElementSizesAdjusted) { this.adjustElementsSize(); } if (typeof this.wot.wtViewport.rowsRenderCalculator.startPosition === 'number') { this.spreader.style.top = this.wot.wtViewport.rowsRenderCalculator.startPosition + 'px'; } else if (total === 0) { // can happen if there are 0 rows this.spreader.style.top = '0'; } else { throw new Error('Incorrect value of the rowsRenderCalculator'); } this.spreader.style.bottom = ''; if (this.needFullRender) { this.syncOverlayOffset(); } } /** * Synchronize calculated left position to an element */ }, { key: 'syncOverlayOffset', value: function syncOverlayOffset() { if (typeof this.wot.wtViewport.columnsRenderCalculator.startPosition === 'number') { this.clone.wtTable.spreader.style.left = this.wot.wtViewport.columnsRenderCalculator.startPosition + 'px'; } else { this.clone.wtTable.spreader.style.left = ''; } } /** * Scrolls vertically to a row * * @param sourceRow {Number} Row index which you want to scroll to * @param [bottomEdge=false] {Boolean} if `true`, scrolls according to the bottom edge (top edge is by default) */ }, { key: 'scrollTo', value: function scrollTo(sourceRow, bottomEdge) { var newY = this.getTableParentOffset(); var sourceInstance = this.wot.cloneSource ? this.wot.cloneSource : this.wot; var mainHolder = sourceInstance.wtTable.holder; var scrollbarCompensation = 0; if (bottomEdge && mainHolder.offsetHeight !== mainHolder.clientHeight) { scrollbarCompensation = (0, _element.getScrollbarWidth)(); } if (bottomEdge) { var fixedRowsBottom = this.wot.getSetting('fixedRowsBottom'); var fixedRowsTop = this.wot.getSetting('fixedRowsTop'); var totalRows = this.wot.getSetting('totalRows'); newY += this.sumCellSizes(0, sourceRow + 1); newY -= this.wot.wtViewport.getViewportHeight() - this.sumCellSizes(totalRows - fixedRowsBottom, totalRows); // Fix 1 pixel offset when cell is selected newY += 1; } else { newY += this.sumCellSizes(this.wot.getSetting('fixedRowsTop'), sourceRow); } newY += scrollbarCompensation; this.setScrollPosition(newY); } /** * Gets table parent top position * * @returns {Number} */ }, { key: 'getTableParentOffset', value: function getTableParentOffset() { if (this.mainTableScrollableElement === window) { return this.wot.wtTable.holderOffset.top; } return 0; } /** * Gets the main overlay's vertical scroll position * * @returns {Number} Main table's vertical scroll position */ }, { key: 'getScrollPosition', value: function getScrollPosition() { return (0, _element.getScrollTop)(this.mainTableScrollableElement); } /** * Redraw borders of selection * * @param {WalkontableSelection} selection Selection for redraw */ }, { key: 'redrawSelectionBorders', value: function redrawSelectionBorders(selection) { if (selection && selection.cellRange) { var border = selection.getBorder(this.wot); if (border) { var corners = selection.getCorners(); border.disappear(); border.appear(corners); } } } /** * Redrawing borders of all selections */ }, { key: 'redrawAllSelectionsBorders', value: function redrawAllSelectionsBorders() { var selections = this.wot.selections; this.redrawSelectionBorders(selections.current); this.redrawSelectionBorders(selections.area); this.redrawSelectionBorders(selections.fill); this.wot.wtTable.wot.wtOverlays.leftOverlay.refresh(); } /** * Adds css classes to hide the header border's header (cell-selection border hiding issue) * * @param {Number} position Header Y position if trimming container is window or scroll top if not */ }, { key: 'adjustHeaderBordersPosition', value: function adjustHeaderBordersPosition(position) { var masterParent = this.wot.wtTable.holder.parentNode; var totalColumns = this.wot.getSetting('totalColumns'); if (totalColumns) { (0, _element.removeClass)(masterParent, 'emptyColumns'); } else { (0, _element.addClass)(masterParent, 'emptyColumns'); } if (this.wot.getSetting('fixedRowsTop') === 0 && this.wot.getSetting('columnHeaders').length > 0) { var previousState = (0, _element.hasClass)(masterParent, 'innerBorderTop'); if (position || this.wot.getSetting('totalRows') === 0) { (0, _element.addClass)(masterParent, 'innerBorderTop'); } else { (0, _element.removeClass)(masterParent, 'innerBorderTop'); } if (!previousState && position || previousState && !position) { this.wot.wtOverlays.adjustElementsSize(); // cell borders should be positioned once again, // because we added / removed 1px border from table header this.redrawAllSelectionsBorders(); } } // nasty workaround for double border in the header, TODO: find a pure-css solution if (this.wot.getSetting('rowHeaders').length === 0) { var secondHeaderCell = this.clone.wtTable.THEAD.querySelectorAll('th:nth-of-type(2)'); if (secondHeaderCell) { for (var i = 0; i < secondHeaderCell.length; i++) { secondHeaderCell[i].style['border-left-width'] = 0; } } } } }]); return TopOverlay; }(_base2.default); _base2.default.registerOverlay(_base2.default.CLONE_TOP, TopOverlay); exports.default = TopOverlay; /***/ }), /* 102 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _element = __webpack_require__(2); var _base = __webpack_require__(11); var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; } /** * @class TopLeftCornerOverlay */ var TopLeftCornerOverlay = function (_Overlay) { _inherits(TopLeftCornerOverlay, _Overlay); /** * @param {Walkontable} wotInstance */ function TopLeftCornerOverlay(wotInstance) { _classCallCheck(this, TopLeftCornerOverlay); var _this = _possibleConstructorReturn(this, (TopLeftCornerOverlay.__proto__ || Object.getPrototypeOf(TopLeftCornerOverlay)).call(this, wotInstance)); _this.clone = _this.makeClone(_base2.default.CLONE_TOP_LEFT_CORNER); return _this; } /** * Checks if overlay should be fully rendered * * @returns {Boolean} */ _createClass(TopLeftCornerOverlay, [{ key: 'shouldBeRendered', value: function shouldBeRendered() { return !!((this.wot.getSetting('fixedRowsTop') || this.wot.getSetting('columnHeaders').length) && (this.wot.getSetting('fixedColumnsLeft') || this.wot.getSetting('rowHeaders').length)); } /** * Updates the corner overlay position */ }, { key: 'resetFixedPosition', value: function resetFixedPosition() { this.updateTrimmingContainer(); if (!this.wot.wtTable.holder.parentNode) { // removed from DOM return; } var overlayRoot = this.clone.wtTable.holder.parentNode; var tableHeight = (0, _element.outerHeight)(this.clone.wtTable.TABLE); var tableWidth = (0, _element.outerWidth)(this.clone.wtTable.TABLE); var preventOverflow = this.wot.getSetting('preventOverflow'); if (this.trimmingContainer === window) { var box = this.wot.wtTable.hider.getBoundingClientRect(); var top = Math.ceil(box.top); var left = Math.ceil(box.left); var bottom = Math.ceil(box.bottom); var right = Math.ceil(box.right); var finalLeft = '0'; var finalTop = '0'; if (!preventOverflow || preventOverflow === 'vertical') { if (left < 0 && right - overlayRoot.offsetWidth > 0) { finalLeft = -left + 'px'; } } if (!preventOverflow || preventOverflow === 'horizontal') { if (top < 0 && bottom - overlayRoot.offsetHeight > 0) { finalTop = -top + 'px'; } } (0, _element.setOverlayPosition)(overlayRoot, finalLeft, finalTop); } else { (0, _element.resetCssTransform)(overlayRoot); } overlayRoot.style.height = (tableHeight === 0 ? tableHeight : tableHeight + 4) + 'px'; overlayRoot.style.width = (tableWidth === 0 ? tableWidth : tableWidth + 4) + 'px'; } }]); return TopLeftCornerOverlay; }(_base2.default); _base2.default.registerOverlay(_base2.default.CLONE_TOP_LEFT_CORNER, TopLeftCornerOverlay); exports.default = TopLeftCornerOverlay; /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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 _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 _element = __webpack_require__(2); var _border2 = __webpack_require__(59); var _border3 = _interopRequireDefault(_border2); var _coords = __webpack_require__(22); var _coords2 = _interopRequireDefault(_coords); var _range = __webpack_require__(43); var _range2 = _interopRequireDefault(_range); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @class Selection */ var Selection = function () { /** * @param {Object} settings * @param {CellRange} cellRange */ function Selection(settings, cellRange) { _classCallCheck(this, Selection); this.settings = settings; this.cellRange = cellRange || null; this.instanceBorders = {}; } /** * Each Walkontable clone requires it's own border for every selection. This method creates and returns selection * borders per instance * * @param {Walkontable} wotInstance * @returns {Border} */ _createClass(Selection, [{ key: 'getBorder', value: function getBorder(wotInstance) { if (this.instanceBorders[wotInstance.guid]) { return this.instanceBorders[wotInstance.guid]; } // where is this returned? this.instanceBorders[wotInstance.guid] = new _border3.default(wotInstance, this.settings); } /** * Checks if selection is empty * * @returns {Boolean} */ }, { key: 'isEmpty', value: function isEmpty() { return this.cellRange === null; } /** * Adds a cell coords to the selection * * @param {CellCoords} coords */ }, { key: 'add', value: function add(coords) { if (this.isEmpty()) { this.cellRange = new _range2.default(coords, coords, coords); } else { this.cellRange.expand(coords); } } /** * If selection range from or to property equals oldCoords, replace it with newCoords. Return boolean * information about success * * @param {CellCoords} oldCoords * @param {CellCoords} newCoords * @returns {Boolean} */ }, { key: 'replace', value: function replace(oldCoords, newCoords) { if (!this.isEmpty()) { if (this.cellRange.from.isEqual(oldCoords)) { this.cellRange.from = newCoords; return true; } if (this.cellRange.to.isEqual(oldCoords)) { this.cellRange.to = newCoords; return true; } } return false; } /** * Clears selection */ }, { key: 'clear', value: function clear() { this.cellRange = null; } /** * Returns the top left (TL) and bottom right (BR) selection coordinates * * @returns {Array} Returns array of coordinates for example `[1, 1, 5, 5]` */ }, { key: 'getCorners', value: function getCorners() { var topLeft = this.cellRange.getTopLeftCorner(); var bottomRight = this.cellRange.getBottomRightCorner(); return [topLeft.row, topLeft.col, bottomRight.row, bottomRight.col]; } /** * Adds class name to cell element at given coords * * @param {Walkontable} wotInstance Walkontable instance * @param {Number} sourceRow Cell row coord * @param {Number} sourceColumn Cell column coord * @param {String} className Class name */ }, { key: 'addClassAtCoords', value: function addClassAtCoords(wotInstance, sourceRow, sourceColumn, className) { var TD = wotInstance.wtTable.getCell(new _coords2.default(sourceRow, sourceColumn)); if ((typeof TD === 'undefined' ? 'undefined' : _typeof(TD)) === 'object') { (0, _element.addClass)(TD, className); } } /** * @param wotInstance */ }, { key: 'draw', value: function draw(wotInstance) { if (this.isEmpty()) { if (this.settings.border) { var border = this.getBorder(wotInstance); if (border) { border.disappear(); } } return; } var renderedRows = wotInstance.wtTable.getRenderedRowsCount(); var renderedColumns = wotInstance.wtTable.getRenderedColumnsCount(); var corners = this.getCorners(); var sourceRow = void 0, sourceCol = void 0, TH = void 0; for (var column = 0; column < renderedColumns; column++) { sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column); if (sourceCol >= corners[1] && sourceCol <= corners[3]) { TH = wotInstance.wtTable.getColumnHeader(sourceCol); if (TH) { var newClasses = []; if (this.settings.highlightHeaderClassName) { newClasses.push(this.settings.highlightHeaderClassName); } if (this.settings.highlightColumnClassName) { newClasses.push(this.settings.highlightColumnClassName); } (0, _element.addClass)(TH, newClasses); } } } for (var row = 0; row < renderedRows; row++) { sourceRow = wotInstance.wtTable.rowFilter.renderedToSource(row); if (sourceRow >= corners[0] && sourceRow <= corners[2]) { TH = wotInstance.wtTable.getRowHeader(sourceRow); if (TH) { var _newClasses = []; if (this.settings.highlightHeaderClassName) { _newClasses.push(this.settings.highlightHeaderClassName); } if (this.settings.highlightRowClassName) { _newClasses.push(this.settings.highlightRowClassName); } (0, _element.addClass)(TH, _newClasses); } } for (var _column = 0; _column < renderedColumns; _column++) { sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(_column); if (sourceRow >= corners[0] && sourceRow <= corners[2] && sourceCol >= corners[1] && sourceCol <= corners[3]) { // selected cell if (this.settings.className) { this.addClassAtCoords(wotInstance, sourceRow, sourceCol, this.settings.className); } } else if (sourceRow >= corners[0] && sourceRow <= corners[2]) { // selection is in this row if (this.settings.highlightRowClassName) { this.addClassAtCoords(wotInstance, sourceRow, sourceCol, this.settings.highlightRowClassName); } } else if (sourceCol >= corners[1] && sourceCol <= corners[3]) { // selection is in this column if (this.settings.highlightColumnClassName) { this.addClassAtCoords(wotInstance, sourceRow, sourceCol, this.settings.highlightColumnClassName); } } } } wotInstance.getSetting('onBeforeDrawBorders', corners, this.settings.className); if (this.settings.border) { var _border = this.getBorder(wotInstance); if (_border) { // warning! border.appear modifies corners! _border.appear(corners); } } } }]); return Selection; }(); exports.default = Selection; /***/ }), /* 104 */ /***/ (function(module, exports, __webpack_require__) { // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) var $export = __webpack_require__(0); $export($export.P, 'Array', {copyWithin: __webpack_require__(151)}); __webpack_require__(17)('copyWithin'); /***/ }), /* 105 */ /***/ (function(module, exports, __webpack_require__) { // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) var $export = __webpack_require__(0); $export($export.P, 'Array', {fill: __webpack_require__(152)}); __webpack_require__(17)('fill'); /***/ }), /* 106 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) var $export = __webpack_require__(0) , $find = __webpack_require__(34)(6) , KEY = 'findIndex' , forced = true; // Shouldn't skip holes if(KEY in [])Array(1)[KEY](function(){ forced = false; }); $export($export.P + $export.F * forced, 'Array', { findIndex: function findIndex(callbackfn/*, that = undefined */){ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(17)(KEY); /***/ }), /* 107 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) var $export = __webpack_require__(0) , $find = __webpack_require__(34)(5) , KEY = 'find' , forced = true; // Shouldn't skip holes if(KEY in [])Array(1)[KEY](function(){ forced = false; }); $export($export.P + $export.F * forced, 'Array', { find: function find(callbackfn/*, that = undefined */){ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(17)(KEY); /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ctx = __webpack_require__(12) , $export = __webpack_require__(0) , toObject = __webpack_require__(21) , call = __webpack_require__(87) , isArrayIter = __webpack_require__(83) , toLength = __webpack_require__(10) , createProperty = __webpack_require__(45) , getIterFn = __webpack_require__(98); $export($export.S + $export.F * !__webpack_require__(50)(function(iter){ Array.from(iter); }), 'Array', { // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ var O = toObject(arrayLike) , C = typeof this == 'function' ? this : Array , aLen = arguments.length , mapfn = aLen > 1 ? arguments[1] : undefined , mapping = mapfn !== undefined , index = 0 , iterFn = getIterFn(O) , length, result, step, iterator; if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); // if object isn't iterable or it's array with default iterator - use simple case if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); } } else { length = toLength(O.length); for(result = new C(length); length > index; index++){ createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); } } result.length = index; return result; } }); /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0) , createProperty = __webpack_require__(45); // WebKit Array.of isn't generic $export($export.S + $export.F * __webpack_require__(14)(function(){ function F(){} return !(Array.of.call(F) instanceof F); }), 'Array', { // 22.1.2.3 Array.of( ...items) of: function of(/* ...args */){ var index = 0 , aLen = arguments.length , result = new (typeof this == 'function' ? this : Array)(aLen); while(aLen > index)createProperty(result, index, arguments[index++]); result.length = aLen; return result; } }); /***/ }), /* 110 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(6).f , createDesc = __webpack_require__(20) , has = __webpack_require__(8) , FProto = Function.prototype , nameRE = /^\s*function ([^ (]*)/ , NAME = 'name'; var isExtensible = Object.isExtensible || function(){ return true; }; // 19.2.4.2 name NAME in FProto || __webpack_require__(7) && dP(FProto, NAME, { configurable: true, get: function(){ try { var that = this , name = ('' + that).match(nameRE)[1]; has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name)); return name; } catch(e){ return ''; } } }); /***/ }), /* 111 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var strong = __webpack_require__(79); // 23.1 Map Objects module.exports = __webpack_require__(35)('Map', function(get){ return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.1.3.6 Map.prototype.get(key) get: function get(key){ var entry = strong.getEntry(this, key); return entry && entry.v; }, // 23.1.3.9 Map.prototype.set(key, value) set: function set(key, value){ return strong.def(this, key === 0 ? 0 : key, value); } }, strong, true); /***/ }), /* 112 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.1 Number.EPSILON var $export = __webpack_require__(0); $export($export.S, 'Number', {EPSILON: Math.pow(2, -52)}); /***/ }), /* 113 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.2 Number.isFinite(number) var $export = __webpack_require__(0) , _isFinite = __webpack_require__(3).isFinite; $export($export.S, 'Number', { isFinite: function isFinite(it){ return typeof it == 'number' && _isFinite(it); } }); /***/ }), /* 114 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.3 Number.isInteger(number) var $export = __webpack_require__(0); $export($export.S, 'Number', {isInteger: __webpack_require__(85)}); /***/ }), /* 115 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.4 Number.isNaN(number) var $export = __webpack_require__(0); $export($export.S, 'Number', { isNaN: function isNaN(number){ return number != number; } }); /***/ }), /* 116 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.5 Number.isSafeInteger(number) var $export = __webpack_require__(0) , isInteger = __webpack_require__(85) , abs = Math.abs; $export($export.S, 'Number', { isSafeInteger: function isSafeInteger(number){ return isInteger(number) && abs(number) <= 0x1fffffffffffff; } }); /***/ }), /* 117 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.6 Number.MAX_SAFE_INTEGER var $export = __webpack_require__(0); $export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff}); /***/ }), /* 118 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.10 Number.MIN_SAFE_INTEGER var $export = __webpack_require__(0); $export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff}); /***/ }), /* 119 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.1 Object.assign(target, source) var $export = __webpack_require__(0); $export($export.S + $export.F, 'Object', {assign: __webpack_require__(90)}); /***/ }), /* 120 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.10 Object.is(value1, value2) var $export = __webpack_require__(0); $export($export.S, 'Object', {is: __webpack_require__(166)}); /***/ }), /* 121 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.19 Object.setPrototypeOf(O, proto) var $export = __webpack_require__(0); $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(93).set}); /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var LIBRARY = __webpack_require__(38) , global = __webpack_require__(3) , ctx = __webpack_require__(12) , classof = __webpack_require__(78) , $export = __webpack_require__(0) , isObject = __webpack_require__(4) , aFunction = __webpack_require__(44) , anInstance = __webpack_require__(33) , forOf = __webpack_require__(37) , speciesConstructor = __webpack_require__(167) , task = __webpack_require__(57).set , microtask = __webpack_require__(161)() , PROMISE = 'Promise' , TypeError = global.TypeError , process = global.process , $Promise = global[PROMISE] , process = global.process , isNode = classof(process) == 'process' , empty = function(){ /* empty */ } , Internal, GenericPromiseCapability, Wrapper; var USE_NATIVE = !!function(){ try { // correct subclassing with @@species support var promise = $Promise.resolve(1) , FakePromise = (promise.constructor = {})[__webpack_require__(1)('species')] = function(exec){ exec(empty, empty); }; // unhandled rejections tracking support, NodeJS Promise without it fails @@species test return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; } catch(e){ /* empty */ } }(); // helpers var sameConstructor = function(a, b){ // with library wrapper special case return a === b || a === $Promise && b === Wrapper; }; var isThenable = function(it){ var then; return isObject(it) && typeof (then = it.then) == 'function' ? then : false; }; var newPromiseCapability = function(C){ return sameConstructor($Promise, C) ? new PromiseCapability(C) : new GenericPromiseCapability(C); }; var PromiseCapability = GenericPromiseCapability = function(C){ var resolve, reject; this.promise = new C(function($$resolve, $$reject){ if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aFunction(resolve); this.reject = aFunction(reject); }; var perform = function(exec){ try { exec(); } catch(e){ return {error: e}; } }; var notify = function(promise, isReject){ if(promise._n)return; promise._n = true; var chain = promise._c; microtask(function(){ var value = promise._v , ok = promise._s == 1 , i = 0; var run = function(reaction){ var handler = ok ? reaction.ok : reaction.fail , resolve = reaction.resolve , reject = reaction.reject , domain = reaction.domain , result, then; try { if(handler){ if(!ok){ if(promise._h == 2)onHandleUnhandled(promise); promise._h = 1; } if(handler === true)result = value; else { if(domain)domain.enter(); result = handler(value); if(domain)domain.exit(); } if(result === reaction.promise){ reject(TypeError('Promise-chain cycle')); } else if(then = isThenable(result)){ then.call(result, resolve, reject); } else resolve(result); } else reject(value); } catch(e){ reject(e); } }; while(chain.length > i)run(chain[i++]); // variable length - can't use forEach promise._c = []; promise._n = false; if(isReject && !promise._h)onUnhandled(promise); }); }; var onUnhandled = function(promise){ task.call(global, function(){ var value = promise._v , abrupt, handler, console; if(isUnhandled(promise)){ abrupt = perform(function(){ if(isNode){ process.emit('unhandledRejection', value, promise); } else if(handler = global.onunhandledrejection){ handler({promise: promise, reason: value}); } else if((console = global.console) && console.error){ console.error('Unhandled promise rejection', value); } }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should promise._h = isNode || isUnhandled(promise) ? 2 : 1; } promise._a = undefined; if(abrupt)throw abrupt.error; }); }; var isUnhandled = function(promise){ if(promise._h == 1)return false; var chain = promise._a || promise._c , i = 0 , reaction; while(chain.length > i){ reaction = chain[i++]; if(reaction.fail || !isUnhandled(reaction.promise))return false; } return true; }; var onHandleUnhandled = function(promise){ task.call(global, function(){ var handler; if(isNode){ process.emit('rejectionHandled', promise); } else if(handler = global.onrejectionhandled){ handler({promise: promise, reason: promise._v}); } }); }; var $reject = function(value){ var promise = this; if(promise._d)return; promise._d = true; promise = promise._w || promise; // unwrap promise._v = value; promise._s = 2; if(!promise._a)promise._a = promise._c.slice(); notify(promise, true); }; var $resolve = function(value){ var promise = this , then; if(promise._d)return; promise._d = true; promise = promise._w || promise; // unwrap try { if(promise === value)throw TypeError("Promise can't be resolved itself"); if(then = isThenable(value)){ microtask(function(){ var wrapper = {_w: promise, _d: false}; // wrap try { then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); } catch(e){ $reject.call(wrapper, e); } }); } else { promise._v = value; promise._s = 1; notify(promise, false); } } catch(e){ $reject.call({_w: promise, _d: false}, e); // wrap } }; // constructor polyfill if(!USE_NATIVE){ // 25.4.3.1 Promise(executor) $Promise = function Promise(executor){ anInstance(this, $Promise, PROMISE, '_h'); aFunction(executor); Internal.call(this); try { executor(ctx($resolve, this, 1), ctx($reject, this, 1)); } catch(err){ $reject.call(this, err); } }; Internal = function Promise(executor){ this._c = []; // <- awaiting reactions this._a = undefined; // <- checked in isUnhandled reactions this._s = 0; // <- state this._d = false; // <- done this._v = undefined; // <- value this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled this._n = false; // <- notify }; Internal.prototype = __webpack_require__(40)($Promise.prototype, { // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) then: function then(onFulfilled, onRejected){ var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; reaction.fail = typeof onRejected == 'function' && onRejected; reaction.domain = isNode ? process.domain : undefined; this._c.push(reaction); if(this._a)this._a.push(reaction); if(this._s)notify(this, false); return reaction.promise; }, // 25.4.5.1 Promise.prototype.catch(onRejected) 'catch': function(onRejected){ return this.then(undefined, onRejected); } }); PromiseCapability = function(){ var promise = new Internal; this.promise = promise; this.resolve = ctx($resolve, promise, 1); this.reject = ctx($reject, promise, 1); }; } $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise}); __webpack_require__(30)($Promise, PROMISE); __webpack_require__(94)(PROMISE); Wrapper = __webpack_require__(26)[PROMISE]; // statics $export($export.S + $export.F * !USE_NATIVE, PROMISE, { // 25.4.4.5 Promise.reject(r) reject: function reject(r){ var capability = newPromiseCapability(this) , $$reject = capability.reject; $$reject(r); return capability.promise; } }); $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { // 25.4.4.6 Promise.resolve(x) resolve: function resolve(x){ // instanceof instead of internal slot check because we should fix it without replacement native Promise core if(x instanceof $Promise && sameConstructor(x.constructor, this))return x; var capability = newPromiseCapability(this) , $$resolve = capability.resolve; $$resolve(x); return capability.promise; } }); $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(50)(function(iter){ $Promise.all(iter)['catch'](empty); })), PROMISE, { // 25.4.4.1 Promise.all(iterable) all: function all(iterable){ var C = this , capability = newPromiseCapability(C) , resolve = capability.resolve , reject = capability.reject; var abrupt = perform(function(){ var values = [] , index = 0 , remaining = 1; forOf(iterable, false, function(promise){ var $index = index++ , alreadyCalled = false; values.push(undefined); remaining++; C.resolve(promise).then(function(value){ if(alreadyCalled)return; alreadyCalled = true; values[$index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if(abrupt)reject(abrupt.error); return capability.promise; }, // 25.4.4.4 Promise.race(iterable) race: function race(iterable){ var C = this , capability = newPromiseCapability(C) , reject = capability.reject; var abrupt = perform(function(){ forOf(iterable, false, function(promise){ C.resolve(promise).then(capability.resolve, reject); }); }); if(abrupt)reject(abrupt.error); return capability.promise; } }); /***/ }), /* 123 */ /***/ (function(module, exports, __webpack_require__) { // 21.2.5.3 get RegExp.prototype.flags() if(__webpack_require__(7) && /./g.flags != 'g')__webpack_require__(6).f(RegExp.prototype, 'flags', { configurable: true, get: __webpack_require__(156) }); /***/ }), /* 124 */ /***/ (function(module, exports, __webpack_require__) { // @@match logic __webpack_require__(36)('match', 1, function(defined, MATCH, $match){ // 21.1.3.11 String.prototype.match(regexp) return [function match(regexp){ 'use strict'; var O = defined(this) , fn = regexp == undefined ? undefined : regexp[MATCH]; return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); }, $match]; }); /***/ }), /* 125 */ /***/ (function(module, exports, __webpack_require__) { // @@replace logic __webpack_require__(36)('replace', 2, function(defined, REPLACE, $replace){ // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) return [function replace(searchValue, replaceValue){ 'use strict'; var O = defined(this) , fn = searchValue == undefined ? undefined : searchValue[REPLACE]; return fn !== undefined ? fn.call(searchValue, O, replaceValue) : $replace.call(String(O), searchValue, replaceValue); }, $replace]; }); /***/ }), /* 126 */ /***/ (function(module, exports, __webpack_require__) { // @@search logic __webpack_require__(36)('search', 1, function(defined, SEARCH, $search){ // 21.1.3.15 String.prototype.search(regexp) return [function search(regexp){ 'use strict'; var O = defined(this) , fn = regexp == undefined ? undefined : regexp[SEARCH]; return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); }, $search]; }); /***/ }), /* 127 */ /***/ (function(module, exports, __webpack_require__) { // @@split logic __webpack_require__(36)('split', 2, function(defined, SPLIT, $split){ 'use strict'; var isRegExp = __webpack_require__(86) , _split = $split , $push = [].push , $SPLIT = 'split' , LENGTH = 'length' , LAST_INDEX = 'lastIndex'; if( 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || '.'[$SPLIT](/()()/)[LENGTH] > 1 || ''[$SPLIT](/.?/)[LENGTH] ){ var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group // based on es5-shim implementation, need to rework it $split = function(separator, limit){ var string = String(this); if(separator === undefined && limit === 0)return []; // If `separator` is not a regex, use native split if(!isRegExp(separator))return _split.call(string, separator, limit); var output = []; var flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.unicode ? 'u' : '') + (separator.sticky ? 'y' : ''); var lastLastIndex = 0; var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; // Make `global` and avoid `lastIndex` issues by working with a copy var separatorCopy = new RegExp(separator.source, flags + 'g'); var separator2, match, lastIndex, lastLength, i; // Doesn't need flags gy, but they don't hurt if(!NPCG)separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); while(match = separatorCopy.exec(string)){ // `separatorCopy.lastIndex` is not reliable cross-browser lastIndex = match.index + match[0][LENGTH]; if(lastIndex > lastLastIndex){ output.push(string.slice(lastLastIndex, match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG if(!NPCG && match[LENGTH] > 1)match[0].replace(separator2, function(){ for(i = 1; i < arguments[LENGTH] - 2; i++)if(arguments[i] === undefined)match[i] = undefined; }); if(match[LENGTH] > 1 && match.index < string[LENGTH])$push.apply(output, match.slice(1)); lastLength = match[0][LENGTH]; lastLastIndex = lastIndex; if(output[LENGTH] >= splitLimit)break; } if(separatorCopy[LAST_INDEX] === match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop } if(lastLastIndex === string[LENGTH]){ if(lastLength || !separatorCopy.test(''))output.push(''); } else output.push(string.slice(lastLastIndex)); return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; }; // Chakra, V8 } else if('0'[$SPLIT](undefined, 0)[LENGTH]){ $split = function(separator, limit){ return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); }; } // 21.1.3.17 String.prototype.split(separator, limit) return [function split(separator, limit){ var O = defined(this) , fn = separator == undefined ? undefined : separator[SPLIT]; return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); }, $split]; }); /***/ }), /* 128 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var strong = __webpack_require__(79); // 23.2 Set Objects module.exports = __webpack_require__(35)('Set', function(get){ return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.2.3.1 Set.prototype.add(value) add: function add(value){ return strong.def(this, value = value === 0 ? 0 : value, value); } }, strong); /***/ }), /* 129 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0) , $at = __webpack_require__(168)(false); $export($export.P, 'String', { // 21.1.3.3 String.prototype.codePointAt(pos) codePointAt: function codePointAt(pos){ return $at(this, pos); } }); /***/ }), /* 130 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) var $export = __webpack_require__(0) , toLength = __webpack_require__(10) , context = __webpack_require__(56) , ENDS_WITH = 'endsWith' , $endsWith = ''[ENDS_WITH]; $export($export.P + $export.F * __webpack_require__(48)(ENDS_WITH), 'String', { endsWith: function endsWith(searchString /*, endPosition = @length */){ var that = context(this, searchString, ENDS_WITH) , endPosition = arguments.length > 1 ? arguments[1] : undefined , len = toLength(that.length) , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len) , search = String(searchString); return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search; } }); /***/ }), /* 131 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0) , toIndex = __webpack_require__(41) , fromCharCode = String.fromCharCode , $fromCodePoint = String.fromCodePoint; // length should be 1, old FF problem $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { // 21.1.2.2 String.fromCodePoint(...codePoints) fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars var res = [] , aLen = arguments.length , i = 0 , code; while(aLen > i){ code = +arguments[i++]; if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) ); } return res.join(''); } }); /***/ }), /* 132 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.1.3.7 String.prototype.includes(searchString, position = 0) var $export = __webpack_require__(0) , context = __webpack_require__(56) , INCLUDES = 'includes'; $export($export.P + $export.F * __webpack_require__(48)(INCLUDES), 'String', { includes: function includes(searchString /*, position = 0 */){ return !!~context(this, searchString, INCLUDES) .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), /* 133 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0) , toIObject = __webpack_require__(9) , toLength = __webpack_require__(10); $export($export.S, 'String', { // 21.1.2.4 String.raw(callSite, ...substitutions) raw: function raw(callSite){ var tpl = toIObject(callSite.raw) , len = toLength(tpl.length) , aLen = arguments.length , res = [] , i = 0; while(len > i){ res.push(String(tpl[i++])); if(i < aLen)res.push(String(arguments[i])); } return res.join(''); } }); /***/ }), /* 134 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); $export($export.P, 'String', { // 21.1.3.13 String.prototype.repeat(count) repeat: __webpack_require__(96) }); /***/ }), /* 135 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.1.3.18 String.prototype.startsWith(searchString [, position ]) var $export = __webpack_require__(0) , toLength = __webpack_require__(10) , context = __webpack_require__(56) , STARTS_WITH = 'startsWith' , $startsWith = ''[STARTS_WITH]; $export($export.P + $export.F * __webpack_require__(48)(STARTS_WITH), 'String', { startsWith: function startsWith(searchString /*, position = 0 */){ var that = context(this, searchString, STARTS_WITH) , index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)) , search = String(searchString); return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search; } }); /***/ }), /* 136 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // ECMAScript 6 symbols shim var global = __webpack_require__(3) , has = __webpack_require__(8) , DESCRIPTORS = __webpack_require__(7) , $export = __webpack_require__(0) , redefine = __webpack_require__(16) , META = __webpack_require__(28).KEY , $fails = __webpack_require__(14) , shared = __webpack_require__(55) , setToStringTag = __webpack_require__(30) , uid = __webpack_require__(31) , wks = __webpack_require__(1) , wksExt = __webpack_require__(97) , wksDefine = __webpack_require__(169) , keyOf = __webpack_require__(160) , enumKeys = __webpack_require__(155) , isArray = __webpack_require__(84) , anObject = __webpack_require__(5) , toIObject = __webpack_require__(9) , toPrimitive = __webpack_require__(58) , createDesc = __webpack_require__(20) , _create = __webpack_require__(51) , gOPNExt = __webpack_require__(163) , $GOPD = __webpack_require__(52) , $DP = __webpack_require__(6) , $keys = __webpack_require__(19) , gOPD = $GOPD.f , dP = $DP.f , gOPN = gOPNExt.f , $Symbol = global.Symbol , $JSON = global.JSON , _stringify = $JSON && $JSON.stringify , PROTOTYPE = 'prototype' , HIDDEN = wks('_hidden') , TO_PRIMITIVE = wks('toPrimitive') , isEnum = {}.propertyIsEnumerable , SymbolRegistry = shared('symbol-registry') , AllSymbols = shared('symbols') , OPSymbols = shared('op-symbols') , ObjectProto = Object[PROTOTYPE] , USE_NATIVE = typeof $Symbol == 'function' , QObject = global.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDesc = DESCRIPTORS && $fails(function(){ return _create(dP({}, 'a', { get: function(){ return dP(this, 'a', {value: 7}).a; } })).a != 7; }) ? function(it, key, D){ var protoDesc = gOPD(ObjectProto, key); if(protoDesc)delete ObjectProto[key]; dP(it, key, D); if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); } : dP; var wrap = function(tag){ var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); sym._k = tag; return sym; }; var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ return typeof it == 'symbol'; } : function(it){ return it instanceof $Symbol; }; var $defineProperty = function defineProperty(it, key, D){ if(it === ObjectProto)$defineProperty(OPSymbols, key, D); anObject(it); key = toPrimitive(key, true); anObject(D); if(has(AllSymbols, key)){ if(!D.enumerable){ if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); it[HIDDEN][key] = true; } else { if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; D = _create(D, {enumerable: createDesc(0, false)}); } return setSymbolDesc(it, key, D); } return dP(it, key, D); }; var $defineProperties = function defineProperties(it, P){ anObject(it); var keys = enumKeys(P = toIObject(P)) , i = 0 , l = keys.length , key; while(l > i)$defineProperty(it, key = keys[i++], P[key]); return it; }; var $create = function create(it, P){ return P === undefined ? _create(it) : $defineProperties(_create(it), P); }; var $propertyIsEnumerable = function propertyIsEnumerable(key){ var E = isEnum.call(this, key = toPrimitive(key, true)); if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ it = toIObject(it); key = toPrimitive(key, true); if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; var D = gOPD(it, key); if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; return D; }; var $getOwnPropertyNames = function getOwnPropertyNames(it){ var names = gOPN(toIObject(it)) , result = [] , i = 0 , key; while(names.length > i){ if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); } return result; }; var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ var IS_OP = it === ObjectProto , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) , result = [] , i = 0 , key; while(names.length > i){ if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); } return result; }; // 19.4.1.1 Symbol([description]) if(!USE_NATIVE){ $Symbol = function Symbol(){ if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); var tag = uid(arguments.length > 0 ? arguments[0] : undefined); var $set = function(value){ if(this === ObjectProto)$set.call(OPSymbols, value); if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; setSymbolDesc(this, tag, createDesc(1, value)); }; if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); return wrap(tag); }; redefine($Symbol[PROTOTYPE], 'toString', function toString(){ return this._k; }); $GOPD.f = $getOwnPropertyDescriptor; $DP.f = $defineProperty; __webpack_require__(53).f = gOPNExt.f = $getOwnPropertyNames; __webpack_require__(29).f = $propertyIsEnumerable; __webpack_require__(39).f = $getOwnPropertySymbols; if(DESCRIPTORS && !__webpack_require__(38)){ redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } wksExt.f = function(name){ return wrap(wks(name)); } } $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); for(var symbols = ( // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]); for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]); $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { // 19.4.2.1 Symbol.for(key) 'for': function(key){ return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key); }, // 19.4.2.5 Symbol.keyFor(sym) keyFor: function keyFor(key){ if(isSymbol(key))return keyOf(SymbolRegistry, key); throw TypeError(key + ' is not a symbol!'); }, useSetter: function(){ setter = true; }, useSimple: function(){ setter = false; } }); $export($export.S + $export.F * !USE_NATIVE, 'Object', { // 19.1.2.2 Object.create(O [, Properties]) create: $create, // 19.1.2.4 Object.defineProperty(O, P, Attributes) defineProperty: $defineProperty, // 19.1.2.3 Object.defineProperties(O, Properties) defineProperties: $defineProperties, // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) getOwnPropertyDescriptor: $getOwnPropertyDescriptor, // 19.1.2.7 Object.getOwnPropertyNames(O) getOwnPropertyNames: $getOwnPropertyNames, // 19.1.2.8 Object.getOwnPropertySymbols(O) getOwnPropertySymbols: $getOwnPropertySymbols }); // 24.3.2 JSON.stringify(value [, replacer [, space]]) $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){ var S = $Symbol(); // MS Edge converts symbol values to JSON as {} // WebKit converts symbol values to JSON as null // V8 throws on boxed symbols return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; })), 'JSON', { stringify: function stringify(it){ if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined var args = [it] , i = 1 , replacer, $replacer; while(arguments.length > i)args.push(arguments[i++]); replacer = args[1]; if(typeof replacer == 'function')$replacer = replacer; if($replacer || !isArray(replacer))replacer = function(key, value){ if($replacer)value = $replacer.call(this, key, value); if(!isSymbol(value))return value; }; args[1] = replacer; return _stringify.apply($JSON, args); } }); // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(15)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); // 19.4.3.5 Symbol.prototype[@@toStringTag] setToStringTag($Symbol, 'Symbol'); // 20.2.1.9 Math[@@toStringTag] setToStringTag(Math, 'Math', true); // 24.3.3 JSON[@@toStringTag] setToStringTag(global.JSON, 'JSON', true); /***/ }), /* 137 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var each = __webpack_require__(34)(0) , redefine = __webpack_require__(16) , meta = __webpack_require__(28) , assign = __webpack_require__(90) , weak = __webpack_require__(80) , isObject = __webpack_require__(4) , getWeak = meta.getWeak , isExtensible = Object.isExtensible , uncaughtFrozenStore = weak.ufstore , tmp = {} , InternalMap; var wrapper = function(get){ return function WeakMap(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }; var methods = { // 23.3.3.3 WeakMap.prototype.get(key) get: function get(key){ if(isObject(key)){ var data = getWeak(key); if(data === true)return uncaughtFrozenStore(this).get(key); return data ? data[this._i] : undefined; } }, // 23.3.3.5 WeakMap.prototype.set(key, value) set: function set(key, value){ return weak.def(this, key, value); } }; // 23.3 WeakMap Objects var $WeakMap = module.exports = __webpack_require__(35)('WeakMap', wrapper, methods, weak, true, true); // IE11 WeakMap frozen keys fix if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){ InternalMap = weak.getConstructor(wrapper); assign(InternalMap.prototype, methods); meta.NEED = true; each(['delete', 'has', 'get', 'set'], function(key){ var proto = $WeakMap.prototype , method = proto[key]; redefine(proto, key, function(a, b){ // store frozen objects on internal weakmap shim if(isObject(a) && !isExtensible(a)){ if(!this._f)this._f = new InternalMap; var result = this._f[key](a, b); return key == 'set' ? this : result; // store all the rest on native weakmap } return method.call(this, a, b); }); }); } /***/ }), /* 138 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var weak = __webpack_require__(80); // 23.4 WeakSet Objects __webpack_require__(35)('WeakSet', function(get){ return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.4.3.1 WeakSet.prototype.add(value) add: function add(value){ return weak.def(this, value, true); } }, weak, false, true); /***/ }), /* 139 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/Array.prototype.includes var $export = __webpack_require__(0) , $includes = __webpack_require__(77)(true); $export($export.P, 'Array', { includes: function includes(el /*, fromIndex = 0 */){ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(17)('includes'); /***/ }), /* 140 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-values-entries var $export = __webpack_require__(0) , $entries = __webpack_require__(92)(true); $export($export.S, 'Object', { entries: function entries(it){ return $entries(it); } }); /***/ }), /* 141 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-getownpropertydescriptors var $export = __webpack_require__(0) , ownKeys = __webpack_require__(165) , toIObject = __webpack_require__(9) , gOPD = __webpack_require__(52) , createProperty = __webpack_require__(45); $export($export.S, 'Object', { getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){ var O = toIObject(object) , getDesc = gOPD.f , keys = ownKeys(O) , result = {} , i = 0 , key; while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key)); return result; } }); /***/ }), /* 142 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-values-entries var $export = __webpack_require__(0) , $values = __webpack_require__(92)(false); $export($export.S, 'Object', { values: function values(it){ return $values(it); } }); /***/ }), /* 143 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-string-pad-start-end var $export = __webpack_require__(0) , $pad = __webpack_require__(95); $export($export.P, 'String', { padEnd: function padEnd(maxLength /*, fillString = ' ' */){ return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); } }); /***/ }), /* 144 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-string-pad-start-end var $export = __webpack_require__(0) , $pad = __webpack_require__(95); $export($export.P, 'String', { padStart: function padStart(maxLength /*, fillString = ' ' */){ return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); } }); /***/ }), /* 145 */ /***/ (function(module, exports, __webpack_require__) { var $iterators = __webpack_require__(72) , redefine = __webpack_require__(16) , global = __webpack_require__(3) , hide = __webpack_require__(15) , Iterators = __webpack_require__(27) , wks = __webpack_require__(1) , ITERATOR = wks('iterator') , TO_STRING_TAG = wks('toStringTag') , ArrayValues = Iterators.Array; for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ var NAME = collections[i] , Collection = global[NAME] , proto = Collection && Collection.prototype , key; if(proto){ if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues); if(!proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); Iterators[NAME] = ArrayValues; for(key in $iterators)if(!proto[key])redefine(proto, key, $iterators[key], true); } } /***/ }), /* 146 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0) , $task = __webpack_require__(57); $export($export.G + $export.B, { setImmediate: $task.set, clearImmediate: $task.clear }); /***/ }), /* 147 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.Viewport = exports.TableRenderer = exports.Table = exports.Settings = exports.Selection = exports.Scroll = exports.Overlays = exports.Event = exports.Core = exports.default = exports.Border = exports.TopLeftCornerOverlay = exports.TopOverlay = exports.LeftOverlay = exports.DebugOverlay = exports.RowFilter = exports.ColumnFilter = exports.CellRange = exports.CellCoords = exports.ViewportRowsCalculator = exports.ViewportColumnsCalculator = undefined; __webpack_require__(111); __webpack_require__(128); __webpack_require__(137); __webpack_require__(138); __webpack_require__(122); __webpack_require__(136); __webpack_require__(119); __webpack_require__(120); __webpack_require__(121); __webpack_require__(110); __webpack_require__(133); __webpack_require__(131); __webpack_require__(129); __webpack_require__(134); __webpack_require__(135); __webpack_require__(130); __webpack_require__(132); __webpack_require__(123); __webpack_require__(124); __webpack_require__(125); __webpack_require__(127); __webpack_require__(126); __webpack_require__(108); __webpack_require__(109); __webpack_require__(104); __webpack_require__(107); __webpack_require__(106); __webpack_require__(105); __webpack_require__(72); __webpack_require__(113); __webpack_require__(114); __webpack_require__(116); __webpack_require__(115); __webpack_require__(112); __webpack_require__(118); __webpack_require__(117); __webpack_require__(139); __webpack_require__(142); __webpack_require__(140); __webpack_require__(141); __webpack_require__(144); __webpack_require__(143); __webpack_require__(146); __webpack_require__(145); var _viewportColumns = __webpack_require__(60); var _viewportColumns2 = _interopRequireDefault(_viewportColumns); var _viewportRows = __webpack_require__(61); var _viewportRows2 = _interopRequireDefault(_viewportRows); var _coords = __webpack_require__(22); var _coords2 = _interopRequireDefault(_coords); var _range = __webpack_require__(43); var _range2 = _interopRequireDefault(_range); var _column = __webpack_require__(64); var _column2 = _interopRequireDefault(_column); var _row = __webpack_require__(65); var _row2 = _interopRequireDefault(_row); var _debug = __webpack_require__(99); var _debug2 = _interopRequireDefault(_debug); var _left = __webpack_require__(100); var _left2 = _interopRequireDefault(_left); var _top = __webpack_require__(101); var _top2 = _interopRequireDefault(_top); var _topLeftCorner = __webpack_require__(102); var _topLeftCorner2 = _interopRequireDefault(_topLeftCorner); var _border = __webpack_require__(59); var _border2 = _interopRequireDefault(_border); var _core = __webpack_require__(62); var _core2 = _interopRequireDefault(_core); var _event = __webpack_require__(63); var _event2 = _interopRequireDefault(_event); var _overlays = __webpack_require__(66); var _overlays2 = _interopRequireDefault(_overlays); var _scroll = __webpack_require__(67); var _scroll2 = _interopRequireDefault(_scroll); var _selection = __webpack_require__(103); var _selection2 = _interopRequireDefault(_selection); var _settings = __webpack_require__(68); var _settings2 = _interopRequireDefault(_settings); var _table = __webpack_require__(69); var _table2 = _interopRequireDefault(_table); var _tableRenderer = __webpack_require__(70); var _tableRenderer2 = _interopRequireDefault(_tableRenderer); var _viewport = __webpack_require__(71); var _viewport2 = _interopRequireDefault(_viewport); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.ViewportColumnsCalculator = _viewportColumns2.default; exports.ViewportRowsCalculator = _viewportRows2.default; exports.CellCoords = _coords2.default; exports.CellRange = _range2.default; exports.ColumnFilter = _column2.default; exports.RowFilter = _row2.default; exports.DebugOverlay = _debug2.default; exports.LeftOverlay = _left2.default; exports.TopOverlay = _top2.default; exports.TopLeftCornerOverlay = _topLeftCorner2.default; exports.Border = _border2.default; exports.default = _core2.default; exports.Core = _core2.default; exports.Event = _event2.default; exports.Overlays = _overlays2.default; exports.Scroll = _scroll2.default; exports.Selection = _selection2.default; exports.Settings = _settings2.default; exports.Table = _table2.default; exports.TableRenderer = _tableRenderer2.default; exports.Viewport = _viewport2.default; /***/ }), /* 148 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; 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; }; exports.stringify = stringify; exports.isDefined = isDefined; exports.isUndefined = isUndefined; exports.isEmpty = isEmpty; exports.isRegExp = isRegExp; /** * Converts any value to string. * * @param {*} value * @returns {String} */ function stringify(value) { var result = void 0; switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { case 'string': case 'number': result = '' + value; break; case 'object': result = value === null ? '' : value.toString(); break; case 'undefined': result = ''; break; default: result = value.toString(); break; } return result; } /** * Checks if given variable is defined. * * @param {*} variable Variable to check. * @returns {Boolean} */ function isDefined(variable) { return typeof variable !== 'undefined'; } /** * Checks if given variable is undefined. * * @param {*} variable Variable to check. * @returns {Boolean} */ function isUndefined(variable) { return typeof variable === 'undefined'; } /** * Check if given variable is null, empty string or undefined. * * @param {*} variable Variable to check. * @returns {Boolean} */ function isEmpty(variable) { return variable === null || variable === '' || isUndefined(variable); } /** * Check if given variable is a regular expression. * * @param {*} variable Variable to check. * @returns {Boolean} */ function isRegExp(variable) { return Object.prototype.toString.call(variable) === '[object RegExp]'; } /***/ }), /* 149 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.toUpperCaseFirst = toUpperCaseFirst; exports.equalsIgnoreCase = equalsIgnoreCase; exports.randomString = randomString; exports.isPercentValue = isPercentValue; exports.substitute = substitute; exports.stripTags = stripTags; var _mixed = __webpack_require__(148); var _number = __webpack_require__(76); /** * Convert string to upper case first letter. * * @param {String} string String to convert. * @returns {String} */ function toUpperCaseFirst(string) { return string[0].toUpperCase() + string.substr(1); } /** * Compare strings case insensitively. * * @param {...String} strings Strings to compare. * @returns {Boolean} */ function equalsIgnoreCase() { var unique = []; for (var _len = arguments.length, strings = Array(_len), _key = 0; _key < _len; _key++) { strings[_key] = arguments[_key]; } var length = strings.length; while (length--) { var string = (0, _mixed.stringify)(strings[length]).toLowerCase(); if (unique.indexOf(string) === -1) { unique.push(string); } } return unique.length === 1; } /** * Generates a random hex string. Used as namespace for Handsontable instance events. * * @return {String} Returns 16-long character random string (eq. `'92b1bfc74ec4'`). */ function randomString() { function s4() { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); } return s4() + s4() + s4() + s4(); } /** * Checks if value is valid percent. * * @param {String} value * @returns {Boolean} */ function isPercentValue(value) { return (/^([0-9][0-9]?%$)|(^100%$)/.test(value) ); } /** * Substitute strings placed beetwen square brackets into value defined in `variables` object. String names defined in * square brackets must be the same as property name of `variables` object. * * @param {String} template Template string. * @param {Object} variables Object which contains all available values which can be injected into template. * @returns {String} */ function substitute(template) { var variables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return ('' + template).replace(/(?:\\)?\[([^[\]]+)]/g, function (match, name) { if (match.charAt(0) === '\\') { return match.substr(1, match.length - 1); } return variables[name] === void 0 ? '' : variables[name]; }); } var STRIP_TAGS_REGEX = /<\/?\w+\/?>|<\w+[\s|/][^>]*>/gi; /** * Strip any HTML tag from the string. * * @param {String} string String to cut HTML from. * @return {String} */ function stripTags(string) { string += ''; return string.replace(STRIP_TAGS_REGEX, ''); } /***/ }), /* 150 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.KEY_CODES = undefined; exports.isPrintableChar = isPrintableChar; exports.isMetaKey = isMetaKey; exports.isCtrlKey = isCtrlKey; exports.isKey = isKey; var _array = __webpack_require__(24); var KEY_CODES = exports.KEY_CODES = { MOUSE_LEFT: 1, MOUSE_RIGHT: 3, MOUSE_MIDDLE: 2, BACKSPACE: 8, COMMA: 188, INSERT: 45, DELETE: 46, END: 35, ENTER: 13, ESCAPE: 27, CONTROL_LEFT: 91, COMMAND_LEFT: 17, COMMAND_RIGHT: 93, ALT: 18, HOME: 36, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, SPACE: 32, SHIFT: 16, CAPS_LOCK: 20, TAB: 9, ARROW_RIGHT: 39, ARROW_LEFT: 37, ARROW_UP: 38, ARROW_DOWN: 40, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, A: 65, X: 88, C: 67, V: 86 }; /** * Returns true if keyCode represents a printable character. * * @param {Number} keyCode * @returns {Boolean} */ function isPrintableChar(keyCode) { return keyCode == 32 || // space keyCode >= 48 && keyCode <= 57 || // 0-9 keyCode >= 96 && keyCode <= 111 || // numpad keyCode >= 186 && keyCode <= 192 || // ;=,-./` keyCode >= 219 && keyCode <= 222 || // []{}\|"' keyCode >= 226 || // special chars (229 for Asian chars) keyCode >= 65 && keyCode <= 90; // a-z } /** * @param {Number} keyCode * @returns {Boolean} */ function isMetaKey(keyCode) { var metaKeys = [KEY_CODES.ARROW_DOWN, KEY_CODES.ARROW_UP, KEY_CODES.ARROW_LEFT, KEY_CODES.ARROW_RIGHT, KEY_CODES.HOME, KEY_CODES.END, KEY_CODES.DELETE, KEY_CODES.BACKSPACE, KEY_CODES.F1, KEY_CODES.F2, KEY_CODES.F3, KEY_CODES.F4, KEY_CODES.F5, KEY_CODES.F6, KEY_CODES.F7, KEY_CODES.F8, KEY_CODES.F9, KEY_CODES.F10, KEY_CODES.F11, KEY_CODES.F12, KEY_CODES.TAB, KEY_CODES.PAGE_DOWN, KEY_CODES.PAGE_UP, KEY_CODES.ENTER, KEY_CODES.ESCAPE, KEY_CODES.SHIFT, KEY_CODES.CAPS_LOCK, KEY_CODES.ALT]; return metaKeys.indexOf(keyCode) !== -1; } /** * @param {Number} keyCode * @returns {Boolean} */ function isCtrlKey(keyCode) { return [KEY_CODES.CONTROL_LEFT, 224, KEY_CODES.COMMAND_LEFT, KEY_CODES.COMMAND_RIGHT].indexOf(keyCode) !== -1; } /** * @param {Number} keyCode * @param {String} baseCode * @returns {Boolean} */ function isKey(keyCode, baseCode) { var keys = baseCode.split('|'); var result = false; (0, _array.arrayEach)(keys, function (key) { if (keyCode === KEY_CODES[key]) { result = true; return false; } }); return result; } /***/ }), /* 151 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) var toObject = __webpack_require__(21) , toIndex = __webpack_require__(41) , toLength = __webpack_require__(10); module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){ var O = toObject(this) , len = toLength(O.length) , to = toIndex(target, len) , from = toIndex(start, len) , end = arguments.length > 2 ? arguments[2] : undefined , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to) , inc = 1; if(from < to && to < from + count){ inc = -1; from += count - 1; to += count - 1; } while(count-- > 0){ if(from in O)O[to] = O[from]; else delete O[to]; to += inc; from += inc; } return O; }; /***/ }), /* 152 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) var toObject = __webpack_require__(21) , toIndex = __webpack_require__(41) , toLength = __webpack_require__(10); module.exports = function fill(value /*, start = 0, end = @length */){ var O = toObject(this) , length = toLength(O.length) , aLen = arguments.length , index = toIndex(aLen > 1 ? arguments[1] : undefined, length) , end = aLen > 2 ? arguments[2] : undefined , endPos = end === undefined ? length : toIndex(end, length); while(endPos > index)O[index++] = value; return O; }; /***/ }), /* 153 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(4) , isArray = __webpack_require__(84) , SPECIES = __webpack_require__(1)('species'); module.exports = function(original){ var C; if(isArray(original)){ C = original.constructor; // cross-realm fallback if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined; if(isObject(C)){ C = C[SPECIES]; if(C === null)C = undefined; } } return C === undefined ? Array : C; }; /***/ }), /* 154 */ /***/ (function(module, exports, __webpack_require__) { // 9.4.2.3 ArraySpeciesCreate(originalArray, length) var speciesConstructor = __webpack_require__(153); module.exports = function(original, length){ return new (speciesConstructor(original))(length); }; /***/ }), /* 155 */ /***/ (function(module, exports, __webpack_require__) { // all enumerable object keys, includes symbols var getKeys = __webpack_require__(19) , gOPS = __webpack_require__(39) , pIE = __webpack_require__(29); module.exports = function(it){ var result = getKeys(it) , getSymbols = gOPS.f; if(getSymbols){ var symbols = getSymbols(it) , isEnum = pIE.f , i = 0 , key; while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); } return result; }; /***/ }), /* 156 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.2.5.3 get RegExp.prototype.flags var anObject = __webpack_require__(5); module.exports = function(){ var that = anObject(this) , result = ''; if(that.global) result += 'g'; if(that.ignoreCase) result += 'i'; if(that.multiline) result += 'm'; if(that.unicode) result += 'u'; if(that.sticky) result += 'y'; return result; }; /***/ }), /* 157 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(4) , setPrototypeOf = __webpack_require__(93).set; module.exports = function(that, target, C){ var P, S = target.constructor; if(S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf){ setPrototypeOf(that, P); } return that; }; /***/ }), /* 158 */ /***/ (function(module, exports) { // fast apply, http://jsperf.lnkit.com/fast-apply/5 module.exports = function(fn, args, that){ var un = that === undefined; switch(args.length){ case 0: return un ? fn() : fn.call(that); case 1: return un ? fn(args[0]) : fn.call(that, args[0]); case 2: return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); case 3: return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); case 4: return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); } return fn.apply(that, args); }; /***/ }), /* 159 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var create = __webpack_require__(51) , descriptor = __webpack_require__(20) , setToStringTag = __webpack_require__(30) , IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() __webpack_require__(15)(IteratorPrototype, __webpack_require__(1)('iterator'), function(){ return this; }); module.exports = function(Constructor, NAME, next){ Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); setToStringTag(Constructor, NAME + ' Iterator'); }; /***/ }), /* 160 */ /***/ (function(module, exports, __webpack_require__) { var getKeys = __webpack_require__(19) , toIObject = __webpack_require__(9); module.exports = function(object, el){ var O = toIObject(object) , keys = getKeys(O) , length = keys.length , index = 0 , key; while(length > index)if(O[key = keys[index++]] === el)return key; }; /***/ }), /* 161 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3) , macrotask = __webpack_require__(57).set , Observer = global.MutationObserver || global.WebKitMutationObserver , process = global.process , Promise = global.Promise , isNode = __webpack_require__(18)(process) == 'process'; module.exports = function(){ var head, last, notify; var flush = function(){ var parent, fn; if(isNode && (parent = process.domain))parent.exit(); while(head){ fn = head.fn; head = head.next; try { fn(); } catch(e){ if(head)notify(); else last = undefined; throw e; } } last = undefined; if(parent)parent.enter(); }; // Node.js if(isNode){ notify = function(){ process.nextTick(flush); }; // browsers with MutationObserver } else if(Observer){ var toggle = true , node = document.createTextNode(''); new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new notify = function(){ node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if(Promise && Promise.resolve){ var promise = Promise.resolve(); notify = function(){ promise.then(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessag // - onreadystatechange // - setTimeout } else { notify = function(){ // strange IE + webpack dev server bug - use .call(global) macrotask.call(global, flush); }; } return function(fn){ var task = {fn: fn, next: undefined}; if(last)last.next = task; if(!head){ head = task; notify(); } last = task; }; }; /***/ }), /* 162 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(6) , anObject = __webpack_require__(5) , getKeys = __webpack_require__(19); module.exports = __webpack_require__(7) ? Object.defineProperties : function defineProperties(O, Properties){ anObject(O); var keys = getKeys(Properties) , length = keys.length , i = 0 , P; while(length > i)dP.f(O, P = keys[i++], Properties[P]); return O; }; /***/ }), /* 163 */ /***/ (function(module, exports, __webpack_require__) { // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window var toIObject = __webpack_require__(9) , gOPN = __webpack_require__(53).f , toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function(it){ try { return gOPN(it); } catch(e){ return windowNames.slice(); } }; module.exports.f = function getOwnPropertyNames(it){ return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); }; /***/ }), /* 164 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var has = __webpack_require__(8) , toObject = __webpack_require__(21) , IE_PROTO = __webpack_require__(54)('IE_PROTO') , ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function(O){ O = toObject(O); if(has(O, IE_PROTO))return O[IE_PROTO]; if(typeof O.constructor == 'function' && O instanceof O.constructor){ return O.constructor.prototype; } return O instanceof Object ? ObjectProto : null; }; /***/ }), /* 165 */ /***/ (function(module, exports, __webpack_require__) { // all object keys, includes non-enumerable and symbols var gOPN = __webpack_require__(53) , gOPS = __webpack_require__(39) , anObject = __webpack_require__(5) , Reflect = __webpack_require__(3).Reflect; module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){ var keys = gOPN.f(anObject(it)) , getSymbols = gOPS.f; return getSymbols ? keys.concat(getSymbols(it)) : keys; }; /***/ }), /* 166 */ /***/ (function(module, exports) { // 7.2.9 SameValue(x, y) module.exports = Object.is || function is(x, y){ return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; }; /***/ }), /* 167 */ /***/ (function(module, exports, __webpack_require__) { // 7.3.20 SpeciesConstructor(O, defaultConstructor) var anObject = __webpack_require__(5) , aFunction = __webpack_require__(44) , SPECIES = __webpack_require__(1)('species'); module.exports = function(O, D){ var C = anObject(O).constructor, S; return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); }; /***/ }), /* 168 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(42) , defined = __webpack_require__(13); // true -> String#at // false -> String#codePointAt module.exports = function(TO_STRING){ return function(that, pos){ var s = String(defined(that)) , i = toInteger(pos) , l = s.length , a, b; if(i < 0 || i >= l)return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; /***/ }), /* 169 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3) , core = __webpack_require__(26) , LIBRARY = __webpack_require__(38) , wksExt = __webpack_require__(97) , defineProperty = __webpack_require__(6).f; module.exports = function(name){ var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)}); }; /***/ }) /******/ ]); //# sourceMappingURL=walkontable.js.map
t
t