/*!
* Copyright (c) HANDSONCODE sp. z o. o.
*
* HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o.,
* a Polish corporation, based in Gdynia, Poland, at 96/98 Aleja Zwycięstwa,
* registered with the National Court Register under number 538651,
* EU tax ID number: PL5862294002, share capital: PLN 62,800.00.
*
* This software is protected by applicable copyright laws, including
* international treaties, and dual-licensed – depending on whether
* your use is intended for or may result in commercial advantage
* or monetary compensation (commercial purposes), or not.
*
* If your use involves only such purposes as research, private study,
* evaluation and the like, you agree to be bound by the terms included
* in the "handsontable-non-commercial-license.pdf" file, available
* in the main directory of this software repository.
*
* By installing, copying, or otherwise using this software for
* commercial purposes, you agree to be bound by the terms included
* in the "handsontable-general-terms.pdf" file, available in the main
* directory of this software repository.
*
* HANDSONCODE PROVIDES THIS SOFTWARE ON AN "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND. IN NO EVENT
* AND UNDER NO LEGAL THEORY, SHALL HANDSONCODE BE LIABLE
* TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL,
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING
* FROM USE OR INABILITY TO USE THIS SOFTWARE.
*
* Version: 7.1.1
* Release date: 12/08/2019 (built at 11/09/2019 12:15:13)
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("Handsontable", [], factory);
else if(typeof exports === 'object')
exports["Handsontable"] = factory();
else
root["Handsontable"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 403);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
}
module.exports = _interopRequireDefault;
/***/ }),
/* 1 */
/***/ (function(module, exports) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
module.exports = _classCallCheck;
/***/ }),
/* 2 */
/***/ (function(module, exports) {
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);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
module.exports = _createClass;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(17);
__webpack_require__(55);
__webpack_require__(13);
__webpack_require__(12);
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 ilen = arr.length;
var i = 0;
while (i < ilen) {
arr[i] = [arr[i]];
i += 1;
}
}
function extendArray(arr, extension) {
var ilen = extension.length;
var i = 0;
while (i < ilen) {
arr.push(extension[i]);
i += 1;
}
}
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;
var iterable = array;
var result = accumulator;
if (!Array.isArray(array)) {
iterable = Array.from(array);
}
var length = iterable.length;
if (initFromArray && length) {
index += 1;
result = iterable[index];
}
index += 1;
while (index < length) {
result = iteratee(result, iterable[index], index, iterable);
index += 1;
}
return result;
}
/**
* 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 = 0;
var iterable = array;
if (!Array.isArray(array)) {
iterable = Array.from(array);
}
var length = iterable.length;
var result = [];
var resIndex = -1;
while (index < length) {
var value = iterable[index];
if (predicate(value, index, iterable)) {
resIndex += 1;
result[resIndex] = value;
}
index += 1;
}
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 = 0;
var iterable = array;
if (!Array.isArray(array)) {
iterable = Array.from(array);
}
var length = iterable.length;
var result = [];
var resIndex = -1;
while (index < length) {
var value = iterable[index];
resIndex += 1;
result[resIndex] = iteratee(value, index, iterable);
index += 1;
}
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 or an any element with implemented iterator protocol.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = 0;
var iterable = array;
if (!Array.isArray(array)) {
iterable = Array.from(array);
}
var length = iterable.length;
while (index < length) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
index += 1;
}
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;
}
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(9);
__webpack_require__(39);
__webpack_require__(49);
exports.__esModule = true;
exports.duckSchema = duckSchema;
exports.inherit = inherit;
exports.extend = extend;
exports.deepExtend = deepExtend;
exports.deepClone = deepClone;
exports.clone = clone;
exports.mixin = mixin;
exports.isObjectEqual = isObjectEqual;
exports.isObject = isObject;
exports.defineGetter = defineGetter;
exports.objectEach = objectEach;
exports.getProperty = getProperty;
exports.deepObjectSize = deepObjectSize;
exports.createObjectPropListener = createObjectPropListener;
exports.hasOwnProperty = hasOwnProperty;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(70));
var _typeof2 = _interopRequireDefault(__webpack_require__(45));
var _array = __webpack_require__(3);
/**
* 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 && (0, _typeof2.default)(value) === 'object' && !Array.isArray(value)) {
schema[key] = duckSchema(value);
} else if (Array.isArray(value)) {
if (value.length && (0, _typeof2.default)(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] && (0, _typeof2.default)(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 ((0, _typeof2.default)(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 = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
mixins[_key - 1] = arguments[_key];
}
(0, _array.arrayEach)(mixins, function (mixinItem) {
Base.MIXINS.push(mixinItem.MIXIN_NAME);
objectEach(mixinItem, function (value, key) {
if (Base.prototype[key] !== void 0) {
throw new Error("Mixin conflict. Property '".concat(key, "' already exist and cannot be overwritten."));
}
if (typeof value === 'function') {
Base.prototype[key] = value;
} else {
var getter = function _getter(property, initialValue) {
var propertyName = "_".concat(property);
var initValue = function initValue(newValue) {
var result = newValue;
if (Array.isArray(result) || isObject(result)) {
result = deepClone(result);
}
return result;
};
return function () {
if (this[propertyName] === void 0) {
this[propertyName] = initValue(initialValue);
}
return this[propertyName];
};
};
var setter = function _setter(property) {
var propertyName = "_".concat(property);
return function (newValue) {
this[propertyName] = newValue;
};
};
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 isObjectEqual(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) {
// eslint-disable-next-line no-restricted-syntax
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 (nameItem) {
result = result[nameItem];
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 += 1;
}
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 = "_".concat(propertyToListen);
var holder = (_holder = {
_touched: false
}, (0, _defineProperty2.default)(_holder, privateProperty, defaultValue), (0, _defineProperty2.default)(_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);
}
/***/ }),
/* 5 */
/***/ (function(module, exports) {
function _getPrototypeOf(o) {
module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
module.exports = _getPrototypeOf;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
var _typeof = __webpack_require__(45);
var assertThisInitialized = __webpack_require__(30);
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return assertThisInitialized(self);
}
module.exports = _possibleConstructorReturn;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
var setPrototypeOf = __webpack_require__(210);
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) setPrototypeOf(subClass, superClass);
}
module.exports = _inherits;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(17);
__webpack_require__(25);
__webpack_require__(13);
__webpack_require__(56);
__webpack_require__(36);
__webpack_require__(9);
__webpack_require__(134);
__webpack_require__(39);
__webpack_require__(32);
__webpack_require__(40);
__webpack_require__(49);
__webpack_require__(133);
exports.__esModule = true;
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.clearTextSelection = clearTextSelection;
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;
exports.selectElementIfAllowed = selectElementIfAllowed;
exports.HTML_CHARACTERS = void 0;
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(38));
var _browser = __webpack_require__(75);
var _feature = __webpack_require__(79);
/**
* 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;
var elementToCheck = element;
while (elementToCheck !== null) {
if (iteration === level) {
parent = elementToCheck;
break;
}
if (elementToCheck.host && elementToCheck.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
elementToCheck = elementToCheck.host;
} else {
iteration += 1;
elementToCheck = elementToCheck.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) {
var elementToCheck = element;
while (elementToCheck !== null && elementToCheck !== until) {
if (elementToCheck.nodeType === Node.ELEMENT_NODE && (nodes.indexOf(elementToCheck.nodeName) > -1 || nodes.indexOf(elementToCheck) > -1)) {
return elementToCheck;
}
if (elementToCheck.host && elementToCheck.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
elementToCheck = elementToCheck.host;
} else {
elementToCheck = elementToCheck.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 = [];
var elementToCheck = element;
while (elementToCheck) {
elementToCheck = closest(elementToCheck, nodes, until);
if (!elementToCheck || until && !until.contains(elementToCheck)) {
break;
}
matched.push(elementToCheck);
if (elementToCheck.host && elementToCheck.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
elementToCheck = elementToCheck.host;
} else {
elementToCheck = elementToCheck.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(child.ownerDocument.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';
var result = false;
var parentNode = polymerWrap(element);
function isHotTable(testElement) {
return testElement.nodeType === Node.ELEMENT_NODE && testElement.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;
}
/* global Polymer wrap unwrap */
/**
* Wrap element into polymer/webcomponent container if exists
*
* @param element
* @returns {*}
*/
function polymerWrap(element) {
return typeof Polymer !== 'undefined' && typeof wrap === 'function' ? wrap(element) : element;
}
/**
* Unwrap element from polymer/webcomponent container if exists
*
* @param element
* @returns {*}
*/
function polymerUnwrap(element) {
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;
var elementToCheck = element;
if (elementToCheck.previousSibling) {
/* eslint-disable no-cond-assign */
while (elementToCheck = elementToCheck.previousSibling) {
i += 1;
}
}
return i;
}
/**
* Check if the provided overlay contains the provided element
*
* @param {String} overlay
* @param {HTMLElement} element
* @param {HTMLElement} root
* @returns {boolean}
*/
function overlayContainsElement(overlayType, element, root) {
var overlayElement = root.parentElement.querySelector(".ht_clone_".concat(overlayType));
return overlayElement ? overlayElement.contains(element) : null;
}
var _hasClass;
var _addClass;
var _removeClass;
function filterEmptyClassNames(classNames) {
var result = [];
if (!classNames || !classNames.length) {
return result;
}
var len = 0;
while (classNames[len]) {
result.push(classNames[len]);
len += 1;
}
return result;
}
if ((0, _feature.isClassListSupported)()) {
var isSupportMultipleClassesArg = function isSupportMultipleClassesArg(rootDocument) {
var element = rootDocument.createElement('div');
element.classList.add('test', 'test2');
return element.classList.contains('test2');
};
_hasClass = function _hasClass(element, className) {
if (element.classList === void 0 || typeof className !== 'string' || className === '') {
return false;
}
return element.classList.contains(className);
};
_addClass = function _addClass(element, classes) {
var rootDocument = element.ownerDocument;
var className = classes;
if (typeof className === 'string') {
className = className.split(' ');
}
className = filterEmptyClassNames(className);
if (className.length > 0) {
if (isSupportMultipleClassesArg(rootDocument)) {
var _element$classList;
(_element$classList = element.classList).add.apply(_element$classList, (0, _toConsumableArray2.default)(className));
} else {
var len = 0;
while (className && className[len]) {
element.classList.add(className[len]);
len += 1;
}
}
}
};
_removeClass = function _removeClass(element, classes) {
var className = classes;
if (typeof className === 'string') {
className = className.split(' ');
}
className = filterEmptyClassNames(className);
if (className.length > 0) {
if (isSupportMultipleClassesArg) {
var _element$classList2;
(_element$classList2 = element.classList).remove.apply(_element$classList2, (0, _toConsumableArray2.default)(className));
} else {
var len = 0;
while (className && className[len]) {
element.classList.remove(className[len]);
len += 1;
}
}
}
};
} else {
var createClassNameRegExp = function createClassNameRegExp(className) {
return new RegExp("(\\s|^)".concat(className, "(\\s|$)"));
};
_hasClass = function _hasClass(element, className) {
// http://snipplr.com/view/3561/addclass-removeclass-hasclass/
return element.className !== void 0 && createClassNameRegExp(className).test(element.className);
};
_addClass = function _addClass(element, classes) {
var len = 0;
var _className = element.className;
var className = classes;
if (typeof className === 'string') {
className = className.split(' ');
}
if (_className === '') {
_className = className.join(' ');
} else {
while (className && className[len]) {
if (!createClassNameRegExp(className[len]).test(_className)) {
_className += " ".concat(className[len]);
}
len += 1;
}
}
element.className = _className;
};
_removeClass = function _removeClass(element, classes) {
var len = 0;
var _className = element.className;
var className = classes;
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 += 1;
}
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 = /(<(.*)>|&(.*);)/;
/**
* Insert content into element trying avoid innerHTML method.
* @return {void}
*/
exports.HTML_CHARACTERS = HTML_CHARACTERS;
function fastInnerHTML(element, content) {
if (HTML_CHARACTERS.test(content)) {
element.innerHTML = content;
} else {
fastInnerText(element, content);
}
}
/**
* Insert text content into element
* @return {Boolean}
*/
function fastInnerText(element, content) {
var child = element.firstChild;
if (child && child.nodeType === 3 && child.nextSibling === null) {
// fast lane - replace existing text node
if (_feature.isTextContentSupported) {
// 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(element.ownerDocument.createTextNode(content));
}
}
/**
* Returns true if element is attached to the DOM and visible, false otherwise
* @param elem
* @returns {boolean}
*/
function isVisible(elem) {
var documentElement = elem.ownerDocument.documentElement;
var next = elem;
while (polymerUnwrap(next) !== 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 && 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 rootDocument = elem.ownerDocument;
var rootWindow = rootDocument.defaultView;
var documentElement = rootDocument.documentElement;
var elementToCheck = elem;
var offsetLeft;
var offsetTop;
var lastElem;
var box;
if ((0, _feature.hasCaptionProblem)() && elementToCheck.firstChild && elementToCheck.firstChild.nodeName === 'CAPTION') {
// fixes problem with Firefox ignoring
in TABLE offset (see also export outerHeight)
// http://jsperf.com/offset-vs-getboundingclientrect/8
box = elementToCheck.getBoundingClientRect();
return {
top: box.top + (rootWindow.pageYOffset || documentElement.scrollTop) - (documentElement.clientTop || 0),
left: box.left + (rootWindow.pageXOffset || documentElement.scrollLeft) - (documentElement.clientLeft || 0)
};
}
offsetLeft = elementToCheck.offsetLeft;
offsetTop = elementToCheck.offsetTop;
lastElem = elementToCheck;
/* eslint-disable no-cond-assign */
while (elementToCheck = elementToCheck.offsetParent) {
// from my observation, document.body always has scrollLeft/scrollTop == 0
if (elementToCheck === rootDocument.body) {
break;
}
offsetLeft += elementToCheck.offsetLeft;
offsetTop += elementToCheck.offsetTop;
lastElem = elementToCheck;
} // 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 += rootWindow.pageXOffset || documentElement.scrollLeft;
offsetTop += rootWindow.pageYOffset || documentElement.scrollTop;
}
return {
left: offsetLeft,
top: offsetTop
};
}
/**
* Returns the document's scrollTop property.
*
* @param {Window} rootWindow
* @returns {Number}
*/
// eslint-disable-next-line no-restricted-globals
function getWindowScrollTop() {
var rootWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
var res = rootWindow.scrollY;
if (res === void 0) {
// IE8-11
res = rootWindow.document.documentElement.scrollTop;
}
return res;
}
/**
* Returns the document's scrollLeft property.
*
* @param {Window} rootWindow
* @returns {Number}
*/
// eslint-disable-next-line no-restricted-globals
function getWindowScrollLeft() {
var rootWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
var res = rootWindow.scrollX;
if (res === void 0) {
// IE8-11
res = rootWindow.document.documentElement.scrollLeft;
}
return res;
}
/**
* Returns the provided element's scrollTop property.
*
* @param element
* @param {Window} rootWindow
* @returns {Number}
*/
// eslint-disable-next-line no-restricted-globals
function getScrollTop(element) {
var rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
if (element === rootWindow) {
return getWindowScrollTop(rootWindow);
}
return element.scrollTop;
}
/**
* Returns the provided element's scrollLeft property.
*
* @param element
* @param {Window} rootWindow
* @returns {Number}
*/
// eslint-disable-next-line no-restricted-globals
function getScrollLeft(element) {
var rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
if (element === rootWindow) {
return getWindowScrollLeft(rootWindow);
}
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 rootDocument = element.ownerDocument;
var rootWindow = rootDocument ? rootDocument.defaultView : void 0;
if (!rootDocument) {
rootDocument = element.document ? element.document : element;
rootWindow = rootDocument.defaultView;
}
var props = ['auto', 'scroll'];
var supportedGetComputedStyle = (0, _feature.isGetComputedStyleSupported)();
var el = element.parentNode;
while (el && el.style && rootDocument.body !== el) {
var _el$style = el.style,
overflow = _el$style.overflow,
overflowX = _el$style.overflowX,
overflowY = _el$style.overflowY;
if ([overflow, overflowX, overflowY].includes('scroll')) {
return el;
} else if (supportedGetComputedStyle) {
var _rootWindow$getComput = rootWindow.getComputedStyle(el);
overflow = _rootWindow$getComput.overflow;
overflowX = _rootWindow$getComput.overflowX;
overflowY = _rootWindow$getComput.overflowY;
if (props.includes(overflow) || props.includes(overflowX) || props.includes(overflowY)) {
return el;
}
} // The '+ 1' after the scrollHeight/scrollWidth is to prevent problems with zoomed out Chrome.
if (el.clientHeight <= el.scrollHeight + 1 && (props.includes(overflowY) || props.includes(overflow))) {
return el;
}
if (el.clientWidth <= el.scrollWidth + 1 && (props.includes(overflowX) || props.includes(overflow))) {
return el;
}
el = el.parentNode;
}
return rootWindow;
}
/**
* 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 rootDocument = base.ownerDocument;
var rootWindow = rootDocument.defaultView;
var el = base.parentNode;
while (el && el.style && rootDocument.body !== el) {
if (el.style.overflow !== 'visible' && el.style.overflow !== '') {
return el;
}
var computedStyle = getComputedStyle(el, rootWindow);
var allowedProperties = ['scroll', 'hidden', 'auto'];
var property = computedStyle.getPropertyValue('overflow');
var propertyY = computedStyle.getPropertyValue('overflow-y');
var propertyX = computedStyle.getPropertyValue('overflow-x');
if (allowedProperties.includes(property) || allowedProperties.includes(propertyY) || allowedProperties.includes(propertyX)) {
return el;
}
el = el.parentNode;
}
return rootWindow;
}
/**
* Returns a style property for the provided element. (Be it an inline or external style).
*
* @param {HTMLElement} element
* @param {String} prop Wanted property
* @param {Window} rootWindow
* @returns {String|undefined} Element's style property
*/
// eslint-disable-next-line no-restricted-globals
function getStyle(element, prop) {
var rootWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window;
if (!element) {
return;
} else if (element === rootWindow) {
if (prop === 'width') {
return "".concat(rootWindow.innerWidth, "px");
} else if (prop === 'height') {
return "".concat(rootWindow.innerHeight, "px");
}
return;
}
var styleProp = element.style[prop];
if (styleProp !== '' && styleProp !== void 0) {
return styleProp;
}
var computedStyle = getComputedStyle(element, rootWindow);
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
* @param {Window} rootWindow
* @returns {IEElementStyle|CssStyle} Elements computed style object
*/
// eslint-disable-next-line no-restricted-globals
function getComputedStyle(element) {
var rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
return element.currentStyle || rootWindow.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) {
var rootWindow = element.defaultView;
if (!rootWindow) {
rootWindow = element.document ? element : element.ownerDocument.defaultView;
}
if (rootWindow.addEventListener) {
element.addEventListener(event, callback, false);
} else {
element.attachEvent("on".concat(event), callback);
}
}
function removeEvent(element, event, callback) {
var rootWindow = element.defaultView;
if (!rootWindow) {
rootWindow = element.document ? element : element.ownerDocument.defaultView;
}
if (rootWindow.removeEventListener) {
element.removeEventListener(event, callback, false);
} else {
element.detachEvent("on".concat(event), callback);
}
}
/**
* Returns caret position in text input
*
* @author https://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea
* @return {Number}
*/
function getCaretPosition(el) {
var rootDocument = el.ownerDocument;
if (el.selectionStart) {
return el.selectionStart;
} else if (rootDocument.selection) {
// IE8
el.focus();
var r = rootDocument.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) {
var rootDocument = el.ownerDocument;
if (el.selectionEnd) {
return el.selectionEnd;
} else if (rootDocument.selection) {
// IE8
var r = rootDocument.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.
*
* @param {Window} rootWindow
* @returns {String}
*/
// eslint-disable-next-line no-restricted-globals
function getSelectionText() {
var rootWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
var rootDocument = rootWindow.document;
var text = '';
if (rootWindow.getSelection) {
text = rootWindow.getSelection().toString();
} else if (rootDocument.selection && rootDocument.selection.type !== 'Control') {
text = rootDocument.selection.createRange().text;
}
return text;
}
/**
* Cross-platform helper to clear text selection.
*
* @param {Window} rootWindow
*/
// eslint-disable-next-line no-restricted-globals
function clearTextSelection() {
var rootWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
var rootDocument = rootWindow.document; // http://stackoverflow.com/questions/3169786/clear-text-selection-with-javascript
if (rootWindow.getSelection) {
if (rootWindow.getSelection().empty) {
// Chrome
rootWindow.getSelection().empty();
} else if (rootWindow.getSelection().removeAllRanges) {
// Firefox
rootWindow.getSelection().removeAllRanges();
}
} else if (rootDocument.selection) {
// IE?
rootDocument.selection.empty();
}
}
/**
* 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;
/**
* Helper to calculate scrollbar width.
* Source: https://stackoverflow.com/questions/986937/how-can-i-get-the-browsers-scrollbar-sizes
*
* @private
* @param {Document} rootDocument
*/
// eslint-disable-next-line no-restricted-globals
function walkontableCalculateScrollbarWidth() {
var rootDocument = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
var inner = rootDocument.createElement('div');
inner.style.height = '200px';
inner.style.width = '100%';
var outer = rootDocument.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);
(rootDocument.body || rootDocument.documentElement).appendChild(outer);
var w1 = inner.offsetWidth;
outer.style.overflow = 'scroll';
var w2 = inner.offsetWidth;
if (w1 === w2) {
w2 = outer.clientWidth;
}
(rootDocument.body || rootDocument.documentElement).removeChild(outer);
return w1 - w2;
}
/**
* Returns the computed width of the native browser scroll bar.
*
* @param {Document} rootDocument
* @return {Number} width
*/
// eslint-disable-next-line no-restricted-globals
function getScrollbarWidth() {
var rootDocument = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
if (cachedScrollbarWidth === void 0) {
cachedScrollbarWidth = walkontableCalculateScrollbarWidth(rootDocument);
}
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(".concat(left, ",").concat(top, ",0)");
overlayElem.style['-webkit-transform'] = "translate3d(".concat(left, ",").concat(top, ",0)");
} else {
overlayElem.style.transform = "translate3d(".concat(left, ",").concat(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;
}
/**
* Check if the given DOM element can be focused (by using "select" method).
*
* @param {HTMLElement} element - DOM element
*/
function selectElementIfAllowed(element) {
var activeElement = element.ownerDocument.activeElement;
if (!isOutsideInput(activeElement)) {
element.select();
}
}
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
var redefine = __webpack_require__(69);
var toString = __webpack_require__(411);
var ObjectPrototype = Object.prototype;
// `Object.prototype.toString` method
// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
if (toString !== ObjectPrototype.toString) {
redefine(ObjectPrototype, 'toString', toString, { unsafe: true });
}
/***/ }),
/* 10 */
/***/ (function(module, exports) {
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj["default"] = obj;
return newObj;
}
}
module.exports = _interopRequireWildcard;
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE = exports.FILTERS_BUTTONS_PLACEHOLDER_VALUE = exports.FILTERS_BUTTONS_PLACEHOLDER_SEARCH = exports.FILTERS_BUTTONS_CANCEL = exports.FILTERS_BUTTONS_OK = exports.FILTERS_BUTTONS_CLEAR = exports.FILTERS_BUTTONS_SELECT_ALL = exports.FILTERS_VALUES_BLANK_CELLS = exports.FILTERS_LABELS_DISJUNCTION = exports.FILTERS_LABELS_CONJUNCTION = exports.FILTERS_DIVS_FILTER_BY_VALUE = exports.FILTERS_DIVS_FILTER_BY_CONDITION = exports.FILTERS_CONDITIONS_YESTERDAY = exports.FILTERS_CONDITIONS_TOMORROW = exports.FILTERS_CONDITIONS_TODAY = exports.FILTERS_CONDITIONS_BEFORE = exports.FILTERS_CONDITIONS_AFTER = exports.FILTERS_CONDITIONS_NOT_BETWEEN = exports.FILTERS_CONDITIONS_BETWEEN = exports.FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL = exports.FILTERS_CONDITIONS_LESS_THAN = exports.FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL = exports.FILTERS_CONDITIONS_GREATER_THAN = exports.FILTERS_CONDITIONS_BY_VALUE = exports.FILTERS_CONDITIONS_NOT_CONTAIN = exports.FILTERS_CONDITIONS_CONTAINS = exports.FILTERS_CONDITIONS_ENDS_WITH = exports.FILTERS_CONDITIONS_BEGINS_WITH = exports.FILTERS_CONDITIONS_NOT_EQUAL = exports.FILTERS_CONDITIONS_EQUAL = exports.FILTERS_CONDITIONS_NOT_EMPTY = exports.FILTERS_CONDITIONS_EMPTY = exports.FILTERS_CONDITIONS_NONE = exports.FILTERS_CONDITIONS_NAMESPACE = exports.FILTERS_NAMESPACE = exports.CONTEXTMENU_ITEMS_SHOW_ROW = exports.CONTEXTMENU_ITEMS_HIDE_ROW = exports.CONTEXTMENU_ITEMS_SHOW_COLUMN = exports.CONTEXTMENU_ITEMS_HIDE_COLUMN = exports.CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD = exports.CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD = exports.CONTEXTMENU_ITEMS_REMOVE_BORDERS = exports.CONTEXTMENU_ITEMS_BORDERS_LEFT = exports.CONTEXTMENU_ITEMS_BORDERS_BOTTOM = exports.CONTEXTMENU_ITEMS_BORDERS_RIGHT = exports.CONTEXTMENU_ITEMS_BORDERS_TOP = exports.CONTEXTMENU_ITEMS_BORDERS = exports.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM = exports.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE = exports.CONTEXTMENU_ITEMS_ALIGNMENT_TOP = exports.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY = exports.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT = exports.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER = exports.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT = exports.CONTEXTMENU_ITEMS_ALIGNMENT = exports.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT = exports.CONTEXTMENU_ITEMS_REMOVE_COMMENT = exports.CONTEXTMENU_ITEMS_EDIT_COMMENT = exports.CONTEXTMENU_ITEMS_ADD_COMMENT = exports.CONTEXTMENU_ITEMS_UNMERGE_CELLS = exports.CONTEXTMENU_ITEMS_MERGE_CELLS = exports.CONTEXTMENU_ITEMS_UNFREEZE_COLUMN = exports.CONTEXTMENU_ITEMS_FREEZE_COLUMN = exports.CONTEXTMENU_ITEMS_CUT = exports.CONTEXTMENU_ITEMS_COPY = exports.CONTEXTMENU_ITEMS_CLEAR_COLUMN = exports.CONTEXTMENU_ITEMS_READ_ONLY = exports.CONTEXTMENU_ITEMS_REDO = exports.CONTEXTMENU_ITEMS_UNDO = exports.CONTEXTMENU_ITEMS_REMOVE_COLUMN = exports.CONTEXTMENU_ITEMS_REMOVE_ROW = exports.CONTEXTMENU_ITEMS_INSERT_RIGHT = exports.CONTEXTMENU_ITEMS_INSERT_LEFT = exports.CONTEXTMENU_ITEMS_ROW_BELOW = exports.CONTEXTMENU_ITEMS_ROW_ABOVE = exports.CONTEXTMENU_ITEMS_NO_ITEMS = exports.CONTEXT_MENU_ITEMS_NAMESPACE = void 0;
/**
* Constants for parts of translation.
*/
var CONTEXT_MENU_ITEMS_NAMESPACE = 'ContextMenu:items';
exports.CONTEXT_MENU_ITEMS_NAMESPACE = CONTEXT_MENU_ITEMS_NAMESPACE;
var CONTEXTMENU_ITEMS_NO_ITEMS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".noItems");
exports.CONTEXTMENU_ITEMS_NO_ITEMS = CONTEXTMENU_ITEMS_NO_ITEMS;
var CONTEXTMENU_ITEMS_ROW_ABOVE = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".insertRowAbove");
exports.CONTEXTMENU_ITEMS_ROW_ABOVE = CONTEXTMENU_ITEMS_ROW_ABOVE;
var CONTEXTMENU_ITEMS_ROW_BELOW = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".insertRowBelow");
exports.CONTEXTMENU_ITEMS_ROW_BELOW = CONTEXTMENU_ITEMS_ROW_BELOW;
var CONTEXTMENU_ITEMS_INSERT_LEFT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".insertColumnOnTheLeft");
exports.CONTEXTMENU_ITEMS_INSERT_LEFT = CONTEXTMENU_ITEMS_INSERT_LEFT;
var CONTEXTMENU_ITEMS_INSERT_RIGHT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".insertColumnOnTheRight");
exports.CONTEXTMENU_ITEMS_INSERT_RIGHT = CONTEXTMENU_ITEMS_INSERT_RIGHT;
var CONTEXTMENU_ITEMS_REMOVE_ROW = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".removeRow");
exports.CONTEXTMENU_ITEMS_REMOVE_ROW = CONTEXTMENU_ITEMS_REMOVE_ROW;
var CONTEXTMENU_ITEMS_REMOVE_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".removeColumn");
exports.CONTEXTMENU_ITEMS_REMOVE_COLUMN = CONTEXTMENU_ITEMS_REMOVE_COLUMN;
var CONTEXTMENU_ITEMS_UNDO = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".undo");
exports.CONTEXTMENU_ITEMS_UNDO = CONTEXTMENU_ITEMS_UNDO;
var CONTEXTMENU_ITEMS_REDO = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".redo");
exports.CONTEXTMENU_ITEMS_REDO = CONTEXTMENU_ITEMS_REDO;
var CONTEXTMENU_ITEMS_READ_ONLY = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".readOnly");
exports.CONTEXTMENU_ITEMS_READ_ONLY = CONTEXTMENU_ITEMS_READ_ONLY;
var CONTEXTMENU_ITEMS_CLEAR_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".clearColumn");
exports.CONTEXTMENU_ITEMS_CLEAR_COLUMN = CONTEXTMENU_ITEMS_CLEAR_COLUMN;
var CONTEXTMENU_ITEMS_COPY = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".copy");
exports.CONTEXTMENU_ITEMS_COPY = CONTEXTMENU_ITEMS_COPY;
var CONTEXTMENU_ITEMS_CUT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".cut");
exports.CONTEXTMENU_ITEMS_CUT = CONTEXTMENU_ITEMS_CUT;
var CONTEXTMENU_ITEMS_FREEZE_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".freezeColumn");
exports.CONTEXTMENU_ITEMS_FREEZE_COLUMN = CONTEXTMENU_ITEMS_FREEZE_COLUMN;
var CONTEXTMENU_ITEMS_UNFREEZE_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".unfreezeColumn");
exports.CONTEXTMENU_ITEMS_UNFREEZE_COLUMN = CONTEXTMENU_ITEMS_UNFREEZE_COLUMN;
var CONTEXTMENU_ITEMS_MERGE_CELLS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".mergeCells");
exports.CONTEXTMENU_ITEMS_MERGE_CELLS = CONTEXTMENU_ITEMS_MERGE_CELLS;
var CONTEXTMENU_ITEMS_UNMERGE_CELLS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".unmergeCells");
exports.CONTEXTMENU_ITEMS_UNMERGE_CELLS = CONTEXTMENU_ITEMS_UNMERGE_CELLS;
var CONTEXTMENU_ITEMS_ADD_COMMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".addComment");
exports.CONTEXTMENU_ITEMS_ADD_COMMENT = CONTEXTMENU_ITEMS_ADD_COMMENT;
var CONTEXTMENU_ITEMS_EDIT_COMMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".editComment");
exports.CONTEXTMENU_ITEMS_EDIT_COMMENT = CONTEXTMENU_ITEMS_EDIT_COMMENT;
var CONTEXTMENU_ITEMS_REMOVE_COMMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".removeComment");
exports.CONTEXTMENU_ITEMS_REMOVE_COMMENT = CONTEXTMENU_ITEMS_REMOVE_COMMENT;
var CONTEXTMENU_ITEMS_READ_ONLY_COMMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".readOnlyComment");
exports.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT = CONTEXTMENU_ITEMS_READ_ONLY_COMMENT;
var CONTEXTMENU_ITEMS_ALIGNMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align");
exports.CONTEXTMENU_ITEMS_ALIGNMENT = CONTEXTMENU_ITEMS_ALIGNMENT;
var CONTEXTMENU_ITEMS_ALIGNMENT_LEFT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.left");
exports.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT = CONTEXTMENU_ITEMS_ALIGNMENT_LEFT;
var CONTEXTMENU_ITEMS_ALIGNMENT_CENTER = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.center");
exports.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER = CONTEXTMENU_ITEMS_ALIGNMENT_CENTER;
var CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.right");
exports.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT = CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT;
var CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.justify");
exports.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY = CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY;
var CONTEXTMENU_ITEMS_ALIGNMENT_TOP = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.top");
exports.CONTEXTMENU_ITEMS_ALIGNMENT_TOP = CONTEXTMENU_ITEMS_ALIGNMENT_TOP;
var CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.middle");
exports.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE = CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE;
var CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.bottom");
exports.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM = CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM;
var CONTEXTMENU_ITEMS_BORDERS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders");
exports.CONTEXTMENU_ITEMS_BORDERS = CONTEXTMENU_ITEMS_BORDERS;
var CONTEXTMENU_ITEMS_BORDERS_TOP = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.top");
exports.CONTEXTMENU_ITEMS_BORDERS_TOP = CONTEXTMENU_ITEMS_BORDERS_TOP;
var CONTEXTMENU_ITEMS_BORDERS_RIGHT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.right");
exports.CONTEXTMENU_ITEMS_BORDERS_RIGHT = CONTEXTMENU_ITEMS_BORDERS_RIGHT;
var CONTEXTMENU_ITEMS_BORDERS_BOTTOM = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.bottom");
exports.CONTEXTMENU_ITEMS_BORDERS_BOTTOM = CONTEXTMENU_ITEMS_BORDERS_BOTTOM;
var CONTEXTMENU_ITEMS_BORDERS_LEFT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.left");
exports.CONTEXTMENU_ITEMS_BORDERS_LEFT = CONTEXTMENU_ITEMS_BORDERS_LEFT;
var CONTEXTMENU_ITEMS_REMOVE_BORDERS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.remove");
exports.CONTEXTMENU_ITEMS_REMOVE_BORDERS = CONTEXTMENU_ITEMS_REMOVE_BORDERS;
var CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".nestedHeaders.insertChildRow");
exports.CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD = CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD;
var CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".nestedHeaders.detachFromParent");
exports.CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD = CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD;
var CONTEXTMENU_ITEMS_HIDE_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".hideColumn");
exports.CONTEXTMENU_ITEMS_HIDE_COLUMN = CONTEXTMENU_ITEMS_HIDE_COLUMN;
var CONTEXTMENU_ITEMS_SHOW_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".showColumn");
exports.CONTEXTMENU_ITEMS_SHOW_COLUMN = CONTEXTMENU_ITEMS_SHOW_COLUMN;
var CONTEXTMENU_ITEMS_HIDE_ROW = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".hideRow");
exports.CONTEXTMENU_ITEMS_HIDE_ROW = CONTEXTMENU_ITEMS_HIDE_ROW;
var CONTEXTMENU_ITEMS_SHOW_ROW = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".showRow");
exports.CONTEXTMENU_ITEMS_SHOW_ROW = CONTEXTMENU_ITEMS_SHOW_ROW;
var FILTERS_NAMESPACE = 'Filters:';
exports.FILTERS_NAMESPACE = FILTERS_NAMESPACE;
var FILTERS_CONDITIONS_NAMESPACE = "".concat(FILTERS_NAMESPACE, "conditions");
exports.FILTERS_CONDITIONS_NAMESPACE = FILTERS_CONDITIONS_NAMESPACE;
var FILTERS_CONDITIONS_NONE = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".none");
exports.FILTERS_CONDITIONS_NONE = FILTERS_CONDITIONS_NONE;
var FILTERS_CONDITIONS_EMPTY = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isEmpty");
exports.FILTERS_CONDITIONS_EMPTY = FILTERS_CONDITIONS_EMPTY;
var FILTERS_CONDITIONS_NOT_EMPTY = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isNotEmpty");
exports.FILTERS_CONDITIONS_NOT_EMPTY = FILTERS_CONDITIONS_NOT_EMPTY;
var FILTERS_CONDITIONS_EQUAL = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isEqualTo");
exports.FILTERS_CONDITIONS_EQUAL = FILTERS_CONDITIONS_EQUAL;
var FILTERS_CONDITIONS_NOT_EQUAL = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isNotEqualTo");
exports.FILTERS_CONDITIONS_NOT_EQUAL = FILTERS_CONDITIONS_NOT_EQUAL;
var FILTERS_CONDITIONS_BEGINS_WITH = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".beginsWith");
exports.FILTERS_CONDITIONS_BEGINS_WITH = FILTERS_CONDITIONS_BEGINS_WITH;
var FILTERS_CONDITIONS_ENDS_WITH = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".endsWith");
exports.FILTERS_CONDITIONS_ENDS_WITH = FILTERS_CONDITIONS_ENDS_WITH;
var FILTERS_CONDITIONS_CONTAINS = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".contains");
exports.FILTERS_CONDITIONS_CONTAINS = FILTERS_CONDITIONS_CONTAINS;
var FILTERS_CONDITIONS_NOT_CONTAIN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".doesNotContain");
exports.FILTERS_CONDITIONS_NOT_CONTAIN = FILTERS_CONDITIONS_NOT_CONTAIN;
var FILTERS_CONDITIONS_BY_VALUE = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".byValue");
exports.FILTERS_CONDITIONS_BY_VALUE = FILTERS_CONDITIONS_BY_VALUE;
var FILTERS_CONDITIONS_GREATER_THAN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".greaterThan");
exports.FILTERS_CONDITIONS_GREATER_THAN = FILTERS_CONDITIONS_GREATER_THAN;
var FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".greaterThanOrEqualTo");
exports.FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL = FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL;
var FILTERS_CONDITIONS_LESS_THAN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".lessThan");
exports.FILTERS_CONDITIONS_LESS_THAN = FILTERS_CONDITIONS_LESS_THAN;
var FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".lessThanOrEqualTo");
exports.FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL = FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL;
var FILTERS_CONDITIONS_BETWEEN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isBetween");
exports.FILTERS_CONDITIONS_BETWEEN = FILTERS_CONDITIONS_BETWEEN;
var FILTERS_CONDITIONS_NOT_BETWEEN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isNotBetween");
exports.FILTERS_CONDITIONS_NOT_BETWEEN = FILTERS_CONDITIONS_NOT_BETWEEN;
var FILTERS_CONDITIONS_AFTER = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".after");
exports.FILTERS_CONDITIONS_AFTER = FILTERS_CONDITIONS_AFTER;
var FILTERS_CONDITIONS_BEFORE = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".before");
exports.FILTERS_CONDITIONS_BEFORE = FILTERS_CONDITIONS_BEFORE;
var FILTERS_CONDITIONS_TODAY = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".today");
exports.FILTERS_CONDITIONS_TODAY = FILTERS_CONDITIONS_TODAY;
var FILTERS_CONDITIONS_TOMORROW = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".tomorrow");
exports.FILTERS_CONDITIONS_TOMORROW = FILTERS_CONDITIONS_TOMORROW;
var FILTERS_CONDITIONS_YESTERDAY = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".yesterday");
exports.FILTERS_CONDITIONS_YESTERDAY = FILTERS_CONDITIONS_YESTERDAY;
var FILTERS_DIVS_FILTER_BY_CONDITION = "".concat(FILTERS_NAMESPACE, "labels.filterByCondition");
exports.FILTERS_DIVS_FILTER_BY_CONDITION = FILTERS_DIVS_FILTER_BY_CONDITION;
var FILTERS_DIVS_FILTER_BY_VALUE = "".concat(FILTERS_NAMESPACE, "labels.filterByValue");
exports.FILTERS_DIVS_FILTER_BY_VALUE = FILTERS_DIVS_FILTER_BY_VALUE;
var FILTERS_LABELS_CONJUNCTION = "".concat(FILTERS_NAMESPACE, "labels.conjunction");
exports.FILTERS_LABELS_CONJUNCTION = FILTERS_LABELS_CONJUNCTION;
var FILTERS_LABELS_DISJUNCTION = "".concat(FILTERS_NAMESPACE, "labels.disjunction");
exports.FILTERS_LABELS_DISJUNCTION = FILTERS_LABELS_DISJUNCTION;
var FILTERS_VALUES_BLANK_CELLS = "".concat(FILTERS_NAMESPACE, "values.blankCells");
exports.FILTERS_VALUES_BLANK_CELLS = FILTERS_VALUES_BLANK_CELLS;
var FILTERS_BUTTONS_SELECT_ALL = "".concat(FILTERS_NAMESPACE, "buttons.selectAll");
exports.FILTERS_BUTTONS_SELECT_ALL = FILTERS_BUTTONS_SELECT_ALL;
var FILTERS_BUTTONS_CLEAR = "".concat(FILTERS_NAMESPACE, "buttons.clear");
exports.FILTERS_BUTTONS_CLEAR = FILTERS_BUTTONS_CLEAR;
var FILTERS_BUTTONS_OK = "".concat(FILTERS_NAMESPACE, "buttons.ok");
exports.FILTERS_BUTTONS_OK = FILTERS_BUTTONS_OK;
var FILTERS_BUTTONS_CANCEL = "".concat(FILTERS_NAMESPACE, "buttons.cancel");
exports.FILTERS_BUTTONS_CANCEL = FILTERS_BUTTONS_CANCEL;
var FILTERS_BUTTONS_PLACEHOLDER_SEARCH = "".concat(FILTERS_NAMESPACE, "buttons.placeholder.search");
exports.FILTERS_BUTTONS_PLACEHOLDER_SEARCH = FILTERS_BUTTONS_PLACEHOLDER_SEARCH;
var FILTERS_BUTTONS_PLACEHOLDER_VALUE = "".concat(FILTERS_NAMESPACE, "buttons.placeholder.value");
exports.FILTERS_BUTTONS_PLACEHOLDER_VALUE = FILTERS_BUTTONS_PLACEHOLDER_VALUE;
var FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE = "".concat(FILTERS_NAMESPACE, "buttons.placeholder.secondValue");
exports.FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE = FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE;
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var charAt = __webpack_require__(153).charAt;
var InternalStateModule = __webpack_require__(87);
var defineIterator = __webpack_require__(151);
var STRING_ITERATOR = 'String Iterator';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
// `String.prototype[@@iterator]` method
// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
defineIterator(String, 'String', function (iterated) {
setInternalState(this, {
type: STRING_ITERATOR,
string: String(iterated),
index: 0
});
// `%StringIteratorPrototype%.next` method
// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
}, function next() {
var state = getInternalState(this);
var string = state.string;
var index = state.index;
var point;
if (index >= string.length) return { value: undefined, done: true };
point = charAt(string, index);
state.index += point.length;
return { value: point, done: false };
});
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var $indexOf = __webpack_require__(148).indexOf;
var sloppyArrayMethod = __webpack_require__(130);
var nativeIndexOf = [].indexOf;
var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
var SLOPPY_METHOD = sloppyArrayMethod('indexOf');
// `Array.prototype.indexOf` method
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
return NEGATIVE_ZERO
// convert -0 to +0
? nativeIndexOf.apply(this, arguments) || 0
: $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
}
});
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toIndexedObject = __webpack_require__(67);
var addToUnscopables = __webpack_require__(100);
var Iterators = __webpack_require__(103);
var InternalStateModule = __webpack_require__(87);
var defineIterator = __webpack_require__(151);
var ARRAY_ITERATOR = 'Array Iterator';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
// `Array.prototype.entries` method
// https://tc39.github.io/ecma262/#sec-array.prototype.entries
// `Array.prototype.keys` method
// https://tc39.github.io/ecma262/#sec-array.prototype.keys
// `Array.prototype.values` method
// https://tc39.github.io/ecma262/#sec-array.prototype.values
// `Array.prototype[@@iterator]` method
// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
// `CreateArrayIterator` internal method
// https://tc39.github.io/ecma262/#sec-createarrayiterator
module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
setInternalState(this, {
type: ARRAY_ITERATOR,
target: toIndexedObject(iterated), // target
index: 0, // next index
kind: kind // kind
});
// `%ArrayIteratorPrototype%.next` method
// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
}, function () {
var state = getInternalState(this);
var target = state.target;
var kind = state.kind;
var index = state.index++;
if (!target || index >= target.length) {
state.target = undefined;
return { value: undefined, done: true };
}
if (kind == 'keys') return { value: index, done: false };
if (kind == 'values') return { value: target[index], done: false };
return { value: [index, target[index]], done: false };
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values%
// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
Iterators.Arguments = Iterators.Array;
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
var getPrototypeOf = __webpack_require__(5);
var superPropBase = __webpack_require__(451);
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
module.exports = _get = Reflect.get;
} else {
module.exports = _get = function _get(target, property, receiver) {
var base = superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(receiver);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}
module.exports = _get;
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(37);
var DOMIterables = __webpack_require__(204);
var ArrayIteratorMethods = __webpack_require__(14);
var hide = __webpack_require__(68);
var wellKnownSymbol = __webpack_require__(34);
var ITERATOR = wellKnownSymbol('iterator');
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var ArrayValues = ArrayIteratorMethods.values;
for (var COLLECTION_NAME in DOMIterables) {
var Collection = global[COLLECTION_NAME];
var CollectionPrototype = Collection && Collection.prototype;
if (CollectionPrototype) {
// some Chrome versions have non-configurable methods on DOMTokenList
if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
hide(CollectionPrototype, ITERATOR, ArrayValues);
} catch (error) {
CollectionPrototype[ITERATOR] = ArrayValues;
}
if (!CollectionPrototype[TO_STRING_TAG]) hide(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
// some Chrome versions have non-configurable methods on DOMTokenList
if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
hide(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
} catch (error) {
CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
}
}
}
}
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var fails = __webpack_require__(28);
var isArray = __webpack_require__(129);
var isObject = __webpack_require__(43);
var toObject = __webpack_require__(61);
var toLength = __webpack_require__(54);
var createProperty = __webpack_require__(105);
var arraySpeciesCreate = __webpack_require__(159);
var arrayMethodHasSpeciesSupport = __webpack_require__(106);
var wellKnownSymbol = __webpack_require__(34);
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () {
var array = [];
array[IS_CONCAT_SPREADABLE] = false;
return array.concat()[0] !== array;
});
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
var isConcatSpreadable = function (O) {
if (!isObject(O)) return false;
var spreadable = O[IS_CONCAT_SPREADABLE];
return spreadable !== undefined ? !!spreadable : isArray(O);
};
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
// `Array.prototype.concat` method
// https://tc39.github.io/ecma262/#sec-array.prototype.concat
// with adding support of @@isConcatSpreadable and @@species
$({ target: 'Array', proto: true, forced: FORCED }, {
concat: function concat(arg) { // eslint-disable-line no-unused-vars
var O = toObject(this);
var A = arraySpeciesCreate(O, 0);
var n = 0;
var i, k, length, len, E;
for (i = -1, length = arguments.length; i < length; i++) {
E = i === -1 ? O : arguments[i];
if (isConcatSpreadable(E)) {
len = toLength(E.length);
if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
} else {
if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
createProperty(A, n++, E);
}
}
A.length = n;
return A;
}
});
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
var arrayWithHoles = __webpack_require__(218);
var iterableToArrayLimit = __webpack_require__(418);
var nonIterableRest = __webpack_require__(219);
function _slicedToArray(arr, i) {
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
}
module.exports = _slicedToArray;
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(9);
__webpack_require__(39);
__webpack_require__(40);
exports.__esModule = true;
exports.isNumeric = isNumeric;
exports.rangeEach = rangeEach;
exports.rangeEachReverse = rangeEachReverse;
exports.valueAccordingPercent = valueAccordingPercent;
var _typeof2 = _interopRequireDefault(__webpack_require__(45));
/**
* 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 = (0, _typeof2.default)(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|Function} rangeTo The number where finish iterate or function as a iteratee.
* @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;
}
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(14);
__webpack_require__(65);
__webpack_require__(9);
__webpack_require__(12);
__webpack_require__(23);
__webpack_require__(16);
exports.__esModule = true;
exports.registerPlugin = registerPlugin;
exports.getPlugin = getPlugin;
exports.getRegistredPluginNames = getRegistredPluginNames;
exports.getPluginName = getPluginName;
var _pluginHooks = _interopRequireDefault(__webpack_require__(44));
var _object = __webpack_require__(4);
var _string = __webpack_require__(76);
/**
* Utility to register plugins and common namespace for keeping reference to all plugins classes
*/
var registeredPlugins = new WeakMap();
/**
* Registers plugin under given name
*
* @param {String} pluginName
* @param {Function} PluginClass
*/
function registerPlugin(pluginName, PluginClass) {
var correctedPluginName = (0, _string.toUpperCaseFirst)(pluginName);
_pluginHooks.default.getSingleton().add('construct', function () {
if (!registeredPlugins.has(this)) {
registeredPlugins.set(this, {});
}
var holder = registeredPlugins.get(this);
if (!holder[correctedPluginName]) {
holder[correctedPluginName] = new PluginClass(this);
}
});
_pluginHooks.default.getSingleton().add('afterDestroy', function () {
if (registeredPlugins.has(this)) {
var pluginsHolder = registeredPlugins.get(this);
(0, _object.objectEach)(pluginsHolder, function (plugin) {
return plugin.destroy();
});
registeredPlugins.delete(this);
}
});
}
/**
* @param {Object} instance
* @param {String|Function} pluginName
* @returns {Function} pluginClass Returns plugin instance if exists or `undefined` if not exists.
*/
function getPlugin(instance, pluginName) {
if (typeof pluginName !== 'string') {
throw Error('Only strings can be passed as "plugin" parameter');
}
var _pluginName = (0, _string.toUpperCaseFirst)(pluginName);
if (!registeredPlugins.has(instance) || !registeredPlugins.get(instance)[_pluginName]) {
return void 0;
}
return registeredPlugins.get(instance)[_pluginName];
}
/**
* Get all registred plugins names for concrete Handsontable instance.
*
* @param {Object} hotInstance
* @returns {Array}
*/
function getRegistredPluginNames(hotInstance) {
return registeredPlugins.has(hotInstance) ? Object.keys(registeredPlugins.get(hotInstance)) : [];
}
/**
* Get plugin name.
*
* @param {Object} hotInstance
* @param {Object} plugin
* @returns {String|null}
*/
function getPluginName(hotInstance, plugin) {
var pluginName = null;
if (registeredPlugins.has(hotInstance)) {
(0, _object.objectEach)(registeredPlugins.get(hotInstance), function (pluginInstance, name) {
if (pluginInstance === plugin) {
pluginName = name;
}
});
}
return pluginName;
}
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(37);
var getOwnPropertyDescriptor = __webpack_require__(92).f;
var hide = __webpack_require__(68);
var redefine = __webpack_require__(69);
var setGlobal = __webpack_require__(147);
var copyConstructorProperties = __webpack_require__(188);
var isForced = __webpack_require__(125);
/*
options.target - name of the target object
options.global - target is the global object
options.stat - export as static methods of target
options.proto - export as prototype methods of target
options.real - real prototype method for the `pure` version
options.forced - export even if the native feature is available
options.bind - bind methods to the target, required for the `pure` version
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
options.unsafe - use the simple assignment of property instead of delete + defineProperty
options.sham - add a flag to not completely full polyfills
options.enumerable - export as enumerable property
options.noTargetGet - prevent calling a getter on target
*/
module.exports = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = global;
} else if (STATIC) {
target = global[TARGET] || setGlobal(TARGET, {});
} else {
target = (global[TARGET] || {}).prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contained in target
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty === typeof targetProperty) continue;
copyConstructorProperties(sourceProperty, targetProperty);
}
// add a flag to not completely full polyfills
if (options.sham || (targetProperty && targetProperty.sham)) {
hide(sourceProperty, 'sham', true);
}
// extend global
redefine(target, key, sourceProperty, options);
}
};
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(25);
__webpack_require__(13);
__webpack_require__(14);
__webpack_require__(35);
__webpack_require__(9);
__webpack_require__(12);
__webpack_require__(23);
__webpack_require__(16);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _object = __webpack_require__(4);
var _array = __webpack_require__(3);
var _translations = __webpack_require__(50);
var _plugins = __webpack_require__(20);
var privatePool = new WeakMap();
var initializedPlugins = null;
/**
* @util
*/
var BasePlugin =
/*#__PURE__*/
function () {
/**
* @param {Object} hotInstance Handsontable instance.
*/
function BasePlugin(hotInstance) {
var _this = this;
(0, _classCallCheck2.default)(this, BasePlugin);
/**
* Handsontable instance.
*
* @type {Core}
*/
(0, _object.defineGetter)(this, 'hot', hotInstance, {
writable: false
});
(0, _object.defineGetter)(this, 't', (0, _translations.getTranslator)(hotInstance), {
writable: false
});
(0, _object.defineGetter)(this, 'rowIndexMapper', (0, _translations.getTranslator)(hotInstance).getRowIndexMapper(), {
writable: false
});
(0, _object.defineGetter)(this, 'columnIndexMapper', (0, _translations.getTranslator)(hotInstance).getColumnIndexMapper(), {
writable: false
});
privatePool.set(this, {
hooks: {}
});
initializedPlugins = null;
this.pluginName = null;
this.pluginsInitializedCallbacks = [];
this.isPluginsReady = false;
this.enabled = false;
this.initialized = false;
this.hot.addHook('afterPluginsInitialized', function () {
return _this.onAfterPluginsInitialized();
});
this.hot.addHook('afterUpdateSettings', function (newSettings) {
return _this.onUpdateSettings(newSettings);
});
this.hot.addHook('beforeInit', function () {
return _this.init();
});
}
(0, _createClass2.default)(BasePlugin, [{
key: "init",
value: function init() {
this.pluginName = (0, _plugins.getPluginName)(this.hot, this);
if (this.isEnabled && this.isEnabled()) {
this.enablePlugin();
}
if (!initializedPlugins) {
initializedPlugins = (0, _plugins.getRegistredPluginNames)(this.hot);
}
if (initializedPlugins.indexOf(this.pluginName) >= 0) {
initializedPlugins.splice(initializedPlugins.indexOf(this.pluginName), 1);
}
if (!initializedPlugins.length) {
this.hot.runHooks('afterPluginsInitialized');
}
this.initialized = true;
}
/**
* Enable plugin for this Handsontable instance.
*/
}, {
key: "enablePlugin",
value: function enablePlugin() {
this.enabled = true;
}
/**
* Disable plugin for this Handsontable instance.
*/
}, {
key: "disablePlugin",
value: function disablePlugin() {
if (this.eventManager) {
this.eventManager.clear();
}
this.clearHooks();
this.enabled = false;
}
/**
* Add listener to plugin hooks system.
*
* @param {String} name
* @param {Function} callback
*/
}, {
key: "addHook",
value: function addHook(name, callback) {
privatePool.get(this).hooks[name] = privatePool.get(this).hooks[name] || [];
var hooks = privatePool.get(this).hooks[name];
this.hot.addHook(name, callback);
hooks.push(callback);
privatePool.get(this).hooks[name] = hooks;
}
/**
* Remove all hooks listeners by hook name.
*
* @param {String} name
*/
}, {
key: "removeHooks",
value: function removeHooks(name) {
var _this2 = this;
(0, _array.arrayEach)(privatePool.get(this).hooks[name] || [], function (callback) {
_this2.hot.removeHook(name, callback);
});
}
/**
* Clear all hooks.
*/
}, {
key: "clearHooks",
value: function clearHooks() {
var _this3 = this;
var hooks = privatePool.get(this).hooks;
(0, _object.objectEach)(hooks, function (callbacks, name) {
return _this3.removeHooks(name);
});
hooks.length = 0;
}
/**
* Register function which will be immediately called after all plugins initialized.
*
* @param {Function} callback
*/
}, {
key: "callOnPluginsReady",
value: function callOnPluginsReady(callback) {
if (this.isPluginsReady) {
callback();
} else {
this.pluginsInitializedCallbacks.push(callback);
}
}
/**
* On after plugins initialized listener.
*
* @private
*/
}, {
key: "onAfterPluginsInitialized",
value: function onAfterPluginsInitialized() {
(0, _array.arrayEach)(this.pluginsInitializedCallbacks, function (callback) {
return callback();
});
this.pluginsInitializedCallbacks.length = 0;
this.isPluginsReady = true;
}
/**
* On update settings listener.
*
* @private
*/
}, {
key: "onUpdateSettings",
value: function onUpdateSettings() {
if (this.isEnabled) {
if (this.enabled && !this.isEnabled()) {
this.disablePlugin();
}
if (!this.enabled && this.isEnabled()) {
this.enablePlugin();
}
if (this.enabled && this.isEnabled()) {
this.updatePlugin();
}
}
}
/**
* Updates the plugin to use the latest options you have specified.
*
* @private
*/
}, {
key: "updatePlugin",
value: function updatePlugin() {}
/**
* Destroy plugin.
*/
}, {
key: "destroy",
value: function destroy() {
var _this4 = this;
if (this.eventManager) {
this.eventManager.destroy();
}
this.clearHooks();
(0, _object.objectEach)(this, function (value, property) {
if (['hot', 't', 'rowIndexMapper', 'columnIndexMapper'].includes(property) === false) {
_this4[property] = null;
}
});
delete this.t;
delete this.hot;
}
}]);
return BasePlugin;
}();
var _default = BasePlugin;
exports.default = _default;
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var global = __webpack_require__(37);
var redefineAll = __webpack_require__(154);
var InternalMetadataModule = __webpack_require__(127);
var collection = __webpack_require__(128);
var collectionWeak = __webpack_require__(203);
var isObject = __webpack_require__(43);
var enforceIternalState = __webpack_require__(87).enforce;
var NATIVE_WEAK_MAP = __webpack_require__(187);
var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
var isExtensible = Object.isExtensible;
var InternalWeakMap;
var wrapper = function (get) {
return function WeakMap() {
return get(this, arguments.length ? arguments[0] : undefined);
};
};
// `WeakMap` constructor
// https://tc39.github.io/ecma262/#sec-weakmap-constructor
var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak, true, true);
// IE11 WeakMap frozen keys fix
// We can't use feature detection because it crash some old IE builds
// https://github.com/zloirock/core-js/issues/485
if (NATIVE_WEAK_MAP && IS_IE11) {
InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
InternalMetadataModule.REQUIRED = true;
var WeakMapPrototype = $WeakMap.prototype;
var nativeDelete = WeakMapPrototype['delete'];
var nativeHas = WeakMapPrototype.has;
var nativeGet = WeakMapPrototype.get;
var nativeSet = WeakMapPrototype.set;
redefineAll(WeakMapPrototype, {
'delete': function (key) {
if (isObject(key) && !isExtensible(key)) {
var state = enforceIternalState(this);
if (!state.frozen) state.frozen = new InternalWeakMap();
return nativeDelete.call(this, key) || state.frozen['delete'](key);
} return nativeDelete.call(this, key);
},
has: function has(key) {
if (isObject(key) && !isExtensible(key)) {
var state = enforceIternalState(this);
if (!state.frozen) state.frozen = new InternalWeakMap();
return nativeHas.call(this, key) || state.frozen.has(key);
} return nativeHas.call(this, key);
},
get: function get(key) {
if (isObject(key) && !isExtensible(key)) {
var state = enforceIternalState(this);
if (!state.frozen) state.frozen = new InternalWeakMap();
return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key);
} return nativeGet.call(this, key);
},
set: function set(key, value) {
if (isObject(key) && !isExtensible(key)) {
var state = enforceIternalState(this);
if (!state.frozen) state.frozen = new InternalWeakMap();
nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value);
} else nativeSet.call(this, key, value);
return this;
}
});
}
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(35);
exports.__esModule = true;
exports.getListenersCounter = getListenersCounter;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _element = __webpack_require__(8);
var _object = __webpack_require__(4);
var _feature = __webpack_require__(79);
var _event = __webpack_require__(31);
/**
* 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 =
/*#__PURE__*/
function () {
/**
* @param {Object} [context=null]
* @private
*/
function EventManager() {
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
(0, _classCallCheck2.default)(this, EventManager);
this.context = context || this;
if (!this.context.eventListeners) {
this.context.eventListeners = []; // TODO perf It would be more performant if every instance of EventManager tracked its own listeners only
}
}
/**
* 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.
* @param {AddEventListenerOptions|Boolean} [options] Listener options if object or useCapture if boolean.
* @returns {Function} Returns function which you can easily call to remove that event
*/
(0, _createClass2.default)(EventManager, [{
key: "addEventListener",
value: function addEventListener(element, eventName, callback) {
var _this = this;
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var context = this.context;
function callbackProxy(event) {
callback.call(this, extendEvent(context, event));
}
if (typeof options !== 'boolean' && !(0, _feature.isPassiveEventSupported)()) {
options = false;
}
this.context.eventListeners.push({
element: element,
event: eventName,
callback: callback,
callbackProxy: callbackProxy,
options: options,
eventManager: this
});
element.addEventListener(eventName, callbackProxy, options);
listenersCounter += 1;
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.
* @param {Boolean} [onlyOwnEvents] Whether whould remove only events registered using this instance of EventManager
*/
}, {
key: "removeEventListener",
value: function removeEventListener(element, eventName, callback) {
var onlyOwnEvents = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var len = this.context.eventListeners.length;
var tmpEvent;
while (len) {
len -= 1;
tmpEvent = this.context.eventListeners[len];
if (tmpEvent.event === eventName && tmpEvent.element === element) {
if (callback && callback !== tmpEvent.callback) {
/* eslint-disable no-continue */
continue;
}
if (onlyOwnEvents && tmpEvent.eventManager !== this) {
continue;
}
this.context.eventListeners.splice(len, 1);
tmpEvent.element.removeEventListener(tmpEvent.event, tmpEvent.callbackProxy, tmpEvent.options);
listenersCounter -= 1;
}
}
}
/**
* Clear all previously registered events.
*
* @private
* @since 0.15.0-beta3
* @param {Boolean} [onlyOwnEvents] Whether whould remove only events registered using this instance of EventManager
*/
}, {
key: "clearEvents",
value: function clearEvents() {
var onlyOwnEvents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (!this.context) {
return;
}
var len = this.context.eventListeners.length;
while (len) {
len -= 1;
var event = this.context.eventListeners[len];
if (event) {
this.removeEventListener(event.element, event.event, event.callback, onlyOwnEvents);
}
}
}
/**
* Clear all previously registered events.
*/
}, {
key: "clear",
value: function clear() {
this.clearEvents();
}
/**
* Destroy instance of EventManager, clearing all events of the context
*/
}, {
key: "destroy",
value: function destroy() {
this.clearEvents();
this.context = null;
}
/**
* Destroy instance of EventManager, clearing only the own events
*/
}, {
key: "destroyWithOwnEventsOnly",
value: function destroyWithOwnEventsOnly() {
this.clearEvents(true);
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 rootDocument = element.document;
var rootWindow = element;
if (!rootDocument) {
rootDocument = element.ownerDocument ? element.ownerDocument : element;
rootWindow = rootDocument.defaultView;
}
var options = {
bubbles: true,
cancelable: eventName !== 'mousemove',
view: rootWindow,
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 (rootDocument.createEvent) {
event = rootDocument.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 || rootDocument.body.parentNode);
} else {
event = rootDocument.createEventObject();
}
if (element.dispatchEvent) {
element.dispatchEvent(event);
} else {
element.fireEvent("on".concat(eventName), event);
}
}
}]);
return EventManager;
}();
/**
* @param {Object} context
* @param {Event} event
* @private
* @returns {*}
*/
function extendEvent(context, event) {
var componentName = 'HOT-TABLE';
var isHotTableSpotted;
var fromElement;
var realTarget;
var target;
var len;
event.isTargetWebComponent = false;
event.realTarget = event.target;
var nativeStopImmediatePropagation = event.stopImmediatePropagation;
event.stopImmediatePropagation = function () {
nativeStopImmediatePropagation.apply(this);
(0, _event.stopImmediatePropagation)(this);
};
if (!EventManager.isHotTableEnv) {
return event;
} // eslint-disable-next-line no-param-reassign
event = (0, _element.polymerWrap)(event);
len = event.path ? event.path.length : 0;
while (len) {
len -= 1;
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 ((0, _object.hasOwnProperty)(context, 'hot') || context.isHotTableEnv || context.wtTable) {
// Polymer doesn't support `event.target` property properly we must emulate it ourselves
if ((0, _object.hasOwnProperty)(context, 'hot')) {
// Custom element
fromElement = context.hot ? context.hot.view.wt.wtTable.TABLE : null;
} else if (context.isHotTableEnv) {
// Handsontable.Core
fromElement = context.view.activeWt.wtTable.TABLE.parentNode.parentNode;
} else if (context.wtTable) {
// Walkontable
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;
}
var _default = EventManager;
exports.default = _default;
function getListenersCounter() {
return listenersCounter;
}
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var $includes = __webpack_require__(148).includes;
var addToUnscopables = __webpack_require__(100);
// `Array.prototype.includes` method
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
$({ target: 'Array', proto: true }, {
includes: function includes(el /* , fromIndex = 0 */) {
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
}
});
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('includes');
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(10);
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.Renderer = void 0;
var _viewportColumns = _interopRequireDefault(__webpack_require__(211));
exports.ViewportColumnsCalculator = _viewportColumns.default;
var _viewportRows = _interopRequireDefault(__webpack_require__(212));
exports.ViewportRowsCalculator = _viewportRows.default;
var _coords = _interopRequireDefault(__webpack_require__(108));
exports.CellCoords = _coords.default;
var _range = _interopRequireDefault(__webpack_require__(213));
exports.CellRange = _range.default;
var _column = _interopRequireDefault(__webpack_require__(214));
exports.ColumnFilter = _column.default;
var _row = _interopRequireDefault(__webpack_require__(215));
exports.RowFilter = _row.default;
var _master = _interopRequireDefault(__webpack_require__(216));
exports.MasterTable = _master.default;
var _left = _interopRequireDefault(__webpack_require__(438));
exports.LeftOverlay = _left.default;
var _top = _interopRequireDefault(__webpack_require__(440));
exports.TopOverlay = _top.default;
var _topLeftCorner = _interopRequireDefault(__webpack_require__(442));
exports.TopLeftCornerOverlay = _topLeftCorner.default;
var _bottom = _interopRequireDefault(__webpack_require__(444));
exports.BottomOverlay = _bottom.default;
var _bottomLeftCorner = _interopRequireDefault(__webpack_require__(446));
exports.BottomLeftCornerOverlay = _bottomLeftCorner.default;
var _border = _interopRequireDefault(__webpack_require__(353));
exports.Border = _border.default;
var _core = _interopRequireDefault(__webpack_require__(344));
exports.default = _core.default;
exports.Core = _core.default;
var _event = _interopRequireDefault(__webpack_require__(345));
exports.Event = _event.default;
var _overlays = _interopRequireDefault(__webpack_require__(346));
exports.Overlays = _overlays.default;
var _scroll = _interopRequireDefault(__webpack_require__(347));
exports.Scroll = _scroll.default;
var _selection = _interopRequireDefault(__webpack_require__(448));
exports.Selection = _selection.default;
var _settings = _interopRequireDefault(__webpack_require__(348));
exports.Settings = _settings.default;
var Renderer = _interopRequireWildcard(__webpack_require__(220));
exports.Renderer = Renderer;
var _orderView = __webpack_require__(136);
exports.OrderView = _orderView.OrderView;
exports.SharedOrderView = _orderView.SharedOrderView;
var _viewport = _interopRequireDefault(__webpack_require__(349));
exports.Viewport = _viewport.default;
var _eventManager = __webpack_require__(24);
exports.getListenersCounter = _eventManager.getListenersCounter;
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(9);
__webpack_require__(39);
__webpack_require__(427);
__webpack_require__(223);
__webpack_require__(40);
__webpack_require__(49);
exports.__esModule = true;
exports.stringify = stringify;
exports.isDefined = isDefined;
exports.isUndefined = isUndefined;
exports.isEmpty = isEmpty;
exports.isRegExp = isRegExp;
exports._injectProductInfo = _injectProductInfo;
var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(71));
var _typeof2 = _interopRequireDefault(__webpack_require__(45));
var _moment = _interopRequireDefault(__webpack_require__(64));
var _templateLiteralTag = __webpack_require__(72);
function _templateObject6() {
var data = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable is missing. Use your purchased key to activate the product. \n Alternatively, you can activate Handsontable to use for non-commercial purposes by \n passing the key: 'non-commercial-and-evaluation'. \n Read more about it in \n the documentation or contact us at support@handsontable.com."], ["\n The license key for Handsontable is missing. Use your purchased key to activate the product.\\x20\n Alternatively, you can activate Handsontable to use for non-commercial purposes by\\x20\n passing the key: 'non-commercial-and-evaluation'.\\x20\n Read more about it in\\x20\n the documentation or contact us at support@handsontable.com."]);
_templateObject6 = function _templateObject6() {
return data;
};
return data;
}
function _templateObject5() {
var data = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable expired on ", ", and is not valid for the installed \n version ", ". Renew your \n license key or downgrade to a version released prior to ", ". If you need any \n help, contact us at sales@handsontable.com."], ["\n The license key for Handsontable expired on ", ", and is not valid for the installed\\x20\n version ", ". Renew your\\x20\n license key or downgrade to a version released prior to ", ". If you need any\\x20\n help, contact us at sales@handsontable.com."]);
_templateObject5 = function _templateObject5() {
return data;
};
return data;
}
function _templateObject4() {
var data = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable is invalid. \n Read more on how to \n install it properly or contact us at support@handsontable.com."], ["\n The license key for Handsontable is invalid.\\x20\n Read more on how to\\x20\n install it properly or contact us at support@handsontable.com."]);
_templateObject4 = function _templateObject4() {
return data;
};
return data;
}
function _templateObject3() {
var data = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable is missing. Use your purchased key to activate the product. \n Alternatively, you can activate Handsontable to use for non-commercial purposes by \n passing the key: 'non-commercial-and-evaluation'. If you need any help, contact \n us at support@handsontable.com."], ["\n The license key for Handsontable is missing. Use your purchased key to activate the product.\\x20\n Alternatively, you can activate Handsontable to use for non-commercial purposes by\\x20\n passing the key: 'non-commercial-and-evaluation'. If you need any help, contact\\x20\n us at support@handsontable.com."]);
_templateObject3 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2() {
var data = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable expired on ", ", and is not valid for the installed \n version ", ". Renew your license key at handsontable.com or downgrade to a version released prior \n to ", ". If you need any help, contact us at sales@handsontable.com."], ["\n The license key for Handsontable expired on ", ", and is not valid for the installed\\x20\n version ", ". Renew your license key at handsontable.com or downgrade to a version released prior\\x20\n to ", ". If you need any help, contact us at sales@handsontable.com."]);
_templateObject2 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject() {
var data = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable is invalid. \n If you need any help, contact us at support@handsontable.com."], ["\n The license key for Handsontable is invalid.\\x20\n If you need any help, contact us at support@handsontable.com."]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
/**
* Converts any value to string.
*
* @param {*} value
* @returns {String}
*/
function stringify(value) {
var result;
switch ((0, _typeof2.default)(value)) {
case 'string':
case 'number':
result = "".concat(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]';
}
/* eslint-disable */
var _m = '\x6C\x65\x6E\x67\x74\x68';
var _hd = function _hd(v) {
return parseInt(v, 16);
};
var _pi = function _pi(v) {
return parseInt(v, 10);
};
var _ss = function _ss(v, s, l) {
return v['\x73\x75\x62\x73\x74\x72'](s, l);
};
var _cp = function _cp(v) {
return v['\x63\x6F\x64\x65\x50\x6F\x69\x6E\x74\x41\x74'](0) - 65;
};
var _norm = function _norm(v) {
return "".concat(v).replace(/\-/g, '');
};
var _extractTime = function _extractTime(v) {
return _hd(_ss(_norm(v), _hd('12'), _cp('\x46'))) / (_hd(_ss(_norm(v), _cp('\x42'), ~~![][_m])) || 9);
};
var _ignored = function _ignored() {
return typeof location !== 'undefined' && /^([a-z0-9\-]+\.)?\x68\x61\x6E\x64\x73\x6F\x6E\x74\x61\x62\x6C\x65\x2E\x63\x6F\x6D$/i.test(location.host);
};
var _notified = false;
var consoleMessages = {
invalid: function invalid() {
return (0, _templateLiteralTag.toSingleLine)(_templateObject());
},
expired: function expired(_ref) {
var keyValidityDate = _ref.keyValidityDate,
hotVersion = _ref.hotVersion;
return (0, _templateLiteralTag.toSingleLine)(_templateObject2(), keyValidityDate, hotVersion, keyValidityDate);
},
missing: function missing() {
return (0, _templateLiteralTag.toSingleLine)(_templateObject3());
},
non_commercial: function non_commercial() {
return '';
}
};
var domMessages = {
invalid: function invalid() {
return (0, _templateLiteralTag.toSingleLine)(_templateObject4());
},
expired: function expired(_ref2) {
var keyValidityDate = _ref2.keyValidityDate,
hotVersion = _ref2.hotVersion;
return (0, _templateLiteralTag.toSingleLine)(_templateObject5(), keyValidityDate, hotVersion, keyValidityDate);
},
missing: function missing() {
return (0, _templateLiteralTag.toSingleLine)(_templateObject6());
},
non_commercial: function non_commercial() {
return '';
}
};
function _injectProductInfo(key, element) {
var hasValidType = !isEmpty(key);
var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
var hotVersion = "7.1.1";
var keyValidityDate;
var consoleMessageState = 'invalid';
var domMessageState = 'invalid';
key = _norm(key || '');
var schemaValidity = _checkKeySchema(key);
if (hasValidType || isNonCommercial || schemaValidity) {
if (schemaValidity) {
var releaseDate = (0, _moment.default)("12/08/2019", 'DD/MM/YYYY');
var releaseDays = Math.floor(releaseDate.toDate().getTime() / 8.64e7);
var keyValidityDays = _extractTime(key);
keyValidityDate = (0, _moment.default)((keyValidityDays + 1) * 8.64e7, 'x').format('MMMM DD, YYYY');
if (releaseDays > keyValidityDays) {
var daysAfterRelease = (0, _moment.default)().diff(releaseDate, 'days');
consoleMessageState = daysAfterRelease <= 1 ? 'valid' : 'expired';
domMessageState = daysAfterRelease <= 15 ? 'valid' : 'expired';
} else {
consoleMessageState = 'valid';
domMessageState = 'valid';
}
} else if (isNonCommercial) {
consoleMessageState = 'non_commercial';
domMessageState = 'valid';
} else {
consoleMessageState = 'invalid';
domMessageState = 'invalid';
}
} else {
consoleMessageState = 'missing';
domMessageState = 'missing';
}
if (_ignored()) {
consoleMessageState = 'valid';
domMessageState = 'valid';
}
if (!_notified && consoleMessageState !== 'valid') {
var message = consoleMessages[consoleMessageState]({
keyValidityDate: keyValidityDate,
hotVersion: hotVersion
});
if (message) {
console[consoleMessageState === 'non_commercial' ? 'info' : 'warn'](consoleMessages[consoleMessageState]({
keyValidityDate: keyValidityDate,
hotVersion: hotVersion
}));
}
_notified = true;
}
if (domMessageState !== 'valid' && element.parentNode) {
var _message = domMessages[domMessageState]({
keyValidityDate: keyValidityDate,
hotVersion: hotVersion
});
if (_message) {
var messageNode = document.createElement('div');
messageNode.id = 'hot-display-license-info';
messageNode.innerHTML = domMessages[domMessageState]({
keyValidityDate: keyValidityDate,
hotVersion: hotVersion
});
element.parentNode.insertBefore(messageNode, element.nextSibling);
}
}
}
function _checkKeySchema(v) {
var z = [][_m];
var p = z;
if (v[_m] !== _cp('\x5A')) {
return false;
}
for (var c = '', i = '\x42\x3C\x48\x34\x50\x2B'.split(''), j = _cp(i.shift()); j; j = _cp(i.shift() || 'A')) {
--j < ''[_m] ? p = p | (_pi("".concat(_pi(_hd(c) + (_hd(_ss(v, Math.abs(j), 2)) + []).padStart(2, '0')))) % 97 || 2) >> 1 : c = _ss(v, j, !j ? 6 : i[_m] === 1 ? 9 : 8);
}
return p === z;
}
/* eslint-enable */
/***/ }),
/* 28 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(17);
exports.__esModule = true;
exports.getCondition = getCondition;
exports.getConditionDescriptor = getConditionDescriptor;
exports.registerCondition = registerCondition;
exports.conditions = void 0;
var conditions = {};
/**
* Get condition closure with pre-bound arguments.
*
* @param {String} name Condition name.
* @param {Array} args Condition arguments.
* @returns {Function}
*/
exports.conditions = conditions;
function getCondition(name, args) {
if (!conditions[name]) {
throw Error("Filter condition \"".concat(name, "\" does not exist."));
}
var _conditions$name = conditions[name],
condition = _conditions$name.condition,
descriptor = _conditions$name.descriptor;
var conditionArguments = args;
if (descriptor.inputValuesDecorator) {
conditionArguments = descriptor.inputValuesDecorator(conditionArguments);
}
return function (dataRow) {
return condition.apply(dataRow.meta.instance, [].concat([dataRow], [conditionArguments]));
};
}
/**
* Get condition object descriptor which defines some additional informations about this condition.
*
* @param {String} name Condition name.
* @returns {Object}
*/
function getConditionDescriptor(name) {
if (!conditions[name]) {
throw Error("Filter condition \"".concat(name, "\" does not exist."));
}
return conditions[name].descriptor;
}
/**
* Condition registerer.
*
* @param {String} name Condition name.
* @param {Function} condition Condition function
* @param {Object} descriptor Condition descriptor
*/
function registerCondition(name, condition, descriptor) {
descriptor.key = name;
conditions[name] = {
condition: condition,
descriptor: descriptor
};
}
/***/ }),
/* 30 */
/***/ (function(module, exports) {
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
module.exports = _assertThisInitialized;
/***/ }),
/* 31 */
/***/ (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__(8);
/**
* 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;
}
var rootWindow = event.target.ownerDocument.defaultView;
return event.clientX + (0, _element.getWindowScrollLeft)(rootWindow);
}
/**
* 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;
}
var rootWindow = event.target.ownerDocument.defaultView;
return event.clientY + (0, _element.getWindowScrollTop)(rootWindow);
}
/**
* 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;
}
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var notARegExp = __webpack_require__(165);
var requireObjectCoercible = __webpack_require__(51);
var correctIsRegExpLogic = __webpack_require__(166);
// `String.prototype.includes` method
// https://tc39.github.io/ecma262/#sec-string.prototype.includes
$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
includes: function includes(searchString /* , position = 0 */) {
return !!~String(requireObjectCoercible(this))
.indexOf(notARegExp(searchString), arguments.length > 1 ? arguments[1] : undefined);
}
});
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(21);
var global = __webpack_require__(37);
var userAgent = __webpack_require__(217);
var slice = [].slice;
var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
var wrap = function (scheduler) {
return function (handler, timeout /* , ...arguments */) {
var boundArgs = arguments.length > 2;
var args = boundArgs ? slice.call(arguments, 2) : undefined;
return scheduler(boundArgs ? function () {
// eslint-disable-next-line no-new-func
(typeof handler == 'function' ? handler : Function(handler)).apply(this, args);
} : handler, timeout);
};
};
// ie9- setTimeout & setInterval additional parameters fix
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
$({ global: true, bind: true, forced: MSIE }, {
// `setTimeout` method
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
setTimeout: wrap(global.setTimeout),
// `setInterval` method
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
setInterval: wrap(global.setInterval)
});
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(37);
var shared = __webpack_require__(97);
var uid = __webpack_require__(122);
var NATIVE_SYMBOL = __webpack_require__(193);
var Symbol = global.Symbol;
var store = shared('wks');
module.exports = function (name) {
return store[name] || (store[name] = NATIVE_SYMBOL && Symbol[name]
|| (NATIVE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var toAbsoluteIndex = __webpack_require__(124);
var toInteger = __webpack_require__(88);
var toLength = __webpack_require__(54);
var toObject = __webpack_require__(61);
var arraySpeciesCreate = __webpack_require__(159);
var createProperty = __webpack_require__(105);
var arrayMethodHasSpeciesSupport = __webpack_require__(106);
var max = Math.max;
var min = Math.min;
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
// `Array.prototype.splice` method
// https://tc39.github.io/ecma262/#sec-array.prototype.splice
// with adding support of @@species
$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, {
splice: function splice(start, deleteCount /* , ...items */) {
var O = toObject(this);
var len = toLength(O.length);
var actualStart = toAbsoluteIndex(start, len);
var argumentsLength = arguments.length;
var insertCount, actualDeleteCount, A, k, from, to;
if (argumentsLength === 0) {
insertCount = actualDeleteCount = 0;
} else if (argumentsLength === 1) {
insertCount = 0;
actualDeleteCount = len - actualStart;
} else {
insertCount = argumentsLength - 2;
actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
}
if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
}
A = arraySpeciesCreate(O, actualDeleteCount);
for (k = 0; k < actualDeleteCount; k++) {
from = actualStart + k;
if (from in O) createProperty(A, k, O[from]);
}
A.length = actualDeleteCount;
if (insertCount < actualDeleteCount) {
for (k = actualStart; k < len - actualDeleteCount; k++) {
from = k + actualDeleteCount;
to = k + insertCount;
if (from in O) O[to] = O[from];
else delete O[to];
}
for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
} else if (insertCount > actualDeleteCount) {
for (k = len - actualDeleteCount; k > actualStart; k--) {
from = k + actualDeleteCount - 1;
to = k + insertCount - 1;
if (from in O) O[to] = O[from];
else delete O[to];
}
}
for (k = 0; k < insertCount; k++) {
O[k + actualStart] = arguments[k + 2];
}
O.length = len - actualDeleteCount + insertCount;
return A;
}
});
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var isObject = __webpack_require__(43);
var isArray = __webpack_require__(129);
var toAbsoluteIndex = __webpack_require__(124);
var toLength = __webpack_require__(54);
var toIndexedObject = __webpack_require__(67);
var createProperty = __webpack_require__(105);
var arrayMethodHasSpeciesSupport = __webpack_require__(106);
var wellKnownSymbol = __webpack_require__(34);
var SPECIES = wellKnownSymbol('species');
var nativeSlice = [].slice;
var max = Math.max;
// `Array.prototype.slice` method
// https://tc39.github.io/ecma262/#sec-array.prototype.slice
// fallback for not array-like ES3 strings and DOM objects
$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
slice: function slice(start, end) {
var O = toIndexedObject(this);
var length = toLength(O.length);
var k = toAbsoluteIndex(start, length);
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
// inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
var Constructor, result, n;
if (isArray(O)) {
Constructor = O.constructor;
// cross-realm fallback
if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
Constructor = undefined;
} else if (isObject(Constructor)) {
Constructor = Constructor[SPECIES];
if (Constructor === null) Constructor = undefined;
}
if (Constructor === Array || Constructor === undefined) {
return nativeSlice.call(O, k, fin);
}
}
result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
result.length = n;
return result;
}
});
/***/ }),
/* 37 */
/***/ (function(module, exports) {
var O = 'object';
var check = function (it) {
return it && it.Math == Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
module.exports =
// eslint-disable-next-line no-undef
check(typeof globalThis == O && globalThis) ||
check(typeof window == O && window) ||
check(typeof self == O && self) ||
check(typeof global == O && global) ||
// eslint-disable-next-line no-new-func
Function('return this')();
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
var arrayWithoutHoles = __webpack_require__(413);
var iterableToArray = __webpack_require__(207);
var nonIterableSpread = __webpack_require__(414);
function _toConsumableArray(arr) {
return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
}
module.exports = _toConsumableArray;
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var redefine = __webpack_require__(69);
var anObject = __webpack_require__(47);
var fails = __webpack_require__(28);
var flags = __webpack_require__(160);
var TO_STRING = 'toString';
var RegExpPrototype = RegExp.prototype;
var nativeToString = RegExpPrototype[TO_STRING];
var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
// FF44- RegExp#toString has a wrong name
var INCORRECT_NAME = nativeToString.name != TO_STRING;
// `RegExp.prototype.toString` method
// https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
if (NOT_GENERIC || INCORRECT_NAME) {
redefine(RegExp.prototype, TO_STRING, function toString() {
var R = anObject(this);
var p = String(R.source);
var rf = R.flags;
var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
return '/' + p + '/' + f;
}, { unsafe: true });
}
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fixRegExpWellKnownSymbolLogic = __webpack_require__(131);
var anObject = __webpack_require__(47);
var toObject = __webpack_require__(61);
var toLength = __webpack_require__(54);
var toInteger = __webpack_require__(88);
var requireObjectCoercible = __webpack_require__(51);
var advanceStringIndex = __webpack_require__(163);
var regExpExec = __webpack_require__(132);
var max = Math.max;
var min = Math.min;
var floor = Math.floor;
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
var maybeToString = function (it) {
return it === undefined ? it : String(it);
};
// @@replace logic
fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
return [
// `String.prototype.replace` method
// https://tc39.github.io/ecma262/#sec-string.prototype.replace
function replace(searchValue, replaceValue) {
var O = requireObjectCoercible(this);
var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
return replacer !== undefined
? replacer.call(searchValue, O, replaceValue)
: nativeReplace.call(String(O), searchValue, replaceValue);
},
// `RegExp.prototype[@@replace]` method
// https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
function (regexp, replaceValue) {
var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
if (res.done) return res.value;
var rx = anObject(regexp);
var S = String(this);
var functionalReplace = typeof replaceValue === 'function';
if (!functionalReplace) replaceValue = String(replaceValue);
var global = rx.global;
if (global) {
var fullUnicode = rx.unicode;
rx.lastIndex = 0;
}
var results = [];
while (true) {
var result = regExpExec(rx, S);
if (result === null) break;
results.push(result);
if (!global) break;
var matchStr = String(result[0]);
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
}
var accumulatedResult = '';
var nextSourcePosition = 0;
for (var i = 0; i < results.length; i++) {
result = results[i];
var matched = String(result[0]);
var position = max(min(toInteger(result.index), S.length), 0);
var captures = [];
// NOTE: This is equivalent to
// captures = result.slice(1).map(maybeToString)
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
var namedCaptures = result.groups;
if (functionalReplace) {
var replacerArgs = [matched].concat(captures, position, S);
if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
var replacement = String(replaceValue.apply(undefined, replacerArgs));
} else {
replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
}
if (position >= nextSourcePosition) {
accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
nextSourcePosition = position + matched.length;
}
}
return accumulatedResult + S.slice(nextSourcePosition);
}
];
// https://tc39.github.io/ecma262/#sec-getsubstitution
function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
var tailPos = position + matched.length;
var m = captures.length;
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
if (namedCaptures !== undefined) {
namedCaptures = toObject(namedCaptures);
symbols = SUBSTITUTION_SYMBOLS;
}
return nativeReplace.call(replacement, symbols, function (match, ch) {
var capture;
switch (ch.charAt(0)) {
case '$': return '$';
case '&': return matched;
case '`': return str.slice(0, position);
case "'": return str.slice(tailPos);
case '<':
capture = namedCaptures[ch.slice(1, -1)];
break;
default: // \d\d?
var n = +ch;
if (n === 0) return match;
if (n > m) {
var f = floor(n / 10);
if (f === 0) return match;
if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
return match;
}
capture = captures[n - 1];
}
return capture === undefined ? '' : capture;
});
}
});
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var $filter = __webpack_require__(89).filter;
var arrayMethodHasSpeciesSupport = __webpack_require__(106);
// `Array.prototype.filter` method
// https://tc39.github.io/ecma262/#sec-array.prototype.filter
// with adding support of @@species
$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
filter: function filter(callbackfn /* , thisArg */) {
return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.getRenderer = _getItem;
exports.getRegisteredRenderers = exports.getRegisteredRendererNames = exports.hasRenderer = exports.registerRenderer = void 0;
var _staticRegister2 = _interopRequireDefault(__webpack_require__(78));
var _cellDecorator = _interopRequireDefault(__webpack_require__(461));
var _autocompleteRenderer = _interopRequireDefault(__webpack_require__(462));
var _checkboxRenderer = _interopRequireDefault(__webpack_require__(463));
var _htmlRenderer = _interopRequireDefault(__webpack_require__(464));
var _numericRenderer = _interopRequireDefault(__webpack_require__(465));
var _passwordRenderer = _interopRequireDefault(__webpack_require__(466));
var _textRenderer = _interopRequireDefault(__webpack_require__(467));
var _staticRegister = (0, _staticRegister2.default)('renderers'),
register = _staticRegister.register,
getItem = _staticRegister.getItem,
hasItem = _staticRegister.hasItem,
getNames = _staticRegister.getNames,
getValues = _staticRegister.getValues;
exports.getRegisteredRenderers = getValues;
exports.getRegisteredRendererNames = getNames;
exports.hasRenderer = hasItem;
exports.registerRenderer = register;
register('base', _cellDecorator.default);
register('autocomplete', _autocompleteRenderer.default);
register('checkbox', _checkboxRenderer.default);
register('html', _htmlRenderer.default);
register('numeric', _numericRenderer.default);
register('password', _passwordRenderer.default);
register('text', _textRenderer.default);
/**
* Retrieve renderer function.
*
* @param {String} name Renderer identification.
* @returns {Function} Returns renderer function.
*/
function _getItem(name) {
if (typeof name === 'function') {
return name;
}
if (!hasItem(name)) {
throw Error("No registered renderer found under \"".concat(name, "\" name"));
}
return getItem(name);
}
/***/ }),
/* 43 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(13);
__webpack_require__(35);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _array = __webpack_require__(3);
var _object = __webpack_require__(4);
/**
* @description
* Handsontable events are the common interface that function in 2 ways: as __callbacks__ and as __hooks__.
*
* @example
*
* ```js
* // Using events as callbacks:
* ...
* const hot1 = new Handsontable(document.getElementById('example1'), {
* afterChange: function(changes, source) {
* $.ajax({
* url: "save.php',
* data: change
* });
* }
* });
* ...
* ```
*
* ```js
* // Using events as plugin hooks:
* ...
* const hot1 = new Handsontable(document.getElementById('example1'), {
* myPlugin: true
* });
*
* const hot2 = new Handsontable(document.getElementById('example2'), {
* myPlugin: false
* });
*
* // global hook
* Handsontable.hooks.add('afterChange', function() {
* // Fired twice - for hot1 and hot2
* if (this.getSettings().myPlugin) {
* // function body - will only run for hot1
* }
* });
*
* // local hook (has same effect as a callback)
* hot2.addHook('afterChange', function() {
* // function body - will only run in #example2
* });
* ```
* ...
*/
// @TODO: Move plugin description hooks to plugin?
var REGISTERED_HOOKS = [
/**
* Fired after resetting a cell's meta. This happens when the {@link Core#updateSettings} method is called.
*
* @event Hooks#afterCellMetaReset
*/
'afterCellMetaReset',
/**
* Fired after one or more cells has been changed. The changes are triggered in any situation when the
* value is entered using an editor or changed using API (e.q setDataAtCell)
*
* __Note:__ For performance reasons, the `changes` array is null for `"loadData"` source.
*
* @event Hooks#afterChange
* @param {Array} changes 2D array containing information about each of the edited cells `[[row, prop, oldVal, newVal], ...]`.
* @param {String} [source] String that identifies source of hook call ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
* @example
* ```js
* new Handsontable(element, {
* afterChange: (changes) => {
* changes.forEach(([row, prop, oldValue, newValue]) => {
* // Some logic...
* });
* }
* })
* ```
*/
'afterChange',
/**
* Fired by {@link ObserveChanges} plugin after detecting changes in the data source. This hook is fired when
* {@link Options#observeChanges} option is enabled.
*
* @event Hooks#afterChangesObserved
*/
'afterChangesObserved',
/**
* Fired each time user opens {@link ContextMenu} and after setting up the Context Menu's default options. These options are a collection
* which user can select by setting an array of keys or an array of objects in {@link Options#contextMenu} option.
*
* @event Hooks#afterContextMenuDefaultOptions
* @param {Array} predefinedItems An array of objects containing information about the pre-defined Context Menu items.
*/
'afterContextMenuDefaultOptions',
/**
* Fired each time user opens {@link ContextMenu} plugin before setting up the Context Menu's items but after filtering these options by
* user (`contextMenu` option). This hook can by helpful to determine if user use specified menu item or to set up
* one of the menu item to by always visible.
*
* @event Hooks#beforeContextMenuSetItems
* @param {Object[]} menuItems An array of objects containing information about to generated Context Menu items.
*/
'beforeContextMenuSetItems',
/**
* Fired by {@link DropdownMenu} plugin after setting up the Dropdown Menu's default options. These options are a
* collection which user can select by setting an array of keys or an array of objects in {@link Options#dropdownMenu}
* option.
*
* @event Hooks#afterDropdownMenuDefaultOptions
* @param {Object[]} predefinedItems An array of objects containing information about the pre-defined Context Menu items.
*/
'afterDropdownMenuDefaultOptions',
/**
* Fired by {@link DropdownMenu} plugin before setting up the Dropdown Menu's items but after filtering these options
* by user (`dropdownMenu` option). This hook can by helpful to determine if user use specified menu item or to set
* up one of the menu item to by always visible.
*
* @event Hooks#beforeDropdownMenuSetItems
* @param {Object[]} menuItems An array of objects containing information about to generated Dropdown Menu items.
*/
'beforeDropdownMenuSetItems',
/**
* Fired by {@link ContextMenu} plugin after hiding the Context Menu. This hook is fired when {@link Options#contextMenu}
* option is enabled.
*
* @event Hooks#afterContextMenuHide
* @param {Object} context The Context Menu plugin instance.
*/
'afterContextMenuHide',
/**
* Fired by {@link ContextMenu} plugin before opening the Context Menu. This hook is fired when {@link Options#contextMenu}
* option is enabled.
*
* @event Hooks#beforeContextMenuShow
* @param {Object} context The Context Menu instance.
*/
'beforeContextMenuShow',
/**
* Fired by {@link ContextMenu} plugin after opening the Context Menu. This hook is fired when {@link Options#contextMenu}
* option is enabled.
*
* @event Hooks#afterContextMenuShow
* @param {Object} context The Context Menu plugin instance.
*/
'afterContextMenuShow',
/**
* Fired by {@link CopyPaste} plugin after reaching the copy limit while copying data. This hook is fired when
* {@link Options#copyPaste} option is enabled.
*
* @event Hooks#afterCopyLimit
* @param {Number} selectedRows Count of selected copyable rows.
* @param {Number} selectedColumns Count of selected copyable columns.
* @param {Number} copyRowsLimit Current copy rows limit.
* @param {Number} copyColumnsLimit Current copy columns limit.
*/
'afterCopyLimit',
/**
* Fired before created a new column.
*
* @event Hooks#beforeCreateCol
* @param {Number} index Represents the visual index of first newly created column in the data source array.
* @param {Number} amount Number of newly created columns in the data source array.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link http://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
* @returns {*} If `false` then creating columns is cancelled.
* @example
* ```js
* // Return `false` to cancel column inserting.
* new Handsontable(element, {
* beforeCreateCol: function(data, coords) {
* return false;
* }
* });
* ```
*/
'beforeCreateCol',
/**
* Fired after created a new column.
*
* @event Hooks#afterCreateCol
* @param {Number} index Represents the visual index of first newly created column in the data source.
* @param {Number} amount Number of newly created columns in the data source.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'afterCreateCol',
/**
* Fired before created a new row.
*
* @event Hooks#beforeCreateRow
* @param {Number} index Represents the visual index of first newly created row in the data source array.
* @param {Number} amount Number of newly created rows in the data source array.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'beforeCreateRow',
/**
* Fired after created a new row.
*
* @event Hooks#afterCreateRow
* @param {Number} index Represents the visual index of first newly created row in the data source array.
* @param {Number} amount Number of newly created rows in the data source array.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'afterCreateRow',
/**
* Fired after the current cell is deselected.
*
* @event Hooks#afterDeselect
*/
'afterDeselect',
/**
* Fired after destroying the Handsontable instance.
*
* @event Hooks#afterDestroy
*/
'afterDestroy',
/**
* General hook which captures `keydown` events attached to the document body. These events are delegated to the
* hooks system and consumed by Core and internal modules (e.g plugins, editors).
*
* @event Hooks#afterDocumentKeyDown
* @param {Event} event A native `keydown` event object.
*/
'afterDocumentKeyDown',
/**
* Fired inside the Walkontable's selection `draw` method. Can be used to add additional class names to cells, depending on the current selection.
*
* @event Hooks#afterDrawSelection
* @param {Number} currentRow Row index of the currently processed cell.
* @param {Number} currentColumn Column index of the currently cell.
* @param {Number[]} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow, endColumn]`.
* @param {Number|undefined} layerLevel Number indicating which layer of selection is currently processed.
* @since 0.38.1
* @returns {String|undefined} Can return a `String`, which will act as an additional `className` to be added to the currently processed cell.
*/
'afterDrawSelection',
/**
* Fired inside the Walkontable's `refreshSelections` method. Can be used to remove additional class names from all cells in the table.
*
* @event Hooks#beforeRemoveCellClassNames
* @since 0.38.1
* @returns {String[]|undefined} Can return an `Array` of `String`s. Each of these strings will act like class names to be removed from all the cells in the table.
*/
'beforeRemoveCellClassNames',
/**
* Fired after getting the cell settings.
*
* @event Hooks#afterGetCellMeta
* @param {Number} row Visual row index.
* @param {Number} column Visual column index.
* @param {Object} cellProperties Object containing the cell properties.
*/
'afterGetCellMeta',
/**
* Fired after retrieving information about a column header and appending it to the table header.
*
* @event Hooks#afterGetColHeader
* @param {Number} column Visual column index.
* @param {HTMLTableCellElement} TH Header's TH element.
*/
'afterGetColHeader',
/**
* Fired after retrieving information about a row header and appending it to the table header.
*
* @event Hooks#afterGetRowHeader
* @param {Number} row Visual row index.
* @param {HTMLTableCellElement} TH Header's TH element.
*/
'afterGetRowHeader',
/**
* Fired after the Handsontable instance is initiated.
*
* @event Hooks#afterInit
*/
'afterInit',
/**
* Fired after new data is loaded (by `loadData` or `updateSettings` method) into the data source array.
*
* @event Hooks#afterLoadData
* @param {Boolean} initialLoad flag that determines whether the data has been loaded during the initialization.
*/
'afterLoadData',
/**
* Fired after a scroll event, which is identified as a momentum scroll (e.g. on an iPad).
*
* @event Hooks#afterMomentumScroll
*/
'afterMomentumScroll',
/**
* Fired after a `mousedown` event is triggered on the cell corner (the drag handle).
*
* @event Hooks#afterOnCellCornerMouseDown
* @param {Event} event `mousedown` event object.
*/
'afterOnCellCornerMouseDown',
/**
* Fired after a `dblclick` event is triggered on the cell corner (the drag handle).
*
* @event Hooks#afterOnCellCornerDblClick
* @param {Event} event `dblclick` event object.
*/
'afterOnCellCornerDblClick',
/**
* Fired after clicking on a cell or row/column header. In case the row/column header was clicked, the coordinate
* indexes are negative.
*
* For example clicking on the row header of cell (0, 0) results with `afterOnCellMouseDown` called
* with coordinates `{row: 0, col: -1}`.
*
* @event Hooks#afterOnCellMouseDown
* @param {Event} event `mousedown` event object.
* @param {CellCoords} coords Coordinates object containing the visual row and visual column indexes of the clicked cell.
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element.
*/
'afterOnCellMouseDown',
/**
* Fired after clicking on a cell or row/column header. In case the row/column header was clicked, the coordinate
* indexes are negative.
*
* For example clicking on the row header of cell (0, 0) results with `afterOnCellMouseUp` called
* with coordinates `{row: 0, col: -1}`.
*
* @event Hooks#afterOnCellMouseUp
* @param {Event} event `mouseup` event object.
* @param {CellCoords} coords Coordinates object containing the visual row and visual column indexes of the clicked cell.
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element.
*/
'afterOnCellMouseUp',
/**
* Fired after clicking right mouse button on a cell or row/column header.
*
* For example clicking on the row header of cell (0, 0) results with `afterOnCellContextMenu` called
* with coordinates `{row: 0, col: -1}`.
*
* @event Hooks#afterOnCellContextMenu
* @since 4.1.0
* @param {Event} event `contextmenu` event object.
* @param {CellCoords} coords Coordinates object containing the visual row and visual column indexes of the clicked cell.
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element.
*/
'afterOnCellContextMenu',
/**
* Fired after hovering a cell or row/column header with the mouse cursor. In case the row/column header was
* hovered, the index is negative.
*
* For example, hovering over the row header of cell (0, 0) results with `afterOnCellMouseOver` called
* with coords `{row: 0, col: -1}`.
*
* @event Hooks#afterOnCellMouseOver
* @param {Event} event `mouseover` event object.
* @param {CellCoords} coords Hovered cell's visual coordinate object.
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element.
*/
'afterOnCellMouseOver',
/**
* Fired after leaving a cell or row/column header with the mouse cursor.
*
* @event Hooks#afterOnCellMouseOut
* @param {Event} event `mouseout` event object.
* @param {CellCoords} coords Leaved cell's visual coordinate object.
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element.
*/
'afterOnCellMouseOut',
/**
* Fired after one or more columns are removed.
*
* @event Hooks#afterRemoveCol
* @param {Number} index Visual index of starter column.
* @param {Number} amount An amount of removed columns.
* @param {Number[]} physicalColumns An array of physical columns removed from the data source.
* @param {String} [source] String that identifies source of hook call ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'afterRemoveCol',
/**
* Fired after one or more rows are removed.
*
* @event Hooks#afterRemoveRow
* @param {Number} index Visual index of starter row.
* @param {Number} amount An amount of removed rows.
* @param {Number[]} physicalRows An array of physical rows removed from the data source.
* @param {String} [source] String that identifies source of hook call ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'afterRemoveRow',
/**
* Fired after the Handsontable table is rendered.
*
* @event Hooks#afterRender
* @param {Boolean} isForced Is `true` if rendering was triggered by a change of settings or data; or `false` if
* rendering was triggered by scrolling or moving selection.
*/
'afterRender',
/**
* Fired before starting rendering the cell.
*
* @event Hooks#beforeRenderer
* @param {HTMLTableCellElement} TD Currently rendered cell's TD element.
* @param {Number} row Visual row index.
* @param {Number} column Visual column index.
* @param {String|Number} prop Column property name or a column index, if datasource is an array of arrays.
* @param {*} value Value of the rendered cell.
* @param {Object} cellProperties Object containing the cell's properties.
*/
'beforeRenderer',
/**
* Fired after finishing rendering the cell (after the renderer finishes).
*
* @event Hooks#afterRenderer
* @param {HTMLTableCellElement} TD Currently rendered cell's TD element.
* @param {Number} row Visual row index.
* @param {Number} column Visual column index.
* @param {String|Number} prop Column property name or a column index, if datasource is an array of arrays.
* @param {*} value Value of the rendered cell.
* @param {Object} cellProperties Object containing the cell's properties.
*/
'afterRenderer',
/**
* Fired after the horizontal scroll event.
*
* @event Hooks#afterScrollHorizontally
*/
'afterScrollHorizontally',
/**
* Fired after the vertical scroll event.
*
* @event Hooks#afterScrollVertically
*/
'afterScrollVertically',
/**
* Fired after one or more cells are selected (e.g. during mouse move).
*
* @event Hooks#afterSelection
* @param {Number} row Selection start visual row index.
* @param {Number} column Selection start visual column index.
* @param {Number} row2 Selection end visual row index.
* @param {Number} column2 Selection end visual column index.
* @param {Object} preventScrolling Object with `value` property where its value change will be observed.
* @param {Number} selectionLayerLevel The number which indicates what selection layer is currently modified.
* @example
* ```js
* new Handsontable(element, {
* afterSelection: (row, column, row2, column2, preventScrolling, selectionLayerLevel) => {
* // setting if prevent scrolling after selection
* preventScrolling.value = true;
* }
* })
* ```
*/
'afterSelection',
/**
* Fired after one or more cells are selected.
*
* The `prop` and `prop2` arguments represent the source object property name instead of the column number.
*
* @event Hooks#afterSelectionByProp
* @param {Number} row Selection start visual row index.
* @param {String} prop Selection start data source object property name.
* @param {Number} row2 Selection end visual row index.
* @param {String} prop2 Selection end data source object property name.
* @param {Object} preventScrolling Object with `value` property where its value change will be observed.
* @param {Number} selectionLayerLevel The number which indicates what selection layer is currently modified.
* @example
* ```js
* new Handsontable(element, {
* afterSelectionByProp: (row, column, row2, column2, preventScrolling, selectionLayerLevel) => {
* // setting if prevent scrolling after selection
* preventScrolling.value = true;
* }
* })
* ```
*/
'afterSelectionByProp',
/**
* Fired after one or more cells are selected (e.g. on mouse up).
*
* @event Hooks#afterSelectionEnd
* @param {Number} row Selection start visual row index.
* @param {Number} column Selection start visual column index.
* @param {Number} row2 Selection end visual row index.
* @param {Number} column2 Selection end visual column index.
* @param {Number} selectionLayerLevel The number which indicates what selection layer is currently modified.
*/
'afterSelectionEnd',
/**
* Fired after one or more cells are selected (e.g. on mouse up).
*
* The `prop` and `prop2` arguments represent the source object property name instead of the column number.
*
* @event Hooks#afterSelectionEndByProp
* @param {Number} row Selection start visual row index.
* @param {String} prop Selection start data source object property index.
* @param {Number} row2 Selection end visual row index.
* @param {String} prop2 Selection end data source object property index.
* @param {Number} selectionLayerLevel The number which indicates what selection layer is currently modified.
*/
'afterSelectionEndByProp',
/**
* Fired after cell meta is changed.
*
* @event Hooks#afterSetCellMeta
* @param {Number} row Visual row index.
* @param {Number} column Visual column index.
* @param {String} key The updated meta key.
* @param {*} value The updated meta value.
*/
'afterSetCellMeta',
/**
* Fired after cell meta is removed.
*
* @event Hooks#afterRemoveCellMeta
* @param {Number} row Visual row index.
* @param {Number} column Visual column index.
* @param {String} key The removed meta key.
* @param {*} value Value which was under removed key of cell meta.
*/
'afterRemoveCellMeta',
/**
* Fired after cell data was changed.
*
* @event Hooks#afterSetDataAtCell
* @param {Array} changes An array of changes in format `[[row, column, oldValue, value], ...]`.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'afterSetDataAtCell',
/**
* Fired after cell data was changed.
*
* @event Hooks#afterSetDataAtRowProp
* @param {Array} changes An array of changes in format `[[row, prop, oldValue, value], ...]`.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'afterSetDataAtRowProp',
/**
* Fired after calling the `updateSettings` method.
*
* @event Hooks#afterUpdateSettings
* @param {Object} newSettings New settings object.
*/
'afterUpdateSettings',
/**
* @description
* A plugin hook executed after validator function, only if validator function is defined.
* Validation result is the first parameter. This can be used to determinate if validation passed successfully or not.
*
* __Returning false from the callback will mark the cell as invalid.__
*
* @event Hooks#afterValidate
* @param {Boolean} isValid `true` if valid, `false` if not.
* @param {*} value The value in question.
* @param {Number} row Visual row index.
* @param {String|Number} prop Property name / visual column index.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'afterValidate',
/**
* Fired before successful change of language (when proper language code was set)
*
* @event Hooks#beforeLanguageChange
* @since 0.35.0
* @param {String} languageCode New language code.
*/
'beforeLanguageChange',
/**
* Fired after successful change of language (when proper language code was set).
*
* @event Hooks#afterLanguageChange
* @since 0.35.0
* @param {String} languageCode New language code.
*/
'afterLanguageChange',
/**
* Fired by {@link Autofill} plugin before populating the data in the autofill feature. This hook is fired when
* {@link Options#fillHandle} option is enabled.
*
* @event Hooks#beforeAutofill
* @param {CellCoords} start Object containing information about first filled cell: `{row: 2, col: 0}`.
* @param {CellCoords} end Object containing information about last filled cell: `{row: 4, col: 1}`.
* @param {Array[]} data 2D array containing information about fill pattern: `[["1", "Ted"], ["1", "John"]]`.
*/
'beforeAutofill',
/**
* Fired before aligning the cell contents.
*
* @event Hooks#beforeCellAlignment
* @param {Object} stateBefore An object with class names defining the cell alignment.
* @param {CellRange[]} range An array of CellRange coordinates where the alignment will be applied.
* @param {String} type Type of the alignment - either `horizontal` or `vertical`.
* @param {String} alignmentClass String defining the alignment class added to the cell.
* Possible values:
* * `htLeft`
* * `htCenter`
* * `htRight`
* * `htJustify`
* * `htTop`
* * `htMiddle`
* * `htBottom`
*/
'beforeCellAlignment',
/**
* Fired before one or more cells is changed. Its main purpose is to alter changes silently after input and before
* table rendering.
*
* @event Hooks#beforeChange
* @param {Array[]} changes 2D array containing information about each of the edited cells.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
* @example
* ```js
* // To disregard a single change, set changes[i] to null or remove it from array using changes.splice(i, 1).
* new Handsontable(element, {
* beforeChange: (changes, source) => {
* // [[row, prop, oldVal, newVal], ...]
* changes[0] = null;
* }
* });
* // To alter a single change, overwrite the desired value to changes[i][3].
* new Handsontable(element, {
* beforeChange: (changes, source) => {
* // [[row, prop, oldVal, newVal], ...]
* changes[0][3] = 10;
* }
* });
* // To cancel all edit, return false from the callback or set array length to 0 (changes.length = 0).
* new Handsontable(element, {
* beforeChange: (changes, source) => {
* // [[row, prop, oldVal, newVal], ...]
* return false;
* }
* });
* ```
*/
'beforeChange',
/**
* Fired right before rendering the changes.
*
* @event Hooks#beforeChangeRender
* @param {Array[]} changes Array in form of `[row, prop, oldValue, newValue]`.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'beforeChangeRender',
/**
* Fired before drawing the borders.
*
* @event Hooks#beforeDrawBorders
* @param {Array} corners Array specifying the current selection borders.
* @param {String} borderClassName Specifies the border class name.
*/
'beforeDrawBorders',
/**
* Fired before getting cell settings.
*
* @event Hooks#beforeGetCellMeta
* @param {Number} row Visual row index.
* @param {Number} column Visual column index.
* @param {Object} cellProperties Object containing the cell's properties.
*/
'beforeGetCellMeta',
/**
* Fired before cell meta is removed.
*
* @event Hooks#beforeRemoveCellMeta
* @param {Number} row Visual row index.
* @param {Number} column Visual column index.
* @param {String} key The removed meta key.
* @param {*} value Value which is under removed key of cell meta.
*/
'beforeRemoveCellMeta',
/**
* Fired before the Handsontable instance is initiated.
*
* @event Hooks#beforeInit
*/
'beforeInit',
/**
* Fired before the Walkontable instance is initiated.
*
* @event Hooks#beforeInitWalkontable
* @param {Object} walkontableConfig Walkontable configuration object.
*/
'beforeInitWalkontable',
/**
* Fired before keydown event is handled. It can be used to overwrite default key bindings.
*
* __Note__: To prevent default behavior you need to call `event.stopImmediatePropagation()` in your `beforeKeyDown`
* handler.
*
* @event Hooks#beforeKeyDown
* @param {Event} event Original DOM event.
*/
'beforeKeyDown',
/**
* Fired after the user clicked a cell, but before all the calculations related with it.
*
* @event Hooks#beforeOnCellMouseDown
* @param {Event} event The `mousedown` event object.
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
* @param {HTMLTableCellElement} TD TD element.
* @param {Object} controller An object with keys `row`, `column` and `cells` which contains boolean values. This
* object allows or disallows changing the selection for the particular axies.
*/
'beforeOnCellMouseDown',
/**
* Fired after the user clicked a cell.
*
* @event Hooks#beforeOnCellMouseUp
* @param {Event} event The `mouseup` event object.
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
* @param {HTMLTableCellElement} TD TD element.
* @param {Object} controller An object with keys `row`, `column` and `cells` which contains boolean values. This
* object allows or disallows changing the selection for the particular axies.
*/
'beforeOnCellMouseUp',
/**
* Fired after the user clicked a cell, but before all the calculations related with it.
*
* @event Hooks#beforeOnCellContextMenu
* @since 4.1.0
* @param {Event} event The `contextmenu` event object.
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
* @param {HTMLTableCellElement} TD TD element.
*/
'beforeOnCellContextMenu',
/**
* Fired after the user moved cursor over a cell, but before all the calculations related with it.
*
* @event Hooks#beforeOnCellMouseOver
* @param {Event} event The `mouseover` event object.
* @param {CellCoords} coords CellCoords object containing the visual coordinates of the clicked cell.
* @param {HTMLTableCellElement} TD TD element.
* @param {Object} controller An object with keys `row`, `column` and `cells` which contains boolean values. This
* object allows or disallows changing the selection for the particular axies.
*/
'beforeOnCellMouseOver',
/**
* Fired after the user moved cursor out from a cell, but before all the calculations related with it.
*
* @event Hooks#beforeOnCellMouseOut
* @param {Event} event The `mouseout` event object.
* @param {CellCoords} coords CellCoords object containing the visual coordinates of the leaved cell.
* @param {HTMLTableCellElement} TD TD element.
*/
'beforeOnCellMouseOut',
/**
* Fired before one or more columns are about to be removed.
*
* @event Hooks#beforeRemoveCol
* @param {Number} index Visual index of starter column.
* @param {Number} amount Amount of columns to be removed.
* @param {Number[]} physicalColumns An array of physical columns removed from the data source.
* @param {String} [source] String that identifies source of hook call ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'beforeRemoveCol',
/**
* Fired when one or more rows are about to be removed.
*
* @event Hooks#beforeRemoveRow
* @param {Number} index Visual index of starter row.
* @param {Number} amount Amount of rows to be removed.
* @param {Number[]} physicalRows An array of physical rows removed from the data source.
* @param {String} [source] String that identifies source of hook call ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'beforeRemoveRow',
/**
* Fired before the Handsontable table is rendered.
*
* @event Hooks#beforeRender
* @param {Boolean} isForced If `true` rendering was triggered by a change of settings or data; or `false` if
* rendering was triggered by scrolling or moving selection.
*/
'beforeRender',
/**
* Fired before setting range is started but not finished yet.
*
* @event Hooks#beforeSetRangeStartOnly
* @param {CellCoords} coords CellCoords instance.
*/
'beforeSetRangeStartOnly',
/**
* Fired before setting range is started.
*
* @event Hooks#beforeSetRangeStart
* @param {CellCoords} coords CellCoords instance.
*/
'beforeSetRangeStart',
/**
* Fired before setting range is ended.
*
* @event Hooks#beforeSetRangeEnd
* @param {CellCoords} coords CellCoords instance.
*/
'beforeSetRangeEnd',
/**
* Fired before the logic of handling a touch scroll, when user started scrolling on a touch-enabled device.
*
* @event Hooks#beforeTouchScroll
*/
'beforeTouchScroll',
/**
* Fired before cell validation, only if validator function is defined. This can be used to manipulate the value
* of changed cell before it is applied to the validator function.
*
* __Note:__ this will not affect values of changes. This will change value *ONLY* for validation
*
* @event Hooks#beforeValidate
* @param {*} value Value of the cell.
* @param {Number} row Visual row index.
* @param {String|Number} prop Property name / column index.
* @param {String} [source] String that identifies source of hook call
* ([list of all available sources]{@link https://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}).
*/
'beforeValidate',
/**
* Fired before cell value is rendered into the DOM (through renderer function). This can be used to manipulate the
* value which is passed to the renderer without modifying the renderer itself.
*
* @event Hooks#beforeValueRender
* @param {*} value Cell value to render.
* @param {Object} cellProperties An object containing the cell properties.
*/
'beforeValueRender',
/**
* Fired after Handsontable instance is constructed (using `new` operator).
*
* @event Hooks#construct
*/
'construct',
/**
* Fired after Handsontable instance is initiated but before table is rendered.
*
* @event Hooks#init
*/
'init',
/**
* Fired when a column index is about to be modified by a callback function.
*
* @event Hooks#modifyCol
* @param {Number} column Visual column index.
*/
'modifyCol',
/**
* Fired when a column index is about to be de-modified by a callback function.
*
* @event Hooks#unmodifyCol
* @param {Number} column Physical column index.
*/
'unmodifyCol',
/**
* Fired when a physical row index is about to be de-modified by a callback function.
*
* @event Hooks#unmodifyRow
* @param {Number} row Physical row index
*/
'unmodifyRow',
/**
* Fired when a column header index is about to be modified by a callback function.
*
* @event Hooks#modifyColHeader
* @param {Number} column Visual column header index.
*/
'modifyColHeader',
/**
* Fired when a column width is about to be modified by a callback function.
*
* @event Hooks#modifyColWidth
* @param {Number} width Current column width.
* @param {Number} column Visual column index.
*/
'modifyColWidth',
/**
* Fired when a row index is about to be modified by a callback function.
*
* @event Hooks#modifyRow
* @param {Number} row Visual row index.
*/
'modifyRow',
/**
* Fired when a row header index is about to be modified by a callback function.
*
* @event Hooks#modifyRowHeader
* @param {Number} row Visual row header index.
*/
'modifyRowHeader',
/**
* Fired when a row height is about to be modified by a callback function.
*
* @event Hooks#modifyRowHeight
* @param {Number} height Row height.
* @param {Number} row Visual row index.
*/
'modifyRowHeight',
/**
* Fired when a data was retrieved or modified.
*
* @event Hooks#modifyData
* @param {Number} row Row height.
* @param {Number} column Column index.
* @param {Object} valueHolder Object which contains original value which can be modified by overwriting `.value` property.
* @param {String} ioMode String which indicates for what operation hook is fired (`get` or `set`).
*/
'modifyData',
/**
* Fired when a data was retrieved or modified.
*
* @event Hooks#modifyRowData
* @param {Number} row Physical row index.
*/
'modifyRowData',
/**
* Used to modify the cell coordinates when using the `getCell` method.
*
* @event Hooks#modifyGetCellCoords
* @since 0.36.0
* @param {Number} row Visual row index.
* @param {Number} column Visual column index.
* @param {Boolean} topmost If set to `true`, it returns the TD element from the topmost overlay. For example,
* if the wanted cell is in the range of fixed rows, it will return a TD element
* from the `top` overlay.
*/
'modifyGetCellCoords',
/**
* Fired by {@link PersistentState} plugin, after loading value, saved under given key, from browser local storage. This hook is fired when
* {@link Options#persistentState} option is enabled.
*
* @event Hooks#persistentStateLoad
* @param {String} key Key.
* @param {Object} valuePlaceholder Object containing the loaded value under `valuePlaceholder.value` (if no value have been saved, `value` key will be undefined).
*/
'persistentStateLoad',
/**
* Fired by {@link PersistentState} plugin after resetting data from local storage. If no key is given, all values associated with table will be cleared.
* This hook is fired when {@link Options#persistentState} option is enabled.
*
* @event Hooks#persistentStateReset
* @param {String} [key] Key.
*/
'persistentStateReset',
/**
* Fired by {@link PersistentState} plugin, after saving value under given key in browser local storage. This hook is fired when
* {@link Options#persistentState} option is enabled.
*
* @event Hooks#persistentStateSave
* @param {String} key Key.
* @param {Mixed} value Value to save.
*/
'persistentStateSave',
/**
* Fired by {@link ColumnSorting} and {@link MultiColumnSorting} plugins before sorting the column. If you return `false` value inside callback for hook, then sorting
* will be not applied by the Handsontable (useful for server-side sorting).
*
* This hook is fired when {@link Options#columnSorting} or {@link Options#multiColumnSorting} option is enabled.
*
* @event Hooks#beforeColumnSort
* @param {Array} currentSortConfig Current sort configuration (for all sorted columns).
* @param {Array} destinationSortConfigs Destination sort configuration (for all sorted columns).
*/
'beforeColumnSort',
/**
* Fired by {@link ColumnSorting} and {@link MultiColumnSorting} plugins after sorting the column. This hook is fired when {@link Options#columnSorting}
* or {@link Options#multiColumnSorting} option is enabled.
*
* @event Hooks#afterColumnSort
* @param {Array} currentSortConfig Current sort configuration (for all sorted columns).
* @param {Array} destinationSortConfigs Destination sort configuration (for all sorted columns).
*/
'afterColumnSort',
/**
* Fired by {@link Autofill} plugin after setting range of autofill. This hook is fired when {@link Options#fillHandle}
* option is enabled.
*
* @event Hooks#modifyAutofillRange
* @param {Array} startArea Array of visual coordinates of the starting point for the drag-down operation (`[startRow, startColumn, endRow, endColumn]`).
* @param {Array} entireArea Array of visual coordinates of the entire area of the drag-down operation (`[startRow, startColumn, endRow, endColumn]`).
*/
'modifyAutofillRange',
/**
* Fired to allow modifying the copyable range with a callback function.
*
* @event Hooks#modifyCopyableRange
* @param {Array[]} copyableRanges Array of objects defining copyable cells.
*/
'modifyCopyableRange',
/**
* Fired by {@link CopyPaste} plugin before copying the values into clipboard and before clearing values of
* the selected cells. This hook is fired when {@link Options#copyPaste} option is enabled.
*
* @event Hooks#beforeCut
* @param {Array[]} data An array of arrays which contains data to cut.
* @param {Object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
* which will be cut out.
* @returns {*} If returns `false` then operation of the cutting out is canceled.
* @example
* ```js
* // To disregard a single row, remove it from the array using data.splice(i, 1).
* new Handsontable(element, {
* beforeCut: function(data, coords) {
* // data -> [[1, 2, 3], [4, 5, 6]]
* data.splice(0, 1);
* // data -> [[4, 5, 6]]
* // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
* }
* });
* // To cancel a cutting action, just return `false`.
* new Handsontable(element, {
* beforeCut: function(data, coords) {
* return false;
* }
* });
* ```
*/
'beforeCut',
/**
* Fired by {@link CopyPaste} plugin after data was cut out from the table. This hook is fired when
* {@link Options#copyPaste} option is enabled.
*
* @event Hooks#afterCut
* @param {Array[]} data An array of arrays which contains the cutted out data.
* @param {Object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
* which was cut out.
*/
'afterCut',
/**
* Fired before values are copied into clipboard.
*
* @event Hooks#beforeCopy
* @param {Array[]} data An array of arrays which contains data to copied.
* @param {Object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
* which will copied.
* @returns {*} If returns `false` then copying is canceled.
*
* @example
* ```js
* // To disregard a single row, remove it from array using data.splice(i, 1).
* ...
* new Handsontable(document.getElementById('example'), {
* beforeCopy: (data, coords) => {
* // data -> [[1, 2, 3], [4, 5, 6]]
* data.splice(0, 1);
* // data -> [[4, 5, 6]]
* // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
* }
* });
* ...
*
* // To cancel copying, return false from the callback.
* ...
* new Handsontable(document.getElementById('example'), {
* beforeCopy: (data, coords) => {
* return false;
* }
* });
* ...
* ```
*/
'beforeCopy',
/**
* Fired by {@link CopyPaste} plugin after data are pasted into table. This hook is fired when {@link Options#copyPaste}
* option is enabled.
*
* @event Hooks#afterCopy
* @param {Array[]} data An array of arrays which contains the copied data.
* @param {Object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
* which was copied.
*/
'afterCopy',
/**
* Fired by {@link CopyPaste} plugin before values are pasted into table. This hook is fired when
* {@link Options#copyPaste} option is enabled.
*
* @event Hooks#beforePaste
* @param {Array[]} data An array of arrays which contains data to paste.
* @param {Object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
* that correspond to the previously selected area.
* @returns {*} If returns `false` then pasting is canceled.
* @example
* ```js
* // To disregard a single row, remove it from array using data.splice(i, 1).
* new Handsontable(example, {
* beforePaste: (data, coords) => {
* // data -> [[1, 2, 3], [4, 5, 6]]
* data.splice(0, 1);
* // data -> [[4, 5, 6]]
* // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
* }
* });
* // To cancel pasting, return false from the callback.
* new Handsontable(example, {
* beforePaste: (data, coords) => {
* return false;
* }
* });
* ```
*/
'beforePaste',
/**
* Fired by {@link CopyPaste} plugin after values are pasted into table. This hook is fired when
* {@link Options#copyPaste} option is enabled.
*
* @event Hooks#afterPaste
* @param {Array[]} data An array of arrays which contains the pasted data.
* @param {Object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
* that correspond to the previously selected area.
*/
'afterPaste',
/**
* Fired by {@link ManualColumnMove} plugin before change order of the visual indexes. This hook is fired when
* {@link Options#manualColumnMove} option is enabled.
*
* @event Hooks#beforeColumnMove
* @param {Number[]} columns Array of visual column indexes to be moved.
* @param {Number} target Visual column index being a target for moved columns.
*/
'beforeColumnMove',
/**
* Fired by {@link ManualColumnMove} plugin after changing order of the visual indexes. This hook is fired when
* {@link Options#manualColumnMove} option is enabled.
*
* @event Hooks#afterColumnMove
* @param {Number[]} columns Array of visual column indexes that were moved.
* @param {Number} target Visual column index being a target for moved columns.
*/
'afterColumnMove',
/**
* Fired by {@link ManualRowMove} plugin before changing the order of the visual indexes. This hook is fired when
* {@link Options#manualRowMove} option is enabled.
*
* @event Hooks#beforeRowMove
* @param {Array} movedRows Array of visual row indexes to be moved.
* @param {Number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements will be placed after the moving action. To check visualization of final index please take a look at [documentation](/demo-moving.html#manualRowMove).
* @param {Number|undefined} dropIndex Visual row index, being a drop index for the moved rows. Points to where we are going to drop the moved elements. To check visualization of drop index please take a look at [documentation](/demo-moving.html#manualRowMove). It's `undefined` when `dragRows` function wasn't called.
* @param {Boolean} movePossible Indicates if it's possible to move rows to the desired position.
*/
'beforeRowMove',
/**
* Fired by {@link ManualRowMove} plugin after changing the order of the visual indexes. This hook is fired when
* {@link Options#manualRowMove} option is enabled.
*
* @event Hooks#afterRowMove
* @param {Array} movedRows Array of visual row indexes to be moved.
* @param {Number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements will be placed after the moving action. To check visualization of final index please take a look at [documentation](/demo-moving.html#manualRowMove).
* @param {Number|undefined} dropIndex Visual row index, being a drop index for the moved rows. Points to where we are going to drop the moved elements. To check visualization of drop index please take a look at [documentation](/demo-moving.html#manualRowMove). It's `undefined` when `dragRows` function wasn't called.
* @param {Boolean} movePossible Indicates if it was possible to move rows to the desired position.
* @param {Boolean} orderChanged Indicates if order of rows was changed by move.
*/
'afterRowMove',
/**
* Fired by {@link ManualColumnResize} plugin before rendering the table with modified column sizes. This hook is
* fired when {@link Options#manualColumnResize} option is enabled.
*
* @event Hooks#beforeColumnResize
* @param {Number} currentColumn Visual index of the resized column.
* @param {Number} newSize Calculated new column width.
* @param {Boolean} isDoubleClick Flag that determines whether there was a double-click.
* @returns {Number} Returns a new column size or `undefined`, if column size should be calculated automatically.
*/
'beforeColumnResize',
/**
* Fired by {@link ManualColumnResize} plugin after rendering the table with modified column sizes. This hook is
* fired when {@link Options#manualColumnResize} option is enabled.
*
* @event Hooks#afterColumnResize
* @param {Number} currentColumn Visual index of the resized column.
* @param {Number} newSize Calculated new column width.
* @param {Boolean} isDoubleClick Flag that determines whether there was a double-click.
*/
'afterColumnResize',
/**
* Fired by {@link ManualRowResize} plugin before rendering the table with modified row sizes. This hook is
* fired when {@link Options#manualRowResize} option is enabled.
*
* @event Hooks#beforeRowResize
* @param {Number} currentRow Visual index of the resized row.
* @param {Number} newSize Calculated new row height.
* @param {Boolean} isDoubleClick Flag that determines whether there was a double-click.
* @returns {Number} Returns the new row size or `undefined` if row size should be calculated automatically.
*/
'beforeRowResize',
/**
* Fired by {@link ManualRowResize} plugin after rendering the table with modified row sizes. This hook is
* fired when {@link Options#manualRowResize} option is enabled.
*
* @event Hooks#afterRowResize
* @param {Number} currentRow Visual index of the resized row.
* @param {Number} newSize Calculated new row height.
* @param {Boolean} isDoubleClick Flag that determines whether there was a double-click.
*/
'afterRowResize',
/**
* Fired after getting the column header renderers.
*
* @event Hooks#afterGetColumnHeaderRenderers
* @param {Function[]} renderers An array of the column header renderers.
*/
'afterGetColumnHeaderRenderers',
/**
* Fired after getting the row header renderers.
*
* @event Hooks#afterGetRowHeaderRenderers
* @param {Function[]} renderers An array of the row header renderers.
*/
'afterGetRowHeaderRenderers',
/**
* Fired before applying stretched column width to column.
*
* @event Hooks#beforeStretchingColumnWidth
* @param {Number} stretchedWidth Calculated width.
* @param {Number} column Visual column index.
* @returns {Number} Returns new width which will be applied to the column element.
*/
'beforeStretchingColumnWidth',
/**
* Fired by {@link Filters} plugin before applying [filtering]{@link https://docs.handsontable.com/pro/demo-filtering.html}. This hook is fired when
* {@link Options#filters} option is enabled.
*
* @event Hooks#beforeFilter
* @param {Object[]} conditionsStack An array of objects with added formulas.
* ```js
* // Example format of the conditionsStack argument:
* [
* {
* column: 2,
* conditions: [
* {name: 'begins_with', args: [['S']]}
* ],
* operation: 'conjunction'
* },
* {
* column: 4,
* conditions: [
* {name: 'not_empty', args: []}
* ],
* operation: 'conjunction'
* },
* ]
* ```
* @returns {Boolean} If hook returns `false` value then filtering won't be applied on the UI side (server-side filtering).
*/
'beforeFilter',
/**
* Fired by {@link Filters} plugin after applying [filtering]{@link https://docs.handsontable.com/pro/demo-filtering.html}. This hook is fired when
* {@link Options#filters} option is enabled.
*
* @event Hooks#afterFilter
* @param {Object[]} conditionsStack An array of objects with added conditions.
* ```js
* // Example format of the conditionsStack argument:
* [
* {
* column: 2,
* conditions: [
* {name: 'begins_with', args: [['S']]}
* ],
* operation: 'conjunction'
* },
* {
* column: 4,
* conditions: [
* {name: 'not_empty', args: []}
* ],
* operation: 'conjunction'
* },
* ]
* ```
*/
'afterFilter',
/**
* Fired while retrieving the column header height.
*
* @event Hooks#modifyColumnHeaderHeight
*/
'modifyColumnHeaderHeight',
/**
* Fired by {@link UndoRedo} plugin before the undo action. Contains information about the action that is being undone.
* This hook is fired when {@link Options#undo} option is enabled.
*
* @event Hooks#beforeUndo
* @param {Object} action The action object. Contains information about the action being undone. The `actionType`
* property of the object specifies the type of the action in a String format. (e.g. `'remove_row'`).
*/
'beforeUndo',
/**
* Fired by {@link UndoRedo} plugin after the undo action. Contains information about the action that is being undone.
* This hook is fired when {@link Options#undo} option is enabled.
*
* @event Hooks#afterUndo
* @param {Object} action The action object. Contains information about the action being undone. The `actionType`
* property of the object specifies the type of the action in a String format. (e.g. `'remove_row'`).
*/
'afterUndo',
/**
* Fired by {@link UndoRedo} plugin before the redo action. Contains information about the action that is being redone.
* This hook is fired when {@link Options#undo} option is enabled.
*
* @event Hooks#beforeRedo
* @param {Object} action The action object. Contains information about the action being redone. The `actionType`
* property of the object specifies the type of the action in a String format (e.g. `'remove_row'`).
*/
'beforeRedo',
/**
* Fired by {@link UndoRedo} plugin after the redo action. Contains information about the action that is being redone.
* This hook is fired when {@link Options#undo} option is enabled.
*
* @event Hooks#afterRedo
* @param {Object} action The action object. Contains information about the action being redone. The `actionType`
* property of the object specifies the type of the action in a String format (e.g. `'remove_row'`).
*/
'afterRedo',
/**
* Fired while retrieving the row header width.
*
* @event Hooks#modifyRowHeaderWidth
* @param {Number} rowHeaderWidth Row header width.
*/
'modifyRowHeaderWidth',
/**
* Fired from the `populateFromArray` method during the `autofill` process. Fired for each "autofilled" cell individually.
*
* @event Hooks#beforeAutofillInsidePopulate
* @param {Object} index Object containing `row` and `col` properties, defining the number of rows/columns from the initial cell of the autofill.
* @param {String} direction Declares the direction of the autofill. Possible values: `up`, `down`, `left`, `right`.
* @param {Array[]} input Contains an array of rows with data being used in the autofill.
* @param {Array} deltas The deltas array passed to the `populateFromArray` method.
*/
'beforeAutofillInsidePopulate',
/**
* Fired when the start of the selection is being modified (e.g. moving the selection with the arrow keys).
*
* @event Hooks#modifyTransformStart
* @param {CellCoords} delta Cell coords object declaring the delta of the new selection relative to the previous one.
*/
'modifyTransformStart',
/**
* Fired when the end of the selection is being modified (e.g. moving the selection with the arrow keys).
*
* @event Hooks#modifyTransformEnd
* @param {CellCoords} delta Cell coords object declaring the delta of the new selection relative to the previous one.
*/
'modifyTransformEnd',
/**
* Fired after the start of the selection is being modified (e.g. moving the selection with the arrow keys).
*
* @event Hooks#afterModifyTransformStart
* @param {CellCoords} coords Coords of the freshly selected cell.
* @param {Number} rowTransformDir `-1` if trying to select a cell with a negative row index. `0` otherwise.
* @param {Number} colTransformDir `-1` if trying to select a cell with a negative column index. `0` otherwise.
*/
'afterModifyTransformStart',
/**
* Fired after the end of the selection is being modified (e.g. moving the selection with the arrow keys).
*
* @event Hooks#afterModifyTransformEnd
* @param {CellCoords} coords Visual coords of the freshly selected cell.
* @param {Number} rowTransformDir `-1` if trying to select a cell with a negative row index. `0` otherwise.
* @param {Number} colTransformDir `-1` if trying to select a cell with a negative column index. `0` otherwise.
*/
'afterModifyTransformEnd',
/**
* Fired inside the `viewportRowCalculatorOverride` method. Allows modifying the row calculator parameters.
*
* @event Hooks#afterViewportRowCalculatorOverride
* @param {Object} calc The row calculator.
*/
'afterViewportRowCalculatorOverride',
/**
* Fired inside the `viewportColumnCalculatorOverride` method. Allows modifying the row calculator parameters.
*
* @event Hooks#afterViewportColumnCalculatorOverride
* @param {Object} calc The row calculator.
*/
'afterViewportColumnCalculatorOverride',
/**
* Fired after initializing all the plugins.
*
* @event Hooks#afterPluginsInitialized
*/
'afterPluginsInitialized',
/**
* Fired by {@link HiddenRows} plugin before marking the rows as hidden. Fired only if the {@link Options#hiddenRows} option is enabled.
* Returning `false` in the callback will prevent the hiding action from completing.
*
* @event Hooks#beforeHideRows
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes.
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes.
* @param {Boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise.
* @returns {undefined|Boolean} If the callback returns `false`, the hiding action will not be completed.
*/
'beforeHideRows',
/**
* Fired by {@link HiddenRows} plugin after marking the rows as hidden. Fired only if the {@link Options#hiddenRows} option is enabled.
*
* @event Hooks#afterHideRows
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes.
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes.
* @param {Boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise.
* @param {Boolean} stateChanged `true`, if the action affected any non-hidden rows, `false` otherwise.
*/
'afterHideRows',
/**
* Fired by {@link HiddenRows} plugin before marking the rows as not hidden. Fired only if the {@link Options#hiddenRows} option is enabled.
* Returning `false` in the callback will prevent the row revealing action from completing.
*
* @event Hooks#beforeUnhideRows
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes.
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes.
* @param {Boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise.
* @returns {undefined|Boolean} If the callback returns `false`, the revealing action will not be completed.
*/
'beforeUnhideRows',
/**
* Fired by {@link HiddenRows} plugin after marking the rows as not hidden. Fired only if the {@link Options#hiddenRows} option is enabled.
*
* @event Hooks#afterUnhideRows
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes.
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes.
* @param {Boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise.
* @param {Boolean} stateChanged `true`, if the action affected any hidden rows, `false` otherwise.
*/
'afterUnhideRows',
/**
* Fired by {@link HiddenColumns} plugin before marking the columns as hidden. Fired only if the {@link Options#hiddenColumns} option is enabled.
* Returning `false` in the callback will prevent the hiding action from completing.
*
* @event Hooks#beforeHideColumns
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes.
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes.
* @param {Boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise.
* @returns {undefined|Boolean} If the callback returns `false`, the hiding action will not be completed.
*/
'beforeHideColumns',
/**
* Fired by {@link HiddenColumns} plugin after marking the columns as hidden. Fired only if the {@link Options#hiddenColumns} option is enabled.
*
* @event Hooks#afterHideColumns
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes.
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes.
* @param {Boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise.
* @param {Boolean} stateChanged `true`, if the action affected any non-hidden columns, `false` otherwise.
*/
'afterHideColumns',
/**
* Fired by {@link HiddenColumns} plugin before marking the columns as not hidden. Fired only if the {@link Options#hiddenColumns} option is enabled.
* Returning `false` in the callback will prevent the column revealing action from completing.
*
* @event Hooks#beforeUnhideColumns
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes.
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes.
* @param {Boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise.
* @returns {undefined|Boolean} If the callback returns `false`, the hiding action will not be completed.
*/
'beforeUnhideColumns',
/**
* Fired by {@link HiddenColumns} plugin after marking the columns as not hidden. Fired only if the {@link Options#hiddenColumns} option is enabled.
*
* @event Hooks#afterUnhideColumns
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes.
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes.
* @param {Boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise.
* @param {Boolean} stateChanged `true`, if the action affected any hidden columns, `false` otherwise.
*/
'afterUnhideColumns',
/**
* Fired by {@link TrimRows} plugin before trimming rows. This hook is fired when {@link Options#trimRows} option is enabled.
*
* @event Hooks#beforeTrimRow
* @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes.
* @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes.
* @param {Boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise.
* @returns {undefined|Boolean} If the callback returns `false`, the trimming action will not be completed.
*/
'beforeTrimRow',
/**
* Fired by {@link TrimRows} plugin after trimming rows. This hook is fired when {@link Options#trimRows} option is enabled.
*
* @event Hooks#afterTrimRow
* @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes.
* @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes.
* @param {Boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise.
* @param {Boolean} stateChanged `true`, if the action affected any non-trimmed rows, `false` otherwise.
* @returns {undefined|Boolean} If the callback returns `false`, the trimming action will not be completed.
*/
'afterTrimRow',
/**
* Fired by {@link TrimRows} plugin before untrimming rows. This hook is fired when {@link Options#trimRows} option is enabled.
*
* @event Hooks#beforeUntrimRow
* @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes.
* @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes.
* @param {Boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise.
* @returns {undefined|Boolean} If the callback returns `false`, the untrimming action will not be completed.
*/
'beforeUntrimRow',
/**
* Fired by {@link TrimRows} plugin after untrimming rows. This hook is fired when {@link Options#trimRows} option is enabled.
*
* @event Hooks#afterUntrimRow
* @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes.
* @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes.
* @param {Boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise.
* @param {Boolean} stateChanged `true`, if the action affected any trimmed rows, `false` otherwise.
* @returns {undefined|Boolean} If the callback returns `false`, the untrimming action will not be completed.
*/
'afterUntrimRow',
/**
* Fired by {@link DropdownMenu} plugin before opening the dropdown menu. This hook is fired when {@link Options#dropdownMenu}
* option is enabled.
*
* @event Hooks#beforeDropdownMenuShow
* @param {DropdownMenu} dropdownMenu The DropdownMenu instance.
*/
'beforeDropdownMenuShow',
/**
* Fired by {@link DropdownMenu} plugin after opening the Dropdown Menu. This hook is fired when {@link Options#dropdownMenu}
* option is enabled.
*
* @event Hooks#afterDropdownMenuShow
* @param {DropdownMenu} dropdownMenu The DropdownMenu instance.
*/
'afterDropdownMenuShow',
/**
* Fired by {@link DropdownMenu} plugin after hiding the Dropdown Menu. This hook is fired when {@link Options#dropdownMenu}
* option is enabled.
*
* @event Hooks#afterDropdownMenuHide
* @param {DropdownMenu} instance The DropdownMenu instance.
*/
'afterDropdownMenuHide',
/**
* Fired by {@link HiddenRows} plugin to check whether the provided row index is hidden. This hook is fired when
* {@link Options#hiddenRows} option is enabled.
*
* @event Hooks#hiddenRow
* @param {Number} row The visual row index in question.
*/
'hiddenRow',
/**
* Fired by {@link HiddenColumns} plugin to check whether the provided column index is hidden. This hook is fired when
* {@link Options#hiddenColumns} option is enabled.
*
* @event Hooks#hiddenColumn
* @param {Number} column The visual column index in question.
*/
'hiddenColumn',
/**
* Fired by {@link NestedRows} plugin before adding a children to the NestedRows structure. This hook is fired when
* {@link Options#nestedRows} option is enabled.
*
* @event Hooks#beforeAddChild
* @param {Object} parent The parent object.
* @param {Object|undefined} element The element added as a child. If `undefined`, a blank child was added.
* @param {Number|undefined} index The index within the parent where the new child was added. If `undefined`, the element was added as the last child.
*/
'beforeAddChild',
/**
* Fired by {@link NestedRows} plugin after adding a children to the NestedRows structure. This hook is fired when
* {@link Options#nestedRows} option is enabled.
*
* @event Hooks#afterAddChild
* @param {Object} parent The parent object.
* @param {Object|undefined} element The element added as a child. If `undefined`, a blank child was added.
* @param {Number|undefined} index The index within the parent where the new child was added. If `undefined`, the element was added as the last child.
*/
'afterAddChild',
/**
* Fired by {@link NestedRows} plugin before detaching a child from its parent. This hook is fired when
* {@link Options#nestedRows} option is enabled.
*
* @event Hooks#beforeDetachChild
* @param {Object} parent An object representing the parent from which the element is to be detached.
* @param {Object} element The detached element.
*/
'beforeDetachChild',
/**
* Fired by {@link NestedRows} plugin after detaching a child from its parent. This hook is fired when
* {@link Options#nestedRows} option is enabled.
*
* @event Hooks#afterDetachChild
* @param {Object} parent An object representing the parent from which the element was detached.
* @param {Object} element The detached element.
*/
'afterDetachChild',
/**
* Fired after the editor is opened and rendered.
*
* @event Hooks#afterBeginEditing
* @param {Number} row Visual row index of the edited cell.
* @param {Number} column Visual column index of the edited cell.
*/
'afterBeginEditing',
/**
* Fired by {@link MergeCells} plugin before cell merging. This hook is fired when {@link Options#mergeCells}
* option is enabled.
*
* @event Hooks#beforeMergeCells
* @param {CellRange} cellRange Selection cell range.
* @param {Boolean} [auto=false] `true` if called automatically by the plugin.
*/
'beforeMergeCells',
/**
* Fired by {@link MergeCells} plugin after cell merging. This hook is fired when {@link Options#mergeCells}
* option is enabled.
*
* @event Hooks#afterMergeCells
* @param {CellRange} cellRange Selection cell range.
* @param {Object} mergeParent The parent collection of the provided cell range.
* @param {Boolean} [auto=false] `true` if called automatically by the plugin.
*/
'afterMergeCells',
/**
* Fired by {@link MergeCells} plugin before unmerging the cells. This hook is fired when {@link Options#mergeCells}
* option is enabled.
*
* @event Hooks#beforeUnmergeCells
* @param {CellRange} cellRange Selection cell range.
* @param {Boolean} [auto=false] `true` if called automatically by the plugin.
*/
'beforeUnmergeCells',
/**
* Fired by {@link MergeCells} plugin after unmerging the cells. This hook is fired when {@link Options#mergeCells}
* option is enabled.
*
* @event Hooks#afterUnmergeCells
* @param {CellRange} cellRange Selection cell range.
* @param {Boolean} [auto=false] `true` if called automatically by the plugin.
*/
'afterUnmergeCells',
/**
* Fired after the table was switched into listening mode. This allows Handsontable to capture keyboard events and
* respond in the right way.
*
* @event Hooks#afterListen
*/
'afterListen',
/**
* Fired after the table was switched off from the listening mode. This makes the Handsontable inert for any
* keyboard events.
*
* @event Hooks#afterUnlisten
*/
'afterUnlisten',
/**
* Fired after the window was resized.
*
* @event Hooks#afterRefreshDimensions
* @param {Object} previousDimensions Previous dimensions of the container.
* @param {Object} currentDimensions Current dimensions of the container.
* @param {Boolean} stateChanged `true`, if the container was re-render, `false` otherwise.
*/
'afterRefreshDimensions',
/**
* Cancellable hook, called after resizing a window, but before redrawing a table.
*
* @event Hooks#beforeRefreshDimensions
* @param {Object} previousDimensions Previous dimensions of the container.
* @param {Object} currentDimensions Current dimensions of the container.
* @param {Boolean} actionPossible `true`, if current and previous dimensions are different, `false` otherwise.
* @returns {undefined|Boolean} If the callback returns `false`, the refresh action will not be completed.
*/
'beforeRefreshDimensions'];
var Hooks =
/*#__PURE__*/
function () {
(0, _createClass2.default)(Hooks, null, [{
key: "getSingleton",
value: function getSingleton() {
return getGlobalSingleton();
}
/**
*
*/
}]);
function Hooks() {
(0, _classCallCheck2.default)(this, Hooks);
this.globalBucket = this.createEmptyBucket();
}
/**
* Returns a new object with empty handlers related to every registered hook name.
*
* @returns {Object} The empty bucket object.
*
* @example
* ```js
* Handsontable.hooks.createEmptyBucket();
* // Results:
* {
* ...
* afterCreateCol: [],
* afterCreateRow: [],
* beforeInit: [],
* ...
* }
* ```
*/
(0, _createClass2.default)(Hooks, [{
key: "createEmptyBucket",
value: function createEmptyBucket() {
var bucket = Object.create(null); // eslint-disable-next-line no-return-assign
(0, _array.arrayEach)(REGISTERED_HOOKS, function (hook) {
return bucket[hook] = [];
});
return bucket;
}
/**
* Get hook bucket based on the context of the object or if argument is `undefined`, get the global hook bucket.
*
* @param {Object} [context=null] A Handsontable instance.
* @returns {Object} Returns a global or Handsontable instance bucket.
*/
}, {
key: "getBucket",
value: function getBucket() {
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (context) {
if (!context.pluginHookBucket) {
context.pluginHookBucket = this.createEmptyBucket();
}
return context.pluginHookBucket;
}
return this.globalBucket;
}
/**
* Adds a listener (globally or locally) to a specified hook name.
* If the `context` parameter is provided, the hook will be added only to the instance it references.
* Otherwise, the callback will be used everytime the hook fires on any Handsontable instance.
* You can provide an array of callback functions as the `callback` argument, this way they will all be fired
* once the hook is triggered.
*
* @see Core#addHook
* @param {String} key Hook name.
* @param {Function|Array} callback Callback function or an array of functions.
* @param {Object} [context=null] The context for the hook callback to be added - a Handsontable instance or leave empty.
* @returns {Hooks} Instance of Hooks.
*
* @example
* ```js
* // single callback, added locally
* Handsontable.hooks.add('beforeInit', myCallback, hotInstance);
*
* // single callback, added globally
* Handsontable.hooks.add('beforeInit', myCallback);
*
* // multiple callbacks, added locally
* Handsontable.hooks.add('beforeInit', [myCallback, anotherCallback], hotInstance);
*
* // multiple callbacks, added globally
* Handsontable.hooks.add('beforeInit', [myCallback, anotherCallback]);
* ```
*/
}, {
key: "add",
value: function add(key, callback) {
var _this = this;
var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
if (Array.isArray(callback)) {
(0, _array.arrayEach)(callback, function (c) {
return _this.add(key, c, context);
});
} else {
var bucket = this.getBucket(context);
if (typeof bucket[key] === 'undefined') {
this.register(key);
bucket[key] = [];
}
callback.skip = false;
if (bucket[key].indexOf(callback) === -1) {
// only add a hook if it has not already been added (adding the same hook twice is now silently ignored)
var foundInitialHook = false;
if (callback.initialHook) {
(0, _array.arrayEach)(bucket[key], function (cb, i) {
if (cb.initialHook) {
bucket[key][i] = callback;
foundInitialHook = true;
return false;
}
});
}
if (!foundInitialHook) {
bucket[key].push(callback);
}
}
}
return this;
}
/**
* Adds a listener to a specified hook. After the hook runs this listener will be automatically removed from the bucket.
*
* @see Core#addHookOnce
* @param {String} key Hook/Event name.
* @param {Function|Array} callback Callback function.
* @param {Object} [context=null] A Handsontable instance.
*
* @example
* ```js
* Handsontable.hooks.once('beforeInit', myCallback, hotInstance);
* ```
*/
}, {
key: "once",
value: function once(key, callback) {
var _this2 = this;
var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
if (Array.isArray(callback)) {
(0, _array.arrayEach)(callback, function (c) {
return _this2.once(key, c, context);
});
} else {
callback.runOnce = true;
this.add(key, callback, context);
}
}
/**
* Removes a listener from a hook with a given name. If the `context` argument is provided, it removes a listener from a local hook assigned to the given Handsontable instance.
*
* @see Core#removeHook
* @param {String} key Hook/Event name.
* @param {Function} callback Callback function (needs the be the function that was previously added to the hook).
* @param {Object} [context=null] Handsontable instance.
* @return {Boolean} Returns `true` if hook was removed, `false` otherwise.
*
* @example
* ```js
* Handsontable.hooks.remove('beforeInit', myCallback);
* ```
*/
}, {
key: "remove",
value: function remove(key, callback) {
var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var bucket = this.getBucket(context);
if (typeof bucket[key] !== 'undefined') {
if (bucket[key].indexOf(callback) >= 0) {
callback.skip = true;
return true;
}
}
return false;
}
/**
* Checks whether there are any registered listeners for the provided hook name.
* If the `context` parameter is provided, it only checks for listeners assigned to the given Handsontable instance.
*
* @param {String} key Hook name.
* @param {Object} [context=null] A Handsontable instance.
* @returns {Boolean} `true` for success, `false` otherwise.
*/
}, {
key: "has",
value: function has(key) {
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var bucket = this.getBucket(context);
return !!(bucket[key] !== void 0 && bucket[key].length);
}
/**
* Runs all local and global callbacks assigned to the hook identified by the `key` parameter.
* It returns either a return value from the last called callback or the first parameter (`p1`) passed to the `run` function.
*
* @see Core#runHooks
* @param {Object} context Handsontable instance.
* @param {String} key Hook/Event name.
* @param {*} [p1] Parameter to be passed as an argument to the callback function.
* @param {*} [p2] Parameter to be passed as an argument to the callback function.
* @param {*} [p3] Parameter to be passed as an argument to the callback function.
* @param {*} [p4] Parameter to be passed as an argument to the callback function.
* @param {*} [p5] Parameter to be passed as an argument to the callback function.
* @param {*} [p6] Parameter to be passed as an argument to the callback function.
* @returns {*} Either a return value from the last called callback or `p1`.
*
* @example
* ```js
* Handsontable.hooks.run(hot, 'beforeInit');
* ```
*/
}, {
key: "run",
value: function run(context, key, p1, p2, p3, p4, p5, p6) {
{
var globalHandlers = this.globalBucket[key];
var length = globalHandlers ? globalHandlers.length : 0;
var index = 0;
if (length) {
// Do not optimise this loop with arrayEach or arrow function! If you do You'll decrease perf because of GC.
while (index < length) {
if (!globalHandlers[index] || globalHandlers[index].skip) {
index += 1;
/* eslint-disable no-continue */
continue;
} // performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture
var res = globalHandlers[index].call(context, p1, p2, p3, p4, p5, p6);
if (res !== void 0) {
// eslint-disable-next-line no-param-reassign
p1 = res;
}
if (globalHandlers[index] && globalHandlers[index].runOnce) {
this.remove(key, globalHandlers[index]);
}
index += 1;
}
}
}
{
var localHandlers = this.getBucket(context)[key];
var _length = localHandlers ? localHandlers.length : 0;
var _index = 0;
if (_length) {
// Do not optimise this loop with arrayEach or arrow function! If you do You'll decrease perf because of GC.
while (_index < _length) {
if (!localHandlers[_index] || localHandlers[_index].skip) {
_index += 1;
/* eslint-disable no-continue */
continue;
} // performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture
var _res = localHandlers[_index].call(context, p1, p2, p3, p4, p5, p6);
if (_res !== void 0) {
// eslint-disable-next-line no-param-reassign
p1 = _res;
}
if (localHandlers[_index] && localHandlers[_index].runOnce) {
this.remove(key, localHandlers[_index], context);
}
_index += 1;
}
}
}
return p1;
}
/**
* Destroy all listeners connected to the context. If no context is provided, the global listeners will be destroyed.
*
* @param {Object} [context=null] A Handsontable instance.
* @example
* ```js
* // destroy the global listeners
* Handsontable.hooks.destroy();
*
* // destroy the local listeners
* Handsontable.hooks.destroy(hotInstance);
* ```
*/
}, {
key: "destroy",
value: function destroy() {
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
// eslint-disable-next-line no-return-assign
(0, _object.objectEach)(this.getBucket(context), function (value, key, bucket) {
return bucket[key].length = 0;
});
}
/**
* Registers a hook name (adds it to the list of the known hook names). Used by plugins.
* It is not necessary to call register, but if you use it, your plugin hook will be used returned by
* the `getRegistered` method. (which itself is used in the demo https://docs.handsontable.com/tutorial-callbacks.html).
*
* @param key {String} The hook name.
*
* @example
* ```js
* Handsontable.hooks.register('myHook');
* ```
*/
}, {
key: "register",
value: function register(key) {
if (!this.isRegistered(key)) {
REGISTERED_HOOKS.push(key);
}
}
/**
* Deregisters a hook name (removes it from the list of known hook names).
*
* @param key {String} Hook name.
*
* @example
* ```js
* Handsontable.hooks.deregister('myHook');
* ```
*/
}, {
key: "deregister",
value: function deregister(key) {
if (this.isRegistered(key)) {
REGISTERED_HOOKS.splice(REGISTERED_HOOKS.indexOf(key), 1);
}
}
/**
* Returns a boolean depending on if a hook by such name has been registered.
*
* @param key {String} Hook name.
* @returns {Boolean} `true` for success, `false` otherwise.
*
* @example
* ```js
* Handsontable.hooks.isRegistered('beforeInit');
*
* // Results:
* true
* ```
*/
}, {
key: "isRegistered",
value: function isRegistered(key) {
return REGISTERED_HOOKS.indexOf(key) >= 0;
}
/**
* Returns an array of registered hooks.
*
* @returns {Array} An array of registered hooks.
*
* @example
* ```js
* Handsontable.hooks.getRegistered();
*
* // Results:
* [
* ...
* 'beforeInit',
* 'beforeRender',
* 'beforeSetRangeEnd',
* 'beforeDrawBorders',
* 'beforeChange',
* ...
* ]
* ```
*/
}, {
key: "getRegistered",
value: function getRegistered() {
return REGISTERED_HOOKS;
}
}]);
return Hooks;
}();
var globalSingleton = new Hooks();
function getGlobalSingleton() {
return globalSingleton;
}
var _default = Hooks;
exports.default = _default;
/***/ }),
/* 45 */
/***/ (function(module, exports) {
function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
function _typeof(obj) {
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
module.exports = _typeof = function _typeof(obj) {
return _typeof2(obj);
};
} else {
module.exports = _typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
};
}
return _typeof(obj);
}
module.exports = _typeof;
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(28);
// Thank's IE8 for his funny defineProperty
module.exports = !fails(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(43);
module.exports = function (it) {
if (!isObject(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _array = __webpack_require__(3);
var _object = __webpack_require__(4);
var MIXIN_NAME = 'localHooks';
/**
* Mixin object to extend objects functionality for local hooks.
*
* @type {Object}
*/
var localHooks = {
/**
* Internal hooks storage.
*/
_localHooks: Object.create(null),
/**
* Add hook to the collection.
*
* @param {String} key Hook name.
* @param {Function} callback Hook callback
* @returns {Object}
*/
addLocalHook: function addLocalHook(key, callback) {
if (!this._localHooks[key]) {
this._localHooks[key] = [];
}
this._localHooks[key].push(callback);
return this;
},
/**
* Run hooks.
*
* @param {String} key Hook name.
* @param {*} params
*/
runLocalHooks: function runLocalHooks(key) {
var _this = this;
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
params[_key - 1] = arguments[_key];
}
if (this._localHooks[key]) {
(0, _array.arrayEach)(this._localHooks[key], function (callback) {
return callback.apply(_this, params);
});
}
},
/**
* Clear all added hooks.
*
* @returns {Object}
*/
clearLocalHooks: function clearLocalHooks() {
this._localHooks = {};
return this;
}
};
(0, _object.defineGetter)(localHooks, 'MIXIN_NAME', MIXIN_NAME, {
writable: false,
enumerable: false
});
var _default = localHooks;
exports.default = _default;
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fixRegExpWellKnownSymbolLogic = __webpack_require__(131);
var isRegExp = __webpack_require__(162);
var anObject = __webpack_require__(47);
var requireObjectCoercible = __webpack_require__(51);
var speciesConstructor = __webpack_require__(416);
var advanceStringIndex = __webpack_require__(163);
var toLength = __webpack_require__(54);
var callRegExpExec = __webpack_require__(132);
var regexpExec = __webpack_require__(161);
var fails = __webpack_require__(28);
var arrayPush = [].push;
var min = Math.min;
var MAX_UINT32 = 0xFFFFFFFF;
// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
// @@split logic
fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
var internalSplit;
if (
'abbc'.split(/(b)*/)[1] == 'c' ||
'test'.split(/(?:)/, -1).length != 4 ||
'ab'.split(/(?:ab)*/).length != 2 ||
'.'.split(/(.?)(.?)/).length != 4 ||
'.'.split(/()()/).length > 1 ||
''.split(/.?/).length
) {
// based on es5-shim implementation, need to rework it
internalSplit = function (separator, limit) {
var string = String(requireObjectCoercible(this));
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
if (lim === 0) return [];
if (separator === undefined) return [string];
// If `separator` is not a regex, use native split
if (!isRegExp(separator)) {
return nativeSplit.call(string, separator, lim);
}
var output = [];
var flags = (separator.ignoreCase ? 'i' : '') +
(separator.multiline ? 'm' : '') +
(separator.unicode ? 'u' : '') +
(separator.sticky ? 'y' : '');
var lastLastIndex = 0;
// Make `global` and avoid `lastIndex` issues by working with a copy
var separatorCopy = new RegExp(separator.source, flags + 'g');
var match, lastIndex, lastLength;
while (match = regexpExec.call(separatorCopy, string)) {
lastIndex = separatorCopy.lastIndex;
if (lastIndex > lastLastIndex) {
output.push(string.slice(lastLastIndex, match.index));
if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
lastLength = match[0].length;
lastLastIndex = lastIndex;
if (output.length >= lim) break;
}
if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
}
if (lastLastIndex === string.length) {
if (lastLength || !separatorCopy.test('')) output.push('');
} else output.push(string.slice(lastLastIndex));
return output.length > lim ? output.slice(0, lim) : output;
};
// Chakra, V8
} else if ('0'.split(undefined, 0).length) {
internalSplit = function (separator, limit) {
return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
};
} else internalSplit = nativeSplit;
return [
// `String.prototype.split` method
// https://tc39.github.io/ecma262/#sec-string.prototype.split
function split(separator, limit) {
var O = requireObjectCoercible(this);
var splitter = separator == undefined ? undefined : separator[SPLIT];
return splitter !== undefined
? splitter.call(separator, O, limit)
: internalSplit.call(String(O), separator, limit);
},
// `RegExp.prototype[@@split]` method
// https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
//
// NOTE: This cannot be properly polyfilled in engines that don't support
// the 'y' flag.
function (regexp, limit) {
var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
if (res.done) return res.value;
var rx = anObject(regexp);
var S = String(this);
var C = speciesConstructor(rx, RegExp);
var unicodeMatching = rx.unicode;
var flags = (rx.ignoreCase ? 'i' : '') +
(rx.multiline ? 'm' : '') +
(rx.unicode ? 'u' : '') +
(SUPPORTS_Y ? 'y' : 'g');
// ^(? + rx + ) is needed, in combination with some S slicing, to
// simulate the 'y' flag.
var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
if (lim === 0) return [];
if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
var p = 0;
var q = 0;
var A = [];
while (q < S.length) {
splitter.lastIndex = SUPPORTS_Y ? q : 0;
var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));
var e;
if (
z === null ||
(e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
) {
q = advanceStringIndex(S, q, unicodeMatching);
} else {
A.push(S.slice(p, q));
if (A.length === lim) return A;
for (var i = 1; i <= z.length - 1; i++) {
A.push(z[i]);
if (A.length === lim) return A;
}
q = p = e;
}
}
A.push(S.slice(p));
return A;
}
];
}, !SUPPORTS_Y);
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
var _recordTranslator = __webpack_require__(486);
exports.getTranslator = _recordTranslator.getTranslator;
var _valueMap = _interopRequireDefault(__webpack_require__(367));
exports.ValueMap = _valueMap.default;
var _indexMap = _interopRequireDefault(__webpack_require__(364));
exports.IndexMap = _indexMap.default;
var _skipMap = _interopRequireDefault(__webpack_require__(366));
exports.SkipMap = _skipMap.default;
var _baseMap = _interopRequireDefault(__webpack_require__(172));
exports.BaseMap = _baseMap.default;
/***/ }),
/* 51 */
/***/ (function(module, exports) {
// `RequireObjectCoercible` abstract operation
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
module.exports = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/* 52 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(46);
var IE8_DOM_DEFINE = __webpack_require__(185);
var anObject = __webpack_require__(47);
var toPrimitive = __webpack_require__(96);
var nativeDefineProperty = Object.defineProperty;
// `Object.defineProperty` method
// https://tc39.github.io/ecma262/#sec-object.defineproperty
exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return nativeDefineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(88);
var min = Math.min;
// `ToLength` abstract operation
// https://tc39.github.io/ecma262/#sec-tolength
module.exports = function (argument) {
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};
/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(21);
var from = __webpack_require__(415);
var checkCorrectnessOfIteration = __webpack_require__(202);
var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
Array.from(iterable);
});
// `Array.from` method
// https://tc39.github.io/ecma262/#sec-array.from
$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
from: from
});
/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var IndexedObject = __webpack_require__(119);
var toIndexedObject = __webpack_require__(67);
var sloppyArrayMethod = __webpack_require__(130);
var nativeJoin = [].join;
var ES3_STRINGS = IndexedObject != Object;
var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
// `Array.prototype.join` method
// https://tc39.github.io/ecma262/#sec-array.prototype.join
$({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
join: function join(separator) {
return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
}
});
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(25);
__webpack_require__(13);
__webpack_require__(32);
__webpack_require__(49);
exports.__esModule = true;
exports.isPrintableChar = isPrintableChar;
exports.isMetaKey = isMetaKey;
exports.isCtrlKey = isCtrlKey;
exports.isCtrlMetaKey = isCtrlMetaKey;
exports.isKey = isKey;
exports.KEY_CODES = void 0;
var _array = __webpack_require__(3);
var 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: 17,
COMMAND_LEFT: 91,
COMMAND_RIGHT: 93,
COMMAND_FIREFOX: 224,
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,
C: 67,
D: 68,
F: 70,
L: 76,
O: 79,
P: 80,
S: 83,
V: 86,
X: 88
};
/**
* Returns true if keyCode represents a printable character.
*
* @param {Number} keyCode
* @returns {Boolean}
*/
exports.KEY_CODES = KEY_CODES;
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;
}
/**
* Checks if passed key code is ctrl or cmd key. Depends on what OS the code runs it check key code based on
* different meta key codes.
*
* @param {Number} keyCode Key code to check.
* @returns {Boolean}
*/
function isCtrlKey(keyCode) {
var keys = [];
if (navigator.platform.includes('Mac')) {
keys.push(KEY_CODES.COMMAND_LEFT, KEY_CODES.COMMAND_RIGHT, KEY_CODES.COMMAND_FIREFOX);
} else {
keys.push(KEY_CODES.CONTROL);
}
return keys.includes(keyCode);
}
/**
* Checks if passed key code is ctrl or cmd key. This helper checks if the key code matches to meta keys
* regardless of the OS on which it is running.
*
* @param {Number} keyCode Key code to check.
* @returns {Boolean}
*/
function isCtrlMetaKey(keyCode) {
return [KEY_CODES.CONTROL, KEY_CODES.COMMAND_LEFT, KEY_CODES.COMMAND_RIGHT, KEY_CODES.COMMAND_FIREFOX].includes(keyCode);
}
/**
* @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;
}
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(46);
var defineProperty = __webpack_require__(53).f;
var FunctionPrototype = Function.prototype;
var FunctionPrototypeToString = FunctionPrototype.toString;
var nameRE = /^\s*function ([^ (]*)/;
var NAME = 'name';
// Function instances `.name` property
// https://tc39.github.io/ecma262/#sec-function-instances-name
if (DESCRIPTORS && !(NAME in FunctionPrototype)) {
defineProperty(FunctionPrototype, NAME, {
configurable: true,
get: function () {
try {
return FunctionPrototypeToString.call(this).match(nameRE)[1];
} catch (error) {
return '';
}
}
});
}
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(14);
__webpack_require__(9);
__webpack_require__(12);
__webpack_require__(23);
__webpack_require__(16);
exports.__esModule = true;
exports.RegisteredEditor = RegisteredEditor;
exports.getEditorInstance = exports._getEditorInstance = _getEditorInstance;
exports.registerEditor = _register;
exports.getEditor = _getItem;
exports.getRegisteredEditors = exports.getRegisteredEditorNames = exports.hasEditor = void 0;
var _staticRegister2 = _interopRequireDefault(__webpack_require__(78));
var _pluginHooks = _interopRequireDefault(__webpack_require__(44));
var _baseEditor = _interopRequireDefault(__webpack_require__(107));
var _autocompleteEditor = _interopRequireDefault(__webpack_require__(355));
var _checkboxEditor = _interopRequireDefault(__webpack_require__(453));
var _dateEditor = _interopRequireDefault(__webpack_require__(454));
var _dropdownEditor = _interopRequireDefault(__webpack_require__(457));
var _handsontableEditor = _interopRequireDefault(__webpack_require__(356));
var _numericEditor = _interopRequireDefault(__webpack_require__(458));
var _passwordEditor = _interopRequireDefault(__webpack_require__(459));
var _selectEditor = _interopRequireDefault(__webpack_require__(460));
var _textEditor = _interopRequireDefault(__webpack_require__(111));
/**
* Utility to register editors and common namespace for keeping reference to all editor classes
*/
var registeredEditorClasses = new WeakMap();
var _staticRegister = (0, _staticRegister2.default)('editors'),
register = _staticRegister.register,
getItem = _staticRegister.getItem,
hasItem = _staticRegister.hasItem,
getNames = _staticRegister.getNames,
getValues = _staticRegister.getValues;
exports.getRegisteredEditors = getValues;
exports.getRegisteredEditorNames = getNames;
exports.hasEditor = hasItem;
_register('base', _baseEditor.default);
_register('autocomplete', _autocompleteEditor.default);
_register('checkbox', _checkboxEditor.default);
_register('date', _dateEditor.default);
_register('dropdown', _dropdownEditor.default);
_register('handsontable', _handsontableEditor.default);
_register('numeric', _numericEditor.default);
_register('password', _passwordEditor.default);
_register('select', _selectEditor.default);
_register('text', _textEditor.default);
function RegisteredEditor(editorClass) {
var instances = {};
var Clazz = editorClass;
this.getConstructor = function () {
return editorClass;
};
this.getInstance = function (hotInstance) {
if (!(hotInstance.guid in instances)) {
instances[hotInstance.guid] = new Clazz(hotInstance);
}
return instances[hotInstance.guid];
};
_pluginHooks.default.getSingleton().add('afterDestroy', function () {
instances[this.guid] = null;
});
}
/**
* Returns instance (singleton) of editor class.
*
* @param {String} name Name of an editor under which it has been stored.
* @param {Object} hotInstance Instance of Handsontable.
* @returns {Function} Returns instance of editor.
*/
function _getEditorInstance(name, hotInstance) {
var editor;
if (typeof name === 'function') {
if (!registeredEditorClasses.get(name)) {
_register(null, name);
}
editor = registeredEditorClasses.get(name);
} else if (typeof name === 'string') {
editor = getItem(name);
} else {
throw Error('Only strings and functions can be passed as "editor" parameter');
}
if (!editor) {
throw Error("No editor registered under name \"".concat(name, "\""));
}
return editor.getInstance(hotInstance);
}
/**
* Retrieve editor class.
*
* @param {String} name Editor identification.
* @returns {Function} Returns editor class.
*/
function _getItem(name) {
if (!hasItem(name)) {
throw Error("No registered editor found under \"".concat(name, "\" name"));
}
return getItem(name).getConstructor();
}
/**
* Register editor class under specified name.
*
* @param {String} name Editor identification.
* @param {Function} editorClass Editor class.
*/
function _register(name, editorClass) {
var editorWrapper = new RegisteredEditor(editorClass);
if (typeof name === 'string') {
register(name, editorWrapper);
}
registeredEditorClasses.set(editorClass, editorWrapper);
}
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.log = log;
exports.warn = warn;
exports.info = info;
exports.error = error;
var _mixed = __webpack_require__(27);
/* eslint-disable no-console */
/* eslint-disable no-restricted-globals */
/**
* "In Internet Explorer 9 (and 8), the console object is only exposed when the developer tools are opened
* for a particular tab."
*
* Source: https://stackoverflow.com/a/5473193
*/
/**
* Logs message to the console if the `console` object is exposed.
*
* @param {...*} args Values which will be logged.
*/
function log() {
if ((0, _mixed.isDefined)(console)) {
var _console;
(_console = console).log.apply(_console, arguments);
}
}
/**
* Logs warn to the console if the `console` object is exposed.
*
* @param {...*} args Values which will be logged.
*/
function warn() {
if ((0, _mixed.isDefined)(console)) {
var _console2;
(_console2 = console).warn.apply(_console2, arguments);
}
}
/**
* Logs info to the console if the `console` object is exposed.
*
* @param {...*} args Values which will be logged.
*/
function info() {
if ((0, _mixed.isDefined)(console)) {
var _console3;
(_console3 = console).info.apply(_console3, arguments);
}
}
/**
* Logs error to the console if the `console` object is exposed.
*
* @param {...*} args Values which will be logged.
*/
function error() {
if ((0, _mixed.isDefined)(console)) {
var _console4;
(_console4 = console).error.apply(_console4, arguments);
}
}
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
var requireObjectCoercible = __webpack_require__(51);
// `ToObject` abstract operation
// https://tc39.github.io/ecma262/#sec-toobject
module.exports = function (argument) {
return Object(requireObjectCoercible(argument));
};
/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var collection = __webpack_require__(128);
var collectionStrong = __webpack_require__(205);
// `Map` constructor
// https://tc39.github.io/ecma262/#sec-map-objects
module.exports = collection('Map', function (get) {
return function Map() { return get(this, arguments.length ? arguments[0] : undefined); };
}, collectionStrong, true);
/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(17);
__webpack_require__(36);
__webpack_require__(33);
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__(3);
/**
* 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;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
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() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
if (remainHits) {
remainHits -= 1;
return func.apply(this, args);
}
return funcThrottle.apply(this, args);
}
_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;
function _debounce() {
var _this2 = this;
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
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 _len4 = arguments.length, functions = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
functions[_key4] = arguments[_key4];
}
var firstFunc = functions[0],
restFunc = functions.slice(1);
return function _pipe() {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
return (0, _array.arrayReduce)(restFunc, function (acc, fn) {
return fn(acc);
}, firstFunc.apply(this, args));
};
}
/**
* 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 _len6 = arguments.length, params = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
params[_key6 - 1] = arguments[_key6];
}
return function _partial() {
for (var _len7 = arguments.length, restParams = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
restParams[_key7] = arguments[_key7];
}
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 _len8 = arguments.length, params = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
params[_key8] = arguments[_key8];
}
var passedArgsSoFar = argsSoFar.concat(params);
var result;
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 _len9 = arguments.length, params = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
params[_key9] = arguments[_key9];
}
var passedArgsSoFar = argsSoFar.concat(params.reverse());
var result;
if (passedArgsSoFar.length >= argsLength) {
result = func.apply(this, passedArgsSoFar);
} else {
result = given(passedArgsSoFar);
}
return result;
};
}
return given([]);
}
/***/ }),
/* 64 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {var require;//! moment.js
//! version : 2.20.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
;(function (global, factory) {
true ? module.exports = factory() :
undefined
}(this, (function () { 'use strict';
var hookCallback;
function hooks () {
return hookCallback.apply(null, arguments);
}
// This is done to register the method called with moment()
// without creating circular dependencies.
function setHookCallback (callback) {
hookCallback = callback;
}
function isArray(input) {
return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
}
function isObject(input) {
// IE8 will treat undefined and null as object if it wasn't for
// input != null
return input != null && Object.prototype.toString.call(input) === '[object Object]';
}
function isObjectEmpty(obj) {
if (Object.getOwnPropertyNames) {
return (Object.getOwnPropertyNames(obj).length === 0);
} else {
var k;
for (k in obj) {
if (obj.hasOwnProperty(k)) {
return false;
}
}
return true;
}
}
function isUndefined(input) {
return input === void 0;
}
function isNumber(input) {
return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
}
function isDate(input) {
return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
}
function map(arr, fn) {
var res = [], i;
for (i = 0; i < arr.length; ++i) {
res.push(fn(arr[i], i));
}
return res;
}
function hasOwnProp(a, b) {
return Object.prototype.hasOwnProperty.call(a, b);
}
function extend(a, b) {
for (var i in b) {
if (hasOwnProp(b, i)) {
a[i] = b[i];
}
}
if (hasOwnProp(b, 'toString')) {
a.toString = b.toString;
}
if (hasOwnProp(b, 'valueOf')) {
a.valueOf = b.valueOf;
}
return a;
}
function createUTC (input, format, locale, strict) {
return createLocalOrUTC(input, format, locale, strict, true).utc();
}
function defaultParsingFlags() {
// We need to deep clone this object.
return {
empty : false,
unusedTokens : [],
unusedInput : [],
overflow : -2,
charsLeftOver : 0,
nullInput : false,
invalidMonth : null,
invalidFormat : false,
userInvalidated : false,
iso : false,
parsedDateParts : [],
meridiem : null,
rfc2822 : false,
weekdayMismatch : false
};
}
function getParsingFlags(m) {
if (m._pf == null) {
m._pf = defaultParsingFlags();
}
return m._pf;
}
var some;
if (Array.prototype.some) {
some = Array.prototype.some;
} else {
some = function (fun) {
var t = Object(this);
var len = t.length >>> 0;
for (var i = 0; i < len; i++) {
if (i in t && fun.call(this, t[i], i, t)) {
return true;
}
}
return false;
};
}
function isValid(m) {
if (m._isValid == null) {
var flags = getParsingFlags(m);
var parsedParts = some.call(flags.parsedDateParts, function (i) {
return i != null;
});
var isNowValid = !isNaN(m._d.getTime()) &&
flags.overflow < 0 &&
!flags.empty &&
!flags.invalidMonth &&
!flags.invalidWeekday &&
!flags.weekdayMismatch &&
!flags.nullInput &&
!flags.invalidFormat &&
!flags.userInvalidated &&
(!flags.meridiem || (flags.meridiem && parsedParts));
if (m._strict) {
isNowValid = isNowValid &&
flags.charsLeftOver === 0 &&
flags.unusedTokens.length === 0 &&
flags.bigHour === undefined;
}
if (Object.isFrozen == null || !Object.isFrozen(m)) {
m._isValid = isNowValid;
}
else {
return isNowValid;
}
}
return m._isValid;
}
function createInvalid (flags) {
var m = createUTC(NaN);
if (flags != null) {
extend(getParsingFlags(m), flags);
}
else {
getParsingFlags(m).userInvalidated = true;
}
return m;
}
// Plugins that add properties should also add the key here (null value),
// so we can properly clone ourselves.
var momentProperties = hooks.momentProperties = [];
function copyConfig(to, from) {
var i, prop, val;
if (!isUndefined(from._isAMomentObject)) {
to._isAMomentObject = from._isAMomentObject;
}
if (!isUndefined(from._i)) {
to._i = from._i;
}
if (!isUndefined(from._f)) {
to._f = from._f;
}
if (!isUndefined(from._l)) {
to._l = from._l;
}
if (!isUndefined(from._strict)) {
to._strict = from._strict;
}
if (!isUndefined(from._tzm)) {
to._tzm = from._tzm;
}
if (!isUndefined(from._isUTC)) {
to._isUTC = from._isUTC;
}
if (!isUndefined(from._offset)) {
to._offset = from._offset;
}
if (!isUndefined(from._pf)) {
to._pf = getParsingFlags(from);
}
if (!isUndefined(from._locale)) {
to._locale = from._locale;
}
if (momentProperties.length > 0) {
for (i = 0; i < momentProperties.length; i++) {
prop = momentProperties[i];
val = from[prop];
if (!isUndefined(val)) {
to[prop] = val;
}
}
}
return to;
}
var updateInProgress = false;
// Moment prototype object
function Moment(config) {
copyConfig(this, config);
this._d = new Date(config._d != null ? config._d.getTime() : NaN);
if (!this.isValid()) {
this._d = new Date(NaN);
}
// Prevent infinite loop in case updateOffset creates new moment
// objects.
if (updateInProgress === false) {
updateInProgress = true;
hooks.updateOffset(this);
updateInProgress = false;
}
}
function isMoment (obj) {
return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
}
function absFloor (number) {
if (number < 0) {
// -0 -> 0
return Math.ceil(number) || 0;
} else {
return Math.floor(number);
}
}
function toInt(argumentForCoercion) {
var coercedNumber = +argumentForCoercion,
value = 0;
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
value = absFloor(coercedNumber);
}
return value;
}
// compare two arrays, return the number of differences
function compareArrays(array1, array2, dontConvert) {
var len = Math.min(array1.length, array2.length),
lengthDiff = Math.abs(array1.length - array2.length),
diffs = 0,
i;
for (i = 0; i < len; i++) {
if ((dontConvert && array1[i] !== array2[i]) ||
(!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
diffs++;
}
}
return diffs + lengthDiff;
}
function warn(msg) {
if (hooks.suppressDeprecationWarnings === false &&
(typeof console !== 'undefined') && console.warn) {
console.warn('Deprecation warning: ' + msg);
}
}
function deprecate(msg, fn) {
var firstTime = true;
return extend(function () {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(null, msg);
}
if (firstTime) {
var args = [];
var arg;
for (var i = 0; i < arguments.length; i++) {
arg = '';
if (typeof arguments[i] === 'object') {
arg += '\n[' + i + '] ';
for (var key in arguments[0]) {
arg += key + ': ' + arguments[0][key] + ', ';
}
arg = arg.slice(0, -2); // Remove trailing comma and space
} else {
arg = arguments[i];
}
args.push(arg);
}
warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
firstTime = false;
}
return fn.apply(this, arguments);
}, fn);
}
var deprecations = {};
function deprecateSimple(name, msg) {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(name, msg);
}
if (!deprecations[name]) {
warn(msg);
deprecations[name] = true;
}
}
hooks.suppressDeprecationWarnings = false;
hooks.deprecationHandler = null;
function isFunction(input) {
return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
}
function set (config) {
var prop, i;
for (i in config) {
prop = config[i];
if (isFunction(prop)) {
this[i] = prop;
} else {
this['_' + i] = prop;
}
}
this._config = config;
// Lenient ordinal parsing accepts just a number in addition to
// number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
// TODO: Remove "ordinalParse" fallback in next major release.
this._dayOfMonthOrdinalParseLenient = new RegExp(
(this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
'|' + (/\d{1,2}/).source);
}
function mergeConfigs(parentConfig, childConfig) {
var res = extend({}, parentConfig), prop;
for (prop in childConfig) {
if (hasOwnProp(childConfig, prop)) {
if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
res[prop] = {};
extend(res[prop], parentConfig[prop]);
extend(res[prop], childConfig[prop]);
} else if (childConfig[prop] != null) {
res[prop] = childConfig[prop];
} else {
delete res[prop];
}
}
}
for (prop in parentConfig) {
if (hasOwnProp(parentConfig, prop) &&
!hasOwnProp(childConfig, prop) &&
isObject(parentConfig[prop])) {
// make sure changes to properties don't modify parent config
res[prop] = extend({}, res[prop]);
}
}
return res;
}
function Locale(config) {
if (config != null) {
this.set(config);
}
}
var keys;
if (Object.keys) {
keys = Object.keys;
} else {
keys = function (obj) {
var i, res = [];
for (i in obj) {
if (hasOwnProp(obj, i)) {
res.push(i);
}
}
return res;
};
}
var defaultCalendar = {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
};
function calendar (key, mom, now) {
var output = this._calendar[key] || this._calendar['sameElse'];
return isFunction(output) ? output.call(mom, now) : output;
}
var defaultLongDateFormat = {
LTS : 'h:mm:ss A',
LT : 'h:mm A',
L : 'MM/DD/YYYY',
LL : 'MMMM D, YYYY',
LLL : 'MMMM D, YYYY h:mm A',
LLLL : 'dddd, MMMM D, YYYY h:mm A'
};
function longDateFormat (key) {
var format = this._longDateFormat[key],
formatUpper = this._longDateFormat[key.toUpperCase()];
if (format || !formatUpper) {
return format;
}
this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
return val.slice(1);
});
return this._longDateFormat[key];
}
var defaultInvalidDate = 'Invalid date';
function invalidDate () {
return this._invalidDate;
}
var defaultOrdinal = '%d';
var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
function ordinal (number) {
return this._ordinal.replace('%d', number);
}
var defaultRelativeTime = {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
ss : '%d seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
};
function relativeTime (number, withoutSuffix, string, isFuture) {
var output = this._relativeTime[string];
return (isFunction(output)) ?
output(number, withoutSuffix, string, isFuture) :
output.replace(/%d/i, number);
}
function pastFuture (diff, output) {
var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
return isFunction(format) ? format(output) : format.replace(/%s/i, output);
}
var aliases = {};
function addUnitAlias (unit, shorthand) {
var lowerCase = unit.toLowerCase();
aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
}
function normalizeUnits(units) {
return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
}
function normalizeObjectUnits(inputObject) {
var normalizedInput = {},
normalizedProp,
prop;
for (prop in inputObject) {
if (hasOwnProp(inputObject, prop)) {
normalizedProp = normalizeUnits(prop);
if (normalizedProp) {
normalizedInput[normalizedProp] = inputObject[prop];
}
}
}
return normalizedInput;
}
var priorities = {};
function addUnitPriority(unit, priority) {
priorities[unit] = priority;
}
function getPrioritizedUnits(unitsObj) {
var units = [];
for (var u in unitsObj) {
units.push({unit: u, priority: priorities[u]});
}
units.sort(function (a, b) {
return a.priority - b.priority;
});
return units;
}
function zeroFill(number, targetLength, forceSign) {
var absNumber = '' + Math.abs(number),
zerosToFill = targetLength - absNumber.length,
sign = number >= 0;
return (sign ? (forceSign ? '+' : '') : '-') +
Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
}
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
var formatFunctions = {};
var formatTokenFunctions = {};
// token: 'M'
// padded: ['MM', 2]
// ordinal: 'Mo'
// callback: function () { this.month() + 1 }
function addFormatToken (token, padded, ordinal, callback) {
var func = callback;
if (typeof callback === 'string') {
func = function () {
return this[callback]();
};
}
if (token) {
formatTokenFunctions[token] = func;
}
if (padded) {
formatTokenFunctions[padded[0]] = function () {
return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
};
}
if (ordinal) {
formatTokenFunctions[ordinal] = function () {
return this.localeData().ordinal(func.apply(this, arguments), token);
};
}
}
function removeFormattingTokens(input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|\]$/g, '');
}
return input.replace(/\\/g, '');
}
function makeFormatFunction(format) {
var array = format.match(formattingTokens), i, length;
for (i = 0, length = array.length; i < length; i++) {
if (formatTokenFunctions[array[i]]) {
array[i] = formatTokenFunctions[array[i]];
} else {
array[i] = removeFormattingTokens(array[i]);
}
}
return function (mom) {
var output = '', i;
for (i = 0; i < length; i++) {
output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
}
return output;
};
}
// format date using native date object
function formatMoment(m, format) {
if (!m.isValid()) {
return m.localeData().invalidDate();
}
format = expandFormat(format, m.localeData());
formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
return formatFunctions[format](m);
}
function expandFormat(format, locale) {
var i = 5;
function replaceLongDateFormatTokens(input) {
return locale.longDateFormat(input) || input;
}
localFormattingTokens.lastIndex = 0;
while (i >= 0 && localFormattingTokens.test(format)) {
format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
localFormattingTokens.lastIndex = 0;
i -= 1;
}
return format;
}
var match1 = /\d/; // 0 - 9
var match2 = /\d\d/; // 00 - 99
var match3 = /\d{3}/; // 000 - 999
var match4 = /\d{4}/; // 0000 - 9999
var match6 = /[+-]?\d{6}/; // -999999 - 999999
var match1to2 = /\d\d?/; // 0 - 99
var match3to4 = /\d\d\d\d?/; // 999 - 9999
var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
var match1to3 = /\d{1,3}/; // 0 - 999
var match1to4 = /\d{1,4}/; // 0 - 9999
var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
var matchUnsigned = /\d+/; // 0 - inf
var matchSigned = /[+-]?\d+/; // -inf - inf
var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
// any word (or two) characters or numbers including two/three word month in arabic.
// includes scottish gaelic two word and hyphenated months
var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
var regexes = {};
function addRegexToken (token, regex, strictRegex) {
regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
return (isStrict && strictRegex) ? strictRegex : regex;
};
}
function getParseRegexForToken (token, config) {
if (!hasOwnProp(regexes, token)) {
return new RegExp(unescapeFormat(token));
}
return regexes[token](config._strict, config._locale);
}
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
function unescapeFormat(s) {
return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
return p1 || p2 || p3 || p4;
}));
}
function regexEscape(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
var tokens = {};
function addParseToken (token, callback) {
var i, func = callback;
if (typeof token === 'string') {
token = [token];
}
if (isNumber(callback)) {
func = function (input, array) {
array[callback] = toInt(input);
};
}
for (i = 0; i < token.length; i++) {
tokens[token[i]] = func;
}
}
function addWeekParseToken (token, callback) {
addParseToken(token, function (input, array, config, token) {
config._w = config._w || {};
callback(input, config._w, config, token);
});
}
function addTimeToArrayFromToken(token, input, config) {
if (input != null && hasOwnProp(tokens, token)) {
tokens[token](input, config._a, config, token);
}
}
var YEAR = 0;
var MONTH = 1;
var DATE = 2;
var HOUR = 3;
var MINUTE = 4;
var SECOND = 5;
var MILLISECOND = 6;
var WEEK = 7;
var WEEKDAY = 8;
// FORMATTING
addFormatToken('Y', 0, 0, function () {
var y = this.year();
return y <= 9999 ? '' + y : '+' + y;
});
addFormatToken(0, ['YY', 2], 0, function () {
return this.year() % 100;
});
addFormatToken(0, ['YYYY', 4], 0, 'year');
addFormatToken(0, ['YYYYY', 5], 0, 'year');
addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
// ALIASES
addUnitAlias('year', 'y');
// PRIORITIES
addUnitPriority('year', 1);
// PARSING
addRegexToken('Y', matchSigned);
addRegexToken('YY', match1to2, match2);
addRegexToken('YYYY', match1to4, match4);
addRegexToken('YYYYY', match1to6, match6);
addRegexToken('YYYYYY', match1to6, match6);
addParseToken(['YYYYY', 'YYYYYY'], YEAR);
addParseToken('YYYY', function (input, array) {
array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
});
addParseToken('YY', function (input, array) {
array[YEAR] = hooks.parseTwoDigitYear(input);
});
addParseToken('Y', function (input, array) {
array[YEAR] = parseInt(input, 10);
});
// HELPERS
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
function isLeapYear(year) {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
}
// HOOKS
hooks.parseTwoDigitYear = function (input) {
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
};
// MOMENTS
var getSetYear = makeGetSet('FullYear', true);
function getIsLeapYear () {
return isLeapYear(this.year());
}
function makeGetSet (unit, keepTime) {
return function (value) {
if (value != null) {
set$1(this, unit, value);
hooks.updateOffset(this, keepTime);
return this;
} else {
return get(this, unit);
}
};
}
function get (mom, unit) {
return mom.isValid() ?
mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
}
function set$1 (mom, unit, value) {
if (mom.isValid() && !isNaN(value)) {
if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
}
else {
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
}
}
}
// MOMENTS
function stringGet (units) {
units = normalizeUnits(units);
if (isFunction(this[units])) {
return this[units]();
}
return this;
}
function stringSet (units, value) {
if (typeof units === 'object') {
units = normalizeObjectUnits(units);
var prioritized = getPrioritizedUnits(units);
for (var i = 0; i < prioritized.length; i++) {
this[prioritized[i].unit](units[prioritized[i].unit]);
}
} else {
units = normalizeUnits(units);
if (isFunction(this[units])) {
return this[units](value);
}
}
return this;
}
function mod(n, x) {
return ((n % x) + x) % x;
}
var indexOf;
if (Array.prototype.indexOf) {
indexOf = Array.prototype.indexOf;
} else {
indexOf = function (o) {
// I know
var i;
for (i = 0; i < this.length; ++i) {
if (this[i] === o) {
return i;
}
}
return -1;
};
}
function daysInMonth(year, month) {
if (isNaN(year) || isNaN(month)) {
return NaN;
}
var modMonth = mod(month, 12);
year += (month - modMonth) / 12;
return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
}
// FORMATTING
addFormatToken('M', ['MM', 2], 'Mo', function () {
return this.month() + 1;
});
addFormatToken('MMM', 0, 0, function (format) {
return this.localeData().monthsShort(this, format);
});
addFormatToken('MMMM', 0, 0, function (format) {
return this.localeData().months(this, format);
});
// ALIASES
addUnitAlias('month', 'M');
// PRIORITY
addUnitPriority('month', 8);
// PARSING
addRegexToken('M', match1to2);
addRegexToken('MM', match1to2, match2);
addRegexToken('MMM', function (isStrict, locale) {
return locale.monthsShortRegex(isStrict);
});
addRegexToken('MMMM', function (isStrict, locale) {
return locale.monthsRegex(isStrict);
});
addParseToken(['M', 'MM'], function (input, array) {
array[MONTH] = toInt(input) - 1;
});
addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
var month = config._locale.monthsParse(input, token, config._strict);
// if we didn't find a month name, mark the date as invalid.
if (month != null) {
array[MONTH] = month;
} else {
getParsingFlags(config).invalidMonth = input;
}
});
// LOCALES
var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
function localeMonths (m, format) {
if (!m) {
return isArray(this._months) ? this._months :
this._months['standalone'];
}
return isArray(this._months) ? this._months[m.month()] :
this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
}
var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
function localeMonthsShort (m, format) {
if (!m) {
return isArray(this._monthsShort) ? this._monthsShort :
this._monthsShort['standalone'];
}
return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
}
function handleStrictParse(monthName, format, strict) {
var i, ii, mom, llc = monthName.toLocaleLowerCase();
if (!this._monthsParse) {
// this is not used
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
for (i = 0; i < 12; ++i) {
mom = createUTC([2000, i]);
this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
}
}
if (strict) {
if (format === 'MMM') {
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'MMM') {
ii = indexOf.call(this._shortMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeMonthsParse (monthName, format, strict) {
var i, mom, regex;
if (this._monthsParseExact) {
return handleStrictParse.call(this, monthName, format, strict);
}
if (!this._monthsParse) {
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
}
// TODO: add sorting
// Sorting makes sure if one month (or abbr) is a prefix of another
// see sorting in computeMonthsParse
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, i]);
if (strict && !this._longMonthsParse[i]) {
this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
}
if (!strict && !this._monthsParse[i]) {
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
}
// test the regex
if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
return i;
} else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
return i;
} else if (!strict && this._monthsParse[i].test(monthName)) {
return i;
}
}
}
// MOMENTS
function setMonth (mom, value) {
var dayOfMonth;
if (!mom.isValid()) {
// No op
return mom;
}
if (typeof value === 'string') {
if (/^\d+$/.test(value)) {
value = toInt(value);
} else {
value = mom.localeData().monthsParse(value);
// TODO: Another silent failure?
if (!isNumber(value)) {
return mom;
}
}
}
dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
return mom;
}
function getSetMonth (value) {
if (value != null) {
setMonth(this, value);
hooks.updateOffset(this, true);
return this;
} else {
return get(this, 'Month');
}
}
function getDaysInMonth () {
return daysInMonth(this.year(), this.month());
}
var defaultMonthsShortRegex = matchWord;
function monthsShortRegex (isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, '_monthsRegex')) {
computeMonthsParse.call(this);
}
if (isStrict) {
return this._monthsShortStrictRegex;
} else {
return this._monthsShortRegex;
}
} else {
if (!hasOwnProp(this, '_monthsShortRegex')) {
this._monthsShortRegex = defaultMonthsShortRegex;
}
return this._monthsShortStrictRegex && isStrict ?
this._monthsShortStrictRegex : this._monthsShortRegex;
}
}
var defaultMonthsRegex = matchWord;
function monthsRegex (isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, '_monthsRegex')) {
computeMonthsParse.call(this);
}
if (isStrict) {
return this._monthsStrictRegex;
} else {
return this._monthsRegex;
}
} else {
if (!hasOwnProp(this, '_monthsRegex')) {
this._monthsRegex = defaultMonthsRegex;
}
return this._monthsStrictRegex && isStrict ?
this._monthsStrictRegex : this._monthsRegex;
}
}
function computeMonthsParse () {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var shortPieces = [], longPieces = [], mixedPieces = [],
i, mom;
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, i]);
shortPieces.push(this.monthsShort(mom, ''));
longPieces.push(this.months(mom, ''));
mixedPieces.push(this.months(mom, ''));
mixedPieces.push(this.monthsShort(mom, ''));
}
// Sorting makes sure if one month (or abbr) is a prefix of another it
// will match the longer piece.
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
for (i = 0; i < 12; i++) {
shortPieces[i] = regexEscape(shortPieces[i]);
longPieces[i] = regexEscape(longPieces[i]);
}
for (i = 0; i < 24; i++) {
mixedPieces[i] = regexEscape(mixedPieces[i]);
}
this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
this._monthsShortRegex = this._monthsRegex;
this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
}
function createDate (y, m, d, h, M, s, ms) {
// can't just apply() to create a date:
// https://stackoverflow.com/q/181348
var date = new Date(y, m, d, h, M, s, ms);
// the date constructor remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
date.setFullYear(y);
}
return date;
}
function createUTCDate (y) {
var date = new Date(Date.UTC.apply(null, arguments));
// the Date.UTC function remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
return date;
}
// start-of-first-week - start-of-year
function firstWeekOffset(year, dow, doy) {
var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
fwd = 7 + dow - doy,
// first-week day local weekday -- which local weekday is fwd
fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
return -fwdlw + fwd - 1;
}
// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
var localWeekday = (7 + weekday - dow) % 7,
weekOffset = firstWeekOffset(year, dow, doy),
dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
resYear, resDayOfYear;
if (dayOfYear <= 0) {
resYear = year - 1;
resDayOfYear = daysInYear(resYear) + dayOfYear;
} else if (dayOfYear > daysInYear(year)) {
resYear = year + 1;
resDayOfYear = dayOfYear - daysInYear(year);
} else {
resYear = year;
resDayOfYear = dayOfYear;
}
return {
year: resYear,
dayOfYear: resDayOfYear
};
}
function weekOfYear(mom, dow, doy) {
var weekOffset = firstWeekOffset(mom.year(), dow, doy),
week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
resWeek, resYear;
if (week < 1) {
resYear = mom.year() - 1;
resWeek = week + weeksInYear(resYear, dow, doy);
} else if (week > weeksInYear(mom.year(), dow, doy)) {
resWeek = week - weeksInYear(mom.year(), dow, doy);
resYear = mom.year() + 1;
} else {
resYear = mom.year();
resWeek = week;
}
return {
week: resWeek,
year: resYear
};
}
function weeksInYear(year, dow, doy) {
var weekOffset = firstWeekOffset(year, dow, doy),
weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
}
// FORMATTING
addFormatToken('w', ['ww', 2], 'wo', 'week');
addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
// ALIASES
addUnitAlias('week', 'w');
addUnitAlias('isoWeek', 'W');
// PRIORITIES
addUnitPriority('week', 5);
addUnitPriority('isoWeek', 5);
// PARSING
addRegexToken('w', match1to2);
addRegexToken('ww', match1to2, match2);
addRegexToken('W', match1to2);
addRegexToken('WW', match1to2, match2);
addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
week[token.substr(0, 1)] = toInt(input);
});
// HELPERS
// LOCALES
function localeWeek (mom) {
return weekOfYear(mom, this._week.dow, this._week.doy).week;
}
var defaultLocaleWeek = {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
};
function localeFirstDayOfWeek () {
return this._week.dow;
}
function localeFirstDayOfYear () {
return this._week.doy;
}
// MOMENTS
function getSetWeek (input) {
var week = this.localeData().week(this);
return input == null ? week : this.add((input - week) * 7, 'd');
}
function getSetISOWeek (input) {
var week = weekOfYear(this, 1, 4).week;
return input == null ? week : this.add((input - week) * 7, 'd');
}
// FORMATTING
addFormatToken('d', 0, 'do', 'day');
addFormatToken('dd', 0, 0, function (format) {
return this.localeData().weekdaysMin(this, format);
});
addFormatToken('ddd', 0, 0, function (format) {
return this.localeData().weekdaysShort(this, format);
});
addFormatToken('dddd', 0, 0, function (format) {
return this.localeData().weekdays(this, format);
});
addFormatToken('e', 0, 0, 'weekday');
addFormatToken('E', 0, 0, 'isoWeekday');
// ALIASES
addUnitAlias('day', 'd');
addUnitAlias('weekday', 'e');
addUnitAlias('isoWeekday', 'E');
// PRIORITY
addUnitPriority('day', 11);
addUnitPriority('weekday', 11);
addUnitPriority('isoWeekday', 11);
// PARSING
addRegexToken('d', match1to2);
addRegexToken('e', match1to2);
addRegexToken('E', match1to2);
addRegexToken('dd', function (isStrict, locale) {
return locale.weekdaysMinRegex(isStrict);
});
addRegexToken('ddd', function (isStrict, locale) {
return locale.weekdaysShortRegex(isStrict);
});
addRegexToken('dddd', function (isStrict, locale) {
return locale.weekdaysRegex(isStrict);
});
addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
var weekday = config._locale.weekdaysParse(input, token, config._strict);
// if we didn't get a weekday name, mark the date as invalid
if (weekday != null) {
week.d = weekday;
} else {
getParsingFlags(config).invalidWeekday = input;
}
});
addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
week[token] = toInt(input);
});
// HELPERS
function parseWeekday(input, locale) {
if (typeof input !== 'string') {
return input;
}
if (!isNaN(input)) {
return parseInt(input, 10);
}
input = locale.weekdaysParse(input);
if (typeof input === 'number') {
return input;
}
return null;
}
function parseIsoWeekday(input, locale) {
if (typeof input === 'string') {
return locale.weekdaysParse(input) % 7 || 7;
}
return isNaN(input) ? null : input;
}
// LOCALES
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
function localeWeekdays (m, format) {
if (!m) {
return isArray(this._weekdays) ? this._weekdays :
this._weekdays['standalone'];
}
return isArray(this._weekdays) ? this._weekdays[m.day()] :
this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
}
var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
function localeWeekdaysShort (m) {
return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
}
var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
function localeWeekdaysMin (m) {
return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
}
function handleStrictParse$1(weekdayName, format, strict) {
var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._shortWeekdaysParse = [];
this._minWeekdaysParse = [];
for (i = 0; i < 7; ++i) {
mom = createUTC([2000, 1]).day(i);
this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
}
}
if (strict) {
if (format === 'dddd') {
ii = indexOf.call(this._weekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'dddd') {
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeWeekdaysParse (weekdayName, format, strict) {
var i, mom, regex;
if (this._weekdaysParseExact) {
return handleStrictParse$1.call(this, weekdayName, format, strict);
}
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._minWeekdaysParse = [];
this._shortWeekdaysParse = [];
this._fullWeekdaysParse = [];
}
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, 1]).day(i);
if (strict && !this._fullWeekdaysParse[i]) {
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
}
if (!this._weekdaysParse[i]) {
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
}
// test the regex
if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
return i;
}
}
}
// MOMENTS
function getSetDayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
if (input != null) {
input = parseWeekday(input, this.localeData());
return this.add(input - day, 'd');
} else {
return day;
}
}
function getSetLocaleDayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
return input == null ? weekday : this.add(input - weekday, 'd');
}
function getSetISODayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
// behaves the same as moment#day except
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
// as a setter, sunday should belong to the previous week.
if (input != null) {
var weekday = parseIsoWeekday(input, this.localeData());
return this.day(this.day() % 7 ? weekday : weekday - 7);
} else {
return this.day() || 7;
}
}
var defaultWeekdaysRegex = matchWord;
function weekdaysRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysStrictRegex;
} else {
return this._weekdaysRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysRegex')) {
this._weekdaysRegex = defaultWeekdaysRegex;
}
return this._weekdaysStrictRegex && isStrict ?
this._weekdaysStrictRegex : this._weekdaysRegex;
}
}
var defaultWeekdaysShortRegex = matchWord;
function weekdaysShortRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysShortStrictRegex;
} else {
return this._weekdaysShortRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysShortRegex')) {
this._weekdaysShortRegex = defaultWeekdaysShortRegex;
}
return this._weekdaysShortStrictRegex && isStrict ?
this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
}
}
var defaultWeekdaysMinRegex = matchWord;
function weekdaysMinRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysMinStrictRegex;
} else {
return this._weekdaysMinRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysMinRegex')) {
this._weekdaysMinRegex = defaultWeekdaysMinRegex;
}
return this._weekdaysMinStrictRegex && isStrict ?
this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
}
}
function computeWeekdaysParse () {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
i, mom, minp, shortp, longp;
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, 1]).day(i);
minp = this.weekdaysMin(mom, '');
shortp = this.weekdaysShort(mom, '');
longp = this.weekdays(mom, '');
minPieces.push(minp);
shortPieces.push(shortp);
longPieces.push(longp);
mixedPieces.push(minp);
mixedPieces.push(shortp);
mixedPieces.push(longp);
}
// Sorting makes sure if one weekday (or abbr) is a prefix of another it
// will match the longer piece.
minPieces.sort(cmpLenRev);
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
for (i = 0; i < 7; i++) {
shortPieces[i] = regexEscape(shortPieces[i]);
longPieces[i] = regexEscape(longPieces[i]);
mixedPieces[i] = regexEscape(mixedPieces[i]);
}
this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
this._weekdaysShortRegex = this._weekdaysRegex;
this._weekdaysMinRegex = this._weekdaysRegex;
this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
}
// FORMATTING
function hFormat() {
return this.hours() % 12 || 12;
}
function kFormat() {
return this.hours() || 24;
}
addFormatToken('H', ['HH', 2], 0, 'hour');
addFormatToken('h', ['hh', 2], 0, hFormat);
addFormatToken('k', ['kk', 2], 0, kFormat);
addFormatToken('hmm', 0, 0, function () {
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
});
addFormatToken('hmmss', 0, 0, function () {
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
zeroFill(this.seconds(), 2);
});
addFormatToken('Hmm', 0, 0, function () {
return '' + this.hours() + zeroFill(this.minutes(), 2);
});
addFormatToken('Hmmss', 0, 0, function () {
return '' + this.hours() + zeroFill(this.minutes(), 2) +
zeroFill(this.seconds(), 2);
});
function meridiem (token, lowercase) {
addFormatToken(token, 0, 0, function () {
return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
});
}
meridiem('a', true);
meridiem('A', false);
// ALIASES
addUnitAlias('hour', 'h');
// PRIORITY
addUnitPriority('hour', 13);
// PARSING
function matchMeridiem (isStrict, locale) {
return locale._meridiemParse;
}
addRegexToken('a', matchMeridiem);
addRegexToken('A', matchMeridiem);
addRegexToken('H', match1to2);
addRegexToken('h', match1to2);
addRegexToken('k', match1to2);
addRegexToken('HH', match1to2, match2);
addRegexToken('hh', match1to2, match2);
addRegexToken('kk', match1to2, match2);
addRegexToken('hmm', match3to4);
addRegexToken('hmmss', match5to6);
addRegexToken('Hmm', match3to4);
addRegexToken('Hmmss', match5to6);
addParseToken(['H', 'HH'], HOUR);
addParseToken(['k', 'kk'], function (input, array, config) {
var kInput = toInt(input);
array[HOUR] = kInput === 24 ? 0 : kInput;
});
addParseToken(['a', 'A'], function (input, array, config) {
config._isPm = config._locale.isPM(input);
config._meridiem = input;
});
addParseToken(['h', 'hh'], function (input, array, config) {
array[HOUR] = toInt(input);
getParsingFlags(config).bigHour = true;
});
addParseToken('hmm', function (input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
getParsingFlags(config).bigHour = true;
});
addParseToken('hmmss', function (input, array, config) {
var pos1 = input.length - 4;
var pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
getParsingFlags(config).bigHour = true;
});
addParseToken('Hmm', function (input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
});
addParseToken('Hmmss', function (input, array, config) {
var pos1 = input.length - 4;
var pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
});
// LOCALES
function localeIsPM (input) {
// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
// Using charAt should be more compatible.
return ((input + '').toLowerCase().charAt(0) === 'p');
}
var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
function localeMeridiem (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? 'pm' : 'PM';
} else {
return isLower ? 'am' : 'AM';
}
}
// MOMENTS
// Setting the hour should keep the time, because the user explicitly
// specified which hour he wants. So trying to maintain the same hour (in
// a new timezone) makes sense. Adding/subtracting hours does not follow
// this rule.
var getSetHour = makeGetSet('Hours', true);
// months
// week
// weekdays
// meridiem
var baseConfig = {
calendar: defaultCalendar,
longDateFormat: defaultLongDateFormat,
invalidDate: defaultInvalidDate,
ordinal: defaultOrdinal,
dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
relativeTime: defaultRelativeTime,
months: defaultLocaleMonths,
monthsShort: defaultLocaleMonthsShort,
week: defaultLocaleWeek,
weekdays: defaultLocaleWeekdays,
weekdaysMin: defaultLocaleWeekdaysMin,
weekdaysShort: defaultLocaleWeekdaysShort,
meridiemParse: defaultLocaleMeridiemParse
};
// internal storage for locale config files
var locales = {};
var localeFamilies = {};
var globalLocale;
function normalizeLocale(key) {
return key ? key.toLowerCase().replace('_', '-') : key;
}
// pick the locale from the array
// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
function chooseLocale(names) {
var i = 0, j, next, locale, split;
while (i < names.length) {
split = normalizeLocale(names[i]).split('-');
j = split.length;
next = normalizeLocale(names[i + 1]);
next = next ? next.split('-') : null;
while (j > 0) {
locale = loadLocale(split.slice(0, j).join('-'));
if (locale) {
return locale;
}
if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
//the next array item is better than a shallower substring of this one
break;
}
j--;
}
i++;
}
return null;
}
function loadLocale(name) {
var oldLocale = null;
// TODO: Find a better way to register and load all the locales in Node
if (!locales[name] && (typeof module !== 'undefined') &&
module && module.exports) {
try {
oldLocale = globalLocale._abbr;
var aliasedRequire = require;
__webpack_require__(431)("./" + name);
getSetGlobalLocale(oldLocale);
} catch (e) {}
}
return locales[name];
}
// This function will load locale and then set the global locale. If
// no arguments are passed in, it will simply return the current global
// locale key.
function getSetGlobalLocale (key, values) {
var data;
if (key) {
if (isUndefined(values)) {
data = getLocale(key);
}
else {
data = defineLocale(key, values);
}
if (data) {
// moment.duration._locale = moment._locale = data;
globalLocale = data;
}
}
return globalLocale._abbr;
}
function defineLocale (name, config) {
if (config !== null) {
var parentConfig = baseConfig;
config.abbr = name;
if (locales[name] != null) {
deprecateSimple('defineLocaleOverride',
'use moment.updateLocale(localeName, config) to change ' +
'an existing locale. moment.defineLocale(localeName, ' +
'config) should only be used for creating a new locale ' +
'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
parentConfig = locales[name]._config;
} else if (config.parentLocale != null) {
if (locales[config.parentLocale] != null) {
parentConfig = locales[config.parentLocale]._config;
} else {
if (!localeFamilies[config.parentLocale]) {
localeFamilies[config.parentLocale] = [];
}
localeFamilies[config.parentLocale].push({
name: name,
config: config
});
return null;
}
}
locales[name] = new Locale(mergeConfigs(parentConfig, config));
if (localeFamilies[name]) {
localeFamilies[name].forEach(function (x) {
defineLocale(x.name, x.config);
});
}
// backwards compat for now: also set the locale
// make sure we set the locale AFTER all child locales have been
// created, so we won't end up with the child locale set.
getSetGlobalLocale(name);
return locales[name];
} else {
// useful for testing
delete locales[name];
return null;
}
}
function updateLocale(name, config) {
if (config != null) {
var locale, tmpLocale, parentConfig = baseConfig;
// MERGE
tmpLocale = loadLocale(name);
if (tmpLocale != null) {
parentConfig = tmpLocale._config;
}
config = mergeConfigs(parentConfig, config);
locale = new Locale(config);
locale.parentLocale = locales[name];
locales[name] = locale;
// backwards compat for now: also set the locale
getSetGlobalLocale(name);
} else {
// pass null for config to unupdate, useful for tests
if (locales[name] != null) {
if (locales[name].parentLocale != null) {
locales[name] = locales[name].parentLocale;
} else if (locales[name] != null) {
delete locales[name];
}
}
}
return locales[name];
}
// returns locale data
function getLocale (key) {
var locale;
if (key && key._locale && key._locale._abbr) {
key = key._locale._abbr;
}
if (!key) {
return globalLocale;
}
if (!isArray(key)) {
//short-circuit everything else
locale = loadLocale(key);
if (locale) {
return locale;
}
key = [key];
}
return chooseLocale(key);
}
function listLocales() {
return keys(locales);
}
function checkOverflow (m) {
var overflow;
var a = m._a;
if (a && getParsingFlags(m).overflow === -2) {
overflow =
a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
-1;
if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
overflow = DATE;
}
if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
overflow = WEEK;
}
if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
overflow = WEEKDAY;
}
getParsingFlags(m).overflow = overflow;
}
return m;
}
// Pick the first defined of two or three arguments.
function defaults(a, b, c) {
if (a != null) {
return a;
}
if (b != null) {
return b;
}
return c;
}
function currentDateArray(config) {
// hooks is actually the exported moment object
var nowValue = new Date(hooks.now());
if (config._useUTC) {
return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
}
return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
}
// convert an array to a date.
// the array should mirror the parameters below
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
function configFromArray (config) {
var i, date, input = [], currentDate, expectedWeekday, yearToUse;
if (config._d) {
return;
}
currentDate = currentDateArray(config);
//compute day of the year from weeks and weekdays
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
dayOfYearFromWeekInfo(config);
}
//if the day of the year is set, figure out what it is
if (config._dayOfYear != null) {
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
getParsingFlags(config)._overflowDayOfYear = true;
}
date = createUTCDate(yearToUse, 0, config._dayOfYear);
config._a[MONTH] = date.getUTCMonth();
config._a[DATE] = date.getUTCDate();
}
// Default to current date.
// * if no year, month, day of month are given, default to today
// * if day of month is given, default month and year
// * if month is given, default only year
// * if year is given, don't default anything
for (i = 0; i < 3 && config._a[i] == null; ++i) {
config._a[i] = input[i] = currentDate[i];
}
// Zero out whatever was not defaulted, including time
for (; i < 7; i++) {
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
}
// Check for 24:00:00.000
if (config._a[HOUR] === 24 &&
config._a[MINUTE] === 0 &&
config._a[SECOND] === 0 &&
config._a[MILLISECOND] === 0) {
config._nextDay = true;
config._a[HOUR] = 0;
}
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
// Apply timezone offset from input. The actual utcOffset can be changed
// with parseZone.
if (config._tzm != null) {
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
}
if (config._nextDay) {
config._a[HOUR] = 24;
}
// check for mismatching day of week
if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
getParsingFlags(config).weekdayMismatch = true;
}
}
function dayOfYearFromWeekInfo(config) {
var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
w = config._w;
if (w.GG != null || w.W != null || w.E != null) {
dow = 1;
doy = 4;
// TODO: We need to take the current isoWeekYear, but that depends on
// how we interpret now (local, utc, fixed offset). So create
// a now version of current config (take local/utc/offset flags, and
// create now).
weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
week = defaults(w.W, 1);
weekday = defaults(w.E, 1);
if (weekday < 1 || weekday > 7) {
weekdayOverflow = true;
}
} else {
dow = config._locale._week.dow;
doy = config._locale._week.doy;
var curWeek = weekOfYear(createLocal(), dow, doy);
weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
// Default to current week.
week = defaults(w.w, curWeek.week);
if (w.d != null) {
// weekday -- low day numbers are considered next week
weekday = w.d;
if (weekday < 0 || weekday > 6) {
weekdayOverflow = true;
}
} else if (w.e != null) {
// local weekday -- counting starts from begining of week
weekday = w.e + dow;
if (w.e < 0 || w.e > 6) {
weekdayOverflow = true;
}
} else {
// default to begining of week
weekday = dow;
}
}
if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
getParsingFlags(config)._overflowWeeks = true;
} else if (weekdayOverflow != null) {
getParsingFlags(config)._overflowWeekday = true;
} else {
temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
config._a[YEAR] = temp.year;
config._dayOfYear = temp.dayOfYear;
}
}
// iso 8601 regex
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
var isoDates = [
['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
['GGGG-[W]WW', /\d{4}-W\d\d/, false],
['YYYY-DDD', /\d{4}-\d{3}/],
['YYYY-MM', /\d{4}-\d\d/, false],
['YYYYYYMMDD', /[+-]\d{10}/],
['YYYYMMDD', /\d{8}/],
// YYYYMM is NOT allowed by the standard
['GGGG[W]WWE', /\d{4}W\d{3}/],
['GGGG[W]WW', /\d{4}W\d{2}/, false],
['YYYYDDD', /\d{7}/]
];
// iso time formats and regexes
var isoTimes = [
['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
['HH:mm:ss', /\d\d:\d\d:\d\d/],
['HH:mm', /\d\d:\d\d/],
['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
['HHmmss', /\d\d\d\d\d\d/],
['HHmm', /\d\d\d\d/],
['HH', /\d\d/]
];
var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
// date from iso format
function configFromISO(config) {
var i, l,
string = config._i,
match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
allowTime, dateFormat, timeFormat, tzFormat;
if (match) {
getParsingFlags(config).iso = true;
for (i = 0, l = isoDates.length; i < l; i++) {
if (isoDates[i][1].exec(match[1])) {
dateFormat = isoDates[i][0];
allowTime = isoDates[i][2] !== false;
break;
}
}
if (dateFormat == null) {
config._isValid = false;
return;
}
if (match[3]) {
for (i = 0, l = isoTimes.length; i < l; i++) {
if (isoTimes[i][1].exec(match[3])) {
// match[2] should be 'T' or space
timeFormat = (match[2] || ' ') + isoTimes[i][0];
break;
}
}
if (timeFormat == null) {
config._isValid = false;
return;
}
}
if (!allowTime && timeFormat != null) {
config._isValid = false;
return;
}
if (match[4]) {
if (tzRegex.exec(match[4])) {
tzFormat = 'Z';
} else {
config._isValid = false;
return;
}
}
config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
configFromStringAndFormat(config);
} else {
config._isValid = false;
}
}
// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
var result = [
untruncateYear(yearStr),
defaultLocaleMonthsShort.indexOf(monthStr),
parseInt(dayStr, 10),
parseInt(hourStr, 10),
parseInt(minuteStr, 10)
];
if (secondStr) {
result.push(parseInt(secondStr, 10));
}
return result;
}
function untruncateYear(yearStr) {
var year = parseInt(yearStr, 10);
if (year <= 49) {
return 2000 + year;
} else if (year <= 999) {
return 1900 + year;
}
return year;
}
function preprocessRFC2822(s) {
// Remove comments and folding whitespace and replace multiple-spaces with a single space
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
}
function checkWeekday(weekdayStr, parsedInput, config) {
if (weekdayStr) {
// TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
if (weekdayProvided !== weekdayActual) {
getParsingFlags(config).weekdayMismatch = true;
config._isValid = false;
return false;
}
}
return true;
}
var obsOffsets = {
UT: 0,
GMT: 0,
EDT: -4 * 60,
EST: -5 * 60,
CDT: -5 * 60,
CST: -6 * 60,
MDT: -6 * 60,
MST: -7 * 60,
PDT: -7 * 60,
PST: -8 * 60
};
function calculateOffset(obsOffset, militaryOffset, numOffset) {
if (obsOffset) {
return obsOffsets[obsOffset];
} else if (militaryOffset) {
// the only allowed military tz is Z
return 0;
} else {
var hm = parseInt(numOffset, 10);
var m = hm % 100, h = (hm - m) / 100;
return h * 60 + m;
}
}
// date and time from ref 2822 format
function configFromRFC2822(config) {
var match = rfc2822.exec(preprocessRFC2822(config._i));
if (match) {
var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
if (!checkWeekday(match[1], parsedArray, config)) {
return;
}
config._a = parsedArray;
config._tzm = calculateOffset(match[8], match[9], match[10]);
config._d = createUTCDate.apply(null, config._a);
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
getParsingFlags(config).rfc2822 = true;
} else {
config._isValid = false;
}
}
// date from iso format or fallback
function configFromString(config) {
var matched = aspNetJsonRegex.exec(config._i);
if (matched !== null) {
config._d = new Date(+matched[1]);
return;
}
configFromISO(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
configFromRFC2822(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
// Final attempt, use Input Fallback
hooks.createFromInputFallback(config);
}
hooks.createFromInputFallback = deprecate(
'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
'discouraged and will be removed in an upcoming major release. Please refer to ' +
'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
function (config) {
config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
}
);
// constant that refers to the ISO standard
hooks.ISO_8601 = function () {};
// constant that refers to the RFC 2822 form
hooks.RFC_2822 = function () {};
// date from string and format string
function configFromStringAndFormat(config) {
// TODO: Move this to another part of the creation flow to prevent circular deps
if (config._f === hooks.ISO_8601) {
configFromISO(config);
return;
}
if (config._f === hooks.RFC_2822) {
configFromRFC2822(config);
return;
}
config._a = [];
getParsingFlags(config).empty = true;
// This array is used to make a Date, either with `new Date` or `Date.UTC`
var string = '' + config._i,
i, parsedInput, tokens, token, skipped,
stringLength = string.length,
totalParsedInputLength = 0;
tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
for (i = 0; i < tokens.length; i++) {
token = tokens[i];
parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
// console.log('token', token, 'parsedInput', parsedInput,
// 'regex', getParseRegexForToken(token, config));
if (parsedInput) {
skipped = string.substr(0, string.indexOf(parsedInput));
if (skipped.length > 0) {
getParsingFlags(config).unusedInput.push(skipped);
}
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
totalParsedInputLength += parsedInput.length;
}
// don't parse if it's not a known token
if (formatTokenFunctions[token]) {
if (parsedInput) {
getParsingFlags(config).empty = false;
}
else {
getParsingFlags(config).unusedTokens.push(token);
}
addTimeToArrayFromToken(token, parsedInput, config);
}
else if (config._strict && !parsedInput) {
getParsingFlags(config).unusedTokens.push(token);
}
}
// add remaining unparsed input length to the string
getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
if (string.length > 0) {
getParsingFlags(config).unusedInput.push(string);
}
// clear _12h flag if hour is <= 12
if (config._a[HOUR] <= 12 &&
getParsingFlags(config).bigHour === true &&
config._a[HOUR] > 0) {
getParsingFlags(config).bigHour = undefined;
}
getParsingFlags(config).parsedDateParts = config._a.slice(0);
getParsingFlags(config).meridiem = config._meridiem;
// handle meridiem
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
configFromArray(config);
checkOverflow(config);
}
function meridiemFixWrap (locale, hour, meridiem) {
var isPm;
if (meridiem == null) {
// nothing to do
return hour;
}
if (locale.meridiemHour != null) {
return locale.meridiemHour(hour, meridiem);
} else if (locale.isPM != null) {
// Fallback
isPm = locale.isPM(meridiem);
if (isPm && hour < 12) {
hour += 12;
}
if (!isPm && hour === 12) {
hour = 0;
}
return hour;
} else {
// this is not supposed to happen
return hour;
}
}
// date from string and array of format strings
function configFromStringAndArray(config) {
var tempConfig,
bestMoment,
scoreToBeat,
i,
currentScore;
if (config._f.length === 0) {
getParsingFlags(config).invalidFormat = true;
config._d = new Date(NaN);
return;
}
for (i = 0; i < config._f.length; i++) {
currentScore = 0;
tempConfig = copyConfig({}, config);
if (config._useUTC != null) {
tempConfig._useUTC = config._useUTC;
}
tempConfig._f = config._f[i];
configFromStringAndFormat(tempConfig);
if (!isValid(tempConfig)) {
continue;
}
// if there is any input that was not parsed add a penalty for that format
currentScore += getParsingFlags(tempConfig).charsLeftOver;
//or tokens
currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
getParsingFlags(tempConfig).score = currentScore;
if (scoreToBeat == null || currentScore < scoreToBeat) {
scoreToBeat = currentScore;
bestMoment = tempConfig;
}
}
extend(config, bestMoment || tempConfig);
}
function configFromObject(config) {
if (config._d) {
return;
}
var i = normalizeObjectUnits(config._i);
config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
return obj && parseInt(obj, 10);
});
configFromArray(config);
}
function createFromConfig (config) {
var res = new Moment(checkOverflow(prepareConfig(config)));
if (res._nextDay) {
// Adding is smart enough around DST
res.add(1, 'd');
res._nextDay = undefined;
}
return res;
}
function prepareConfig (config) {
var input = config._i,
format = config._f;
config._locale = config._locale || getLocale(config._l);
if (input === null || (format === undefined && input === '')) {
return createInvalid({nullInput: true});
}
if (typeof input === 'string') {
config._i = input = config._locale.preparse(input);
}
if (isMoment(input)) {
return new Moment(checkOverflow(input));
} else if (isDate(input)) {
config._d = input;
} else if (isArray(format)) {
configFromStringAndArray(config);
} else if (format) {
configFromStringAndFormat(config);
} else {
configFromInput(config);
}
if (!isValid(config)) {
config._d = null;
}
return config;
}
function configFromInput(config) {
var input = config._i;
if (isUndefined(input)) {
config._d = new Date(hooks.now());
} else if (isDate(input)) {
config._d = new Date(input.valueOf());
} else if (typeof input === 'string') {
configFromString(config);
} else if (isArray(input)) {
config._a = map(input.slice(0), function (obj) {
return parseInt(obj, 10);
});
configFromArray(config);
} else if (isObject(input)) {
configFromObject(config);
} else if (isNumber(input)) {
// from milliseconds
config._d = new Date(input);
} else {
hooks.createFromInputFallback(config);
}
}
function createLocalOrUTC (input, format, locale, strict, isUTC) {
var c = {};
if (locale === true || locale === false) {
strict = locale;
locale = undefined;
}
if ((isObject(input) && isObjectEmpty(input)) ||
(isArray(input) && input.length === 0)) {
input = undefined;
}
// object construction must be done this way.
// https://github.com/moment/moment/issues/1423
c._isAMomentObject = true;
c._useUTC = c._isUTC = isUTC;
c._l = locale;
c._i = input;
c._f = format;
c._strict = strict;
return createFromConfig(c);
}
function createLocal (input, format, locale, strict) {
return createLocalOrUTC(input, format, locale, strict, false);
}
var prototypeMin = deprecate(
'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return createInvalid();
}
}
);
var prototypeMax = deprecate(
'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other > this ? this : other;
} else {
return createInvalid();
}
}
);
// Pick a moment m from moments so that m[fn](other) is true for all
// other. This relies on the function fn to be transitive.
//
// moments should either be an array of moment objects or an array, whose
// first element is an array of moment objects.
function pickBy(fn, moments) {
var res, i;
if (moments.length === 1 && isArray(moments[0])) {
moments = moments[0];
}
if (!moments.length) {
return createLocal();
}
res = moments[0];
for (i = 1; i < moments.length; ++i) {
if (!moments[i].isValid() || moments[i][fn](res)) {
res = moments[i];
}
}
return res;
}
// TODO: Use [].sort instead?
function min () {
var args = [].slice.call(arguments, 0);
return pickBy('isBefore', args);
}
function max () {
var args = [].slice.call(arguments, 0);
return pickBy('isAfter', args);
}
var now = function () {
return Date.now ? Date.now() : +(new Date());
};
var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
function isDurationValid(m) {
for (var key in m) {
if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
return false;
}
}
var unitHasDecimal = false;
for (var i = 0; i < ordering.length; ++i) {
if (m[ordering[i]]) {
if (unitHasDecimal) {
return false; // only allow non-integers for smallest unit
}
if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
unitHasDecimal = true;
}
}
}
return true;
}
function isValid$1() {
return this._isValid;
}
function createInvalid$1() {
return createDuration(NaN);
}
function Duration (duration) {
var normalizedInput = normalizeObjectUnits(duration),
years = normalizedInput.year || 0,
quarters = normalizedInput.quarter || 0,
months = normalizedInput.month || 0,
weeks = normalizedInput.week || 0,
days = normalizedInput.day || 0,
hours = normalizedInput.hour || 0,
minutes = normalizedInput.minute || 0,
seconds = normalizedInput.second || 0,
milliseconds = normalizedInput.millisecond || 0;
this._isValid = isDurationValid(normalizedInput);
// representation for dateAddRemove
this._milliseconds = +milliseconds +
seconds * 1e3 + // 1000
minutes * 6e4 + // 1000 * 60
hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
// Because of dateAddRemove treats 24 hours as different from a
// day when working around DST, we need to store them separately
this._days = +days +
weeks * 7;
// It is impossible to translate months into days without knowing
// which months you are are talking about, so we have to store
// it separately.
this._months = +months +
quarters * 3 +
years * 12;
this._data = {};
this._locale = getLocale();
this._bubble();
}
function isDuration (obj) {
return obj instanceof Duration;
}
function absRound (number) {
if (number < 0) {
return Math.round(-1 * number) * -1;
} else {
return Math.round(number);
}
}
// FORMATTING
function offset (token, separator) {
addFormatToken(token, 0, 0, function () {
var offset = this.utcOffset();
var sign = '+';
if (offset < 0) {
offset = -offset;
sign = '-';
}
return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
});
}
offset('Z', ':');
offset('ZZ', '');
// PARSING
addRegexToken('Z', matchShortOffset);
addRegexToken('ZZ', matchShortOffset);
addParseToken(['Z', 'ZZ'], function (input, array, config) {
config._useUTC = true;
config._tzm = offsetFromString(matchShortOffset, input);
});
// HELPERS
// timezone chunker
// '+10:00' > ['10', '00']
// '-1530' > ['-15', '30']
var chunkOffset = /([\+\-]|\d\d)/gi;
function offsetFromString(matcher, string) {
var matches = (string || '').match(matcher);
if (matches === null) {
return null;
}
var chunk = matches[matches.length - 1] || [];
var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
var minutes = +(parts[1] * 60) + toInt(parts[2]);
return minutes === 0 ?
0 :
parts[0] === '+' ? minutes : -minutes;
}
// Return a moment from input, that is local/utc/zone equivalent to model.
function cloneWithOffset(input, model) {
var res, diff;
if (model._isUTC) {
res = model.clone();
diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
// Use low-level api, because this fn is low-level api.
res._d.setTime(res._d.valueOf() + diff);
hooks.updateOffset(res, false);
return res;
} else {
return createLocal(input).local();
}
}
function getDateOffset (m) {
// On Firefox.24 Date#getTimezoneOffset returns a floating point.
// https://github.com/moment/moment/pull/1871
return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
}
// HOOKS
// This function will be called whenever a moment is mutated.
// It is intended to keep the offset in sync with the timezone.
hooks.updateOffset = function () {};
// MOMENTS
// keepLocalTime = true means only change the timezone, without
// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
// +0200, so we adjust the time as needed, to be valid.
//
// Keeping the time actually adds/subtracts (one hour)
// from the actual represented time. That is why we call updateOffset
// a second time. In case it wants us to change the offset again
// _changeInProgress == true case, then we have to adjust, because
// there is no such time in the given timezone.
function getSetOffset (input, keepLocalTime, keepMinutes) {
var offset = this._offset || 0,
localAdjust;
if (!this.isValid()) {
return input != null ? this : NaN;
}
if (input != null) {
if (typeof input === 'string') {
input = offsetFromString(matchShortOffset, input);
if (input === null) {
return this;
}
} else if (Math.abs(input) < 16 && !keepMinutes) {
input = input * 60;
}
if (!this._isUTC && keepLocalTime) {
localAdjust = getDateOffset(this);
}
this._offset = input;
this._isUTC = true;
if (localAdjust != null) {
this.add(localAdjust, 'm');
}
if (offset !== input) {
if (!keepLocalTime || this._changeInProgress) {
addSubtract(this, createDuration(input - offset, 'm'), 1, false);
} else if (!this._changeInProgress) {
this._changeInProgress = true;
hooks.updateOffset(this, true);
this._changeInProgress = null;
}
}
return this;
} else {
return this._isUTC ? offset : getDateOffset(this);
}
}
function getSetZone (input, keepLocalTime) {
if (input != null) {
if (typeof input !== 'string') {
input = -input;
}
this.utcOffset(input, keepLocalTime);
return this;
} else {
return -this.utcOffset();
}
}
function setOffsetToUTC (keepLocalTime) {
return this.utcOffset(0, keepLocalTime);
}
function setOffsetToLocal (keepLocalTime) {
if (this._isUTC) {
this.utcOffset(0, keepLocalTime);
this._isUTC = false;
if (keepLocalTime) {
this.subtract(getDateOffset(this), 'm');
}
}
return this;
}
function setOffsetToParsedOffset () {
if (this._tzm != null) {
this.utcOffset(this._tzm, false, true);
} else if (typeof this._i === 'string') {
var tZone = offsetFromString(matchOffset, this._i);
if (tZone != null) {
this.utcOffset(tZone);
}
else {
this.utcOffset(0, true);
}
}
return this;
}
function hasAlignedHourOffset (input) {
if (!this.isValid()) {
return false;
}
input = input ? createLocal(input).utcOffset() : 0;
return (this.utcOffset() - input) % 60 === 0;
}
function isDaylightSavingTime () {
return (
this.utcOffset() > this.clone().month(0).utcOffset() ||
this.utcOffset() > this.clone().month(5).utcOffset()
);
}
function isDaylightSavingTimeShifted () {
if (!isUndefined(this._isDSTShifted)) {
return this._isDSTShifted;
}
var c = {};
copyConfig(c, this);
c = prepareConfig(c);
if (c._a) {
var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
this._isDSTShifted = this.isValid() &&
compareArrays(c._a, other.toArray()) > 0;
} else {
this._isDSTShifted = false;
}
return this._isDSTShifted;
}
function isLocal () {
return this.isValid() ? !this._isUTC : false;
}
function isUtcOffset () {
return this.isValid() ? this._isUTC : false;
}
function isUtc () {
return this.isValid() ? this._isUTC && this._offset === 0 : false;
}
// ASP.NET json date format regex
var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
// and further modified to allow for strings containing both week and day
var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function createDuration (input, key) {
var duration = input,
// matching against regexp is expensive, do it on demand
match = null,
sign,
ret,
diffRes;
if (isDuration(input)) {
duration = {
ms : input._milliseconds,
d : input._days,
M : input._months
};
} else if (isNumber(input)) {
duration = {};
if (key) {
duration[key] = input;
} else {
duration.milliseconds = input;
}
} else if (!!(match = aspNetRegex.exec(input))) {
sign = (match[1] === '-') ? -1 : 1;
duration = {
y : 0,
d : toInt(match[DATE]) * sign,
h : toInt(match[HOUR]) * sign,
m : toInt(match[MINUTE]) * sign,
s : toInt(match[SECOND]) * sign,
ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
};
} else if (!!(match = isoRegex.exec(input))) {
sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1;
duration = {
y : parseIso(match[2], sign),
M : parseIso(match[3], sign),
w : parseIso(match[4], sign),
d : parseIso(match[5], sign),
h : parseIso(match[6], sign),
m : parseIso(match[7], sign),
s : parseIso(match[8], sign)
};
} else if (duration == null) {// checks for null or undefined
duration = {};
} else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
duration = {};
duration.ms = diffRes.milliseconds;
duration.M = diffRes.months;
}
ret = new Duration(duration);
if (isDuration(input) && hasOwnProp(input, '_locale')) {
ret._locale = input._locale;
}
return ret;
}
createDuration.fn = Duration.prototype;
createDuration.invalid = createInvalid$1;
function parseIso (inp, sign) {
// We'd normally use ~~inp for this, but unfortunately it also
// converts floats to ints.
// inp may be undefined, so careful calling replace on it.
var res = inp && parseFloat(inp.replace(',', '.'));
// apply sign while we're at it
return (isNaN(res) ? 0 : res) * sign;
}
function positiveMomentsDifference(base, other) {
var res = {milliseconds: 0, months: 0};
res.months = other.month() - base.month() +
(other.year() - base.year()) * 12;
if (base.clone().add(res.months, 'M').isAfter(other)) {
--res.months;
}
res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
return res;
}
function momentsDifference(base, other) {
var res;
if (!(base.isValid() && other.isValid())) {
return {milliseconds: 0, months: 0};
}
other = cloneWithOffset(other, base);
if (base.isBefore(other)) {
res = positiveMomentsDifference(base, other);
} else {
res = positiveMomentsDifference(other, base);
res.milliseconds = -res.milliseconds;
res.months = -res.months;
}
return res;
}
// TODO: remove 'name' arg after deprecation is removed
function createAdder(direction, name) {
return function (val, period) {
var dur, tmp;
//invert the arguments, but complain about it
if (period !== null && !isNaN(+period)) {
deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
tmp = val; val = period; period = tmp;
}
val = typeof val === 'string' ? +val : val;
dur = createDuration(val, period);
addSubtract(this, dur, direction);
return this;
};
}
function addSubtract (mom, duration, isAdding, updateOffset) {
var milliseconds = duration._milliseconds,
days = absRound(duration._days),
months = absRound(duration._months);
if (!mom.isValid()) {
// No op
return;
}
updateOffset = updateOffset == null ? true : updateOffset;
if (months) {
setMonth(mom, get(mom, 'Month') + months * isAdding);
}
if (days) {
set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
}
if (milliseconds) {
mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
}
if (updateOffset) {
hooks.updateOffset(mom, days || months);
}
}
var add = createAdder(1, 'add');
var subtract = createAdder(-1, 'subtract');
function getCalendarFormat(myMoment, now) {
var diff = myMoment.diff(now, 'days', true);
return diff < -6 ? 'sameElse' :
diff < -1 ? 'lastWeek' :
diff < 0 ? 'lastDay' :
diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse';
}
function calendar$1 (time, formats) {
// We want to compare the start of today, vs this.
// Getting start-of-today depends on whether we're local/utc/offset or not.
var now = time || createLocal(),
sod = cloneWithOffset(now, this).startOf('day'),
format = hooks.calendarFormat(this, sod) || 'sameElse';
var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
}
function clone () {
return new Moment(this);
}
function isAfter (input, units) {
var localInput = isMoment(input) ? input : createLocal(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return this.valueOf() > localInput.valueOf();
} else {
return localInput.valueOf() < this.clone().startOf(units).valueOf();
}
}
function isBefore (input, units) {
var localInput = isMoment(input) ? input : createLocal(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return this.valueOf() < localInput.valueOf();
} else {
return this.clone().endOf(units).valueOf() < localInput.valueOf();
}
}
function isBetween (from, to, units, inclusivity) {
inclusivity = inclusivity || '()';
return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
(inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
}
function isSame (input, units) {
var localInput = isMoment(input) ? input : createLocal(input),
inputMs;
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(units || 'millisecond');
if (units === 'millisecond') {
return this.valueOf() === localInput.valueOf();
} else {
inputMs = localInput.valueOf();
return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
}
}
function isSameOrAfter (input, units) {
return this.isSame(input, units) || this.isAfter(input,units);
}
function isSameOrBefore (input, units) {
return this.isSame(input, units) || this.isBefore(input,units);
}
function diff (input, units, asFloat) {
var that,
zoneDelta,
delta, output;
if (!this.isValid()) {
return NaN;
}
that = cloneWithOffset(input, this);
if (!that.isValid()) {
return NaN;
}
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
units = normalizeUnits(units);
switch (units) {
case 'year': output = monthDiff(this, that) / 12; break;
case 'month': output = monthDiff(this, that); break;
case 'quarter': output = monthDiff(this, that) / 3; break;
case 'second': output = (this - that) / 1e3; break; // 1000
case 'minute': output = (this - that) / 6e4; break; // 1000 * 60
case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60
case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst
case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst
default: output = this - that;
}
return asFloat ? output : absFloor(output);
}
function monthDiff (a, b) {
// difference in months
var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
// b is in (anchor - 1 month, anchor + 1 month)
anchor = a.clone().add(wholeMonthDiff, 'months'),
anchor2, adjust;
if (b - anchor < 0) {
anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
// linear across the month
adjust = (b - anchor) / (anchor - anchor2);
} else {
anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
// linear across the month
adjust = (b - anchor) / (anchor2 - anchor);
}
//check for negative zero, return zero if negative zero
return -(wholeMonthDiff + adjust) || 0;
}
hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
function toString () {
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
}
function toISOString(keepOffset) {
if (!this.isValid()) {
return null;
}
var utc = keepOffset !== true;
var m = utc ? this.clone().utc() : this;
if (m.year() < 0 || m.year() > 9999) {
return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
}
if (isFunction(Date.prototype.toISOString)) {
// native implementation is ~50x faster, use it when we can
if (utc) {
return this.toDate().toISOString();
} else {
return new Date(this._d.valueOf()).toISOString().replace('Z', formatMoment(m, 'Z'));
}
}
return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
}
/**
* Return a human readable representation of a moment that can
* also be evaluated to get a new moment which is the same
*
* @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
*/
function inspect () {
if (!this.isValid()) {
return 'moment.invalid(/* ' + this._i + ' */)';
}
var func = 'moment';
var zone = '';
if (!this.isLocal()) {
func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
zone = 'Z';
}
var prefix = '[' + func + '("]';
var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
var datetime = '-MM-DD[T]HH:mm:ss.SSS';
var suffix = zone + '[")]';
return this.format(prefix + year + datetime + suffix);
}
function format (inputString) {
if (!inputString) {
inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
}
var output = formatMoment(this, inputString);
return this.localeData().postformat(output);
}
function from (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
createLocal(time).isValid())) {
return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function fromNow (withoutSuffix) {
return this.from(createLocal(), withoutSuffix);
}
function to (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
createLocal(time).isValid())) {
return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function toNow (withoutSuffix) {
return this.to(createLocal(), withoutSuffix);
}
// If passed a locale key, it will set the locale for this
// instance. Otherwise, it will return the locale configuration
// variables for this instance.
function locale (key) {
var newLocaleData;
if (key === undefined) {
return this._locale._abbr;
} else {
newLocaleData = getLocale(key);
if (newLocaleData != null) {
this._locale = newLocaleData;
}
return this;
}
}
var lang = deprecate(
'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
function (key) {
if (key === undefined) {
return this.localeData();
} else {
return this.locale(key);
}
}
);
function localeData () {
return this._locale;
}
function startOf (units) {
units = normalizeUnits(units);
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
case 'year':
this.month(0);
/* falls through */
case 'quarter':
case 'month':
this.date(1);
/* falls through */
case 'week':
case 'isoWeek':
case 'day':
case 'date':
this.hours(0);
/* falls through */
case 'hour':
this.minutes(0);
/* falls through */
case 'minute':
this.seconds(0);
/* falls through */
case 'second':
this.milliseconds(0);
}
// weeks are a special case
if (units === 'week') {
this.weekday(0);
}
if (units === 'isoWeek') {
this.isoWeekday(1);
}
// quarters are also special
if (units === 'quarter') {
this.month(Math.floor(this.month() / 3) * 3);
}
return this;
}
function endOf (units) {
units = normalizeUnits(units);
if (units === undefined || units === 'millisecond') {
return this;
}
// 'date' is an alias for 'day', so it should be considered as such.
if (units === 'date') {
units = 'day';
}
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
}
function valueOf () {
return this._d.valueOf() - ((this._offset || 0) * 60000);
}
function unix () {
return Math.floor(this.valueOf() / 1000);
}
function toDate () {
return new Date(this.valueOf());
}
function toArray () {
var m = this;
return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
}
function toObject () {
var m = this;
return {
years: m.year(),
months: m.month(),
date: m.date(),
hours: m.hours(),
minutes: m.minutes(),
seconds: m.seconds(),
milliseconds: m.milliseconds()
};
}
function toJSON () {
// new Date(NaN).toJSON() === null
return this.isValid() ? this.toISOString() : null;
}
function isValid$2 () {
return isValid(this);
}
function parsingFlags () {
return extend({}, getParsingFlags(this));
}
function invalidAt () {
return getParsingFlags(this).overflow;
}
function creationData() {
return {
input: this._i,
format: this._f,
locale: this._locale,
isUTC: this._isUTC,
strict: this._strict
};
}
// FORMATTING
addFormatToken(0, ['gg', 2], 0, function () {
return this.weekYear() % 100;
});
addFormatToken(0, ['GG', 2], 0, function () {
return this.isoWeekYear() % 100;
});
function addWeekYearFormatToken (token, getter) {
addFormatToken(0, [token, token.length], 0, getter);
}
addWeekYearFormatToken('gggg', 'weekYear');
addWeekYearFormatToken('ggggg', 'weekYear');
addWeekYearFormatToken('GGGG', 'isoWeekYear');
addWeekYearFormatToken('GGGGG', 'isoWeekYear');
// ALIASES
addUnitAlias('weekYear', 'gg');
addUnitAlias('isoWeekYear', 'GG');
// PRIORITY
addUnitPriority('weekYear', 1);
addUnitPriority('isoWeekYear', 1);
// PARSING
addRegexToken('G', matchSigned);
addRegexToken('g', matchSigned);
addRegexToken('GG', match1to2, match2);
addRegexToken('gg', match1to2, match2);
addRegexToken('GGGG', match1to4, match4);
addRegexToken('gggg', match1to4, match4);
addRegexToken('GGGGG', match1to6, match6);
addRegexToken('ggggg', match1to6, match6);
addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
week[token.substr(0, 2)] = toInt(input);
});
addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
week[token] = hooks.parseTwoDigitYear(input);
});
// MOMENTS
function getSetWeekYear (input) {
return getSetWeekYearHelper.call(this,
input,
this.week(),
this.weekday(),
this.localeData()._week.dow,
this.localeData()._week.doy);
}
function getSetISOWeekYear (input) {
return getSetWeekYearHelper.call(this,
input, this.isoWeek(), this.isoWeekday(), 1, 4);
}
function getISOWeeksInYear () {
return weeksInYear(this.year(), 1, 4);
}
function getWeeksInYear () {
var weekInfo = this.localeData()._week;
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
}
function getSetWeekYearHelper(input, week, weekday, dow, doy) {
var weeksTarget;
if (input == null) {
return weekOfYear(this, dow, doy).year;
} else {
weeksTarget = weeksInYear(input, dow, doy);
if (week > weeksTarget) {
week = weeksTarget;
}
return setWeekAll.call(this, input, week, weekday, dow, doy);
}
}
function setWeekAll(weekYear, week, weekday, dow, doy) {
var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
this.year(date.getUTCFullYear());
this.month(date.getUTCMonth());
this.date(date.getUTCDate());
return this;
}
// FORMATTING
addFormatToken('Q', 0, 'Qo', 'quarter');
// ALIASES
addUnitAlias('quarter', 'Q');
// PRIORITY
addUnitPriority('quarter', 7);
// PARSING
addRegexToken('Q', match1);
addParseToken('Q', function (input, array) {
array[MONTH] = (toInt(input) - 1) * 3;
});
// MOMENTS
function getSetQuarter (input) {
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
}
// FORMATTING
addFormatToken('D', ['DD', 2], 'Do', 'date');
// ALIASES
addUnitAlias('date', 'D');
// PRIOROITY
addUnitPriority('date', 9);
// PARSING
addRegexToken('D', match1to2);
addRegexToken('DD', match1to2, match2);
addRegexToken('Do', function (isStrict, locale) {
// TODO: Remove "ordinalParse" fallback in next major release.
return isStrict ?
(locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
locale._dayOfMonthOrdinalParseLenient;
});
addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
array[DATE] = toInt(input.match(match1to2)[0]);
});
// MOMENTS
var getSetDayOfMonth = makeGetSet('Date', true);
// FORMATTING
addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
// ALIASES
addUnitAlias('dayOfYear', 'DDD');
// PRIORITY
addUnitPriority('dayOfYear', 4);
// PARSING
addRegexToken('DDD', match1to3);
addRegexToken('DDDD', match3);
addParseToken(['DDD', 'DDDD'], function (input, array, config) {
config._dayOfYear = toInt(input);
});
// HELPERS
// MOMENTS
function getSetDayOfYear (input) {
var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
}
// FORMATTING
addFormatToken('m', ['mm', 2], 0, 'minute');
// ALIASES
addUnitAlias('minute', 'm');
// PRIORITY
addUnitPriority('minute', 14);
// PARSING
addRegexToken('m', match1to2);
addRegexToken('mm', match1to2, match2);
addParseToken(['m', 'mm'], MINUTE);
// MOMENTS
var getSetMinute = makeGetSet('Minutes', false);
// FORMATTING
addFormatToken('s', ['ss', 2], 0, 'second');
// ALIASES
addUnitAlias('second', 's');
// PRIORITY
addUnitPriority('second', 15);
// PARSING
addRegexToken('s', match1to2);
addRegexToken('ss', match1to2, match2);
addParseToken(['s', 'ss'], SECOND);
// MOMENTS
var getSetSecond = makeGetSet('Seconds', false);
// FORMATTING
addFormatToken('S', 0, 0, function () {
return ~~(this.millisecond() / 100);
});
addFormatToken(0, ['SS', 2], 0, function () {
return ~~(this.millisecond() / 10);
});
addFormatToken(0, ['SSS', 3], 0, 'millisecond');
addFormatToken(0, ['SSSS', 4], 0, function () {
return this.millisecond() * 10;
});
addFormatToken(0, ['SSSSS', 5], 0, function () {
return this.millisecond() * 100;
});
addFormatToken(0, ['SSSSSS', 6], 0, function () {
return this.millisecond() * 1000;
});
addFormatToken(0, ['SSSSSSS', 7], 0, function () {
return this.millisecond() * 10000;
});
addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
return this.millisecond() * 100000;
});
addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
return this.millisecond() * 1000000;
});
// ALIASES
addUnitAlias('millisecond', 'ms');
// PRIORITY
addUnitPriority('millisecond', 16);
// PARSING
addRegexToken('S', match1to3, match1);
addRegexToken('SS', match1to3, match2);
addRegexToken('SSS', match1to3, match3);
var token;
for (token = 'SSSS'; token.length <= 9; token += 'S') {
addRegexToken(token, matchUnsigned);
}
function parseMs(input, array) {
array[MILLISECOND] = toInt(('0.' + input) * 1000);
}
for (token = 'S'; token.length <= 9; token += 'S') {
addParseToken(token, parseMs);
}
// MOMENTS
var getSetMillisecond = makeGetSet('Milliseconds', false);
// FORMATTING
addFormatToken('z', 0, 0, 'zoneAbbr');
addFormatToken('zz', 0, 0, 'zoneName');
// MOMENTS
function getZoneAbbr () {
return this._isUTC ? 'UTC' : '';
}
function getZoneName () {
return this._isUTC ? 'Coordinated Universal Time' : '';
}
var proto = Moment.prototype;
proto.add = add;
proto.calendar = calendar$1;
proto.clone = clone;
proto.diff = diff;
proto.endOf = endOf;
proto.format = format;
proto.from = from;
proto.fromNow = fromNow;
proto.to = to;
proto.toNow = toNow;
proto.get = stringGet;
proto.invalidAt = invalidAt;
proto.isAfter = isAfter;
proto.isBefore = isBefore;
proto.isBetween = isBetween;
proto.isSame = isSame;
proto.isSameOrAfter = isSameOrAfter;
proto.isSameOrBefore = isSameOrBefore;
proto.isValid = isValid$2;
proto.lang = lang;
proto.locale = locale;
proto.localeData = localeData;
proto.max = prototypeMax;
proto.min = prototypeMin;
proto.parsingFlags = parsingFlags;
proto.set = stringSet;
proto.startOf = startOf;
proto.subtract = subtract;
proto.toArray = toArray;
proto.toObject = toObject;
proto.toDate = toDate;
proto.toISOString = toISOString;
proto.inspect = inspect;
proto.toJSON = toJSON;
proto.toString = toString;
proto.unix = unix;
proto.valueOf = valueOf;
proto.creationData = creationData;
// Year
proto.year = getSetYear;
proto.isLeapYear = getIsLeapYear;
// Week Year
proto.weekYear = getSetWeekYear;
proto.isoWeekYear = getSetISOWeekYear;
// Quarter
proto.quarter = proto.quarters = getSetQuarter;
// Month
proto.month = getSetMonth;
proto.daysInMonth = getDaysInMonth;
// Week
proto.week = proto.weeks = getSetWeek;
proto.isoWeek = proto.isoWeeks = getSetISOWeek;
proto.weeksInYear = getWeeksInYear;
proto.isoWeeksInYear = getISOWeeksInYear;
// Day
proto.date = getSetDayOfMonth;
proto.day = proto.days = getSetDayOfWeek;
proto.weekday = getSetLocaleDayOfWeek;
proto.isoWeekday = getSetISODayOfWeek;
proto.dayOfYear = getSetDayOfYear;
// Hour
proto.hour = proto.hours = getSetHour;
// Minute
proto.minute = proto.minutes = getSetMinute;
// Second
proto.second = proto.seconds = getSetSecond;
// Millisecond
proto.millisecond = proto.milliseconds = getSetMillisecond;
// Offset
proto.utcOffset = getSetOffset;
proto.utc = setOffsetToUTC;
proto.local = setOffsetToLocal;
proto.parseZone = setOffsetToParsedOffset;
proto.hasAlignedHourOffset = hasAlignedHourOffset;
proto.isDST = isDaylightSavingTime;
proto.isLocal = isLocal;
proto.isUtcOffset = isUtcOffset;
proto.isUtc = isUtc;
proto.isUTC = isUtc;
// Timezone
proto.zoneAbbr = getZoneAbbr;
proto.zoneName = getZoneName;
// Deprecations
proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
function createUnix (input) {
return createLocal(input * 1000);
}
function createInZone () {
return createLocal.apply(null, arguments).parseZone();
}
function preParsePostFormat (string) {
return string;
}
var proto$1 = Locale.prototype;
proto$1.calendar = calendar;
proto$1.longDateFormat = longDateFormat;
proto$1.invalidDate = invalidDate;
proto$1.ordinal = ordinal;
proto$1.preparse = preParsePostFormat;
proto$1.postformat = preParsePostFormat;
proto$1.relativeTime = relativeTime;
proto$1.pastFuture = pastFuture;
proto$1.set = set;
// Month
proto$1.months = localeMonths;
proto$1.monthsShort = localeMonthsShort;
proto$1.monthsParse = localeMonthsParse;
proto$1.monthsRegex = monthsRegex;
proto$1.monthsShortRegex = monthsShortRegex;
// Week
proto$1.week = localeWeek;
proto$1.firstDayOfYear = localeFirstDayOfYear;
proto$1.firstDayOfWeek = localeFirstDayOfWeek;
// Day of Week
proto$1.weekdays = localeWeekdays;
proto$1.weekdaysMin = localeWeekdaysMin;
proto$1.weekdaysShort = localeWeekdaysShort;
proto$1.weekdaysParse = localeWeekdaysParse;
proto$1.weekdaysRegex = weekdaysRegex;
proto$1.weekdaysShortRegex = weekdaysShortRegex;
proto$1.weekdaysMinRegex = weekdaysMinRegex;
// Hours
proto$1.isPM = localeIsPM;
proto$1.meridiem = localeMeridiem;
function get$1 (format, index, field, setter) {
var locale = getLocale();
var utc = createUTC().set(setter, index);
return locale[field](utc, format);
}
function listMonthsImpl (format, index, field) {
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
if (index != null) {
return get$1(format, index, field, 'month');
}
var i;
var out = [];
for (i = 0; i < 12; i++) {
out[i] = get$1(format, i, field, 'month');
}
return out;
}
// ()
// (5)
// (fmt, 5)
// (fmt)
// (true)
// (true, 5)
// (true, fmt, 5)
// (true, fmt)
function listWeekdaysImpl (localeSorted, format, index, field) {
if (typeof localeSorted === 'boolean') {
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
} else {
format = localeSorted;
index = format;
localeSorted = false;
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
}
var locale = getLocale(),
shift = localeSorted ? locale._week.dow : 0;
if (index != null) {
return get$1(format, (index + shift) % 7, field, 'day');
}
var i;
var out = [];
for (i = 0; i < 7; i++) {
out[i] = get$1(format, (i + shift) % 7, field, 'day');
}
return out;
}
function listMonths (format, index) {
return listMonthsImpl(format, index, 'months');
}
function listMonthsShort (format, index) {
return listMonthsImpl(format, index, 'monthsShort');
}
function listWeekdays (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
}
function listWeekdaysShort (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
}
function listWeekdaysMin (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
}
getSetGlobalLocale('en', {
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
ordinal : function (number) {
var b = number % 10,
output = (toInt(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
}
});
// Side effect imports
hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
var mathAbs = Math.abs;
function abs () {
var data = this._data;
this._milliseconds = mathAbs(this._milliseconds);
this._days = mathAbs(this._days);
this._months = mathAbs(this._months);
data.milliseconds = mathAbs(data.milliseconds);
data.seconds = mathAbs(data.seconds);
data.minutes = mathAbs(data.minutes);
data.hours = mathAbs(data.hours);
data.months = mathAbs(data.months);
data.years = mathAbs(data.years);
return this;
}
function addSubtract$1 (duration, input, value, direction) {
var other = createDuration(input, value);
duration._milliseconds += direction * other._milliseconds;
duration._days += direction * other._days;
duration._months += direction * other._months;
return duration._bubble();
}
// supports only 2.0-style add(1, 's') or add(duration)
function add$1 (input, value) {
return addSubtract$1(this, input, value, 1);
}
// supports only 2.0-style subtract(1, 's') or subtract(duration)
function subtract$1 (input, value) {
return addSubtract$1(this, input, value, -1);
}
function absCeil (number) {
if (number < 0) {
return Math.floor(number);
} else {
return Math.ceil(number);
}
}
function bubble () {
var milliseconds = this._milliseconds;
var days = this._days;
var months = this._months;
var data = this._data;
var seconds, minutes, hours, years, monthsFromDays;
// if we have a mix of positive and negative values, bubble down first
// check: https://github.com/moment/moment/issues/2166
if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
(milliseconds <= 0 && days <= 0 && months <= 0))) {
milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
days = 0;
months = 0;
}
// The following code bubbles up values, see the tests for
// examples of what that means.
data.milliseconds = milliseconds % 1000;
seconds = absFloor(milliseconds / 1000);
data.seconds = seconds % 60;
minutes = absFloor(seconds / 60);
data.minutes = minutes % 60;
hours = absFloor(minutes / 60);
data.hours = hours % 24;
days += absFloor(hours / 24);
// convert days to months
monthsFromDays = absFloor(daysToMonths(days));
months += monthsFromDays;
days -= absCeil(monthsToDays(monthsFromDays));
// 12 months -> 1 year
years = absFloor(months / 12);
months %= 12;
data.days = days;
data.months = months;
data.years = years;
return this;
}
function daysToMonths (days) {
// 400 years have 146097 days (taking into account leap year rules)
// 400 years have 12 months === 4800
return days * 4800 / 146097;
}
function monthsToDays (months) {
// the reverse of daysToMonths
return months * 146097 / 4800;
}
function as (units) {
if (!this.isValid()) {
return NaN;
}
var days;
var months;
var milliseconds = this._milliseconds;
units = normalizeUnits(units);
if (units === 'month' || units === 'year') {
days = this._days + milliseconds / 864e5;
months = this._months + daysToMonths(days);
return units === 'month' ? months : months / 12;
} else {
// handle milliseconds separately because of floating point math errors (issue #1867)
days = this._days + Math.round(monthsToDays(this._months));
switch (units) {
case 'week' : return days / 7 + milliseconds / 6048e5;
case 'day' : return days + milliseconds / 864e5;
case 'hour' : return days * 24 + milliseconds / 36e5;
case 'minute' : return days * 1440 + milliseconds / 6e4;
case 'second' : return days * 86400 + milliseconds / 1000;
// Math.floor prevents floating point math errors here
case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
default: throw new Error('Unknown unit ' + units);
}
}
}
// TODO: Use this.as('ms')?
function valueOf$1 () {
if (!this.isValid()) {
return NaN;
}
return (
this._milliseconds +
this._days * 864e5 +
(this._months % 12) * 2592e6 +
toInt(this._months / 12) * 31536e6
);
}
function makeAs (alias) {
return function () {
return this.as(alias);
};
}
var asMilliseconds = makeAs('ms');
var asSeconds = makeAs('s');
var asMinutes = makeAs('m');
var asHours = makeAs('h');
var asDays = makeAs('d');
var asWeeks = makeAs('w');
var asMonths = makeAs('M');
var asYears = makeAs('y');
function clone$1 () {
return createDuration(this);
}
function get$2 (units) {
units = normalizeUnits(units);
return this.isValid() ? this[units + 's']() : NaN;
}
function makeGetter(name) {
return function () {
return this.isValid() ? this._data[name] : NaN;
};
}
var milliseconds = makeGetter('milliseconds');
var seconds = makeGetter('seconds');
var minutes = makeGetter('minutes');
var hours = makeGetter('hours');
var days = makeGetter('days');
var months = makeGetter('months');
var years = makeGetter('years');
function weeks () {
return absFloor(this.days() / 7);
}
var round = Math.round;
var thresholds = {
ss: 44, // a few seconds to seconds
s : 45, // seconds to minute
m : 45, // minutes to hour
h : 22, // hours to day
d : 26, // days to month
M : 11 // months to year
};
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
}
function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
var duration = createDuration(posNegDuration).abs();
var seconds = round(duration.as('s'));
var minutes = round(duration.as('m'));
var hours = round(duration.as('h'));
var days = round(duration.as('d'));
var months = round(duration.as('M'));
var years = round(duration.as('y'));
var a = seconds <= thresholds.ss && ['s', seconds] ||
seconds < thresholds.s && ['ss', seconds] ||
minutes <= 1 && ['m'] ||
minutes < thresholds.m && ['mm', minutes] ||
hours <= 1 && ['h'] ||
hours < thresholds.h && ['hh', hours] ||
days <= 1 && ['d'] ||
days < thresholds.d && ['dd', days] ||
months <= 1 && ['M'] ||
months < thresholds.M && ['MM', months] ||
years <= 1 && ['y'] || ['yy', years];
a[2] = withoutSuffix;
a[3] = +posNegDuration > 0;
a[4] = locale;
return substituteTimeAgo.apply(null, a);
}
// This function allows you to set the rounding function for relative time strings
function getSetRelativeTimeRounding (roundingFunction) {
if (roundingFunction === undefined) {
return round;
}
if (typeof(roundingFunction) === 'function') {
round = roundingFunction;
return true;
}
return false;
}
// This function allows you to set a threshold for relative time strings
function getSetRelativeTimeThreshold (threshold, limit) {
if (thresholds[threshold] === undefined) {
return false;
}
if (limit === undefined) {
return thresholds[threshold];
}
thresholds[threshold] = limit;
if (threshold === 's') {
thresholds.ss = limit - 1;
}
return true;
}
function humanize (withSuffix) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var locale = this.localeData();
var output = relativeTime$1(this, !withSuffix, locale);
if (withSuffix) {
output = locale.pastFuture(+this, output);
}
return locale.postformat(output);
}
var abs$1 = Math.abs;
function sign(x) {
return ((x > 0) - (x < 0)) || +x;
}
function toISOString$1() {
// for ISO strings we do not use the normal bubbling rules:
// * milliseconds bubble up until they become hours
// * days do not bubble at all
// * months bubble up until they become years
// This is because there is no context-free conversion between hours and days
// (think of clock changes)
// and also not between days and months (28-31 days per month)
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var seconds = abs$1(this._milliseconds) / 1000;
var days = abs$1(this._days);
var months = abs$1(this._months);
var minutes, hours, years;
// 3600 seconds -> 60 minutes -> 1 hour
minutes = absFloor(seconds / 60);
hours = absFloor(minutes / 60);
seconds %= 60;
minutes %= 60;
// 12 months -> 1 year
years = absFloor(months / 12);
months %= 12;
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
var Y = years;
var M = months;
var D = days;
var h = hours;
var m = minutes;
var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
var total = this.asSeconds();
if (!total) {
// this is the same as C#'s (Noda) and python (isodate)...
// but not other JS (goog.date)
return 'P0D';
}
var totalSign = total < 0 ? '-' : '';
var ymSign = sign(this._months) !== sign(total) ? '-' : '';
var daysSign = sign(this._days) !== sign(total) ? '-' : '';
var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
return totalSign + 'P' +
(Y ? ymSign + Y + 'Y' : '') +
(M ? ymSign + M + 'M' : '') +
(D ? daysSign + D + 'D' : '') +
((h || m || s) ? 'T' : '') +
(h ? hmsSign + h + 'H' : '') +
(m ? hmsSign + m + 'M' : '') +
(s ? hmsSign + s + 'S' : '');
}
var proto$2 = Duration.prototype;
proto$2.isValid = isValid$1;
proto$2.abs = abs;
proto$2.add = add$1;
proto$2.subtract = subtract$1;
proto$2.as = as;
proto$2.asMilliseconds = asMilliseconds;
proto$2.asSeconds = asSeconds;
proto$2.asMinutes = asMinutes;
proto$2.asHours = asHours;
proto$2.asDays = asDays;
proto$2.asWeeks = asWeeks;
proto$2.asMonths = asMonths;
proto$2.asYears = asYears;
proto$2.valueOf = valueOf$1;
proto$2._bubble = bubble;
proto$2.clone = clone$1;
proto$2.get = get$2;
proto$2.milliseconds = milliseconds;
proto$2.seconds = seconds;
proto$2.minutes = minutes;
proto$2.hours = hours;
proto$2.days = days;
proto$2.weeks = weeks;
proto$2.months = months;
proto$2.years = years;
proto$2.humanize = humanize;
proto$2.toISOString = toISOString$1;
proto$2.toString = toISOString$1;
proto$2.toJSON = toISOString$1;
proto$2.locale = locale;
proto$2.localeData = localeData;
// Deprecations
proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
proto$2.lang = lang;
// Side effect imports
// FORMATTING
addFormatToken('X', 0, 0, 'unix');
addFormatToken('x', 0, 0, 'valueOf');
// PARSING
addRegexToken('x', matchSigned);
addRegexToken('X', matchTimestamp);
addParseToken('X', function (input, array, config) {
config._d = new Date(parseFloat(input, 10) * 1000);
});
addParseToken('x', function (input, array, config) {
config._d = new Date(toInt(input));
});
// Side effect imports
hooks.version = '2.20.1';
setHookCallback(createLocal);
hooks.fn = proto;
hooks.min = min;
hooks.max = max;
hooks.now = now;
hooks.utc = createUTC;
hooks.unix = createUnix;
hooks.months = listMonths;
hooks.isDate = isDate;
hooks.locale = getSetGlobalLocale;
hooks.invalid = createInvalid;
hooks.duration = createDuration;
hooks.isMoment = isMoment;
hooks.weekdays = listWeekdays;
hooks.parseZone = createInZone;
hooks.localeData = getLocale;
hooks.isDuration = isDuration;
hooks.monthsShort = listMonthsShort;
hooks.weekdaysMin = listWeekdaysMin;
hooks.defineLocale = defineLocale;
hooks.updateLocale = updateLocale;
hooks.locales = listLocales;
hooks.weekdaysShort = listWeekdaysShort;
hooks.normalizeUnits = normalizeUnits;
hooks.relativeTimeRounding = getSetRelativeTimeRounding;
hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
hooks.calendarFormat = getCalendarFormat;
hooks.prototype = proto;
// currently HTML5 input type only supports 24-hour formats
hooks.HTML5_FMT = {
DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', //
DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', //
DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', //
DATE: 'YYYY-MM-DD', //
TIME: 'HH:mm', //
TIME_SECONDS: 'HH:mm:ss', //
TIME_MS: 'HH:mm:ss.SSS', //
WEEK: 'YYYY-[W]WW', //
MONTH: 'YYYY-MM' //
};
return hooks;
})));
/*** EXPORTS FROM exports-to-window-loader ***/
window['moment'] = __webpack_require__(64);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(430)(module)))
/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(21);
var toObject = __webpack_require__(61);
var nativeKeys = __webpack_require__(102);
var fails = __webpack_require__(28);
var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
// `Object.keys` method
// https://tc39.github.io/ecma262/#sec-object.keys
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
keys: function keys(it) {
return nativeKeys(toObject(it));
}
});
/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(17);
__webpack_require__(13);
__webpack_require__(36);
__webpack_require__(58);
__webpack_require__(40);
exports.__esModule = true;
exports.normalizeSelection = normalizeSelection;
exports.isSeparator = isSeparator;
exports.hasSubMenu = hasSubMenu;
exports.isDisabled = isDisabled;
exports.isSelectionDisabled = isSelectionDisabled;
exports.getValidSelection = getValidSelection;
exports.prepareVerticalAlignClass = prepareVerticalAlignClass;
exports.prepareHorizontalAlignClass = prepareHorizontalAlignClass;
exports.getAlignmentClasses = getAlignmentClasses;
exports.align = align;
exports.checkSelectionConsistency = checkSelectionConsistency;
exports.markLabelAsSelected = markLabelAsSelected;
exports.isItemHidden = isItemHidden;
exports.filterSeparators = filterSeparators;
var _array = __webpack_require__(3);
var _element = __webpack_require__(8);
var _separator = __webpack_require__(177);
function normalizeSelection(selRanges) {
return (0, _array.arrayMap)(selRanges, function (range) {
return {
start: range.getTopLeftCorner(),
end: range.getBottomRightCorner()
};
});
}
function isSeparator(cell) {
return (0, _element.hasClass)(cell, 'htSeparator');
}
function hasSubMenu(cell) {
return (0, _element.hasClass)(cell, 'htSubmenu');
}
function isDisabled(cell) {
return (0, _element.hasClass)(cell, 'htDisabled');
}
function isSelectionDisabled(cell) {
return (0, _element.hasClass)(cell, 'htSelectionDisabled');
}
function getValidSelection(hot) {
var selected = hot.getSelected();
if (!selected) {
return null;
}
if (selected[0] < 0) {
return null;
}
return selected;
}
function prepareVerticalAlignClass(className, alignment) {
if (className.indexOf(alignment) !== -1) {
return className;
}
var replacedClassName = className.replace('htTop', '').replace('htMiddle', '').replace('htBottom', '').replace(' ', '');
return "".concat(replacedClassName, " ").concat(alignment);
}
function prepareHorizontalAlignClass(className, alignment) {
if (className.indexOf(alignment) !== -1) {
return className;
}
var replacedClassName = className.replace('htLeft', '').replace('htCenter', '').replace('htRight', '').replace('htJustify', '').replace(' ', '');
return "".concat(replacedClassName, " ").concat(alignment);
}
function getAlignmentClasses(ranges, callback) {
var classes = {};
(0, _array.arrayEach)(ranges, function (_ref) {
var from = _ref.from,
to = _ref.to;
for (var row = from.row; row <= to.row; row++) {
for (var col = from.col; col <= to.col; col++) {
if (!classes[row]) {
classes[row] = [];
}
classes[row][col] = callback(row, col);
}
}
});
return classes;
}
function align(ranges, type, alignment, cellDescriptor, propertySetter) {
(0, _array.arrayEach)(ranges, function (_ref2) {
var from = _ref2.from,
to = _ref2.to;
if (from.row === to.row && from.col === to.col) {
applyAlignClassName(from.row, from.col, type, alignment, cellDescriptor, propertySetter);
} else {
for (var row = from.row; row <= to.row; row++) {
for (var col = from.col; col <= to.col; col++) {
applyAlignClassName(row, col, type, alignment, cellDescriptor, propertySetter);
}
}
}
});
}
function applyAlignClassName(row, col, type, alignment, cellDescriptor, propertySetter) {
var cellMeta = cellDescriptor(row, col);
var className = alignment;
if (cellMeta.className) {
if (type === 'vertical') {
className = prepareVerticalAlignClass(cellMeta.className, alignment);
} else {
className = prepareHorizontalAlignClass(cellMeta.className, alignment);
}
}
propertySetter(row, col, 'className', className);
}
function checkSelectionConsistency(ranges, comparator) {
var result = false;
if (Array.isArray(ranges)) {
(0, _array.arrayEach)(ranges, function (range) {
range.forAll(function (row, col) {
if (comparator(row, col)) {
result = true;
return false;
}
});
return result;
});
}
return result;
}
function markLabelAsSelected(label) {
// workaround for https://github.com/handsontable/handsontable/issues/1946
return "".concat(String.fromCharCode(10003), "").concat(label);
}
function isItemHidden(item, instance) {
return !item.hidden || !(typeof item.hidden === 'function' && item.hidden.call(instance));
}
function shiftSeparators(items, separator) {
var result = items.slice(0);
for (var i = 0; i < result.length;) {
if (result[i].name === separator) {
result.shift();
} else {
break;
}
}
return result;
}
function popSeparators(items, separator) {
var result = items.slice(0);
result.reverse();
result = shiftSeparators(result, separator);
result.reverse();
return result;
}
function removeDuplicatedSeparators(items) {
var result = [];
(0, _array.arrayEach)(items, function (value, index) {
if (index > 0) {
if (result[result.length - 1].name !== value.name) {
result.push(value);
}
} else {
result.push(value);
}
});
return result;
}
function filterSeparators(items) {
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _separator.KEY;
var result = items.slice(0);
result = shiftSeparators(result, separator);
result = popSeparators(result, separator);
result = removeDuplicatedSeparators(result);
return result;
}
/***/ }),
/* 67 */
/***/ (function(module, exports, __webpack_require__) {
// toObject with fallback for non-array-like ES3 strings
var IndexedObject = __webpack_require__(119);
var requireObjectCoercible = __webpack_require__(51);
module.exports = function (it) {
return IndexedObject(requireObjectCoercible(it));
};
/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(46);
var definePropertyModule = __webpack_require__(53);
var createPropertyDescriptor = __webpack_require__(95);
module.exports = DESCRIPTORS ? function (object, key, value) {
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(37);
var shared = __webpack_require__(97);
var hide = __webpack_require__(68);
var has = __webpack_require__(52);
var setGlobal = __webpack_require__(147);
var nativeFunctionToString = __webpack_require__(186);
var InternalStateModule = __webpack_require__(87);
var getInternalState = InternalStateModule.get;
var enforceInternalState = InternalStateModule.enforce;
var TEMPLATE = String(nativeFunctionToString).split('toString');
shared('inspectSource', function (it) {
return nativeFunctionToString.call(it);
});
(module.exports = function (O, key, value, options) {
var unsafe = options ? !!options.unsafe : false;
var simple = options ? !!options.enumerable : false;
var noTargetGet = options ? !!options.noTargetGet : false;
if (typeof value == 'function') {
if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
}
if (O === global) {
if (simple) O[key] = value;
else setGlobal(key, value);
return;
} else if (!unsafe) {
delete O[key];
} else if (!noTargetGet && O[key]) {
simple = true;
}
if (simple) O[key] = value;
else hide(O, key, value);
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, 'toString', function toString() {
return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this);
});
/***/ }),
/* 70 */
/***/ (function(module, exports) {
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;
}
module.exports = _defineProperty;
/***/ }),
/* 71 */
/***/ (function(module, exports) {
function _taggedTemplateLiteral(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
return Object.freeze(Object.defineProperties(strings, {
raw: {
value: Object.freeze(raw)
}
}));
}
module.exports = _taggedTemplateLiteral;
/***/ }),
/* 72 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(40);
__webpack_require__(133);
exports.__esModule = true;
exports.toSingleLine = toSingleLine;
var _array = __webpack_require__(3);
/* eslint-disable import/prefer-default-export */
/**
* Tags a multiline string and return new one without line break characters and following spaces.
*
* @param {Array} strings Parts of the entire string without expressions.
* @param {...String} expressions Expressions converted to strings, which are added to the entire string.
* @returns {String}
*/
function toSingleLine(strings) {
for (var _len = arguments.length, expressions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
expressions[_key - 1] = arguments[_key];
}
var result = (0, _array.arrayReduce)(strings, function (previousValue, currentValue, index) {
var valueWithoutWhiteSpaces = currentValue.replace(/(?:\r?\n\s+)/g, '');
var expressionForIndex = expressions[index] ? expressions[index] : '';
return previousValue + valueWithoutWhiteSpaces + expressionForIndex;
}, '');
return result.trim();
}
/***/ }),
/* 73 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(37);
var DOMIterables = __webpack_require__(204);
var forEach = __webpack_require__(434);
var hide = __webpack_require__(68);
for (var COLLECTION_NAME in DOMIterables) {
var Collection = global[COLLECTION_NAME];
var CollectionPrototype = Collection && Collection.prototype;
// some Chrome versions have non-configurable methods on DOMTokenList
if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
hide(CollectionPrototype, 'forEach', forEach);
} catch (error) {
CollectionPrototype.forEach = forEach;
}
}
/***/ }),
/* 74 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var aFunction = __webpack_require__(156);
var toObject = __webpack_require__(61);
var fails = __webpack_require__(28);
var sloppyArrayMethod = __webpack_require__(130);
var nativeSort = [].sort;
var test = [1, 2, 3];
// IE8-
var FAILS_ON_UNDEFINED = fails(function () {
test.sort(undefined);
});
// V8 bug
var FAILS_ON_NULL = fails(function () {
test.sort(null);
});
// Old WebKit
var SLOPPY_METHOD = sloppyArrayMethod('sort');
var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD;
// `Array.prototype.sort` method
// https://tc39.github.io/ecma262/#sec-array.prototype.sort
$({ target: 'Array', proto: true, forced: FORCED }, {
sort: function sort(comparefn) {
return comparefn === undefined
? nativeSort.call(toObject(this))
: nativeSort.call(toObject(this), aFunction(comparefn));
}
});
/***/ }),
/* 75 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.setBrowserMeta = setBrowserMeta;
exports.isChrome = isChrome;
exports.isEdge = isEdge;
exports.isIE = isIE;
exports.isIE8 = isIE8;
exports.isIE9 = isIE9;
exports.isMSBrowser = isMSBrowser;
exports.isMobileBrowser = isMobileBrowser;
exports.isSafari = isSafari;
var _object = __webpack_require__(4);
var tester = function tester(testerFunc) {
var result = {
value: false
};
result.test = function (ua, vendor) {
result.value = testerFunc(ua, vendor);
};
return result;
};
var browsers = {
chrome: tester(function (ua, vendor) {
return /Chrome/.test(ua) && /Google/.test(vendor);
}),
edge: tester(function (ua) {
return /Edge/.test(ua);
}),
ie: tester(function (ua) {
return /Trident/.test(ua);
}),
// eslint-disable-next-line no-restricted-globals
ie8: tester(function () {
return !document.createTextNode('test').textContent;
}),
// eslint-disable-next-line no-restricted-globals
ie9: tester(function () {
return !!document.documentMode;
}),
mobile: tester(function (ua) {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua);
}),
safari: tester(function (ua, vendor) {
return /Safari/.test(ua) && /Apple Computer/.test(vendor);
})
};
function setBrowserMeta() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$userAgent = _ref.userAgent,
userAgent = _ref$userAgent === void 0 ? navigator.userAgent : _ref$userAgent,
_ref$vendor = _ref.vendor,
vendor = _ref$vendor === void 0 ? navigator.vendor : _ref$vendor;
(0, _object.objectEach)(browsers, function (_ref2) {
var test = _ref2.test;
return void test(userAgent, vendor);
});
}
setBrowserMeta();
function isChrome() {
return browsers.chrome.value;
}
function isEdge() {
return browsers.edge.value;
}
function isIE() {
return browsers.ie.value;
}
function isIE8() {
return browsers.ie8.value;
}
function isIE9() {
return browsers.ie9.value;
}
function isMSBrowser() {
return browsers.ie.value || browsers.edge.value;
}
function isMobileBrowser() {
return browsers.mobile.value;
}
function isSafari() {
return browsers.safari.value;
}
/***/ }),
/* 76 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(13);
__webpack_require__(9);
__webpack_require__(39);
__webpack_require__(40);
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__(27);
/**
* 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 = new Array(_len), _key = 0; _key < _len; _key++) {
strings[_key] = arguments[_key];
}
var length = strings.length;
while (length) {
length -= 1;
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 "".concat(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) {
return "".concat(string).replace(STRIP_TAGS_REGEX, '');
}
/***/ }),
/* 77 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function (it) {
return toString.call(it).slice(8, -1);
};
/***/ }),
/* 78 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(14);
__webpack_require__(62);
__webpack_require__(9);
__webpack_require__(12);
__webpack_require__(16);
exports.__esModule = true;
exports.default = staticRegister;
exports.collection = void 0;
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(38));
var collection = new Map();
exports.collection = collection;
function staticRegister() {
var namespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'common';
if (!collection.has(namespace)) {
collection.set(namespace, new Map());
}
var subCollection = collection.get(namespace);
/**
* Register an item to the collection. If the item under the same was exist earlier then this item will be replaced with new one.
*
* @param {String} name Identification of the item.
* @param {*} item Item to save in the collection.
*/
function register(name, item) {
subCollection.set(name, item);
}
/**
* Retrieve the item from the collection.
*
* @param {String} name Identification of the item.
* @returns {*} Returns item which was saved in the collection.
*/
function getItem(name) {
return subCollection.get(name);
}
/**
* Check if item under specyfied name is exists.
*
* @param {String} name Identification of the item.
* @returns {Boolean} Returns `true` or `false` depends on if element exists in the collection.
*/
function hasItem(name) {
return subCollection.has(name);
}
/**
* Retrieve list of names registered from the collection.
*
* @returns {Array} Returns an array of strings with all names under which objects are stored.
*/
function getNames() {
return (0, _toConsumableArray2.default)(subCollection.keys());
}
/**
* Retrieve all registered values from the collection.
*
* @returns {Array} Returns an array with all values stored in the collection.
*/
function getValues() {
return (0, _toConsumableArray2.default)(subCollection.values());
}
return {
register: register,
getItem: getItem,
hasItem: hasItem,
getNames: getNames,
getValues: getValues
};
}
/***/ }),
/* 79 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(9);
__webpack_require__(39);
__webpack_require__(135);
__webpack_require__(33);
exports.__esModule = true;
exports.requestAnimationFrame = requestAnimationFrame;
exports.isClassListSupported = isClassListSupported;
exports.isTextContentSupported = isTextContentSupported;
exports.isGetComputedStyleSupported = isGetComputedStyleSupported;
exports.cancelAnimationFrame = cancelAnimationFrame;
exports.isTouchSupported = isTouchSupported;
exports.isWebComponentSupportedNatively = isWebComponentSupportedNatively;
exports.hasCaptionProblem = hasCaptionProblem;
exports.getComparisonFunction = getComparisonFunction;
exports.isPassiveEventSupported = isPassiveEventSupported;
var _typeof2 = _interopRequireDefault(__webpack_require__(45));
// https://gist.github.com/paulirish/1579671
/* eslint-disable no-restricted-globals */
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["".concat(vendors[x], "RequestAnimationFrame")];
_cancelAnimationFrame = window["".concat(vendors[x], "CancelAnimationFrame")] || window["".concat(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);
}
function isClassListSupported() {
return !!document.documentElement.classList;
}
function isTextContentSupported() {
return !!document.createTextNode('test').textContent;
}
function isGetComputedStyleSupported() {
return !!window.getComputedStyle;
}
/**
* 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 = '
');
return result.join('');
}
/**
* Helper to verify and get CSSRules for the element.
*
* @param {Element} element Element to verify with selector text.
* @param {String} selector Selector text from CSSRule.
*/
function matchCSSRules(element, selector) {
var result;
if (element.msMatchesSelector) {
result = element.msMatchesSelector(selector);
} else if (element.matches) {
result = element.matches(selector);
}
return result;
}
/**
* Converts HTMLTable or string into Handsontable configuration object.
*
* @param {Element|String} element Node element which should contain `
...
`.
* @param {Document} [rootDocument]
* @returns {Object} Return configuration object. Contains keys as DefaultSettings.
*/
// eslint-disable-next-line no-restricted-globals
function htmlToGridSettings(element) {
var rootDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
var settingsObj = {};
var fragment = rootDocument.createDocumentFragment();
var tempElem = rootDocument.createElement('div');
fragment.appendChild(tempElem);
var checkElement = element;
if (typeof checkElement === 'string') {
tempElem.insertAdjacentHTML('afterbegin', "".concat(checkElement));
checkElement = tempElem.querySelector('table');
}
if (!checkElement || !isHTMLTable(checkElement)) {
return;
}
var styleElem = tempElem.querySelector('style');
var styleSheet = null;
var styleSheetArr = [];
if (styleElem) {
rootDocument.body.appendChild(styleElem);
styleElem.disabled = true;
styleSheet = styleElem.sheet;
styleSheetArr = styleSheet ? Array.from(styleSheet.cssRules) : [];
rootDocument.body.removeChild(styleElem);
}
var generator = tempElem.querySelector('meta[name$="enerator"]');
var hasRowHeaders = checkElement.querySelector('tbody th') !== null;
var countCols = Array.from(checkElement.querySelector('tr').cells).reduce(function (cols, cell) {
return cols + cell.colSpan;
}, 0) - (hasRowHeaders ? 1 : 0);
var fixedRowsBottom = checkElement.tFoot && Array.from(checkElement.tFoot.rows) || [];
var fixedRowsTop = [];
var hasColHeaders = false;
var thRowsLen = 0;
var countRows = 0;
if (checkElement.tHead) {
var thRows = Array.from(checkElement.tHead.rows).filter(function (tr) {
var isDataRow = tr.querySelector('td') !== null;
if (isDataRow) {
fixedRowsTop.push(tr);
}
return !isDataRow;
});
thRowsLen = thRows.length;
hasColHeaders = thRowsLen > 0;
if (thRowsLen > 1) {
settingsObj.nestedHeaders = Array.from(thRows).reduce(function (rows, row) {
var headersRow = Array.from(row.cells).reduce(function (headers, header, currentIndex) {
if (hasRowHeaders && currentIndex === 0) {
return headers;
}
var colspan = header.colSpan,
innerHTML = header.innerHTML;
var nextHeader = colspan > 1 ? {
label: innerHTML,
colspan: colspan
} : innerHTML;
headers.push(nextHeader);
return headers;
}, []);
rows.push(headersRow);
return rows;
}, []);
} else if (hasColHeaders) {
settingsObj.colHeaders = Array.from(thRows[0].children).reduce(function (headers, header, index) {
if (hasRowHeaders && index === 0) {
return headers;
}
headers.push(header.innerHTML);
return headers;
}, []);
}
}
if (fixedRowsTop.length) {
settingsObj.fixedRowsTop = fixedRowsTop.length;
}
if (fixedRowsBottom.length) {
settingsObj.fixedRowsBottom = fixedRowsBottom.length;
}
var dataRows = [].concat(fixedRowsTop, (0, _toConsumableArray2.default)(Array.from(checkElement.tBodies).reduce(function (sections, section) {
sections.push.apply(sections, (0, _toConsumableArray2.default)(section.rows));
return sections;
}, [])), (0, _toConsumableArray2.default)(fixedRowsBottom));
countRows = dataRows.length;
var dataArr = new Array(countRows);
for (var r = 0; r < countRows; r++) {
dataArr[r] = new Array(countCols);
}
var mergeCells = [];
var rowHeaders = [];
for (var row = 0; row < countRows; row++) {
var tr = dataRows[row];
var cells = Array.from(tr.cells);
var cellsLen = cells.length;
var _loop = function _loop(cellId) {
var cell = cells[cellId];
var nodeName = cell.nodeName,
innerHTML = cell.innerHTML,
rowspan = cell.rowSpan,
colspan = cell.colSpan;
var col = dataArr[row].findIndex(function (value) {
return value === void 0;
});
if (nodeName === 'TD') {
if (rowspan > 1 || colspan > 1) {
for (var rstart = row; rstart < row + rowspan; rstart++) {
if (rstart < countRows) {
for (var cstart = col; cstart < col + colspan; cstart++) {
dataArr[rstart][cstart] = null;
}
}
}
var styleAttr = cell.getAttribute('style');
var ignoreMerge = styleAttr && styleAttr.includes('mso-ignore:colspan');
if (!ignoreMerge) {
mergeCells.push({
col: col,
row: row,
rowspan: rowspan,
colspan: colspan
});
}
}
var cellStyle = styleSheetArr.reduce(function (settings, cssRule) {
if (cssRule.selectorText && matchCSSRules(cell, cssRule.selectorText)) {
var whiteSpace = cssRule.style.whiteSpace;
if (whiteSpace) {
settings.whiteSpace = whiteSpace;
}
}
return settings;
}, {});
if (cellStyle.whiteSpace === 'nowrap') {
dataArr[row][col] = innerHTML.replace(/[\r\n][\x20]{0,2}/gim, '\x20').replace(/ /gim, '\r\n').replace(/(<([^>]+)>)/gi, '').replace(/ /gi, '\x20');
} else if (generator && /excel/gi.test(generator.content)) {
dataArr[row][col] = innerHTML.replace(/ [\r\n]?[\x20]{0,2}/gim, '\r\n').replace(/(<([^>]+)>)/gi, '').replace(/ /gi, '\x20');
} else {
dataArr[row][col] = innerHTML.replace(/ [\r\n]?/gim, '\r\n').replace(/(<([^>]+)>)/gi, '').replace(/ /gi, '\x20');
}
} else {
rowHeaders.push(innerHTML);
}
};
for (var cellId = 0; cellId < cellsLen; cellId++) {
_loop(cellId);
}
}
if (mergeCells.length) {
settingsObj.mergeCells = mergeCells;
}
if (rowHeaders.length) {
settingsObj.rowHeaders = rowHeaders;
}
if (dataArr.length) {
settingsObj.data = dataArr;
}
return settingsObj;
}
/***/ }),
/* 175 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(133);
__webpack_require__(73);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _element = __webpack_require__(8);
var _array = __webpack_require__(3);
/**
* @class GhostTable
* @util
*/
var GhostTable =
/*#__PURE__*/
function () {
function GhostTable(hotInstance) {
(0, _classCallCheck2.default)(this, GhostTable);
/**
* Handsontable instance.
*
* @type {Core}
*/
this.hot = hotInstance;
/**
* Container element where every table will be injected.
*
* @type {HTMLElement|null}
*/
this.container = null;
/**
* Flag which determine is table was injected to DOM.
*
* @type {Boolean}
*/
this.injected = false;
/**
* Added rows collection.
*
* @type {Array}
*/
this.rows = [];
/**
* Added columns collection.
*
* @type {Array}
*/
this.columns = [];
/**
* Samples prepared for calculations.
*
* @type {Map}
* @default {null}
*/
this.samples = null;
/**
* Ghost table settings.
*
* @type {Object}
* @default {Object}
*/
this.settings = {
useHeaders: true
};
}
/**
* Add row.
*
* @param {Number} row Row index.
* @param {Map} samples Samples Map object.
*/
(0, _createClass2.default)(GhostTable, [{
key: "addRow",
value: function addRow(row, samples) {
if (this.columns.length) {
throw new Error('Doesn\'t support multi-dimensional table');
}
if (!this.rows.length) {
this.container = this.createContainer(this.hot.rootElement.className);
}
var rowObject = {
row: row
};
this.rows.push(rowObject);
this.samples = samples;
this.table = this.createTable(this.hot.table.className);
this.table.colGroup.appendChild(this.createColGroupsCol());
this.table.tr.appendChild(this.createRow(row));
this.container.container.appendChild(this.table.fragment);
rowObject.table = this.table.table;
}
/**
* Add a row consisting of the column headers.
*/
}, {
key: "addColumnHeadersRow",
value: function addColumnHeadersRow(samples) {
var colHeader = this.hot.getColHeader(0);
if (colHeader !== null && colHeader !== void 0) {
var rowObject = {
row: -1
};
this.rows.push(rowObject);
this.container = this.createContainer(this.hot.rootElement.className);
this.samples = samples;
this.table = this.createTable(this.hot.table.className);
this.table.colGroup.appendChild(this.createColGroupsCol());
this.table.tHead.appendChild(this.createColumnHeadersRow());
this.container.container.appendChild(this.table.fragment);
rowObject.table = this.table.table;
}
}
/**
* Add column.
*
* @param {Number} column Column index.
* @param {Map} samples Samples Map object.
*/
}, {
key: "addColumn",
value: function addColumn(column, samples) {
if (this.rows.length) {
throw new Error('Doesn\'t support multi-dimensional table');
}
if (!this.columns.length) {
this.container = this.createContainer(this.hot.rootElement.className);
}
var columnObject = {
col: column
};
this.columns.push(columnObject);
this.samples = samples;
this.table = this.createTable(this.hot.table.className);
if (this.getSetting('useHeaders') && this.hot.getColHeader(column) !== null) {
this.hot.view.appendColHeader(column, this.table.th);
}
this.table.tBody.appendChild(this.createCol(column));
this.container.container.appendChild(this.table.fragment);
columnObject.table = this.table.table;
}
/**
* Get calculated heights.
*
* @param {Function} callback Callback which will be fired for each calculated row.
*/
}, {
key: "getHeights",
value: function getHeights(callback) {
if (!this.injected) {
this.injectTable();
}
(0, _array.arrayEach)(this.rows, function (row) {
// -1 <- reduce border-top from table
callback(row.row, (0, _element.outerHeight)(row.table) - 1);
});
}
/**
* Get calculated widths.
*
* @param {Function} callback Callback which will be fired for each calculated column.
*/
}, {
key: "getWidths",
value: function getWidths(callback) {
if (!this.injected) {
this.injectTable();
}
(0, _array.arrayEach)(this.columns, function (column) {
callback(column.col, (0, _element.outerWidth)(column.table));
});
}
/**
* Set the Ghost Table settings to the provided object.
*
* @param {Object} settings New Ghost Table Settings
*/
}, {
key: "setSettings",
value: function setSettings(settings) {
this.settings = settings;
}
/**
* Set a single setting of the Ghost Table.
*
* @param {String} name Setting name.
* @param {*} value Setting value.
*/
}, {
key: "setSetting",
value: function setSetting(name, value) {
if (!this.settings) {
this.settings = {};
}
this.settings[name] = value;
}
/**
* Get the Ghost Table settings.
*
* @returns {Object|null}
*/
}, {
key: "getSettings",
value: function getSettings() {
return this.settings;
}
/**
* Get a single Ghost Table setting.
*
* @param {String} name
* @returns {Boolean|null}
*/
}, {
key: "getSetting",
value: function getSetting(name) {
if (this.settings) {
return this.settings[name];
}
return null;
}
/**
* Create colgroup col elements.
*
* @returns {DocumentFragment}
*/
}, {
key: "createColGroupsCol",
value: function createColGroupsCol() {
var _this = this;
var fragment = this.hot.rootDocument.createDocumentFragment();
if (this.hot.hasRowHeaders()) {
fragment.appendChild(this.createColElement(-1));
}
this.samples.forEach(function (sample) {
(0, _array.arrayEach)(sample.strings, function (string) {
fragment.appendChild(_this.createColElement(string.col));
});
});
return fragment;
}
/**
* Create table row element.
*
* @param {Number} row Row index.
* @returns {DocumentFragment} Returns created table row elements.
*/
}, {
key: "createRow",
value: function createRow(row) {
var _this2 = this;
var rootDocument = this.hot.rootDocument;
var fragment = rootDocument.createDocumentFragment();
var th = rootDocument.createElement('th');
if (this.hot.hasRowHeaders()) {
this.hot.view.appendRowHeader(row, th);
fragment.appendChild(th);
}
this.samples.forEach(function (sample) {
(0, _array.arrayEach)(sample.strings, function (string) {
var column = string.col;
var cellProperties = _this2.hot.getCellMeta(row, column);
cellProperties.col = column;
cellProperties.row = row;
var renderer = _this2.hot.getCellRenderer(cellProperties);
var td = rootDocument.createElement('td'); // Indicate that this element is created and supported by GhostTable. It can be useful to
// exclude rendering performance costly logic or exclude logic which doesn't work within a hidden table.
td.setAttribute('ghost-table', 1);
renderer(_this2.hot, td, row, column, _this2.hot.colToProp(column), string.value, cellProperties);
fragment.appendChild(td);
});
});
return fragment;
}
}, {
key: "createColumnHeadersRow",
value: function createColumnHeadersRow() {
var _this3 = this;
var rootDocument = this.hot.rootDocument;
var fragment = rootDocument.createDocumentFragment();
if (this.hot.hasRowHeaders()) {
var th = rootDocument.createElement('th');
this.hot.view.appendColHeader(-1, th);
fragment.appendChild(th);
}
this.samples.forEach(function (sample) {
(0, _array.arrayEach)(sample.strings, function (string) {
var column = string.col;
var th = rootDocument.createElement('th');
_this3.hot.view.appendColHeader(column, th);
fragment.appendChild(th);
});
});
return fragment;
}
/**
* Create table column elements.
*
* @param {Number} column Column index.
* @returns {DocumentFragment} Returns created column table column elements.
*/
}, {
key: "createCol",
value: function createCol(column) {
var _this4 = this;
var rootDocument = this.hot.rootDocument;
var fragment = rootDocument.createDocumentFragment();
this.samples.forEach(function (sample) {
(0, _array.arrayEach)(sample.strings, function (string) {
var row = string.row;
var cellProperties = _this4.hot.getCellMeta(row, column);
cellProperties.col = column;
cellProperties.row = row;
var renderer = _this4.hot.getCellRenderer(cellProperties);
var td = rootDocument.createElement('td');
var tr = rootDocument.createElement('tr'); // Indicate that this element is created and supported by GhostTable. It can be useful to
// exclude rendering performance costly logic or exclude logic which doesn't work within a hidden table.
td.setAttribute('ghost-table', 1);
renderer(_this4.hot, td, row, column, _this4.hot.colToProp(column), string.value, cellProperties);
tr.appendChild(td);
fragment.appendChild(tr);
});
});
return fragment;
}
/**
* Remove table from document and reset internal state.
*/
}, {
key: "clean",
value: function clean() {
this.rows.length = 0;
this.rows[-1] = void 0;
this.columns.length = 0;
if (this.samples) {
this.samples.clear();
}
this.samples = null;
this.removeTable();
}
/**
* Inject generated table into document.
*
* @param {HTMLElement} [parent=null]
*/
}, {
key: "injectTable",
value: function injectTable() {
var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (!this.injected) {
(parent || this.hot.rootElement).appendChild(this.container.fragment);
this.injected = true;
}
}
/**
* Remove table from document.
*/
}, {
key: "removeTable",
value: function removeTable() {
if (this.injected && this.container.container.parentNode) {
this.container.container.parentNode.removeChild(this.container.container);
this.container = null;
this.injected = false;
}
}
/**
* Create col element.
*
* @param {Number} column Column index.
* @returns {HTMLElement}
*/
}, {
key: "createColElement",
value: function createColElement(column) {
var col = this.hot.rootDocument.createElement('col');
col.style.width = "".concat(this.hot.view.wt.wtTable.getStretchedColumnWidth(column), "px");
return col;
}
/**
* Create table element.
*
* @param {String} className
* @returns {Object}
*/
}, {
key: "createTable",
value: function createTable() {
var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var rootDocument = this.hot.rootDocument;
var fragment = rootDocument.createDocumentFragment();
var table = rootDocument.createElement('table');
var tHead = rootDocument.createElement('thead');
var tBody = rootDocument.createElement('tbody');
var colGroup = rootDocument.createElement('colgroup');
var tr = rootDocument.createElement('tr');
var th = rootDocument.createElement('th');
if (this.isVertical()) {
table.appendChild(colGroup);
}
if (this.isHorizontal()) {
tr.appendChild(th);
tHead.appendChild(tr);
table.style.tableLayout = 'auto';
table.style.width = 'auto';
}
table.appendChild(tHead);
if (this.isVertical()) {
tBody.appendChild(tr);
}
table.appendChild(tBody);
(0, _element.addClass)(table, className);
fragment.appendChild(table);
return {
fragment: fragment,
table: table,
tHead: tHead,
tBody: tBody,
colGroup: colGroup,
tr: tr,
th: th
};
}
/**
* Create container for tables.
*
* @param {String} className
* @returns {Object}
*/
}, {
key: "createContainer",
value: function createContainer() {
var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var rootDocument = this.hot.rootDocument;
var fragment = rootDocument.createDocumentFragment();
var container = rootDocument.createElement('div');
var containerClassName = "htGhostTable htAutoSize ".concat(className.trim());
(0, _element.addClass)(container, containerClassName);
fragment.appendChild(container);
return {
fragment: fragment,
container: container
};
}
/**
* Checks if table is raised vertically (checking rows).
*
* @returns {Boolean}
*/
}, {
key: "isVertical",
value: function isVertical() {
return !!(this.rows.length && !this.columns.length);
}
/**
* Checks if table is raised horizontally (checking columns).
*
* @returns {Boolean}
*/
}, {
key: "isHorizontal",
value: function isHorizontal() {
return !!(this.columns.length && !this.rows.length);
}
}]);
return GhostTable;
}();
var _default = GhostTable;
exports.default = _default;
/***/ }),
/* 176 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(55);
__webpack_require__(25);
__webpack_require__(13);
__webpack_require__(14);
__webpack_require__(139);
__webpack_require__(81);
__webpack_require__(82);
__webpack_require__(9);
__webpack_require__(83);
__webpack_require__(12);
__webpack_require__(16);
exports.__esModule = true;
exports.areValidSortStates = areValidSortStates;
exports.getNextSortOrder = getNextSortOrder;
exports.getHeaderSpanElement = getHeaderSpanElement;
exports.isFirstLevelColumnHeader = isFirstLevelColumnHeader;
exports.wasHeaderClickedProperly = wasHeaderClickedProperly;
exports.HEADER_SPAN_CLASS = exports.DESC_SORT_STATE = exports.ASC_SORT_STATE = void 0;
var _mixed = __webpack_require__(27);
var _object = __webpack_require__(4);
var _event = __webpack_require__(31);
var ASC_SORT_STATE = 'asc';
exports.ASC_SORT_STATE = ASC_SORT_STATE;
var DESC_SORT_STATE = 'desc';
exports.DESC_SORT_STATE = DESC_SORT_STATE;
var HEADER_SPAN_CLASS = 'colHeader';
/**
* Get if column state is valid.
*
* @param {Number} columnState Particular column state.
* @returns {Boolean}
*/
exports.HEADER_SPAN_CLASS = HEADER_SPAN_CLASS;
function isValidColumnState(columnState) {
if ((0, _mixed.isUndefined)(columnState)) {
return false;
}
var column = columnState.column,
sortOrder = columnState.sortOrder;
return Number.isInteger(column) && [ASC_SORT_STATE, DESC_SORT_STATE].includes(sortOrder);
}
/**
* Get if all sorted columns states are valid.
*
* @param {Array} sortStates
* @returns {Boolean}
*/
function areValidSortStates(sortStates) {
if (Array.isArray(sortStates) === false || sortStates.every(function (columnState) {
return (0, _object.isObject)(columnState);
}) === false) {
return false;
}
var sortedColumns = sortStates.map(function (_ref) {
var column = _ref.column;
return column;
});
var indexOccursOnlyOnce = new Set(sortedColumns).size === sortedColumns.length;
return indexOccursOnlyOnce && sortStates.every(isValidColumnState);
}
/**
* Get next sort order for particular column. The order sequence looks as follows: 'asc' -> 'desc' -> undefined -> 'asc'
*
* @param {String|undefined} sortOrder sort order (`asc` for ascending, `desc` for descending and undefined for not sorted).
* @returns {String|undefined} Next sort order (`asc` for ascending, `desc` for descending and undefined for not sorted).
*/
function getNextSortOrder(sortOrder) {
if (sortOrder === DESC_SORT_STATE) {
return;
} else if (sortOrder === ASC_SORT_STATE) {
return DESC_SORT_STATE;
}
return ASC_SORT_STATE;
}
/**
* Get `span` DOM element inside `th` DOM element.
*
* @param {Element} TH th HTML element.
* @returns {Element | null}
*/
function getHeaderSpanElement(TH) {
var headerSpanElement = TH.querySelector(".".concat(HEADER_SPAN_CLASS));
return headerSpanElement;
}
/**
*
* Get if handled header is first level column header.
*
* @param {Number} column Visual column index.
* @param {Element} TH th HTML element.
* @returns {Boolean}
*/
function isFirstLevelColumnHeader(column, TH) {
if (column < 0 || !TH.parentNode) {
return false;
}
var TRs = TH.parentNode.parentNode.childNodes;
var headerLevel = Array.from(TRs).indexOf(TH.parentNode) - TRs.length;
if (headerLevel !== -1) {
return false;
}
return true;
}
/**
* Get if header was clicked properly. Click on column header and NOT done by right click return `true`.
*
* @param {Number} row Visual row index.
* @param {Number} column Visual column index.
* @param {Event} clickEvent Click event.
* @returns {Boolean}
*/
function wasHeaderClickedProperly(row, column, clickEvent) {
return row === -1 && column >= 0 && (0, _event.isRightClick)(clickEvent) === false;
}
/***/ }),
/* 177 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = separatorItem;
exports.KEY = void 0;
var KEY = '---------';
exports.KEY = KEY;
function separatorItem() {
return {
name: KEY
};
}
/***/ }),
/* 178 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(17);
__webpack_require__(58);
__webpack_require__(65);
__webpack_require__(9);
__webpack_require__(134);
__webpack_require__(39);
__webpack_require__(40);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _core = _interopRequireDefault(__webpack_require__(170));
var _element = __webpack_require__(8);
var _array = __webpack_require__(3);
var _cursor = _interopRequireDefault(__webpack_require__(543));
var _eventManager = _interopRequireDefault(__webpack_require__(24));
var _object = __webpack_require__(4);
var _mixed = __webpack_require__(27);
var _function = __webpack_require__(63);
var _utils = __webpack_require__(66);
var _unicode = __webpack_require__(57);
var _localHooks = _interopRequireDefault(__webpack_require__(48));
var _predefinedItems = __webpack_require__(84);
var _event = __webpack_require__(31);
var MIN_WIDTH = 215;
/**
* @class Menu
* @plugin ContextMenu
*/
var Menu =
/*#__PURE__*/
function () {
function Menu(hotInstance, options) {
(0, _classCallCheck2.default)(this, Menu);
this.hot = hotInstance;
this.options = options || {
parent: null,
name: null,
className: '',
keepInViewport: true,
standalone: false,
minWidth: MIN_WIDTH
};
this.eventManager = new _eventManager.default(this);
this.container = this.createContainer(this.options.name);
this.hotMenu = null;
this.hotSubMenus = {};
this.parentMenu = this.options.parent || null;
this.menuItems = null;
this.origOutsideClickDeselects = null;
this.keyEvent = false;
this.offset = {
above: 0,
below: 0,
left: 0,
right: 0
};
this._afterScrollCallback = null;
this.registerEvents();
}
/**
* Register event listeners.
*
* @private
*/
(0, _createClass2.default)(Menu, [{
key: "registerEvents",
value: function registerEvents() {
var _this = this;
this.eventManager.addEventListener(this.hot.rootDocument.documentElement, 'mousedown', function (event) {
return _this.onDocumentMouseDown(event);
});
}
/**
* Set array of objects which defines menu items.
*
* @param {Array} menuItems Menu items to display.
*/
}, {
key: "setMenuItems",
value: function setMenuItems(menuItems) {
this.menuItems = menuItems;
}
/**
* Set offset menu position for specified area (`above`, `below`, `left` or `right`).
*
* @param {String} area Specified area name (`above`, `below`, `left` or `right`).
* @param {Number} offset Offset value.
*/
}, {
key: "setOffset",
value: function setOffset(area) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
this.offset[area] = offset;
}
/**
* Check if menu is using as sub-menu.
*
* @returns {Boolean}
*/
}, {
key: "isSubMenu",
value: function isSubMenu() {
return this.parentMenu !== null;
}
/**
* Open menu.
*
* @fires Hooks#beforeContextMenuShow
* @fires Hooks#afterContextMenuShow
*/
}, {
key: "open",
value: function open() {
var _this2 = this;
this.runLocalHooks('beforeOpen');
this.container.removeAttribute('style');
this.container.style.display = 'block';
var delayedOpenSubMenu = (0, _function.debounce)(function (row) {
return _this2.openSubMenu(row);
}, 300);
var minWidthOfMenu = this.options.minWidth || MIN_WIDTH;
var noItemsDefined = false;
var filteredItems = (0, _array.arrayFilter)(this.menuItems, function (item) {
if (item.key === _predefinedItems.NO_ITEMS) {
noItemsDefined = true;
}
return (0, _utils.isItemHidden)(item, _this2.hot);
});
if (filteredItems.length < 1 && !noItemsDefined) {
filteredItems.push((0, _predefinedItems.predefinedItems)()[_predefinedItems.NO_ITEMS]);
} else if (filteredItems.length === 0) {
return;
}
filteredItems = (0, _utils.filterSeparators)(filteredItems, _predefinedItems.SEPARATOR);
var settings = {
data: filteredItems,
colHeaders: false,
autoColumnSize: true,
modifyColWidth: function modifyColWidth(width) {
if ((0, _mixed.isDefined)(width) && width < minWidthOfMenu) {
return minWidthOfMenu;
}
return width;
},
autoRowSize: false,
readOnly: true,
copyPaste: false,
columns: [{
data: 'name',
renderer: function renderer(hot, TD, row, col, prop, value) {
return _this2.menuItemRenderer(hot, TD, row, col, prop, value);
}
}],
renderAllRows: true,
fragmentSelection: 'cell',
disableVisualSelection: 'area',
beforeKeyDown: function beforeKeyDown(event) {
return _this2.onBeforeKeyDown(event);
},
afterOnCellMouseOver: function afterOnCellMouseOver(event, coords) {
if (_this2.isAllSubMenusClosed()) {
delayedOpenSubMenu(coords.row);
} else {
_this2.openSubMenu(coords.row);
}
},
rowHeights: function rowHeights(row) {
return filteredItems[row].name === _predefinedItems.SEPARATOR ? 1 : 23;
}
};
this.origOutsideClickDeselects = this.hot.getSettings().outsideClickDeselects;
this.hot.getSettings().outsideClickDeselects = false;
this.hotMenu = new _core.default(this.container, settings);
this.hotMenu.addHook('afterInit', function () {
return _this2.onAfterInit();
});
this.hotMenu.addHook('afterSelection', function () {
return _this2.onAfterSelection.apply(_this2, arguments);
});
this.hotMenu.init();
this.hotMenu.listen();
this.blockMainTableCallbacks();
this.runLocalHooks('afterOpen');
}
/**
* Close menu.
*
* @param {Boolean} [closeParent=false] if `true` try to close parent menu if exists.
*/
}, {
key: "close",
value: function close() {
var closeParent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (!this.isOpened()) {
return;
}
if (closeParent && this.parentMenu) {
this.parentMenu.close();
} else {
this.closeAllSubMenus();
this.container.style.display = 'none';
this.releaseMainTableCallbacks();
this.hotMenu.destroy();
this.hotMenu = null;
this.hot.getSettings().outsideClickDeselects = this.origOutsideClickDeselects;
this.runLocalHooks('afterClose');
if (this.parentMenu) {
this.parentMenu.hotMenu.listen();
}
}
}
/**
* Open sub menu at the provided row index.
*
* @param {Number} row Row index.
* @returns {Menu|Boolean} Returns created menu or `false` if no one menu was created.
*/
}, {
key: "openSubMenu",
value: function openSubMenu(row) {
if (!this.hotMenu) {
return false;
}
var cell = this.hotMenu.getCell(row, 0);
this.closeAllSubMenus();
if (!cell || !(0, _utils.hasSubMenu)(cell)) {
return false;
}
var dataItem = this.hotMenu.getSourceDataAtRow(row);
var subMenu = new Menu(this.hot, {
parent: this,
name: dataItem.name,
className: this.options.className,
keepInViewport: true
});
subMenu.setMenuItems(dataItem.submenu.items);
subMenu.open();
subMenu.setPosition(cell.getBoundingClientRect());
this.hotSubMenus[dataItem.key] = subMenu;
return subMenu;
}
/**
* Close sub menu at row index.
*
* @param {Number} row Row index.
*/
}, {
key: "closeSubMenu",
value: function closeSubMenu(row) {
var dataItem = this.hotMenu.getSourceDataAtRow(row);
var menus = this.hotSubMenus[dataItem.key];
if (menus) {
menus.destroy();
delete this.hotSubMenus[dataItem.key];
}
}
/**
* Close all opened sub menus.
*/
}, {
key: "closeAllSubMenus",
value: function closeAllSubMenus() {
var _this3 = this;
(0, _array.arrayEach)(this.hotMenu.getData(), function (value, row) {
return _this3.closeSubMenu(row);
});
}
/**
* Checks if all created and opened sub menus are closed.
*
* @returns {Boolean}
*/
}, {
key: "isAllSubMenusClosed",
value: function isAllSubMenusClosed() {
return Object.keys(this.hotSubMenus).length === 0;
}
/**
* Destroy instance.
*/
}, {
key: "destroy",
value: function destroy() {
var menuContainerParentElement = this.container.parentNode;
this.clearLocalHooks();
this.close();
this.parentMenu = null;
this.eventManager.destroy();
if (menuContainerParentElement) {
menuContainerParentElement.removeChild(this.container);
}
}
/**
* Checks if menu was opened.
*
* @returns {Boolean} Returns `true` if menu was opened.
*/
}, {
key: "isOpened",
value: function isOpened() {
return this.hotMenu !== null;
}
/**
* Execute menu command.
*
* @param {Event} [event]
*/
}, {
key: "executeCommand",
value: function executeCommand(event) {
if (!this.isOpened() || !this.hotMenu.getSelectedLast()) {
return;
}
var selectedItem = this.hotMenu.getSourceDataAtRow(this.hotMenu.getSelectedLast()[0]);
this.runLocalHooks('select', selectedItem, event);
if (selectedItem.isCommand === false || selectedItem.name === _predefinedItems.SEPARATOR) {
return;
}
var selRanges = this.hot.getSelectedRange();
var normalizedSelection = selRanges ? (0, _utils.normalizeSelection)(selRanges) : [];
var autoClose = true; // Don't close context menu if item is disabled or it has submenu
if (selectedItem.disabled === true || typeof selectedItem.disabled === 'function' && selectedItem.disabled.call(this.hot) === true || selectedItem.submenu) {
autoClose = false;
}
this.runLocalHooks('executeCommand', selectedItem.key, normalizedSelection, event);
if (this.isSubMenu()) {
this.parentMenu.runLocalHooks('executeCommand', selectedItem.key, normalizedSelection, event);
}
if (autoClose) {
this.close(true);
}
}
/**
* Set menu position based on dom event or based on literal object.
*
* @param {Event|Object} coords Event or literal Object with coordinates.
*/
}, {
key: "setPosition",
value: function setPosition(coords) {
var cursor = new _cursor.default(coords, this.hot.rootWindow);
if (this.options.keepInViewport) {
if (cursor.fitsBelow(this.container)) {
this.setPositionBelowCursor(cursor);
} else if (cursor.fitsAbove(this.container)) {
this.setPositionAboveCursor(cursor);
} else {
this.setPositionBelowCursor(cursor);
}
if (cursor.fitsOnRight(this.container)) {
this.setPositionOnRightOfCursor(cursor);
} else {
this.setPositionOnLeftOfCursor(cursor);
}
} else {
this.setPositionBelowCursor(cursor);
this.setPositionOnRightOfCursor(cursor);
}
}
/**
* Set menu position above cursor object.
*
* @param {Cursor} cursor `Cursor` object.
*/
}, {
key: "setPositionAboveCursor",
value: function setPositionAboveCursor(cursor) {
var top = this.offset.above + cursor.top - this.container.offsetHeight;
if (this.isSubMenu()) {
top = cursor.top + cursor.cellHeight - this.container.offsetHeight + 3;
}
this.container.style.top = "".concat(top, "px");
}
/**
* Set menu position below cursor object.
*
* @param {Cursor} cursor `Cursor` object.
*/
}, {
key: "setPositionBelowCursor",
value: function setPositionBelowCursor(cursor) {
var top = this.offset.below + cursor.top;
if (this.isSubMenu()) {
top = cursor.top - 1;
}
this.container.style.top = "".concat(top, "px");
}
/**
* Set menu position on the right of cursor object.
*
* @param {Cursor} cursor `Cursor` object.
*/
}, {
key: "setPositionOnRightOfCursor",
value: function setPositionOnRightOfCursor(cursor) {
var left;
if (this.isSubMenu()) {
left = 1 + cursor.left + cursor.cellWidth;
} else {
left = this.offset.right + 1 + cursor.left;
}
this.container.style.left = "".concat(left, "px");
}
/**
* Set menu position on the left of cursor object.
*
* @param {Cursor} cursor `Cursor` object.
*/
}, {
key: "setPositionOnLeftOfCursor",
value: function setPositionOnLeftOfCursor(cursor) {
var left = this.offset.left + cursor.left - this.container.offsetWidth + (0, _element.getScrollbarWidth)(this.hot.rootDocument) + 4;
this.container.style.left = "".concat(left, "px");
}
/**
* Select first cell in opened menu.
*/
}, {
key: "selectFirstCell",
value: function selectFirstCell() {
var cell = this.hotMenu.getCell(0, 0);
if ((0, _utils.isSeparator)(cell) || (0, _utils.isDisabled)(cell) || (0, _utils.isSelectionDisabled)(cell)) {
this.selectNextCell(0, 0);
} else {
this.hotMenu.selectCell(0, 0);
}
}
/**
* Select last cell in opened menu.
*/
}, {
key: "selectLastCell",
value: function selectLastCell() {
var lastRow = this.hotMenu.countRows() - 1;
var cell = this.hotMenu.getCell(lastRow, 0);
if ((0, _utils.isSeparator)(cell) || (0, _utils.isDisabled)(cell) || (0, _utils.isSelectionDisabled)(cell)) {
this.selectPrevCell(lastRow, 0);
} else {
this.hotMenu.selectCell(lastRow, 0);
}
}
/**
* Select next cell in opened menu.
*
* @param {Number} row Row index.
* @param {Number} col Column index.
*/
}, {
key: "selectNextCell",
value: function selectNextCell(row, col) {
var nextRow = row + 1;
var cell = nextRow < this.hotMenu.countRows() ? this.hotMenu.getCell(nextRow, col) : null;
if (!cell) {
return;
}
if ((0, _utils.isSeparator)(cell) || (0, _utils.isDisabled)(cell) || (0, _utils.isSelectionDisabled)(cell)) {
this.selectNextCell(nextRow, col);
} else {
this.hotMenu.selectCell(nextRow, col);
}
}
/**
* Select previous cell in opened menu.
*
* @param {Number} row Row index.
* @param {Number} col Column index.
*/
}, {
key: "selectPrevCell",
value: function selectPrevCell(row, col) {
var prevRow = row - 1;
var cell = prevRow >= 0 ? this.hotMenu.getCell(prevRow, col) : null;
if (!cell) {
return;
}
if ((0, _utils.isSeparator)(cell) || (0, _utils.isDisabled)(cell) || (0, _utils.isSelectionDisabled)(cell)) {
this.selectPrevCell(prevRow, col);
} else {
this.hotMenu.selectCell(prevRow, col);
}
}
/**
* Menu item renderer.
*
* @private
*/
}, {
key: "menuItemRenderer",
value: function menuItemRenderer(hot, TD, row, col, prop, value) {
var _this4 = this;
var item = hot.getSourceDataAtRow(row);
var wrapper = this.hot.rootDocument.createElement('div');
var isSubMenu = function isSubMenu(itemToTest) {
return (0, _object.hasOwnProperty)(itemToTest, 'submenu');
};
var itemIsSeparator = function itemIsSeparator(itemToTest) {
return new RegExp(_predefinedItems.SEPARATOR, 'i').test(itemToTest.name);
};
var itemIsDisabled = function itemIsDisabled(itemToTest) {
return itemToTest.disabled === true || typeof itemToTest.disabled === 'function' && itemToTest.disabled.call(_this4.hot) === true;
};
var itemIsSelectionDisabled = function itemIsSelectionDisabled(itemToTest) {
return itemToTest.disableSelection;
};
var itemValue = value;
if (typeof itemValue === 'function') {
itemValue = itemValue.call(this.hot);
}
(0, _element.empty)(TD);
(0, _element.addClass)(wrapper, 'htItemWrapper');
TD.appendChild(wrapper);
if (itemIsSeparator(item)) {
(0, _element.addClass)(TD, 'htSeparator');
} else if (typeof item.renderer === 'function') {
(0, _element.addClass)(TD, 'htCustomMenuRenderer');
TD.appendChild(item.renderer(hot, wrapper, row, col, prop, itemValue));
} else {
(0, _element.fastInnerHTML)(wrapper, itemValue);
}
if (itemIsDisabled(item)) {
(0, _element.addClass)(TD, 'htDisabled');
this.eventManager.addEventListener(TD, 'mouseenter', function () {
return hot.deselectCell();
});
} else if (itemIsSelectionDisabled(item)) {
(0, _element.addClass)(TD, 'htSelectionDisabled');
this.eventManager.addEventListener(TD, 'mouseenter', function () {
return hot.deselectCell();
});
} else if (isSubMenu(item)) {
(0, _element.addClass)(TD, 'htSubmenu');
if (itemIsSelectionDisabled(item)) {
this.eventManager.addEventListener(TD, 'mouseenter', function () {
return hot.deselectCell();
});
} else {
this.eventManager.addEventListener(TD, 'mouseenter', function () {
return hot.selectCell(row, col, void 0, void 0, false, false);
});
}
} else {
(0, _element.removeClass)(TD, 'htSubmenu');
(0, _element.removeClass)(TD, 'htDisabled');
if (itemIsSelectionDisabled(item)) {
this.eventManager.addEventListener(TD, 'mouseenter', function () {
return hot.deselectCell();
});
} else {
this.eventManager.addEventListener(TD, 'mouseenter', function () {
return hot.selectCell(row, col, void 0, void 0, false, false);
});
}
}
}
/**
* Create container/wrapper for handsontable.
*
* @private
* @param {String} [name] Class name.
* @returns {HTMLElement}
*/
}, {
key: "createContainer",
value: function createContainer() {
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var rootDocument = this.hot.rootDocument;
var className = name;
var container;
if (className) {
if ((0, _function.isFunction)(className)) {
className = className.call(this.hot);
if (className === null || (0, _mixed.isUndefined)(className)) {
className = '';
} else {
className = className.toString();
}
}
className = className.replace(/[^A-z0-9]/g, '_');
className = "".concat(this.options.className, "Sub_").concat(className);
container = rootDocument.querySelector(".".concat(this.options.className, ".").concat(className));
}
if (!container) {
container = rootDocument.createElement('div');
(0, _element.addClass)(container, "htMenu ".concat(this.options.className));
if (className) {
(0, _element.addClass)(container, className);
}
rootDocument.getElementsByTagName('body')[0].appendChild(container);
}
return container;
}
/**
* @private
*/
}, {
key: "blockMainTableCallbacks",
value: function blockMainTableCallbacks() {
this._afterScrollCallback = function () {};
this.hot.addHook('afterScrollVertically', this._afterScrollCallback);
this.hot.addHook('afterScrollHorizontally', this._afterScrollCallback);
}
/**
* @private
*/
}, {
key: "releaseMainTableCallbacks",
value: function releaseMainTableCallbacks() {
if (this._afterScrollCallback) {
this.hot.removeHook('afterScrollVertically', this._afterScrollCallback);
this.hot.removeHook('afterScrollHorizontally', this._afterScrollCallback);
this._afterScrollCallback = null;
}
}
/**
* On before key down listener.
*
* @private
* @param {Event} event
*/
}, {
key: "onBeforeKeyDown",
value: function onBeforeKeyDown(event) {
var selection = this.hotMenu.getSelectedLast();
var stopEvent = false;
this.keyEvent = true;
switch (event.keyCode) {
case _unicode.KEY_CODES.ESCAPE:
this.close();
stopEvent = true;
break;
case _unicode.KEY_CODES.ENTER:
if (selection) {
if (this.hotMenu.getSourceDataAtRow(selection[0]).submenu) {
stopEvent = true;
} else {
this.executeCommand(event);
this.close(true);
}
}
break;
case _unicode.KEY_CODES.ARROW_DOWN:
if (selection) {
this.selectNextCell(selection[0], selection[1]);
} else {
this.selectFirstCell();
}
stopEvent = true;
break;
case _unicode.KEY_CODES.ARROW_UP:
if (selection) {
this.selectPrevCell(selection[0], selection[1]);
} else {
this.selectLastCell();
}
stopEvent = true;
break;
case _unicode.KEY_CODES.ARROW_RIGHT:
if (selection) {
var menu = this.openSubMenu(selection[0]);
if (menu) {
menu.selectFirstCell();
}
}
stopEvent = true;
break;
case _unicode.KEY_CODES.ARROW_LEFT:
if (selection && this.isSubMenu()) {
this.close();
if (this.parentMenu) {
this.parentMenu.hotMenu.listen();
}
stopEvent = true;
}
break;
default:
break;
}
if (stopEvent) {
event.preventDefault();
(0, _event.stopImmediatePropagation)(event);
}
this.keyEvent = false;
}
/**
* On after init listener.
*
* @private
*/
}, {
key: "onAfterInit",
value: function onAfterInit() {
var wtTable = this.hotMenu.view.wt.wtTable;
var data = this.hotMenu.getSettings().data;
var hiderStyle = wtTable.hider.style;
var holderStyle = wtTable.holder.style;
var currentHiderWidth = parseInt(hiderStyle.width, 10);
var realHeight = (0, _array.arrayReduce)(data, function (accumulator, value) {
return accumulator + (value.name === _predefinedItems.SEPARATOR ? 1 : 26);
}, 0);
holderStyle.width = "".concat(currentHiderWidth + 22, "px");
holderStyle.height = "".concat(realHeight + 4, "px");
hiderStyle.height = holderStyle.height;
}
/**
* On after selection listener.
*
* @param {Number} r Selection start row index.
* @param {Number} c Selection start column index.
* @param {Number} r2 Selection end row index.
* @param {Number} c2 Selection end column index.
* @param {Object} preventScrolling Object with `value` property where its value change will be observed.
* @param {Number} selectionLayerLevel The number which indicates what selection layer is currently modified.
*/
}, {
key: "onAfterSelection",
value: function onAfterSelection(r, c, r2, c2, preventScrolling) {
if (this.keyEvent === false) {
preventScrolling.value = true;
}
}
/**
* Document mouse down listener.
*
* @private
* @param {Event} event
*/
}, {
key: "onDocumentMouseDown",
value: function onDocumentMouseDown(event) {
if (!this.isOpened()) {
return;
}
if (this.container && (0, _element.isChildOf)(event.target, this.container)) {
this.executeCommand(event);
} // Close menu when clicked element is not belongs to menu itself
if (this.options.standalone && this.hotMenu && !(0, _element.isChildOf)(event.target, this.hotMenu.rootElement)) {
this.close(true); // Automatically close menu when clicked element is not belongs to menu or submenu (not necessarily to itself)
} else if ((this.isAllSubMenusClosed() || this.isSubMenu()) && !(0, _element.isChildOf)(event.target, '.htMenu') && (0, _element.isChildOf)(event.target, this.hot.rootDocument)) {
this.close(true);
}
}
}]);
return Menu;
}();
(0, _object.mixin)(Menu, _localHooks.default);
var _default = Menu;
exports.default = _default;
/***/ }),
/* 179 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(71));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _index = __webpack_require__(26);
var _templateLiteralTag = __webpack_require__(72);
function _templateObject4() {
var data = (0, _taggedTemplateLiteral2.default)(["The merged cell declared at [", ", ", "] has \"rowspan\" or \"colspan\" declared as \n \"0\", which is not supported. It cannot be added to the collection."]);
_templateObject4 = function _templateObject4() {
return data;
};
return data;
}
function _templateObject3() {
var data = (0, _taggedTemplateLiteral2.default)(["The merged cell declared at [", ", ", "] has both \"rowspan\" \n and \"colspan\" declared as \"1\", which makes it a single cell. It cannot be added to the collection."]);
_templateObject3 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2() {
var data = (0, _taggedTemplateLiteral2.default)(["The merged cell declared at [", ", ", "] is positioned (or positioned partially) \n outside of the table range. It was not added to the table, please fix your setup."]);
_templateObject2 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject() {
var data = (0, _taggedTemplateLiteral2.default)(["The merged cell declared with {row: ", ", col: ", ", rowspan: \n ", ", colspan: ", "} contains negative values, which is not supported. It \n will not be added to the collection."]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
/**
* The `MergedCellCoords` class represents a single merged cell.
*
* @class MergedCellCoords
* @plugin MergeCells
*/
var MergedCellCoords =
/*#__PURE__*/
function () {
function MergedCellCoords(row, column, rowspan, colspan) {
(0, _classCallCheck2.default)(this, MergedCellCoords);
/**
* The index of the topmost merged cell row.
*
* @type {Number}
*/
this.row = row;
/**
* The index of the leftmost column.
*
* @type {Number}
*/
this.col = column;
/**
* The `rowspan` value of the merged cell.
*
* @type {Number}
*/
this.rowspan = rowspan;
/**
* The `colspan` value of the merged cell.
*
* @type {Number}
*/
this.colspan = colspan;
/**
* `true` only if the merged cell is bound to be removed.
*
* @type {Boolean}
*/
this.removed = false;
}
/**
* Get a warning message for when the declared merged cell data contains negative values.
*
* @param {Object} newMergedCell Object containg information about the merged cells that was about to be added.
* @return {String}
*/
(0, _createClass2.default)(MergedCellCoords, [{
key: "normalize",
/**
* Sanitize (prevent from going outside the boundaries) the merged cell.
*
* @param hotInstance
*/
value: function normalize(hotInstance) {
var totalRows = hotInstance.countRows();
var totalColumns = hotInstance.countCols();
if (this.row < 0) {
this.row = 0;
} else if (this.row > totalRows - 1) {
this.row = totalRows - 1;
}
if (this.col < 0) {
this.col = 0;
} else if (this.col > totalColumns - 1) {
this.col = totalColumns - 1;
}
if (this.row + this.rowspan > totalRows - 1) {
this.rowspan = totalRows - this.row;
}
if (this.col + this.colspan > totalColumns - 1) {
this.colspan = totalColumns - this.col;
}
}
/**
* Returns `true` if the provided coordinates are inside the merged cell.
*
* @param {Number} row The row index.
* @param {Number} column The column index.
* @return {Boolean}
*/
}, {
key: "includes",
value: function includes(row, column) {
return this.row <= row && this.col <= column && this.row + this.rowspan - 1 >= row && this.col + this.colspan - 1 >= column;
}
/**
* Returns `true` if the provided `column` property is within the column span of the merged cell.
*
* @param {Number} column The column index.
* @return {Boolean}
*/
}, {
key: "includesHorizontally",
value: function includesHorizontally(column) {
return this.col <= column && this.col + this.colspan - 1 >= column;
}
/**
* Returns `true` if the provided `row` property is within the row span of the merged cell.
*
* @param {Number} row Row index.
* @return {Boolean}
*/
}, {
key: "includesVertically",
value: function includesVertically(row) {
return this.row <= row && this.row + this.rowspan - 1 >= row;
}
/**
* Shift (and possibly resize, if needed) the merged cell.
*
* @param {Array} shiftVector 2-element array containing the information on the shifting in the `x` and `y` axis.
* @param {Number} indexOfChange Index of the preceding change.
* @returns {Boolean} Returns `false` if the whole merged cell was removed.
*/
}, {
key: "shift",
value: function shift(shiftVector, indexOfChange) {
var shiftValue = shiftVector[0] || shiftVector[1];
var shiftedIndex = indexOfChange + Math.abs(shiftVector[0] || shiftVector[1]) - 1;
var span = shiftVector[0] ? 'colspan' : 'rowspan';
var index = shiftVector[0] ? 'col' : 'row';
var changeStart = Math.min(indexOfChange, shiftedIndex);
var changeEnd = Math.max(indexOfChange, shiftedIndex);
var mergeStart = this[index];
var mergeEnd = this[index] + this[span] - 1;
if (mergeStart >= indexOfChange) {
this[index] += shiftValue;
} // adding rows/columns
if (shiftValue > 0) {
if (indexOfChange <= mergeEnd && indexOfChange > mergeStart) {
this[span] += shiftValue;
} // removing rows/columns
} else if (shiftValue < 0) {
// removing the whole merge
if (changeStart <= mergeStart && changeEnd >= mergeEnd) {
this.removed = true;
return false; // removing the merge partially, including the beginning
} else if (mergeStart >= changeStart && mergeStart <= changeEnd) {
var removedOffset = changeEnd - mergeStart + 1;
var preRemovedOffset = Math.abs(shiftValue) - removedOffset;
this[index] -= preRemovedOffset + shiftValue;
this[span] -= removedOffset; // removing the middle part of the merge
} else if (mergeStart <= changeStart && mergeEnd >= changeEnd) {
this[span] += shiftValue; // removing the end part of the merge
} else if (mergeStart <= changeStart && mergeEnd >= changeStart && mergeEnd < changeEnd) {
var removedPart = mergeEnd - changeStart + 1;
this[span] -= removedPart;
}
}
return true;
}
/**
* Check if the second provided merged cell is "farther" in the provided direction.
*
* @param {MergedCellCoords} mergedCell The merged cell to check.
* @param {String} direction Drag direction.
* @return {Boolean|null} `true` if the second provided merged cell is "farther".
*/
}, {
key: "isFarther",
value: function isFarther(mergedCell, direction) {
if (!mergedCell) {
return true;
}
if (direction === 'down') {
return mergedCell.row + mergedCell.rowspan - 1 < this.row + this.rowspan - 1;
} else if (direction === 'up') {
return mergedCell.row > this.row;
} else if (direction === 'right') {
return mergedCell.col + mergedCell.colspan - 1 < this.col + this.colspan - 1;
} else if (direction === 'left') {
return mergedCell.col > this.col;
}
return null;
}
/**
* Get the bottom row index of the merged cell.
*
* @returns {Number}
*/
}, {
key: "getLastRow",
value: function getLastRow() {
return this.row + this.rowspan - 1;
}
/**
* Get the rightmost column index of the merged cell.
*
* @returns {Number}
*/
}, {
key: "getLastColumn",
value: function getLastColumn() {
return this.col + this.colspan - 1;
}
/**
* Get the range coordinates of the merged cell.
*
* @return {CellRange}
*/
}, {
key: "getRange",
value: function getRange() {
return new _index.CellRange(new _index.CellCoords(this.row, this.col), new _index.CellCoords(this.row, this.col), new _index.CellCoords(this.getLastRow(), this.getLastColumn()));
}
}], [{
key: "NEGATIVE_VALUES_WARNING",
value: function NEGATIVE_VALUES_WARNING(newMergedCell) {
return (0, _templateLiteralTag.toSingleLine)(_templateObject(), newMergedCell.row, newMergedCell.col, newMergedCell.rowspan, newMergedCell.colspan);
}
/**
* Get a warning message for when the declared merged cell data contains values exceeding the table limits.
*
* @param {Object} newMergedCell Object containg information about the merged cells that was about to be added.
* @return {String}
*/
}, {
key: "IS_OUT_OF_BOUNDS_WARNING",
value: function IS_OUT_OF_BOUNDS_WARNING(newMergedCell) {
return (0, _templateLiteralTag.toSingleLine)(_templateObject2(), newMergedCell.row, newMergedCell.col);
}
/**
* Get a warning message for when the declared merged cell data represents a single cell.
*
* @param {Object} newMergedCell Object containg information about the merged cells that was about to be added.
* @return {String}
*/
}, {
key: "IS_SINGLE_CELL",
value: function IS_SINGLE_CELL(newMergedCell) {
return (0, _templateLiteralTag.toSingleLine)(_templateObject3(), newMergedCell.row, newMergedCell.col);
}
/**
* Get a warning message for when the declared merged cell data contains "colspan" or "rowspan", that equals 0.
*
* @param {Object} newMergedCell Object containg information about the merged cells that was about to be added.
* @return {String}
*/
}, {
key: "ZERO_SPAN_WARNING",
value: function ZERO_SPAN_WARNING(newMergedCell) {
return (0, _templateLiteralTag.toSingleLine)(_templateObject4(), newMergedCell.row, newMergedCell.col);
}
/**
* Check whether the values provided for a merged cell contain any negative values.
*
* @param {Object} mergedCellInfo Object containing the `row`, `col`, `rowspan` and `colspan` properties.
* @return {Boolean}
*/
}, {
key: "containsNegativeValues",
value: function containsNegativeValues(mergedCellInfo) {
return mergedCellInfo.row < 0 || mergedCellInfo.col < 0 || mergedCellInfo.rowspan < 0 || mergedCellInfo.colspan < 0;
}
/**
* Check whether the provided merged cell information object represents a single cell.
*
* @private
* @param {Object} mergedCellInfo An object with `row`, `col`, `rowspan` and `colspan` properties.
* @return {Boolean}
*/
}, {
key: "isSingleCell",
value: function isSingleCell(mergedCellInfo) {
return mergedCellInfo.colspan === 1 && mergedCellInfo.rowspan === 1;
}
/**
* Check whether the provided merged cell information object contains a rowspan or colspan of 0.
*
* @private
* @param {Object} mergedCellInfo An object with `row`, `col`, `rowspan` and `colspan` properties.
* @return {Boolean}
*/
}, {
key: "containsZeroSpan",
value: function containsZeroSpan(mergedCellInfo) {
return mergedCellInfo.colspan === 0 || mergedCellInfo.rowspan === 0;
}
/**
* Check whether the provided merged cell object is to be declared out of bounds of the table.
*
* @param {Object} mergeCell Object containing the `row`, `col`, `rowspan` and `colspan` properties.
* @param {Number} rowCount Number of rows in the table.
* @param {Number} columnCount Number of rows in the table.
* @return {Boolean}
*/
}, {
key: "isOutOfBounds",
value: function isOutOfBounds(mergeCell, rowCount, columnCount) {
return mergeCell.row < 0 || mergeCell.col < 0 || mergeCell.row >= rowCount || mergeCell.row + mergeCell.rowspan - 1 >= rowCount || mergeCell.col >= columnCount || mergeCell.col + mergeCell.colspan - 1 >= columnCount;
}
}]);
return MergedCellCoords;
}();
var _default = MergedCellCoords;
exports.default = _default;
/***/ }),
/* 180 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = getOptionsList;
exports.TYPES = exports.TYPE_DATE = exports.TYPE_TEXT = exports.TYPE_NUMERIC = void 0;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(70));
var _object = __webpack_require__(4);
var _array = __webpack_require__(3);
var _predefinedItems = __webpack_require__(84);
var _conditionRegisterer = __webpack_require__(29);
var _none = __webpack_require__(612);
exports.CONDITION_NONE = _none.CONDITION_NAME;
var _empty = __webpack_require__(391);
exports.CONDITION_EMPTY = _empty.CONDITION_NAME;
var _notEmpty = __webpack_require__(613);
exports.CONDITION_NOT_EMPTY = _notEmpty.CONDITION_NAME;
var _equal = __webpack_require__(392);
exports.CONDITION_EQUAL = _equal.CONDITION_NAME;
var _notEqual = __webpack_require__(614);
exports.CONDITION_NOT_EQUAL = _notEqual.CONDITION_NAME;
var _greaterThan = __webpack_require__(615);
exports.CONDITION_GREATER_THAN = _greaterThan.CONDITION_NAME;
var _greaterThanOrEqual = __webpack_require__(616);
exports.CONDITION_GREATER_THAN_OR_EQUAL = _greaterThanOrEqual.CONDITION_NAME;
var _lessThan = __webpack_require__(617);
exports.CONDITION_LESS_THAN = _lessThan.CONDITION_NAME;
var _lessThanOrEqual = __webpack_require__(618);
exports.CONDITION_LESS_THAN_OR_EQUAL = _lessThanOrEqual.CONDITION_NAME;
var _between = __webpack_require__(393);
exports.CONDITION_BETWEEN = _between.CONDITION_NAME;
var _notBetween = __webpack_require__(619);
exports.CONDITION_NOT_BETWEEN = _notBetween.CONDITION_NAME;
var _beginsWith = __webpack_require__(620);
exports.CONDITION_BEGINS_WITH = _beginsWith.CONDITION_NAME;
var _endsWith = __webpack_require__(621);
exports.CONDITION_ENDS_WITH = _endsWith.CONDITION_NAME;
var _contains = __webpack_require__(396);
exports.CONDITION_CONTAINS = _contains.CONDITION_NAME;
var _notContains = __webpack_require__(623);
exports.CONDITION_NOT_CONTAINS = _notContains.CONDITION_NAME;
var _before = __webpack_require__(395);
exports.CONDITION_DATE_BEFORE = _before.CONDITION_NAME;
var _after = __webpack_require__(394);
exports.CONDITION_DATE_AFTER = _after.CONDITION_NAME;
var _tomorrow = __webpack_require__(624);
exports.CONDITION_TOMORROW = _tomorrow.CONDITION_NAME;
var _today = __webpack_require__(625);
exports.CONDITION_TODAY = _today.CONDITION_NAME;
var _yesterday = __webpack_require__(626);
exports.CONDITION_YESTERDAY = _yesterday.CONDITION_NAME;
var _byValue = __webpack_require__(627);
exports.CONDITION_BY_VALUE = _byValue.CONDITION_NAME;
var _true = __webpack_require__(628);
exports.CONDITION_TRUE = _true.CONDITION_NAME;
var _false = __webpack_require__(629);
exports.CONDITION_FALSE = _false.CONDITION_NAME;
var _conjunction = __webpack_require__(181);
exports.OPERATION_AND = _conjunction.OPERATION_ID;
var _disjunction = __webpack_require__(397);
exports.OPERATION_OR = _disjunction.OPERATION_ID;
var _disjunctionWithExtraCondition = __webpack_require__(398);
exports.OPERATION_OR_THEN_VARIABLE = _disjunctionWithExtraCondition.OPERATION_ID;
var _TYPES;
var TYPE_NUMERIC = 'numeric';
exports.TYPE_NUMERIC = TYPE_NUMERIC;
var TYPE_TEXT = 'text';
exports.TYPE_TEXT = TYPE_TEXT;
var TYPE_DATE = 'date';
/**
* Default types and order for filter conditions.
*
* @type {Object}
*/
exports.TYPE_DATE = TYPE_DATE;
var TYPES = (_TYPES = {}, (0, _defineProperty2.default)(_TYPES, TYPE_NUMERIC, [_none.CONDITION_NAME, _predefinedItems.SEPARATOR, _empty.CONDITION_NAME, _notEmpty.CONDITION_NAME, _predefinedItems.SEPARATOR, _equal.CONDITION_NAME, _notEqual.CONDITION_NAME, _predefinedItems.SEPARATOR, _greaterThan.CONDITION_NAME, _greaterThanOrEqual.CONDITION_NAME, _lessThan.CONDITION_NAME, _lessThanOrEqual.CONDITION_NAME, _between.CONDITION_NAME, _notBetween.CONDITION_NAME]), (0, _defineProperty2.default)(_TYPES, TYPE_TEXT, [_none.CONDITION_NAME, _predefinedItems.SEPARATOR, _empty.CONDITION_NAME, _notEmpty.CONDITION_NAME, _predefinedItems.SEPARATOR, _equal.CONDITION_NAME, _notEqual.CONDITION_NAME, _predefinedItems.SEPARATOR, _beginsWith.CONDITION_NAME, _endsWith.CONDITION_NAME, _predefinedItems.SEPARATOR, _contains.CONDITION_NAME, _notContains.CONDITION_NAME]), (0, _defineProperty2.default)(_TYPES, TYPE_DATE, [_none.CONDITION_NAME, _predefinedItems.SEPARATOR, _empty.CONDITION_NAME, _notEmpty.CONDITION_NAME, _predefinedItems.SEPARATOR, _equal.CONDITION_NAME, _notEqual.CONDITION_NAME, _predefinedItems.SEPARATOR, _before.CONDITION_NAME, _after.CONDITION_NAME, _between.CONDITION_NAME, _predefinedItems.SEPARATOR, _tomorrow.CONDITION_NAME, _today.CONDITION_NAME, _yesterday.CONDITION_NAME]), _TYPES);
/**
* Get options list for conditional filter by data type (e.q: `'text'`, `'numeric'`, `'date'`).
*
* @returns {Object}
*/
exports.TYPES = TYPES;
function getOptionsList(type) {
var items = [];
var typeName = type;
if (!TYPES[typeName]) {
typeName = TYPE_TEXT;
}
(0, _array.arrayEach)(TYPES[typeName], function (typeValue) {
var option;
if (typeValue === _predefinedItems.SEPARATOR) {
option = {
name: _predefinedItems.SEPARATOR
};
} else {
option = (0, _object.clone)((0, _conditionRegisterer.getConditionDescriptor)(typeValue));
}
items.push(option);
});
return items;
}
/***/ }),
/* 181 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(10);
exports.__esModule = true;
exports.operationResult = operationResult;
exports.SHORT_NAME_FOR_COMPONENT = exports.OPERATION_ID = void 0;
var C = _interopRequireWildcard(__webpack_require__(11));
var _logicalOperationRegisterer = __webpack_require__(114);
var OPERATION_ID = 'conjunction';
exports.OPERATION_ID = OPERATION_ID;
var SHORT_NAME_FOR_COMPONENT = C.FILTERS_LABELS_CONJUNCTION; // p AND q AND w AND x AND... === TRUE?
exports.SHORT_NAME_FOR_COMPONENT = SHORT_NAME_FOR_COMPONENT;
function operationResult(conditions, value) {
return conditions.every(function (condition) {
return condition.func(value);
});
}
(0, _logicalOperationRegisterer.registerOperation)(OPERATION_ID, SHORT_NAME_FOR_COMPONENT, operationResult);
/***/ }),
/* 182 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(14);
__webpack_require__(9);
__webpack_require__(12);
__webpack_require__(23);
__webpack_require__(16);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(6));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(30));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(5));
var _get2 = _interopRequireDefault(__webpack_require__(15));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _element = __webpack_require__(8);
var _object = __webpack_require__(4);
var _base = _interopRequireDefault(__webpack_require__(115));
var privatePool = new WeakMap();
/**
* @class InputUI
* @util
*/
var InputUI =
/*#__PURE__*/
function (_BaseUI) {
(0, _inherits2.default)(InputUI, _BaseUI);
(0, _createClass2.default)(InputUI, null, [{
key: "DEFAULTS",
get: function get() {
return (0, _object.clone)({
placeholder: '',
type: 'text',
tagName: 'input'
});
}
}]);
function InputUI(hotInstance, options) {
var _this;
(0, _classCallCheck2.default)(this, InputUI);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(InputUI).call(this, hotInstance, (0, _object.extend)(InputUI.DEFAULTS, options)));
privatePool.set((0, _assertThisInitialized2.default)(_this), {});
_this.registerHooks();
return _this;
}
/**
* Register all necessary hooks.
*/
(0, _createClass2.default)(InputUI, [{
key: "registerHooks",
value: function registerHooks() {
var _this2 = this;
this.addLocalHook('click', function () {
return _this2.onClick();
});
this.addLocalHook('keyup', function (event) {
return _this2.onKeyup(event);
});
}
/**
* Build DOM structure.
*/
}, {
key: "build",
value: function build() {
(0, _get2.default)((0, _getPrototypeOf2.default)(InputUI.prototype), "build", this).call(this);
var priv = privatePool.get(this);
var icon = this.hot.rootDocument.createElement('div');
priv.input = this._element.firstChild;
(0, _element.addClass)(this._element, 'htUIInput');
(0, _element.addClass)(icon, 'htUIInputIcon');
this._element.appendChild(icon);
this.update();
}
/**
* Update element.
*/
}, {
key: "update",
value: function update() {
if (!this.isBuilt()) {
return;
}
var input = privatePool.get(this).input;
input.type = this.options.type;
input.placeholder = this.translateIfPossible(this.options.placeholder);
input.value = this.translateIfPossible(this.options.value);
}
/**
* Focus element.
*/
}, {
key: "focus",
value: function focus() {
if (this.isBuilt()) {
privatePool.get(this).input.focus();
}
}
/**
* OnClick listener.
*/
}, {
key: "onClick",
value: function onClick() {}
/**
* OnKeyup listener.
*
* @param {Event} event
*/
}, {
key: "onKeyup",
value: function onKeyup(event) {
this.options.value = event.target.value;
}
}]);
return InputUI;
}(_base.default);
var _default = InputUI;
exports.default = _default;
/***/ }),
/* 183 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(17);
__webpack_require__(58);
__webpack_require__(9);
__webpack_require__(39);
exports.__esModule = true;
exports.getMixedMonthObject = getMixedMonthObject;
exports.getMixedMonthName = getMixedMonthName;
exports.getShorthand = getShorthand;
exports.getStartDate = getStartDate;
exports.getEndDate = getEndDate;
exports.getAdditionalData = getAdditionalData;
exports.setStartDate = setStartDate;
exports.setEndDate = setEndDate;
exports.parseDate = parseDate;
exports.getDateYear = getDateYear;
exports.WEEK_LENGTH = exports.DEC_LENGTH = void 0;
/**
* Day count for December.
*
* @type {Number}
*/
var DEC_LENGTH = 31;
/**
* Day count for a week.
*
* @type {Number}
*/
exports.DEC_LENGTH = DEC_LENGTH;
var WEEK_LENGTH = 7;
/**
* Generate a mixed month object.
*
* @private
* @param {String} monthName The month name.
* @param {Number} index Index for the mixed month.
* @returns {Object} The month object.
*/
exports.WEEK_LENGTH = WEEK_LENGTH;
function getMixedMonthObject(monthName, index) {
return {
name: monthName,
days: WEEK_LENGTH,
daysBeforeFullWeeks: 0,
daysAfterFullWeeks: 0,
fullWeeks: 1,
index: index
};
}
/**
* Generate the name for a mixed month.
*
* @private
* @param {Number} afterMonthIndex Index of the month after the mixed one.
* @param {Array} monthList List of the months.
* @returns {String} Name for the mixed month.
*/
function getMixedMonthName(afterMonthIndex, monthList) {
var mixedMonthName = null;
var afterMonthShorthand = getShorthand(monthList[afterMonthIndex].name);
var beforeMonthShorthand = afterMonthIndex > 0 ? getShorthand(monthList[afterMonthIndex - 1].name) : null;
var firstMonthShorthand = getShorthand(monthList[0].name);
var lastMonthShorthand = getShorthand(monthList[monthList.length - 1].name);
if (afterMonthIndex > 0) {
mixedMonthName = "".concat(beforeMonthShorthand, "/").concat(afterMonthShorthand);
} else if (afterMonthIndex === monthList.length - 1) {
mixedMonthName = "".concat(afterMonthShorthand, "/").concat(firstMonthShorthand);
} else {
mixedMonthName = "".concat(lastMonthShorthand, "/").concat(afterMonthShorthand);
}
return mixedMonthName;
}
/**
* Get the three first letters from the provided month name.
*
* @private
* @param {String} monthName The month name.
* @returns {String} The three-lettered shorthand for the month name.
*/
function getShorthand(monthName) {
var MONTH_SHORT_LEN = 3;
return monthName.substring(0, MONTH_SHORT_LEN);
}
/**
* Get the start date of the provided range bar.
*
* @param {Object} rangeBar The range bar object.
* @returns {Date} The start date.
*/
function getStartDate(rangeBar) {
return parseDate(Array.isArray(rangeBar) ? rangeBar[1] : rangeBar.startDate);
}
/**
* Get the end date of the provided range bar.
*
* @param {Object} rangeBar The range bar object.
* @returns {Date} The end date.
*/
function getEndDate(rangeBar) {
return parseDate(Array.isArray(rangeBar) ? rangeBar[2] : rangeBar.endDate);
}
/**
* Get the additional data object of the provided range bar.
*
* @param {Object} rangeBar The range bar object.
* @returns {Object} The additional data object.
*/
function getAdditionalData(rangeBar) {
return Array.isArray(rangeBar) ? rangeBar[3] : rangeBar.additionalData;
}
/**
* Set the start date of the provided range bar.
*
* @param {Object} rangeBar The range bar object.
* @param {Date} value The new start date value.
*/
function setStartDate(rangeBar, value) {
if (Array.isArray(rangeBar)) {
rangeBar[1] = value;
} else {
rangeBar.startDate = value;
}
}
/**
* Set the end date of the provided range bar.
*
* @param {Object} rangeBar The range bar object.
* @param {Date} value The new end date value.
*/
function setEndDate(rangeBar, value) {
if (Array.isArray(rangeBar)) {
rangeBar[2] = value;
} else {
rangeBar.endDate = value;
}
}
/**
* Parse the provided date and check if it's valid.
*
* @param {String|Date} date Date string or object.
* @returns {Date|null} Parsed Date object or null, if not a valid date string.
*/
function parseDate(date) {
var newDate = date;
if (newDate === null) {
return null;
}
if (!(newDate instanceof Date)) {
newDate = new Date(newDate);
if (newDate.toString() === 'Invalid Date') {
return null;
}
}
return newDate;
}
/**
* Get the year of the provided date.
*
* @param {Date|String} date Date to get the year from.
* @returns {Number|null} The year from the provided date.
*/
function getDateYear(date) {
var newDate = parseDate(date);
return newDate ? newDate.getFullYear() : null;
}
/***/ }),
/* 184 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
/**
* Base class for the Nested Rows' UI sub-classes.
*
* @class
* @util
* @private
*/
var BaseUI = function BaseUI(pluginInstance, hotInstance) {
(0, _classCallCheck2.default)(this, BaseUI);
/**
* Instance of Handsontable.
*
* @type {Core}
*/
this.hot = hotInstance;
/**
* Reference to the main plugin instance.
*/
this.plugin = pluginInstance;
};
var _default = BaseUI;
exports.default = _default;
/***/ }),
/* 185 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(46);
var fails = __webpack_require__(28);
var createElement = __webpack_require__(146);
// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
/***/ }),
/* 186 */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(97);
module.exports = shared('native-function-to-string', Function.toString);
/***/ }),
/* 187 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(37);
var nativeFunctionToString = __webpack_require__(186);
var WeakMap = global.WeakMap;
module.exports = typeof WeakMap === 'function' && /native code/.test(nativeFunctionToString.call(WeakMap));
/***/ }),
/* 188 */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(52);
var ownKeys = __webpack_require__(189);
var getOwnPropertyDescriptorModule = __webpack_require__(92);
var definePropertyModule = __webpack_require__(53);
module.exports = function (target, source) {
var keys = ownKeys(source);
var defineProperty = definePropertyModule.f;
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
}
};
/***/ }),
/* 189 */
/***/ (function(module, exports, __webpack_require__) {
var getBuiltIn = __webpack_require__(123);
var getOwnPropertyNamesModule = __webpack_require__(99);
var getOwnPropertySymbolsModule = __webpack_require__(150);
var anObject = __webpack_require__(47);
// all object keys, includes non-enumerable and symbols
module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
var keys = getOwnPropertyNamesModule.f(anObject(it));
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
};
/***/ }),
/* 190 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(37);
/***/ }),
/* 191 */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(52);
var toIndexedObject = __webpack_require__(67);
var indexOf = __webpack_require__(148).indexOf;
var hiddenKeys = __webpack_require__(98);
module.exports = function (object, names) {
var O = toIndexedObject(object);
var i = 0;
var result = [];
var key;
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (has(O, key = names[i++])) {
~indexOf(result, key) || result.push(key);
}
return result;
};
/***/ }),
/* 192 */
/***/ (function(module, exports, __webpack_require__) {
var toIndexedObject = __webpack_require__(67);
var nativeGetOwnPropertyNames = __webpack_require__(99).f;
var toString = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function (it) {
try {
return nativeGetOwnPropertyNames(it);
} catch (error) {
return windowNames.slice();
}
};
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
module.exports.f = function getOwnPropertyNames(it) {
return windowNames && toString.call(it) == '[object Window]'
? getWindowNames(it)
: nativeGetOwnPropertyNames(toIndexedObject(it));
};
/***/ }),
/* 193 */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(28);
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
// Chrome 38 Symbol has incorrect toString conversion
// eslint-disable-next-line no-undef
return !String(Symbol());
});
/***/ }),
/* 194 */
/***/ (function(module, exports, __webpack_require__) {
var getBuiltIn = __webpack_require__(123);
module.exports = getBuiltIn('document', 'documentElement');
/***/ }),
/* 195 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var getPrototypeOf = __webpack_require__(152);
var hide = __webpack_require__(68);
var has = __webpack_require__(52);
var wellKnownSymbol = __webpack_require__(34);
var IS_PURE = __webpack_require__(120);
var ITERATOR = wellKnownSymbol('iterator');
var BUGGY_SAFARI_ITERATORS = false;
var returnThis = function () { return this; };
// `%IteratorPrototype%` object
// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
if ([].keys) {
arrayIterator = [].keys();
// Safari 8 has buggy iterators w/o `next`
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
else {
PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
}
}
if (IteratorPrototype == undefined) IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
module.exports = {
IteratorPrototype: IteratorPrototype,
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
};
/***/ }),
/* 196 */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(28);
module.exports = !fails(function () {
function F() { /* empty */ }
F.prototype.constructor = null;
return Object.getPrototypeOf(new F()) !== F.prototype;
});
/***/ }),
/* 197 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(47);
var aPossiblePrototype = __webpack_require__(410);
// `Object.setPrototypeOf` method
// https://tc39.github.io/ecma262/#sec-object.setprototypeof
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
var CORRECT_SETTER = false;
var test = {};
var setter;
try {
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
setter.call(test, []);
CORRECT_SETTER = test instanceof Array;
} catch (error) { /* empty */ }
return function setPrototypeOf(O, proto) {
anObject(O);
aPossiblePrototype(proto);
if (CORRECT_SETTER) setter.call(O, proto);
else O.__proto__ = proto;
return O;
};
}() : undefined);
/***/ }),
/* 198 */
/***/ (function(module, exports, __webpack_require__) {
var classofRaw = __webpack_require__(77);
var wellKnownSymbol = __webpack_require__(34);
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
// ES3 wrong here
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
try {
return it[key];
} catch (error) { /* empty */ }
};
// getting tag from ES6+ `Object.prototype.toString`
module.exports = function (it) {
var O, tag, result;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
// builtinTag case
: CORRECT_ARGUMENTS ? classofRaw(O)
// ES3 arguments fallback
: (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
};
/***/ }),
/* 199 */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(34);
var Iterators = __webpack_require__(103);
var ITERATOR = wellKnownSymbol('iterator');
var ArrayPrototype = Array.prototype;
// check on default Array iterator
module.exports = function (it) {
return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
};
/***/ }),
/* 200 */
/***/ (function(module, exports, __webpack_require__) {
var classof = __webpack_require__(198);
var Iterators = __webpack_require__(103);
var wellKnownSymbol = __webpack_require__(34);
var ITERATOR = wellKnownSymbol('iterator');
module.exports = function (it) {
if (it != undefined) return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ }),
/* 201 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(47);
// call something on iterator step with safe closing on error
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 (error) {
var returnMethod = iterator['return'];
if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
throw error;
}
};
/***/ }),
/* 202 */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(34);
var ITERATOR = wellKnownSymbol('iterator');
var SAFE_CLOSING = false;
try {
var called = 0;
var iteratorWithReturn = {
next: function () {
return { done: !!called++ };
},
'return': function () {
SAFE_CLOSING = true;
}
};
iteratorWithReturn[ITERATOR] = function () {
return this;
};
// eslint-disable-next-line no-throw-literal
Array.from(iteratorWithReturn, function () { throw 2; });
} catch (error) { /* empty */ }
module.exports = function (exec, SKIP_CLOSING) {
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
var ITERATION_SUPPORT = false;
try {
var object = {};
object[ITERATOR] = function () {
return {
next: function () {
return { done: ITERATION_SUPPORT = true };
}
};
};
exec(object);
} catch (error) { /* empty */ }
return ITERATION_SUPPORT;
};
/***/ }),
/* 203 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var redefineAll = __webpack_require__(154);
var getWeakData = __webpack_require__(127).getWeakData;
var anObject = __webpack_require__(47);
var isObject = __webpack_require__(43);
var anInstance = __webpack_require__(157);
var iterate = __webpack_require__(155);
var ArrayIterationModule = __webpack_require__(89);
var $has = __webpack_require__(52);
var InternalStateModule = __webpack_require__(87);
var setInternalState = InternalStateModule.set;
var internalStateGetterFor = InternalStateModule.getterFor;
var find = ArrayIterationModule.find;
var findIndex = ArrayIterationModule.findIndex;
var id = 0;
// fallback for uncaught frozen keys
var uncaughtFrozenStore = function (store) {
return store.frozen || (store.frozen = new UncaughtFrozenStore());
};
var UncaughtFrozenStore = function () {
this.entries = [];
};
var findUncaughtFrozen = function (store, key) {
return find(store.entries, 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.entries.push([key, value]);
},
'delete': function (key) {
var index = findIndex(this.entries, function (it) {
return it[0] === key;
});
if (~index) this.entries.splice(index, 1);
return !!~index;
}
};
module.exports = {
getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
var C = wrapper(function (that, iterable) {
anInstance(that, C, CONSTRUCTOR_NAME);
setInternalState(that, {
type: CONSTRUCTOR_NAME,
id: id++,
frozen: undefined
});
if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);
});
var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
var define = function (that, key, value) {
var state = getInternalState(that);
var data = getWeakData(anObject(key), true);
if (data === true) uncaughtFrozenStore(state).set(key, value);
else data[state.id] = value;
return that;
};
redefineAll(C.prototype, {
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function (key) {
var state = getInternalState(this);
if (!isObject(key)) return false;
var data = getWeakData(key);
if (data === true) return uncaughtFrozenStore(state)['delete'](key);
return data && $has(data, state.id) && delete data[state.id];
},
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function has(key) {
var state = getInternalState(this);
if (!isObject(key)) return false;
var data = getWeakData(key);
if (data === true) return uncaughtFrozenStore(state).has(key);
return data && $has(data, state.id);
}
});
redefineAll(C.prototype, IS_MAP ? {
// 23.3.3.3 WeakMap.prototype.get(key)
get: function get(key) {
var state = getInternalState(this);
if (isObject(key)) {
var data = getWeakData(key);
if (data === true) return uncaughtFrozenStore(state).get(key);
return data ? data[state.id] : undefined;
}
},
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function set(key, value) {
return define(this, key, value);
}
} : {
// 23.4.3.1 WeakSet.prototype.add(value)
add: function add(value) {
return define(this, value, true);
}
});
return C;
}
};
/***/ }),
/* 204 */
/***/ (function(module, exports) {
// iterable DOM collections
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
module.exports = {
CSSRuleList: 0,
CSSStyleDeclaration: 0,
CSSValueList: 0,
ClientRectList: 0,
DOMRectList: 0,
DOMStringList: 0,
DOMTokenList: 1,
DataTransferItemList: 0,
FileList: 0,
HTMLAllCollection: 0,
HTMLCollection: 0,
HTMLFormElement: 0,
HTMLSelectElement: 0,
MediaList: 0,
MimeTypeArray: 0,
NamedNodeMap: 0,
NodeList: 1,
PaintRequestList: 0,
Plugin: 0,
PluginArray: 0,
SVGLengthList: 0,
SVGNumberList: 0,
SVGPathSegList: 0,
SVGPointList: 0,
SVGStringList: 0,
SVGTransformList: 0,
SourceBufferList: 0,
StyleSheetList: 0,
TextTrackCueList: 0,
TextTrackList: 0,
TouchList: 0
};
/***/ }),
/* 205 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defineProperty = __webpack_require__(53).f;
var create = __webpack_require__(101);
var redefineAll = __webpack_require__(154);
var bind = __webpack_require__(104);
var anInstance = __webpack_require__(157);
var iterate = __webpack_require__(155);
var defineIterator = __webpack_require__(151);
var setSpecies = __webpack_require__(206);
var DESCRIPTORS = __webpack_require__(46);
var fastKey = __webpack_require__(127).fastKey;
var InternalStateModule = __webpack_require__(87);
var setInternalState = InternalStateModule.set;
var internalStateGetterFor = InternalStateModule.getterFor;
module.exports = {
getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
var C = wrapper(function (that, iterable) {
anInstance(that, C, CONSTRUCTOR_NAME);
setInternalState(that, {
type: CONSTRUCTOR_NAME,
index: create(null),
first: undefined,
last: undefined,
size: 0
});
if (!DESCRIPTORS) that.size = 0;
if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);
});
var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
var define = function (that, key, value) {
var state = getInternalState(that);
var entry = getEntry(that, key);
var previous, index;
// change existing entry
if (entry) {
entry.value = value;
// create new entry
} else {
state.last = entry = {
index: index = fastKey(key, true),
key: key,
value: value,
previous: previous = state.last,
next: undefined,
removed: false
};
if (!state.first) state.first = entry;
if (previous) previous.next = entry;
if (DESCRIPTORS) state.size++;
else that.size++;
// add to index
if (index !== 'F') state.index[index] = entry;
} return that;
};
var getEntry = function (that, key) {
var state = getInternalState(that);
// fast case
var index = fastKey(key);
var entry;
if (index !== 'F') return state.index[index];
// frozen object case
for (entry = state.first; entry; entry = entry.next) {
if (entry.key == key) return entry;
}
};
redefineAll(C.prototype, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function clear() {
var that = this;
var state = getInternalState(that);
var data = state.index;
var entry = state.first;
while (entry) {
entry.removed = true;
if (entry.previous) entry.previous = entry.previous.next = undefined;
delete data[entry.index];
entry = entry.next;
}
state.first = state.last = undefined;
if (DESCRIPTORS) state.size = 0;
else 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;
var state = getInternalState(that);
var entry = getEntry(that, key);
if (entry) {
var next = entry.next;
var prev = entry.previous;
delete state.index[entry.index];
entry.removed = true;
if (prev) prev.next = next;
if (next) next.previous = prev;
if (state.first == entry) state.first = next;
if (state.last == entry) state.last = prev;
if (DESCRIPTORS) state.size--;
else 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 */) {
var state = getInternalState(this);
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
var entry;
while (entry = entry ? entry.next : state.first) {
boundFunction(entry.value, entry.key, this);
// revert to the last existing entry
while (entry && entry.removed) entry = entry.previous;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function has(key) {
return !!getEntry(this, key);
}
});
redefineAll(C.prototype, IS_MAP ? {
// 23.1.3.6 Map.prototype.get(key)
get: function get(key) {
var entry = getEntry(this, key);
return entry && entry.value;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function set(key, value) {
return define(this, key === 0 ? 0 : key, value);
}
} : {
// 23.2.3.1 Set.prototype.add(value)
add: function add(value) {
return define(this, value = value === 0 ? 0 : value, value);
}
});
if (DESCRIPTORS) defineProperty(C.prototype, 'size', {
get: function () {
return getInternalState(this).size;
}
});
return C;
},
setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
// 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
defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
setInternalState(this, {
type: ITERATOR_NAME,
target: iterated,
state: getInternalCollectionState(iterated),
kind: kind,
last: undefined
});
}, function () {
var state = getInternalIteratorState(this);
var kind = state.kind;
var entry = state.last;
// revert to the last existing entry
while (entry && entry.removed) entry = entry.previous;
// get next entry
if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
// or finish the iteration
state.target = undefined;
return { value: undefined, done: true };
}
// return step by kind
if (kind == 'keys') return { value: entry.key, done: false };
if (kind == 'values') return { value: entry.value, done: false };
return { value: [entry.key, entry.value], done: false };
}, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
// add [@@species], 23.1.2.2, 23.2.2.2
setSpecies(CONSTRUCTOR_NAME);
}
};
/***/ }),
/* 206 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var getBuiltIn = __webpack_require__(123);
var definePropertyModule = __webpack_require__(53);
var wellKnownSymbol = __webpack_require__(34);
var DESCRIPTORS = __webpack_require__(46);
var SPECIES = wellKnownSymbol('species');
module.exports = function (CONSTRUCTOR_NAME) {
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
var defineProperty = definePropertyModule.f;
if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
defineProperty(Constructor, SPECIES, {
configurable: true,
get: function () { return this; }
});
}
};
/***/ }),
/* 207 */
/***/ (function(module, exports) {
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
module.exports = _iterableToArray;
/***/ }),
/* 208 */
/***/ (function(module, exports, __webpack_require__) {
var requireObjectCoercible = __webpack_require__(51);
var whitespaces = __webpack_require__(209);
var whitespace = '[' + whitespaces + ']';
var ltrim = RegExp('^' + whitespace + whitespace + '*');
var rtrim = RegExp(whitespace + whitespace + '*$');
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
var createMethod = function (TYPE) {
return function ($this) {
var string = String(requireObjectCoercible($this));
if (TYPE & 1) string = string.replace(ltrim, '');
if (TYPE & 2) string = string.replace(rtrim, '');
return string;
};
};
module.exports = {
// `String.prototype.{ trimLeft, trimStart }` methods
// https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
start: createMethod(1),
// `String.prototype.{ trimRight, trimEnd }` methods
// https://tc39.github.io/ecma262/#sec-string.prototype.trimend
end: createMethod(2),
// `String.prototype.trim` method
// https://tc39.github.io/ecma262/#sec-string.prototype.trim
trim: createMethod(3)
};
/***/ }),
/* 209 */
/***/ (function(module, exports) {
// a string of all valid unicode whitespaces
// eslint-disable-next-line max-len
module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
/***/ }),
/* 210 */
/***/ (function(module, exports) {
function _setPrototypeOf(o, p) {
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
module.exports = _setPrototypeOf;
/***/ }),
/* 211 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(14);
__webpack_require__(9);
__webpack_require__(12);
__webpack_require__(23);
__webpack_require__(16);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _constants = __webpack_require__(164);
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 =
/*#__PURE__*/
function () {
(0, _createClass2.default)(ViewportColumnsCalculator, null, [{
key: "DEFAULT_WIDTH",
/**
* Default column width
*
* @type {Number}
*/
get: function get() {
return 50;
}
/**
* @param {Object} options Object with all options specyfied for column viewport calculation.
* @param {Number} options.viewportWidth Width of the viewport
* @param {Number} options.scrollOffset Current horizontal scroll position of the viewport
* @param {Number} options.totalColumns Total number of rows
* @param {Function} options.columnWidthFn Function that returns the width of the column at a given index (in px)
* @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by MergeCells plugin)
* @param {String} options.calculationType String which describes types of calculation which will be performed.
* @param {String} [options.stretchH] Stretch mode 'all' or 'last'
* @param {Function} [options.stretchingColumnWidthFn] Function that returns the new width of the stretched column.
*/
}]);
function ViewportColumnsCalculator() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
viewportSize = _ref.viewportSize,
scrollOffset = _ref.scrollOffset,
totalItems = _ref.totalItems,
itemSizeFn = _ref.itemSizeFn,
overrideFn = _ref.overrideFn,
calculationType = _ref.calculationType,
stretchMode = _ref.stretchMode,
_ref$stretchingItemWi = _ref.stretchingItemWidthFn,
stretchingItemWidthFn = _ref$stretchingItemWi === void 0 ? function (width) {
return width;
} : _ref$stretchingItemWi;
(0, _classCallCheck2.default)(this, ViewportColumnsCalculator);
privatePool.set(this, {
viewportWidth: viewportSize,
scrollOffset: scrollOffset,
totalColumns: totalItems,
columnWidthFn: itemSizeFn,
overrideFn: overrideFn,
calculationType: calculationType,
stretchingColumnWidthFn: stretchingItemWidthFn
});
/**
* 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 = stretchMode;
this.totalTargetWidth = 0;
this.needVerifyLastColumnWidth = true;
this.stretchAllColumnsWidth = [];
this.calculate();
}
/**
* Calculates viewport
*/
(0, _createClass2.default)(ViewportColumnsCalculator, [{
key: "calculate",
value: function calculate() {
var sum = 0;
var needReverse = true;
var startPositions = [];
var columnWidth;
var priv = privatePool.get(this);
var calculationType = priv.calculationType;
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 && calculationType !== _constants.FULLY_VISIBLE_TYPE) {
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 + (calculationType === _constants.FULLY_VISIBLE_TYPE ? columnWidth : 0) <= scrollOffset + compensatedViewportWidth) {
if (this.startColumn === null || this.startColumn === void 0) {
this.startColumn = i;
}
this.endColumn = i;
}
startPositions.push(sum);
sum += columnWidth;
if (calculationType !== _constants.FULLY_VISIBLE_TYPE) {
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 || calculationType !== _constants.FULLY_VISIBLE_TYPE) {
this.startColumn -= 1;
}
if (viewportSum > viewportWidth) {
break;
}
}
}
if (calculationType === _constants.RENDER_TYPE && this.startColumn !== null && overrideFn) {
overrideFn(this);
}
this.startPosition = startPositions[this.startColumn];
if (this.startPosition === void 0) {
this.startPosition = null;
} // If totalColumns exceeded its total columns size set endColumn to the latest item
if (totalColumns < this.endColumn) {
this.endColumn = totalColumns - 1;
}
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;
}
var totalColumnsWidth = totalWidth;
this.totalTargetWidth = totalColumnsWidth;
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') {
totalColumnsWidth -= permanentColumnWidth;
} else {
sumAll += columnWidth;
}
}
var remainingSize = totalColumnsWidth - sumAll;
if (this.stretch === 'all' && remainingSize > 0) {
this.stretchAllRatio = totalColumnsWidth / sumAll;
this.stretchAllColumnsWidth = [];
this.needVerifyLastColumnWidth = true;
} else if (this.stretch === 'last' && totalColumnsWidth !== 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 (isNaN(width)) {
width = ViewportColumnsCalculator.DEFAULT_WIDTH;
}
return width;
}
}]);
return ViewportColumnsCalculator;
}();
var _default = ViewportColumnsCalculator;
exports.default = _default;
/***/ }),
/* 212 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(14);
__webpack_require__(9);
__webpack_require__(12);
__webpack_require__(23);
__webpack_require__(16);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _constants = __webpack_require__(164);
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 =
/*#__PURE__*/
function () {
(0, _createClass2.default)(ViewportRowsCalculator, null, [{
key: "DEFAULT_HEIGHT",
/**
* Default row height
*
* @type {Number}
*/
get: function get() {
return 23;
}
/**
* @param {Object} options Object with all options specyfied for row viewport calculation.
* @param {Number} options.viewportHeight Height of the viewport
* @param {Number} options.scrollOffset Current vertical scroll position of the viewport
* @param {Number} options.totalRows Total number of rows
* @param {Function} options.rowHeightFn Function that returns the height of the row at a given index (in px)
* @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by MergeCells plugin)
* @param {String} options.calculationType String which describes types of calculation which will be performed.
* @param {Number} options.horizontalScrollbarHeight
*/
}]);
function ViewportRowsCalculator() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
viewportSize = _ref.viewportSize,
scrollOffset = _ref.scrollOffset,
totalItems = _ref.totalItems,
itemSizeFn = _ref.itemSizeFn,
overrideFn = _ref.overrideFn,
calculationType = _ref.calculationType,
scrollbarHeight = _ref.scrollbarHeight;
(0, _classCallCheck2.default)(this, ViewportRowsCalculator);
privatePool.set(this, {
viewportHeight: viewportSize,
scrollOffset: scrollOffset,
totalRows: totalItems,
rowHeightFn: itemSizeFn,
overrideFn: overrideFn,
calculationType: calculationType,
horizontalScrollbarHeight: scrollbarHeight
});
/**
* 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
*/
(0, _createClass2.default)(ViewportRowsCalculator, [{
key: "calculate",
value: function calculate() {
var sum = 0;
var needReverse = true;
var startPositions = [];
var priv = privatePool.get(this);
var calculationType = priv.calculationType;
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; // Calculate the number (start and end index) of rows needed
for (var i = 0; i < totalRows; i++) {
rowHeight = rowHeightFn(i);
if (isNaN(rowHeight)) {
rowHeight = ViewportRowsCalculator.DEFAULT_HEIGHT;
}
if (sum <= scrollOffset && calculationType !== _constants.FULLY_VISIBLE_TYPE) {
this.startRow = i;
}
if (sum >= scrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? rowHeight : 0) <= scrollOffset + viewportHeight - horizontalScrollbarHeight) {
if (this.startRow === null) {
this.startRow = i;
}
this.endRow = i;
}
startPositions.push(sum);
sum += rowHeight;
if (calculationType !== _constants.FULLY_VISIBLE_TYPE) {
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 || calculationType !== _constants.FULLY_VISIBLE_TYPE) {
this.startRow -= 1;
}
if (viewportSum >= viewportHeight - horizontalScrollbarHeight) {
break;
}
}
}
if (calculationType === _constants.RENDER_TYPE && this.startRow !== null && overrideFn) {
overrideFn(this);
}
this.startPosition = startPositions[this.startRow];
if (this.startPosition === void 0) {
this.startPosition = null;
} // If totalRows exceeded its total rows size set endRow to the latest item
if (totalRows < this.endRow) {
this.endRow = totalRows - 1;
}
if (this.startRow !== null) {
this.count = this.endRow - this.startRow + 1;
}
}
}]);
return ViewportRowsCalculator;
}();
var _default = ViewportRowsCalculator;
exports.default = _default;
/***/ }),
/* 213 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(25);
__webpack_require__(13);
__webpack_require__(32);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _coords = _interopRequireDefault(__webpack_require__(108));
/**
* CellRange holds cell coordinates as {@link CellCoords} instances. This object represent unit of the selection layer which
* can contains multiple contiquous cells or single cell.
*
* @util
*/
var CellRange =
/*#__PURE__*/
function () {
function CellRange(highlight) {
var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : highlight;
var to = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : highlight;
(0, _classCallCheck2.default)(this, CellRange);
/**
* Used to draw bold border around a cell where selection was started and to edit the cell when you press Enter.
*
* @type {CellCoords}
*/
this.highlight = highlight;
/**
* Usually the same as highlight, but in Excel there is distinction - one can change highlight within a selection.
*
* @type {CellCoords}
*/
this.from = from;
/**
* End selection.
*
* @type {CellCoords}
*/
this.to = to;
}
/**
* Set the new coordinates for highlighting selection.
*
* @param {CellCoords} coords Coordinates to use.
*/
(0, _createClass2.default)(CellRange, [{
key: "setHighlight",
value: function setHighlight(coords) {
this.highlight = coords;
return this;
}
/**
* Set the new coordinates where selection starts from.
*
* @param {CellCoords} coords Coordinates to use.
*/
}, {
key: "setFrom",
value: function setFrom(coords) {
this.from = coords;
return this;
}
/**
* Set new coordinates where selection ends from.
*
* @param {CellCoords} coords Coordinates to use.
*/
}, {
key: "setTo",
value: function setTo(coords) {
this.to = coords;
return this;
}
/**
* Checks if given coordinates are valid in context of a given Walkontable instance.
*
* @param {Walkontable} wot The Walkontable instance.
* @returns {Boolean}
*/
}, {
key: "isValid",
value: function isValid(wot) {
return this.from.isValid(wot) && this.to.isValid(wot);
}
/**
* 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 coordinates are within `from` and `to` cell coordinates of this range.
*
* @param {CellCoords} cellCoords The cell coordinates to check.
* @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} cellRange The cells range to check.
* @returns {Boolean}
*/
}, {
key: "includesRange",
value: function includesRange(cellRange) {
return this.includes(cellRange.getTopLeftCorner()) && this.includes(cellRange.getBottomRightCorner());
}
/**
* Checks if given range is equal to this range.
*
* @param {CellRange} cellRange The cells range to check.
* @returns {Boolean}
*/
}, {
key: "isEqual",
value: function isEqual(cellRange) {
return Math.min(this.from.row, this.to.row) === Math.min(cellRange.from.row, cellRange.to.row) && Math.max(this.from.row, this.to.row) === Math.max(cellRange.from.row, cellRange.to.row) && Math.min(this.from.col, this.to.col) === Math.min(cellRange.from.col, cellRange.to.col) && Math.max(this.from.col, this.to.col) === Math.max(cellRange.from.col, cellRange.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} cellRange The cells range to check.
* @returns {Boolean}
*/
}, {
key: "overlaps",
value: function overlaps(cellRange) {
return cellRange.isSouthEastOf(this.getTopLeftCorner()) && cellRange.isNorthWestOf(this.getBottomRightCorner());
}
/**
* Checks if tested coordinates are positioned in south-east from this cell range.
*
* @param {CellRange} cellRange The cells range to check.
* @returns {Boolean}
*/
}, {
key: "isSouthEastOf",
value: function isSouthEastOf(cellRange) {
return this.getTopLeftCorner().isSouthEastOf(cellRange) || this.getBottomRightCorner().isSouthEastOf(cellRange);
}
/**
* Checks if tested coordinates are positioned in north-west from this cell range.
*
* @param {CellRange} cellRange The cells range to check.
* @returns {Boolean}
*/
}, {
key: "isNorthWestOf",
value: function isNorthWestOf(cellRange) {
return this.getTopLeftCorner().isNorthWestOf(cellRange) || this.getBottomRightCorner().isNorthWestOf(cellRange);
}
/**
* Returns `true` if the provided range is overlapping the current range horizontally (e.g. the current range's last
* column is 5 and the provided range's first column is 3).
*
* @param {CellRange} cellRange The cells range to check.
* @returns {Boolean}
*/
}, {
key: "isOverlappingHorizontally",
value: function isOverlappingHorizontally(cellRange) {
return this.getTopRightCorner().col >= cellRange.getTopLeftCorner().col && this.getTopRightCorner().col <= cellRange.getTopRightCorner().col || this.getTopLeftCorner().col <= cellRange.getTopRightCorner().col && this.getTopLeftCorner().col >= cellRange.getTopLeftCorner().col;
}
/**
* Returns `true` if the provided range is overlapping the current range vertically (e.g. the current range's last
* row is 5 and the provided range's first row is 3).
*
* @param {CellRange} cellRange The cells range to check.
* @returns {Boolean}
*/
}, {
key: "isOverlappingVertically",
value: function isOverlappingVertically(cellRange) {
return this.getBottomRightCorner().row >= cellRange.getTopRightCorner().row && this.getBottomRightCorner().row <= cellRange.getBottomRightCorner().row || this.getTopRightCorner().row <= cellRange.getBottomRightCorner().row && this.getTopRightCorner().row >= cellRange.getTopRightCorner().row;
}
/**
* 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 _coords.default(Math.min(topLeft.row, cellCoords.row), Math.min(topLeft.col, cellCoords.col));
this.to = new _coords.default(Math.max(bottomRight.row, cellCoords.row), Math.max(bottomRight.col, cellCoords.col));
return true;
}
return false;
}
/**
* Expand the current object by the range passed in the first argument.
*
* @param {CellRange} expandingRange Object extending the range.
* @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 initialDirection = this.getDirection();
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 _coords.default(resultTopRow, resultTopCol);
var finalTo = new _coords.default(resultBottomRow, resultBottomCol);
this.from = finalFrom;
this.to = finalTo;
this.setDirection(initialDirection);
if (this.highlight.row === this.getBottomRightCorner().row && this.getVerticalDirection() === 'N-S') {
this.flipDirectionVertically();
}
if (this.highlight.col === this.getTopRightCorner().col && this.getHorizontalDirection() === 'W-E') {
this.flipDirectionHorizontally();
}
return true;
}
/**
* Gets the direction of the selection.
*
* @returns {String} Returns one of the values: `'NW-SE'`, `'NE-SW'`, `'SE-NW'`, `'SW-NE'`.
*/
}, {
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';
}
}
/**
* Sets the direction of the selection.
*
* @param {String} direction One of the values: `'NW-SE'`, `'NE-SW'`, `'SE-NW'`, `'SW-NE'`.
*/
}, {
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;
}
}
/**
* Gets the vertical direction of the range.
*
* @returns {String} Returns one of the values: `N-S` (north->south), `S-N` (south->north).
*/
}, {
key: "getVerticalDirection",
value: function getVerticalDirection() {
return ['NE-SW', 'NW-SE'].indexOf(this.getDirection()) > -1 ? 'N-S' : 'S-N';
}
/**
* Gets the horizontal direction of the range.
*
* @returns {String} Returns one of the values: `W-E` (west->east), `E-W` (east->west).
*/
}, {
key: "getHorizontalDirection",
value: function getHorizontalDirection() {
return ['NW-SE', 'SW-NE'].indexOf(this.getDirection()) > -1 ? 'W-E' : 'E-W';
}
/**
* Flip the direction vertically. (e.g. `NW-SE` changes to `SW-NE`).
*/
}, {
key: "flipDirectionVertically",
value: function flipDirectionVertically() {
var direction = this.getDirection();
switch (direction) {
case 'NW-SE':
this.setDirection('SW-NE');
break;
case 'NE-SW':
this.setDirection('SE-NW');
break;
case 'SE-NW':
this.setDirection('NE-SW');
break;
case 'SW-NE':
this.setDirection('NW-SE');
break;
default:
break;
}
}
/**
* Flip the direction horizontally. (e.g. `NW-SE` changes to `NE-SW`).
*/
}, {
key: "flipDirectionHorizontally",
value: function flipDirectionHorizontally() {
var direction = this.getDirection();
switch (direction) {
case 'NW-SE':
this.setDirection('NE-SW');
break;
case 'NE-SW':
this.setDirection('NW-SE');
break;
case 'SE-NW':
this.setDirection('SW-NE');
break;
case 'SW-NE':
this.setDirection('SE-NW');
break;
default:
break;
}
}
/**
* Gets the top left corner of this range.
*
* @returns {CellCoords}
*/
}, {
key: "getTopLeftCorner",
value: function getTopLeftCorner() {
return new _coords.default(Math.min(this.from.row, this.to.row), Math.min(this.from.col, this.to.col));
}
/**
* Gets the bottom right corner of this range.
*
* @returns {CellCoords}
*/
}, {
key: "getBottomRightCorner",
value: function getBottomRightCorner() {
return new _coords.default(Math.max(this.from.row, this.to.row), Math.max(this.from.col, this.to.col));
}
/**
* Gets the top right corner of this range.
*
* @returns {CellCoords}
*/
}, {
key: "getTopRightCorner",
value: function getTopRightCorner() {
return new _coords.default(Math.min(this.from.row, this.to.row), Math.max(this.from.col, this.to.col));
}
/**
* Gets the bottom left corner of this range.
*
* @returns {CellCoords}
*/
}, {
key: "getBottomLeftCorner",
value: function getBottomLeftCorner() {
return new _coords.default(Math.max(this.from.row, this.to.row), Math.min(this.from.col, this.to.col));
}
/**
* Checks if coordinates match to one of the 4th corners of this range.
*
* @param {CellCoords} coords Cell coordinates to check.
* @param {CellRange} [expandedRange]
* @returns {Boolean}
*/
}, {
key: "isCorner",
value: function isCorner(coords, expandedRange) {
if (expandedRange && expandedRange.includes(coords) && (this.getTopLeftCorner().isEqual(new _coords.default(expandedRange.from.row, expandedRange.from.col)) || this.getTopRightCorner().isEqual(new _coords.default(expandedRange.from.row, expandedRange.to.col)) || this.getBottomLeftCorner().isEqual(new _coords.default(expandedRange.to.row, expandedRange.from.col)) || this.getBottomRightCorner().isEqual(new _coords.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());
}
/**
* Gets coordinates of the corner which is opposite to the matched. When the passed coordinates matched to the
* bottom-right corner of this range then the coordinates for top-left will be returned.
*
* @param {CellCoords} coords Cell coordinates to check.
* @param {CellRange} [expandedRange]
* @returns {CellCoords}
*/
}, {
key: "getOppositeCorner",
value: function getOppositeCorner(coords, expandedRange) {
if (!(coords instanceof _coords.default)) {
return false;
}
if (expandedRange) {
if (expandedRange.includes(coords)) {
if (this.getTopLeftCorner().isEqual(new _coords.default(expandedRange.from.row, expandedRange.from.col))) {
return this.getBottomRightCorner();
}
if (this.getTopRightCorner().isEqual(new _coords.default(expandedRange.from.row, expandedRange.to.col))) {
return this.getBottomLeftCorner();
}
if (this.getBottomLeftCorner().isEqual(new _coords.default(expandedRange.to.row, expandedRange.from.col))) {
return this.getTopRightCorner();
}
if (this.getBottomRightCorner().isEqual(new _coords.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 _coords.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 _coords.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;
}
}
}
}
/**
* Convert CellRange to literal object.
*
* @return {Object} Returns a literal object with `from` and `to` properties which each of that object
* contains `row` and `col` keys.
*/
}, {
key: "toObject",
value: function toObject() {
return {
from: this.from.toObject(),
to: this.to.toObject()
};
}
}]);
return CellRange;
}();
var _default = CellRange;
exports.default = _default;
/***/ }),
/* 214 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
/**
* @class ColumnFilter
*/
var ColumnFilter =
/*#__PURE__*/
function () {
/**
* @param {Number} offset
* @param {Number} total
* @param {Number} countTH
*/
function ColumnFilter(offset, total, countTH) {
(0, _classCallCheck2.default)(this, ColumnFilter);
this.offset = offset;
this.total = total;
this.countTH = countTH;
}
/**
* @param index
* @returns {Number}
*/
(0, _createClass2.default)(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;
}();
var _default = ColumnFilter;
exports.default = _default;
/***/ }),
/* 215 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
/**
* @class RowFilter
*/
var RowFilter =
/*#__PURE__*/
function () {
/**
* @param {Number} offset
* @param {Number} total
* @param {Number} countTH
*/
function RowFilter(offset, total, countTH) {
(0, _classCallCheck2.default)(this, RowFilter);
this.offset = offset;
this.total = total;
this.countTH = countTH;
}
/**
* @param index
* @returns {Number}
*/
(0, _createClass2.default)(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;
}();
var _default = RowFilter;
exports.default = _default;
/***/ }),
/* 216 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(25);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(6));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(5));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _element = __webpack_require__(8);
var _table = _interopRequireDefault(__webpack_require__(93));
var _calculatedRows = _interopRequireDefault(__webpack_require__(350));
var _calculatedColumns = _interopRequireDefault(__webpack_require__(167));
var _object = __webpack_require__(4);
/**
* Subclass of `Table` that provides the helper methods relevant to the master table (not overlays), implemented through mixins.
*/
var MasterTable =
/*#__PURE__*/
function (_Table) {
(0, _inherits2.default)(MasterTable, _Table);
function MasterTable() {
(0, _classCallCheck2.default)(this, MasterTable);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(MasterTable).apply(this, arguments));
}
(0, _createClass2.default)(MasterTable, [{
key: "alignOverlaysWithTrimmingContainer",
value: function alignOverlaysWithTrimmingContainer() {
var trimmingElement = (0, _element.getTrimmingContainer)(this.wtRootElement);
var rootWindow = this.wot.rootWindow;
if (trimmingElement === rootWindow) {
var preventOverflow = this.wot.getSetting('preventOverflow');
if (!preventOverflow) {
this.holder.style.overflow = 'visible';
this.wtRootElement.style.overflow = 'visible';
}
} else {
var trimmingElementParent = trimmingElement.parentElement;
var trimmingHeight = (0, _element.getStyle)(trimmingElement, 'height', rootWindow);
var trimmingOverflow = (0, _element.getStyle)(trimmingElement, 'overflow', rootWindow);
var holderStyle = this.holder.style;
var scrollWidth = trimmingElement.scrollWidth,
scrollHeight = trimmingElement.scrollHeight;
var _trimmingElement$getB = trimmingElement.getBoundingClientRect(),
width = _trimmingElement$getB.width,
height = _trimmingElement$getB.height;
var overflow = ['auto', 'hidden', 'scroll'];
if (trimmingElementParent && overflow.includes(trimmingOverflow)) {
var cloneNode = trimmingElement.cloneNode(false);
trimmingElementParent.insertBefore(cloneNode, trimmingElement);
var cloneHeight = (0, _element.getComputedStyle)(cloneNode, rootWindow).height;
trimmingElementParent.removeChild(cloneNode);
if (parseInt(cloneHeight, 10) === 0) {
height = 0;
}
}
height = Math.min(height, scrollHeight);
holderStyle.height = trimmingHeight === 'auto' ? 'auto' : "".concat(height, "px");
width = Math.min(width, scrollWidth);
holderStyle.width = "".concat(width, "px");
holderStyle.overflow = '';
this.hasTableHeight = height > 0;
this.hasTableWidth = width > 0;
}
this.isTableVisible = (0, _element.isVisible)(this.TABLE);
}
}, {
key: "markOversizedColumnHeaders",
value: function markOversizedColumnHeaders() {
var wot = this.wot;
var overlayName = wot.getOverlayName();
var columnHeaders = wot.getSetting('columnHeaders');
var columnHeadersCount = columnHeaders.length;
if (columnHeadersCount && !wot.wtViewport.hasOversizedColumnHeadersMarked[overlayName]) {
var rowHeaders = wot.getSetting('rowHeaders');
var rowHeaderCount = rowHeaders.length;
var columnCount = this.getRenderedColumnsCount();
for (var i = 0; i < columnHeadersCount; i++) {
for (var renderedColumnIndex = -1 * rowHeaderCount; renderedColumnIndex < columnCount; renderedColumnIndex++) {
this.markIfOversizedColumnHeader(renderedColumnIndex);
}
}
wot.wtViewport.hasOversizedColumnHeadersMarked[overlayName] = true;
}
}
}]);
return MasterTable;
}(_table.default);
(0, _object.mixin)(MasterTable, _calculatedRows.default);
(0, _object.mixin)(MasterTable, _calculatedColumns.default);
var _default = MasterTable;
exports.default = _default;
/***/ }),
/* 217 */
/***/ (function(module, exports, __webpack_require__) {
var getBuiltIn = __webpack_require__(123);
module.exports = getBuiltIn('navigator', 'userAgent') || '';
/***/ }),
/* 218 */
/***/ (function(module, exports) {
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
module.exports = _arrayWithHoles;
/***/ }),
/* 219 */
/***/ (function(module, exports) {
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
module.exports = _nonIterableRest;
/***/ }),
/* 220 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.Renderer = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _rowHeaders = _interopRequireDefault(__webpack_require__(419));
exports.RowHeadersRenderer = _rowHeaders.default;
var _columnHeaders = _interopRequireDefault(__webpack_require__(424));
exports.ColumnHeadersRenderer = _columnHeaders.default;
var _colGroup = _interopRequireDefault(__webpack_require__(425));
exports.ColGroupRenderer = _colGroup.default;
var _rows = _interopRequireDefault(__webpack_require__(426));
exports.RowsRenderer = _rows.default;
var _cells = _interopRequireDefault(__webpack_require__(432));
exports.CellsRenderer = _cells.default;
var _table = _interopRequireDefault(__webpack_require__(433));
exports.TableRenderer = _table.default;
/**
* Content renderer.
*
* @class Renderer
*/
var Renderer =
/*#__PURE__*/
function () {
function Renderer() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
TABLE = _ref.TABLE,
THEAD = _ref.THEAD,
COLGROUP = _ref.COLGROUP,
TBODY = _ref.TBODY,
rowUtils = _ref.rowUtils,
columnUtils = _ref.columnUtils,
cellRenderer = _ref.cellRenderer;
(0, _classCallCheck2.default)(this, Renderer);
/**
* General renderer class used to render Walkontable content on screen.
*
* @type {TableRenderer}
*/
this.renderer = new _table.default(TABLE, {
cellRenderer: cellRenderer
});
this.renderer.setRenderers({
rowHeaders: new _rowHeaders.default(),
columnHeaders: new _columnHeaders.default(THEAD),
colGroup: new _colGroup.default(COLGROUP),
rows: new _rows.default(TBODY),
cells: new _cells.default()
});
this.renderer.setAxisUtils(rowUtils, columnUtils);
}
/**
* Sets filter calculators for newly calculated row and column position. The filters are used to transform visual
* indexes (0 to N) to source indexes provided by Handsontable.
*
* @param {RowFilter} rowFilter
* @param {ColumnFilter} columnFilter
* @returns {Renderer}
*/
(0, _createClass2.default)(Renderer, [{
key: "setFilters",
value: function setFilters(rowFilter, columnFilter) {
this.renderer.setFilters(rowFilter, columnFilter);
return this;
}
/**
* Sets the viewport size of the rendered table.
*
* @param {Number} rowsCount An amount of rows to render.
* @param {Number} columnsCount An amount of columns to render.
* @return {Renderer}
*/
}, {
key: "setViewportSize",
value: function setViewportSize(rowsCount, columnsCount) {
this.renderer.setViewportSize(rowsCount, columnsCount);
return this;
}
/**
* Sets row and column header functions.
*
* @param {Function[]} rowHeaders Row header functions. Factories for creating content for row headers.
* @param {Function[]} columnHeaders Column header functions. Factories for creating content for column headers.
* @returns {Renderer}
*/
}, {
key: "setHeaderContentRenderers",
value: function setHeaderContentRenderers(rowHeaders, columnHeaders) {
this.renderer.setHeaderContentRenderers(rowHeaders, columnHeaders);
return this;
}
/**
* Adjusts the table (preparing for render).
*/
}, {
key: "adjust",
value: function adjust() {
this.renderer.adjust();
}
/**
* Renders the table.
*/
}, {
key: "render",
value: function render() {
this.renderer.render();
}
}]);
return Renderer;
}();
exports.Renderer = Renderer;
/***/ }),
/* 221 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _constants = __webpack_require__(222);
var _viewSizeSet = _interopRequireDefault(__webpack_require__(420));
/**
* Executive model for each table renderer. It's responsible for injecting DOM nodes in a
* specified order and adjusting the number of elements in the root node.
*
* Only this class have rights to juggling DOM elements within the root node (see render method).
*
* @class {OrderView}
*/
var OrderView =
/*#__PURE__*/
function () {
function OrderView(rootNode, nodesPool, childNodeType) {
(0, _classCallCheck2.default)(this, OrderView);
/**
* The root node to manage with.
*
* @type {HTMLElement}
*/
this.rootNode = rootNode;
/**
* Factory for newly created DOM elements.
*
* @type {Function}
*/
this.nodesPool = nodesPool;
/**
* Holder for sizing and positioning of the view.
*
* @type {ViewSizeSet}
*/
this.sizeSet = new _viewSizeSet.default();
/**
* Node type which the order view will manage while rendering the DOM elements.
*
* @type {String}
*/
this.childNodeType = childNodeType.toUpperCase();
/**
* The visual index of currently processed row.
*
* @type {Number}
*/
this.visualIndex = 0;
/**
* The list of DOM elements which are rendered for this render cycle.
*
* @type {HTMLElement[]}
*/
this.collectedNodes = [];
}
/**
* Sets the size for rendered elements. It can be a size for rows, cells or size for row
* headers etc. it depends for what table renderer this instance was created.
*
* @param {Number} size
* @returns {OrderView}
*/
(0, _createClass2.default)(OrderView, [{
key: "setSize",
value: function setSize(size) {
this.sizeSet.setSize(size);
return this;
}
/**
* Sets the offset for rendered elements. The offset describes the shift between 0 and
* the first rendered element according to the scroll position.
*
* @param {Number} offset
* @returns {OrderView}
*/
}, {
key: "setOffset",
value: function setOffset(offset) {
this.sizeSet.setOffset(offset);
return this;
}
/**
* Checks if this instance of the view shares the root node with another instance. This happens only once when
* a row (TR) as a root node is managed by two OrderView instances. If this happens another DOM injection
* algorithm is performed to achieve consistent order.
*
* @returns {Boolean}
*/
}, {
key: "isSharedViewSet",
value: function isSharedViewSet() {
return this.sizeSet.isShared();
}
/**
* Returns rendered DOM element based on visual index.
*
* @param {Number} visualIndex
* @returns {HTMLElement}
*/
}, {
key: "getNode",
value: function getNode(visualIndex) {
return visualIndex < this.collectedNodes.length ? this.collectedNodes[visualIndex] : null;
}
/**
* Returns currently processed DOM element.
*
* @returns {HTMLElement}
*/
}, {
key: "getCurrentNode",
value: function getCurrentNode() {
var length = this.collectedNodes.length;
return length > 0 ? this.collectedNodes[length - 1] : null;
}
/**
* Returns rendered child count for this instance.
*
* @returns {Number}
*/
}, {
key: "getRenderedChildCount",
value: function getRenderedChildCount() {
var rootNode = this.rootNode,
sizeSet = this.sizeSet;
var childElementCount = 0;
if (this.isSharedViewSet()) {
var element = rootNode.firstElementChild;
while (element) {
if (element.tagName === this.childNodeType) {
childElementCount += 1;
} else if (sizeSet.isPlaceOn(_constants.WORKING_SPACE_TOP)) {
break;
}
element = element.nextElementSibling;
}
} else {
childElementCount = rootNode.childElementCount;
}
return childElementCount;
}
/**
* Setups and prepares all necessary properties and start the rendering process.
* This method has to be called only once (at the start) for the render cycle.
*/
}, {
key: "start",
value: function start() {
this.collectedNodes.length = 0;
this.visualIndex = 0;
var rootNode = this.rootNode,
sizeSet = this.sizeSet;
var isShared = this.isSharedViewSet();
var _sizeSet$getViewSize = sizeSet.getViewSize(),
nextSize = _sizeSet$getViewSize.nextSize;
var childElementCount = this.getRenderedChildCount();
while (childElementCount < nextSize) {
var newNode = this.nodesPool();
if (!isShared || isShared && sizeSet.isPlaceOn(_constants.WORKING_SPACE_BOTTOM)) {
rootNode.appendChild(newNode);
} else {
rootNode.insertBefore(newNode, rootNode.firstChild);
}
childElementCount += 1;
}
var isSharedPlacedOnTop = isShared && sizeSet.isPlaceOn(_constants.WORKING_SPACE_TOP);
while (childElementCount > nextSize) {
rootNode.removeChild(isSharedPlacedOnTop ? rootNode.firstChild : rootNode.lastChild);
childElementCount -= 1;
}
}
/**
* Renders the DOM element based on visual index (which is calculated internally).
* This method has to be called as many times as the size count is met (to cover all previously rendered DOM elements).
*/
}, {
key: "render",
value: function render() {
var rootNode = this.rootNode,
sizeSet = this.sizeSet;
var visualIndex = this.visualIndex;
if (this.isSharedViewSet() && sizeSet.isPlaceOn(_constants.WORKING_SPACE_BOTTOM)) {
visualIndex += sizeSet.sharedSize.nextSize;
}
var node = rootNode.childNodes[visualIndex];
if (node.tagName !== this.childNodeType) {
var newNode = this.nodesPool();
rootNode.replaceChild(newNode, node);
node = newNode;
}
this.collectedNodes.push(node);
this.visualIndex += 1;
}
/**
* Ends the render process.
* This method has to be called only once (at the end) for the render cycle.
*/
}, {
key: "end",
value: function end() {}
}]);
return OrderView;
}();
exports.default = OrderView;
/***/ }),
/* 222 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.WORKING_SPACE_BOTTOM = exports.WORKING_SPACE_TOP = exports.WORKING_SPACE_ALL = void 0;
/**
* Describes that ViewSizeSet instance doesn't share sizes with another
* instance (root node can contain only one type of children nodes).
*
* @type {Number}
*/
var WORKING_SPACE_ALL = 0;
/**
* Describes that ViewSizeSet instance share sizes with another instance and
* set working space for this instance to 'top' (root node can contain multiple
* types of children and this instance will be occupied top space of the root node).
*
* @type {Number}
*/
exports.WORKING_SPACE_ALL = WORKING_SPACE_ALL;
var WORKING_SPACE_TOP = 1;
/**
* Describes that ViewSizeSet instance share sizes with another instance and
* set working space for this instance to 'bottom' (root node can contain multiple
* types of children and this instance will be occupied bottom space of the root node).
*
* @type {Number}
*/
exports.WORKING_SPACE_TOP = WORKING_SPACE_TOP;
var WORKING_SPACE_BOTTOM = 2;
exports.WORKING_SPACE_BOTTOM = WORKING_SPACE_BOTTOM;
/***/ }),
/* 223 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(21);
var $padStart = __webpack_require__(428).start;
var WEBKIT_BUG = __webpack_require__(429);
// `String.prototype.padStart` method
// https://tc39.github.io/ecma262/#sec-string.prototype.padstart
$({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
padStart: function padStart(maxLength /* , fillString = ' ' */) {
return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
}
});
/***/ }),
/* 224 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toInteger = __webpack_require__(88);
var requireObjectCoercible = __webpack_require__(51);
// `String.prototype.repeat` method implementation
// https://tc39.github.io/ecma262/#sec-string.prototype.repeat
module.exports = ''.repeat || function repeat(count) {
var str = String(requireObjectCoercible(this));
var result = '';
var n = toInteger(count);
if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');
for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
return result;
};
/***/ }),
/* 225 */
/***/ (function(module, exports) {
/***/ }),
/* 226 */
/***/ (function(module, exports) {
/***/ }),
/* 227 */
/***/ (function(module, exports) {
/***/ }),
/* 228 */
/***/ (function(module, exports) {
/***/ }),
/* 229 */
/***/ (function(module, exports) {
/***/ }),
/* 230 */
/***/ (function(module, exports) {
/***/ }),
/* 231 */
/***/ (function(module, exports) {
/***/ }),
/* 232 */
/***/ (function(module, exports) {
/***/ }),
/* 233 */
/***/ (function(module, exports) {
/***/ }),
/* 234 */
/***/ (function(module, exports) {
/***/ }),
/* 235 */
/***/ (function(module, exports) {
/***/ }),
/* 236 */
/***/ (function(module, exports) {
/***/ }),
/* 237 */
/***/ (function(module, exports) {
/***/ }),
/* 238 */
/***/ (function(module, exports) {
/***/ }),
/* 239 */
/***/ (function(module, exports) {
/***/ }),
/* 240 */
/***/ (function(module, exports) {
/***/ }),
/* 241 */
/***/ (function(module, exports) {
/***/ }),
/* 242 */
/***/ (function(module, exports) {
/***/ }),
/* 243 */
/***/ (function(module, exports) {
/***/ }),
/* 244 */
/***/ (function(module, exports) {
/***/ }),
/* 245 */
/***/ (function(module, exports) {
/***/ }),
/* 246 */
/***/ (function(module, exports) {
/***/ }),
/* 247 */
/***/ (function(module, exports) {
/***/ }),
/* 248 */
/***/ (function(module, exports) {
/***/ }),
/* 249 */
/***/ (function(module, exports) {
/***/ }),
/* 250 */
/***/ (function(module, exports) {
/***/ }),
/* 251 */
/***/ (function(module, exports) {
/***/ }),
/* 252 */
/***/ (function(module, exports) {
/***/ }),
/* 253 */
/***/ (function(module, exports) {
/***/ }),
/* 254 */
/***/ (function(module, exports) {
/***/ }),
/* 255 */
/***/ (function(module, exports) {
/***/ }),
/* 256 */
/***/ (function(module, exports) {
/***/ }),
/* 257 */
/***/ (function(module, exports) {
/***/ }),
/* 258 */
/***/ (function(module, exports) {
/***/ }),
/* 259 */
/***/ (function(module, exports) {
/***/ }),
/* 260 */
/***/ (function(module, exports) {
/***/ }),
/* 261 */
/***/ (function(module, exports) {
/***/ }),
/* 262 */
/***/ (function(module, exports) {
/***/ }),
/* 263 */
/***/ (function(module, exports) {
/***/ }),
/* 264 */
/***/ (function(module, exports) {
/***/ }),
/* 265 */
/***/ (function(module, exports) {
/***/ }),
/* 266 */
/***/ (function(module, exports) {
/***/ }),
/* 267 */
/***/ (function(module, exports) {
/***/ }),
/* 268 */
/***/ (function(module, exports) {
/***/ }),
/* 269 */
/***/ (function(module, exports) {
/***/ }),
/* 270 */
/***/ (function(module, exports) {
/***/ }),
/* 271 */
/***/ (function(module, exports) {
/***/ }),
/* 272 */
/***/ (function(module, exports) {
/***/ }),
/* 273 */
/***/ (function(module, exports) {
/***/ }),
/* 274 */
/***/ (function(module, exports) {
/***/ }),
/* 275 */
/***/ (function(module, exports) {
/***/ }),
/* 276 */
/***/ (function(module, exports) {
/***/ }),
/* 277 */
/***/ (function(module, exports) {
/***/ }),
/* 278 */
/***/ (function(module, exports) {
/***/ }),
/* 279 */
/***/ (function(module, exports) {
/***/ }),
/* 280 */
/***/ (function(module, exports) {
/***/ }),
/* 281 */
/***/ (function(module, exports) {
/***/ }),
/* 282 */
/***/ (function(module, exports) {
/***/ }),
/* 283 */
/***/ (function(module, exports) {
/***/ }),
/* 284 */
/***/ (function(module, exports) {
/***/ }),
/* 285 */
/***/ (function(module, exports) {
/***/ }),
/* 286 */
/***/ (function(module, exports) {
/***/ }),
/* 287 */
/***/ (function(module, exports) {
/***/ }),
/* 288 */
/***/ (function(module, exports) {
/***/ }),
/* 289 */
/***/ (function(module, exports) {
/***/ }),
/* 290 */
/***/ (function(module, exports) {
/***/ }),
/* 291 */
/***/ (function(module, exports) {
/***/ }),
/* 292 */
/***/ (function(module, exports) {
/***/ }),
/* 293 */
/***/ (function(module, exports) {
/***/ }),
/* 294 */
/***/ (function(module, exports) {
/***/ }),
/* 295 */
/***/ (function(module, exports) {
/***/ }),
/* 296 */
/***/ (function(module, exports) {
/***/ }),
/* 297 */
/***/ (function(module, exports) {
/***/ }),
/* 298 */
/***/ (function(module, exports) {
/***/ }),
/* 299 */
/***/ (function(module, exports) {
/***/ }),
/* 300 */
/***/ (function(module, exports) {
/***/ }),
/* 301 */
/***/ (function(module, exports) {
/***/ }),
/* 302 */
/***/ (function(module, exports) {
/***/ }),
/* 303 */
/***/ (function(module, exports) {
/***/ }),
/* 304 */
/***/ (function(module, exports) {
/***/ }),
/* 305 */
/***/ (function(module, exports) {
/***/ }),
/* 306 */
/***/ (function(module, exports) {
/***/ }),
/* 307 */
/***/ (function(module, exports) {
/***/ }),
/* 308 */
/***/ (function(module, exports) {
/***/ }),
/* 309 */
/***/ (function(module, exports) {
/***/ }),
/* 310 */
/***/ (function(module, exports) {
/***/ }),
/* 311 */
/***/ (function(module, exports) {
/***/ }),
/* 312 */
/***/ (function(module, exports) {
/***/ }),
/* 313 */
/***/ (function(module, exports) {
/***/ }),
/* 314 */
/***/ (function(module, exports) {
/***/ }),
/* 315 */
/***/ (function(module, exports) {
/***/ }),
/* 316 */
/***/ (function(module, exports) {
/***/ }),
/* 317 */
/***/ (function(module, exports) {
/***/ }),
/* 318 */
/***/ (function(module, exports) {
/***/ }),
/* 319 */
/***/ (function(module, exports) {
/***/ }),
/* 320 */
/***/ (function(module, exports) {
/***/ }),
/* 321 */
/***/ (function(module, exports) {
/***/ }),
/* 322 */
/***/ (function(module, exports) {
/***/ }),
/* 323 */
/***/ (function(module, exports) {
/***/ }),
/* 324 */
/***/ (function(module, exports) {
/***/ }),
/* 325 */
/***/ (function(module, exports) {
/***/ }),
/* 326 */
/***/ (function(module, exports) {
/***/ }),
/* 327 */
/***/ (function(module, exports) {
/***/ }),
/* 328 */
/***/ (function(module, exports) {
/***/ }),
/* 329 */
/***/ (function(module, exports) {
/***/ }),
/* 330 */
/***/ (function(module, exports) {
/***/ }),
/* 331 */
/***/ (function(module, exports) {
/***/ }),
/* 332 */
/***/ (function(module, exports) {
/***/ }),
/* 333 */
/***/ (function(module, exports) {
/***/ }),
/* 334 */
/***/ (function(module, exports) {
/***/ }),
/* 335 */
/***/ (function(module, exports) {
/***/ }),
/* 336 */
/***/ (function(module, exports) {
/***/ }),
/* 337 */
/***/ (function(module, exports) {
/***/ }),
/* 338 */
/***/ (function(module, exports) {
/***/ }),
/* 339 */
/***/ (function(module, exports) {
/***/ }),
/* 340 */
/***/ (function(module, exports) {
/***/ }),
/* 341 */
/***/ (function(module, exports) {
/***/ }),
/* 342 */
/***/ (function(module, exports) {
/***/ }),
/* 343 */
/***/ (function(module, exports) {
/***/ }),
/* 344 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(13);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _element = __webpack_require__(8);
var _object = __webpack_require__(4);
var _string = __webpack_require__(76);
var _event = _interopRequireDefault(__webpack_require__(345));
var _overlays = _interopRequireDefault(__webpack_require__(346));
var _scroll = _interopRequireDefault(__webpack_require__(347));
var _settings = _interopRequireDefault(__webpack_require__(348));
var _master = _interopRequireDefault(__webpack_require__(216));
var _viewport = _interopRequireDefault(__webpack_require__(349));
/**
* @class Walkontable
*/
var Walkontable =
/*#__PURE__*/
function () {
/**
* @param {Object} settings
*/
function Walkontable(settings) {
(0, _classCallCheck2.default)(this, Walkontable);
var originalHeaders = []; // this is the namespace for global events
this.guid = "wt_".concat((0, _string.randomString)());
this.rootDocument = settings.table.ownerDocument;
this.rootWindow = this.rootDocument.defaultView; // bootstrap from settings
if (settings.cloneSource) {
this.cloneSource = settings.cloneSource;
this.cloneOverlay = settings.cloneOverlay;
this.wtSettings = settings.cloneSource.wtSettings;
this.wtTable = this.cloneOverlay.createTable(this, settings.table);
this.wtScroll = new _scroll.default(this);
this.wtViewport = settings.cloneSource.wtViewport;
this.wtEvent = new _event.default(this);
this.selections = this.cloneSource.selections;
} else {
this.wtSettings = new _settings.default(this, settings);
this.wtTable = new _master.default(this, settings.table);
this.wtScroll = new _scroll.default(this);
this.wtViewport = new _viewport.default(this);
this.wtEvent = new _event.default(this);
this.selections = this.getSetting('selections');
this.wtOverlays = new _overlays.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}
*/
(0, _createClass2.default)(Walkontable, [{
key: "draw",
value: function draw() {
var fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
this.drawInterrupted = false;
if (!fastDraw && !this.wtTable.isVisible()) {
// 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);
}
/**
* Scrolls the viewport to a cell (rerenders if needed).
*
* @param {CellCoords} coords
* @param {Boolean} [snapToTop]
* @param {Boolean} [snapToRight]
* @param {Boolean} [snapToBottom]
* @param {Boolean} [snapToLeft]
* @returns {Boolean}
*/
}, {
key: "scrollViewport",
value: function scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
if (coords.col < 0 || coords.row < 0) {
return false;
}
return this.wtScroll.scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft);
}
/**
* Scrolls the viewport to a column (rerenders if needed).
*
* @param {Number} column Visual column index.
* @param {Boolean} [snapToRight]
* @param {Boolean} [snapToLeft]
* @returns {Boolean}
*/
}, {
key: "scrollViewportHorizontally",
value: function scrollViewportHorizontally(column, snapToRight, snapToLeft) {
if (column < 0) {
return false;
}
return this.wtScroll.scrollViewportHorizontally(column, snapToRight, snapToLeft);
}
/**
* Scrolls the viewport to a row (rerenders if needed).
*
* @param {Number} row Visual row index.
* @param {Boolean} [snapToTop]
* @param {Boolean} [snapToBottom]
* @returns {Boolean}
*/
}, {
key: "scrollViewportVertically",
value: function scrollViewportVertically(row, snapToTop, snapToBottom) {
if (row < 0) {
return false;
}
return this.wtScroll.scrollViewportVertically(row, snapToTop, snapToBottom);
}
/**
* @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';
}
/**
* 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".concat((0, _string.toUpperCaseFirst)(key)));
}
allClassNames.push("ht".concat((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;
}();
var _default = Walkontable;
exports.default = _default;
/***/ }),
/* 345 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(25);
__webpack_require__(14);
__webpack_require__(9);
__webpack_require__(12);
__webpack_require__(23);
__webpack_require__(16);
__webpack_require__(33);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _element = __webpack_require__(8);
var _function = __webpack_require__(63);
var _feature = __webpack_require__(79);
var _browser = __webpack_require__(75);
var _eventManager = _interopRequireDefault(__webpack_require__(24));
var privatePool = new WeakMap();
/**
* @class Event
*/
var Event =
/*#__PURE__*/
function () {
/**
* @param {*} instance Walkontable instance.
*/
function Event(instance) {
(0, _classCallCheck2.default)(this, Event);
/**
* Instance of {@link Walkontable}.
*
* @private
* @type {Walkontable}
*/
this.instance = instance;
/**
* Instance of {@link EventManager}.
*
* @private
* @type {EventManager}
*/
this.eventManager = new _eventManager.default(instance);
privatePool.set(this, {
selectedCellBeforeTouchEnd: void 0,
dblClickTimeout: [null, null],
dblClickOrigin: [null, null]
});
this.registerEvents();
}
/**
* Adds listeners for mouse and touch events.
*
* @private
*/
(0, _createClass2.default)(Event, [{
key: "registerEvents",
value: function registerEvents() {
var _this = this;
this.eventManager.addEventListener(this.instance.wtTable.holder, 'contextmenu', function (event) {
return _this.onContextMenu(event);
});
this.eventManager.addEventListener(this.instance.wtTable.TABLE, 'mouseover', function (event) {
return _this.onMouseOver(event);
});
this.eventManager.addEventListener(this.instance.wtTable.TABLE, 'mouseout', function (event) {
return _this.onMouseOut(event);
});
var initTouchEvents = function initTouchEvents() {
_this.eventManager.addEventListener(_this.instance.wtTable.holder, 'touchstart', function (event) {
return _this.onTouchStart(event);
});
_this.eventManager.addEventListener(_this.instance.wtTable.holder, 'touchend', function (event) {
return _this.onTouchEnd(event);
});
if (!_this.instance.momentumScrolling) {
_this.instance.momentumScrolling = {};
}
_this.eventManager.addEventListener(_this.instance.wtTable.holder, 'scroll', function () {
clearTimeout(_this.instance.momentumScrolling._timeout);
if (!_this.instance.momentumScrolling.ongoing) {
_this.instance.getSetting('onBeforeTouchScroll');
}
_this.instance.momentumScrolling.ongoing = true;
_this.instance.momentumScrolling._timeout = setTimeout(function () {
if (!_this.instance.touchApplied) {
_this.instance.momentumScrolling.ongoing = false;
_this.instance.getSetting('onAfterMomentumScroll');
}
}, 200);
});
};
var initMouseEvents = function initMouseEvents() {
_this.eventManager.addEventListener(_this.instance.wtTable.holder, 'mouseup', function (event) {
return _this.onMouseUp(event);
});
_this.eventManager.addEventListener(_this.instance.wtTable.holder, 'mousedown', function (event) {
return _this.onMouseDown(event);
});
};
if ((0, _browser.isMobileBrowser)()) {
initTouchEvents();
} else {
// PC like devices which support both methods (touchscreen and ability to plug-in mouse).
if ((0, _feature.isTouchSupported)()) {
initTouchEvents();
}
initMouseEvents();
}
}
/**
* Checks if an element is already selected.
*
* @private
* @param {Element} touchTarget
* @returns {Boolean}
*/
}, {
key: "selectedCellWasTouched",
value: function selectedCellWasTouched(touchTarget) {
var priv = privatePool.get(this);
var cellUnderFinger = this.parentCell(touchTarget);
var coordsOfCellUnderFinger = cellUnderFinger.coords;
if (priv.selectedCellBeforeTouchEnd && coordsOfCellUnderFinger) {
var _ref = [coordsOfCellUnderFinger.row, priv.selectedCellBeforeTouchEnd.from.row],
rowTouched = _ref[0],
rowSelected = _ref[1];
var _ref2 = [coordsOfCellUnderFinger.col, priv.selectedCellBeforeTouchEnd.from.col],
colTouched = _ref2[0],
colSelected = _ref2[1];
return rowTouched === rowSelected && colTouched === colSelected;
}
return false;
}
/**
* Gets closest TD or TH element.
*
* @private
* @param {Element} elem
* @returns {Object} Contains coordinates and reference to TD or TH if it exists. Otherwise it's empty object.
*/
}, {
key: "parentCell",
value: function parentCell(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.getCell().cellRange.highlight;
cell.TD = this.instance.wtTable.getCell(cell.coords);
} else if ((0, _element.hasClass)(elem, 'wtBorder') && (0, _element.hasClass)(elem, 'area')) {
if (this.instance.selections.createOrGetArea().cellRange) {
cell.coords = this.instance.selections.createOrGetArea().cellRange.to;
cell.TD = this.instance.wtTable.getCell(cell.coords);
}
}
return cell;
}
/**
* onMouseDown callback.
*
* @private
* @param {MouseEvent} event
*/
}, {
key: "onMouseDown",
value: function onMouseDown(event) {
var priv = privatePool.get(this);
var activeElement = this.instance.rootDocument.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 = this.parentCell(realTarget);
if ((0, _element.hasClass)(realTarget, 'corner')) {
this.instance.getSetting('onCellCornerMouseDown', event, realTarget);
} else if (cell.TD && this.instance.hasSetting('onCellMouseDown')) {
this.instance.getSetting('onCellMouseDown', event, cell.coords, cell.TD, this.instance);
}
if (event.button !== 2 && cell.TD) {
// if not right mouse button
priv.dblClickOrigin[0] = cell.TD;
clearTimeout(priv.dblClickTimeout[0]);
priv.dblClickTimeout[0] = setTimeout(function () {
priv.dblClickOrigin[0] = null;
}, 1000);
}
}
/**
* onContextMenu callback.
*
* @private
* @param {MouseEvent} event
*/
}, {
key: "onContextMenu",
value: function onContextMenu(event) {
if (this.instance.hasSetting('onCellContextMenu')) {
var cell = this.parentCell(event.realTarget);
if (cell.TD) {
this.instance.getSetting('onCellContextMenu', event, cell.coords, cell.TD, this.instance);
}
}
}
/**
* onMouseOver callback.
*
* @private
* @param {MouseEvent} event
*/
}, {
key: "onMouseOver",
value: function onMouseOver(event) {
if (!this.instance.hasSetting('onCellMouseOver')) {
return;
}
var table = this.instance.wtTable.TABLE;
var td = (0, _element.closestDown)(event.realTarget, ['TD', 'TH'], table);
var mainWOT = this.instance.cloneSource || this.instance;
if (td && td !== mainWOT.lastMouseOver && (0, _element.isChildOf)(td, table)) {
mainWOT.lastMouseOver = td;
this.instance.getSetting('onCellMouseOver', event, this.instance.wtTable.getCoords(td), td, this.instance);
}
}
/**
* onMouseOut callback.
*
* @private
* @param {MouseEvent} event
*/
}, {
key: "onMouseOut",
value: function onMouseOut(event) {
if (!this.instance.hasSetting('onCellMouseOut')) {
return;
}
var table = this.instance.wtTable.TABLE;
var lastTD = (0, _element.closestDown)(event.realTarget, ['TD', 'TH'], table);
var nextTD = (0, _element.closestDown)(event.relatedTarget, ['TD', 'TH'], table);
if (lastTD && lastTD !== nextTD && (0, _element.isChildOf)(lastTD, table)) {
this.instance.getSetting('onCellMouseOut', event, this.instance.wtTable.getCoords(lastTD), lastTD, this.instance);
}
}
/**
* onMouseUp callback.
*
* @private
* @param {MouseEvent} event
*/
}, {
key: "onMouseUp",
value: function onMouseUp(event) {
if (event.button === 2) {
return;
} // if not right mouse button
var priv = privatePool.get(this);
var cell = this.parentCell(event.realTarget);
if (cell.TD && this.instance.hasSetting('onCellMouseUp')) {
this.instance.getSetting('onCellMouseUp', event, cell.coords, cell.TD, this.instance);
}
if (cell.TD === priv.dblClickOrigin[0] && cell.TD === priv.dblClickOrigin[1]) {
if ((0, _element.hasClass)(event.realTarget, 'corner')) {
this.instance.getSetting('onCellCornerDblClick', event, cell.coords, cell.TD, this.instance);
} else {
this.instance.getSetting('onCellDblClick', event, cell.coords, cell.TD, this.instance);
}
priv.dblClickOrigin[0] = null;
priv.dblClickOrigin[1] = null;
} else if (cell.TD === priv.dblClickOrigin[0]) {
priv.dblClickOrigin[1] = cell.TD;
clearTimeout(priv.dblClickTimeout[1]);
priv.dblClickTimeout[1] = setTimeout(function () {
priv.dblClickOrigin[1] = null;
}, 500);
}
}
/**
* onTouchStart callback. Simulates mousedown event.
*
* @private
* @param {MouseEvent} event
*/
}, {
key: "onTouchStart",
value: function onTouchStart(event) {
var priv = privatePool.get(this);
priv.selectedCellBeforeTouchEnd = this.instance.selections.getCell().cellRange;
this.instance.touchApplied = true;
this.onMouseDown(event);
}
/**
* onTouchEnd callback. Simulates mouseup event.
*
* @private
* @param {MouseEvent} event
*/
}, {
key: "onTouchEnd",
value: function onTouchEnd(event) {
var excludeTags = ['A', 'BUTTON', 'INPUT'];
var target = event.target;
this.instance.touchApplied = false; // When the standard event was performed on the link element (a cell which contains HTML `a` element) then here
// we check if it should be canceled. Click is blocked in a situation when the element is rendered outside
// selected cells. This prevents accidentally page reloads while selecting adjacent cells.
if (this.selectedCellWasTouched(target) === false && excludeTags.includes(target.tagName)) {
event.preventDefault();
}
this.onMouseUp(event);
}
/**
* Clears double-click timeouts and destroys the internal eventManager instance.
*/
}, {
key: "destroy",
value: function destroy() {
var priv = privatePool.get(this);
clearTimeout(priv.dblClickTimeout[0]);
clearTimeout(priv.dblClickTimeout[1]);
this.eventManager.destroy();
}
}]);
return Event;
}();
var _default = Event;
exports.default = _default;
/***/ }),
/* 346 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(73);
__webpack_require__(33);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _element = __webpack_require__(8);
var _array = __webpack_require__(3);
var _unicode = __webpack_require__(57);
var _browser = __webpack_require__(75);
var _eventManager = _interopRequireDefault(__webpack_require__(24));
var _base = _interopRequireDefault(__webpack_require__(90));
/**
* @class Overlays
*/
var Overlays =
/*#__PURE__*/
function () {
/**
* @param {Walkontable} wotInstance
*/
function Overlays(wotInstance) {
(0, _classCallCheck2.default)(this, Overlays);
/**
* Walkontable instance's reference.
*
* @private
* @type {Walkontable}
*/
this.wot = wotInstance;
var _this$wot = this.wot,
rootDocument = _this$wot.rootDocument,
rootWindow = _this$wot.rootWindow,
wtTable = _this$wot.wtTable;
/**
* Sometimes `line-height` might be set to 'normal'. In that case, a default `font-size` should be multiplied by roughly 1.2.
* https://developer.mozilla.org/pl/docs/Web/CSS/line-height#Values
*/
var BODY_LINE_HEIGHT = parseInt(rootWindow.getComputedStyle(rootDocument.body).lineHeight, 10);
var FALLBACK_BODY_LINE_HEIGHT = parseInt(rootWindow.getComputedStyle(rootDocument.body).fontSize, 10) * 1.2; // legacy support
this.instance = this.wot;
this.eventManager = new _eventManager.default(this.wot);
this.scrollbarSize = (0, _element.getScrollbarWidth)(rootDocument);
this.wot.update('scrollbarWidth', this.scrollbarSize);
this.wot.update('scrollbarHeight', this.scrollbarSize);
var isOverflowHidden = rootWindow.getComputedStyle(wtTable.wtRootElement.parentNode).getPropertyValue('overflow') === 'hidden';
this.scrollableElement = isOverflowHidden ? wtTable.holder : (0, _element.getScrollableElement)(wtTable.TABLE);
this.topOverlay = void 0;
this.bottomOverlay = void 0;
this.leftOverlay = void 0;
this.topLeftCornerOverlay = void 0;
this.bottomLeftCornerOverlay = void 0;
this.prepareOverlays();
this.hasScrollbarBottom = false;
this.hasScrollbarRight = false;
this.destroyed = false;
this.keyPressed = false;
this.spreaderLastSize = {
width: null,
height: null
};
this.verticalScrolling = false;
this.horizontalScrolling = false;
this.browserLineHeight = BODY_LINE_HEIGHT || FALLBACK_BODY_LINE_HEIGHT;
this.registerListeners();
this.lastScrollX = rootWindow.scrollX;
this.lastScrollY = rootWindow.scrollY;
}
/**
* Prepare overlays based on user settings.
*
* @returns {Boolean} Returns `true` if changes applied to overlay needs scroll synchronization.
*/
(0, _createClass2.default)(Overlays, [{
key: "prepareOverlays",
value: function prepareOverlays() {
var syncScroll = false;
if (this.topOverlay) {
syncScroll = this.topOverlay.updateStateOfRendering() || syncScroll;
} else {
this.topOverlay = _base.default.createOverlay(_base.default.CLONE_TOP, this.wot);
}
if (!_base.default.hasOverlay(_base.default.CLONE_BOTTOM)) {
this.bottomOverlay = {
needFullRender: false,
updateStateOfRendering: function updateStateOfRendering() {
return false;
}
};
}
if (!_base.default.hasOverlay(_base.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 = _base.default.createOverlay(_base.default.CLONE_BOTTOM, this.wot);
}
if (this.leftOverlay) {
syncScroll = this.leftOverlay.updateStateOfRendering() || syncScroll;
} else {
this.leftOverlay = _base.default.createOverlay(_base.default.CLONE_LEFT, this.wot);
}
if (this.topOverlay.needFullRender && this.leftOverlay.needFullRender) {
if (this.topLeftCornerOverlay) {
syncScroll = this.topLeftCornerOverlay.updateStateOfRendering() || syncScroll;
} else {
this.topLeftCornerOverlay = _base.default.createOverlay(_base.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 = _base.default.createOverlay(_base.default.CLONE_BOTTOM_LEFT_CORNER, this.wot);
}
}
if (this.wot.getSetting('debug') && !this.debug) {
this.debug = _base.default.createOverlay(_base.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 _this$wot2 = this.wot,
rootDocument = _this$wot2.rootDocument,
rootWindow = _this$wot2.rootWindow;
var topOverlayScrollableElement = this.topOverlay.mainTableScrollableElement;
var leftOverlayScrollableElement = this.leftOverlay.mainTableScrollableElement;
this.eventManager.addEventListener(rootDocument.documentElement, 'keydown', function (event) {
return _this.onKeyDown(event);
});
this.eventManager.addEventListener(rootDocument.documentElement, 'keyup', function () {
return _this.onKeyUp();
});
this.eventManager.addEventListener(rootDocument, 'visibilitychange', function () {
return _this.onKeyUp();
});
this.eventManager.addEventListener(topOverlayScrollableElement, 'scroll', function (event) {
return _this.onTableScroll(event);
}, {
passive: true
});
if (topOverlayScrollableElement !== leftOverlayScrollableElement) {
this.eventManager.addEventListener(leftOverlayScrollableElement, 'scroll', function (event) {
return _this.onTableScroll(event);
}, {
passive: true
});
}
var isHighPixelRatio = rootWindow.devicePixelRatio && rootWindow.devicePixelRatio > 1;
var isScrollOnWindow = this.scrollableElement === rootWindow;
var preventWheel = this.wot.wtSettings.getSetting('preventWheel');
var wheelEventOptions = {
passive: isScrollOnWindow
};
if (preventWheel || isHighPixelRatio || !(0, _browser.isChrome)()) {
this.eventManager.addEventListener(this.wot.wtTable.wtRootElement, 'wheel', function (event) {
return _this.onCloneWheel(event, preventWheel);
}, wheelEventOptions);
}
var overlays = [this.topOverlay, this.bottomOverlay, this.leftOverlay, this.topLeftCornerOverlay, this.bottomLeftCornerOverlay];
overlays.forEach(function (overlay) {
if (overlay && overlay.needFullRender) {
var holder = overlay.clone.wtTable.holder;
_this.eventManager.addEventListener(holder, 'wheel', function (event) {
return _this.onCloneWheel(event, preventWheel);
}, wheelEventOptions);
}
});
var resizeTimeout;
this.eventManager.addEventListener(rootWindow, 'resize', function () {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function () {
_this.wot.getSetting('onWindowResize');
}, 200);
});
}
/**
* Deregister all previously registered listeners.
*/
}, {
key: "deregisterListeners",
value: function deregisterListeners() {
this.eventManager.clearEvents(true);
}
/**
* Scroll listener
*
* @param {Event} event
*/
}, {
key: "onTableScroll",
value: function onTableScroll(event) {
// There was if statement which controlled flow of this function. It avoided the execution of the next lines
// on mobile devices. It was changed. Broader description of this case is included within issue #4856.
var rootWindow = this.wot.rootWindow;
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 !== rootWindow && target !== rootWindow && !event.target.contains(masterVertical) || masterHorizontal !== rootWindow && target !== rootWindow && !event.target.contains(masterHorizontal)) {
return;
}
}
this.syncScrollPositions(event);
}
/**
* Wheel listener for cloned overlays.
*
* @param {Event} event
*/
}, {
key: "onCloneWheel",
value: function onCloneWheel(event, preventDefault) {
var rootWindow = this.wot.rootWindow; // There was if statement which controlled flow of this function. It avoided the execution of the next lines
// on mobile devices. It was changed. Broader description of this case is included within issue #4856.
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
var shouldNotWheelVertically = masterVertical !== rootWindow && target !== rootWindow && !target.contains(masterVertical);
var shouldNotWheelHorizontally = masterHorizontal !== rootWindow && target !== rootWindow && !target.contains(masterHorizontal);
if (this.keyPressed && (shouldNotWheelVertically || shouldNotWheelHorizontally)) {
return;
}
var isScrollPossible = this.translateMouseWheelToScroll(event);
if (preventDefault || this.scrollableElement !== rootWindow && isScrollPossible) {
event.preventDefault();
}
}
/**
* 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
*/
}, {
key: "translateMouseWheelToScroll",
value: function translateMouseWheelToScroll(event) {
var browserLineHeight = this.browserLineHeight;
var deltaY = isNaN(event.deltaY) ? -1 * event.wheelDeltaY : event.deltaY;
var deltaX = isNaN(event.deltaX) ? -1 * event.wheelDeltaX : event.deltaX;
if (event.deltaMode === 1) {
deltaX += deltaX * browserLineHeight;
deltaY += deltaY * browserLineHeight;
}
var isScrollVerticallyPossible = this.scrollVertically(deltaY);
var isScrollHorizontallyPossible = this.scrollHorizontally(deltaX);
return isScrollVerticallyPossible || isScrollHorizontallyPossible;
}
/**
* Scrolls main scrollable element horizontally.
*
* @param {Number} delta Relative value to scroll.
*/
}, {
key: "scrollVertically",
value: function scrollVertically(delta) {
var previousScroll = this.scrollableElement.scrollTop;
this.scrollableElement.scrollTop += delta;
return previousScroll !== this.scrollableElement.scrollTop;
}
/**
* Scrolls main scrollable element horizontally.
*
* @param {Number} delta Relative value to scroll.
*/
}, {
key: "scrollHorizontally",
value: function scrollHorizontally(delta) {
var previousScroll = this.scrollableElement.scrollLeft;
this.scrollableElement.scrollLeft += delta;
return previousScroll !== this.scrollableElement.scrollLeft;
}
/**
* Synchronize scroll position between master table and overlay table.
*
* @private
*/
}, {
key: "syncScrollPositions",
value: function syncScrollPositions() {
if (this.destroyed) {
return;
}
var rootWindow = this.wot.rootWindow;
var topHolder = this.topOverlay.clone.wtTable.holder;
var leftHolder = this.leftOverlay.clone.wtTable.holder;
var _ref = [this.scrollableElement.scrollLeft, this.scrollableElement.scrollTop],
scrollLeft = _ref[0],
scrollTop = _ref[1];
this.horizontalScrolling = topHolder.scrollLeft !== scrollLeft || this.lastScrollX !== rootWindow.scrollX;
this.verticalScrolling = leftHolder.scrollTop !== scrollTop || this.lastScrollY !== rootWindow.scrollY;
this.lastScrollX = rootWindow.scrollX;
this.lastScrollY = rootWindow.scrollY;
if (this.horizontalScrolling) {
topHolder.scrollLeft = scrollLeft;
var bottomHolder = this.bottomOverlay.needFullRender ? this.bottomOverlay.clone.wtTable.holder : null;
if (bottomHolder) {
bottomHolder.scrollLeft = scrollLeft;
}
}
if (this.verticalScrolling) {
leftHolder.scrollTop = scrollTop;
}
this.refreshAll();
}
/**
* 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();
}
var _this$wot3 = this.wot,
rootWindow = _this$wot3.rootWindow,
wtTable = _this$wot3.wtTable;
if (rootWindow.getComputedStyle(wtTable.wtRootElement.parentNode).getPropertyValue('overflow') === 'hidden') {
this.scrollableElement = wtTable.holder;
} else {
this.scrollableElement = (0, _element.getScrollableElement)(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 _this$wot4 = this.wot,
wtViewport = _this$wot4.wtViewport,
wtTable = _this$wot4.wtTable;
var totalColumns = this.wot.getSetting('totalColumns');
var totalRows = this.wot.getSetting('totalRows');
var headerRowSize = wtViewport.getRowHeaderWidth();
var headerColumnSize = wtViewport.getColumnHeaderHeight();
var hiderStyle = wtTable.hider.style;
hiderStyle.width = "".concat(headerRowSize + this.leftOverlay.sumCellSizes(0, totalColumns), "px");
hiderStyle.height = "".concat(headerColumnSize + this.topOverlay.sumCellSizes(0, totalRows) + 1, "px");
if (this.scrollbarSize > 0) {
var _wtTable$wtRootElemen = wtTable.wtRootElement,
rootElemScrollHeight = _wtTable$wtRootElemen.scrollHeight,
rootElemScrollWidth = _wtTable$wtRootElemen.scrollWidth;
var _wtTable$holder = wtTable.holder,
holderScrollHeight = _wtTable$holder.scrollHeight,
holderScrollWidth = _wtTable$holder.scrollWidth;
this.hasScrollbarRight = rootElemScrollHeight < holderScrollHeight;
this.hasScrollbarBottom = rootElemScrollWidth < holderScrollWidth;
if (this.hasScrollbarRight && wtTable.hider.scrollWidth + this.scrollbarSize > rootElemScrollWidth) {
this.hasScrollbarBottom = true;
} else if (this.hasScrollbarBottom && wtTable.hider.scrollHeight + this.scrollbarSize > rootElemScrollHeight) {
this.hasScrollbarRight = true;
}
}
this.topOverlay.adjustElementsSize(force);
this.leftOverlay.adjustElementsSize(force);
this.bottomOverlay.adjustElementsSize(force);
}
/**
*
*/
}, {
key: "applyToDOM",
value: function applyToDOM() {
var wtTable = this.wot.wtTable;
if (!wtTable.isVisible()) {
return;
}
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) {
if (!elem) {
return;
}
if (elem.clone && elem.clone.wtTable.TABLE.contains(element)) {
result = elem.clone;
}
});
return result;
}
}]);
return Overlays;
}();
var _default = Overlays;
exports.default = _default;
/***/ }),
/* 347 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _element = __webpack_require__(8);
/**
* @class Scroll
*/
var Scroll =
/*#__PURE__*/
function () {
/**
* @param {Walkontable} wotInstance
*/
function Scroll(wotInstance) {
(0, _classCallCheck2.default)(this, Scroll);
this.wot = wotInstance;
}
/**
* Scrolls viewport to a cell.
*
* @param {CellCoords} coords
* @param {Boolean} [snapToTop]
* @param {Boolean} [snapToRight]
* @param {Boolean} [snapToBottom]
* @param {Boolean} [snapToLeft]
* @returns {Boolean}
*/
(0, _createClass2.default)(Scroll, [{
key: "scrollViewport",
value: function scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
if (coords.col < 0 || coords.row < 0) {
return false;
}
var scrolledHorizontally = this.scrollViewportHorizontally(coords.col, snapToRight, snapToLeft);
var scrolledVertically = this.scrollViewportVertically(coords.row, snapToTop, snapToBottom);
return scrolledHorizontally || scrolledVertically;
}
/**
* Scrolls viewport to a column.
*
* @param {Number} column Visual column index.
* @param {Boolean} [snapToRight]
* @param {Boolean} [snapToLeft]
* @returns {Boolean}
*/
}, {
key: "scrollViewportHorizontally",
value: function scrollViewportHorizontally(column, snapToRight, snapToLeft) {
if (!this.wot.drawn) {
return false;
}
var _this$_getVariables = this._getVariables(),
fixedColumnsLeft = _this$_getVariables.fixedColumnsLeft,
leftOverlay = _this$_getVariables.leftOverlay,
totalColumns = _this$_getVariables.totalColumns;
var result = false;
if (column >= 0 && column <= Math.max(totalColumns - 1, 0)) {
var firstVisibleColumn = this.getFirstVisibleColumn();
var lastVisibleColumn = this.getLastVisibleColumn();
if (column >= fixedColumnsLeft && firstVisibleColumn > -1 && (column < firstVisibleColumn || snapToLeft)) {
result = leftOverlay.scrollTo(column);
} else if (lastVisibleColumn === -1 || lastVisibleColumn > -1 && (column > lastVisibleColumn || snapToRight)) {
result = leftOverlay.scrollTo(column, true);
}
}
return result;
}
/**
* Scrolls viewport to a row.
*
* @param {Number} row Visual row index.
* @param {Boolean} [snapToTop]
* @param {Boolean} [snapToBottom]
* @returns {Boolean}
*/
}, {
key: "scrollViewportVertically",
value: function scrollViewportVertically(row, snapToTop, snapToBottom) {
if (!this.wot.drawn) {
return false;
}
var _this$_getVariables2 = this._getVariables(),
fixedRowsBottom = _this$_getVariables2.fixedRowsBottom,
fixedRowsTop = _this$_getVariables2.fixedRowsTop,
topOverlay = _this$_getVariables2.topOverlay,
totalRows = _this$_getVariables2.totalRows;
var result = false;
if (row >= 0 && row <= Math.max(totalRows - 1, 0)) {
var firstVisibleRow = this.getFirstVisibleRow();
var lastVisibleRow = this.getLastVisibleRow();
if (row >= fixedRowsTop && firstVisibleRow > -1 && (row < firstVisibleRow || snapToTop)) {
result = topOverlay.scrollTo(row);
} else if (lastVisibleRow === -1 || lastVisibleRow > -1 && (row > lastVisibleRow && row < totalRows - fixedRowsBottom || snapToBottom)) {
result = topOverlay.scrollTo(row, true);
}
}
return result;
}
/**
* 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 _this$_getVariables3 = this._getVariables(),
topOverlay = _this$_getVariables3.topOverlay,
wtTable = _this$_getVariables3.wtTable,
wtViewport = _this$_getVariables3.wtViewport,
totalRows = _this$_getVariables3.totalRows,
fixedRowsTop = _this$_getVariables3.fixedRowsTop;
var rootWindow = this.wot.rootWindow;
var firstVisibleRow = wtTable.getFirstVisibleRow();
if (topOverlay.mainTableScrollableElement === rootWindow) {
var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
var totalTableHeight = (0, _element.innerHeight)(wtTable.hider);
var windowHeight = (0, _element.innerHeight)(rootWindow);
var windowScrollTop = (0, _element.getScrollTop)(rootWindow, rootWindow); // 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);
for (var row = totalRows; row > 0; row--) {
rowsHeight += topOverlay.sumCellSizes(row - 1, row);
if (rootElementOffset.top + totalTableHeight - rowsHeight <= windowScrollTop) {
// Return physical row + 1
firstVisibleRow = row;
break;
}
}
}
}
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 _this$_getVariables4 = this._getVariables(),
topOverlay = _this$_getVariables4.topOverlay,
wtTable = _this$_getVariables4.wtTable,
wtViewport = _this$_getVariables4.wtViewport,
totalRows = _this$_getVariables4.totalRows;
var rootWindow = this.wot.rootWindow;
var lastVisibleRow = wtTable.getLastVisibleRow();
if (topOverlay.mainTableScrollableElement === rootWindow) {
var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
var windowScrollTop = (0, _element.getScrollTop)(rootWindow, rootWindow); // Only calculate lastVisibleRow when table didn't filled (from bottom) whole viewport space
if (rootElementOffset.top > windowScrollTop) {
var windowHeight = (0, _element.innerHeight)(rootWindow);
var rowsHeight = wtViewport.getColumnHeaderHeight();
for (var row = 1; row <= totalRows; 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;
break;
}
}
}
}
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 _this$_getVariables5 = this._getVariables(),
leftOverlay = _this$_getVariables5.leftOverlay,
wtTable = _this$_getVariables5.wtTable,
wtViewport = _this$_getVariables5.wtViewport,
totalColumns = _this$_getVariables5.totalColumns;
var rootWindow = this.wot.rootWindow;
var firstVisibleColumn = wtTable.getFirstVisibleColumn();
if (leftOverlay.mainTableScrollableElement === rootWindow) {
var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
var totalTableWidth = (0, _element.innerWidth)(wtTable.hider);
var windowWidth = (0, _element.innerWidth)(rootWindow);
var windowScrollLeft = (0, _element.getScrollLeft)(rootWindow, rootWindow); // Only calculate firstVisibleColumn when table didn't filled (from left) whole viewport space
if (rootElementOffset.left + totalTableWidth - windowWidth <= windowScrollLeft) {
var columnsWidth = wtViewport.getRowHeaderWidth();
for (var column = totalColumns; column > 0; column--) {
columnsWidth += leftOverlay.sumCellSizes(column - 1, column);
if (rootElementOffset.left + totalTableWidth - columnsWidth <= windowScrollLeft) {
// Return physical column + 1
firstVisibleColumn = column;
break;
}
}
}
}
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 _this$_getVariables6 = this._getVariables(),
leftOverlay = _this$_getVariables6.leftOverlay,
wtTable = _this$_getVariables6.wtTable,
wtViewport = _this$_getVariables6.wtViewport,
totalColumns = _this$_getVariables6.totalColumns;
var rootWindow = this.wot.rootWindow;
var lastVisibleColumn = wtTable.getLastVisibleColumn();
if (leftOverlay.mainTableScrollableElement === rootWindow) {
var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
var windowScrollLeft = (0, _element.getScrollLeft)(rootWindow, rootWindow); // Only calculate lastVisibleColumn when table didn't filled (from right) whole viewport space
if (rootElementOffset.left > windowScrollLeft) {
var windowWidth = (0, _element.innerWidth)(rootWindow);
var columnsWidth = wtViewport.getRowHeaderWidth();
for (var column = 1; column <= totalColumns; 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;
break;
}
}
}
}
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;
}();
var _default = Scroll;
exports.default = _default;
/***/ }),
/* 348 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _element = __webpack_require__(8);
var _object = __webpack_require__(4);
/**
* @class Settings
*/
var Settings =
/*#__PURE__*/
function () {
/**
* @param {Walkontable} wotInstance
* @param {Object} settings
*/
function Settings(wotInstance, settings) {
var _this = this;
(0, _classCallCheck2.default)(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;
},
preventWheel: 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() {// return undefined means use default size for the rendered cell content
},
rowHeight: function rowHeight() {// 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,
onCellContextMenu: null,
onCellMouseOver: null,
onCellMouseOut: null,
onCellMouseUp: null,
// onCellMouseOut: null,
onCellDblClick: null,
onCellCornerMouseDown: null,
onCellCornerDblClick: null,
beforeDraw: null,
onDraw: null,
onBeforeRemoveCellClassNames: null,
onAfterDrawSelection: null,
onBeforeDrawBorders: null,
onScrollVertically: null,
onScrollHorizontally: null,
onBeforeTouchScroll: null,
onAfterMomentumScroll: null,
onBeforeStretchingColumnWidth: function onBeforeStretchingColumnWidth(width) {
return width;
},
onModifyRowHeaderWidth: null,
onModifyGetCellCoords: null,
onWindowResize: null,
// constants
scrollbarWidth: 10,
scrollbarHeight: 10,
renderAllRows: false,
groups: false,
rowHeaderWidth: null,
columnHeaderHeight: null,
headerClassName: null
}; // reference to settings
this.settings = {};
(0, _object.objectEach)(this.defaults, function (value, key) {
if (settings[key] !== void 0) {
_this.settings[key] = settings[key];
} else if (value === void 0) {
throw new Error("A required setting \"".concat(key, "\" was not provided"));
} else {
_this.settings[key] = value;
}
});
}
/**
* Update settings
*
* @param {Object} settings
* @param {*} value
* @returns {Walkontable}
*/
(0, _createClass2.default)(Settings, [{
key: "update",
value: function update(settings, value) {
var _this2 = this;
if (value === void 0) {
// settings is object
(0, _object.objectEach)(settings, function (settingValue, key) {
_this2.settings[key] = settingValue;
});
} 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;
}();
var _default = Settings;
exports.default = _default;
/***/ }),
/* 349 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _element = __webpack_require__(8);
var _object = __webpack_require__(4);
var _eventManager = _interopRequireDefault(__webpack_require__(24));
var _calculator = __webpack_require__(435);
/**
* @class Viewport
*/
var Viewport =
/*#__PURE__*/
function () {
/**
* @param wotInstance
*/
function Viewport(wotInstance) {
var _this = this;
(0, _classCallCheck2.default)(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 _eventManager.default(this.wot);
this.eventManager.addEventListener(this.wot.rootWindow, 'resize', function () {
_this.clientHeight = _this.getWorkspaceHeight();
});
}
/**
* @returns {number}
*/
(0, _createClass2.default)(Viewport, [{
key: "getWorkspaceHeight",
value: function getWorkspaceHeight() {
var currentDocument = this.wot.rootDocument;
var trimmingContainer = this.instance.wtOverlays.topOverlay.trimmingContainer;
var height = 0;
if (trimmingContainer === this.wot.rootWindow) {
height = currentDocument.documentElement.clientHeight;
} else {
var 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 wot = this.wot;
var rootDocument = wot.rootDocument,
rootWindow = wot.rootWindow;
var trimmingContainer = this.instance.wtOverlays.leftOverlay.trimmingContainer;
var docOffsetWidth = rootDocument.documentElement.offsetWidth;
var totalColumns = wot.getSetting('totalColumns');
var preventOverflow = wot.getSetting('preventOverflow');
var width;
var overflow;
if (preventOverflow) {
return (0, _element.outerWidth)(this.instance.wtTable.wtRootElement);
}
if (wot.getSetting('freezeOverlays')) {
width = Math.min(docOffsetWidth - this.getWorkspaceOffset().left, docOffsetWidth);
} else {
width = Math.min(this.getContainerFillWidth(), docOffsetWidth - this.getWorkspaceOffset().left, docOffsetWidth);
}
if (trimmingContainer === rootWindow && 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 rootDocument.documentElement.clientWidth;
}
if (trimmingContainer !== rootWindow) {
overflow = (0, _element.getStyle)(this.instance.wtOverlays.leftOverlay.trimmingContainer, 'overflow', rootWindow);
if (overflow === 'scroll' || overflow === 'hidden' || overflow === 'auto') {
// this is used in `scroll.html`
// TODO test me
return Math.max(width, trimmingContainer.clientWidth);
}
}
var stretchSetting = wot.getSetting('stretchH');
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 wtTable = this.wot.wtTable;
var sum = 0;
var column = from;
while (column < length) {
sum += wtTable.getColumnWidth(column);
column += 1;
}
return sum;
}
/**
* @returns {Number}
*/
}, {
key: "getContainerFillWidth",
value: function getContainerFillWidth() {
if (this.containerWidth) {
return this.containerWidth;
}
var mainContainer = this.instance.wtTable.holder;
var dummyElement = this.wot.rootDocument.createElement('div');
dummyElement.style.width = '100%';
dummyElement.style.height = '1px';
mainContainer.appendChild(dummyElement);
var 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() {
var wtTable = this.wot.wtTable;
return (0, _element.outerWidth)(wtTable.TABLE) || (0, _element.outerWidth)(wtTable.TBODY) || (0, _element.outerWidth)(wtTable.THEAD); // IE8 reports 0 as
offsetWidth;
}
/**
* @returns {Number}
*/
}, {
key: "getColumnHeaderHeight",
value: function getColumnHeaderHeight() {
var columnHeaders = this.instance.getSetting('columnHeaders');
if (!columnHeaders.length) {
this.columnHeaderHeight = 0;
} else 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();
if (containerHeight === Infinity) {
return containerHeight;
}
var columnHeaderHeight = this.getColumnHeaderHeight();
if (columnHeaderHeight > 0) {
containerHeight -= columnHeaderHeight;
}
return containerHeight;
}
/**
* @returns {Number}
*/
}, {
key: "getRowHeaderWidth",
value: function getRowHeaderWidth() {
var rowHeadersWidthSetting = this.instance.getSetting('rowHeaderWidth');
var rowHeaders = this.instance.getSetting('rowHeaders');
if (rowHeadersWidthSetting) {
this.rowHeaderWidth = 0;
for (var i = 0, len = rowHeaders.length; i < len; i++) {
this.rowHeaderWidth += rowHeadersWidthSetting[i] || rowHeadersWidthSetting;
}
}
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();
if (containerWidth === Infinity) {
return containerWidth;
}
var 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 calculationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _calculator.RENDER_TYPE;
var wot = this.wot;
var wtSettings = wot.wtSettings,
wtOverlays = wot.wtOverlays,
wtTable = wot.wtTable,
rootDocument = wot.rootDocument;
var height;
var scrollbarHeight;
var fixedRowsHeight;
this.rowHeaderWidth = NaN;
if (wtSettings.settings.renderAllRows && calculationType === _calculator.RENDER_TYPE) {
height = Infinity;
} else {
height = this.getViewportHeight();
}
var pos = wtOverlays.topOverlay.getScrollPosition() - wtOverlays.topOverlay.getTableParentOffset();
if (pos < 0) {
pos = 0;
}
var fixedRowsTop = wot.getSetting('fixedRowsTop');
var fixedRowsBottom = wot.getSetting('fixedRowsBottom');
var totalRows = wot.getSetting('totalRows');
if (fixedRowsTop) {
fixedRowsHeight = wtOverlays.topOverlay.sumCellSizes(0, fixedRowsTop);
pos += fixedRowsHeight;
height -= fixedRowsHeight;
}
if (fixedRowsBottom && wtOverlays.bottomOverlay.clone) {
fixedRowsHeight = wtOverlays.bottomOverlay.sumCellSizes(totalRows - fixedRowsBottom, totalRows);
height -= fixedRowsHeight;
}
if (wtTable.holder.clientHeight === wtTable.holder.offsetHeight) {
scrollbarHeight = 0;
} else {
scrollbarHeight = (0, _element.getScrollbarWidth)(rootDocument);
}
return new _calculator.ViewportRowsCalculator({
viewportSize: height,
scrollOffset: pos,
totalItems: wot.getSetting('totalRows'),
itemSizeFn: function itemSizeFn(sourceRow) {
return wtTable.getRowHeight(sourceRow);
},
overrideFn: wtSettings.settings.viewportRowCalculatorOverride,
calculationType: calculationType,
scrollbarHeight: 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 calculationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _calculator.RENDER_TYPE;
var wot = this.wot;
var wtSettings = wot.wtSettings,
wtOverlays = wot.wtOverlays,
wtTable = wot.wtTable,
rootDocument = wot.rootDocument;
var width = this.getViewportWidth();
var pos = wtOverlays.leftOverlay.getScrollPosition() - wtOverlays.leftOverlay.getTableParentOffset();
this.columnHeaderHeight = NaN;
if (pos < 0) {
pos = 0;
}
var fixedColumnsLeft = wot.getSetting('fixedColumnsLeft');
if (fixedColumnsLeft) {
var fixedColumnsWidth = wtOverlays.leftOverlay.sumCellSizes(0, fixedColumnsLeft);
pos += fixedColumnsWidth;
width -= fixedColumnsWidth;
}
if (wtTable.holder.clientWidth !== wtTable.holder.offsetWidth) {
width -= (0, _element.getScrollbarWidth)(rootDocument);
}
return new _calculator.ViewportColumnsCalculator({
viewportSize: width,
scrollOffset: pos,
totalItems: wot.getSetting('totalColumns'),
itemSizeFn: function itemSizeFn(sourceCol) {
return wot.wtTable.getColumnWidth(sourceCol);
},
overrideFn: wtSettings.settings.viewportColumnCalculatorOverride,
calculationType: calculationType,
stretchMode: wot.getSetting('stretchH'),
stretchingItemWidthFn: function stretchingItemWidthFn(stretchedWidth, column) {
return 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;
var runFastDraw = fastDraw;
if (runFastDraw) {
var proposedRowsVisibleCalculator = this.createRowsCalculator(_calculator.FULLY_VISIBLE_TYPE);
var proposedColumnsVisibleCalculator = this.createColumnsCalculator(_calculator.FULLY_VISIBLE_TYPE);
if (!(this.areAllProposedVisibleRowsAlreadyRendered(proposedRowsVisibleCalculator) && this.areAllProposedVisibleColumnsAlreadyRendered(proposedColumnsVisibleCalculator))) {
runFastDraw = false;
}
}
if (!runFastDraw) {
this.rowsRenderCalculator = this.createRowsCalculator(_calculator.RENDER_TYPE);
this.columnsRenderCalculator = this.createColumnsCalculator(_calculator.RENDER_TYPE);
} // delete temporarily to make sure that renderers always use rowsRenderCalculator, not rowsVisibleCalculator
this.rowsVisibleCalculator = null;
this.columnsVisibleCalculator = null;
return runFastDraw;
}
/**
* Creates rowsVisibleCalculator and columnsVisibleCalculator (after draw, to determine what are
* the actually fully visible rows and columns)
*/
}, {
key: "createVisibleCalculators",
value: function createVisibleCalculators() {
this.rowsVisibleCalculator = this.createRowsCalculator(_calculator.FULLY_VISIBLE_TYPE);
this.columnsVisibleCalculator = this.createColumnsCalculator(_calculator.FULLY_VISIBLE_TYPE);
}
/**
* 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) {
return false;
}
var startRow = proposedRowsVisibleCalculator.startRow,
endRow = proposedRowsVisibleCalculator.endRow;
var _this$rowsRenderCalcu = this.rowsRenderCalculator,
renderedStartRow = _this$rowsRenderCalcu.startRow,
renderedEndRow = _this$rowsRenderCalcu.endRow;
if (startRow < renderedStartRow || startRow === renderedStartRow && startRow > 0) {
return false;
} else if (endRow > renderedEndRow || endRow === renderedEndRow && endRow < this.wot.getSetting('totalRows') - 1) {
return false;
}
return true;
}
/**
* 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) {
return false;
}
var startColumn = proposedColumnsVisibleCalculator.startColumn,
endColumn = proposedColumnsVisibleCalculator.endColumn;
var _this$columnsRenderCa = this.columnsRenderCalculator,
renderedStartColumn = _this$columnsRenderCa.startColumn,
renderedEndColumn = _this$columnsRenderCa.endColumn;
if (startColumn < renderedStartColumn || startColumn === renderedStartColumn && startColumn > 0) {
return false;
} else if (endColumn > renderedEndColumn || endColumn === renderedEndColumn && endColumn < this.wot.getSetting('totalColumns') - 1) {
return false;
}
return true;
}
/**
* 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;
}();
var _default = Viewport;
exports.default = _default;
/***/ }),
/* 350 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _object = __webpack_require__(4);
var MIXIN_NAME = 'calculatedRows';
/**
* Mixin for the subclasses of `Table` with implementations of
* helper methods that are related to rows.
* This mixin is meant to be applied in the subclasses of `Table`
* that use virtual rendering in the vertical axis.
*
* @type {Object}
*/
var calculatedRows = {
/**
* Get the source index of the first rendered row. If no rows are rendered, returns an error code: -1
*
* @returns {Number}
*/
getFirstRenderedRow: function getFirstRenderedRow() {
var startRow = this.wot.wtViewport.rowsRenderCalculator.startRow;
if (startRow === null) {
return -1;
}
return startRow;
},
/**
* Get the source index of the first row fully visible in the viewport. If no rows are fully visible, returns an error code: -1
*
* @returns {Number}
*/
getFirstVisibleRow: function getFirstVisibleRow() {
var startRow = this.wot.wtViewport.rowsVisibleCalculator.startRow;
if (startRow === null) {
return -1;
}
return startRow;
},
/**
* Get the source index of the last rendered row. If no rows are rendered, returns an error code: -1
*
* @returns {Number}
*/
getLastRenderedRow: function getLastRenderedRow() {
var endRow = this.wot.wtViewport.rowsRenderCalculator.endRow;
if (endRow === null) {
return -1;
}
return endRow;
},
/**
* Get the source index of the last row fully visible in the viewport. If no rows are fully visible, returns an error code: -1
*
* @returns {Number}
*/
getLastVisibleRow: function getLastVisibleRow() {
var endRow = this.wot.wtViewport.rowsVisibleCalculator.endRow;
if (endRow === null) {
return -1;
}
return endRow;
},
/**
* Get the number of rendered rows
*
* @returns {Number}
*/
getRenderedRowsCount: function getRenderedRowsCount() {
return this.wot.wtViewport.rowsRenderCalculator.count;
},
/**
* Get the number of fully visible rows in the viewport
*
* @returns {Number}
*/
getVisibleRowsCount: function getVisibleRowsCount() {
return this.wot.wtViewport.rowsVisibleCalculator.count;
}
};
(0, _object.defineGetter)(calculatedRows, 'MIXIN_NAME', MIXIN_NAME, {
writable: false,
enumerable: false
});
var _default = calculatedRows;
exports.default = _default;
/***/ }),
/* 351 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _object = __webpack_require__(4);
var MIXIN_NAME = 'stickyRowsTop';
/**
* Mixin for the subclasses of `Table` with implementations of
* helper methods that are related to rows.
* This mixin is meant to be applied in the subclasses of `Table`
* that use sticky rendering of the top rows in the vertical axis.
*
* @type {Object}
*/
var stickyRowsTop = {
/**
* Get the source index of the first rendered row. If no rows are rendered, returns an error code: -1.
*
* @returns {Number}
*/
getFirstRenderedRow: function getFirstRenderedRow() {
var totalRows = this.wot.getSetting('totalRows');
if (totalRows === 0) {
return -1;
}
return 0;
},
/**
* Get the source index of the first row fully visible in the viewport. If no rows are fully visible, returns an error code: -1.
* Assumes that all rendered rows are fully visible.
*
* @returns {Number}
*/
getFirstVisibleRow: function getFirstVisibleRow() {
return this.getFirstRenderedRow();
},
/**
* Get the source index of the last rendered row. If no rows are rendered, returns an error code: -1.
*
* @returns {Number}
*/
getLastRenderedRow: function getLastRenderedRow() {
return this.getRenderedRowsCount() - 1;
},
/**
* Get the source index of the last row fully visible in the viewport. If no rows are fully visible, returns an error code: -1.
* Assumes that all rendered rows are fully visible.
*
* @returns {Number}
*/
getLastVisibleRow: function getLastVisibleRow() {
return this.getLastRenderedRow();
},
/**
* Get the number of rendered rows.
*
* @returns {Number}
*/
getRenderedRowsCount: function getRenderedRowsCount() {
var totalRows = this.wot.getSetting('totalRows');
return Math.min(this.wot.getSetting('fixedRowsTop'), totalRows);
},
/**
* Get the number of fully visible rows in the viewport.
* Assumes that all rendered rows are fully visible.
*
* @returns {Number}
*/
getVisibleRowsCount: function getVisibleRowsCount() {
return this.getRenderedRowsCount();
}
};
(0, _object.defineGetter)(stickyRowsTop, 'MIXIN_NAME', MIXIN_NAME, {
writable: false,
enumerable: false
});
var _default = stickyRowsTop;
exports.default = _default;
/***/ }),
/* 352 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _object = __webpack_require__(4);
var MIXIN_NAME = 'stickyRowsBottom';
/**
* Mixin for the subclasses of `Table` with implementations of
* helper methods that are related to rows.
* This mixin is meant to be applied in the subclasses of `Table`
* that use sticky rendering of the bottom rows in the vertical axis.
*
* @type {Object}
*/
var stickyRowsBottom = {
/**
* Get the source index of the first rendered row. If no rows are rendered, returns an error code: -1
*
* @returns {Number}
*/
getFirstRenderedRow: function getFirstRenderedRow() {
var totalRows = this.wot.getSetting('totalRows');
var fixedRowsBottom = this.wot.getSetting('fixedRowsBottom');
var index = totalRows - fixedRowsBottom;
if (index < 0) {
return -1;
}
return index;
},
/**
* Get the source index of the first row fully visible in the viewport. If no rows are fully visible, returns an error code: -1
* Assumes that all rendered rows are fully visible.
*
* @returns {Number}
*/
getFirstVisibleRow: function getFirstVisibleRow() {
return this.getFirstRenderedRow();
},
/**
* Get the source index of the last rendered row. If no rows are rendered, returns an error code: -1.
*
* @returns {Number}
*/
getLastRenderedRow: function getLastRenderedRow() {
return this.wot.getSetting('totalRows') - 1;
},
/**
* Get the source index of the last row fully visible in the viewport. If no rows are fully visible, returns an error code: -1.
* Assumes that all rendered rows are fully visible.
*
* @returns {Number}
*/
getLastVisibleRow: function getLastVisibleRow() {
return this.getLastRenderedRow();
},
/**
* Get the number of rendered rows.
*
* @returns {Number}
*/
getRenderedRowsCount: function getRenderedRowsCount() {
var totalRows = this.wot.getSetting('totalRows');
return Math.min(this.wot.getSetting('fixedRowsBottom'), totalRows);
},
/**
* Get the number of fully visible rows in the viewport.
* Assumes that all rendered rows are fully visible.
*
* @returns {Number}
*/
getVisibleRowsCount: function getVisibleRowsCount() {
return this.getRenderedRowsCount();
}
};
(0, _object.defineGetter)(stickyRowsBottom, 'MIXIN_NAME', MIXIN_NAME, {
writable: false,
enumerable: false
});
var _default = stickyRowsBottom;
exports.default = _default;
/***/ }),
/* 353 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(25);
__webpack_require__(56);
__webpack_require__(32);
exports.__esModule = true;
exports.default = void 0;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _element = __webpack_require__(8);
var _event = __webpack_require__(31);
var _object = __webpack_require__(4);
var _browser = __webpack_require__(75);
var _eventManager = _interopRequireDefault(__webpack_require__(24));
var _coords = _interopRequireDefault(__webpack_require__(108));
/**
*
*/
var Border =
/*#__PURE__*/
function () {
/**
* @param {Walkontable} wotInstance
* @param {Object} settings
*/
function Border(wotInstance, settings) {
(0, _classCallCheck2.default)(this, Border);
if (!settings) {
return;
}
this.eventManager = new _eventManager.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: '6px',
height: '6px',
borderWidth: '1px',
borderStyle: 'solid',
borderColor: '#FFF'
};
this.corner = null;
this.cornerStyle = null;
this.createBorders(settings);
this.registerListeners();
}
/**
* Register all necessary events
*/
(0, _createClass2.default)(Border, [{
key: "registerListeners",
value: function registerListeners() {
var _this2 = this;
var documentBody = this.wot.rootDocument.body;
this.eventManager.addEventListener(documentBody, 'mousedown', function () {
return _this2.onMouseDown();
});
this.eventManager.addEventListener(documentBody, '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 documentBody = this.wot.rootDocument.body;
var bounds = parentElement.getBoundingClientRect(); // Hide border to prevents selection jumping when fragmentSelection is enabled.
parentElement.style.display = 'none';
function isOutside(mouseEvent) {
if (mouseEvent.clientY < Math.floor(bounds.top)) {
return true;
}
if (mouseEvent.clientY > Math.ceil(bounds.top + bounds.height)) {
return true;
}
if (mouseEvent.clientX < Math.floor(bounds.left)) {
return true;
}
if (mouseEvent.clientX > Math.ceil(bounds.left + bounds.width)) {
return true;
}
}
function handler(handlerEvent) {
if (isOutside(handlerEvent)) {
_this.eventManager.removeEventListener(documentBody, 'mousemove', handler);
parentElement.style.display = 'block';
}
}
this.eventManager.addEventListener(documentBody, 'mousemove', handler);
}
/**
* Create border elements
*
* @param {Object} settings
*/
}, {
key: "createBorders",
value: function createBorders(settings) {
var rootDocument = this.wot.rootDocument;
this.main = rootDocument.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 = rootDocument.createElement('div');
div.className = "wtBorder ".concat(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 ? "".concat(this.settings[position].width, "px") : "".concat(settings.border.width, "px");
style.width = this.settings[position] && this.settings[position].width ? "".concat(this.settings[position].width, "px") : "".concat(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();
var wtTable = this.wot.wtTable;
var bordersHolder = wtTable.bordersHolder;
if (!bordersHolder) {
bordersHolder = rootDocument.createElement('div');
bordersHolder.className = 'htBorders';
wtTable.bordersHolder = bordersHolder;
wtTable.spreader.appendChild(bordersHolder);
}
bordersHolder.appendChild(this.main);
}
/**
* Create multiple selector handler for mobile devices
*/
}, {
key: "createMultipleSelectorHandles",
value: function createMultipleSelectorHandles() {
var _this3 = this;
var rootDocument = this.wot.rootDocument;
this.selectionHandles = {
topLeft: rootDocument.createElement('DIV'),
topLeftHitArea: rootDocument.createElement('DIV'),
bottomRight: rootDocument.createElement('DIV'),
bottomRightHitArea: rootDocument.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: "".concat(hitAreaWidth, "px"),
width: "".concat(hitAreaWidth, "px"),
'border-radius': "".concat(parseInt(hitAreaWidth / 1.5, 10), "px")
};
(0, _object.objectEach)(hitAreaStyle, function (value, key) {
_this3.selectionHandles.styles.bottomRightHitArea[key] = value;
_this3.selectionHandles.styles.topLeftHitArea[key] = value;
});
var handleStyle = {
position: 'absolute',
height: "".concat(width, "px"),
width: "".concat(width, "px"),
'border-radius': "".concat(parseInt(width / 1.5, 10), "px"),
background: '#F5F5FF',
border: '1px solid #4285c8'
};
(0, _object.objectEach)(handleStyle, function (value, key) {
_this3.selectionHandles.styles.bottomRight[key] = value;
_this3.selectionHandles.styles.topLeft[key] = value;
});
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) {
var areaSelection = this.wot.selections.createOrGetArea();
if (areaSelection.cellRange) {
if (row !== areaSelection.cellRange.to.row || col !== areaSelection.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 = "".concat(parseInt(top - handleWidth, 10), "px");
this.selectionHandles.styles.topLeft.left = "".concat(parseInt(left - handleWidth, 10), "px");
this.selectionHandles.styles.topLeftHitArea.top = "".concat(parseInt(top - hitAreaWidth / 4 * 3, 10), "px");
this.selectionHandles.styles.topLeftHitArea.left = "".concat(parseInt(left - hitAreaWidth / 4 * 3, 10), "px");
this.selectionHandles.styles.bottomRight.top = "".concat(parseInt(top + height, 10), "px");
this.selectionHandles.styles.bottomRight.left = "".concat(parseInt(left + width, 10), "px");
this.selectionHandles.styles.bottomRightHitArea.top = "".concat(parseInt(top + height - hitAreaWidth / 4, 10), "px");
this.selectionHandles.styles.bottomRightHitArea.left = "".concat(parseInt(left + width - hitAreaWidth / 4, 10), "px");
if (this.settings.border.cornerVisible && this.settings.border.cornerVisible()) {
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 _this$wot = this.wot,
wtTable = _this$wot.wtTable,
rootDocument = _this$wot.rootDocument,
rootWindow = _this$wot.rootWindow;
var fromRow;
var toRow;
var fromColumn;
var toColumn;
var rowsCount = wtTable.getRenderedRowsCount();
for (var i = 0; i < rowsCount; i += 1) {
var s = wtTable.rowFilter.renderedToSource(i);
if (s >= corners[0] && s <= corners[2]) {
fromRow = s;
break;
}
}
for (var _i = rowsCount - 1; _i >= 0; _i -= 1) {
var _s = wtTable.rowFilter.renderedToSource(_i);
if (_s >= corners[0] && _s <= corners[2]) {
toRow = _s;
break;
}
}
var columnsCount = wtTable.getRenderedColumnsCount();
for (var _i2 = 0; _i2 < columnsCount; _i2 += 1) {
var _s2 = wtTable.columnFilter.renderedToSource(_i2);
if (_s2 >= corners[1] && _s2 <= corners[3]) {
fromColumn = _s2;
break;
}
}
for (var _i3 = columnsCount - 1; _i3 >= 0; _i3 -= 1) {
var _s3 = wtTable.columnFilter.renderedToSource(_i3);
if (_s3 >= corners[1] && _s3 <= corners[3]) {
toColumn = _s3;
break;
}
}
if (fromRow === void 0 || fromColumn === void 0) {
this.disappear();
return;
}
var fromTD = wtTable.getCell(new _coords.default(fromRow, fromColumn));
var isMultiple = fromRow !== toRow || fromColumn !== toColumn;
var toTD = isMultiple ? wtTable.getCell(new _coords.default(toRow, toColumn)) : fromTD;
var fromOffset = (0, _element.offset)(fromTD);
var toOffset = isMultiple ? (0, _element.offset)(toTD) : fromOffset;
var containerOffset = (0, _element.offset)(wtTable.TABLE);
var minTop = fromOffset.top;
var minLeft = fromOffset.left;
var left = minLeft - containerOffset.left - 1;
var width = toOffset.left + (0, _element.outerWidth)(toTD) - minLeft;
if (this.isEntireColumnSelected(fromRow, toRow)) {
var modifiedValues = this.getDimensionsFromHeader('columns', fromColumn, toColumn, containerOffset);
var fromTH = null;
if (modifiedValues) {
var _modifiedValues = (0, _slicedToArray2.default)(modifiedValues, 3);
fromTH = _modifiedValues[0];
left = _modifiedValues[1];
width = _modifiedValues[2];
}
if (fromTH) {
fromTD = fromTH;
}
}
var top = minTop - containerOffset.top - 1;
var height = toOffset.top + (0, _element.outerHeight)(toTD) - minTop;
if (this.isEntireRowSelected(fromColumn, toColumn)) {
var _modifiedValues2 = this.getDimensionsFromHeader('rows', fromRow, toRow, containerOffset);
var _fromTH = null;
if (_modifiedValues2) {
var _modifiedValues3 = (0, _slicedToArray2.default)(_modifiedValues2, 3);
_fromTH = _modifiedValues3[0];
top = _modifiedValues3[1];
height = _modifiedValues3[2];
}
if (_fromTH) {
fromTD = _fromTH;
}
}
var style = (0, _element.getComputedStyle)(fromTD, rootWindow);
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 = "".concat(top, "px");
this.topStyle.left = "".concat(left, "px");
this.topStyle.width = "".concat(width, "px");
this.topStyle.display = 'block';
this.leftStyle.top = "".concat(top, "px");
this.leftStyle.left = "".concat(left, "px");
this.leftStyle.height = "".concat(height, "px");
this.leftStyle.display = 'block';
var delta = Math.floor(this.settings.border.width / 2);
this.bottomStyle.top = "".concat(top + height - delta, "px");
this.bottomStyle.left = "".concat(left, "px");
this.bottomStyle.width = "".concat(width, "px");
this.bottomStyle.display = 'block';
this.rightStyle.top = "".concat(top, "px");
this.rightStyle.left = "".concat(left + width - delta, "px");
this.rightStyle.height = "".concat(height + 1, "px");
this.rightStyle.display = 'block';
var cornerVisibleSetting = this.settings.border.cornerVisible;
cornerVisibleSetting = typeof cornerVisibleSetting === 'function' ? cornerVisibleSetting(this.settings.layerLevel) : cornerVisibleSetting;
var hookResult = this.wot.getSetting('onModifyGetCellCoords', toRow, toColumn);
var checkRow = toRow,
checkCol = toColumn;
if (hookResult && Array.isArray(hookResult)) {
var _hookResult = (0, _slicedToArray2.default)(hookResult, 4);
checkRow = _hookResult[2];
checkCol = _hookResult[3];
}
if ((0, _browser.isMobileBrowser)() || !cornerVisibleSetting || this.isPartRange(checkRow, checkCol)) {
this.cornerStyle.display = 'none';
} else {
this.cornerStyle.top = "".concat(top + height - 4, "px");
this.cornerStyle.left = "".concat(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';
var trimmingContainer = (0, _element.getTrimmingContainer)(wtTable.TABLE);
var trimToWindow = trimmingContainer === rootWindow;
if (trimToWindow) {
trimmingContainer = rootDocument.documentElement;
}
if (toColumn === this.wot.getSetting('totalColumns') - 1) {
var toTdOffsetLeft = trimToWindow ? toTD.getBoundingClientRect().left : toTD.offsetLeft;
var cornerRightEdge = toTdOffsetLeft + (0, _element.outerWidth)(toTD) + parseInt(this.cornerDefaultStyle.width, 10) / 2;
var cornerOverlappingContainer = cornerRightEdge >= (0, _element.innerWidth)(trimmingContainer);
if (cornerOverlappingContainer) {
this.cornerStyle.left = "".concat(Math.floor(left + width - 3 - parseInt(this.cornerDefaultStyle.width, 10) / 2), "px");
this.cornerStyle.borderRightWidth = 0;
}
}
if (toRow === this.wot.getSetting('totalRows') - 1) {
var toTdOffsetTop = trimToWindow ? toTD.getBoundingClientRect().top : toTD.offsetTop;
var cornerBottomEdge = toTdOffsetTop + (0, _element.outerHeight)(toTD) + parseInt(this.cornerDefaultStyle.height, 10) / 2;
var _cornerOverlappingContainer = cornerBottomEdge >= (0, _element.innerHeight)(trimmingContainer);
if (_cornerOverlappingContainer) {
this.cornerStyle.top = "".concat(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(toRow, toColumn, top, left, width, height);
}
}
/**
* Check whether an entire column of cells is selected.
*
* @private
* @param {Number} startRowIndex Start row index.
* @param {Number} endRowIndex End row index.
*/
}, {
key: "isEntireColumnSelected",
value: function isEntireColumnSelected(startRowIndex, endRowIndex) {
return startRowIndex === this.wot.wtTable.getFirstRenderedRow() && endRowIndex === this.wot.wtTable.getLastRenderedRow();
}
/**
* Check whether an entire row of cells is selected.
*
* @private
* @param {Number} startColumnIndex Start column index.
* @param {Number} endColumnIndex End column index.
*/
}, {
key: "isEntireRowSelected",
value: function isEntireRowSelected(startColumnIndex, endColumnIndex) {
return startColumnIndex === this.wot.wtTable.getFirstRenderedColumn() && endColumnIndex === this.wot.wtTable.getLastRenderedColumn();
}
/**
* Get left/top index and width/height depending on the `direction` provided.
*
* @private
* @param {String} direction `rows` or `columns`, defines if an entire column or row is selected.
* @param {Number} fromIndex Start index of the selection.
* @param {Number} toIndex End index of the selection.
* @param {Number} containerOffset offset of the container.
* @return {Array|Boolean} Returns an array of [headerElement, left, width] or [headerElement, top, height], depending on `direction` (`false` in case of an error getting the headers).
*/
}, {
key: "getDimensionsFromHeader",
value: function getDimensionsFromHeader(direction, fromIndex, toIndex, containerOffset) {
var wtTable = this.wot.wtTable;
var rootHotElement = wtTable.wtRootElement.parentNode;
var getHeaderFn = null;
var dimensionFn = null;
var entireSelectionClassname = null;
var index = null;
var dimension = null;
var dimensionProperty = null;
var startHeader = null;
var endHeader = null;
switch (direction) {
case 'rows':
getHeaderFn = function getHeaderFn() {
return wtTable.getRowHeader.apply(wtTable, arguments);
};
dimensionFn = function dimensionFn() {
return _element.outerHeight.apply(void 0, arguments);
};
entireSelectionClassname = 'ht__selection--rows';
dimensionProperty = 'top';
break;
case 'columns':
getHeaderFn = function getHeaderFn() {
return wtTable.getColumnHeader.apply(wtTable, arguments);
};
dimensionFn = function dimensionFn() {
return _element.outerWidth.apply(void 0, arguments);
};
entireSelectionClassname = 'ht__selection--columns';
dimensionProperty = 'left';
break;
default:
}
if (rootHotElement.className.includes(entireSelectionClassname)) {
var columnHeaderLevelCount = this.wot.getSetting('columnHeaders').length;
startHeader = getHeaderFn(fromIndex, columnHeaderLevelCount - 1);
endHeader = getHeaderFn(toIndex, columnHeaderLevelCount - 1);
if (!startHeader || !endHeader) {
return false;
}
var startHeaderOffset = (0, _element.offset)(startHeader);
var endOffset = (0, _element.offset)(endHeader);
if (startHeader && endHeader) {
index = startHeaderOffset[dimensionProperty] - containerOffset[dimensionProperty] - 1;
dimension = endOffset[dimensionProperty] + dimensionFn(endHeader) - startHeaderOffset[dimensionProperty];
}
return [startHeader, index, dimension];
}
return false;
}
/**
* Change border style.
*
* @private
* @param {String} borderElement Coordinate where add/remove border: top, right, bottom, left.
*/
}, {
key: "changeBorderStyle",
value: function changeBorderStyle(borderElement, border) {
var style = this[borderElement].style;
var borderStyle = border[borderElement];
if (!borderStyle || borderStyle.hide) {
(0, _element.addClass)(this[borderElement], 'hidden');
} else {
if ((0, _element.hasClass)(this[borderElement], 'hidden')) {
(0, _element.removeClass)(this[borderElement], 'hidden');
}
style.backgroundColor = borderStyle.color;
if (borderElement === 'top' || borderElement === 'bottom') {
style.height = "".concat(borderStyle.width, "px");
}
if (borderElement === 'right' || borderElement === 'left') {
style.width = "".concat(borderStyle.width, "px");
}
}
}
/**
* Change border style to default.
*
* @private
* @param {HTMLElement} position
*/
}, {
key: "changeBorderToDefaultStyle",
value: function changeBorderToDefaultStyle(position) {
var defaultBorder = {
width: 1,
color: '#000'
};
var style = this[position].style;
style.backgroundColor = defaultBorder.color;
style.width = "".concat(defaultBorder.width, "px");
style.height = "".concat(defaultBorder.width, "px");
}
/**
* Toggle class 'hidden' to element.
*
* @private
* @param {String} borderElement Coordinate where add/remove border: top, right, bottom, left.
* @return {Boolean}
*/
}, {
key: "toggleHiddenClass",
value: function toggleHiddenClass(borderElement, remove) {
this.changeBorderToDefaultStyle(borderElement);
if (remove) {
(0, _element.addClass)(this[borderElement], 'hidden');
} else {
(0, _element.removeClass)(this[borderElement], 'hidden');
}
}
/**
* 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';
}
}
/**
* Cleans up all the DOM state related to a Border instance. Call this prior to deleting a Border instance.
*/
}, {
key: "destroy",
value: function destroy() {
this.eventManager.destroyWithOwnEventsOnly();
this.main.parentNode.removeChild(this.main);
}
}]);
return Border;
}();
var _default = Border;
exports.default = _default;
/***/ }),
/* 354 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(21);
var $values = __webpack_require__(449).values;
// `Object.values` method
// https://tc39.github.io/ecma262/#sec-object.values
$({ target: 'Object', stat: true }, {
values: function values(O) {
return $values(O);
}
});
/***/ }),
/* 355 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(41);
__webpack_require__(137);
__webpack_require__(13);
__webpack_require__(14);
__webpack_require__(74);
__webpack_require__(9);
__webpack_require__(12);
__webpack_require__(40);
__webpack_require__(23);
__webpack_require__(16);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(6));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(30));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(5));
var _get2 = _interopRequireDefault(__webpack_require__(15));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _unicode = __webpack_require__(57);
var _mixed = __webpack_require__(27);
var _string = __webpack_require__(76);
var _array = __webpack_require__(3);
var _element = __webpack_require__(8);
var _handsontableEditor = _interopRequireDefault(__webpack_require__(356));
var privatePool = new WeakMap();
/**
* @private
* @editor AutocompleteEditor
* @class AutocompleteEditor
* @dependencies HandsontableEditor
*/
var AutocompleteEditor =
/*#__PURE__*/
function (_HandsontableEditor) {
(0, _inherits2.default)(AutocompleteEditor, _HandsontableEditor);
function AutocompleteEditor(instance) {
var _this;
(0, _classCallCheck2.default)(this, AutocompleteEditor);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(AutocompleteEditor).call(this, instance));
/**
* Query string to turn available values over.
*
* @type {String}
*/
_this.query = null;
/**
* Contains stripped choices.
*
* @type {String[]}
*/
_this.strippedChoices = [];
/**
* Contains raw choices.
*
* @type {Array}
*/
_this.rawChoices = [];
privatePool.set((0, _assertThisInitialized2.default)(_this), {
skipOne: false
});
return _this;
}
/**
* Gets current value from editable element.
*
* @returns {String}
*/
(0, _createClass2.default)(AutocompleteEditor, [{
key: "getValue",
value: function getValue() {
var _this2 = this;
var selectedValue = this.rawChoices.find(function (value) {
var strippedValue = _this2.stripValueIfNeeded(value);
return strippedValue === _this2.TEXTAREA.value;
});
if ((0, _mixed.isDefined)(selectedValue)) {
return selectedValue;
}
return this.TEXTAREA.value;
}
/**
* Creates an editor's elements and adds necessary CSS classnames.
*/
}, {
key: "createElements",
value: function createElements() {
(0, _get2.default)((0, _getPrototypeOf2.default)(AutocompleteEditor.prototype), "createElements", this).call(this);
(0, _element.addClass)(this.htContainer, 'autocompleteEditor');
(0, _element.addClass)(this.htContainer, this.hot.rootWindow.navigator.platform.indexOf('Mac') === -1 ? '' : 'htMacScroll');
}
/**
* Opens the editor and adjust its size and internal Handsontable's instance.
*/
}, {
key: "open",
value: function open() {
var _this3 = this;
var priv = privatePool.get(this); // this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
// Ugly fix for handsontable which grab window object for autocomplete scroll listener instead table element.
this.TEXTAREA_PARENT.style.overflow = 'auto';
(0, _get2.default)((0, _getPrototypeOf2.default)(AutocompleteEditor.prototype), "open", this).call(this);
this.TEXTAREA_PARENT.style.overflow = '';
var choicesListHot = this.htEditor.getInstance();
var trimDropdown = this.cellProperties.trimDropdown === void 0 ? true : this.cellProperties.trimDropdown;
this.showEditableElement();
this.focus();
var scrollbarWidth = (0, _element.getScrollbarWidth)(this.hot.rootDocument);
choicesListHot.updateSettings({
colWidths: trimDropdown ? [(0, _element.outerWidth)(this.TEXTAREA) - 2] : void 0,
width: trimDropdown ? (0, _element.outerWidth)(this.TEXTAREA) + scrollbarWidth + 2 : void 0,
renderer: function renderer(instance, TD, row, col, prop, value) {
var _this3$cellProperties = _this3.cellProperties,
filteringCaseSensitive = _this3$cellProperties.filteringCaseSensitive,
allowHtml = _this3$cellProperties.allowHtml;
var query = _this3.query;
var cellValue = (0, _mixed.stringify)(value);
var indexOfMatch;
var match;
if (cellValue && !allowHtml) {
indexOfMatch = filteringCaseSensitive === true ? cellValue.indexOf(query) : cellValue.toLowerCase().indexOf(query.toLowerCase());
if (indexOfMatch !== -1) {
match = cellValue.substr(indexOfMatch, query.length);
cellValue = cellValue.replace(match, "".concat(match, ""));
}
}
TD.innerHTML = cellValue;
},
autoColumnSize: true
}); // Add additional space for autocomplete holder
this.htEditor.view.wt.wtTable.holder.parentNode.style['padding-right'] = "".concat(scrollbarWidth + 2, "px");
if (priv.skipOne) {
priv.skipOne = false;
}
this.hot._registerTimeout(function () {
_this3.queryChoices(_this3.TEXTAREA.value);
});
}
/**
* Closes the editor.
*/
}, {
key: "close",
value: function close() {
this.removeHooksByKey('beforeKeyDown');
(0, _get2.default)((0, _getPrototypeOf2.default)(AutocompleteEditor.prototype), "close", this).call(this);
}
/**
* Verifies result of validation or closes editor if user's cancelled changes. Re-renders WalkOnTable.
*
* @param {Boolean|undefined} result
*/
}, {
key: "discardEditor",
value: function discardEditor(result) {
(0, _get2.default)((0, _getPrototypeOf2.default)(AutocompleteEditor.prototype), "discardEditor", this).call(this, result);
this.hot.view.render();
}
/**
* Prepares choices list based on applied argument.
*
* @private
* @param {String} query
*/
}, {
key: "queryChoices",
value: function queryChoices(query) {
var _this4 = this;
var source = this.cellProperties.source;
this.query = query;
if (typeof source === 'function') {
source.call(this.cellProperties, query, function (choices) {
_this4.rawChoices = choices;
_this4.updateChoicesList(_this4.stripValuesIfNeeded(choices));
});
} else if (Array.isArray(source)) {
this.rawChoices = source;
this.updateChoicesList(this.stripValuesIfNeeded(source));
} else {
this.updateChoicesList([]);
}
}
/**
* Updates list of the possible completions to choose.
*
* @private
* @param {Array} choicesList
*/
}, {
key: "updateChoicesList",
value: function updateChoicesList(choicesList) {
var pos = (0, _element.getCaretPosition)(this.TEXTAREA);
var endPos = (0, _element.getSelectionEndPosition)(this.TEXTAREA);
var sortByRelevanceSetting = this.cellProperties.sortByRelevance;
var filterSetting = this.cellProperties.filter;
var orderByRelevance = null;
var highlightIndex = null;
var choices = choicesList;
if (sortByRelevanceSetting) {
orderByRelevance = AutocompleteEditor.sortByRelevance(this.stripValueIfNeeded(this.getValue()), choices, this.cellProperties.filteringCaseSensitive);
}
var orderByRelevanceLength = Array.isArray(orderByRelevance) ? orderByRelevance.length : 0;
if (filterSetting === false) {
if (orderByRelevanceLength) {
highlightIndex = orderByRelevance[0];
}
} else {
var sorted = [];
for (var i = 0, choicesCount = choices.length; i < choicesCount; i++) {
if (sortByRelevanceSetting && orderByRelevanceLength <= i) {
break;
}
if (orderByRelevanceLength) {
sorted.push(choices[orderByRelevance[i]]);
} else {
sorted.push(choices[i]);
}
}
highlightIndex = 0;
choices = sorted;
}
this.strippedChoices = choices;
this.htEditor.loadData((0, _array.pivot)([choices]));
this.updateDropdownHeight();
this.flipDropdownIfNeeded();
if (this.cellProperties.strict === true) {
this.highlightBestMatchingChoice(highlightIndex);
}
this.hot.listen(false);
(0, _element.setCaretPosition)(this.TEXTAREA, pos, pos === endPos ? void 0 : endPos);
}
/**
* Checks where is enough place to open editor.
*
* @private
* @returns {Boolean}
*/
}, {
key: "flipDropdownIfNeeded",
value: function flipDropdownIfNeeded() {
var textareaOffset = (0, _element.offset)(this.TEXTAREA);
var textareaHeight = (0, _element.outerHeight)(this.TEXTAREA);
var dropdownHeight = this.getDropdownHeight();
var trimmingContainer = (0, _element.getTrimmingContainer)(this.hot.view.wt.wtTable.TABLE);
var trimmingContainerScrollTop = trimmingContainer.scrollTop;
var headersHeight = (0, _element.outerHeight)(this.hot.view.wt.wtTable.THEAD);
var containerOffset = {
row: 0,
col: 0
};
if (trimmingContainer !== this.hot.rootWindow) {
containerOffset = (0, _element.offset)(trimmingContainer);
}
var spaceAbove = textareaOffset.top - containerOffset.top - headersHeight + trimmingContainerScrollTop;
var spaceBelow = trimmingContainer.scrollHeight - spaceAbove - headersHeight - textareaHeight;
var flipNeeded = dropdownHeight > spaceBelow && spaceAbove > spaceBelow;
if (flipNeeded) {
this.flipDropdown(dropdownHeight);
} else {
this.unflipDropdown();
}
this.limitDropdownIfNeeded(flipNeeded ? spaceAbove : spaceBelow, dropdownHeight);
return flipNeeded;
}
/**
* Checks if the internal table should generate scrollbar or could be rendered without it.
*
* @private
* @param {Number} spaceAvailable
* @param {Number} dropdownHeight
*/
}, {
key: "limitDropdownIfNeeded",
value: function limitDropdownIfNeeded(spaceAvailable, dropdownHeight) {
if (dropdownHeight > spaceAvailable) {
var tempHeight = 0;
var i = 0;
var lastRowHeight = 0;
var height = null;
do {
lastRowHeight = this.htEditor.getRowHeight(i) || this.htEditor.view.wt.wtSettings.settings.defaultRowHeight;
tempHeight += lastRowHeight;
i += 1;
} while (tempHeight < spaceAvailable);
height = tempHeight - lastRowHeight;
if (this.htEditor.flipped) {
this.htEditor.rootElement.style.top = "".concat(parseInt(this.htEditor.rootElement.style.top, 10) + dropdownHeight - height, "px");
}
this.setDropdownHeight(tempHeight - lastRowHeight);
}
}
/**
* Configures editor to open it at the top.
*
* @private
* @param {Number} dropdownHeight
*/
}, {
key: "flipDropdown",
value: function flipDropdown(dropdownHeight) {
var dropdownStyle = this.htEditor.rootElement.style;
dropdownStyle.position = 'absolute';
dropdownStyle.top = "".concat(-dropdownHeight, "px");
this.htEditor.flipped = true;
}
/**
* Configures editor to open it at the bottom.
*
* @private
*/
}, {
key: "unflipDropdown",
value: function unflipDropdown() {
var dropdownStyle = this.htEditor.rootElement.style;
if (dropdownStyle.position === 'absolute') {
dropdownStyle.position = '';
dropdownStyle.top = '';
}
this.htEditor.flipped = void 0;
}
/**
* Updates width and height of the internal Handsontable's instance.
*
* @private
*/
}, {
key: "updateDropdownHeight",
value: function updateDropdownHeight() {
var currentDropdownWidth = this.htEditor.getColWidth(0) + (0, _element.getScrollbarWidth)(this.hot.rootDocument) + 2;
var trimDropdown = this.cellProperties.trimDropdown;
this.htEditor.updateSettings({
height: this.getDropdownHeight(),
width: trimDropdown ? void 0 : currentDropdownWidth
});
this.htEditor.view.wt.wtTable.alignOverlaysWithTrimmingContainer();
}
/**
* Sets new height of the internal Handsontable's instance.
*
* @private
* @param {Number} height
*/
}, {
key: "setDropdownHeight",
value: function setDropdownHeight(height) {
this.htEditor.updateSettings({
height: height
});
}
/**
* Creates new selection on specified row index, or deselects selected cells.
*
* @private
* @param {Number|undefined} index
*/
}, {
key: "highlightBestMatchingChoice",
value: function highlightBestMatchingChoice(index) {
if (typeof index === 'number') {
this.htEditor.selectCell(index, 0, void 0, void 0, void 0, false);
} else {
this.htEditor.deselectCell();
}
}
/**
* Calculates and return the internal Handsontable's height.
*
* @private
* @returns {Number}
*/
}, {
key: "getDropdownHeight",
value: function getDropdownHeight() {
var firstRowHeight = this.htEditor.getInstance().getRowHeight(0) || 23;
var visibleRows = this.cellProperties.visibleRows;
return this.strippedChoices.length >= visibleRows ? visibleRows * firstRowHeight : this.strippedChoices.length * firstRowHeight + 8;
}
/**
* Sanitizes value from potential dangerous tags.
*
* @private
* @param {String} value
* @returns {String}
*/
}, {
key: "stripValueIfNeeded",
value: function stripValueIfNeeded(value) {
return this.stripValuesIfNeeded([value])[0];
}
/**
* Sanitizes an array of the values from potential dangerous tags.
*
* @private
* @param {String[]} values
* @returns {String[]}
*/
}, {
key: "stripValuesIfNeeded",
value: function stripValuesIfNeeded(values) {
var allowHtml = this.cellProperties.allowHtml;
var stringifiedValues = (0, _array.arrayMap)(values, function (value) {
return (0, _mixed.stringify)(value);
});
var strippedValues = (0, _array.arrayMap)(stringifiedValues, function (value) {
return allowHtml ? value : (0, _string.stripTags)(value);
});
return strippedValues;
}
/**
* Captures use of arrow down and up to control their behaviour.
*
* @private
* @param {Number} keyCode
* @returns {Boolean}
*/
}, {
key: "allowKeyEventPropagation",
value: function allowKeyEventPropagation(keyCode) {
var selectedRange = this.htEditor.getSelectedRangeLast();
var selected = {
row: selectedRange ? selectedRange.from.row : -1
};
var allowed = false;
if (keyCode === _unicode.KEY_CODES.ARROW_DOWN && selected.row > 0 && selected.row < this.htEditor.countRows() - 1) {
allowed = true;
}
if (keyCode === _unicode.KEY_CODES.ARROW_UP && selected.row > -1) {
allowed = true;
}
return allowed;
}
/**
* onBeforeKeyDown callback.
*
* @private
* @param {KeyboardEvent} event
*/
}, {
key: "onBeforeKeyDown",
value: function onBeforeKeyDown(event) {
var _this5 = this;
var priv = privatePool.get(this);
priv.skipOne = false;
if ((0, _unicode.isPrintableChar)(event.keyCode) || event.keyCode === _unicode.KEY_CODES.BACKSPACE || event.keyCode === _unicode.KEY_CODES.DELETE || event.keyCode === _unicode.KEY_CODES.INSERT) {
var timeOffset = 0; // on ctl+c / cmd+c don't update suggestion list
if (event.keyCode === _unicode.KEY_CODES.C && (event.ctrlKey || event.metaKey)) {
return;
}
if (!this.isOpened()) {
timeOffset += 10;
}
if (this.htEditor) {
this.hot._registerTimeout(function () {
_this5.queryChoices(_this5.TEXTAREA.value);
priv.skipOne = true;
}, timeOffset);
}
}
(0, _get2.default)((0, _getPrototypeOf2.default)(AutocompleteEditor.prototype), "onBeforeKeyDown", this).call(this, event);
}
}]);
return AutocompleteEditor;
}(_handsontableEditor.default);
/**
* Filters and sorts by relevance.
*
* @param value
* @param choices
* @param caseSensitive
* @returns {Number[]} array of indexes in original choices array
*/
AutocompleteEditor.sortByRelevance = function (value, choices, caseSensitive) {
var choicesRelevance = [];
var currentItem;
var valueLength = value.length;
var valueIndex;
var charsLeft;
var result = [];
var i;
var choicesCount = choices.length;
if (valueLength === 0) {
for (i = 0; i < choicesCount; i++) {
result.push(i);
}
return result;
}
for (i = 0; i < choicesCount; i++) {
currentItem = (0, _string.stripTags)((0, _mixed.stringify)(choices[i]));
if (caseSensitive) {
valueIndex = currentItem.indexOf(value);
} else {
valueIndex = currentItem.toLowerCase().indexOf(value.toLowerCase());
}
if (valueIndex !== -1) {
charsLeft = currentItem.length - valueIndex - valueLength;
choicesRelevance.push({
baseIndex: i,
index: valueIndex,
charsLeft: charsLeft,
value: currentItem
});
}
}
choicesRelevance.sort(function (a, b) {
if (b.index === -1) {
return -1;
}
if (a.index === -1) {
return 1;
}
if (a.index < b.index) {
return -1;
} else if (b.index < a.index) {
return 1;
} else if (a.index === b.index) {
if (a.charsLeft < b.charsLeft) {
return -1;
} else if (a.charsLeft > b.charsLeft) {
return 1;
}
}
return 0;
});
for (i = 0, choicesCount = choicesRelevance.length; i < choicesCount; i++) {
result.push(choicesRelevance[i].baseIndex);
}
return result;
};
var _default = AutocompleteEditor;
exports.default = _default;
/***/ }),
/* 356 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(6));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(5));
var _get2 = _interopRequireDefault(__webpack_require__(15));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _unicode = __webpack_require__(57);
var _object = __webpack_require__(4);
var _element = __webpack_require__(8);
var _event = __webpack_require__(31);
var _textEditor = _interopRequireDefault(__webpack_require__(111));
/**
* @private
* @editor HandsontableEditor
* @class HandsontableEditor
* @dependencies TextEditor
*/
var HandsontableEditor =
/*#__PURE__*/
function (_TextEditor) {
(0, _inherits2.default)(HandsontableEditor, _TextEditor);
function HandsontableEditor() {
(0, _classCallCheck2.default)(this, HandsontableEditor);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HandsontableEditor).apply(this, arguments));
}
(0, _createClass2.default)(HandsontableEditor, [{
key: "open",
/**
* Opens the editor and adjust its size.
*/
value: function open() {
// this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
(0, _get2.default)((0, _getPrototypeOf2.default)(HandsontableEditor.prototype), "open", this).call(this);
if (this.htEditor) {
this.htEditor.destroy();
}
if (this.htContainer.style.display === 'none') {
this.htContainer.style.display = '';
} // Construct and initialise a new Handsontable
this.htEditor = new this.hot.constructor(this.htContainer, this.htOptions);
this.htEditor.init();
this.htEditor.rootElement.style.display = '';
if (this.cellProperties.strict) {
this.htEditor.selectCell(0, 0);
} else {
this.htEditor.deselectCell();
}
(0, _element.setCaretPosition)(this.TEXTAREA, 0, this.TEXTAREA.value.length);
}
/**
* Closes the editor.
*/
}, {
key: "close",
value: function close() {
if (this.htEditor) {
this.htEditor.rootElement.style.display = 'none';
}
this.removeHooksByKey('beforeKeyDown');
(0, _get2.default)((0, _getPrototypeOf2.default)(HandsontableEditor.prototype), "close", this).call(this);
}
/**
* Prepares editor's meta data and configuration of the internal Handsontable's instance.
*
* @param {Number} row
* @param {Number} col
* @param {Number|String} prop
* @param {HTMLTableCellElement} td
* @param {*} originalValue
* @param {Object} cellProperties
*/
}, {
key: "prepare",
value: function prepare(td, row, col, prop, value, cellProperties) {
(0, _get2.default)((0, _getPrototypeOf2.default)(HandsontableEditor.prototype), "prepare", this).call(this, td, row, col, prop, value, cellProperties);
var parent = this;
var options = {
startRows: 0,
startCols: 0,
minRows: 0,
minCols: 0,
className: 'listbox',
copyPaste: false,
autoColumnSize: false,
autoRowSize: false,
readOnly: true,
fillHandle: false,
autoWrapCol: false,
autoWrapRow: false,
afterOnCellMouseDown: function afterOnCellMouseDown(_, coords) {
var sourceValue = this.getSourceData(coords.row, coords.col); // if the value is undefined then it means we don't want to set the value
if (sourceValue !== void 0) {
parent.setValue(sourceValue);
}
parent.instance.destroyEditor();
},
preventWheel: true
};
if (this.cellProperties.handsontable) {
(0, _object.extend)(options, cellProperties.handsontable);
}
this.htOptions = options;
}
/**
* Begins editing on a highlighted cell and hides fillHandle corner if was present.
*
* @param {*} newInitialValue
* @param {*} event
*/
}, {
key: "beginEditing",
value: function beginEditing(newInitialValue, event) {
var onBeginEditing = this.hot.getSettings().onBeginEditing;
if (onBeginEditing && onBeginEditing() === false) {
return;
}
(0, _get2.default)((0, _getPrototypeOf2.default)(HandsontableEditor.prototype), "beginEditing", this).call(this, newInitialValue, event);
}
/**
* Sets focus state on the select element.
*/
}, {
key: "focus",
value: function focus(safeFocus) {
(0, _get2.default)((0, _getPrototypeOf2.default)(HandsontableEditor.prototype), "focus", this).call(this, safeFocus);
}
/**
* Creates an editor's elements and adds necessary CSS classnames.
*/
}, {
key: "createElements",
value: function createElements() {
(0, _get2.default)((0, _getPrototypeOf2.default)(HandsontableEditor.prototype), "createElements", this).call(this);
var DIV = this.hot.rootDocument.createElement('DIV');
DIV.className = 'handsontableEditor';
this.TEXTAREA_PARENT.appendChild(DIV);
this.htContainer = DIV;
this.assignHooks();
}
/**
* Finishes editing and start saving or restoring process for editing cell or last selected range.
*
* @param {Boolean} restoreOriginalValue If true, then closes editor without saving value from the editor into a cell.
* @param {Boolean} ctrlDown If true, then saveValue will save editor's value to each cell in the last selected range.
* @param {Function} callback
*/
}, {
key: "finishEditing",
value: function finishEditing(restoreOriginalValue, ctrlDown, callback) {
if (this.htEditor && this.htEditor.isListening()) {
// if focus is still in the HOT editor
this.hot.listen(); // return the focus to the parent HOT instance
}
if (this.htEditor && this.htEditor.getSelectedLast()) {
var value = this.htEditor.getInstance().getValue();
if (value !== void 0) {
// if the value is undefined then it means we don't want to set the value
this.setValue(value);
}
}
return (0, _get2.default)((0, _getPrototypeOf2.default)(HandsontableEditor.prototype), "finishEditing", this).call(this, restoreOriginalValue, ctrlDown, callback);
}
/**
* Assings afterDestroy callback to prevent memory leaks.
*
* @private
*/
}, {
key: "assignHooks",
value: function assignHooks() {
var _this = this;
this.hot.addHook('afterDestroy', function () {
if (_this.htEditor) {
_this.htEditor.destroy();
}
});
}
/**
* onBeforeKeyDown callback.
*
* @private
* @param {Event} event
*/
}, {
key: "onBeforeKeyDown",
value: function onBeforeKeyDown(event) {
if ((0, _event.isImmediatePropagationStopped)(event)) {
return;
}
var innerHOT = this.htEditor.getInstance();
var rowToSelect;
var selectedRow;
if (event.keyCode === _unicode.KEY_CODES.ARROW_DOWN) {
if (!innerHOT.getSelectedLast() && !innerHOT.flipped) {
rowToSelect = 0;
} else if (innerHOT.getSelectedLast()) {
if (innerHOT.flipped) {
rowToSelect = innerHOT.getSelectedLast()[0] + 1;
} else if (!innerHOT.flipped) {
var lastRow = innerHOT.countRows() - 1;
selectedRow = innerHOT.getSelectedLast()[0];
rowToSelect = Math.min(lastRow, selectedRow + 1);
}
}
} else if (event.keyCode === _unicode.KEY_CODES.ARROW_UP) {
if (!innerHOT.getSelectedLast() && innerHOT.flipped) {
rowToSelect = innerHOT.countRows() - 1;
} else if (innerHOT.getSelectedLast()) {
if (innerHOT.flipped) {
selectedRow = innerHOT.getSelectedLast()[0];
rowToSelect = Math.max(0, selectedRow - 1);
} else {
selectedRow = innerHOT.getSelectedLast()[0];
rowToSelect = selectedRow - 1;
}
}
}
if (rowToSelect !== void 0) {
if (rowToSelect < 0 || innerHOT.flipped && rowToSelect > innerHOT.countRows() - 1) {
innerHOT.deselectCell();
} else {
innerHOT.selectCell(rowToSelect, 0);
}
if (innerHOT.getData().length) {
event.preventDefault();
(0, _event.stopImmediatePropagation)(event);
this.hot.listen();
this.TEXTAREA.focus();
}
}
(0, _get2.default)((0, _getPrototypeOf2.default)(HandsontableEditor.prototype), "onBeforeKeyDown", this).call(this, event);
}
}]);
return HandsontableEditor;
}(_textEditor.default);
var _default = HandsontableEditor;
exports.default = _default;
/***/ }),
/* 357 */
/***/ (function(module, exports, __webpack_require__) {
var require;var require;!function(e){if(true)module.exports=e();else {}}(function(){return function e(t,n,r){function i(o,u){if(!n[o]){if(!t[o]){var s="function"==typeof require&&require;if(!u&&s)return require(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return i(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o15&&_(T,y,e),o=!1):c.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1,s=g(s,10,n,c.s)}else{if(e instanceof t)return c.s=e.s,c.e=e.e,c.c=(e=e.c)?e.slice():e,void(T=0);if((o="number"==typeof e)&&0*e==0){if(c.s=1/e<0?(e=-e,-1):1,e===~~e){for(i=0,a=e;a>=10;a/=10,i++);return c.e=i,c.c=[e],void(T=0)}s=e+""}else{if(!p.test(s=e+""))return E(c,s,o);c.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1}}for((i=s.indexOf("."))>-1&&(s=s.replace(".","")),(a=s.search(/e/i))>0?(i<0&&(i=a),i+=+s.slice(a+1),s=s.substring(0,a)):i<0&&(i=s.length),a=0;48===s.charCodeAt(a);a++);for(u=s.length;48===s.charCodeAt(--u););if(s=s.slice(a,u+1))if(u=s.length,o&&q&&u>15&&(e>S||e!==h(e))&&_(T,y,c.s*e),(i=i-a-1)>V)c.c=c.e=null;else if(i=0&&(c=W,W=0,e=e.replace(".",""),g=(d=new t(r)).pow(e.length-h),W=c,d.c=s(l(i(g.c),g.e),10,n),d.e=d.c.length),u=c=(p=s(e,r,n)).length;0==p[--c];p.pop());if(!p[0])return"0";if(h<0?--u:(g.c=p,g.e=u,g.s=a,p=(g=L(g,d,v,m,n)).c,f=g.r,u=g.e),o=u+v+1,h=p[o],c=n/2,f=f||o<0||null!=p[o+1],f=m<4?(null!=h||f)&&(0==m||m==(g.s<0?3:2)):h>c||h==c&&(4==m||f||6==m&&1&p[o-1]||m==(g.s<0?8:7)),o<1||!p[0])e=f?l("1",-v):"0";else{if(p.length=o,f)for(--n;++p[--o]>n;)p[o]=0,o||(++u,p=[1].concat(p));for(c=p.length;!p[--c];);for(h=0,e="";h<=c;e+=b.charAt(p[h++]));e=l(e,u)}return e}function F(e,n,r,a){var o,u,s,f,g;if(r=null!=r&&Z(r,0,8,a,m)?0|r:R,!e.c)return e.toString();if(o=e.c[0],s=e.e,null==n)g=i(e.c),g=19==a||24==a&&s<=$?c(g,s):l(g,s);else if(e=A(new t(e),n,r),u=e.e,g=i(e.c),f=g.length,19==a||24==a&&(n<=u||u<=$)){for(;ff){if(--n>0)for(g+=".";n--;g+="0");}else if((n+=u-f)>0)for(u+1==f&&(g+=".");n--;g+="0");return e.s<0&&o?"-"+g:g}function D(e,n){var r,i,a=0;for(u(e[0])&&(e=e[0]),r=new t(e[0]);++an||e!=f(e))&&_(r,(i||"decimal places")+(en?" out of range":" not an integer"),e),!0}function k(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*x-1)>V?e.c=e.e=null:n=10;u/=10,i++);if((a=t-i)<0)a+=x,o=t,l=(s=f[c=0])/g[i-o-1]%10|0;else if((c=d((a+1)/x))>=f.length){if(!r)break e;for(;f.length<=c;f.push(0));s=l=0,i=1,o=(a%=x)-x+1}else{for(s=u=f[c],i=1;u>=10;u/=10,i++);l=(o=(a%=x)-x+i)<0?0:s/g[i-o-1]%10|0}if(r=r||t<0||null!=f[c+1]||(o<0?s:s%g[i-o-1]),r=n<4?(l||r)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(a>0?o>0?s/g[i-o]:0:f[c-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,r?(t-=e.e+1,f[0]=g[(x-t%x)%x],e.e=-t||0):f[0]=e.e=0,e;if(0==a?(f.length=c,u=1,c--):(f.length=c+1,u=g[x-a],f[c]=o>0?h(s/g[i-o]%g[o])*u:0),r)for(;;){if(0==c){for(a=1,o=f[0];o>=10;o/=10,a++);for(o=f[0]+=u,u=1;o>=10;o/=10,u++);a!=u&&(e.e++,f[0]==w&&(f[0]=1));break}if(f[c]+=u,f[c]!=w)break;f[c--]=0,u=1}for(a=f.length;0===f[--a];f.pop());}e.e>V?e.c=e.e=null:e.en)return null!=(e=i[n++])};return s(t="DECIMAL_PLACES")&&Z(e,0,M,2,t)&&(C=0|e),r[t]=C,s(t="ROUNDING_MODE")&&Z(e,0,8,2,t)&&(R=0|e),r[t]=R,s(t="EXPONENTIAL_AT")&&(u(e)?Z(e[0],-M,0,2,t)&&Z(e[1],0,M,2,t)&&($=0|e[0],P=0|e[1]):Z(e,-M,M,2,t)&&($=-(P=0|(e<0?-e:e)))),r[t]=[$,P],s(t="RANGE")&&(u(e)?Z(e[0],-M,-1,2,t)&&Z(e[1],1,M,2,t)&&(I=0|e[0],V=0|e[1]):Z(e,-M,M,2,t)&&(0|e?I=-(V=0|(e<0?-e:e)):q&&_(2,t+" cannot be zero",e))),r[t]=[I,V],s(t="ERRORS")&&(e===!!e||1===e||0===e?(T=0,Z=(q=!!e)?B:o):q&&_(2,t+v,e)),r[t]=q,s(t="CRYPTO")&&(!0===e||!1===e||1===e||0===e?e?!(e="undefined"==typeof crypto)&&crypto&&(crypto.getRandomValues||crypto.randomBytes)?z=!0:q?_(2,"crypto unavailable",e?void 0:crypto):z=!1:z=!1:q&&_(2,t+v,e)),r[t]=z,s(t="MODULO_MODE")&&Z(e,0,9,2,t)&&(G=0|e),r[t]=G,s(t="POW_PRECISION")&&Z(e,0,M,2,t)&&(W=0|e),r[t]=W,s(t="FORMAT")&&("object"==typeof e?H=e:q&&_(2,t+" not an object",e)),r[t]=H,r},t.max=function(){return D(arguments,U.lt)},t.min=function(){return D(arguments,U.gt)},t.random=function(){var e=9007199254740992*Math.random()&2097151?function(){return h(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(n){var r,i,a,o,u,s=0,c=[],l=new t(j);if(n=null!=n&&Z(n,0,M,14)?0|n:C,o=d(n/x),z)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(o*=2));s>>11))>=9e15?(i=crypto.getRandomValues(new Uint32Array(2)),r[s]=i[0],r[s+1]=i[1]):(c.push(u%1e14),s+=2);s=o/2}else if(crypto.randomBytes){for(r=crypto.randomBytes(o*=7);s=9e15?crypto.randomBytes(7).copy(r,s):(c.push(u%1e14),s+=7);s=o/7}else z=!1,q&&_(14,"crypto unavailable",crypto);if(!z)for(;s=10;u/=10,s++);sr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function i(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(a,o,u,s,c){var l,f,g,p,d,v,m,y,b,S,N,O,M,F,D,B,k,_=a.s==o.s?1:-1,L=a.c,E=o.c;if(!(L&&L[0]&&E&&E[0]))return new t(a.s&&o.s&&(L?!E||L[0]!=E[0]:E)?L&&0==L[0]||!E?0*_:_/0:NaN);for(b=(y=new t(_)).c=[],_=u+(f=a.e-o.e)+1,c||(c=w,f=r(a.e/x)-r(o.e/x),_=_/x|0),g=0;E[g]==(L[g]||0);g++);if(E[g]>(L[g]||0)&&f--,_<0)b.push(1),p=!0;else{for(F=L.length,B=E.length,g=0,_+=2,(d=h(c/(E[0]+1)))>1&&(E=e(E,d,c),L=e(L,d,c),B=E.length,F=L.length),M=B,N=(S=L.slice(0,B)).length;N=c/2&&D++;do{if(d=0,(l=n(E,S,B,N))<0){if(O=S[0],B!=N&&(O=O*c+(S[1]||0)),(d=h(O/D))>1)for(d>=c&&(d=c-1),m=(v=e(E,d,c)).length,N=S.length;1==n(v,S,m,N);)d--,i(v,B=10;_/=10,g++);A(y,u+(y.e=g+f*x-1)+1,s,p)}else y.e=f,y.r=+p;return y}}(),E=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,a=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,u,s,c){var l,f=s?u:u.replace(a,"");if(i.test(f))o.s=isNaN(f)?null:f<0?-1:1;else{if(!s&&(f=f.replace(e,function(e,t,n){return l="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=l?e:t}),c&&(l=c,f=f.replace(n,"$1").replace(r,"0.$1")),u!=f))return new t(f,l);q&&_(T,"not a"+(c?" base "+c:"")+" number",u),o.s=null}o.c=o.e=null,T=0}}(),U.absoluteValue=U.abs=function(){var e=new t(this);return e.s<0&&(e.s=1),e},U.ceil=function(){return A(new t(this),this.e+1,2)},U.comparedTo=U.cmp=function(e,n){return T=1,a(this,new t(e,n))},U.decimalPlaces=U.dp=function(){var e,t,n=this.c;if(!n)return null;if(e=((t=n.length-1)-r(this.e/x))*x,t=n[t])for(;t%10==0;t/=10,e--);return e<0&&(e=0),e},U.dividedBy=U.div=function(e,n){return T=3,L(this,new t(e,n),C,R)},U.dividedToIntegerBy=U.divToInt=function(e,n){return T=4,L(this,new t(e,n),0,1)},U.equals=U.eq=function(e,n){return T=5,0===a(this,new t(e,n))},U.floor=function(){return A(new t(this),this.e+1,3)},U.greaterThan=U.gt=function(e,n){return T=6,a(this,new t(e,n))>0},U.greaterThanOrEqualTo=U.gte=function(e,n){return T=7,1===(n=a(this,new t(e,n)))||0===n},U.isFinite=function(){return!!this.c},U.isInteger=U.isInt=function(){return!!this.c&&r(this.e/x)>this.c.length-2},U.isNaN=function(){return!this.s},U.isNegative=U.isNeg=function(){return this.s<0},U.isZero=function(){return!!this.c&&0==this.c[0]},U.lessThan=U.lt=function(e,n){return T=8,a(this,new t(e,n))<0},U.lessThanOrEqualTo=U.lte=function(e,n){return T=9,-1===(n=a(this,new t(e,n)))||0===n},U.minus=U.sub=function(e,n){var i,a,o,u,s=this,c=s.s;if(T=10,e=new t(e,n),n=e.s,!c||!n)return new t(NaN);if(c!=n)return e.s=-n,s.plus(e);var l=s.e/x,f=e.e/x,g=s.c,p=e.c;if(!l||!f){if(!g||!p)return g?(e.s=-n,e):new t(p?s:NaN);if(!g[0]||!p[0])return p[0]?(e.s=-n,e):new t(g[0]?s:3==R?-0:0)}if(l=r(l),f=r(f),g=g.slice(),c=l-f){for((u=c<0)?(c=-c,o=g):(f=l,o=p),o.reverse(),n=c;n--;o.push(0));o.reverse()}else for(a=(u=(c=g.length)<(n=p.length))?c:n,c=n=0;n0)for(;n--;g[i++]=0);for(n=w-1;a>c;){if(g[--a]