/*!
* 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.4.2
* Release date: 19/02/2020 (built at 19/02/2020 13:44:06)
*/
(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 = 416);
/******/ })
/************************************************************************/
/******/ ([
/* 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";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(10);
__webpack_require__(23);
__webpack_require__(38);
__webpack_require__(52);
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__(42));
var _array = __webpack_require__(4);
/**
* 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);
}
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(19);
__webpack_require__(60);
__webpack_require__(12);
__webpack_require__(13);
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;
}
/***/ }),
/* 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__(42);
var assertThisInitialized = __webpack_require__(28);
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__(222);
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__(19);
__webpack_require__(31);
__webpack_require__(12);
__webpack_require__(54);
__webpack_require__(41);
__webpack_require__(177);
__webpack_require__(10);
__webpack_require__(119);
__webpack_require__(23);
__webpack_require__(38);
__webpack_require__(39);
__webpack_require__(40);
__webpack_require__(52);
__webpack_require__(143);
exports.__esModule = true;
exports.getParent = getParent;
exports.getFrameElement = getFrameElement;
exports.getParentWindow = getParentWindow;
exports.hasAccessToParentWindow = hasAccessToParentWindow;
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.matchesCSSRules = matchesCSSRules;
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__(37));
var _browser = __webpack_require__(71);
var _feature = __webpack_require__(76);
/**
* 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.
* @returns {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;
}
/**
* Gets `frameElement` of the specified frame. Returns null if it is a top frame or if script has no access to read property.
*
* @param {Window} frame Frame from which should be get frameElement in safe way.
* @returns {HTMLIFrameElement|null}
*/
function getFrameElement(frame) {
return Object.getPrototypeOf(frame.parent) && frame.frameElement;
}
/**
* Gets parent frame of the specified frame. Returns null if it is a top frame or if script has no access to read property.
*
* @param {Window} frame Frame from which should be get frameElement in safe way.
* @returns {Window|null}
*/
function getParentWindow(frame) {
return getFrameElement(frame) && frame.parent;
}
/**
* Checks if script has access to read from parent frame of specified frame.
* @param {Window} frame Frame from which should be get frameElement in safe way.
*/
function hasAccessToParentWindow(frame) {
return !!Object.getPrototypeOf(frame.parent);
}
/**
* Goes up the DOM tree (including given element) until it finds an parent element that matches the nodes or nodes name.
* This method goes up through web components.
*
* @param {Node} element Element from which traversing is started.
* @param {(string | Node)[]} [nodes] Array of elements or Array of elements name (in uppercase form).
* @param {Node} [until] The element until the traversing ends.
* @returns {Node|null}
*/
function closest(element) {
var nodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var until = arguments.length > 2 ? arguments[2] : undefined;
var _Node = Node,
ELEMENT_NODE = _Node.ELEMENT_NODE,
DOCUMENT_FRAGMENT_NODE = _Node.DOCUMENT_FRAGMENT_NODE;
var elementToCheck = element;
while (elementToCheck !== null && elementToCheck !== void 0 && elementToCheck !== until) {
var _elementToCheck = elementToCheck,
nodeType = _elementToCheck.nodeType,
nodeName = _elementToCheck.nodeName;
if (nodeType === ELEMENT_NODE && (nodes.includes(nodeName) || nodes.includes(elementToCheck))) {
return elementToCheck;
}
var _elementToCheck2 = elementToCheck,
host = _elementToCheck2.host;
if (host && nodeType === DOCUMENT_FRAGMENT_NODE) {
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') {
if (child.defaultView) {
queriedParents = Array.prototype.slice.call(child.querySelectorAll(parent), 0);
} else {
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
* @returns {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.
* @returns {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
* @returns {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
* @returns {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];
}
}
/**
* Verifies if element fit to provided CSSRule.
*
* @param {Element} element Element to verify with selector text.
* @param {CSSRule} rule Selector text from CSSRule.
* @returns {Boolean}
*/
function matchesCSSRules(element, rule) {
var selectorText = rule.selectorText;
var result = false;
if (rule.type === CSSRule.STYLE_RULE && selectorText) {
if (element.msMatchesSelector) {
result = element.msMatchesSelector(selectorText);
} else if (element.matches) {
result = element.matches(selectorText);
}
}
return result;
}
/**
* 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
* @returns {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
*
* @returns {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
* @returns {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('HandsontableCopyPaste') === -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 _typeof = __webpack_require__(42);
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function _getRequireWildcardCache() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
return {
"default": obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj["default"] = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
module.exports = _interopRequireWildcard;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
var TO_STRING_TAG_SUPPORT = __webpack_require__(164);
var redefine = __webpack_require__(68);
var toString = __webpack_require__(424);
// `Object.prototype.toString` method
// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
if (!TO_STRING_TAG_SUPPORT) {
redefine(Object.prototype, 'toString', toString, { unsafe: true });
}
/***/ }),
/* 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 $ = __webpack_require__(20);
var $indexOf = __webpack_require__(158).indexOf;
var arrayMethodIsStrict = __webpack_require__(84);
var arrayMethodUsesToLength = __webpack_require__(59);
var nativeIndexOf = [].indexOf;
var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
var STRICT_METHOD = arrayMethodIsStrict('indexOf');
var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
// `Array.prototype.indexOf` method
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH }, {
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);
}
});
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var charAt = __webpack_require__(165).charAt;
var InternalStateModule = __webpack_require__(81);
var defineIterator = __webpack_require__(162);
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 };
});
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
var superPropBase = __webpack_require__(463);
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;
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toIndexedObject = __webpack_require__(63);
var addToUnscopables = __webpack_require__(109);
var Iterators = __webpack_require__(112);
var InternalStateModule = __webpack_require__(81);
var defineIterator = __webpack_require__(162);
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');
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(35);
var DOMIterables = __webpack_require__(214);
var ArrayIteratorMethods = __webpack_require__(15);
var createNonEnumerableProperty = __webpack_require__(67);
var wellKnownSymbol = __webpack_require__(36);
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 {
createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
} catch (error) {
CollectionPrototype[ITERATOR] = ArrayValues;
}
if (!CollectionPrototype[TO_STRING_TAG]) {
createNonEnumerableProperty(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 {
createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
} catch (error) {
CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
}
}
}
}
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(10);
__webpack_require__(23);
__webpack_require__(38);
__webpack_require__(40);
exports.__esModule = true;
exports.isNumeric = isNumeric;
exports.rangeEach = rangeEach;
exports.rangeEachReverse = rangeEachReverse;
exports.valueAccordingPercent = valueAccordingPercent;
var _typeof2 = _interopRequireDefault(__webpack_require__(42));
/**
* 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;
}
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
var arrayWithHoles = __webpack_require__(229);
var iterableToArrayLimit = __webpack_require__(431);
var nonIterableRest = __webpack_require__(230);
function _slicedToArray(arr, i) {
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
}
module.exports = _slicedToArray;
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(20);
var fails = __webpack_require__(26);
var isArray = __webpack_require__(114);
var isObject = __webpack_require__(45);
var toObject = __webpack_require__(58);
var toLength = __webpack_require__(49);
var createProperty = __webpack_require__(115);
var arraySpeciesCreate = __webpack_require__(170);
var arrayMethodHasSpeciesSupport = __webpack_require__(116);
var wellKnownSymbol = __webpack_require__(36);
var V8_VERSION = __webpack_require__(218);
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
// We can't use this feature detection in V8 since it causes
// deoptimization and serious performance degradation
// https://github.com/zloirock/core-js/issues/679
var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !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;
}
});
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(35);
var getOwnPropertyDescriptor = __webpack_require__(79).f;
var createNonEnumerableProperty = __webpack_require__(67);
var redefine = __webpack_require__(68);
var setGlobal = __webpack_require__(156);
var copyConstructorProperties = __webpack_require__(198);
var isForced = __webpack_require__(134);
/*
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)) {
createNonEnumerableProperty(sourceProperty, 'sham', true);
}
// extend global
redefine(target, key, sourceProperty, options);
}
};
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(15);
__webpack_require__(65);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(24);
__webpack_require__(16);
exports.__esModule = true;
exports.registerPlugin = registerPlugin;
exports.getPlugin = getPlugin;
exports.getRegistredPluginNames = getRegistredPluginNames;
exports.getPluginName = getPluginName;
var _pluginHooks = _interopRequireDefault(__webpack_require__(46));
var _object = __webpack_require__(3);
var _string = __webpack_require__(74);
/**
* 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;
}
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(12);
__webpack_require__(15);
__webpack_require__(33);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(24);
__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__(3);
var _array = __webpack_require__(4);
var _recordTranslator = __webpack_require__(98);
var _plugins = __webpack_require__(21);
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, _recordTranslator.getTranslator)(hotInstance), {
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 (property !== 'hot' && property !== 't') {
_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 $ = __webpack_require__(20);
var exec = __webpack_require__(140);
$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
exec: exec
});
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var global = __webpack_require__(35);
var redefineAll = __webpack_require__(166);
var InternalMetadataModule = __webpack_require__(136);
var collection = __webpack_require__(137);
var collectionWeak = __webpack_require__(213);
var isObject = __webpack_require__(45);
var enforceIternalState = __webpack_require__(81).enforce;
var NATIVE_WEAK_MAP = __webpack_require__(197);
var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
var isExtensible = Object.isExtensible;
var InternalWeakMap;
var wrapper = function (init) {
return function WeakMap() {
return init(this, arguments.length ? arguments[0] : undefined);
};
};
// `WeakMap` constructor
// https://tc39.github.io/ecma262/#sec-weakmap-constructor
var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);
// 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;
}
});
}
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(33);
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__(3);
var _feature = __webpack_require__(76);
var _event = __webpack_require__(32);
/**
* 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;
}
/***/ }),
/* 26 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.Renderer = void 0;
var _viewportColumns = _interopRequireDefault(__webpack_require__(223));
exports.ViewportColumnsCalculator = _viewportColumns.default;
var _viewportRows = _interopRequireDefault(__webpack_require__(224));
exports.ViewportRowsCalculator = _viewportRows.default;
var _coords = _interopRequireDefault(__webpack_require__(118));
exports.CellCoords = _coords.default;
var _range = _interopRequireDefault(__webpack_require__(225));
exports.CellRange = _range.default;
var _column = _interopRequireDefault(__webpack_require__(226));
exports.ColumnFilter = _column.default;
var _row = _interopRequireDefault(__webpack_require__(227));
exports.RowFilter = _row.default;
var _master = _interopRequireDefault(__webpack_require__(228));
exports.MasterTable = _master.default;
var _left = _interopRequireDefault(__webpack_require__(450));
exports.LeftOverlay = _left.default;
var _top = _interopRequireDefault(__webpack_require__(452));
exports.TopOverlay = _top.default;
var _topLeftCorner = _interopRequireDefault(__webpack_require__(454));
exports.TopLeftCornerOverlay = _topLeftCorner.default;
var _bottom = _interopRequireDefault(__webpack_require__(456));
exports.BottomOverlay = _bottom.default;
var _bottomLeftCorner = _interopRequireDefault(__webpack_require__(458));
exports.BottomLeftCornerOverlay = _bottomLeftCorner.default;
var _border = _interopRequireDefault(__webpack_require__(373));
exports.Border = _border.default;
var _core = _interopRequireDefault(__webpack_require__(363));
exports.default = _core.default;
exports.Core = _core.default;
var _event = _interopRequireDefault(__webpack_require__(364));
exports.Event = _event.default;
var _overlays = _interopRequireDefault(__webpack_require__(365));
exports.Overlays = _overlays.default;
var _scroll = _interopRequireDefault(__webpack_require__(367));
exports.Scroll = _scroll.default;
var _selection = _interopRequireDefault(__webpack_require__(460));
exports.Selection = _selection.default;
var _settings = _interopRequireDefault(__webpack_require__(368));
exports.Settings = _settings.default;
var Renderer = _interopRequireWildcard(__webpack_require__(231));
exports.Renderer = Renderer;
var _orderView = __webpack_require__(145);
exports.OrderView = _orderView.OrderView;
exports.SharedOrderView = _orderView.SharedOrderView;
var _viewport = _interopRequireDefault(__webpack_require__(369));
exports.Viewport = _viewport.default;
var _eventManager = __webpack_require__(25);
exports.getListenersCounter = _eventManager.getListenersCounter;
/***/ }),
/* 28 */
/***/ (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;
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(10);
__webpack_require__(23);
__webpack_require__(38);
__webpack_require__(440);
__webpack_require__(234);
__webpack_require__(40);
__webpack_require__(52);
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__(72));
var _typeof2 = _interopRequireDefault(__webpack_require__(42));
var _moment = _interopRequireDefault(__webpack_require__(64));
var _templateLiteralTag = __webpack_require__(73);
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.4.2";
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)("19/02/2020", '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 */
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(19);
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
};
}
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(20);
var $includes = __webpack_require__(158).includes;
var addToUnscopables = __webpack_require__(109);
var arrayMethodUsesToLength = __webpack_require__(59);
var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
// `Array.prototype.includes` method
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
$({ target: 'Array', proto: true, forced: !USES_TO_LENGTH }, {
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');
/***/ }),
/* 32 */
/***/ (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 frame = event.target.ownerDocument.defaultView;
var offset = (0, _element.getWindowScrollTop)(frame);
frame = (0, _element.getParentWindow)(frame);
while (frame) {
offset -= (0, _element.getWindowScrollTop)(frame);
frame = (0, _element.getParentWindow)(frame);
}
return event.clientY + offset;
}
/**
* 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;
}
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(20);
var toAbsoluteIndex = __webpack_require__(133);
var toInteger = __webpack_require__(82);
var toLength = __webpack_require__(49);
var toObject = __webpack_require__(58);
var arraySpeciesCreate = __webpack_require__(170);
var createProperty = __webpack_require__(115);
var arrayMethodHasSpeciesSupport = __webpack_require__(116);
var arrayMethodUsesToLength = __webpack_require__(59);
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
var USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });
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: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
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;
}
});
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(20);
var global = __webpack_require__(35);
var userAgent = __webpack_require__(139);
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)
});
/***/ }),
/* 35 */
/***/ (function(module, exports) {
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 == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
check(typeof self == 'object' && self) ||
check(typeof global == 'object' && global) ||
// eslint-disable-next-line no-new-func
Function('return this')();
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(35);
var shared = __webpack_require__(157);
var has = __webpack_require__(47);
var uid = __webpack_require__(132);
var NATIVE_SYMBOL = __webpack_require__(161);
var USE_SYMBOL_AS_UID = __webpack_require__(203);
var WellKnownSymbolsStore = shared('wks');
var Symbol = global.Symbol;
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
module.exports = function (name) {
if (!has(WellKnownSymbolsStore, name)) {
if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];
else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
} return WellKnownSymbolsStore[name];
};
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
var arrayWithoutHoles = __webpack_require__(426);
var iterableToArray = __webpack_require__(217);
var nonIterableSpread = __webpack_require__(427);
function _toConsumableArray(arr) {
return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
}
module.exports = _toConsumableArray;
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var redefine = __webpack_require__(68);
var anObject = __webpack_require__(48);
var fails = __webpack_require__(26);
var flags = __webpack_require__(171);
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 });
}
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(20);
var notARegExp = __webpack_require__(175);
var requireObjectCoercible = __webpack_require__(53);
var correctIsRegExpLogic = __webpack_require__(176);
// `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);
}
});
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fixRegExpWellKnownSymbolLogic = __webpack_require__(141);
var anObject = __webpack_require__(48);
var toObject = __webpack_require__(58);
var toLength = __webpack_require__(49);
var toInteger = __webpack_require__(82);
var requireObjectCoercible = __webpack_require__(53);
var advanceStringIndex = __webpack_require__(173);
var regExpExec = __webpack_require__(142);
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, reason) {
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
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) {
if (
(!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
(typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
) {
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__(20);
var isObject = __webpack_require__(45);
var isArray = __webpack_require__(114);
var toAbsoluteIndex = __webpack_require__(133);
var toLength = __webpack_require__(49);
var toIndexedObject = __webpack_require__(63);
var createProperty = __webpack_require__(115);
var wellKnownSymbol = __webpack_require__(36);
var arrayMethodHasSpeciesSupport = __webpack_require__(116);
var arrayMethodUsesToLength = __webpack_require__(59);
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
var USES_TO_LENGTH = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });
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: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
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;
}
});
/***/ }),
/* 42 */
/***/ (function(module, exports) {
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
module.exports = _typeof = function _typeof(obj) {
return typeof obj;
};
} else {
module.exports = _typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
module.exports = _typeof;
/***/ }),
/* 43 */
/***/ (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__(83));
var _cellDecorator = _interopRequireDefault(__webpack_require__(473));
var _autocompleteRenderer = _interopRequireDefault(__webpack_require__(474));
var _checkboxRenderer = _interopRequireDefault(__webpack_require__(475));
var _htmlRenderer = _interopRequireDefault(__webpack_require__(476));
var _numericRenderer = _interopRequireDefault(__webpack_require__(477));
var _passwordRenderer = _interopRequireDefault(__webpack_require__(478));
var _textRenderer = _interopRequireDefault(__webpack_require__(479));
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);
}
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(26);
// Thank's IE8 for his funny defineProperty
module.exports = !fails(function () {
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});
/***/ }),
/* 45 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(12);
__webpack_require__(33);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _array = __webpack_require__(4);
var _object = __webpack_require__(3);
/**
* @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 http://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 http://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 http://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 http://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 http://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 http://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 http://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 http://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.
*/
'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 http://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 change order of the visual indexes. This hook is fired when
* {@link Options#manualRowMove} option is enabled.
*
* @event Hooks#beforeRowMove
* @param {Number[]} rows An array of visual row indexes to be moved.
* @param {Number} target Visual row index being a target for moved rows.
*/
'beforeRowMove',
/**
* Fired by {@link ManualRowMove} plugin after change order of the visual indexes. This hook is fired when
* {@link Options#manualRowMove} option is enabled.
*
* @event Hooks#afterRowMove
* @param {Number[]} rows An array of visual row indexes that were moved.
* @param {Number} target Visual row index being a target for moved rows.
*/
'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 http://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 http://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',
/**
* Used to skip the length cache calculation for a defined period of time.
*
* @event Hooks#skipLengthCache
* @param {Number} delay The delay in milliseconds.
*/
'skipLengthCache',
/**
* 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 http://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;
/***/ }),
/* 47 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(45);
module.exports = function (it) {
if (!isObject(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(82);
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
};
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(20);
var $filter = __webpack_require__(75).filter;
var arrayMethodHasSpeciesSupport = __webpack_require__(116);
var arrayMethodUsesToLength = __webpack_require__(59);
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
// Edge 14- issue
var USES_TO_LENGTH = arrayMethodUsesToLength('filter');
// `Array.prototype.filter` method
// https://tc39.github.io/ecma262/#sec-array.prototype.filter
// with adding support of @@species
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
filter: function filter(callbackfn /* , thisArg */) {
return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(44);
var IE8_DOM_DEFINE = __webpack_require__(194);
var anObject = __webpack_require__(48);
var toPrimitive = __webpack_require__(105);
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;
};
/***/ }),
/* 52 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fixRegExpWellKnownSymbolLogic = __webpack_require__(141);
var isRegExp = __webpack_require__(172);
var anObject = __webpack_require__(48);
var requireObjectCoercible = __webpack_require__(53);
var speciesConstructor = __webpack_require__(429);
var advanceStringIndex = __webpack_require__(173);
var toLength = __webpack_require__(49);
var callRegExpExec = __webpack_require__(142);
var regexpExec = __webpack_require__(140);
var fails = __webpack_require__(26);
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);
/***/ }),
/* 53 */
/***/ (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;
};
/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(20);
var IndexedObject = __webpack_require__(104);
var toIndexedObject = __webpack_require__(63);
var arrayMethodIsStrict = __webpack_require__(84);
var nativeJoin = [].join;
var ES3_STRINGS = IndexedObject != Object;
var STRICT_METHOD = arrayMethodIsStrict('join', ',');
// `Array.prototype.join` method
// https://tc39.github.io/ecma262/#sec-array.prototype.join
$({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
join: function join(separator) {
return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
}
});
/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(31);
__webpack_require__(12);
__webpack_require__(23);
__webpack_require__(39);
__webpack_require__(52);
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__(4);
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;
}
/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(44);
var defineProperty = __webpack_require__(51).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 '';
}
}
});
}
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(15);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(24);
__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__(83));
var _pluginHooks = _interopRequireDefault(__webpack_require__(46));
var _baseEditor = _interopRequireDefault(__webpack_require__(117));
var _autocompleteEditor = _interopRequireDefault(__webpack_require__(375));
var _checkboxEditor = _interopRequireDefault(__webpack_require__(465));
var _dateEditor = _interopRequireDefault(__webpack_require__(466));
var _dropdownEditor = _interopRequireDefault(__webpack_require__(469));
var _handsontableEditor = _interopRequireDefault(__webpack_require__(376));
var _numericEditor = _interopRequireDefault(__webpack_require__(470));
var _passwordEditor = _interopRequireDefault(__webpack_require__(471));
var _selectEditor = _interopRequireDefault(__webpack_require__(472));
var _textEditor = _interopRequireDefault(__webpack_require__(123));
/**
* 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);
}
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
var requireObjectCoercible = __webpack_require__(53);
// `ToObject` abstract operation
// https://tc39.github.io/ecma262/#sec-toobject
module.exports = function (argument) {
return Object(requireObjectCoercible(argument));
};
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(44);
var fails = __webpack_require__(26);
var has = __webpack_require__(47);
var defineProperty = Object.defineProperty;
var cache = {};
var thrower = function (it) { throw it; };
module.exports = function (METHOD_NAME, options) {
if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
if (!options) options = {};
var method = [][METHOD_NAME];
var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
var argument0 = has(options, 0) ? options[0] : thrower;
var argument1 = has(options, 1) ? options[1] : undefined;
return cache[METHOD_NAME] = !!method && !fails(function () {
if (ACCESSORS && !DESCRIPTORS) return true;
var O = { length: -1 };
if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower });
else O[1] = 1;
method.call(O, argument0, argument1);
});
};
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(20);
var from = __webpack_require__(428);
var checkCorrectnessOfIteration = __webpack_require__(212);
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
});
/***/ }),
/* 61 */
/***/ (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__(29);
/* 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);
}
}
/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _array = __webpack_require__(4);
var _object = __webpack_require__(3);
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;
/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {
// toObject with fallback for non-array-like ES3 strings
var IndexedObject = __webpack_require__(104);
var requireObjectCoercible = __webpack_require__(53);
module.exports = function (it) {
return IndexedObject(requireObjectCoercible(it));
};
/***/ }),
/* 64 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {var require;//! moment.js
;(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;
// the date constructor remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0) {
// preserve leap years using a full 400 year cycle, then reset
date = new Date(y + 400, m, d, h, M, s, ms);
if (isFinite(date.getFullYear())) {
date.setFullYear(y);
}
} else {
date = new Date(y, m, d, h, M, s, ms);
}
return date;
}
function createUTCDate (y) {
var date;
// the Date.UTC function remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0) {
var args = Array.prototype.slice.call(arguments);
// preserve leap years using a full 400 year cycle, then reset
args[0] = y + 400;
date = new Date(Date.UTC.apply(null, args));
if (isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
} else {
date = new Date(Date.UTC.apply(null, arguments));
}
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 6th 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
function shiftWeekdays (ws, n) {
return ws.slice(n, 7).concat(ws.slice(0, n));
}
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
function localeWeekdays (m, format) {
var weekdays = isArray(this._weekdays) ? this._weekdays :
this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone'];
return (m === true) ? shiftWeekdays(weekdays, this._week.dow)
: (m) ? weekdays[m.day()] : weekdays;
}
var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
function localeWeekdaysShort (m) {
return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow)
: (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
}
var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
function localeWeekdaysMin (m) {
return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow)
: (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 they want. 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);
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 globalLocale;
}
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__(444)("./" + 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;
}
else {
if ((typeof console !== 'undefined') && console.warn) {
//warn user if arguments are passed but the locale could not be set
console.warn('Locale ' + key + ' not found. Did you forget to load it?');
}
}
}
return globalLocale._abbr;
}
function defineLocale (name, config) {
if (config !== null) {
var locale, 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 {
locale = loadLocale(config.parentLocale);
if (locale != null) {
parentConfig = locale._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 beginning of week
weekday = w.e + dow;
if (w.e < 0 || w.e > 6) {
weekdayOverflow = true;
}
} else {
// default to beginning 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, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
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 || normalizedInput.isoWeek || 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 : 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 = {};
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(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(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) {
var localFrom = isMoment(from) ? from : createLocal(from),
localTo = isMoment(to) ? to : createLocal(to);
if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
return false;
}
inclusivity = inclusivity || '()';
return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) &&
(inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, 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,
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.valueOf() + this.utcOffset() * 60 * 1000).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;
}
var MS_PER_SECOND = 1000;
var MS_PER_MINUTE = 60 * MS_PER_SECOND;
var MS_PER_HOUR = 60 * MS_PER_MINUTE;
var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
// actual modulo - handles negative numbers (for dates before 1970):
function mod$1(dividend, divisor) {
return (dividend % divisor + divisor) % divisor;
}
function localStartOfDate(y, m, d) {
// the date constructor remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0) {
// preserve leap years using a full 400 year cycle, then reset
return new Date(y + 400, m, d) - MS_PER_400_YEARS;
} else {
return new Date(y, m, d).valueOf();
}
}
function utcStartOfDate(y, m, d) {
// Date.UTC remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0) {
// preserve leap years using a full 400 year cycle, then reset
return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
} else {
return Date.UTC(y, m, d);
}
}
function startOf (units) {
var time;
units = normalizeUnits(units);
if (units === undefined || units === 'millisecond' || !this.isValid()) {
return this;
}
var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
switch (units) {
case 'year':
time = startOfDate(this.year(), 0, 1);
break;
case 'quarter':
time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
break;
case 'month':
time = startOfDate(this.year(), this.month(), 1);
break;
case 'week':
time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
break;
case 'isoWeek':
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
break;
case 'day':
case 'date':
time = startOfDate(this.year(), this.month(), this.date());
break;
case 'hour':
time = this._d.valueOf();
time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
break;
case 'minute':
time = this._d.valueOf();
time -= mod$1(time, MS_PER_MINUTE);
break;
case 'second':
time = this._d.valueOf();
time -= mod$1(time, MS_PER_SECOND);
break;
}
this._d.setTime(time);
hooks.updateOffset(this, true);
return this;
}
function endOf (units) {
var time;
units = normalizeUnits(units);
if (units === undefined || units === 'millisecond' || !this.isValid()) {
return this;
}
var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
switch (units) {
case 'year':
time = startOfDate(this.year() + 1, 0, 1) - 1;
break;
case 'quarter':
time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
break;
case 'month':
time = startOfDate(this.year(), this.month() + 1, 1) - 1;
break;
case 'week':
time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
break;
case 'isoWeek':
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
break;
case 'day':
case 'date':
time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
break;
case 'hour':
time = this._d.valueOf();
time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
break;
case 'minute':
time = this._d.valueOf();
time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
break;
case 'second':
time = this._d.valueOf();
time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
break;
}
this._d.setTime(time);
hooks.updateOffset(this, true);
return this;
}
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');
// PRIORITY
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;
proto.year = getSetYear;
proto.isLeapYear = getIsLeapYear;
proto.weekYear = getSetWeekYear;
proto.isoWeekYear = getSetISOWeekYear;
proto.quarter = proto.quarters = getSetQuarter;
proto.month = getSetMonth;
proto.daysInMonth = getDaysInMonth;
proto.week = proto.weeks = getSetWeek;
proto.isoWeek = proto.isoWeeks = getSetISOWeek;
proto.weeksInYear = getWeeksInYear;
proto.isoWeeksInYear = getISOWeeksInYear;
proto.date = getSetDayOfMonth;
proto.day = proto.days = getSetDayOfWeek;
proto.weekday = getSetLocaleDayOfWeek;
proto.isoWeekday = getSetISODayOfWeek;
proto.dayOfYear = getSetDayOfYear;
proto.hour = proto.hours = getSetHour;
proto.minute = proto.minutes = getSetMinute;
proto.second = proto.seconds = getSetSecond;
proto.millisecond = proto.milliseconds = getSetMillisecond;
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;
proto.zoneAbbr = getZoneAbbr;
proto.zoneName = getZoneName;
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;
proto$1.months = localeMonths;
proto$1.monthsShort = localeMonthsShort;
proto$1.monthsParse = localeMonthsParse;
proto$1.monthsRegex = monthsRegex;
proto$1.monthsShortRegex = monthsShortRegex;
proto$1.week = localeWeek;
proto$1.firstDayOfYear = localeFirstDayOfYear;
proto$1.firstDayOfWeek = localeFirstDayOfWeek;
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;
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 === 'quarter' || units === 'year') {
days = this._days + milliseconds / 864e5;
months = this._months + daysToMonths(days);
switch (units) {
case 'month': return months;
case 'quarter': return months / 3;
case 'year': return 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 asQuarters = makeAs('Q');
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.asQuarters = asQuarters;
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;
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.24.0';
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: 'GGGG-[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__(443)(module)))
/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(20);
var toObject = __webpack_require__(58);
var nativeKeys = __webpack_require__(111);
var fails = __webpack_require__(26);
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__(19);
__webpack_require__(12);
__webpack_require__(144);
__webpack_require__(41);
__webpack_require__(56);
__webpack_require__(23);
__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__(4);
var _element = __webpack_require__(8);
var _separator = __webpack_require__(186);
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__) {
var DESCRIPTORS = __webpack_require__(44);
var definePropertyModule = __webpack_require__(51);
var createPropertyDescriptor = __webpack_require__(103);
module.exports = DESCRIPTORS ? function (object, key, value) {
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(35);
var createNonEnumerableProperty = __webpack_require__(67);
var has = __webpack_require__(47);
var setGlobal = __webpack_require__(156);
var inspectSource = __webpack_require__(195);
var InternalStateModule = __webpack_require__(81);
var getInternalState = InternalStateModule.get;
var enforceInternalState = InternalStateModule.enforce;
var TEMPLATE = String(String).split('String');
(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')) createNonEnumerableProperty(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 createNonEnumerableProperty(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 || inspectSource(this);
});
/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var collection = __webpack_require__(137);
var collectionStrong = __webpack_require__(215);
// `Map` constructor
// https://tc39.github.io/ecma262/#sec-map-objects
module.exports = collection('Map', function (init) {
return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
}, collectionStrong);
/***/ }),
/* 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, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.setBrowserMeta = setBrowserMeta;
exports.setPlatformMeta = setPlatformMeta;
exports.isChrome = isChrome;
exports.isEdge = isEdge;
exports.isIE = isIE;
exports.isIE8 = isIE8;
exports.isIE9 = isIE9;
exports.isMSBrowser = isMSBrowser;
exports.isMobileBrowser = isMobileBrowser;
exports.isSafari = isSafari;
exports.isFirefox = isFirefox;
exports.isWindowsOS = isWindowsOS;
exports.isMacOS = isMacOS;
exports.isLinuxOS = isLinuxOS;
var _object = __webpack_require__(3);
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);
}),
firefox: tester(function (ua) {
return /Firefox/.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);
})
};
var platforms = {
mac: tester(function (platform) {
return /^Mac/.test(platform);
}),
win: tester(function (platform) {
return /^Win/.test(platform);
}),
linux: tester(function (platform) {
return /^Linux/.test(platform);
})
};
/**
* @param {object} [metaObject] The browser identity collection.
* @param {object} [metaObject.userAgent] The user agent reported by browser.
* @param {object} [metaObject.vendor] The vendor name reported by browser.
*/
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);
});
}
/**
* @param {object} [metaObject] The platform identity collection.
* @param {object} [metaObject.platform] The platform ID.
*/
function setPlatformMeta() {
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref3$platform = _ref3.platform,
platform = _ref3$platform === void 0 ? navigator.platform : _ref3$platform;
(0, _object.objectEach)(platforms, function (_ref4) {
var test = _ref4.test;
return void test(platform);
});
}
setBrowserMeta();
setPlatformMeta();
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;
}
function isFirefox() {
return browsers.firefox.value;
}
/**
* @returns {boolean}
*/
function isWindowsOS() {
return platforms.win.value;
}
/**
* @returns {boolean}
*/
function isMacOS() {
return platforms.mac.value;
}
/**
* @returns {boolean}
*/
function isLinuxOS() {
return platforms.linux.value;
}
/***/ }),
/* 72 */
/***/ (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;
/***/ }),
/* 73 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(23);
__webpack_require__(40);
__webpack_require__(143);
exports.__esModule = true;
exports.toSingleLine = toSingleLine;
var _array = __webpack_require__(4);
/* 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();
}
/***/ }),
/* 74 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(12);
__webpack_require__(10);
__webpack_require__(23);
__webpack_require__(38);
__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__(29);
/**
* 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, '');
}
/***/ }),
/* 75 */
/***/ (function(module, exports, __webpack_require__) {
var bind = __webpack_require__(113);
var IndexedObject = __webpack_require__(104);
var toObject = __webpack_require__(58);
var toLength = __webpack_require__(49);
var arraySpeciesCreate = __webpack_require__(170);
var push = [].push;
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
var createMethod = function (TYPE) {
var IS_MAP = TYPE == 1;
var IS_FILTER = TYPE == 2;
var IS_SOME = TYPE == 3;
var IS_EVERY = TYPE == 4;
var IS_FIND_INDEX = TYPE == 6;
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
return function ($this, callbackfn, that, specificCreate) {
var O = toObject($this);
var self = IndexedObject(O);
var boundFunction = bind(callbackfn, that, 3);
var length = toLength(self.length);
var index = 0;
var create = specificCreate || arraySpeciesCreate;
var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
var value, result;
for (;length > index; index++) if (NO_HOLES || index in self) {
value = self[index];
result = boundFunction(value, index, O);
if (TYPE) {
if (IS_MAP) target[index] = result; // map
else if (result) switch (TYPE) {
case 3: return true; // some
case 5: return value; // find
case 6: return index; // findIndex
case 2: push.call(target, value); // filter
} else if (IS_EVERY) return false; // every
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
};
};
module.exports = {
// `Array.prototype.forEach` method
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
forEach: createMethod(0),
// `Array.prototype.map` method
// https://tc39.github.io/ecma262/#sec-array.prototype.map
map: createMethod(1),
// `Array.prototype.filter` method
// https://tc39.github.io/ecma262/#sec-array.prototype.filter
filter: createMethod(2),
// `Array.prototype.some` method
// https://tc39.github.io/ecma262/#sec-array.prototype.some
some: createMethod(3),
// `Array.prototype.every` method
// https://tc39.github.io/ecma262/#sec-array.prototype.every
every: createMethod(4),
// `Array.prototype.find` method
// https://tc39.github.io/ecma262/#sec-array.prototype.find
find: createMethod(5),
// `Array.prototype.findIndex` method
// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
findIndex: createMethod(6)
};
/***/ }),
/* 76 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(10);
__webpack_require__(23);
__webpack_require__(38);
__webpack_require__(120);
__webpack_require__(34);
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__(42));
// 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('');
}
/**
* 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') {
var escapedAdjacentHTML = checkElement.replace(/
]*?>([\s\S]*?)<\/\s*td>/g, function (cellFragment) {
var openingTag = cellFragment.match(/
]*?>/g)[0];
var cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).replace(/(<(?!br)([^>]+)>)/gi, '');
var closingTag = '
';
return "".concat(openingTag).concat(cellValue).concat(closingTag);
});
tempElem.insertAdjacentHTML('afterbegin', "".concat(escapedAdjacentHTML));
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)(Array.from(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 ((0, _element.matchesCSSRules)(cell, cssRule)) {
var whiteSpace = cssRule.style.whiteSpace;
if (whiteSpace) {
settings.whiteSpace = whiteSpace;
}
}
return settings;
}, {});
var cellValue = '';
if (cellStyle.whiteSpace === 'nowrap') {
cellValue = innerHTML.replace(/[\r\n][\x20]{0,2}/gim, '\x20').replace(/ /gim, '\r\n');
} else if (generator && /excel/gi.test(generator.content)) {
cellValue = innerHTML.replace(/[\r\n][\x20]{0,2}/g, '\x20').replace(/ [\r\n]?[\x20]{0,3}/gim, '\r\n');
} else {
cellValue = innerHTML.replace(/ [\r\n]?/gim, '\r\n');
}
dataArr[row][col] = cellValue.replace(regEscapedChars, function (match) {
return ESCAPED_HTML_CHARS[match];
});
} 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;
}
/***/ }),
/* 184 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(96);
__webpack_require__(143);
__webpack_require__(97);
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__(4);
/**
* @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;
/***/ }),
/* 185 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(100);
__webpack_require__(60);
__webpack_require__(31);
__webpack_require__(12);
__webpack_require__(15);
__webpack_require__(148);
__webpack_require__(86);
__webpack_require__(87);
__webpack_require__(10);
__webpack_require__(88);
__webpack_require__(13);
__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__(29);
var _object = __webpack_require__(3);
var _event = __webpack_require__(32);
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;
}
/***/ }),
/* 186 */
/***/ (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
};
}
/***/ }),
/* 187 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(19);
__webpack_require__(56);
__webpack_require__(65);
__webpack_require__(10);
__webpack_require__(119);
__webpack_require__(23);
__webpack_require__(38);
__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__(181));
var _element = __webpack_require__(8);
var _array = __webpack_require__(4);
var _cursor = _interopRequireDefault(__webpack_require__(560));
var _eventManager = _interopRequireDefault(__webpack_require__(25));
var _object = __webpack_require__(3);
var _mixed = __webpack_require__(29);
var _function = __webpack_require__(77);
var _utils = __webpack_require__(66);
var _unicode = __webpack_require__(55);
var _localHooks = _interopRequireDefault(__webpack_require__(62));
var _predefinedItems = __webpack_require__(89);
var _event = __webpack_require__(32);
var _browser = __webpack_require__(71);
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,
container: this.hot.rootDocument.documentElement
};
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;
var frame = this.hot.rootWindow;
while (frame) {
this.eventManager.addEventListener(frame.document, 'mousedown', function (event) {
return _this.onDocumentMouseDown(event);
});
frame = (0, _element.getParentWindow)(frame);
}
}
/**
* Set array of objects which defines menu items.
*
* @param {Array} menuItems Menu items to display.
*/
}, {
key: "setMenuItems",
value: function setMenuItems(menuItems) {
this.menuItems = menuItems;
}
/**
* Returns currently selected menu item. Returns `null` if no item was selected.
*
* @returns {Object|null}
*/
}, {
key: "getSelectedItem",
value: function getSelectedItem() {
return this.hasSelectedItem() ? this.hotMenu.getSourceDataAtRow(this.hotMenu.getSelectedLast()[0]) : null;
}
/**
* Checks if the menu has selected (highlighted) any item from the menu list.
*
* @returns {Boolean}
*/
}, {
key: "hasSelectedItem",
value: function hasSelectedItem() {
return Array.isArray(this.hotMenu.getSelectedLast());
}
/**
* 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 shouldAutoCloseMenu = false;
var settings = {
data: filteredItems,
colHeaders: false,
autoColumnSize: true,
autoWrapRow: false,
modifyColWidth: function modifyColWidth(width) {
if ((0, _mixed.isDefined)(width) && width < minWidthOfMenu) {
return minWidthOfMenu;
}
return width;
},
autoRowSize: false,
readOnly: true,
editor: false,
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: false,
outsideClickDeselects: false,
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;
},
afterOnCellContextMenu: function afterOnCellContextMenu(event) {
event.preventDefault(); // On the Windows platform, the "contextmenu" is triggered after the "mouseup" so that's
// why the closing menu is here. (#6507#issuecomment-582392301).
if ((0, _browser.isWindowsOS)() && shouldAutoCloseMenu && _this2.hasSelectedItem()) {
_this2.close(true);
}
},
beforeOnCellMouseUp: function beforeOnCellMouseUp(event) {
if (_this2.hasSelectedItem()) {
shouldAutoCloseMenu = !_this2.isCommandPassive(_this2.getSelectedItem());
_this2.executeCommand(event);
}
},
afterOnCellMouseUp: function afterOnCellMouseUp(event) {
// If the code runs on the other platform than Windows, the "mouseup" is triggered
// after the "contextmenu". So then "mouseup" closes the menu. Otherwise, the closing
// menu responsibility is forwarded to "afterOnCellContextMenu" callback (#6507#issuecomment-582392301).
if ((!(0, _browser.isWindowsOS)() || !(0, _event.isRightClick)(event)) && shouldAutoCloseMenu && _this2.hasSelectedItem()) {
_this2.close(true);
}
},
afterUnlisten: function afterUnlisten() {
// Restore menu focus, fix for `this.instance.unlisten();` call in the tableView.js@260 file.
// This prevents losing table responsiveness for keyboard events when filter select menu is closed (#6497).
if (!_this2.hasSelectedItem() && _this2.isOpened()) {
_this2.hotMenu.listen(false);
}
}
};
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,
container: this.options.container
});
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.hasSelectedItem()) {
return;
}
var selectedItem = this.getSelectedItem();
this.runLocalHooks('select', selectedItem, event);
if (this.isCommandPassive(selectedItem)) {
return;
}
var selRanges = this.hot.getSelectedRange();
var normalizedSelection = selRanges ? (0, _utils.normalizeSelection)(selRanges) : [];
this.runLocalHooks('executeCommand', selectedItem.key, normalizedSelection, event);
if (this.isSubMenu()) {
this.parentMenu.runLocalHooks('executeCommand', selectedItem.key, normalizedSelection, event);
}
}
/**
* Checks if the passed command is passive or not. The command is passive when it's marked as
* disabled, the descriptor object contains `isCommand` property set to `false`, command
* is a separator, or the item is recognized as submenu. For passive items the menu is not
* closed automatically after the user trigger the command through the UI.
*
* @param {Object} commandDescriptor Selected menu item from the menu data source.
* @returns {Boolean}
*/
}, {
key: "isCommandPassive",
value: function isCommandPassive(commandDescriptor) {
var isCommand = commandDescriptor.isCommand,
commandName = commandDescriptor.name,
disabled = commandDescriptor.disabled,
submenu = commandDescriptor.submenu;
var isItemDisabled = disabled === true || typeof disabled === 'function' && disabled.call(this.hot) === true;
return isCommand === false || commandName === _predefinedItems.SEPARATOR || isItemDisabled === true || submenu;
}
/**
* 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.container.ownerDocument.defaultView);
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', '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 doc = this.options.container.ownerDocument;
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 = doc.querySelector(".".concat(this.options.className, ".").concat(className));
}
if (!container) {
container = doc.createElement('div');
(0, _element.addClass)(container, "htMenu ".concat(this.options.className));
if (className) {
(0, _element.addClass)(container, className);
}
this.options.container.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) {
// For input elements, prevent event propagation. It allows entering text into an input
// element freely - without steeling the key events from the menu module (#6506, #6549).
if ((0, _element.isInput)(event.target) && this.container.contains(event.target)) {
(0, _event.stopImmediatePropagation)(event);
return;
}
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;
} // 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.container.ownerDocument) || (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;
/***/ }),
/* 188 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(72));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _index = __webpack_require__(27);
var _templateLiteralTag = __webpack_require__(73);
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;
/***/ }),
/* 189 */
/***/ (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__(3);
var _array = __webpack_require__(4);
var _predefinedItems = __webpack_require__(89);
var _conditionRegisterer = __webpack_require__(30);
var _none = __webpack_require__(633);
exports.CONDITION_NONE = _none.CONDITION_NAME;
var _empty = __webpack_require__(404);
exports.CONDITION_EMPTY = _empty.CONDITION_NAME;
var _notEmpty = __webpack_require__(634);
exports.CONDITION_NOT_EMPTY = _notEmpty.CONDITION_NAME;
var _equal = __webpack_require__(405);
exports.CONDITION_EQUAL = _equal.CONDITION_NAME;
var _notEqual = __webpack_require__(635);
exports.CONDITION_NOT_EQUAL = _notEqual.CONDITION_NAME;
var _greaterThan = __webpack_require__(636);
exports.CONDITION_GREATER_THAN = _greaterThan.CONDITION_NAME;
var _greaterThanOrEqual = __webpack_require__(637);
exports.CONDITION_GREATER_THAN_OR_EQUAL = _greaterThanOrEqual.CONDITION_NAME;
var _lessThan = __webpack_require__(638);
exports.CONDITION_LESS_THAN = _lessThan.CONDITION_NAME;
var _lessThanOrEqual = __webpack_require__(639);
exports.CONDITION_LESS_THAN_OR_EQUAL = _lessThanOrEqual.CONDITION_NAME;
var _between = __webpack_require__(406);
exports.CONDITION_BETWEEN = _between.CONDITION_NAME;
var _notBetween = __webpack_require__(640);
exports.CONDITION_NOT_BETWEEN = _notBetween.CONDITION_NAME;
var _beginsWith = __webpack_require__(641);
exports.CONDITION_BEGINS_WITH = _beginsWith.CONDITION_NAME;
var _endsWith = __webpack_require__(642);
exports.CONDITION_ENDS_WITH = _endsWith.CONDITION_NAME;
var _contains = __webpack_require__(409);
exports.CONDITION_CONTAINS = _contains.CONDITION_NAME;
var _notContains = __webpack_require__(644);
exports.CONDITION_NOT_CONTAINS = _notContains.CONDITION_NAME;
var _before = __webpack_require__(408);
exports.CONDITION_DATE_BEFORE = _before.CONDITION_NAME;
var _after = __webpack_require__(407);
exports.CONDITION_DATE_AFTER = _after.CONDITION_NAME;
var _tomorrow = __webpack_require__(645);
exports.CONDITION_TOMORROW = _tomorrow.CONDITION_NAME;
var _today = __webpack_require__(646);
exports.CONDITION_TODAY = _today.CONDITION_NAME;
var _yesterday = __webpack_require__(647);
exports.CONDITION_YESTERDAY = _yesterday.CONDITION_NAME;
var _byValue = __webpack_require__(648);
exports.CONDITION_BY_VALUE = _byValue.CONDITION_NAME;
var _true = __webpack_require__(649);
exports.CONDITION_TRUE = _true.CONDITION_NAME;
var _false = __webpack_require__(650);
exports.CONDITION_FALSE = _false.CONDITION_NAME;
var _conjunction = __webpack_require__(190);
exports.OPERATION_AND = _conjunction.OPERATION_ID;
var _disjunction = __webpack_require__(410);
exports.OPERATION_OR = _disjunction.OPERATION_ID;
var _disjunctionWithExtraCondition = __webpack_require__(411);
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;
}
/***/ }),
/* 190 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
__webpack_require__(100);
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__(126);
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);
/***/ }),
/* 191 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(15);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(24);
__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__(28));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(5));
var _get2 = _interopRequireDefault(__webpack_require__(14));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _element = __webpack_require__(8);
var _object = __webpack_require__(3);
var _base = _interopRequireDefault(__webpack_require__(127));
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;
/***/ }),
/* 192 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(19);
__webpack_require__(56);
__webpack_require__(10);
__webpack_require__(38);
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;
}
/***/ }),
/* 193 */
/***/ (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;
/***/ }),
/* 194 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(44);
var fails = __webpack_require__(26);
var createElement = __webpack_require__(155);
// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
/***/ }),
/* 195 */
/***/ (function(module, exports, __webpack_require__) {
var store = __webpack_require__(196);
var functionToString = Function.toString;
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
if (typeof store.inspectSource != 'function') {
store.inspectSource = function (it) {
return functionToString.call(it);
};
}
module.exports = store.inspectSource;
/***/ }),
/* 196 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(35);
var setGlobal = __webpack_require__(156);
var SHARED = '__core-js_shared__';
var store = global[SHARED] || setGlobal(SHARED, {});
module.exports = store;
/***/ }),
/* 197 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(35);
var inspectSource = __webpack_require__(195);
var WeakMap = global.WeakMap;
module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
/***/ }),
/* 198 */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(47);
var ownKeys = __webpack_require__(199);
var getOwnPropertyDescriptorModule = __webpack_require__(79);
var definePropertyModule = __webpack_require__(51);
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));
}
};
/***/ }),
/* 199 */
/***/ (function(module, exports, __webpack_require__) {
var getBuiltIn = __webpack_require__(107);
var getOwnPropertyNamesModule = __webpack_require__(108);
var getOwnPropertySymbolsModule = __webpack_require__(160);
var anObject = __webpack_require__(48);
// 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;
};
/***/ }),
/* 200 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(35);
module.exports = global;
/***/ }),
/* 201 */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(47);
var toIndexedObject = __webpack_require__(63);
var indexOf = __webpack_require__(158).indexOf;
var hiddenKeys = __webpack_require__(106);
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;
};
/***/ }),
/* 202 */
/***/ (function(module, exports, __webpack_require__) {
var toIndexedObject = __webpack_require__(63);
var nativeGetOwnPropertyNames = __webpack_require__(108).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));
};
/***/ }),
/* 203 */
/***/ (function(module, exports, __webpack_require__) {
var NATIVE_SYMBOL = __webpack_require__(161);
module.exports = NATIVE_SYMBOL
// eslint-disable-next-line no-undef
&& !Symbol.sham
// eslint-disable-next-line no-undef
&& typeof Symbol.iterator == 'symbol';
/***/ }),
/* 204 */
/***/ (function(module, exports, __webpack_require__) {
var getBuiltIn = __webpack_require__(107);
module.exports = getBuiltIn('document', 'documentElement');
/***/ }),
/* 205 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var getPrototypeOf = __webpack_require__(163);
var createNonEnumerableProperty = __webpack_require__(67);
var has = __webpack_require__(47);
var wellKnownSymbol = __webpack_require__(36);
var IS_PURE = __webpack_require__(94);
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)) {
createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
}
module.exports = {
IteratorPrototype: IteratorPrototype,
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
};
/***/ }),
/* 206 */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(26);
module.exports = !fails(function () {
function F() { /* empty */ }
F.prototype.constructor = null;
return Object.getPrototypeOf(new F()) !== F.prototype;
});
/***/ }),
/* 207 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(48);
var aPossiblePrototype = __webpack_require__(423);
// `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);
/***/ }),
/* 208 */
/***/ (function(module, exports, __webpack_require__) {
var TO_STRING_TAG_SUPPORT = __webpack_require__(164);
var classofRaw = __webpack_require__(80);
var wellKnownSymbol = __webpack_require__(36);
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 = TO_STRING_TAG_SUPPORT ? classofRaw : 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;
};
/***/ }),
/* 209 */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(36);
var Iterators = __webpack_require__(112);
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);
};
/***/ }),
/* 210 */
/***/ (function(module, exports, __webpack_require__) {
var classof = __webpack_require__(208);
var Iterators = __webpack_require__(112);
var wellKnownSymbol = __webpack_require__(36);
var ITERATOR = wellKnownSymbol('iterator');
module.exports = function (it) {
if (it != undefined) return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ }),
/* 211 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(48);
// 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;
}
};
/***/ }),
/* 212 */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(36);
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;
};
/***/ }),
/* 213 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var redefineAll = __webpack_require__(166);
var getWeakData = __webpack_require__(136).getWeakData;
var anObject = __webpack_require__(48);
var isObject = __webpack_require__(45);
var anInstance = __webpack_require__(168);
var iterate = __webpack_require__(167);
var ArrayIterationModule = __webpack_require__(75);
var $has = __webpack_require__(47);
var InternalStateModule = __webpack_require__(81);
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;
}
};
/***/ }),
/* 214 */
/***/ (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
};
/***/ }),
/* 215 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defineProperty = __webpack_require__(51).f;
var create = __webpack_require__(110);
var redefineAll = __webpack_require__(166);
var bind = __webpack_require__(113);
var anInstance = __webpack_require__(168);
var iterate = __webpack_require__(167);
var defineIterator = __webpack_require__(162);
var setSpecies = __webpack_require__(216);
var DESCRIPTORS = __webpack_require__(44);
var fastKey = __webpack_require__(136).fastKey;
var InternalStateModule = __webpack_require__(81);
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);
}
};
/***/ }),
/* 216 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var getBuiltIn = __webpack_require__(107);
var definePropertyModule = __webpack_require__(51);
var wellKnownSymbol = __webpack_require__(36);
var DESCRIPTORS = __webpack_require__(44);
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; }
});
}
};
/***/ }),
/* 217 */
/***/ (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;
/***/ }),
/* 218 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(35);
var userAgent = __webpack_require__(139);
var process = global.process;
var versions = process && process.versions;
var v8 = versions && versions.v8;
var match, version;
if (v8) {
match = v8.split('.');
version = match[0] + match[1];
} else if (userAgent) {
match = userAgent.match(/Edge\/(\d+)/);
if (!match || match[1] >= 74) {
match = userAgent.match(/Chrome\/(\d+)/);
if (match) version = match[1];
}
}
module.exports = version && +version;
/***/ }),
/* 219 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fails = __webpack_require__(26);
// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
// so we use an intermediate function.
function RE(s, f) {
return RegExp(s, f);
}
exports.UNSUPPORTED_Y = fails(function () {
// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
var re = RE('a', 'y');
re.lastIndex = 2;
return re.exec('abcd') != null;
});
exports.BROKEN_CARET = fails(function () {
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
var re = RE('^r', 'gy');
re.lastIndex = 2;
return re.exec('str') != null;
});
/***/ }),
/* 220 */
/***/ (function(module, exports, __webpack_require__) {
var requireObjectCoercible = __webpack_require__(53);
var whitespaces = __webpack_require__(221);
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)
};
/***/ }),
/* 221 */
/***/ (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';
/***/ }),
/* 222 */
/***/ (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;
/***/ }),
/* 223 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(15);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(24);
__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__(174);
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 columns
* @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;
/***/ }),
/* 224 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(15);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(24);
__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__(174);
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;
/***/ }),
/* 225 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(31);
__webpack_require__(12);
__webpack_require__(39);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _coords = _interopRequireDefault(__webpack_require__(118));
/**
* 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;
/***/ }),
/* 226 */
/***/ (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;
/***/ }),
/* 227 */
/***/ (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;
/***/ }),
/* 228 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(31);
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__(95));
var _calculatedRows = _interopRequireDefault(__webpack_require__(370));
var _calculatedColumns = _interopRequireDefault(__webpack_require__(178));
var _object = __webpack_require__(3);
/**
* 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); // Before calculating the height of the trimming element, set overflow: auto to hide scrollbars.
// An issue occurred on Firefox, where an empty element with overflow: scroll returns an element height higher than 0px
// despite an empty content within.
cloneNode.style.overflow = 'auto';
if (trimmingElement.nextElementSibling) {
trimmingElementParent.insertBefore(cloneNode, trimmingElement.nextElementSibling);
} else {
trimmingElementParent.appendChild(cloneNode);
}
var cloneHeight = parseInt((0, _element.getComputedStyle)(cloneNode, rootWindow).height, 10);
trimmingElementParent.removeChild(cloneNode);
if (cloneHeight === 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 = holderStyle.height === 'auto' ? true : 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;
/***/ }),
/* 229 */
/***/ (function(module, exports) {
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
module.exports = _arrayWithHoles;
/***/ }),
/* 230 */
/***/ (function(module, exports) {
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
module.exports = _nonIterableRest;
/***/ }),
/* 231 */
/***/ (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__(432));
exports.RowHeadersRenderer = _rowHeaders.default;
var _columnHeaders = _interopRequireDefault(__webpack_require__(437));
exports.ColumnHeadersRenderer = _columnHeaders.default;
var _colGroup = _interopRequireDefault(__webpack_require__(438));
exports.ColGroupRenderer = _colGroup.default;
var _rows = _interopRequireDefault(__webpack_require__(439));
exports.RowsRenderer = _rows.default;
var _cells = _interopRequireDefault(__webpack_require__(445));
exports.CellsRenderer = _cells.default;
var _table = _interopRequireDefault(__webpack_require__(446));
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;
/***/ }),
/* 232 */
/***/ (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__(233);
var _viewSizeSet = _interopRequireDefault(__webpack_require__(433));
/**
* 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;
/***/ }),
/* 233 */
/***/ (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;
/***/ }),
/* 234 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(20);
var $padStart = __webpack_require__(441).start;
var WEBKIT_BUG = __webpack_require__(442);
// `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);
}
});
/***/ }),
/* 235 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toInteger = __webpack_require__(82);
var requireObjectCoercible = __webpack_require__(53);
// `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;
};
/***/ }),
/* 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) {
/***/ }),
/* 345 */
/***/ (function(module, exports) {
/***/ }),
/* 346 */
/***/ (function(module, exports) {
/***/ }),
/* 347 */
/***/ (function(module, exports) {
/***/ }),
/* 348 */
/***/ (function(module, exports) {
/***/ }),
/* 349 */
/***/ (function(module, exports) {
/***/ }),
/* 350 */
/***/ (function(module, exports) {
/***/ }),
/* 351 */
/***/ (function(module, exports) {
/***/ }),
/* 352 */
/***/ (function(module, exports) {
/***/ }),
/* 353 */
/***/ (function(module, exports) {
/***/ }),
/* 354 */
/***/ (function(module, exports) {
/***/ }),
/* 355 */
/***/ (function(module, exports) {
/***/ }),
/* 356 */
/***/ (function(module, exports) {
/***/ }),
/* 357 */
/***/ (function(module, exports) {
/***/ }),
/* 358 */
/***/ (function(module, exports) {
/***/ }),
/* 359 */
/***/ (function(module, exports) {
/***/ }),
/* 360 */
/***/ (function(module, exports) {
/***/ }),
/* 361 */
/***/ (function(module, exports) {
/***/ }),
/* 362 */
/***/ (function(module, exports) {
/***/ }),
/* 363 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(12);
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__(3);
var _string = __webpack_require__(74);
var _event = _interopRequireDefault(__webpack_require__(364));
var _overlays = _interopRequireDefault(__webpack_require__(365));
var _scroll = _interopRequireDefault(__webpack_require__(367));
var _settings = _interopRequireDefault(__webpack_require__(368));
var _master = _interopRequireDefault(__webpack_require__(228));
var _viewport = _interopRequireDefault(__webpack_require__(369));
/**
* @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;
/***/ }),
/* 364 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(31);
__webpack_require__(15);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(24);
__webpack_require__(16);
__webpack_require__(34);
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__(77);
var _feature = __webpack_require__(76);
var _browser = __webpack_require__(71);
var _eventManager = _interopRequireDefault(__webpack_require__(25));
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);
} // doubleclick reacts only for left mouse button or from touch events
if ((event.button === 0 || this.instance.touchApplied) && cell.TD) {
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) {
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 not left mouse button, and the origin event is not comes from touch
if (event.button !== 0 && !this.instance.touchApplied) {
return;
}
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; // 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);
this.instance.touchApplied = false;
}
/**
* 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;
/***/ }),
/* 365 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(96);
__webpack_require__(97);
__webpack_require__(34);
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__(4);
var _unicode = __webpack_require__(55);
var _browser = __webpack_require__(71);
var _eventManager = _interopRequireDefault(__webpack_require__(25));
var _base = _interopRequireDefault(__webpack_require__(92));
/**
* @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;
/***/ }),
/* 366 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $forEach = __webpack_require__(75).forEach;
var arrayMethodIsStrict = __webpack_require__(84);
var arrayMethodUsesToLength = __webpack_require__(59);
var STRICT_METHOD = arrayMethodIsStrict('forEach');
var USES_TO_LENGTH = arrayMethodUsesToLength('forEach');
// `Array.prototype.forEach` method implementation
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
module.exports = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) {
return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
} : [].forEach;
/***/ }),
/* 367 */
/***/ (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;
/***/ }),
/* 368 */
/***/ (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__(3);
/**
* @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;
/***/ }),
/* 369 */
/***/ (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__(3);
var _eventManager = _interopRequireDefault(__webpack_require__(25));
var _calculator = __webpack_require__(447);
/**
* @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;
/***/ }),
/* 370 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _object = __webpack_require__(3);
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;
/***/ }),
/* 371 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _object = __webpack_require__(3);
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;
/***/ }),
/* 372 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _object = __webpack_require__(3);
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;
/***/ }),
/* 373 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(31);
__webpack_require__(54);
__webpack_require__(39);
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__(32);
var _object = __webpack_require__(3);
var _browser = __webpack_require__(71);
var _eventManager = _interopRequireDefault(__webpack_require__(25));
var _coords = _interopRequireDefault(__webpack_require__(118));
/**
*
*/
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;
/***/ }),
/* 374 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(20);
var $values = __webpack_require__(461).values;
// `Object.values` method
// https://tc39.github.io/ecma262/#sec-object.values
$({ target: 'Object', stat: true }, {
values: function values(O) {
return $values(O);
}
});
/***/ }),
/* 375 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(50);
__webpack_require__(146);
__webpack_require__(12);
__webpack_require__(15);
__webpack_require__(78);
__webpack_require__(10);
__webpack_require__(23);
__webpack_require__(13);
__webpack_require__(40);
__webpack_require__(24);
__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__(28));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(5));
var _get2 = _interopRequireDefault(__webpack_require__(14));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _unicode = __webpack_require__(55);
var _mixed = __webpack_require__(29);
var _string = __webpack_require__(74);
var _array = __webpack_require__(4);
var _element = __webpack_require__(8);
var _handsontableEditor = _interopRequireDefault(__webpack_require__(376));
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,
afterRenderer: function afterRenderer(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,
modifyColWidth: function modifyColWidth(width, col) {
// workaround for text overlapping the dropdown, not really accurate
var autoColumnSize = this.getPlugin('autoColumnSize');
var columnWidth = width;
if (autoColumnSize) {
var autoWidths = autoColumnSize.widths;
if (autoWidths[col]) {
columnWidth = autoWidths[col];
}
}
return trimDropdown ? columnWidth : columnWidth + 15;
}
}); // 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;
/***/ }),
/* 376 */
/***/ (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__(14));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _unicode = __webpack_require__(55);
var _object = __webpack_require__(3);
var _element = __webpack_require__(8);
var _event = __webpack_require__(32);
var _textEditor = _interopRequireDefault(__webpack_require__(123));
/**
* @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;
/***/ }),
/* 377 */
/***/ (function(module, exports, __webpack_require__) {
var require;var require;!function(e){if(true)module.exports=e();else {}}(function(){return function a(o,u,c){function s(t,e){if(!u[t]){if(!o[t]){var r="function"==typeof require&&require;if(!e&&r)return require(t,!0);if(l)return l(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var i=u[t]={exports:{}};o[t][0].call(i.exports,function(e){return s(o[t][1][e]||e)},i,i.exports,a,o,u,c)}return u[t].exports}for(var l="function"==typeof require&&require,e=0;ea[o]^r?1:-1;return c==s?0:s(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tO?e.c=e.e=null:e.c=r=f.length){if(!n)break e;for(;f.length<=s;f.push(0));c=l=0,o=(a%=j)-j+(i=1)}else{for(c=u=f[s],i=1;10<=u;u/=10,i++);l=(o=(a%=j)-j+i)<0?0:c/p[i-o-1]%10|0}if(n=n||t<0||null!=f[s+1]||(o<0?c:c%p[i-o-1]),n=r<4?(l||n)&&(0==r||r==(e.s<0?3:2)):5O?e.c=e.e=null:e.e>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[o]=r[0],t[o+1]=r[1]):(u.push(a%1e14),o+=2);o=i/2}else{if(!crypto.randomBytes)throw x=!1,Error(T+"crypto unavailable");for(t=crypto.randomBytes(i*=7);or-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(e,t,r,n,i){var a,o,u,c,s,l,f,p,g=e.indexOf("."),h=b,d=w;for(0<=g&&(c=S,S=0,e=e.replace(".",""),l=(p=new A(t)).pow(e.length-g),S=c,p.c=m(H(V(l.c),l.e,"0"),10,r,v),p.e=p.c.length),u=c=(f=m(e,t,r,i?(a=M,v):(a=v,M))).length;0==f[--c];f.pop());if(!f[0])return a.charAt(0);if(g<0?--u:(l.c=f,l.e=u,l.s=n,f=(l=y(l,p,h,d,r)).c,s=l.r,u=l.e),g=f[o=u+h+1],c=r/2,s=s||o<0||null!=f[o+1],s=d<4?(null!=g||s)&&(0==d||d==(l.s<0?3:2)):cr;)f[o]=0,o||(++u,f=[1].concat(f));for(c=f.length;!f[--c];);for(g=0,e="";g<=c;e+=a.charAt(f[g++]));e=H(e,u,a.charAt(0))}return e}}(),y=function(){function M(e,t,r){var n,i,a,o,u=0,c=e.length,s=t%I,l=t/I|0;for(e=e.slice();c--;)u=((i=s*(a=e[c]%I)+(n=l*a+(o=e[c]/I|0)*s)%I*I+u)/r|0)+(n/I|0)+l*o,e[c]=i%r;return u&&(e=[u].concat(e)),e}function B(e,t,r,n){var i,a;if(r!=n)a=nt[i]?1:-1;break}return a}function D(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r](S[u]||0)&&o--,x<0)g.push(1),c=!0;else{for(y=S.length,w=N.length,x+=2,1<(s=L(i/(N[u=0]+1)))&&(N=M(N,s,i),S=M(S,s,i),w=N.length,y=S.length),m=w,d=(h=S.slice(0,w)).length;d=i/2&&b++;do{if(s=0,(a=B(N,h,w,d))<0){if(v=h[0],w!=d&&(v=v*i+(h[1]||0)),1<(s=L(v/b)))for(i<=s&&(s=i-1),f=(l=M(N,s,i)).length,d=h.length;1==B(l,h,f,d);)s--,D(l,wa&&(s.c.length=a):n&&(s=s.mod(t))}if(i){if(0===(i=L(i/2)))break;c=i%2}else if(E(e=e.times(r),e.e+1,1),14a&&(l.c.length=a):n&&(l=l.mod(t))}return n?s:(u&&(s=d.div(s)),t?s.mod(t):a?E(s,S,w,void 0):s)},n.integerValue=function(e){var t=new A(this);return null==e?e=w:Z(e,0,8),E(t,t.e+1,e)},n.isEqualTo=n.eq=function(e,t){return 0===q(this,new A(e,t))},n.isFinite=function(){return!!this.c},n.isGreaterThan=n.gt=function(e,t){return 0this.c.length-2},n.isLessThan=n.lt=function(e,t){return q(this,new A(e,t))<0},n.isLessThanOrEqualTo=n.lte=function(e,t){return-1===(t=q(this,new A(e,t)))||0===t},n.isNaN=function(){return!this.s},n.isNegative=function(){return this.s<0},n.isPositive=function(){return 0n&&(n=this.e+1),n},n.shiftedBy=function(e){return Z(e,-C,C),this.times("1e"+e)},n.squareRoot=n.sqrt=function(){var e,t,r,n,i,a=this,o=a.c,u=a.s,c=a.e,s=b+4,l=new A("0.5");if(1!==u||!o||!o[0])return new A(!u||u<0&&(!o||o[0])?NaN:o?a:1/0);if((r=0==(u=Math.sqrt(+F(a)))||u==1/0?(((t=V(o)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=G((c+1)/2)-(c<0||c%2),new A(t=u==1/0?"1e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):new A(u+"")).c[0])for((u=(c=r.e)+s)<3&&(u=0);;)if(i=r,r=l.times(i.plus(y(a,i,s,1))),V(i.c).slice(0,u)===(t=V(r.c)).slice(0,u)){if(r.e=Math.pow(10,12)&&!r||"trillion"===r?(c=n.trillion,t/=Math.pow(10,12)):s=Math.pow(10,9)&&!r||"billion"===r?(c=n.billion,t/=Math.pow(10,9)):s=Math.pow(10,6)&&!r||"million"===r?(c=n.million,t/=Math.pow(10,6)):(s=Math.pow(10,3)&&!r||"thousand"===r)&&(c=n.thousand,t/=Math.pow(10,3)),c&&(c=(a?" ":"")+c),u){var f=t.toString().split(".")[0];l=Math.max(u-f.length,0)}return{value:t,abbreviation:c,mantissaPrecision:l}}({value:c,forceAverage:O,abbreviations:i.currentAbbreviations(),spaceSeparated:D,totalLength:y});c=_.value,k+=_.abbreviation,y&&(S=_.mantissaPrecision)}if(F){var L=(l=(s={value:c,characteristicPrecision:b}).value,f=s.characteristicPrecision,p=void 0===f?0:f,g=C(l.toExponential().split("e"),2),h=g[0],d=g[1],v=+h,p&&1
1 && rows[rows.length - 1] === '') {
rows.pop();
}
for (r = 0, rLen = rows.length; r < rLen; r += 1) {
rows[r] = rows[r].split('\t');
for (c = 0, cLen = rows[r].length; c < cLen; c += 1) {
if (!arr[a]) {
arr[a] = [];
}
if (multiline && c === 0) {
last = arr[a].length - 1;
arr[a][last] = arr[a][last] + '\n' + rows[r][0];
if (multiline && countQuotes(rows[r][0]) & 1) {
//& 1 is a bitwise way of performing mod 2
multiline = false;
arr[a][last] = arr[a][last].substring(0, arr[a][last].length - 1).replace(/""/g, '"');
}
} else {
if (c === cLen - 1 && rows[r][c].indexOf('"') === 0 && countQuotes(rows[r][c]) & 1) {
arr[a].push(rows[r][c].substring(1).replace(/""/g, '"'));
multiline = true;
} else {
arr[a].push(rows[r][c].replace(/""/g, '"'));
multiline = false;
}
}
}
if (!multiline) {
a += 1;
}
}
return arr;
},
/**
* Encode array into valid spreadsheet string
*
* @param arr
* @returns {String}
*/
stringify: function stringify(arr) {
var r,
rLen,
c,
cLen,
str = '',
val;
for (r = 0, rLen = arr.length; r < rLen; r += 1) {
cLen = arr[r].length;
for (c = 0; c < cLen; c += 1) {
if (c > 0) {
str += '\t';
}
val = arr[r][c];
if (typeof val === 'string') {
if (val.indexOf('\n') > -1) {
str += '"' + val.replace(/"/g, '""') + '"';
} else {
str += val;
}
} else if (val === null || val === void 0) {
// void 0 resolves to undefined
str += '';
} else {
str += val;
}
}
if (r !== rLen - 1) {
str += '\n';
}
}
return str;
}
};
if (true) {
exports.parse = SheetClip.parse;
exports.stringify = SheetClip.stringify;
} else {}
})(window);
/***/ }),
/* 381 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(20);
var $reduce = __webpack_require__(504).left;
var arrayMethodIsStrict = __webpack_require__(84);
var arrayMethodUsesToLength = __webpack_require__(59);
var STRICT_METHOD = arrayMethodIsStrict('reduce');
var USES_TO_LENGTH = arrayMethodUsesToLength('reduce', { 1: 0 });
// `Array.prototype.reduce` method
// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {
reduce: function reduce(callbackfn /* , initialValue */) {
return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
}
});
/***/ }),
/* 382 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(15);
__webpack_require__(69);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(16);
exports.__esModule = true;
exports.mouseDown = mouseDown;
exports.mouseOver = mouseOver;
exports.handleMouseEvent = handleMouseEvent;
var _event = __webpack_require__(32);
var _src = __webpack_require__(27);
/**
* MouseDown handler.
*
* @param {Object} options
* @param {Boolean} options.isShiftKey The flag which indicates if the shift key is pressed.
* @param {Boolean} options.isLeftClick The flag which indicates if the left mouse button is pressed.
* @param {Boolean} options.isRightClick The flag which indicates if the right mouse button is pressed.
* @param {CellRange} options.coords The CellCoords object with defined visual coordinates.
* @param {Selection} options.selection The Selection class instance.
* @param {Object} options.controller An object with keys `row`, `column`, `cell` which indicate what
* operation will be performed in later selection stages.
*/
function mouseDown(_ref) {
var isShiftKey = _ref.isShiftKey,
isLeftClick = _ref.isLeftClick,
isRightClick = _ref.isRightClick,
coords = _ref.coords,
selection = _ref.selection,
controller = _ref.controller;
var currentSelection = selection.isSelected() ? selection.getSelectedRange().current() : null;
var selectedCorner = selection.isSelectedByCorner();
var selectedRow = selection.isSelectedByRowHeader();
if (isShiftKey && currentSelection) {
if (coords.row >= 0 && coords.col >= 0 && !controller.cells) {
selection.setRangeEnd(coords);
} else if ((selectedCorner || selectedRow) && coords.row >= 0 && coords.col >= 0 && !controller.cells) {
selection.setRangeEnd(new _src.CellCoords(coords.row, coords.col));
} else if (selectedCorner && coords.row < 0 && !controller.column) {
selection.setRangeEnd(new _src.CellCoords(currentSelection.to.row, coords.col));
} else if (selectedRow && coords.col < 0 && !controller.row) {
selection.setRangeEnd(new _src.CellCoords(coords.row, currentSelection.to.col));
} else if ((!selectedCorner && !selectedRow && coords.col < 0 || selectedCorner && coords.col < 0) && !controller.row) {
selection.selectRows(currentSelection.from.row, coords.row);
} else if ((!selectedCorner && !selectedRow && coords.row < 0 || selectedRow && coords.row < 0) && !controller.column) {
selection.selectColumns(currentSelection.from.col, coords.col);
}
} else {
var newCoord = new _src.CellCoords(coords.row, coords.col);
if (newCoord.row < 0) {
newCoord.row = 0;
}
if (newCoord.col < 0) {
newCoord.col = 0;
}
var allowRightClickSelection = !selection.inInSelection(newCoord);
var performSelection = isLeftClick || isRightClick && allowRightClickSelection; // clicked row header and when some column was selected
if (coords.row < 0 && coords.col >= 0 && !controller.column) {
if (performSelection) {
selection.selectColumns(coords.col);
} // clicked column header and when some row was selected
} else if (coords.col < 0 && coords.row >= 0 && !controller.row) {
if (performSelection) {
selection.selectRows(coords.row);
}
} else if (coords.col >= 0 && coords.row >= 0 && !controller.cells) {
if (performSelection) {
selection.setRangeStart(coords);
}
} else if (coords.col < 0 && coords.row < 0) {
selection.setRangeStart(coords);
}
}
}
/**
* MouseOver handler.
*
* @param {Object} options
* @param {Boolean} options.isLeftClick
* @param {CellRange} options.coords The CellCoords object with defined visual coordinates.
* @param {Selection} options.selection The Selection class instance.
* @param {Object} options.controller An object with keys `row`, `column`, `cell` which indicate what
* operation will be performed in later selection stages.
*/
function mouseOver(_ref2) {
var isLeftClick = _ref2.isLeftClick,
coords = _ref2.coords,
selection = _ref2.selection,
controller = _ref2.controller;
if (!isLeftClick) {
return;
}
var selectedRow = selection.isSelectedByRowHeader();
var selectedColumn = selection.isSelectedByColumnHeader();
var countCols = selection.tableProps.countCols();
var countRows = selection.tableProps.countRows();
if (selectedColumn && !controller.column) {
selection.setRangeEnd(new _src.CellCoords(countRows - 1, coords.col));
} else if (selectedRow && !controller.row) {
selection.setRangeEnd(new _src.CellCoords(coords.row, countCols - 1));
} else if (!controller.cell) {
selection.setRangeEnd(coords);
}
}
var handlers = new Map([['mousedown', mouseDown], ['mouseover', mouseOver], ['touchstart', mouseDown]]);
/**
* Mouse handler for selection functionality.
*
* @param {Event} event An native event to handle.
* @param {Object} options
* @param {CellRange} options.coords The CellCoords object with defined visual coordinates.
* @param {Selection} options.selection The Selection class instance.
* @param {Object} options.controller An object with keys `row`, `column`, `cell` which indicate what
* operation will be performed in later selection stages.
*/
function handleMouseEvent(event, _ref3) {
var coords = _ref3.coords,
selection = _ref3.selection,
controller = _ref3.controller;
handlers.get(event.type)({
coords: coords,
selection: selection,
controller: controller,
isShiftKey: event.shiftKey,
isLeftClick: (0, _event.isLeftClick)(event) || event.type === 'touchstart',
isRightClick: (0, _event.isRightClick)(event)
});
}
/***/ }),
/* 383 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(124);
__webpack_require__(149);
__webpack_require__(15);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(24);
__webpack_require__(16);
exports.__esModule = true;
exports.registerAsRootInstance = registerAsRootInstance;
exports.hasValidParameter = hasValidParameter;
exports.isRootInstance = isRootInstance;
exports.rootInstanceSymbol = exports.holder = void 0;
var holder = new WeakMap();
exports.holder = holder;
var rootInstanceSymbol = Symbol('rootInstance');
/**
* Register an object as a root instance.
*
* @param {Object} object An object to associate with root instance flag.
*/
exports.rootInstanceSymbol = rootInstanceSymbol;
function registerAsRootInstance(object) {
holder.set(object, true);
}
/**
* Check if the source of the root indication call is valid.
*
* @param {Symbol} rootSymbol A symbol as a source of truth.
* @return {Boolean}
*/
function hasValidParameter(rootSymbol) {
return rootSymbol === rootInstanceSymbol;
}
/**
* Check if passed an object was flagged as a root instance.
*
* @param {Object} object An object to check.
* @return {Boolean}
*/
function isRootInstance(object) {
return holder.has(object);
}
/***/ }),
/* 384 */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(36);
exports.f = wellKnownSymbol;
/***/ }),
/* 385 */
/***/ (function(module, exports, __webpack_require__) {
var path = __webpack_require__(200);
var has = __webpack_require__(47);
var wrappedWellKnownSymbolModule = __webpack_require__(384);
var defineProperty = __webpack_require__(51).f;
module.exports = function (NAME) {
var Symbol = path.Symbol || (path.Symbol = {});
if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
value: wrappedWellKnownSymbolModule.f(NAME)
});
};
/***/ }),
/* 386 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _typeof2 = _interopRequireDefault(__webpack_require__(42));
var _mixed = __webpack_require__(29);
var _object = __webpack_require__(3);
/**
* @alias Options
* @constructor
* @description
* ## Constructor options
*
* Constructor options are applied using an object literal passed as a second argument to the Handsontable constructor.
*
* ```js
* const container = document.getElementById('example');
* const hot = new Handsontable(container, {
* data: myArray,
* width: 400,
* height: 300
* });
* ```
*
* ---
* ## Cascading configuration
*
* Handsontable is using *Cascading Configuration*, which is a fast way to provide configuration options
* for the entire table, including its columns and particular cells.
*
* Consider the following example:
* ```js
* const container = document.getElementById('example');
* const hot = new Handsontable(container, {
* readOnly: true,
* columns: [
* {readOnly: false},
* {},
* {}
* ],
* cells: function(row, col, prop) {
* var cellProperties = {};
*
* if (row === 0 && col === 0) {
* cellProperties.readOnly = true;
* }
*
* return cellProperties;
* }
* });
* ```
*
* The above notation will result in all TDs being *read only*, except for first column TDs which will be *editable*, except for the TD in top left corner which will still be *read only*.
*
* ### The Cascading Configuration model
*
* ##### 1. Constructor
*
* Configuration options that are provided using first-level `handsontable(container, {option: "value"})` and `updateSettings` method.
*
* ##### 2. Columns
*
* Configuration options that are provided using second-level object `handsontable(container, {columns: {option: "value"}]})`
*
* ##### 3. Cells
*
* Configuration options that are provided using third-level function `handsontable(container, {cells: function: (row, col, prop){ }})`
*
* ---
* ## Architecture performance
*
* The Cascading Configuration model is based on prototypical inheritance. It is much faster and memory efficient
* compared to the previous model that used jQuery extend. See: [http://jsperf.com/extending-settings](http://jsperf.com/extending-settings).
*
* ---
* __Important notice:__ In order for the data separation to work properly, make sure that each instance of Handsontable has a unique `id`.
*/
function DefaultSettings() {}
DefaultSettings.prototype = {
/**
* License key for commercial version of Handsontable.
*
* @type {String}
* @default undefined
* @example
* ```js
* licenseKey: '00000-00000-00000-00000-00000',
* // or
* licenseKey: 'non-commercial-and-evaluation',
* ```
*/
licenseKey: void 0,
/**
* @description
* Initial data source that will be bound to the data grid __by reference__ (editing data grid alters the data source).
* Can be declared as an array of arrays, array of objects or a function.
*
* See [Understanding binding as reference](https://docs.handsontable.com/tutorial-data-binding.html#page-reference).
*
* @type {Array[]|Object[]}
* @default undefined
* @example
* ```js
* // as an array of arrays
* data: [
* ['A', 'B', 'C'],
* ['D', 'E', 'F'],
* ['G', 'H', 'J']
* ]
*
* // as an array of objects
* data: [
* {id: 1, name: 'Ted Right'},
* {id: 2, name: 'Frank Honest'},
* {id: 3, name: 'Joan Well'},
* {id: 4, name: 'Gail Polite'},
* {id: 5, name: 'Michael Fair'},
* ]
* ```
*/
data: void 0,
/**
* @description
* Defines the structure of a new row when data source is an array of objects.
*
* See [data-schema](https://docs.handsontable.com/tutorial-data-sources.html#page-data-schema) for more options.
*
* @type {Object}
* @default undefined
*
* @example
* ```
* // with data schema we can start with an empty table
* data: null,
* dataSchema: {id: null, name: {first: null, last: null}, address: null},
* colHeaders: ['ID', 'First Name', 'Last Name', 'Address'],
* columns: [
* {data: 'id'},
* {data: 'name.first'},
* {data: 'name.last'},
* {data: 'address'}
* ],
* startRows: 5,
* minSpareRows: 1
* ```
*/
dataSchema: void 0,
/**
* Width of the grid. Can be a value or a function that returns a value.
*
* @type {Number|String|Function}
* @default undefined
*
* @example
* ```
* // as a number
* width: 500,
*
* // as a string
* width: '75vw',
*
* // as a function
* width: function() {
* return 500;
* },
* ```
*/
width: void 0,
/**
* Height of the grid. Can be a number or a function that returns a number.
*
* @type {Number|String|Function}
* @default undefined
*
* @example
* ```js
* // as a number
* height: 500,
*
* // as a string
* height: '75vh',
*
* // as a function
* height: function() {
* return 500;
* },
* ```
*/
height: void 0,
/**
* @description
* Initial number of rows.
*
* __Note:__ This option only has effect in Handsontable constructor and only if `data` option is not provided
*
* @type {Number}
* @default 5
*
* @example
* ```js
* // start with 15 empty rows
* startRows: 15,
* ```
*/
startRows: 5,
/**
* @description
* Initial number of columns.
*
* __Note:__ This option only has effect in Handsontable constructor and only if `data` option is not provided
*
* @type {Number}
* @default 5
*
* @example
* ```js
* // start with 15 empty columns
* startCols: 15,
* ```
*/
startCols: 5,
/**
* Setting `true` or `false` will enable or disable the default row headers (1, 2, 3).
* You can also define an array `['One', 'Two', 'Three', ...]` or a function to define the headers.
* If a function is set the index of the row is passed as a parameter.
*
* @type {Boolean|String[]|Function}
* @default undefined
*
* @example
* ```js
* // as a boolean
* rowHeaders: true,
*
* // as an array
* rowHeaders: ['1', '2', '3'],
*
* // as a function
* rowHeaders: function(index) {
* return index + ': AB';
* },
* ```
*/
rowHeaders: void 0,
/**
* Setting `true` or `false` will enable or disable the default column headers (A, B, C).
* You can also define an array `['One', 'Two', 'Three', ...]` or a function to define the headers.
* If a function is set, then the index of the column is passed as a parameter.
*
* @type {Boolean|String[]|Function}
* @default null
*
* @example
* ```js
* // as a boolean
* colHeaders: true,
*
* // as an array
* colHeaders: ['A', 'B', 'C'],
*
* // as a function
* colHeaders: function(index) {
* return index + ': AB';
* },
* ```
*/
colHeaders: null,
/**
* Defines column widths in pixels. Accepts number, string (that will be converted to a number), array of numbers
* (if you want to define column width separately for each column) or a function (if you want to set column width
* dynamically on each render).
*
* @type {Number|Number[]|String|String[]|Function}
* @default undefined
*
* @example
* ```js
* // as a number, for each column.
* colWidths: 100,
*
* // as a string, for each column.
* colWidths: '100px',
*
* // as an array, based on visual indexes. The rest of the columns have a default width.
* colWidths: [100, 120, 90],
*
* // as a function, based on visual indexes.
* colWidths: function(index) {
* return index * 10;
* },
* ```
*/
colWidths: void 0,
/**
* Defines row heights in pixels. Accepts numbers, strings (that will be converted into a number), array of numbers
* (if you want to define row height separately for each row) or a function (if you want to set row height dynamically
* on each render).
*
* If the {@link ManualRowResize} or {@link AutoRowSize} plugins are enabled, this is also the minimum height that can
* be set via either of those two plugins.
*
* Height should be equal or greater than 23px. Table is rendered incorrectly if height is less than 23px.
*
* @type {Number|Number[]|String|String[]|Function}
* @default undefined
*
* @example
* ```js
* // as a number, the same for all rows
* rowHeights: 100,
*
* // as a string, the same for all row
* rowHeights: '100px',
*
* // as an array, based on visual indexes. The rest of the rows have a default height
* rowHeights: [100, 120, 90],
*
* // as a function, based on visual indexes
* rowHeights: function(index) {
* return index * 10;
* },
* ```
*/
rowHeights: void 0,
/**
* @description
* Defines the cell properties and data binding for certain columns.
*
* __Note:__ Using this option sets a fixed number of columns (options `startCols`, `minCols`, `maxCols` will be ignored).
*
* See [documentation -> datasources.html](https://docs.handsontable.com/tutorial-data-sources.html#page-nested) for examples.
*
* @type {Object[]|Function}
* @default undefined
*
* @example
* ```js
* // as an array of objects
* // order of the objects in array is representation of physical indexes.
* columns: [
* {
* // column options for the first column
* type: 'numeric',
* numericFormat: {
* pattern: '0,0.00 $'
* }
* },
* {
* // column options for the second column
* type: 'text',
* readOnly: true
* }
* ],
*
* // or as a function, based on physical indexes
* columns: function(index) {
* return {
* type: index > 0 ? 'numeric' : 'text',
* readOnly: index < 1
* }
* }
* ```
*/
columns: void 0,
/**
* @description
* Defines the cell properties for given `row`, `col`, `prop` coordinates. Any constructor or column option may be
* overwritten for a particular cell (row/column combination) using the `cells` property in the Handsontable constructor.
*
* __Note:__ Parameters `row` and `col` always represent __physical indexes__. Example below show how to execute
* operations based on the __visual__ representation of Handsontable.
*
* Possible values of `prop`:
* - property name for column's data source object, when dataset is an [array of objects](/tutorial-data-sources.html#page-object)
* - the same number as `col`, when dataset is an [array of arrays](/tutorial-data-sources.html#page-array)
*
* @type {Function}
* @default undefined
*
* @example
* ```js
* cells: function(row, column, prop) {
* const cellProperties = {};
* const visualRowIndex = this.instance.toVisualRow(row);
* const visualColIndex = this.instance.toVisualColumn(column);
*
* if (visualRowIndex === 0 && visualColIndex === 0) {
* cellProperties.readOnly = true;
* }
*
* return cellProperties;
* },
* ```
*/
cells: void 0,
/**
* Any constructor or column option may be overwritten for a particular cell (row/column combination), using `cell`
* array passed to the Handsontable constructor.
*
* @type {Array[]}
* @default []
*
* @example
* ```js
* // make cell with coordinates (0, 0) read only
* cell: [
* {
* row: 0,
* col: 0,
* readOnly: true
* }
* ],
* ```
*/
cell: [],
/**
* @description
* If `true`, enables the {@link Comments} plugin, which enables an option to apply cell comments through the context menu
* (configurable with context menu keys `commentsAddEdit`, `commentsRemove`).
*
* To initialize Handsontable with predefined comments, provide cell coordinates and comment text values in a form of
* an array.
*
* See [Comments](https://docs.handsontable.com/demo-comments_.html) demo for examples.
*
* @type {Boolean|Object[]}
* @default false
*
* @example
* ```js
* // enable comments plugin
* comments: true,
*
* // or an object with extra predefined plugin config:
*
* comments: {
* displayDelay: 1000
* }
*
* // or
* // enable comments plugin and add predefined comments
* const hot = new Handsontable(document.getElementById('example'), {
* date: getData(),
* comments: true,
* cell: [
* { row: 1, col: 1, comment: { value: 'Foo' } },
* { row: 2, col: 2, comment: { value: 'Bar' } }
* ]
* });
* ```
*/
comments: false,
/**
* @description
* If `true`, enables the {@link CustomBorders} plugin, which enables an option to apply custom borders through the context
* menu (configurable with context menu key `borders`). To initialize Handsontable with predefined custom borders,
* provide cell coordinates and border styles in a form of an array.
*
* See [Custom Borders](https://docs.handsontable.com/demo-custom-borders.html) demo for examples.
*
* @type {Boolean|Object[]}
* @default false
*
* @example
* ```js
* // enable custom borders
* customBorders: true,
*
* // or
* // enable custom borders and start with predefined left border
* customBorders: [
* {
* range: {
* from: {
* row: 1,
* col: 1
* },
* to: {
* row: 3,
* col: 4
* }
* },
* left: {
* width: 2,
* color: 'red'
* },
* right: {},
* top: {},
* bottom: {}
* }
* ],
*
* // or
* customBorders: [
* {
* row: 2,
* col: 2,
* left: {
* width: 2,
* color: 'red'
* },
* right: {
* width: 1,
* color: 'green'
* },
* top: '',
* bottom: ''
* }
* ],
* ```
*/
customBorders: false,
/**
* Minimum number of rows. At least that number of rows will be created during initialization.
*
* @type {Number}
* @default 0
*
* @example
* ```js
* // set minimum table size to 10 rows
* minRows: 10,
* ```
*/
minRows: 0,
/**
* Minimum number of columns. At least that number of columns will be created during initialization.
*
* @type {Number}
* @default 0
*
* @example
* ```js
* // set minimum table size to 10 columns
* minCols: 10,
* ```
*/
minCols: 0,
/**
* Maximum number of rows. If set to a value lower than the initial row count, the data will be trimmed to the provided
* value as the number of rows.
*
* @type {Number}
* @default Infinity
*
* @example
* ```js
* // limit table size to maximum 300 rows
* maxRows: 300,
* ```
*/
maxRows: Infinity,
/**
* Maximum number of cols. If set to a value lower than the initial col count, the data will be trimmed to the provided
* value as the number of cols.
*
* @type {Number}
* @default Infinity
*
* @example
* ```js
* // limit table size to maximum 300 columns
* maxCols: 300,
* ```
*/
maxCols: Infinity,
/**
* When set to 1 (or more), Handsontable will add a new row at the end of grid if there are no more empty rows.
* (unless the number of rows exceeds the one set in the `maxRows` property)
*
* @type {Number}
* @default 0
*
* @example
* ```js
* // always add 3 empty rows at the table end
* minSpareRows: 3,
* ```
*/
minSpareRows: 0,
/**
* When set to 1 (or more), Handsontable will add a new column at the end of grid if there are no more empty columns.
* (unless the number of rows exceeds the one set in the `maxCols` property)
*
* @type {Number}
* @default 0
*
* @example
* ```js
* // always add 3 empty columns at the table end
* minSpareCols: 3,
* ```
*/
minSpareCols: 0,
/**
* If set to `false`, there won't be an option to insert new rows in the Context Menu.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // hide "Insert row above" and "Insert row below" options from the Context Menu
* allowInsertRow: false,
* ```
*/
allowInsertRow: true,
/**
* If set to `false`, there won't be an option to insert new columns in the Context Menu.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // hide "Insert column left" and "Insert column right" options from the Context Menu
* allowInsertColumn: false,
* ```
*/
allowInsertColumn: true,
/**
* If set to `false`, there won't be an option to remove rows in the Context Menu.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // hide "Remove row" option from the Context Menu
* allowRemoveRow: false,
* ```
*/
allowRemoveRow: true,
/**
* If set to `false`, there won't be an option to remove columns in the Context Menu.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // hide "Remove column" option from the Context Menu
* allowRemoveColumn: false,
* ```
*/
allowRemoveColumn: true,
/**
* @description
* Defines how the table selection reacts. The selection support three different behaviors defined as:
* * `'single'` Only a single cell can be selected.
* * `'range'` Multiple cells within a single range can be selected.
* * `'multiple'` Multiple ranges of cells can be selected.
*
* To see how to interact with selection by getting selected data or change styles of the selected cells go to
* [https://docs.handsontable.com/demo-selecting-ranges.html](https://docs.handsontable.com/demo-selecting-ranges.html).
*
* @type {String}
* @default 'multiple'
*
* @example
* ```js
* // only one cell can be selected at a time
* selectionMode: 'single',
* ```
*/
selectionMode: 'multiple',
/**
* Enables the fill handle (drag-down and copy-down) functionality, which shows a small rectangle in bottom
* right corner of the selected area, that let's you expand values to the adjacent cells.
*
* Setting to `true` enables the fillHandle plugin. Possible values: `true` (to enable in all directions),
* `'vertical'` or `'horizontal'` (to enable in one direction), `false` (to disable completely), an object with
* options: `autoInsertRow`, `direction`.
*
* If `autoInsertRow` option is `true`, fill-handler will create new rows till it reaches the last row.
* It is enabled by default.
*
* @type {Boolean|String|Object}
* @default true
*
* @example
* ```js
* // enable plugin in all directions and with autoInsertRow as true
* fillHandle: true,
*
* // or
* // enable plugin in vertical direction and with autoInsertRow as true
* fillHandle: 'vertical',
*
* // or
* fillHandle: {
* // enable plugin in both directions and with autoInsertRow as false
* autoInsertRow: false,
* },
*
* // or
* fillHandle: {
* // enable plugin in vertical direction and with autoInsertRow as false
* autoInsertRow: false,
* direction: 'vertical'
* },
* ```
*/
fillHandle: {
autoInsertRow: false
},
/**
* Allows to specify the number of fixed (or *frozen*) rows at the top of the table.
*
* @type {Number}
* @default 0
*
* @example
* ```js
* // freeze the first 3 rows of the table.
* fixedRowsTop: 3,
* ```
*/
fixedRowsTop: 0,
/**
* Allows to specify the number of fixed (or *frozen*) rows at the bottom of the table.
*
* @type {Number}
* @default 0
*
* @example
* ```js
* // freeze the last 3 rows of the table.
* fixedRowsBottom: 3,
* ```
*/
fixedRowsBottom: 0,
/**
* Allows to specify the number of fixed (or *frozen*) columns on the left of the table.
*
* @type {Number}
* @default 0
*
* @example
* ```js
* // freeze first 3 columns of the table.
* fixedColumnsLeft: 3,
* ```
*/
fixedColumnsLeft: 0,
/**
* If `true`, mouse click outside the grid will deselect the current selection. Can be a function that takes the
* click event target and returns a boolean.
*
* @type {Boolean|Function}
* @default true
*
* @example
* ```js
* // don't clear current selection when mouse click was outside the grid
* outsideClickDeselects: false,
*
* // or
* outsideClickDeselects: function(event) {
* return false;
* }
* ```
*/
outsideClickDeselects: true,
/**
* If `true`, ENTER begins editing mode (like in Google Docs). If `false`, ENTER moves to next
* row (like Excel) and adds a new row if necessary. TAB adds new column if necessary.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* enterBeginsEditing: false,
* ```
*/
enterBeginsEditing: true,
/**
* Defines the cursor movement after ENTER was pressed (SHIFT + ENTER uses a negative vector). Can
* be an object or a function that returns an object. The event argument passed to the function is a DOM Event object
* received after the ENTER key has been pressed. This event object can be used to check whether user pressed
* ENTER or SHIFT + ENTER.
*
* @type {Object|Function}
* @default {row: 1, col: 0}
*
* @example
* ```js
* // move selection diagonal by 1 cell in x and y axis
* enterMoves: {row: 1, col: 1},
* // or as a function
* enterMoves: function(event) {
* return {row: 1, col: 1};
* },
* ```
*/
enterMoves: {
row: 1,
col: 0
},
/**
* Defines the cursor movement after TAB is pressed (SHIFT + TAB uses a negative vector). Can
* be an object or a function that returns an object. The event argument passed to the function is a DOM Event object
* received after the TAB key has been pressed. This event object can be used to check whether user pressed
* TAB or SHIFT + TAB.
*
* @type {Object|Function}
* @default {row: 0, col: 1}
*
* @example
* ```js
* // move selection 2 cells away after TAB pressed.
* tabMoves: {row: 2, col: 2},
* // or as a function
* tabMoves: function(event) {
* return {row: 2, col: 2};
* },
* ```
*/
tabMoves: {
row: 0,
col: 1
},
/**
* If `true`, pressing TAB or right arrow in the last column will move to first column in next row.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // stop TAB key navigation on the last column
* autoWrapRow: false,
* ```
*/
autoWrapRow: true,
/**
* If `true`, pressing ENTER or down arrow in the last row will move to the first row in the next column.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // stop ENTER key navigation on the last row
* autoWrapCol: false,
* ```
*/
autoWrapCol: true,
/**
* @description
* Turns on saving the state of column sorting, column positions and column sizes in local storage.
*
* You can save any sort of data in local storage to preserve table state between page reloads. In order to enable
* data storage mechanism, `persistentState` option must be set to `true` (you can set it either during Handsontable
* initialization or using the `updateSettings` method). When `persistentState` is enabled it exposes 3 hooks:
*
* __persistentStateSave__ (key: String, value: Mixed)
*
* * Saves value under given key in browser local storage.
*
* __persistentStateLoad__ (key: String, valuePlaceholder: Object)
*
* * Loads `value`, saved under given key, form browser local storage. The loaded `value` will be saved in
* `valuePlaceholder.value` (this is due to specific behaviour of `Hooks.run()` method). If no value have
* been saved under key `valuePlaceholder.value` will be `undefined`.
*
* __persistentStateReset__ (key: String)
*
* * Clears the value saved under `key`. If no `key` is given, all values associated with table will be cleared.
*
* __Note:__ The main reason behind using `persistentState` hooks rather than regular LocalStorage API is that it
* ensures separation of data stored by multiple Handsontable instances. In other words, if you have two (or more)
* instances of Handsontable on one page, data saved by one instance won't be accessible by the second instance.
* Those two instances can store data under the same key and no data would be overwritten.
*
* __Important:__ In order for the data separation to work properly, make sure that each instance of Handsontable has a unique `id`.
*
* @type {Boolean}
* @default false
*
* @example
* ```js
* // enable the persistent state plugin
* persistentState: true,
* ```
*/
persistentState: void 0,
/**
* Class name for all visible rows in the current selection.
*
* @type {String}
* @default undefined
*
* @example
* ```js
* // This will add a 'currentRow' class name to appropriate table cells.
* currentRowClassName: 'currentRow',
* ```
*/
currentRowClassName: void 0,
/**
* Class name for all visible columns in the current selection.
*
* @type {String}
* @default undefined
*
* @example
* ```js
* // This will add a 'currentColumn' class name to appropriate table cells.
* currentColClassName: 'currentColumn',
* ```
*/
currentColClassName: void 0,
/**
* Class name for all visible headers in current selection.
*
* @type {String}
* @default 'ht__highlight'
*
* @example
* ```js
* // This will add a 'ht__highlight' class name to appropriate table headers.
* currentHeaderClassName: 'ht__highlight',
* ```
*/
currentHeaderClassName: 'ht__highlight',
/**
* Class name for all active headers in selections. The header will be marked with this class name
* only when a whole column or row will be selected.
*
* @type {String}
* @since 0.38.2
* @default 'ht__active_highlight'
*
* @example
* ```js
* // this will add a 'ht__active_highlight' class name to appropriate table headers.
* activeHeaderClassName: 'ht__active_highlight',
* ```
*/
activeHeaderClassName: 'ht__active_highlight',
/**
* Class name for the Handsontable container element.
*
* @type {String|String[]}
* @default undefined
*
* @example
* ```js
* // set custom class for table container
* className: 'your__class--name',
*
* // or
* className: ['first-class-name', 'second-class-name'],
* ```
*/
className: void 0,
/**
* Class name for all tables inside container element.
*
* @type {String|String[]}
* @default undefined
*
* @example
* ```js
* // set custom class for table element
* tableClassName: 'your__class--name',
*
* // or
* tableClassName: ['first-class-name', 'second-class-name'],
* ```
*/
tableClassName: void 0,
/**
* @description
* Defines how the columns react, when the declared table width is different than the calculated sum of all column widths.
* [See more](https://docs.handsontable.com/demo-stretching.html) mode. Possible values:
* * `'none'` Disable stretching
* * `'last'` Stretch only the last column
* * `'all'` Stretch all the columns evenly
*
* @type {String}
* @default 'none'
*
* @example
* ```js
* // fit table to the container
* stretchH: 'all',
* ```
*/
stretchH: 'none',
/**
* Overwrites the default `isEmptyRow` method, which checks if row at the provided index is empty.
*
* @type {Function}
* @param {Number} row Visual row index.
* @returns {Boolean}
*
* @example
* ```js
* // define custom checks for empty row
* isEmptyRow: function(row) {
* ...
* },
* ```
*/
isEmptyRow: function isEmptyRow(row) {
var col;
var colLen;
var value;
var meta;
for (col = 0, colLen = this.countCols(); col < colLen; col++) {
value = this.getDataAtCell(row, col);
if (value !== '' && value !== null && (0, _mixed.isDefined)(value)) {
if ((0, _typeof2.default)(value) === 'object') {
meta = this.getCellMeta(row, col);
return (0, _object.isObjectEqual)(this.getSchema()[meta.prop], value);
}
return false;
}
}
return true;
},
/**
* Overwrites the default `isEmptyCol` method, which checks if column at the provided index is empty.
*
* @type {Function}
* @param {Number} column Visual column index
* @returns {Boolean}
*
* @example
* ```js
* // define custom checks for empty column
* isEmptyCol: function(column) {
* return false;
* },
* ```
*/
isEmptyCol: function isEmptyCol(col) {
var row;
var rowLen;
var value;
for (row = 0, rowLen = this.countRows(); row < rowLen; row++) {
value = this.getDataAtCell(row, col);
if (value !== '' && value !== null && (0, _mixed.isDefined)(value)) {
return false;
}
}
return true;
},
/**
* When set to `true`, the table is re-rendered when it is detected that it was made visible in DOM.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // don't rerender the table on visibility changes
* observeDOMVisibility: false,
* ```
*/
observeDOMVisibility: true,
/**
* If set to `true`, Handsontable will accept values that were marked as invalid by the cell `validator`. It will
* result with *invalid* cells being treated as *valid* (will save the *invalid* value into the Handsontable data source).
* If set to `false`, Handsontable will *not* accept the invalid values and won't allow the user to close the editor.
* This option will be particularly useful when used with the Autocomplete's `strict` mode.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // don't save the invalid values
* allowInvalid: false,
* ```
*/
allowInvalid: true,
/**
* If set to `true`, Handsontable will accept values that are empty (`null`, `undefined` or `''`). If set to `false`,
* Handsontable will *not* accept the empty values and mark cell as invalid.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // allow empty values for all cells (whole table)
* allowEmpty: true,
*
* // or
* columns: [
* {
* data: 'date',
* dateFormat: 'DD/MM/YYYY',
* // allow empty values only for the 'date' column
* allowEmpty: true
* }
* ],
* ```
*/
allowEmpty: true,
/**
* CSS class name for cells that did not pass validation.
*
* @type {String}
* @default 'htInvalid'
*
* @example
* ```js
* // set custom validation error class
* invalidCellClassName: 'highlight--error',
* ```
*/
invalidCellClassName: 'htInvalid',
/**
* When set to an non-empty string, displayed as the cell content for empty cells. If a value of a different type is provided,
* it will be stringified and applied as a string.
*
* @type {String}
* @default undefined
*
* @example
* ```js
* // add custom placeholder content to empty cells
* placeholder: 'Empty Cell',
* ```
*/
placeholder: void 0,
/**
* CSS class name for cells that have a placeholder in use.
*
* @type {String}
* @default 'htPlaceholder'
*
* @example
* ```js
* // set custom placeholder class
* placeholderCellClassName: 'has-placeholder',
* ```
*/
placeholderCellClassName: 'htPlaceholder',
/**
* CSS class name for read-only cells.
*
* @type {String}
* @default 'htDimmed'
*
* @example
* ```js
* // set custom read-only class
* readOnlyCellClassName: 'is-readOnly',
* ```
*/
readOnlyCellClassName: 'htDimmed',
/**
* @description
* If a string is provided, it may be one of the following predefined values:
* * `autocomplete`,
* * `checkbox`,
* * `html`,
* * `numeric`,
* * `password`.
* * `text`.
*
* Or you can [register](https://docs.handsontable.com/demo-custom-renderers.html) the custom renderer under specified name and use its name as an alias in your
* configuration.
*
* If a function is provided, it will receive the following arguments:
* ```js
* function(instance, TD, row, col, prop, value, cellProperties) {}
* ```
*
* You can read more about custom renderes [in the documentation](https://docs.handsontable.com/demo-custom-renderers.html).
*
* @type {String|Function}
* @default undefined
*
* @example
* ```js
* // register custom renderer
* Handsontable.renderers.registerRenderer('my.renderer', function(instance, TD, row, col, prop, value, cellProperties) {
* TD.innerHTML = value;
* });
*
* // use it for selected column:
* columns: [
* {
* // as a string with the name of build in renderer
* renderer: 'autocomplete',
* editor: 'select'
* },
* {
* // as an alias to custom renderer registered above
* renderer: 'my.renderer'
* },
* {
* // renderer as custom function
* renderer: function(hotInstance, TD, row, col, prop, value, cellProperties) {
* TD.style.color = 'blue';
* TD.innerHTML = value;
* }
* }
* ],
* ```
*/
renderer: void 0,
/**
* CSS class name added to the commented cells.
*
* @type {String}
* @default 'htCommentCell'
*
* @example
* ```js
* // set custom class for commented cells
* commentedCellClassName: 'has-comment',
* ```
*/
commentedCellClassName: 'htCommentCell',
/**
* If set to `true`, it enables the browser's native selection of a fragment of the text within a single cell, between
* adjacent cells or in a whole table. If set to `'cell'`, it enables the possibility of selecting a fragment of the
* text within a single cell's body.
*
* @type {Boolean|String}
* @default false
*
* @example
* ```js
* // enable text selection within table
* fragmentSelection: true,
*
* // or
* // enable text selection within cells only
* fragmentSelection: 'cell',
* ```
*/
fragmentSelection: false,
/**
* @description
* Makes cell [read only](https://docs.handsontable.com/demo-read-only.html).
*
* @type {Boolean}
* @default false
*
* @example
* ```js
* // set cell as read only
* readOnly: true,
* ```
*/
readOnly: false,
/**
* @description
* When added to a `column` property, it skips the column on paste and pastes the data on the next column to the right.
*
* @type {Boolean}
* @default false
*
* @example
* ```js
* columns: [
* {
* // don't paste data to this column
* skipColumnOnPaste: true
* }
* ],
* ```
*/
skipColumnOnPaste: false,
/**
* @description
* When added to a cell property, it skips the row on paste and pastes the data on the following row.
*
* @type {Boolean}
* @default false
*
* @example
* ```js
* cells: function(row, column) {
* const cellProperties = {};
*
* // don't paste data to the second row
* if (row === 1) {
* cellProperties.skipRowOnPaste = true;
* }
*
* return cellProperties;
* }
* ```
*/
skipRowOnPaste: false,
/**
* @description
* Setting to `true` enables the {@link Search} plugin (see [demo](https://docs.handsontable.com/demo-search-for-values.html)).
*
* @type {Boolean}
* @default false
*
* @example
* ```js
* // enable search plugin
* search: true,
*
* // or
* // as an object with detailed configuration
* search: {
* searchResultClass: 'customClass',
* queryMethod: function(queryStr, value) {
* ...
* },
* callback: function(instance, row, column, value, result) {
* ...
* }
* }
* ```
*/
search: false,
/**
* @description
* Shortcut to define the combination of the cell renderer, editor and validator for the column, cell or whole table.
*
* Possible values:
* * [autocomplete](https://docs.handsontable.com/demo-autocomplete.html)
* * [checkbox](https://docs.handsontable.com/demo-checkbox.html)
* * [date](https://docs.handsontable.com/demo-date.html)
* * [dropdown](https://docs.handsontable.com/demo-dropdown.html)
* * [handsontable](https://docs.handsontable.com/demo-handsontable.html)
* * [numeric](https://docs.handsontable.com/demo-numeric.html)
* * [password](https://docs.handsontable.com/demo-password.html)
* * text
* * [time](https://docs.handsontable.com/demo-time.html)
*
* Or you can register the custom cell type under specified name and use
* its name as an alias in your configuration.
*
* @type {String}
* @default 'text'
*
* @example
* ```js
* // register custom cell type:
* Handsontable.cellTypes.registerCellType('my.type', {
* editor: MyEditorClass,
* renderer: function(hot, td, row, col, prop, value, cellProperties) {
* td.innerHTML = value;
* },
* validator: function(value, callback) {
* callback(value === 'foo' ? true : false);
* }
* });
*
* // use it in column settings:
* columns: [
* {
* type: 'text'
* },
* {
* // an alias to custom type
* type: 'my.type'
* },
* {
* type: 'checkbox'
* }
* ],
* ```
*/
type: 'text',
/**
* @description
* Makes a cell copyable (pressing CTRL + C on your keyboard moves its value to system clipboard).
*
* __Note:__ this setting is `false` by default for cells with type `password`.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* cells: [
* {
* cell: 0,
* row: 0,
* // cell with coordinates (0, 0) can't be copied
* copyable: false,
* }
* ],
* ```
*/
copyable: true,
/**
* Defines the editor for the table/column/cell.
*
* If a string is provided, it may be one of the following predefined values:
* * [autocomplete](https://docs.handsontable.com/demo-autocomplete.html)
* * [checkbox](https://docs.handsontable.com/demo-checkbox.html)
* * [date](https://docs.handsontable.com/demo-date.html)
* * [dropdown](https://docs.handsontable.com/demo-dropdown.html)
* * [handsontable](https://docs.handsontable.com/demo-handsontable.html)
* * [mobile](https://docs.handsontable.com/demo-mobiles-and-tablets.html)
* * [password](https://docs.handsontable.com/demo-password.html)
* * [select](https://docs.handsontable.com/demo-select.html)
* * text
*
* Or you can [register](https://docs.handsontable.com/tutorial-cell-editor.html#registering-an-editor) the custom editor under specified name and use its name as an alias in your
* configuration.
*
* To disable cell editing completely set `editor` property to `false`.
*
* @type {String|Function|Boolean}
* @default undefined
*
* @example
* ```js
* columns: [
* {
* // set editor for the first column
* editor: 'select'
* },
* {
* // disable editor for the second column
* editor: false
* }
* ],
* ```
*/
editor: void 0,
/**
* Control number of choices for the autocomplete (or dropdown) typed cells. After exceeding it, a scrollbar for the
* dropdown list of choices will appear.
*
* @type {Number}
* @default 10
*
* @example
* ```js
* columns: [
* {
* type: 'autocomplete',
* // set autocomplete options list height
* visibleRows: 15,
* }
* ],
* ```
*/
visibleRows: 10,
/**
* Makes autocomplete or dropdown width the same as the edited cell width. If `false` then editor will be scaled
* according to its content.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* columns: [
* {
* type: 'autocomplete',
* // don't trim dropdown width with column width
* trimDropdown: false,
* }
* ],
* ```
*/
trimDropdown: true,
/**
* Setting to `true` enables the debug mode, currently used to test the correctness of the row and column
* header fixed positioning on a layer above the master table.
*
* @type {Boolean}
* @default false
*
* @example
* ```js
* // enable debug mode
* debug: true,
* ```
*/
debug: false,
/**
* When set to `true`, the text of the cell content is wrapped if it does not fit in the fixed column width.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* colWidths: 100,
* columns: [
* {
* // fixed column width is set but don't wrap the content
* wordWrap: false,
* }
* ],
* ```
*/
wordWrap: true,
/**
* CSS class name added to cells with cell meta `wordWrap: false`.
*
* @type {String}
* @default 'htNoWrap'
*
* @example
* ```js
* // set custom class for cells which content won't be wrapped
* noWordWrapClassName: 'is-noWrapCell',
* ```
*/
noWordWrapClassName: 'htNoWrap',
/**
* @description
* Defines if the right-click context menu should be enabled. Context menu allows to create new row or column at any
* place in the grid among [other features](https://docs.handsontable.com/demo-context-menu.html).
* Possible values:
* * `true` (to enable default options),
* * `false` (to disable completely)
* * an array of [predefined options](https://docs.handsontable.com/demo-context-menu.html#page-specific),
* * an object [with defined structure](https://docs.handsontable.com/demo-context-menu.html#page-custom)
*
* See [the context menu demo](https://docs.handsontable.com/demo-context-menu.html) for examples.
*
* @type {Boolean|String[]|Object}
* @default undefined
*
* @example
* ```js
* // as a boolean
* contextMenu: true,
*
* // as an array
* contextMenu: ['row_above', 'row_below', '---------', 'undo', 'redo'],
*
* // as an object (`name` attribute is required in the custom keys)
* contextMenu: {
* items: {
* "option1": {
* name: "option1"
* },
* "option2": {
* name: "option2",
* submenu: {
* items: [
* {
* key: "option2:suboption1",
* name: "option2:suboption1",
* callback: function(key, options) {
* ...
* }
* },
* ...
* ]
* }
* }
* }
* },
* ```
*/
contextMenu: void 0,
/**
* Disables or enables CopyPaste plugin to provide the copy/cut/paste functionality.
* Possible values:
* * `true` (to enable default options),
* * `false` (to disable completely)
*
* or an object with values:
* * `'columnsLimit'` (see {@link CopyPaste#columnsLimit})
* * `'rowsLimit'` (see {@link CopyPaste#rowsLimit})
* * `'pasteMode'` (see {@link CopyPaste#pasteMode})
*
* @type {Boolean|Object}
* @default true
*
* @example
* ```js
* // disable copy and paste
* copyPaste: false,
* ```
* @example
* ```js
* // disable copy and paste
* copyPaste: false,
*
* // or
* copyPaste: {
* pasteMode: 'shift_right',
* columnsLimit: 10,
* rowsLimit: 10,
* }
* ```
*/
copyPaste: true,
/**
* If `true`, undo/redo functionality is enabled.
*
* @type {Boolean}
* @default undefined
*
* @example
* ```js
* // enable undo and redo
* undo: true,
* ```
*/
undo: void 0,
/**
* @description
* Turns on [Column sorting](https://docs.handsontable.com/demo-sorting-data.html). Can be either a boolean (`true` / `false`) or an object with a declared sorting options:
* * `initialConfig` - Object with predefined keys:
* * `column` - sorted column
* * `sortOrder` - order in which column will be sorted
* * `'asc'` = ascending
* * `'desc'` = descending
* * `indicator` - display status for sorting order indicator (an arrow icon in the column header, specifying the sorting order).
* * `true` = show sort indicator for sorted columns
* * `false` = don't show sort indicator for sorted columns
* * `headerAction` - allow to click on the headers to sort
* * `true` = turn on possibility to click on the headers to sort
* * `false` = turn off possibility to click on the headers to sort
* * `sortEmptyCells` - how empty values should be handled
* * `true` = the table sorts empty cells
* * `false` = the table moves all empty cells to the end of the table
* * `compareFunctionFactory` - curry function returning compare function; compare function should work in the same way as function which is handled by native `Array.sort` method); please take a look at below examples for more information.
*
* @type {Boolean|Object}
* @default undefined
*
* @example
* ```js
* // as boolean
* columnSorting: true
*
* // as an object with initial sort config (sort ascending for column at index 1)
* columnSorting: {
* initialConfig: {
* column: 1,
* sortOrder: 'asc'
* }
* }
*
* // as an object which define specific sorting options for all columns
* columnSorting: {
* sortEmptyCells: true, // true = the table sorts empty cells, false = the table moves all empty cells to the end of the table
* indicator: true, // true = shows indicator for all columns, false = don't show indicator for columns
* headerAction: false, // true = allow to click on the headers to sort, false = turn off possibility to click on the headers to sort
* compareFunctionFactory: function(sortOrder, columnMeta) {
* return function(value, nextValue) {
* // Some value comparisons which will return -1, 0 or 1...
* }
* }
* }```
*/
columnSorting: void 0,
/**
* Turns on [Manual column move](https://docs.handsontable.com/demo-moving-rows-and-columns.html), if set to a boolean or define initial column order (as an array of column indexes).
*
* @type {Boolean|Number[]}
* @default undefined
*
* @example
* ```js
* // as a boolean to enable column move
* manualColumnMove: true,
*
* // as a array with initial order
* // (move column index at 0 to 1 and move column index at 1 to 4)
* manualColumnMove: [1, 4],
* ```
*/
manualColumnMove: void 0,
/**
* @description
* Turns on [Manual column resize](https://docs.handsontable.com/demo-resizing.html), if set to a boolean or define initial column resized widths (an an array of widths).
*
* @type {Boolean|Number[]}
* @default undefined
*
* @example
* ```js
* // as a boolean to enable column resize
* manualColumnResize: true,
*
* // as a array with initial widths
* // (column at 0 index has 40px and column at 1 index has 50px)
* manualColumnResize: [40, 50],
* ```
*/
manualColumnResize: void 0,
/**
* @description
* Turns on [Manual row move](https://docs.handsontable.com/demo-moving-rows-and-columns.html), if set to a boolean or define initial row order (as an array of row indexes).
*
* @type {Boolean|Number[]}
* @default undefined
*
* @example
* ```js
* // as a boolean
* manualRowMove: true,
*
* // as a array with initial order
* // (move row index at 0 to 1 and move row index at 1 to 4)
* manualRowMove: [1, 4],
* ```
*/
manualRowMove: void 0,
/**
* @description
* Turns on [Manual row resize](https://docs.handsontable.com/demo-resizing.html), if set to a boolean or define initial row resized heights (as an array of heights).
*
* @type {Boolean|Number[]}
* @default undefined
*
* @example
* ```js
* // as a boolean to enable row resize
* manualRowResize: true,
*
* // as an array to set initial heights
* // (row at 0 index has 40px and row at 1 index has 50px)
* manualRowResize: [40, 50],
* ```
*/
manualRowResize: void 0,
/**
* @description
* If set to `true`, it enables a possibility to merge cells. If set to an array of objects, it merges the cells provided
* in the objects (see the example below). More information on [the demo page](https://docs.handsontable.com/demo-merge-cells.html).
*
* @type {Boolean|Object[]}
* @default false
*
* @example
* ```js
* // enables the mergeCells plugin
* margeCells: true,
*
* // declares a list of merged sections
* mergeCells: [
* // rowspan and colspan properties declare the width and height of a merged section in cells
* {row: 1, col: 1, rowspan: 3, colspan: 3},
* {row: 3, col: 4, rowspan: 2, colspan: 2},
* {row: 5, col: 6, rowspan: 3, colspan: 3}
* ],
* ```
*/
mergeCells: false,
/**
* @description
* Turns on [Multi-column sorting](https://docs.handsontable.com/pro/demo-multicolumn-sorting.html). Can be either a boolean (`true` / `false`) or an object with a declared sorting options:
* * `initialConfig` - Array containing objects, every with predefined keys:
* * `column` - sorted column
* * `sortOrder` - order in which column will be sorted
* * `'asc'` = ascending
* * `'desc'` = descending
* * `indicator` - display status for sorting order indicator (an arrow icon in the column header, specifying the sorting order).
* * `true` = show sort indicator for sorted columns
* * `false` = don't show sort indicator for sorted columns
* * `headerAction` - allow to click on the headers to sort
* * `true` = turn on possibility to click on the headers to sort
* * `false` = turn off possibility to click on the headers to sort
* * `sortEmptyCells` - how empty values should be handled
* * `true` = the table sorts empty cells
* * `false` = the table moves all empty cells to the end of the table
* * `compareFunctionFactory` - curry function returning compare function; compare function should work in the same way as function which is handled by native `Array.sort` method); please take a look at below examples for more information.
*
* @type {Boolean|Object}
* @default undefined
*
* @example
* ```js
* // as boolean
* multiColumnSorting: true
*
* // as an object with initial sort config (sort ascending for column at index 1 and then sort descending for column at index 0)
* multiColumnSorting: {
* initialConfig: [{
* column: 1,
* sortOrder: 'asc'
* }, {
* column: 0,
* sortOrder: 'desc'
* }]
* }
*
* // as an object which define specific sorting options for all columns
* multiColumnSorting: {
* sortEmptyCells: true, // true = the table sorts empty cells, false = the table moves all empty cells to the end of the table
* indicator: true, // true = shows indicator for all columns, false = don't show indicator for columns
* headerAction: false, // true = allow to click on the headers to sort, false = turn off possibility to click on the headers to sort
* compareFunctionFactory: function(sortOrder, columnMeta) {
* return function(value, nextValue) {
* // Some value comparisons which will return -1, 0 or 1...
* }
* }
* }```
*/
multiColumnSorting: void 0,
/**
* @description
* Number of rows to be rendered outside of the visible part of the table. By default, it's set to `'auto'`, which
* makes Handsontable to attempt to calculate the best offset performance-wise.
*
* You may test out different values to find the best one that works for your specific implementation.
*
* @type {Number|String}
* @default 'auto'
*
* @example
* ```js
* viewportRowRenderingOffset: 70,
* ```
*/
viewportRowRenderingOffset: 'auto',
/**
* @description
* Number of columns to be rendered outside of the visible part of the table. By default, it's set to `'auto'`, which
* makes Handsontable try calculating the best offset performance-wise.
*
* You may experiment with the value to find the one that works best for your specific implementation.
*
* @type {Number|String}
* @default 'auto'
*
* @example
* ```js
* viewportColumnRenderingOffset: 70,
* ```
*/
viewportColumnRenderingOffset: 'auto',
/**
* @description
* A function, regular expression or a string, which will be used in the process of cell validation. If a function is
* used, be sure to execute the callback argument with either `true` (`callback(true)`) if the validation passed
* or with `false` (`callback(false)`), if the validation failed.
*
* __Note__, that `this` in the function points to the `cellProperties` object.
*
* If a string is provided, it may be one of the following predefined values:
* * `autocomplete`,
* * `date`,
* * `numeric`,
* * `time`.
*
* Or you can [register](https://docs.handsontable.com/demo-data-validation.html) the validator function under specified name and use its name as an alias in your
* configuration.
*
* See more [in the demo](https://docs.handsontable.com/demo-data-validation.html).
*
* @type {Function|RegExp|String}
* @default undefined
*
* @example
* ```js
* columns: [
* {
* // as a function
* validator: function(value, callback) {
* ...
* }
* },
* {
* // regular expression
* validator: /^[0-9]$/
* },
* {
* // as a string
* validator: 'numeric'
* }
* ],
* ```
*/
validator: void 0,
/**
* @description
* Disables visual cells selection.
*
* Possible values:
* * `true` - Disables any type of visual selection (current and area selection),
* * `false` - Enables any type of visual selection. This is default value.
* * `'current'` - Disables the selection of a currently selected cell, the area selection is still present.
* * `'area'` - Disables the area selection, the currently selected cell selection is still present.
* * `'header'` - Disables the headers selection, the currently selected cell selection is still present.
*
* @type {Boolean|String|String[]}
* @default false
*
* @example
* ```js
* // as a boolean
* disableVisualSelection: true,
*
* // as a string ('current', 'area' or 'header')
* disableVisualSelection: 'current',
*
* // as an array
* disableVisualSelection: ['current', 'area'],
* ```
*/
disableVisualSelection: false,
/**
* Disables or enables {@link ManualColumnFreeze} plugin.
*
* @type {Boolean}
* @default undefined
*
* @example
* ```js
* // enable fixed columns
* manualColumnFreeze: true,
* ```
*/
manualColumnFreeze: void 0,
/**
* Defines whether Handsontable should trim the whitespace at the beginning and the end of the cell contents.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* columns: [
* {
* // don't remove whitespace
* trimWhitespace: false
* }
* ]
* ```
*/
trimWhitespace: true,
/**
* Defines data source for Autocomplete or Dropdown cell types.
*
* @type {Array|Function}
* @default undefined
*
* @example
* ```js
* // source as a array
* columns: [{
* type: 'autocomplete',
* source: ['A', 'B', 'C', 'D']
* }],
*
* // source as a function
* columns: [{
* type: 'autocomplete',
* source: function(query, callback) {
* fetch('https://example.com/query?q=' + query, function(response) {
* callback(response.items);
* })
* }
* }],
* ```
*/
source: void 0,
/**
* @description
* Defines the column header name.
*
* @type {String}
* @default undefined
*
* @example
* ```js
* // set header names for every column
* columns: [
* {
* title: 'First name',
* type: 'text',
* },
* {
* title: 'Last name',
* type: 'text',
* }
* ],
* ```
*/
title: void 0,
/**
* Data template for `'checkbox'` type when checkbox is checked.
*
* @type {Boolean|String|Number}
* @default true
*
* @example
* ```js
* checkedTemplate: 'good'
*
* // if a checkbox-typed cell is checked, then getDataAtCell(x, y),
* // where x and y are the coordinates of the cell will return 'good'.
* ```
*/
checkedTemplate: void 0,
/**
* Data template for `'checkbox'` type when checkbox is unchecked.
*
* @type {Boolean|String|Number}
* @default false
*
* @example
* ```js
* uncheckedTemplate: 'bad'
*
* // if a checkbox-typed cell is not checked, then getDataAtCell(x,y),
* // where x and y are the coordinates of the cell will return 'bad'.
* ```
*/
uncheckedTemplate: void 0,
/**
* @description
* Object which describes if renderer should create checkbox element with label element as a parent.
*
* __Note__, this option only works for [checkbox-typed](https://docs.handsontable.com/demo-checkbox.html) cells.
*
* By default the [checkbox](https://docs.handsontable.com/demo-checkbox.html) renderer renders the checkbox without a label.
*
* Possible object properties:
* * `property` - Defines the property name of the data object, which will to be used as a label.
* (eg. `label: {property: 'name.last'}`). This option works only if data was passed as an array of objects.
* * `position` - String which describes where to place the label text (before or after checkbox element).
* Valid values are `'before'` and '`after`' (defaults to `'after'`).
* * `value` - String or a Function which will be used as label text.
*
* @type {Object}
* @default undefined
*
* @example
* ```js
* columns: [{
* type: 'checkbox',
* // add "My label:" after the checkbox
* label: {position: 'after', value: 'My label: '}
* }],
* ```
*/
label: void 0,
/**
* Display format for numeric typed renderers.
*
* __Note__, this option only works for [numeric-typed](https://docs.handsontable.com/demo-numeric.html) cells.
*
* Format is described by two properties:
* * `pattern` - Handled by `numbro` for purpose of formatting numbers to desired pattern. List of supported patterns can be found [here](http://numbrojs.com/format.html#numbers).
* * `culture` - Handled by `numbro` for purpose of formatting currencies. Examples showing how it works can be found [here](http://numbrojs.com/format.html#currency). List of supported cultures can be found [here](http://numbrojs.com/languages.html#supported-languages).
*
* __Note:__ Please keep in mind that this option is used only to format the displayed output! It has no effect on the input data provided for the cell. The numeric data can be entered to the table only as floats (separated by a dot or a comma) or integers, and are stored in the source dataset as JavaScript numbers.
*
* Handsontable uses [numbro](http://numbrojs.com/) as a main library for numbers formatting.
*
* @since 0.35.0
* @type {Object}
* @default undefined
*
* @example
* ```js
* columns: [
* {
* type: 'numeric',
* // set desired format pattern and
* numericFormat: {
* pattern: '0,00',
* culture: 'en-US'
* }
* }
* ],
* ```
*/
numericFormat: void 0,
/**
* Language for Handsontable translation. Possible language codes are [listed here](https://docs.handsontable.com/tutorial-internationalization.html#available-languages).
*
* @type {String}
* @default 'en-US'
*
* @example
* ```js
* // set Polish language
* language: 'pl-PL',
* ```
*/
language: 'en-US',
/**
* Data source for [select-typed](https://docs.handsontable.com/demo-select.html) cells.
*
* __Note__, this option only works for [select-typed](https://docs.handsontable.com/demo-select.html) cells.
*
* @type {String[]}
* @default undefined
*
* @example
* ```js
* columns: [
* {
* editor: 'select',
* // add three select options to choose from
* selectOptions: ['A', 'B', 'C'],
* }
* ],
* ```
*/
selectOptions: void 0,
/**
* Enables or disables the {@link AutoColumnSize} plugin. Default value is `undefined`, which has the same effect as `true`.
* Disabling this plugin can increase performance, as no size-related calculations would be done.
*
* Column width calculations are divided into sync and async part. Each of those parts has their own advantages and
* disadvantages. Synchronous calculations are faster but they block the browser UI, while the slower asynchronous
* operations don't block the browser UI.
*
* To configure the sync/async distribution, you can pass an absolute value (number of columns) or a percentage value.
*
* You can also use the `useHeaders` option to take the column headers width into calculation.
*
* @type {Object|Boolean}
* @default {syncLimit: 50}
*
* @example
* ```js
* // as a number (300 columns in sync, rest async)
* autoColumnSize: {syncLimit: 300},
*
* // as a string (percent)
* autoColumnSize: {syncLimit: '40%'},
*
* // use headers width while calculating the column width
* autoColumnSize: {useHeaders: true},
* ```
*/
autoColumnSize: void 0,
/**
* Enables or disables {@link AutoRowSize} plugin. Default value is `undefined`, which has the same effect as `false`
* (disabled). Enabling this plugin can decrease performance, as size-related calculations would be performed.
*
* Row height calculations are divided into sync and async stages. Each of these stages has their own advantages and
* disadvantages. Synchronous calculations are faster but they block the browser UI, while the slower asynchronous
* operations don't block the browser UI.
*
* To configure the sync/async distribution, you can pass an absolute value (number of columns) or a percentage value.
*
* @type {Object|Boolean}
* @default {syncLimit: 500}
*
* @example
* ```js
* // as a number (300 columns in sync, rest async)
* autoRowSize: {syncLimit: 300},
*
* // as a string (percent)
* autoRowSize: {syncLimit: '40%'},
* ```
*/
autoRowSize: void 0,
/**
* Date validation format.
*
* __Note__, this option only works for [date-typed](https://docs.handsontable.com/demo-date.html) cells.
*
* @type {String}
* @default 'DD/MM/YYYY'
*
* @example
* ```js
* columns: [{
* type: 'date',
* // localise date format
* dateFormat: 'MM/DD/YYYY'
* }],
* ```
*/
dateFormat: 'DD/MM/YYYY',
/**
* If `true` then dates will be automatically formatted to match the desired format.
*
* __Note__, this option only works for [date-typed](https://docs.handsontable.com/demo-date.html) cells.
*
* @type {Boolean}
* @default false
*
* @example
* ```js
* columns: [{
* type: 'date',
* dateFormat: 'YYYY-MM-DD',
* // force selected date format
* correctFormat: true
* }],
* ```
*/
correctFormat: false,
/**
* Definition of default value which will fill the empty cells.
*
* __Note__, this option only works for [date-typed](https://docs.handsontable.com/demo-date.html) cells.
*
* @type {String}
* @default undefined
*
* @example
* ```js
* columns: [
* {
* type: 'date',
* // always set this date for empty cells
* defaultDate: '2015-02-02'
* }
* ],
* ```
*/
defaultDate: void 0,
/**
* If set to `true`, the value entered into the cell must match (case-sensitive) the autocomplete source.
* Otherwise, cell won't pass the validation. When filtering the autocomplete source list, the editor will
* be working in case-insensitive mode.
*
* __Note__, this option only works for [autocomplete-typed](https://docs.handsontable.com/demo-autocomplete.html) cells.
*
* @type {Boolean}
* @default undefined
*
* @example
* ```js
* columns: [{
* type: 'autocomplete',
* source: ['A', 'B', 'C'],
* // force selected value to match the source list
* strict: true
* }],
* ```
*/
strict: void 0,
/**
* If set to `true`, data defined in `source` of the autocomplete or dropdown cell will be treated as HTML.
*
* __Warning:__ Enabling this option can cause serious XSS vulnerabilities.
*
* __Note__, this option only works for [autocomplete-typed](https://docs.handsontable.com/demo-autocomplete.html) cells.
*
* @type {Boolean}
* @default false
*
* @example
* ```js
* columns: [{
* type: 'autocomplete',
* // use HTML in the source list
* allowHtml: true,
* source: ['foo', 'bar']
* }],
* ```
*/
allowHtml: false,
/**
* If typed `true` then virtual rendering mechanism for handsontable will be disabled.
*
* @type {Boolean}
* @default undefined
*
* @example
* ```js
* // disable virtual rows rendering
* renderAllRows: true,
* ```
*/
renderAllRows: void 0,
/**
* Prevents table to overlap outside the parent element. If `'horizontal'` option is chosen then table will show
* a horizontal scrollbar if parent's width is narrower then table's width.
*
* Possible values:
* * `false` - Disables functionality.
* * `horizontal` - Prevents horizontal overflow table.
* * `vertical` - Prevents vertical overflow table.
*
* @type {String|Boolean}
* @default false
*
* @example
* ```js
* preventOverflow: 'horizontal',
* ```
*/
preventOverflow: false,
/**
* Prevents wheel event on overlays for doing default action.
*
* @private
* @type {Boolean}
* @default false
*
* @example
* ```js
* preventWheel: false,
* ```
*/
preventWheel: false,
/**
* @description
* Enables the functionality of the {@link BindRowsWithHeaders} plugin which allows binding the table rows with their headers.
* If the plugin is enabled, the table row headers will "stick" to the rows, when they are hidden/moved. Basically,
* if at the initialization row 0 has a header titled "A", it will have it no matter what you do with the table.
*
* @type {Boolean|String}
* @default undefined
*
* @example
* ```js
* // keep row data and row headers in sync
* bindRowsWithHeaders: true
* ```
*/
bindRowsWithHeaders: void 0,
/**
* @description
* The {@link CollapsibleColumns} plugin allows collapsing of columns, covered by a header with the `colspan` property
* defined.
*
* Clicking the "collapse/expand" button collapses (or expands) all "child" headers except the first one.
*
* Setting the `collapsibleColumns` property to `true` will display a "collapse/expand" button in every
* header with a defined colspan` property.
*
* To limit this functionality to a smaller group of headers, define the `collapsibleColumns` property
* as an array of objects, as in the example below.
*
* @type {Boolean|Object[]}
* @default undefined
*
* @example
* ```js
* // enable collapsing for all headers
* collapsibleColumns: true,
*
* // or
* // enable collapsing for selected headers
* collapsibleColumns: [
* {row: -4, col: 1, collapsible: true},
* {row: -3, col: 5, collapsible: true}
* ],
* ```
*/
collapsibleColumns: void 0,
/**
* @description
* Allows making pre-defined calculations on the cell values and display the results within Handsontable.
*
* Possible types:
* * `'sum'`
* * `'min'`
* * `'max'`
* * `'count'`
* * `'average'`
* * `'custom'` - add `customFunction`
*
* [See the demo for more information](https://docs.handsontable.com/pro/demo-summary-calculations.html).
*
* @type {Object[]|Function}
* @default undefined
*
* @example
* ```
* columnSummary: [
* {
* destinationRow: 4,
* destinationColumn: 1,
* forceNumeric: true,
* reversedRowCoords: true,
* suppressDataTypeErrors: false,
* readOnly: true,
* roundFloat: false,
* type: 'custom',
* customFunction: function(endpoint) {
* return 100;
* }
* }
* ],
* ```
*/
columnSummary: void 0,
/**
* This plugin allows adding a configurable dropdown menu to the table's column headers. The dropdown menu acts like
* the {@link Options#contextMenu}, but is triggered by clicking the button in the header.
*
* @type {Boolean|Object|String[]}
* @default undefined
*
* @example
* ```js
* // enable dropdown menu
* dropdownMenu: true,
*
* // or
* // enable and configure dropdown menu options
* dropdownMenu: ['remove_col', '---------', 'make_read_only', 'alignment']
* ```
*/
dropdownMenu: void 0,
/**
* The {@link Filters} plugin allows filtering the table data either by the built-in component or with the API.
*
* @type {Boolean}
* @default undefined
*
* @example
* ```js
* // enable filters
* filters: true,
* ```
*/
filters: void 0,
/**
* The {@link Formulas} plugin allows Handsontable to process formula expressions defined in the provided data.
*
* @type {Boolean|Object}
* @default undefined
*
* @example
* ```js
* // enable formulas plugin
* formulas: true,
*
* // or as an object with custom variables to be used in formula expressions
* formulas: {
* variables: {
* FOO: 64,
* BAR: 'baz',
* }
* },
* ```
*/
formulas: void 0,
/**
* @description
* The {@link GanttChart} plugin enables a possibility to create a Gantt chart using a Handsontable instance. In this
* case, the whole table becomes read-only.
*
* @type {Object}
* @default undefined
*/
ganttChart: void 0,
/**
* @description
* Allows adding a tooltip to the table headers.
*
* Available options:
* * the `rows` property defines if tooltips should be added to row headers,
* * the `columns` property defines if tooltips should be added to column headers,
* * the `onlyTrimmed` property defines if tooltips should be added only to headers, which content is trimmed by the header itself (the content being wider then the header).
*
* @type {Boolean|Object}
* @default undefined
*
* @example
* ```js
* // enable tooltips for all headers
* headerTooltips: true,
*
* // or
* headerTooltips: {
* rows: false,
* columns: true,
* onlyTrimmed: true
* }
* ```
*/
headerTooltips: void 0,
/**
* The {@link HiddenColumns} plugin allows hiding of certain columns. You can pass additional configuration with an
* object notation. Options that are then available are:
* * `columns` - an array of rows that should be hidden on plugin initialization
* * `indicators` - enables small ui markers to indicate where are hidden columns
*
* @type {Boolean|Object}
* @default undefined
*
* @example
* ```js
* // enable column hiding
* hiddenColumns: true,
*
* // or
* hiddenColumns: {
* // set columns that are hidden by default
* columns: [5, 10, 15],
* // show where are hidden columns
* indicators: true
* }
* ```
*/
hiddenColumns: void 0,
/**
* The {@link HiddenRows} plugin allows hiding of certain rows. You can pass additional configuration with an
* object notation. Options that are then available are:
* * `rows` - an array of rows that should be hidden on plugin initialization
* * `indicators` - enables small ui markers to indicate where are hidden columns
*
* @type {Boolean|Object}
* @default undefined
*
* @example
* ```js
* // enable row hiding
* hiddenRows: true,
*
* // or
* hiddenRows: {
* // set rows that are hidden by default
* rows: [5, 10, 15],
* // show where are hidden rows
* indicators: true
* }
* ```
*/
hiddenRows: void 0,
/**
* @description
* Allows creating a nested header structure, using the HTML's colspan attribute.
*
* @type {Array[]}
* @default undefined
*
* @example
* ```
* nestedHeaders: [
* ['A', {label: 'B', colspan: 8}, 'C'],
* ['D', {label: 'E', colspan: 4}, {label: 'F', colspan: 4}, 'G'],
* ['H', 'I', 'J', 'K', 'L', 'M', 'N', 'R', 'S', 'T']
* ],
* ```
*/
nestedHeaders: void 0,
/**
* @description
* Plugin allowing hiding of certain rows.
*
* @type {Boolean|Number[]}
* @default undefined
*
* @example
* ```js
* // enable plugin
* trimRows: true,
*
* // or
* // trim selected rows on table initialization
* trimRows: [5, 10, 15],
* ```
*/
trimRows: void 0,
/**
* @description
* Allows setting a custom width of the row headers. You can provide a number or an array of widths, if many row
* header levels are defined.
*
* @type {Number|Number[]}
* @default undefined
*
* @example
* ```js
* // set width for all row headers
* rowHeaderWidth: 25,
*
* // or
* // set width for selected headers only
* rowHeaderWidth: [25, 30, 55],
* ```
*/
rowHeaderWidth: void 0,
/**
* @description
* Allows setting a custom height of the column headers. You can provide a number or an array of heights, if many
* column header levels are defined.
*
* @type {Number|Number[]}
* @default undefined
*
* @example
* ```js
* // set shared height for all headers
* columnHeaderHeight: 35,
*
* // or
* // set height for each header individually
* columnHeaderHeight: [35, 20, 55],
*
* // or
* // skipped headers will fallback to default value
* columnHeaderHeight: [35, undefined, 55],
* ```
*/
columnHeaderHeight: void 0,
/**
* @description
* Enables the {@link ObserveChanges} plugin switches table into one-way data binding where changes are applied into
* data source (from outside table) will be automatically reflected in the table.
*
* For every data change [afterChangesObserved](Hooks.html#event:afterChangesObserved) hook will be fired.
*
* @type {Boolean}
* @default undefined
*
* @example
* ```js
* observeChanges: true,
* ```
*/
observeChanges: void 0,
/**
* If defined as `true`, the Autocomplete's suggestion list would be sorted by relevance (the closer to the left the
* match is, the higher the suggestion).
*
* __Note__, this option only works for [autocomplete-typed](https://docs.handsontable.com/demo-autocomplete.html) cells.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* columns: [
* {
* type: 'autocomplete',
* source: [ ... ],
* // keep options order as they were defined
* sortByRelevance: false
* }
* ],
* ```
*/
sortByRelevance: true,
/**
* If defined as `true`, when the user types into the input area the Autocomplete's suggestion list is updated to only
* include those choices starting with what has been typed; if defined as `false` all suggestions remain shown, with
* those matching what has been typed marked in bold.
*
* __Note__, this option only works for [autocomplete-typed](https://docs.handsontable.com/demo-autocomplete.html) cells.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* columns: [
* {
* type: 'autocomplete',
* source: [ ... ],
* // don't hide options that don't match search query
* filter: false
* }
* ],
* ```
*/
filter: true,
/**
* If defined as `true`, filtering in the Autocomplete Editor will be case-sensitive.
*
* __Note__, this option only works for [autocomplete-typed](https://docs.handsontable.com/demo-autocomplete.html) cells.
*
* @type {Boolean}
* @default: false
*
* @example
* ```js
* columns: [
* {
* type: 'autocomplete',
* source: [ ... ],
* // match case while searching autocomplete options
* filteringCaseSensitive: true
* }
* ],
* ```
*/
filteringCaseSensitive: false,
/**
* @description
* Disables or enables the drag to scroll functionality.
*
* @type {Boolean}
* @default true
*
* @example
* ```js
* // don't scroll the viewport when selection gets to the viewport edge
* dragToScroll: false,
* ```
*/
dragToScroll: true,
/**
* @description
* Disable or enable the nested rows functionality - displaying nested structures in a two-dimensional data table.
*
* See [quick setup of the Nested rows](https://docs.handsontable.kbudnik/pro/next/demo-nested-rows.html).
* @example
* ```js
* nestedRows: true,
* ```
*
* @type {Boolean}
* @default false
*/
nestedRows: void 0
};
var _default = DefaultSettings;
exports.default = _default;
/***/ }),
/* 387 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.getTranslatedPhrase = getTranslatedPhrase;
var _array = __webpack_require__(4);
var _dictionariesManager = __webpack_require__(150);
var _phraseFormatters = __webpack_require__(508);
var _mixed = __webpack_require__(29);
/**
* Get phrase for specified dictionary key.
*
* @param {String} languageCode Language code for specific language i.e. 'en-US', 'pt-BR', 'de-DE'.
* @param {String} dictionaryKey Constant which is dictionary key.
* @param {*} argumentsForFormatters Arguments which will be handled by formatters.
*
* @returns {String}
*/
// eslint-disable-next-line import/prefer-default-export
function getTranslatedPhrase(languageCode, dictionaryKey, argumentsForFormatters) {
var languageDictionary = (0, _dictionariesManager.getLanguageDictionary)(languageCode);
if (languageDictionary === null) {
return null;
}
var phrasePropositions = languageDictionary[dictionaryKey];
if ((0, _mixed.isUndefined)(phrasePropositions)) {
return null;
}
var formattedPhrase = getFormattedPhrase(phrasePropositions, argumentsForFormatters);
if (Array.isArray(formattedPhrase)) {
return formattedPhrase[0];
}
return formattedPhrase;
}
/**
* Get formatted phrase from phrases propositions for specified dictionary key.
*
* @private
* @param {Array|string} phrasePropositions List of phrase propositions.
* @param {*} argumentsForFormatters Arguments which will be handled by formatters.
*
* @returns {Array|string}
*/
function getFormattedPhrase(phrasePropositions, argumentsForFormatters) {
var formattedPhrasePropositions = phrasePropositions;
(0, _array.arrayEach)((0, _phraseFormatters.getPhraseFormatters)(), function (formatter) {
formattedPhrasePropositions = formatter(phrasePropositions, argumentsForFormatters);
});
return formattedPhrasePropositions;
}
/***/ }),
/* 388 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(19);
__webpack_require__(23);
exports.__esModule = true;
exports.extendNotExistingKeys = extendNotExistingKeys;
exports.createCellHeadersRange = createCellHeadersRange;
exports.normalizeLanguageCode = normalizeLanguageCode;
exports.applyLanguageSetting = applyLanguageSetting;
exports.warnUserAboutLanguageRegistration = warnUserAboutLanguageRegistration;
var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(72));
var _mixed = __webpack_require__(29);
var _object = __webpack_require__(3);
var _console = __webpack_require__(61);
var _templateLiteralTag = __webpack_require__(73);
var _dictionariesManager = __webpack_require__(150);
function _templateObject() {
var data = (0, _taggedTemplateLiteral2.default)(["Language with code \"", "\" was not found. You should register particular language \n before using it. Read more about this issue at: https://docs.handsontable.com/i18n/missing-language-code."]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
/**
* Perform shallow extend of a target object with only this extension's properties which doesn't exist in the target.
*
* @param {Object} target An object that will receive the new properties.
* @param {Object} extension An object containing additional properties to merge into the target.
*/
// TODO: Maybe it should be moved to global helpers? It's changed `extend` function.
function extendNotExistingKeys(target, extension) {
(0, _object.objectEach)(extension, function (value, key) {
if ((0, _mixed.isUndefined)(target[key])) {
target[key] = value;
}
});
return target;
}
/**
* Create range of values basing on cell indexes. For example, it will create below ranges for specified function arguments:
*
* createCellHeadersRange(2, 7) => `2-7`
* createCellHeadersRange(7, 2) => `2-7`
* createCellHeadersRange(0, 4, 'A', 'D') => `A-D`
* createCellHeadersRange(4, 0, 'D', 'A') => `A-D`
*
* @param {number} firstRowIndex Index of "first" cell
* @param {number} nextRowIndex Index of "next" cell
* @param {*} fromValue Value which will represent "first" cell
* @param {*} toValue Value which will represent "next" cell
* @returns {String} Value representing range i.e. A-Z, 11-15.
*/
function createCellHeadersRange(firstRowIndex, nextRowIndex) {
var fromValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : firstRowIndex;
var toValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : nextRowIndex;
// Will swap `fromValue` with `toValue` if it's necessary.
var from = fromValue,
to = toValue;
if (firstRowIndex > nextRowIndex) {
var _ref = [to, from];
from = _ref[0];
to = _ref[1];
}
return "".concat(from, "-").concat(to);
}
/**
* Normalize language code. It takes handled languageCode proposition and change it to proper languageCode.
* For example, when it takes `eN-us` as parameter it return `en-US`
*
* @param {String} languageCode Language code for specific language i.e. 'en-US', 'pt-BR', 'de-DE'.
* @returns {String}
*/
function normalizeLanguageCode(languageCode) {
var languageCodePattern = /^([a-zA-Z]{2})-([a-zA-Z]{2})$/;
var partsOfLanguageCode = languageCodePattern.exec(languageCode);
if (partsOfLanguageCode) {
return "".concat(partsOfLanguageCode[1].toLowerCase(), "-").concat(partsOfLanguageCode[2].toUpperCase());
}
return languageCode;
}
/**
* Set proper start language code. User may set language code which is not proper.
*
* @param {Object} settings Settings object.
* @param {String} languageCode Language code for specific language i.e. 'en-US', 'pt-BR', 'de-DE'.
* @returns {String}
*/
function applyLanguageSetting(settings, languageCode) {
var normalizedLanguageCode = normalizeLanguageCode(languageCode);
if ((0, _dictionariesManager.hasLanguageDictionary)(normalizedLanguageCode)) {
settings.language = normalizedLanguageCode;
} else {
settings.language = _dictionariesManager.DEFAULT_LANGUAGE_CODE;
warnUserAboutLanguageRegistration(languageCode);
}
}
/**
*
* Warn user if there is no registered language.
*
* @param {String} languageCode Language code for specific language i.e. 'en-US', 'pt-BR', 'de-DE'.
*/
function warnUserAboutLanguageRegistration(languageCode) {
if ((0, _mixed.isDefined)(languageCode)) {
(0, _console.error)((0, _templateLiteralTag.toSingleLine)(_templateObject(), languageCode));
}
}
/***/ }),
/* 389 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
var _highlight = _interopRequireDefault(__webpack_require__(390));
exports.Highlight = _highlight.default;
var _selection = _interopRequireDefault(__webpack_require__(519));
exports.Selection = _selection.default;
var _mouseEventHandler = __webpack_require__(382);
exports.handleMouseEvent = _mouseEventHandler.handleMouseEvent;
var _utils = __webpack_require__(152);
exports.detectSelectionType = _utils.detectSelectionType;
exports.normalizeSelectionFactory = _utils.normalizeSelectionFactory;
/***/ }),
/* 390 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(124);
__webpack_require__(149);
__webpack_require__(391);
__webpack_require__(19);
__webpack_require__(510);
__webpack_require__(50);
__webpack_require__(96);
__webpack_require__(31);
__webpack_require__(15);
__webpack_require__(69);
__webpack_require__(392);
__webpack_require__(393);
__webpack_require__(65);
__webpack_require__(10);
__webpack_require__(39);
__webpack_require__(13);
__webpack_require__(97);
__webpack_require__(16);
exports.__esModule = true;
exports.default = exports.CUSTOM_SELECTION = exports.HEADER_TYPE = exports.FILL_TYPE = exports.CELL_TYPE = exports.AREA_TYPE = exports.ACTIVE_HEADER_TYPE = void 0;
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(37));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(70));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _types = __webpack_require__(512);
var _array = __webpack_require__(4);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var ACTIVE_HEADER_TYPE = 'active-header';
exports.ACTIVE_HEADER_TYPE = ACTIVE_HEADER_TYPE;
var AREA_TYPE = 'area';
exports.AREA_TYPE = AREA_TYPE;
var CELL_TYPE = 'cell';
exports.CELL_TYPE = CELL_TYPE;
var FILL_TYPE = 'fill';
exports.FILL_TYPE = FILL_TYPE;
var HEADER_TYPE = 'header';
exports.HEADER_TYPE = HEADER_TYPE;
var CUSTOM_SELECTION = 'custom-selection';
/**
* Highlight class responsible for managing Walkontable Selection classes.
*
* With Highlight object you can manipulate four different highlight types:
* - `cell` can be added only to a single cell at a time and it defines currently selected cell;
* - `fill` can occur only once and its highlight defines selection of autofill functionality (managed by the plugin with the same name);
* - `areas` can be added to multiple cells at a time. This type highlights selected cell or multiple cells.
* The multiple cells have to be defined as an uninterrupted order (regular shape). Otherwise, the new layer of
* that type should be created to manage not-consecutive selection;
* - `header` can occur multiple times. This type is designed to highlight only headers. Like `area` type it
* can appear with multiple highlights (accessed under different level layers).
*
* @class Highlight
* @util
*/
exports.CUSTOM_SELECTION = CUSTOM_SELECTION;
var Highlight =
/*#__PURE__*/
function () {
function Highlight(options) {
(0, _classCallCheck2.default)(this, Highlight);
/**
* Options consumed by Highlight class and Walkontable Selection classes.
*
* @type {Object}
*/
this.options = options;
/**
* The property which describes which layer level of the visual selection will be modified.
* This option is valid only for `area` and `header` highlight types which occurs multiple times on
* the table (as a non-consecutive selection).
*
* An order of the layers is the same as the order of added new non-consecutive selections.
*
* @type {Number}
* @default 0
*/
this.layerLevel = 0;
/**
* `cell` highlight object which describes attributes for the currently selected cell.
* It can only occur only once on the table.
*
* @type {Selection}
*/
this.cell = (0, _types.createHighlight)(CELL_TYPE, options);
/**
* `fill` highlight object which describes attributes for the borders for autofill functionality.
* It can only occur only once on the table.
*
* @type {Selection}
*/
this.fill = (0, _types.createHighlight)(FILL_TYPE, options);
/**
* Collection of the `area` highlights. That objects describes attributes for the borders and selection of
* the multiple selected cells. It can occur multiple times on the table.
*
* @type {Map.}
*/
this.areas = new Map();
/**
* Collection of the `header` highlights. That objects describes attributes for the selection of
* the multiple selected rows and columns in the table header. It can occur multiple times on the table.
*
* @type {Map.}
*/
this.headers = new Map();
/**
* Collection of the `active-header` highlights. That objects describes attributes for the selection of
* the multiple selected rows and columns in the table header. The table headers which have selected all items in
* a row will be marked as `active-header`.
*
* @type {Map.}
*/
this.activeHeaders = new Map();
/**
* Collection of the `custom-selection`, holder for example borders added through CustomBorders plugin.
*
* @type {Selection[]}
*/
this.customSelections = [];
}
/**
* Check if highlight cell rendering is disabled for specyfied highlight type.
*
* @param {String} highlightType Highlight type. Possible values are: `cell`, `area`, `fill` or `header`.
* @return {Boolean}
*/
(0, _createClass2.default)(Highlight, [{
key: "isEnabledFor",
value: function isEnabledFor(highlightType) {
// Legacy compatibility.
var type = highlightType === 'current' ? CELL_TYPE : highlightType;
var disableHighlight = this.options.disableHighlight;
if (typeof disableHighlight === 'string') {
disableHighlight = [disableHighlight];
}
return disableHighlight === false || Array.isArray(disableHighlight) && !disableHighlight.includes(type);
}
/**
* Set a new layer level to make access to the desire `area` and `header` highlights.
*
* @param {Number} [level=0] Layer level to use.
* @returns {Highlight}
*/
}, {
key: "useLayerLevel",
value: function useLayerLevel() {
var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
this.layerLevel = level;
return this;
}
/**
* Get Walkontable Selection instance created for controlling highlight of the currently selected/edited cell.
*
* @return {Selection}
*/
}, {
key: "getCell",
value: function getCell() {
return this.cell;
}
/**
* Get Walkontable Selection instance created for controlling highlight of the autofill functionality.
*
* @return {Selection}
*/
}, {
key: "getFill",
value: function getFill() {
return this.fill;
}
/**
* Get or create (if not exist in the cache) Walkontable Selection instance created for controlling highlight
* of the multiple selected cells.
*
* @return {Selection}
*/
}, {
key: "createOrGetArea",
value: function createOrGetArea() {
var layerLevel = this.layerLevel;
var area;
if (this.areas.has(layerLevel)) {
area = this.areas.get(layerLevel);
} else {
area = (0, _types.createHighlight)(AREA_TYPE, _objectSpread({
layerLevel: layerLevel
}, this.options));
this.areas.set(layerLevel, area);
}
return area;
}
/**
* Get all Walkontable Selection instances which describes the state of the visual highlight of the cells.
*
* @return {Selection[]}
*/
}, {
key: "getAreas",
value: function getAreas() {
return (0, _toConsumableArray2.default)(this.areas.values());
}
/**
* Get or create (if not exist in the cache) Walkontable Selection instance created for controlling highlight
* of the multiple selected header cells.
*
* @return {Selection}
*/
}, {
key: "createOrGetHeader",
value: function createOrGetHeader() {
var layerLevel = this.layerLevel;
var header;
if (this.headers.has(layerLevel)) {
header = this.headers.get(layerLevel);
} else {
header = (0, _types.createHighlight)(HEADER_TYPE, _objectSpread({}, this.options));
this.headers.set(layerLevel, header);
}
return header;
}
/**
* Get all Walkontable Selection instances which describes the state of the visual highlight of the headers.
*
* @return {Selection[]}
*/
}, {
key: "getHeaders",
value: function getHeaders() {
return (0, _toConsumableArray2.default)(this.headers.values());
}
/**
* Get or create (if not exist in the cache) Walkontable Selection instance created for controlling highlight
* of the multiple selected active header cells.
*
* @return {Selection}
*/
}, {
key: "createOrGetActiveHeader",
value: function createOrGetActiveHeader() {
var layerLevel = this.layerLevel;
var header;
if (this.activeHeaders.has(layerLevel)) {
header = this.activeHeaders.get(layerLevel);
} else {
header = (0, _types.createHighlight)(ACTIVE_HEADER_TYPE, _objectSpread({}, this.options));
this.activeHeaders.set(layerLevel, header);
}
return header;
}
/**
* Get all Walkontable Selection instances which describes the state of the visual highlight of the active headers.
*
* @return {Selection[]}
*/
}, {
key: "getActiveHeaders",
value: function getActiveHeaders() {
return (0, _toConsumableArray2.default)(this.activeHeaders.values());
}
/**
* Get Walkontable Selection instance created for controlling highlight of the custom selection functionality.
*
* @return {Selection}
*/
}, {
key: "getCustomSelections",
value: function getCustomSelections() {
return (0, _toConsumableArray2.default)(this.customSelections.values());
}
/**
* Add selection to the custom selection instance. The new selection are added to the end of the selection collection.
*
* @param {Object} options
*/
}, {
key: "addCustomSelection",
value: function addCustomSelection(options) {
this.customSelections.push((0, _types.createHighlight)(CUSTOM_SELECTION, _objectSpread({}, options)));
}
/**
* Perform cleaning visual highlights for the whole table.
*/
}, {
key: "clear",
value: function clear() {
this.cell.clear();
this.fill.clear();
(0, _array.arrayEach)(this.areas.values(), function (highlight) {
return void highlight.clear();
});
(0, _array.arrayEach)(this.headers.values(), function (highlight) {
return void highlight.clear();
});
(0, _array.arrayEach)(this.activeHeaders.values(), function (highlight) {
return void highlight.clear();
});
}
/**
* This object can be iterate over using `for of` syntax or using internal `arrayEach` helper.
*/
}, {
key: Symbol.iterator,
value: function value() {
return [this.cell, this.fill].concat((0, _toConsumableArray2.default)(this.areas.values()), (0, _toConsumableArray2.default)(this.headers.values()), (0, _toConsumableArray2.default)(this.activeHeaders.values()), (0, _toConsumableArray2.default)(this.customSelections))[Symbol.iterator]();
}
}]);
return Highlight;
}();
var _default = Highlight;
exports.default = _default;
/***/ }),
/* 391 */
/***/ (function(module, exports, __webpack_require__) {
var defineWellKnownSymbol = __webpack_require__(385);
// `Symbol.iterator` well-known symbol
// https://tc39.github.io/ecma262/#sec-symbol.iterator
defineWellKnownSymbol('iterator');
/***/ }),
/* 392 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(20);
var fails = __webpack_require__(26);
var toIndexedObject = __webpack_require__(63);
var nativeGetOwnPropertyDescriptor = __webpack_require__(79).f;
var DESCRIPTORS = __webpack_require__(44);
var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
}
});
/***/ }),
/* 393 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(20);
var DESCRIPTORS = __webpack_require__(44);
var ownKeys = __webpack_require__(199);
var toIndexedObject = __webpack_require__(63);
var getOwnPropertyDescriptorModule = __webpack_require__(79);
var createProperty = __webpack_require__(115);
// `Object.getOwnPropertyDescriptors` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
var O = toIndexedObject(object);
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
var keys = ownKeys(O);
var result = {};
var index = 0;
var key, descriptor;
while (keys.length > index) {
descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
if (descriptor !== undefined) createProperty(result, key, descriptor);
}
return result;
}
});
/***/ }),
/* 394 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(12);
__webpack_require__(15);
__webpack_require__(69);
__webpack_require__(65);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(16);
exports.__esModule = true;
exports.default = void 0;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(70));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _object = __webpack_require__(3);
var _number = __webpack_require__(17);
var _mixed = __webpack_require__(29);
/**
* @class SamplesGenerator
* @util
*/
var SamplesGenerator =
/*#__PURE__*/
function () {
(0, _createClass2.default)(SamplesGenerator, null, [{
key: "SAMPLE_COUNT",
/**
* Number of samples to take of each value length.
*
* @type {Number}
*/
get: function get() {
return 3;
}
}]);
function SamplesGenerator(dataFactory) {
(0, _classCallCheck2.default)(this, SamplesGenerator);
/**
* Samples prepared for calculations.
*
* @type {Map}
* @default {null}
*/
this.samples = null;
/**
* Function which give the data to collect samples.
*
* @type {Function}
*/
this.dataFactory = dataFactory;
/**
* Custom number of samples to take of each value length.
*
* @type {Number}
* @default {null}
*/
this.customSampleCount = null;
/**
* `true` if duplicate samples collection should be allowed, `false` otherwise.
*
* @type {Boolean}
* @default {false}
*/
this.allowDuplicates = false;
}
/**
* Get the sample count for this instance.
*
* @returns {Number}
*/
(0, _createClass2.default)(SamplesGenerator, [{
key: "getSampleCount",
value: function getSampleCount() {
if (this.customSampleCount) {
return this.customSampleCount;
}
return SamplesGenerator.SAMPLE_COUNT;
}
/**
* Set the sample count.
*
* @param {Number} sampleCount Number of samples to be collected.
*/
}, {
key: "setSampleCount",
value: function setSampleCount(sampleCount) {
this.customSampleCount = sampleCount;
}
/**
* Set if the generator should accept duplicate values.
*
* @param {Boolean} allowDuplicates `true` to allow duplicate values.
*/
}, {
key: "setAllowDuplicates",
value: function setAllowDuplicates(allowDuplicates) {
this.allowDuplicates = allowDuplicates;
}
/**
* Generate samples for row. You can control which area should be sampled by passing `rowRange` object and `colRange` object.
*
* @param {Object|Number} rowRange
* @param {Object} colRange
* @returns {Object}
*/
}, {
key: "generateRowSamples",
value: function generateRowSamples(rowRange, colRange) {
return this.generateSamples('row', colRange, rowRange);
}
/**
* Generate samples for column. You can control which area should be sampled by passing `colRange` object and `rowRange` object.
*
* @param {Object} colRange Column index.
* @param {Object} rowRange Column index.
* @returns {Object}
*/
}, {
key: "generateColumnSamples",
value: function generateColumnSamples(colRange, rowRange) {
return this.generateSamples('col', rowRange, colRange);
}
/**
* Generate collection of samples.
*
* @param {String} type Type to generate. Can be `col` or `row`.
* @param {Object} range
* @param {Object|Number} specifierRange
* @returns {Map}
*/
}, {
key: "generateSamples",
value: function generateSamples(type, range, specifierRange) {
var _this = this;
var samples = new Map();
var _ref = typeof specifierRange === 'number' ? {
from: specifierRange,
to: specifierRange
} : specifierRange,
from = _ref.from,
to = _ref.to;
(0, _number.rangeEach)(from, to, function (index) {
var sample = _this.generateSample(type, range, index);
samples.set(index, sample);
});
return samples;
}
/**
* Generate sample for specified type (`row` or `col`).
*
* @param {String} type Samples type `row` or `col`.
* @param {Object} range
* @param {Number} specifierValue
* @returns {Map}
*/
}, {
key: "generateSample",
value: function generateSample(type, range, specifierValue) {
var _this2 = this;
if (type !== 'row' && type !== 'col') {
throw new Error('Unsupported sample type');
}
var samples = new Map();
var computedKey = type === 'row' ? 'col' : 'row';
var sampledValues = [];
(0, _number.rangeEach)(range.from, range.to, function (index) {
var _ref2 = type === 'row' ? _this2.dataFactory(specifierValue, index) : _this2.dataFactory(index, specifierValue),
value = _ref2.value,
bundleCountSeed = _ref2.bundleCountSeed;
var hasCustomBundleSeed = bundleCountSeed > 0;
var length;
if ((0, _object.isObject)(value)) {
length = Object.keys(value).length;
} else if (Array.isArray(value)) {
length = value.length;
} else {
length = (0, _mixed.stringify)(value).length;
}
if (hasCustomBundleSeed) {
length += bundleCountSeed;
}
if (!samples.has(length)) {
samples.set(length, {
needed: _this2.getSampleCount(),
strings: []
});
}
var sample = samples.get(length);
if (sample.needed) {
var duplicate = sampledValues.indexOf(value) > -1;
if (!duplicate || _this2.allowDuplicates || hasCustomBundleSeed) {
sample.strings.push((0, _defineProperty2.default)({
value: value
}, computedKey, index));
sampledValues.push(value);
sample.needed -= 1;
}
}
});
return samples;
}
}]);
return SamplesGenerator;
}();
var _default = SamplesGenerator;
exports.default = _default;
/***/ }),
/* 395 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(124);
__webpack_require__(19);
__webpack_require__(100);
__webpack_require__(50);
__webpack_require__(96);
__webpack_require__(15);
__webpack_require__(148);
__webpack_require__(41);
__webpack_require__(78);
__webpack_require__(69);
__webpack_require__(86);
__webpack_require__(87);
__webpack_require__(396);
__webpack_require__(392);
__webpack_require__(393);
__webpack_require__(177);
__webpack_require__(65);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(97);
__webpack_require__(16);
__webpack_require__(34);
exports.__esModule = true;
exports.default = void 0;
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(37));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(70));
var _objectWithoutProperties2 = _interopRequireDefault(__webpack_require__(531));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(6));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(28));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(5));
var _get2 = _interopRequireDefault(__webpack_require__(14));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _element = __webpack_require__(8);
var _mixed = __webpack_require__(29);
var _object = __webpack_require__(3);
var _array = __webpack_require__(4);
var _number = __webpack_require__(17);
var _base = _interopRequireDefault(__webpack_require__(22));
var _plugins = __webpack_require__(21);
var _pluginHooks = _interopRequireDefault(__webpack_require__(46));
var _keyStateObserver = __webpack_require__(151);
var _columnStatesManager = __webpack_require__(533);
var _utils = __webpack_require__(185);
var _domHelpers = __webpack_require__(534);
var _rowsMapper = _interopRequireDefault(__webpack_require__(535));
var _rootComparator = __webpack_require__(536);
var _sortService = __webpack_require__(93);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var APPEND_COLUMN_CONFIG_STRATEGY = 'append';
var REPLACE_COLUMN_CONFIG_STRATEGY = 'replace';
var PLUGIN_KEY = 'columnSorting';
(0, _sortService.registerRootComparator)(PLUGIN_KEY, _rootComparator.rootComparator);
_pluginHooks.default.getSingleton().register('beforeColumnSort');
_pluginHooks.default.getSingleton().register('afterColumnSort'); // DIFF - MultiColumnSorting & ColumnSorting: changed configuration documentation.
/**
* @plugin ColumnSorting
*
* @description
* This plugin sorts the view by columns (but does not sort the data source!). To enable the plugin, set the
* {@link Options#columnSorting} property to the correct value (see the examples below).
*
* @example
* ```js
* // as boolean
* columnSorting: true
*
* // as an object with initial sort config (sort ascending for column at index 1)
* columnSorting: {
* initialConfig: {
* column: 1,
* sortOrder: 'asc'
* }
* }
*
* // as an object which define specific sorting options for all columns
* columnSorting: {
* sortEmptyCells: true, // true = the table sorts empty cells, false = the table moves all empty cells to the end of the table (by default)
* indicator: true, // true = shows indicator for all columns (by default), false = don't show indicator for columns
* headerAction: true, // true = allow to click on the headers to sort (by default), false = turn off possibility to click on the headers to sort
* compareFunctionFactory: function(sortOrder, columnMeta) {
* return function(value, nextValue) {
* // Some value comparisons which will return -1, 0 or 1...
* }
* }
* }
*
* // as an object passed to the `column` property, allows specifying a custom options for the desired column.
* // please take a look at documentation of `column` property: https://docs.handsontable.com/pro/Options.html#columns
* columns: [{
* columnSorting: {
* indicator: false, // disable indicator for the first column,
* sortEmptyCells: true,
* headerAction: false, // clicks on the first column won't sort
* compareFunctionFactory: function(sortOrder, columnMeta) {
* return function(value, nextValue) {
* return 0; // Custom compare function for the first column (don't sort)
* }
* }
* }
* }]```
*
* @dependencies ObserveChanges
*/
var ColumnSorting =
/*#__PURE__*/
function (_BasePlugin) {
(0, _inherits2.default)(ColumnSorting, _BasePlugin);
function ColumnSorting(hotInstance) {
var _this2;
(0, _classCallCheck2.default)(this, ColumnSorting);
_this2 = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ColumnSorting).call(this, hotInstance));
/**
* Instance of column state manager.
*
* @private
* @type {ColumnStatesManager}
*/
_this2.columnStatesManager = new _columnStatesManager.ColumnStatesManager();
/**
* Object containing visual row indexes mapped to data source indexes.
*
* @private
* @type {RowsMapper}
*/
_this2.rowsMapper = new _rowsMapper.default((0, _assertThisInitialized2.default)(_this2));
/**
* It blocks the plugin translation, this flag is checked inside `onModifyRow` callback.
*
* @private
* @type {Boolean}
*/
_this2.blockPluginTranslation = true;
/**
* Cached column properties from plugin like i.e. `indicator`, `headerAction`.
*
* @private
* @type {Map}
*/
_this2.columnMetaCache = new Map();
/**
* Main settings key designed for the plugin.
*
* @private
* @type {String}
*/
_this2.pluginKey = PLUGIN_KEY;
return _this2;
}
/**
* Checks if the plugin is enabled in the Handsontable settings. This method is executed in {@link Hooks#beforeInit}
* hook and if it returns `true` than the {@link ColumnSorting#enablePlugin} method is called.
*
* @returns {Boolean}
*/
(0, _createClass2.default)(ColumnSorting, [{
key: "isEnabled",
value: function isEnabled() {
return !!this.hot.getSettings()[this.pluginKey];
}
/**
* Enables the plugin functionality for this Handsontable instance.
*/
}, {
key: "enablePlugin",
value: function enablePlugin() {
var _this3 = this;
if (this.enabled) {
return;
}
if ((0, _mixed.isUndefined)(this.hot.getSettings().observeChanges)) {
this.enableObserveChangesPlugin();
}
this.addHook('afterTrimRow', function () {
return _this3.sortByPresetSortStates();
});
this.addHook('afterUntrimRow', function () {
return _this3.sortByPresetSortStates();
});
this.addHook('modifyRow', function (row, source) {
return _this3.onModifyRow(row, source);
});
this.addHook('unmodifyRow', function (row, source) {
return _this3.onUnmodifyRow(row, source);
});
this.addHook('afterGetColHeader', function (column, TH) {
return _this3.onAfterGetColHeader(column, TH);
});
this.addHook('beforeOnCellMouseDown', function (event, coords, TD, controller) {
return _this3.onBeforeOnCellMouseDown(event, coords, TD, controller);
});
this.addHook('afterOnCellMouseDown', function (event, target) {
return _this3.onAfterOnCellMouseDown(event, target);
});
this.addHook('afterCreateRow', function (index, amount) {
return _this3.onAfterCreateRow(index, amount);
});
this.addHook('afterRemoveRow', function (index, amount) {
return _this3.onAfterRemoveRow(index, amount);
});
this.addHook('afterInit', function () {
return _this3.loadOrSortBySettings();
});
this.addHook('afterLoadData', function (initialLoad) {
return _this3.onAfterLoadData(initialLoad);
});
this.addHook('afterCreateCol', function () {
return _this3.onAfterCreateCol();
});
this.addHook('afterRemoveCol', function () {
return _this3.onAfterRemoveCol();
}); // TODO: Workaround? It should be refactored / described.
if (this.hot.view) {
this.loadOrSortBySettings();
}
(0, _get2.default)((0, _getPrototypeOf2.default)(ColumnSorting.prototype), "enablePlugin", this).call(this);
}
/**
* Disables the plugin functionality for this Handsontable instance.
*/
}, {
key: "disablePlugin",
value: function disablePlugin() {
var _this4 = this;
var clearColHeader = function clearColHeader(column, TH) {
var headerSpanElement = (0, _utils.getHeaderSpanElement)(TH);
if ((0, _utils.isFirstLevelColumnHeader)(column, TH) === false || headerSpanElement === null) {
return;
}
_this4.updateHeaderClasses(headerSpanElement);
}; // Changing header width and removing indicator.
this.hot.addHook('afterGetColHeader', clearColHeader);
this.hot.addHookOnce('afterRender', function () {
_this4.hot.removeHook('afterGetColHeader', clearColHeader);
});
this.rowsMapper.clearMap();
(0, _get2.default)((0, _getPrototypeOf2.default)(ColumnSorting.prototype), "disablePlugin", this).call(this);
} // DIFF - MultiColumnSorting & ColumnSorting: changed function documentation.
/**
* Sorts the table by chosen columns and orders.
*
* @param {undefined|Object} sortConfig Single column sort configuration. The configuration object contains `column` and `sortOrder` properties.
* First of them contains visual column index, the second one contains sort order (`asc` for ascending, `desc` for descending).
*
* **Note**: Please keep in mind that every call of `sort` function set an entirely new sort order. Previous sort configs aren't preserved.
*
* @example
* ```js
* // sort ascending first visual column
* hot.getPlugin('columnSorting').sort({ column: 0, sortOrder: 'asc' });
* ```
*
* @fires Hooks#beforeColumnSort
* @fires Hooks#afterColumnSort
*/
}, {
key: "sort",
value: function sort(sortConfig) {
var _this5 = this;
var currentSortConfig = this.getSortConfig(); // We always pass configs defined as an array to `beforeColumnSort` and `afterColumnSort` hooks.
var destinationSortConfigs = this.getNormalizedSortConfigs(sortConfig);
var sortPossible = this.areValidSortConfigs(destinationSortConfigs);
var allowSort = this.hot.runHooks('beforeColumnSort', currentSortConfig, destinationSortConfigs, sortPossible);
if (allowSort === false) {
return;
}
if (sortPossible) {
var translateColumnToPhysical = function translateColumnToPhysical(_ref) {
var visualColumn = _ref.column,
restOfProperties = (0, _objectWithoutProperties2.default)(_ref, ["column"]);
return _objectSpread({
column: _this5.hot.toPhysicalColumn(visualColumn)
}, restOfProperties);
};
var internalSortStates = (0, _array.arrayMap)(destinationSortConfigs, function (columnSortConfig) {
return translateColumnToPhysical(columnSortConfig);
});
this.columnStatesManager.setSortStates(internalSortStates);
this.sortByPresetSortStates();
this.saveAllSortSettings();
this.hot.render();
this.hot.view.wt.draw(true); // TODO: Workaround? One test won't pass after removal. It should be refactored / described.
}
this.hot.runHooks('afterColumnSort', currentSortConfig, this.getSortConfig(), sortPossible);
}
/**
* Clear the sort performed on the table.
*/
}, {
key: "clearSort",
value: function clearSort() {
this.sort([]);
}
/**
* Checks if the table is sorted (any column have to be sorted).
*
* @returns {Boolean}
*/
}, {
key: "isSorted",
value: function isSorted() {
return this.enabled && !this.columnStatesManager.isListOfSortedColumnsEmpty();
}
/**
* Get sort configuration for particular column or for all sorted columns. Objects contain `column` and `sortOrder` properties.
*
* **Note**: Please keep in mind that returned objects expose **visual** column index under the `column` key. They are handled by the `sort` function.
*
* @param {Number} [column] Visual column index.
* @returns {undefined|Object|Array}
*/
}, {
key: "getSortConfig",
value: function getSortConfig(column) {
var _this6 = this;
var translateColumnToVisual = function translateColumnToVisual(_ref2) {
var physicalColumn = _ref2.column,
restOfProperties = (0, _objectWithoutProperties2.default)(_ref2, ["column"]);
return _objectSpread({
column: _this6.hot.toVisualColumn(physicalColumn)
}, restOfProperties);
};
if ((0, _mixed.isDefined)(column)) {
var physicalColumn = this.hot.toPhysicalColumn(column);
var columnSortState = this.columnStatesManager.getColumnSortState(physicalColumn);
if ((0, _mixed.isDefined)(columnSortState)) {
return translateColumnToVisual(columnSortState);
}
return;
}
var sortStates = this.columnStatesManager.getSortStates();
return (0, _array.arrayMap)(sortStates, function (columnState) {
return translateColumnToVisual(columnState);
});
}
/**
* @description
* Warn: Useful mainly for providing server side sort implementation (see in the example below). It doesn't sort the data set. It just sets sort configuration for all sorted columns.
* Note: Please keep in mind that this method doesn't re-render the table.
*
* @example
* ```js
* beforeColumnSort: function(currentSortConfig, destinationSortConfigs) {
* const columnSortPlugin = this.getPlugin('columnSorting');
*
* columnSortPlugin.setSortConfig(destinationSortConfigs);
*
* // const newData = ... // Calculated data set, ie. from an AJAX call.
*
* this.loadData(newData); // Load new data set and re-render the table.
*
* return false; // The blockade for the default sort action.
* }```
*
* @param {undefined|Object|Array} sortConfig Single column sort configuration or full sort configuration (for all sorted columns).
* The configuration object contains `column` and `sortOrder` properties. First of them contains visual column index, the second one contains
* sort order (`asc` for ascending, `desc` for descending).
*/
}, {
key: "setSortConfig",
value: function setSortConfig(sortConfig) {
var _this7 = this;
// We always set configs defined as an array.
var destinationSortConfigs = this.getNormalizedSortConfigs(sortConfig);
if (this.areValidSortConfigs(destinationSortConfigs)) {
var translateColumnToPhysical = function translateColumnToPhysical(_ref3) {
var visualColumn = _ref3.column,
restOfProperties = (0, _objectWithoutProperties2.default)(_ref3, ["column"]);
return _objectSpread({
column: _this7.hot.toPhysicalColumn(visualColumn)
}, restOfProperties);
};
var internalSortStates = (0, _array.arrayMap)(destinationSortConfigs, function (columnSortConfig) {
return translateColumnToPhysical(columnSortConfig);
});
this.columnStatesManager.setSortStates(internalSortStates);
}
}
/**
* Get normalized sort configs.
*
* @private
* @param {Object|Array} [sortConfig=[]] Single column sort configuration or full sort configuration (for all sorted columns).
* The configuration object contains `column` and `sortOrder` properties. First of them contains visual column index, the second one contains
* sort order (`asc` for ascending, `desc` for descending).
* @returns {Array}
*/
}, {
key: "getNormalizedSortConfigs",
value: function getNormalizedSortConfigs() {
var sortConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
if (Array.isArray(sortConfig)) {
return sortConfig.slice(0, 1);
}
return [sortConfig].slice(0, 1);
}
/**
* Get if sort configs are valid.
*
* @private
* @param {Array} sortConfigs Sort configuration for all sorted columns. Objects contain `column` and `sortOrder` properties.
* @returns {Boolean}
*/
}, {
key: "areValidSortConfigs",
value: function areValidSortConfigs(sortConfigs) {
if (Array.isArray(sortConfigs) === false) {
return false;
}
var sortedColumns = sortConfigs.map(function (_ref4) {
var column = _ref4.column;
return column;
});
var numberOfColumns = this.hot.countCols();
var onlyExistingVisualIndexes = sortedColumns.every(function (visualColumn) {
return visualColumn <= numberOfColumns && visualColumn >= 0;
});
return (0, _utils.areValidSortStates)(sortConfigs) && onlyExistingVisualIndexes; // We don't translate visual indexes to physical indexes.
}
/**
* Saves all sorting settings. Saving works only when {@link Options#persistentState} option is enabled.
*
* @private
* @fires Hooks#persistentStateSave
*/
}, {
key: "saveAllSortSettings",
value: function saveAllSortSettings() {
var allSortSettings = this.columnStatesManager.getAllColumnsProperties();
allSortSettings.initialConfig = this.columnStatesManager.getSortStates();
this.hot.runHooks('persistentStateSave', 'columnSorting', allSortSettings);
}
/**
* Get all saved sorting settings. Loading works only when {@link Options#persistentState} option is enabled.
*
* @private
* @returns {Object} Previously saved sort settings.
*
* @fires Hooks#persistentStateLoad
*/
}, {
key: "getAllSavedSortSettings",
value: function getAllSavedSortSettings() {
var _this8 = this;
var storedAllSortSettings = {};
this.hot.runHooks('persistentStateLoad', 'columnSorting', storedAllSortSettings);
var allSortSettings = storedAllSortSettings.value;
var translateColumnToVisual = function translateColumnToVisual(_ref5) {
var physicalColumn = _ref5.column,
restOfProperties = (0, _objectWithoutProperties2.default)(_ref5, ["column"]);
return _objectSpread({
column: _this8.hot.toVisualColumn(physicalColumn)
}, restOfProperties);
};
if ((0, _mixed.isDefined)(allSortSettings) && Array.isArray(allSortSettings.initialConfig)) {
allSortSettings.initialConfig = (0, _array.arrayMap)(allSortSettings.initialConfig, translateColumnToVisual);
}
return allSortSettings;
}
/**
* Get next sort configuration for particular column. Object contain `column` and `sortOrder` properties.
*
* **Note**: Please keep in mind that returned object expose **visual** column index under the `column` key.
*
* @private
* @param {Number} column Visual column index.
* @returns {undefined|Object}
*/
}, {
key: "getColumnNextConfig",
value: function getColumnNextConfig(column) {
var physicalColumn = this.hot.toPhysicalColumn(column);
if (this.columnStatesManager.isColumnSorted(physicalColumn)) {
var columnSortConfig = this.getSortConfig(column);
var sortOrder = (0, _utils.getNextSortOrder)(columnSortConfig.sortOrder);
if ((0, _mixed.isDefined)(sortOrder)) {
columnSortConfig.sortOrder = sortOrder;
return columnSortConfig;
}
return;
}
var nrOfColumns = this.hot.countCols();
if (Number.isInteger(column) && column >= 0 && column < nrOfColumns) {
return {
column: column,
sortOrder: (0, _utils.getNextSortOrder)()
};
}
}
/**
* Get sort configuration with "next order" for particular column.
*
* @private
* @param {Number} columnToChange Visual column index of column which order will be changed.
* @param {String} strategyId ID of strategy. Possible values: 'append' and 'replace'. The first one
* change order of particular column and change it's position in the sort queue to the last one. The second one
* just change order of particular column.
*
* **Note**: Please keep in mind that returned objects expose **visual** column index under the `column` key.
*
* @returns {Array}
*/
}, {
key: "getNextSortConfig",
value: function getNextSortConfig(columnToChange) {
var strategyId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : APPEND_COLUMN_CONFIG_STRATEGY;
var physicalColumn = this.hot.toPhysicalColumn(columnToChange);
var indexOfColumnToChange = this.columnStatesManager.getIndexOfColumnInSortQueue(physicalColumn);
var isColumnSorted = this.columnStatesManager.isColumnSorted(physicalColumn);
var currentSortConfig = this.getSortConfig();
var nextColumnConfig = this.getColumnNextConfig(columnToChange);
if (isColumnSorted) {
if ((0, _mixed.isUndefined)(nextColumnConfig)) {
return [].concat((0, _toConsumableArray2.default)(currentSortConfig.slice(0, indexOfColumnToChange)), (0, _toConsumableArray2.default)(currentSortConfig.slice(indexOfColumnToChange + 1)));
}
if (strategyId === APPEND_COLUMN_CONFIG_STRATEGY) {
return [].concat((0, _toConsumableArray2.default)(currentSortConfig.slice(0, indexOfColumnToChange)), (0, _toConsumableArray2.default)(currentSortConfig.slice(indexOfColumnToChange + 1)), [nextColumnConfig]);
} else if (strategyId === REPLACE_COLUMN_CONFIG_STRATEGY) {
return [].concat((0, _toConsumableArray2.default)(currentSortConfig.slice(0, indexOfColumnToChange)), [nextColumnConfig], (0, _toConsumableArray2.default)(currentSortConfig.slice(indexOfColumnToChange + 1)));
}
}
if ((0, _mixed.isDefined)(nextColumnConfig)) {
return currentSortConfig.concat(nextColumnConfig);
}
return currentSortConfig;
}
/**
* Saves to cache part of plugins related properties, properly merged from cascade settings.
*
* @private
* @param {Number} column Visual column index.
* @returns {Object}
*/
// TODO: Workaround. Inheriting of non-primitive cell meta values doesn't work. Using this function we don't count
// merged properties few times.
}, {
key: "setMergedPluginSettings",
value: function setMergedPluginSettings(column) {
var physicalColumnIndex = this.hot.toPhysicalColumn(column);
var pluginMainSettings = this.hot.getSettings()[this.pluginKey];
var storedColumnProperties = this.columnStatesManager.getAllColumnsProperties();
var cellMeta = this.hot.getCellMeta(0, column);
var columnMeta = Object.getPrototypeOf(cellMeta);
var columnMetaHasPluginSettings = Object.hasOwnProperty.call(columnMeta, this.pluginKey);
var pluginColumnConfig = columnMetaHasPluginSettings ? columnMeta[this.pluginKey] : {};
this.columnMetaCache.set(physicalColumnIndex, Object.assign(storedColumnProperties, pluginMainSettings, pluginColumnConfig));
}
/**
* Get copy of settings for first cell in the column.
*
* @private
* @param {Number} column Visual column index.
* @returns {Object}
*/
// TODO: Workaround. Inheriting of non-primitive cell meta values doesn't work. Instead of getting properties from
// column meta we call this function.
}, {
key: "getFirstCellSettings",
value: function getFirstCellSettings(column) {
// TODO: Remove test named: "should not break the dataset when inserted new row" (#5431).
var actualBlockTranslationFlag = this.blockPluginTranslation;
this.blockPluginTranslation = true;
if (this.columnMetaCache.size === 0 || this.columnMetaCache.size < this.hot.countCols()) {
this.rebuildColumnMetaCache();
}
var cellMeta = this.hot.getCellMeta(0, column);
this.blockPluginTranslation = actualBlockTranslationFlag;
var cellMetaCopy = Object.create(cellMeta);
cellMetaCopy[this.pluginKey] = this.columnMetaCache.get(this.hot.toPhysicalColumn(column));
return cellMetaCopy;
}
/**
* Rebuild the column meta cache for all the columns.
*
* @private
*/
}, {
key: "rebuildColumnMetaCache",
value: function rebuildColumnMetaCache() {
var _this9 = this;
var numberOfColumns = this.hot.countCols();
if (numberOfColumns === 0) {
this.columnMetaCache.clear();
} else {
(0, _number.rangeEach)(numberOfColumns - 1, function (visualColumnIndex) {
return _this9.setMergedPluginSettings(visualColumnIndex);
});
}
}
/**
* Get number of rows which should be sorted.
*
* @private
* @param {Number} numberOfRows Total number of displayed rows.
* @returns {Number}
*/
}, {
key: "getNumberOfRowsToSort",
value: function getNumberOfRowsToSort(numberOfRows) {
var settings = this.hot.getSettings(); // `maxRows` option doesn't take into account `minSpareRows` option in this case.
if (settings.maxRows <= numberOfRows) {
return settings.maxRows;
}
return numberOfRows - settings.minSpareRows;
}
/**
* Performs the sorting using a stable sort function basing on internal state of sorting.
*
* @private
*/
}, {
key: "sortByPresetSortStates",
value: function sortByPresetSortStates() {
var _this10 = this;
if (this.columnStatesManager.isListOfSortedColumnsEmpty()) {
this.rowsMapper.clearMap();
return;
}
var indexesWithData = [];
var sortedColumnsList = this.columnStatesManager.getSortedColumns();
var numberOfRows = this.hot.countRows(); // Function `getDataAtCell` won't call the indices translation inside `onModifyRow` callback - we check the `blockPluginTranslation`
// flag inside it (we just want to get data not already modified by `columnSorting` plugin translation).
this.blockPluginTranslation = true;
var getDataForSortedColumns = function getDataForSortedColumns(visualRowIndex) {
return (0, _array.arrayMap)(sortedColumnsList, function (physicalColumn) {
return _this10.hot.getDataAtCell(visualRowIndex, _this10.hot.toVisualColumn(physicalColumn));
});
};
for (var visualRowIndex = 0; visualRowIndex < this.getNumberOfRowsToSort(numberOfRows); visualRowIndex += 1) {
indexesWithData.push([visualRowIndex].concat(getDataForSortedColumns(visualRowIndex)));
}
(0, _sortService.sort)(indexesWithData, this.pluginKey, (0, _array.arrayMap)(sortedColumnsList, function (physicalColumn) {
return _this10.columnStatesManager.getSortOrderOfColumn(physicalColumn);
}), (0, _array.arrayMap)(sortedColumnsList, function (physicalColumn) {
return _this10.getFirstCellSettings(_this10.hot.toVisualColumn(physicalColumn));
})); // Append spareRows
for (var _visualRowIndex = indexesWithData.length; _visualRowIndex < numberOfRows; _visualRowIndex += 1) {
indexesWithData.push([_visualRowIndex].concat(getDataForSortedColumns(_visualRowIndex)));
} // The blockade of the indices translation is released.
this.blockPluginTranslation = false; // Save all indexes to arrayMapper, a completely new sequence is set by the plugin
this.rowsMapper._arrayMap = (0, _array.arrayMap)(indexesWithData, function (indexWithData) {
return indexWithData[0];
});
}
/**
* Load saved settings or sort by predefined plugin configuration.
*
* @private
*/
}, {
key: "loadOrSortBySettings",
value: function loadOrSortBySettings() {
this.columnMetaCache.clear();
var storedAllSortSettings = this.getAllSavedSortSettings();
if ((0, _object.isObject)(storedAllSortSettings)) {
this.sortBySettings(storedAllSortSettings);
} else {
var allSortSettings = this.hot.getSettings()[this.pluginKey];
this.sortBySettings(allSortSettings);
}
}
/**
* Sort the table by provided configuration.
*
* @private
* @param {Object} allSortSettings All sort config settings. Object may contain `initialConfig`, `indicator`,
* `sortEmptyCells`, `headerAction` and `compareFunctionFactory` properties.
*/
}, {
key: "sortBySettings",
value: function sortBySettings(allSortSettings) {
if ((0, _object.isObject)(allSortSettings)) {
this.columnStatesManager.updateAllColumnsProperties(allSortSettings);
var initialConfig = allSortSettings.initialConfig;
if (Array.isArray(initialConfig) || (0, _object.isObject)(initialConfig)) {
this.sort(initialConfig);
}
} else {
// Extra render for headers. Their width may change.
this.hot.render();
}
}
/**
* Enables the ObserveChanges plugin.
*
* @private
*/
}, {
key: "enableObserveChangesPlugin",
value: function enableObserveChangesPlugin() {
var _this = this;
this.hot._registerTimeout(setTimeout(function () {
_this.hot.updateSettings({
observeChanges: true
});
}, 0));
}
/**
* Callback for `modifyRow` hook. Translates visual row index to the sorted row index.
*
* @private
* @param {Number} row Visual row index.
* @returns {Number} Physical row index.
*/
}, {
key: "onModifyRow",
value: function onModifyRow(row, source) {
if (this.blockPluginTranslation === false && source !== this.pluginName && this.isSorted()) {
var rowInMapper = this.rowsMapper.getValueByIndex(row);
row = rowInMapper === null ? row : rowInMapper;
}
return row;
}
/**
* Callback for `unmodifyRow` hook. Translates sorted row index to visual row index.
*
* @private
* @param {Number} row Physical row index.
* @returns {Number} Visual row index.
*/
}, {
key: "onUnmodifyRow",
value: function onUnmodifyRow(row, source) {
if (this.blockPluginTranslation === false && source !== this.pluginName && this.isSorted()) {
row = this.rowsMapper.getIndexByValue(row);
}
return row;
}
/**
* Callback for the `onAfterGetColHeader` hook. Adds column sorting CSS classes.
*
* @private
* @param {Number} column Visual column index.
* @param {Element} TH TH HTML element.
*/
}, {
key: "onAfterGetColHeader",
value: function onAfterGetColHeader(column, TH) {
var headerSpanElement = (0, _utils.getHeaderSpanElement)(TH);
if ((0, _utils.isFirstLevelColumnHeader)(column, TH) === false || headerSpanElement === null) {
return;
}
var physicalColumn = this.hot.toPhysicalColumn(column);
var pluginSettingsForColumn = this.getFirstCellSettings(column)[this.pluginKey];
var showSortIndicator = pluginSettingsForColumn.indicator;
var headerActionEnabled = pluginSettingsForColumn.headerAction;
this.updateHeaderClasses(headerSpanElement, this.columnStatesManager, physicalColumn, showSortIndicator, headerActionEnabled);
}
/**
* Update header classes.
*
* @private
* @param {HTMLElement} headerSpanElement Header span element.
* @param {...*} args Extra arguments for helpers.
*/
}, {
key: "updateHeaderClasses",
value: function updateHeaderClasses(headerSpanElement) {
(0, _element.removeClass)(headerSpanElement, (0, _domHelpers.getClassedToRemove)(headerSpanElement));
if (this.enabled !== false) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
(0, _element.addClass)(headerSpanElement, _domHelpers.getClassesToAdd.apply(void 0, args));
}
}
/**
* Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
* for `updateSettings` in specific situations.
*
* @private
* @param {Object} newSettings New settings object.
*/
}, {
key: "onUpdateSettings",
value: function onUpdateSettings(newSettings) {
(0, _get2.default)((0, _getPrototypeOf2.default)(ColumnSorting.prototype), "onUpdateSettings", this).call(this);
this.columnMetaCache.clear();
if ((0, _mixed.isDefined)(newSettings[this.pluginKey])) {
this.sortBySettings(newSettings[this.pluginKey]);
}
}
/**
* Callback for the `afterLoadData` hook.
*
* @private
* @param {Boolean} initialLoad flag that determines whether the data has been loaded during the initialization.
*/
}, {
key: "onAfterLoadData",
value: function onAfterLoadData(initialLoad) {
this.rowsMapper.clearMap();
this.columnMetaCache.clear();
if (initialLoad === true) {
// TODO: Workaround? It should be refactored / described.
if (this.hot.view) {
this.loadOrSortBySettings();
}
}
}
/**
* Callback for the `afterCreateRow` hook.
*
* @private
* @param {Number} index Visual index of the created row.
* @param {Number} amount Amount of created rows.
*/
}, {
key: "onAfterCreateRow",
value: function onAfterCreateRow(index, amount) {
this.rowsMapper.shiftItems(index, amount);
}
/**
* Callback for the `afterRemoveRow` hook.
*
* @private
* @param {Number} index Visual index of the removed row.
* @param {Number} amount Amount of removed rows.
*/
}, {
key: "onAfterRemoveRow",
value: function onAfterRemoveRow(index, amount) {
this.rowsMapper.unshiftItems(index, amount);
} // TODO: Workaround. Inheriting of non-primitive cell meta values doesn't work. We clear the cache after action which reorganize sequence of columns.
// TODO: Remove test named: "should add new columns properly when the `columnSorting` plugin is enabled (inheriting of non-primitive cell meta values)".
/**
* Callback for the `afterCreateCol` hook.
*
* @private
*/
}, {
key: "onAfterCreateCol",
value: function onAfterCreateCol() {
this.columnMetaCache.clear();
} // TODO: Workaround. Inheriting of non-primitive cell meta values doesn't work. We clear the cache after action which reorganize sequence of columns.
// TODO: Remove test named: "should add new columns properly when the `columnSorting` plugin is enabled (inheriting of non-primitive cell meta values)".
/**
* Callback for the `afterRemoveCol` hook.
*
* @private
*/
}, {
key: "onAfterRemoveCol",
value: function onAfterRemoveCol() {
this.columnMetaCache.clear();
}
/**
* Indicates if clickable header was clicked.
*
* @private
* @param {MouseEvent} event The `mousedown` event.
* @param {Number} column Visual column index.
* @returns {Boolean}
*/
}, {
key: "wasClickableHeaderClicked",
value: function wasClickableHeaderClicked(event, column) {
var pluginSettingsForColumn = this.getFirstCellSettings(column)[this.pluginKey];
var headerActionEnabled = pluginSettingsForColumn.headerAction;
return headerActionEnabled && event.realTarget.nodeName === 'SPAN';
}
/**
* Changes the behavior of selection / dragging.
*
* @private
* @param {MouseEvent} event The `mousedown` event.
* @param {CellCoords} coords Visual coordinates.
* @param {HTMLElement} TD
* @param {Object} blockCalculations
*/
}, {
key: "onBeforeOnCellMouseDown",
value: function onBeforeOnCellMouseDown(event, coords, TD, blockCalculations) {
if ((0, _utils.wasHeaderClickedProperly)(coords.row, coords.col, event) === false) {
return;
}
if (this.wasClickableHeaderClicked(event, coords.col) && (0, _keyStateObserver.isPressedCtrlKey)()) {
blockCalculations.column = true;
}
}
/**
* Callback for the `onAfterOnCellMouseDown` hook.
*
* @private
* @param {Event} event Event which are provided by hook.
* @param {CellCoords} coords Visual coords of the selected cell.
*/
}, {
key: "onAfterOnCellMouseDown",
value: function onAfterOnCellMouseDown(event, coords) {
if ((0, _utils.wasHeaderClickedProperly)(coords.row, coords.col, event) === false) {
return;
}
if (this.wasClickableHeaderClicked(event, coords.col)) {
if ((0, _keyStateObserver.isPressedCtrlKey)()) {
this.hot.deselectCell();
this.hot.selectColumns(coords.col);
}
this.sort(this.getColumnNextConfig(coords.col));
}
}
/**
* Destroys the plugin instance.
*/
}, {
key: "destroy",
value: function destroy() {
this.rowsMapper.destroy();
this.columnStatesManager.destroy();
(0, _get2.default)((0, _getPrototypeOf2.default)(ColumnSorting.prototype), "destroy", this).call(this);
}
}]);
return ColumnSorting;
}(_base.default);
(0, _plugins.registerPlugin)(PLUGIN_KEY, ColumnSorting);
var _default = ColumnSorting;
exports.default = _default;
/***/ }),
/* 396 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(20);
var assign = __webpack_require__(530);
// `Object.assign` method
// https://tc39.github.io/ecma262/#sec-object.assign
$({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
assign: assign
});
/***/ }),
/* 397 */
/***/ (function(module, exports, __webpack_require__) {
var arrayWithHoles = __webpack_require__(229);
var iterableToArray = __webpack_require__(217);
var nonIterableRest = __webpack_require__(230);
function _toArray(arr) {
return arrayWithHoles(arr) || iterableToArray(arr) || nonIterableRest();
}
module.exports = _toArray;
/***/ }),
/* 398 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.getCompareFunctionFactory = getCompareFunctionFactory;
exports.getRootComparator = exports.registerRootComparator = void 0;
var _default = __webpack_require__(537);
var _numeric = __webpack_require__(538);
var _date = __webpack_require__(539);
var _staticRegister3 = _interopRequireDefault(__webpack_require__(83));
var _staticRegister = (0, _staticRegister3.default)('sorting.compareFunctionFactory'),
registerCompareFunctionFactory = _staticRegister.register,
getGloballyCompareFunctionFactory = _staticRegister.getItem,
hasGloballyCompareFunctionFactory = _staticRegister.hasItem;
var _staticRegister2 = (0, _staticRegister3.default)('sorting.mainSortComparator'),
registerRootComparator = _staticRegister2.register,
getRootComparator = _staticRegister2.getItem;
/**
* Gets sort function for the particular column basing on it's data type.
*
* @param {String} dataType Data type for the particular column.
* @returns {Function}
*/
exports.getRootComparator = getRootComparator;
exports.registerRootComparator = registerRootComparator;
function getCompareFunctionFactory(type) {
if (hasGloballyCompareFunctionFactory(type)) {
return getGloballyCompareFunctionFactory(type);
}
return getGloballyCompareFunctionFactory(_default.COLUMN_DATA_TYPE);
}
registerCompareFunctionFactory(_numeric.COLUMN_DATA_TYPE, _numeric.compareFunctionFactory);
registerCompareFunctionFactory(_date.COLUMN_DATA_TYPE, _date.compareFunctionFactory);
registerCompareFunctionFactory(_default.COLUMN_DATA_TYPE, _default.compareFunctionFactory);
/***/ }),
/* 399 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(54);
__webpack_require__(23);
__webpack_require__(52);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _array = __webpack_require__(4);
var _object = __webpack_require__(3);
/**
* Command executor for ContextMenu.
*
* @class CommandExecutor
* @plugin ContextMenu
*/
var CommandExecutor =
/*#__PURE__*/
function () {
function CommandExecutor(hotInstance) {
(0, _classCallCheck2.default)(this, CommandExecutor);
this.hot = hotInstance;
this.commands = {};
this.commonCallback = null;
}
/**
* Register command.
*
* @param {String} name Command name.
* @param {Object} commandDescriptor Command descriptor object with properties like `key` (command id),
* `callback` (task to execute), `name` (command name), `disabled` (command availability).
*/
(0, _createClass2.default)(CommandExecutor, [{
key: "registerCommand",
value: function registerCommand(name, commandDescriptor) {
this.commands[name] = commandDescriptor;
}
/**
* Set common callback which will be trigger on every executed command.
*
* @param {Function} callback Function which will be fired on every command execute.
*/
}, {
key: "setCommonCallback",
value: function setCommonCallback(callback) {
this.commonCallback = callback;
}
/**
* Execute command by its name.
*
* @param {String} commandName Command id.
* @param {*} params Arguments passed to command task.
*/
}, {
key: "execute",
value: function execute(commandName) {
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];
}
var commandSplit = commandName.split(':');
var commandNamePrimary = commandSplit[0];
var subCommandName = commandSplit.length === 2 ? commandSplit[1] : null;
var command = this.commands[commandNamePrimary];
if (!command) {
throw new Error("Menu command '".concat(commandNamePrimary, "' not exists."));
}
if (subCommandName && command.submenu) {
command = findSubCommand(subCommandName, command.submenu.items);
}
if (command.disabled === true) {
return;
}
if (typeof command.disabled === 'function' && command.disabled.call(this.hot) === true) {
return;
}
if ((0, _object.hasOwnProperty)(command, 'submenu')) {
return;
}
var callbacks = [];
if (typeof command.callback === 'function') {
callbacks.push(command.callback);
}
if (typeof this.commonCallback === 'function') {
callbacks.push(this.commonCallback);
}
params.unshift(commandSplit.join(':'));
(0, _array.arrayEach)(callbacks, function (callback) {
return callback.apply(_this.hot, params);
});
}
}]);
return CommandExecutor;
}();
function findSubCommand(subCommandName, subCommands) {
var command;
(0, _array.arrayEach)(subCommands, function (cmd) {
var cmds = cmd.key ? cmd.key.split(':') : null;
if (Array.isArray(cmds) && cmds[1] === subCommandName) {
command = cmd;
return false;
}
});
return command;
}
var _default = CommandExecutor;
exports.default = _default;
/***/ }),
/* 400 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(12);
__webpack_require__(56);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _object = __webpack_require__(3);
var _array = __webpack_require__(4);
var _predefinedItems = __webpack_require__(89);
/**
* Predefined items class factory for menu items.
*
* @class ItemsFactory
* @plugin ContextMenu
*/
var ItemsFactory =
/*#__PURE__*/
function () {
function ItemsFactory(hotInstance) {
var orderPattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
(0, _classCallCheck2.default)(this, ItemsFactory);
this.hot = hotInstance;
this.predefinedItems = (0, _predefinedItems.predefinedItems)();
this.defaultOrderPattern = orderPattern;
}
/**
* Set predefined items.
*
* @param {Array} predefinedItemsCollection Array of predefined items.
*/
(0, _createClass2.default)(ItemsFactory, [{
key: "setPredefinedItems",
value: function setPredefinedItems(predefinedItemsCollection) {
var _this = this;
var items = {};
this.defaultOrderPattern.length = 0;
(0, _object.objectEach)(predefinedItemsCollection, function (value, key) {
var menuItemKey = '';
if (value.name === _predefinedItems.SEPARATOR) {
items[_predefinedItems.SEPARATOR] = value;
menuItemKey = _predefinedItems.SEPARATOR; // Menu item added as a property to array
} else if (isNaN(parseInt(key, 10))) {
value.key = value.key === void 0 ? key : value.key;
items[key] = value;
menuItemKey = value.key;
} else {
items[value.key] = value;
menuItemKey = value.key;
}
_this.defaultOrderPattern.push(menuItemKey);
});
this.predefinedItems = items;
}
/**
* Get all menu items based on pattern.
*
* @param {Array|Object|Boolean} pattern Pattern which you can define by displaying menu items order. If `true` default
* pattern will be used.
* @returns {Array}
*/
}, {
key: "getItems",
value: function getItems() {
var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
return _getItems(pattern, this.defaultOrderPattern, this.predefinedItems);
}
}]);
return ItemsFactory;
}();
function _getItems() {
var itemsPattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var defaultPattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var items = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var result = [];
var pattern = itemsPattern;
if (pattern && pattern.items) {
pattern = pattern.items;
} else if (!Array.isArray(pattern)) {
pattern = defaultPattern;
}
if ((0, _object.isObject)(pattern)) {
(0, _object.objectEach)(pattern, function (value, key) {
var item = items[typeof value === 'string' ? value : key];
if (!item) {
item = value;
}
if ((0, _object.isObject)(value)) {
(0, _object.extend)(item, value);
} else if (typeof item === 'string') {
item = {
name: item
};
}
if (item.key === void 0) {
item.key = key;
}
result.push(item);
});
} else {
(0, _array.arrayEach)(pattern, function (name, key) {
var item = items[name]; // Item deleted from settings `allowInsertRow: false` etc.
if (!item && _predefinedItems.ITEMS.indexOf(name) >= 0) {
return;
}
if (!item) {
item = {
name: name,
key: "".concat(key)
};
}
if ((0, _object.isObject)(name)) {
(0, _object.extend)(item, name);
}
if (item.key === void 0) {
item.key = key;
}
result.push(item);
});
}
return result;
}
var _default = ItemsFactory;
exports.default = _default;
/***/ }),
/* 401 */
/***/ (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 _number = __webpack_require__(17);
var STATE_INITIALIZED = 0;
var STATE_BUILT = 1;
var STATE_APPENDED = 2;
var UNIT = 'px';
/**
* @class
* @private
*/
var BaseUI =
/*#__PURE__*/
function () {
function BaseUI(hotInstance) {
(0, _classCallCheck2.default)(this, BaseUI);
/**
* Instance of Handsontable.
*
* @type {Core}
*/
this.hot = hotInstance;
/**
* DOM element representing the ui element.
*
* @type {HTMLElement}
* @private
*/
this._element = null;
/**
* Flag which determines build state of element.
*
* @type {Boolean}
*/
this.state = STATE_INITIALIZED;
}
/**
* Add created UI elements to table.
*
* @param {HTMLElement} wrapper Element which are parent for our UI element.
*/
(0, _createClass2.default)(BaseUI, [{
key: "appendTo",
value: function appendTo(wrapper) {
wrapper.appendChild(this._element);
this.state = STATE_APPENDED;
}
/**
* Method for create UI element. Only create, without append to table.
*/
}, {
key: "build",
value: function build() {
this._element = this.hot.rootDocument.createElement('div');
this.state = STATE_BUILT;
}
/**
* Method for remove UI element.
*/
}, {
key: "destroy",
value: function destroy() {
if (this.isAppended()) {
this._element.parentElement.removeChild(this._element);
}
this._element = null;
this.state = STATE_INITIALIZED;
}
/**
* Check if UI element are appended.
*
* @returns {Boolean}
*/
}, {
key: "isAppended",
value: function isAppended() {
return this.state === STATE_APPENDED;
}
/**
* Check if UI element are built.
*
* @returns {Boolean}
*/
}, {
key: "isBuilt",
value: function isBuilt() {
return this.state >= STATE_BUILT;
}
/**
* Setter for position.
*
* @param {Number} top New top position of the element.
* @param {Number} left New left position of the element.
*/
}, {
key: "setPosition",
value: function setPosition(top, left) {
if ((0, _number.isNumeric)(top)) {
this._element.style.top = top + UNIT;
}
if ((0, _number.isNumeric)(left)) {
this._element.style.left = left + UNIT;
}
}
/**
* Getter for the element position.
*
* @returns {Object} Object contains left and top position of the element.
*/
}, {
key: "getPosition",
value: function getPosition() {
return {
top: this._element.style.top ? parseInt(this._element.style.top, 10) : 0,
left: this._element.style.left ? parseInt(this._element.style.left, 10) : 0
};
}
/**
* Setter for the element size.
*
* @param {Number} width New width of the element.
* @param {Number} height New height of the element.
*/
}, {
key: "setSize",
value: function setSize(width, height) {
if ((0, _number.isNumeric)(width)) {
this._element.style.width = width + UNIT;
}
if ((0, _number.isNumeric)(height)) {
this._element.style.height = height + UNIT;
}
}
/**
* Getter for the element position.
*
* @returns {Object} Object contains height and width of the element.
*/
}, {
key: "getSize",
value: function getSize() {
return {
width: this._element.style.width ? parseInt(this._element.style.width, 10) : 0,
height: this._element.style.height ? parseInt(this._element.style.height, 10) : 0
};
}
/**
* Setter for the element offset. Offset means marginTop and marginLeft of the element.
*
* @param {Number} top New margin top of the element.
* @param {Number} left New margin left of the element.
*/
}, {
key: "setOffset",
value: function setOffset(top, left) {
if ((0, _number.isNumeric)(top)) {
this._element.style.marginTop = top + UNIT;
}
if ((0, _number.isNumeric)(left)) {
this._element.style.marginLeft = left + UNIT;
}
}
/**
* Getter for the element offset.
*
* @returns {Object} Object contains top and left offset of the element.
*/
}, {
key: "getOffset",
value: function getOffset() {
return {
top: this._element.style.marginTop ? parseInt(this._element.style.marginTop, 10) : 0,
left: this._element.style.marginLeft ? parseInt(this._element.style.marginLeft, 10) : 0
};
}
}]);
return BaseUI;
}();
var _default = BaseUI;
exports.default = _default;
/***/ }),
/* 402 */
/***/ (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 STATE_INITIALIZED = 0;
var STATE_BUILT = 1;
var STATE_APPENDED = 2;
var UNIT = 'px';
/**
* @class
* @private
*/
var BaseUI =
/*#__PURE__*/
function () {
function BaseUI(hotInstance) {
(0, _classCallCheck2.default)(this, BaseUI);
/**
* Instance of Handsontable.
*
* @type {Core}
*/
this.hot = hotInstance;
/**
* DOM element representing the ui element.
*
* @type {HTMLElement}
* @private
*/
this._element = null;
/**
* Flag which determines build state of element.
*
* @type {Boolean}
*/
this.state = STATE_INITIALIZED;
}
/**
* Add created UI elements to table.
*
* @param {HTMLElement} wrapper Element which are parent for our UI element.
*/
(0, _createClass2.default)(BaseUI, [{
key: "appendTo",
value: function appendTo(wrapper) {
wrapper.appendChild(this._element);
this.state = STATE_APPENDED;
}
/**
* Method for create UI element. Only create, without append to table.
*/
}, {
key: "build",
value: function build() {
this._element = this.hot.rootDocument.createElement('div');
this.state = STATE_BUILT;
}
/**
* Method for remove UI element.
*/
}, {
key: "destroy",
value: function destroy() {
if (this.isAppended()) {
this._element.parentElement.removeChild(this._element);
}
this._element = null;
this.state = STATE_INITIALIZED;
}
/**
* Check if UI element are appended.
*
* @returns {Boolean}
*/
}, {
key: "isAppended",
value: function isAppended() {
return this.state === STATE_APPENDED;
}
/**
* Check if UI element are built.
*
* @returns {Boolean}
*/
}, {
key: "isBuilt",
value: function isBuilt() {
return this.state >= STATE_BUILT;
}
/**
* Setter for position.
*
* @param {Number} top New top position of the element.
* @param {Number} left New left position of the element.
*/
}, {
key: "setPosition",
value: function setPosition(top, left) {
if (top !== void 0) {
this._element.style.top = top + UNIT;
}
if (left !== void 0) {
this._element.style.left = left + UNIT;
}
}
/**
* Getter for the element position.
*
* @returns {Object} Object contains left and top position of the element.
*/
}, {
key: "getPosition",
value: function getPosition() {
return {
top: this._element.style.top ? parseInt(this._element.style.top, 10) : 0,
left: this._element.style.left ? parseInt(this._element.style.left, 10) : 0
};
}
/**
* Setter for the element size.
*
* @param {Number} width New width of the element.
* @param {Number} height New height of the element.
*/
}, {
key: "setSize",
value: function setSize(width, height) {
if (width) {
this._element.style.width = width + UNIT;
}
if (height) {
this._element.style.height = height + UNIT;
}
}
/**
* Getter for the element position.
*
* @returns {Object} Object contains height and width of the element.
*/
}, {
key: "getSize",
value: function getSize() {
return {
width: this._element.style.width ? parseInt(this._element.style.width, 10) : 0,
height: this._element.style.height ? parseInt(this._element.style.height, 10) : 0
};
}
/**
* Setter for the element offset. Offset means marginTop and marginLeft of the element.
*
* @param {Number} top New margin top of the element.
* @param {Number} left New margin left of the element.
*/
}, {
key: "setOffset",
value: function setOffset(top, left) {
if (top) {
this._element.style.marginTop = top + UNIT;
}
if (left) {
this._element.style.marginLeft = left + UNIT;
}
}
/**
* Getter for the element offset.
*
* @returns {Object} Object contains top and left offset of the element.
*/
}, {
key: "getOffset",
value: function getOffset() {
return {
top: this._element.style.marginTop ? parseInt(this._element.style.marginTop, 10) : 0,
left: this._element.style.marginLeft ? parseInt(this._element.style.marginLeft, 10) : 0
};
}
}]);
return BaseUI;
}();
var _default = BaseUI;
exports.default = _default;
/***/ }),
/* 403 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(10);
__webpack_require__(38);
exports.__esModule = true;
exports.applySpanProperties = applySpanProperties;
/**
* Apply the `colspan`/`rowspan` properties.
*
* @param {HTMLElement} TD The soon-to-be-modified cell.
* @param {MergedCellCoords} merged cellInfo The merged cell in question.
* @param {Number} row Row index.
* @param {Number} col Column index.
*/
// eslint-disable-next-line import/prefer-default-export
function applySpanProperties(TD, mergedCellInfo, row, col) {
if (mergedCellInfo) {
if (mergedCellInfo.row === row && mergedCellInfo.col === col) {
TD.setAttribute('rowspan', mergedCellInfo.rowspan.toString());
TD.setAttribute('colspan', mergedCellInfo.colspan.toString());
} else {
TD.removeAttribute('rowspan');
TD.removeAttribute('colspan');
TD.style.display = 'none';
}
} else {
TD.removeAttribute('rowspan');
TD.removeAttribute('colspan');
TD.style.display = '';
}
}
/***/ }),
/* 404 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
exports.__esModule = true;
exports.condition = condition;
exports.CONDITION_NAME = void 0;
var C = _interopRequireWildcard(__webpack_require__(11));
var _conditionRegisterer = __webpack_require__(30);
var CONDITION_NAME = 'empty';
exports.CONDITION_NAME = CONDITION_NAME;
function condition(dataRow) {
return dataRow.value === '' || dataRow.value === null || dataRow.value === void 0;
}
(0, _conditionRegisterer.registerCondition)(CONDITION_NAME, condition, {
name: C.FILTERS_CONDITIONS_EMPTY,
inputsCount: 0,
showOperators: true
});
/***/ }),
/* 405 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.condition = condition;
exports.CONDITION_NAME = void 0;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18));
var C = _interopRequireWildcard(__webpack_require__(11));
var _mixed = __webpack_require__(29);
var _conditionRegisterer = __webpack_require__(30);
var CONDITION_NAME = 'eq';
exports.CONDITION_NAME = CONDITION_NAME;
function condition(dataRow, _ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 1),
value = _ref2[0];
return (0, _mixed.stringify)(dataRow.value).toLowerCase() === (0, _mixed.stringify)(value);
}
(0, _conditionRegisterer.registerCondition)(CONDITION_NAME, condition, {
name: C.FILTERS_CONDITIONS_EQUAL,
inputsCount: 1,
showOperators: true
});
/***/ }),
/* 406 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.condition = condition;
exports.CONDITION_NAME = void 0;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18));
var C = _interopRequireWildcard(__webpack_require__(11));
var _conditionRegisterer = __webpack_require__(30);
var _after = __webpack_require__(407);
var _before = __webpack_require__(408);
var CONDITION_NAME = 'between';
exports.CONDITION_NAME = CONDITION_NAME;
function condition(dataRow, _ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
from = _ref2[0],
to = _ref2[1];
var fromValue = from;
var toValue = to;
if (dataRow.meta.type === 'numeric') {
var _from = parseFloat(fromValue, 10);
var _to = parseFloat(toValue, 10);
fromValue = Math.min(_from, _to);
toValue = Math.max(_from, _to);
} else if (dataRow.meta.type === 'date') {
var dateBefore = (0, _conditionRegisterer.getCondition)(_before.CONDITION_NAME, [toValue]);
var dateAfter = (0, _conditionRegisterer.getCondition)(_after.CONDITION_NAME, [fromValue]);
return dateBefore(dataRow) && dateAfter(dataRow);
}
return dataRow.value >= fromValue && dataRow.value <= toValue;
}
(0, _conditionRegisterer.registerCondition)(CONDITION_NAME, condition, {
name: C.FILTERS_CONDITIONS_BETWEEN,
inputsCount: 2,
showOperators: true
});
/***/ }),
/* 407 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.condition = condition;
exports.CONDITION_NAME = void 0;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18));
var _moment = _interopRequireDefault(__webpack_require__(64));
var C = _interopRequireWildcard(__webpack_require__(11));
var _conditionRegisterer = __webpack_require__(30);
var CONDITION_NAME = 'date_after';
exports.CONDITION_NAME = CONDITION_NAME;
function condition(dataRow, _ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 1),
value = _ref2[0];
var date = (0, _moment.default)(dataRow.value, dataRow.meta.dateFormat);
var inputDate = (0, _moment.default)(value, dataRow.meta.dateFormat);
if (!date.isValid() || !inputDate.isValid()) {
return false;
}
return date.diff(inputDate) >= 0;
}
(0, _conditionRegisterer.registerCondition)(CONDITION_NAME, condition, {
name: C.FILTERS_CONDITIONS_AFTER,
inputsCount: 1,
showOperators: true
});
/***/ }),
/* 408 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.condition = condition;
exports.CONDITION_NAME = void 0;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18));
var _moment = _interopRequireDefault(__webpack_require__(64));
var C = _interopRequireWildcard(__webpack_require__(11));
var _conditionRegisterer = __webpack_require__(30);
var CONDITION_NAME = 'date_before';
exports.CONDITION_NAME = CONDITION_NAME;
function condition(dataRow, _ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 1),
value = _ref2[0];
var date = (0, _moment.default)(dataRow.value, dataRow.meta.dateFormat);
var inputDate = (0, _moment.default)(value, dataRow.meta.dateFormat);
if (!date.isValid() || !inputDate.isValid()) {
return false;
}
return date.diff(inputDate) <= 0;
}
(0, _conditionRegisterer.registerCondition)(CONDITION_NAME, condition, {
name: C.FILTERS_CONDITIONS_BEFORE,
inputsCount: 1,
showOperators: true
});
/***/ }),
/* 409 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(12);
exports.__esModule = true;
exports.condition = condition;
exports.CONDITION_NAME = void 0;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18));
var C = _interopRequireWildcard(__webpack_require__(11));
var _mixed = __webpack_require__(29);
var _conditionRegisterer = __webpack_require__(30);
var CONDITION_NAME = 'contains';
exports.CONDITION_NAME = CONDITION_NAME;
function condition(dataRow, _ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 1),
value = _ref2[0];
return (0, _mixed.stringify)(dataRow.value).toLowerCase().indexOf((0, _mixed.stringify)(value)) >= 0;
}
(0, _conditionRegisterer.registerCondition)(CONDITION_NAME, condition, {
name: C.FILTERS_CONDITIONS_CONTAINS,
inputsCount: 1,
showOperators: true
});
/***/ }),
/* 410 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
__webpack_require__(99);
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__(126);
var OPERATION_ID = 'disjunction';
exports.OPERATION_ID = OPERATION_ID;
var SHORT_NAME_FOR_COMPONENT = C.FILTERS_LABELS_DISJUNCTION; // (p OR q OR w OR x OR...) === TRUE?
exports.SHORT_NAME_FOR_COMPONENT = SHORT_NAME_FOR_COMPONENT;
function operationResult(conditions, value) {
return conditions.some(function (condition) {
return condition.func(value);
});
}
(0, _logicalOperationRegisterer.registerOperation)(OPERATION_ID, SHORT_NAME_FOR_COMPONENT, operationResult);
/***/ }),
/* 411 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
__webpack_require__(41);
__webpack_require__(99);
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__(126);
var OPERATION_ID = 'disjunctionWithExtraCondition';
exports.OPERATION_ID = OPERATION_ID;
var SHORT_NAME_FOR_COMPONENT = C.FILTERS_LABELS_DISJUNCTION; // ((p OR q OR w OR x OR...) AND z) === TRUE?
exports.SHORT_NAME_FOR_COMPONENT = SHORT_NAME_FOR_COMPONENT;
function operationResult(conditions, value) {
if (conditions.length < 3) {
throw Error('Operation doesn\'t work on less then three conditions.');
}
return conditions.slice(0, conditions.length - 1).some(function (condition) {
return condition.func(value);
}) && conditions[conditions.length - 1].func(value);
}
(0, _logicalOperationRegisterer.registerOperation)(OPERATION_ID, SHORT_NAME_FOR_COMPONENT, operationResult);
/***/ }),
/* 412 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(12);
__webpack_require__(33);
__webpack_require__(56);
exports.__esModule = true;
exports.default = void 0;
var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(72));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _array = __webpack_require__(4);
var _object = __webpack_require__(3);
var _templateLiteralTag = __webpack_require__(73);
var _localHooks = _interopRequireDefault(__webpack_require__(62));
var _conditionRegisterer = __webpack_require__(30);
var _conjunction = __webpack_require__(190);
var _logicalOperationRegisterer = __webpack_require__(126);
function _templateObject() {
var data = (0, _taggedTemplateLiteral2.default)(["The column of index ", " has been already applied with a `", "`\n filter operation. Use `removeConditions` to clear the current conditions and then add new ones.\n Mind that you cannot mix different types of operations (for instance, if you use `conjunction`,\n use it consequently for a particular column)."], ["The column of index ", " has been already applied with a \\`", "\\`\n filter operation. Use \\`removeConditions\\` to clear the current conditions and then add new ones.\n Mind that you cannot mix different types of operations (for instance, if you use \\`conjunction\\`,\n use it consequently for a particular column)."]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
/**
* @class ConditionCollection
* @plugin Filters
*/
var ConditionCollection =
/*#__PURE__*/
function () {
function ConditionCollection() {
(0, _classCallCheck2.default)(this, ConditionCollection);
/**
* Conditions collection grouped by operation type and then column index.
*
* @type {Object}
*/
this.conditions = this.initConditionsCollection();
/**
* Types of operations grouped by column index.
*
* @type {Object}
*/
this.columnTypes = {};
/**
* Order of added condition filters.
*
* @type {Array}
*/
this.orderStack = [];
}
/**
* Check if condition collection is empty (so no needed to filter data).
*
* @returns {Boolean}
*/
(0, _createClass2.default)(ConditionCollection, [{
key: "isEmpty",
value: function isEmpty() {
return !this.orderStack.length;
}
/**
* Check if value is matched to the criteria of conditions chain.
*
* @param {Object} value Object with `value` and `meta` keys.
* @param {Number} [column] Column index.
* @returns {Boolean}
*/
}, {
key: "isMatch",
value: function isMatch(value, column) {
var _this = this;
var result = true;
if (column === void 0) {
(0, _object.objectEach)(this.columnTypes, function (columnType, columnIndex) {
result = _this.isMatchInConditions(_this.conditions[columnType][columnIndex], value, columnType);
return result;
});
} else {
var columnType = this.columnTypes[column];
result = this.isMatchInConditions(this.getConditions(column), value, columnType);
}
return result;
}
/**
* Check if the value is matches the conditions.
*
* @param {Array} conditions List of conditions.
* @param {Object} value Object with `value` and `meta` keys.
* @param {String} [operationType='conjunction'] Type of conditions operation
* @returns {Boolean}
*/
}, {
key: "isMatchInConditions",
value: function isMatchInConditions(conditions, value) {
var operationType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _conjunction.OPERATION_ID;
var result = false;
if (conditions.length) {
result = (0, _logicalOperationRegisterer.getOperationFunc)(operationType)(conditions, value);
} else {
result = true;
}
return result;
}
/**
* Add condition to the collection.
*
* @param {Number} column Column index.
* @param {Object} conditionDefinition Object with keys:
* * `command` Object, Command object with condition name as `key` property.
* * `args` Array, Condition arguments.
* @param {String} [operation='conjunction'] Type of conditions operation
* @fires ConditionCollection#beforeAdd
* @fires ConditionCollection#afterAdd
*/
}, {
key: "addCondition",
value: function addCondition(column, conditionDefinition) {
var operation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _conjunction.OPERATION_ID;
var args = (0, _array.arrayMap)(conditionDefinition.args, function (v) {
return typeof v === 'string' ? v.toLowerCase() : v;
});
var name = conditionDefinition.name || conditionDefinition.command.key;
this.runLocalHooks('beforeAdd', column);
if (this.orderStack.indexOf(column) === -1) {
this.orderStack.push(column);
}
var columnType = this.columnTypes[column];
if (columnType) {
if (columnType !== operation) {
throw Error((0, _templateLiteralTag.toSingleLine)(_templateObject(), column, columnType));
}
} else {
if (!this.conditions[operation]) {
throw new Error("Unexpected operation named `".concat(operation, "`. Possible ones are `disjunction` and `conjunction`."));
}
this.columnTypes[column] = operation;
} // Add condition
this.getConditions(column).push({
name: name,
args: args,
func: (0, _conditionRegisterer.getCondition)(name, args)
});
this.runLocalHooks('afterAdd', column);
}
/**
* Get all added conditions from the collection at specified column index.
*
* @param {Number} column Column index.
* @returns {Array} Returns conditions collection as an array.
*/
}, {
key: "getConditions",
value: function getConditions(column) {
var columnType = this.columnTypes[column];
if (!columnType) {
return [];
}
if (!this.conditions[columnType][column]) {
this.conditions[columnType][column] = [];
}
return this.conditions[columnType][column];
}
/**
* Export all previously added conditions.
*
* @returns {Array}
*/
}, {
key: "exportAllConditions",
value: function exportAllConditions() {
var _this2 = this;
var result = [];
(0, _array.arrayEach)(this.orderStack, function (column) {
var conditions = (0, _array.arrayMap)(_this2.getConditions(column), function (_ref) {
var name = _ref.name,
args = _ref.args;
return {
name: name,
args: args
};
});
var operation = _this2.columnTypes[column];
result.push({
column: column,
operation: operation,
conditions: conditions
});
});
return result;
}
/**
* Import conditions to the collection.
*/
}, {
key: "importAllConditions",
value: function importAllConditions(conditions) {
var _this3 = this;
this.clean();
(0, _array.arrayEach)(conditions, function (stack) {
_this3.orderStack.push(stack.column);
(0, _array.arrayEach)(stack.conditions, function (condition) {
return _this3.addCondition(stack.column, condition);
});
});
}
/**
* Remove conditions at given column index.
*
* @param {Number} column Column index.
* @fires ConditionCollection#beforeRemove
* @fires ConditionCollection#afterRemove
*/
}, {
key: "removeConditions",
value: function removeConditions(column) {
this.runLocalHooks('beforeRemove', column);
if (this.orderStack.indexOf(column) >= 0) {
this.orderStack.splice(this.orderStack.indexOf(column), 1);
}
this.clearConditions(column);
this.runLocalHooks('afterRemove', column);
}
/**
* Clear conditions at specified column index but without clearing stack order.
*
* @param {Number }column Column index.
* @fires ConditionCollection#beforeClear
* @fires ConditionCollection#afterClear
*/
}, {
key: "clearConditions",
value: function clearConditions(column) {
this.runLocalHooks('beforeClear', column);
this.getConditions(column).length = 0;
delete this.columnTypes[column];
this.runLocalHooks('afterClear', column);
}
/**
* Check if at least one condition was added at specified column index. And if second parameter is passed then additionally
* check if condition exists under its name.
*
* @param {Number} column Column index.
* @param {String} [name] Condition name.
* @returns {Boolean}
*/
}, {
key: "hasConditions",
value: function hasConditions(column, name) {
var columnType = this.columnTypes[column];
var result = false;
if (!columnType) {
return false;
}
var conditions = this.getConditions(column);
if (name) {
result = (0, _array.arrayFilter)(conditions, function (condition) {
return condition.name === name;
}).length > 0;
} else {
result = conditions.length > 0;
}
return result;
}
/**
* Clean all conditions collection and reset order stack.
*
* @fires ConditionCollection#beforeClean
* @fires ConditionCollection#afterClean
*/
}, {
key: "clean",
value: function clean() {
this.runLocalHooks('beforeClean');
this.columnTypes = Object.create(null);
this.orderStack.length = 0;
this.conditions = this.initConditionsCollection();
this.runLocalHooks('afterClean');
}
/**
* Destroy object.
*/
}, {
key: "destroy",
value: function destroy() {
this.clearLocalHooks();
this.conditions = null;
this.orderStack = null;
this.columnTypes = null;
}
/**
* Init conditions collection
*
* @private
*/
}, {
key: "initConditionsCollection",
value: function initConditionsCollection() {
var conditions = Object.create(null);
(0, _object.objectEach)(_logicalOperationRegisterer.operations, function (_, operation) {
conditions[operation] = Object.create(null);
});
return conditions;
}
}]);
return ConditionCollection;
}();
(0, _object.mixin)(ConditionCollection, _localHooks.default);
var _default = ConditionCollection;
exports.default = _default;
/***/ }),
/* 413 */
/***/ (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 _array = __webpack_require__(4);
/**
* @class DataFilter
* @plugin Filters
*/
var DataFilter =
/*#__PURE__*/
function () {
function DataFilter(conditionCollection) {
var columnDataFactory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
return [];
};
(0, _classCallCheck2.default)(this, DataFilter);
/**
* Reference to the instance of {ConditionCollection}.
*
* @type {ConditionCollection}
*/
this.conditionCollection = conditionCollection;
/**
* Function which provide source data factory for specified column.
*
* @type {Function}
*/
this.columnDataFactory = columnDataFactory;
}
/**
* Filter data based on the conditions collection.
*
* @returns {Array}
*/
(0, _createClass2.default)(DataFilter, [{
key: "filter",
value: function filter() {
var _this = this;
var filteredData = [];
if (!this.conditionCollection.isEmpty()) {
(0, _array.arrayEach)(this.conditionCollection.orderStack, function (column, index) {
var columnData = _this.columnDataFactory(column);
if (index) {
columnData = _this._getIntersectData(columnData, filteredData);
}
filteredData = _this.filterByColumn(column, columnData);
});
}
return filteredData;
}
/**
* Filter data based on specified column index.
*
* @param {Number} column Column index.
* @param {Array} [dataSource] Data source as array of objects with `value` and `meta` keys (e.g. `{value: 'foo', meta: {}}`).
* @returns {Array} Returns filtered data.
*/
}, {
key: "filterByColumn",
value: function filterByColumn(column) {
var _this2 = this;
var dataSource = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var filteredData = [];
(0, _array.arrayEach)(dataSource, function (dataRow) {
if (dataRow !== void 0 && _this2.conditionCollection.isMatch(dataRow, column)) {
filteredData.push(dataRow);
}
});
return filteredData;
}
/**
* Intersect data.
*
* @private
* @param {Array} data
* @param {Array} needles
* @returns {Array}
*/
}, {
key: "_getIntersectData",
value: function _getIntersectData(data, needles) {
var result = [];
(0, _array.arrayEach)(needles, function (needleRow) {
var row = needleRow.meta.visualRow;
if (data[row] !== void 0) {
result[row] = data[row];
}
});
return result;
}
}]);
return DataFilter;
}();
var _default = DataFilter;
exports.default = _default;
/***/ }),
/* 414 */
/***/ (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 _hotFormulaParser = __webpack_require__(128);
var _object = __webpack_require__(3);
/**
* @class BaseCell
* @util
*/
var BaseCell =
/*#__PURE__*/
function () {
function BaseCell(row, column) {
(0, _classCallCheck2.default)(this, BaseCell);
var rowObject = (0, _object.isObject)(row);
var columnObject = (0, _object.isObject)(column);
this._row = rowObject ? row.index : row;
this.rowAbsolute = rowObject ? row.isAbsolute : true;
this._column = columnObject ? column.index : column;
this.columnAbsolute = columnObject ? column.isAbsolute : true;
this.rowOffset = 0;
this.columnOffset = 0; // TODO: Change syntax to es6 after upgrade tests to newer version of phantom and jasmine.
Object.defineProperty(this, 'row', {
get: function get() {
return this.rowOffset + this._row;
},
set: function set(rowIndex) {
this._row = rowIndex;
},
enumerable: true,
configurable: true
});
Object.defineProperty(this, 'column', {
get: function get() {
return this.columnOffset + this._column;
},
set: function set(columnIndex) {
this._column = columnIndex;
},
enumerable: true,
configurable: true
});
}
/**
* Translate cell coordinates.
*
* @param {Number} rowOffset Row offset to move.
* @param {Number} columnOffset Column offset to move.
*/
(0, _createClass2.default)(BaseCell, [{
key: "translateTo",
value: function translateTo(rowOffset, columnOffset) {
this.row = this.row + rowOffset;
this.column = this.column + columnOffset;
}
/**
* Check if cell is equal to provided one.
*
* @param {BaseCell} cell Cell object.
* @returns {Boolean}
*/
}, {
key: "isEqual",
value: function isEqual(cell) {
return cell.row === this.row && cell.column === this.column;
}
/**
* Stringify object.
*
* @returns {String}
*/
}, {
key: "toString",
value: function toString() {
return (0, _hotFormulaParser.toLabel)({
index: this.row,
isAbsolute: this.rowAbsolute
}, {
index: this.column,
isAbsolute: this.columnAbsolute
});
}
}]);
return BaseCell;
}();
var _default = BaseCell;
exports.default = _default;
/***/ }),
/* 415 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(19);
exports.__esModule = true;
exports.default = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(6));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(5));
var _createClass2 = _interopRequireDefault(__webpack_require__(2));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _array = __webpack_require__(4);
var _number = __webpack_require__(17);
var _element = __webpack_require__(8);
var _base = _interopRequireDefault(__webpack_require__(193));
/**
* Class responsible for the UI in the Nested Rows' row headers.
*
* @class HeadersUI
* @util
* @extends BaseUI
*/
var HeadersUI =
/*#__PURE__*/
function (_BaseUI) {
(0, _inherits2.default)(HeadersUI, _BaseUI);
(0, _createClass2.default)(HeadersUI, null, [{
key: "CSS_CLASSES",
/**
* CSS classes used in the row headers.
*
* @type {Object}
*/
get: function get() {
return {
indicatorContainer: 'ht_nestingLevels',
parent: 'ht_nestingParent',
indicator: 'ht_nestingLevel',
emptyIndicator: 'ht_nestingLevel_empty',
button: 'ht_nestingButton',
expandButton: 'ht_nestingExpand',
collapseButton: 'ht_nestingCollapse'
};
}
}]);
function HeadersUI(nestedRowsPlugin, hotInstance) {
var _this;
(0, _classCallCheck2.default)(this, HeadersUI);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HeadersUI).call(this, nestedRowsPlugin, hotInstance));
/**
* Reference to the DataManager instance connected with the Nested Rows plugin.
*
* @type {DataManager}
*/
_this.dataManager = _this.plugin.dataManager; // /**
// * Level cache array.
// *
// * @type {Array}
// */
// this.levelCache = this.dataManager.cache.levels;
/**
* Reference to the CollapsingUI instance connected with the Nested Rows plugin.
*
* @type {CollapsingUI}
*/
_this.collapsingUI = _this.plugin.collapsingUI;
/**
* Cache for the row headers width.
*
* @type {null|Number}
*/
_this.rowHeaderWidthCache = null;
/**
* Reference to the TrimRows instance connected with the Nested Rows plugin.
*
* @type {TrimRows}
*/
_this.trimRowsPlugin = nestedRowsPlugin.trimRowsPlugin;
return _this;
}
/**
* Append nesting indicators and buttons to the row headers.
*
* @private
* @param {Number} row Row index.
* @param {HTMLElement} TH TH 3element.
*/
(0, _createClass2.default)(HeadersUI, [{
key: "appendLevelIndicators",
value: function appendLevelIndicators(row, TH) {
var rowIndex = this.trimRowsPlugin.rowsMapper.getValueByIndex(row);
var rowLevel = this.dataManager.getRowLevel(rowIndex);
var rowObject = this.dataManager.getDataObject(rowIndex);
var innerDiv = TH.getElementsByTagName('DIV')[0];
var innerSpan = innerDiv.querySelector('span.rowHeader');
var previousIndicators = innerDiv.querySelectorAll('[class^="ht_nesting"]');
(0, _array.arrayEach)(previousIndicators, function (elem) {
if (elem) {
innerDiv.removeChild(elem);
}
});
(0, _element.addClass)(TH, HeadersUI.CSS_CLASSES.indicatorContainer);
if (rowLevel) {
var rootDocument = this.hot.rootDocument;
var initialContent = innerSpan.cloneNode(true);
innerDiv.innerHTML = '';
(0, _number.rangeEach)(0, rowLevel - 1, function () {
var levelIndicator = rootDocument.createElement('SPAN');
(0, _element.addClass)(levelIndicator, HeadersUI.CSS_CLASSES.emptyIndicator);
innerDiv.appendChild(levelIndicator);
});
innerDiv.appendChild(initialContent);
}
if (this.dataManager.hasChildren(rowObject)) {
var buttonsContainer = this.hot.rootDocument.createElement('DIV');
(0, _element.addClass)(TH, HeadersUI.CSS_CLASSES.parent);
if (this.collapsingUI.areChildrenCollapsed(rowIndex)) {
(0, _element.addClass)(buttonsContainer, "".concat(HeadersUI.CSS_CLASSES.button, " ").concat(HeadersUI.CSS_CLASSES.expandButton));
} else {
(0, _element.addClass)(buttonsContainer, "".concat(HeadersUI.CSS_CLASSES.button, " ").concat(HeadersUI.CSS_CLASSES.collapseButton));
}
innerDiv.appendChild(buttonsContainer);
}
}
/**
* Update the row header width according to number of levels in the dataset.
*
* @private
* @param {Number} deepestLevel Cached deepest level of nesting.
*/
}, {
key: "updateRowHeaderWidth",
value: function updateRowHeaderWidth(deepestLevel) {
var deepestLevelIndex = deepestLevel;
if (!deepestLevelIndex) {
deepestLevelIndex = this.dataManager.cache.levelCount;
}
this.rowHeaderWidthCache = Math.max(50, 11 + 10 * deepestLevelIndex + 25);
this.hot.render();
}
}]);
return HeadersUI;
}(_base.default);
var _default = HeadersUI;
exports.default = _default;
/***/ }),
/* 416 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = __webpack_require__(9);
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(417);
exports.__esModule = true;
exports.default = void 0;
__webpack_require__(418);
__webpack_require__(419);
__webpack_require__(420);
var _editors = __webpack_require__(57);
var _renderers = __webpack_require__(43);
var _validators = __webpack_require__(85);
var _cellTypes = __webpack_require__(180);
var _core = _interopRequireDefault(__webpack_require__(181));
var _jquery = _interopRequireDefault(__webpack_require__(522));
var _eventManager = _interopRequireWildcard(__webpack_require__(25));
var _pluginHooks = _interopRequireDefault(__webpack_require__(46));
var _ghostTable = _interopRequireDefault(__webpack_require__(184));
var parseTableHelpers = _interopRequireWildcard(__webpack_require__(183));
var arrayHelpers = _interopRequireWildcard(__webpack_require__(4));
var browserHelpers = _interopRequireWildcard(__webpack_require__(71));
var dataHelpers = _interopRequireWildcard(__webpack_require__(147));
var dateHelpers = _interopRequireWildcard(__webpack_require__(379));
var featureHelpers = _interopRequireWildcard(__webpack_require__(76));
var functionHelpers = _interopRequireWildcard(__webpack_require__(77));
var mixedHelpers = _interopRequireWildcard(__webpack_require__(29));
var numberHelpers = _interopRequireWildcard(__webpack_require__(17));
var objectHelpers = _interopRequireWildcard(__webpack_require__(3));
var settingHelpers = _interopRequireWildcard(__webpack_require__(182));
var stringHelpers = _interopRequireWildcard(__webpack_require__(74));
var unicodeHelpers = _interopRequireWildcard(__webpack_require__(55));
var domHelpers = _interopRequireWildcard(__webpack_require__(8));
var domEventHelpers = _interopRequireWildcard(__webpack_require__(32));
var plugins = _interopRequireWildcard(__webpack_require__(523));
var _plugins = __webpack_require__(21);
var _defaultSettings = _interopRequireDefault(__webpack_require__(386));
var _rootInstance = __webpack_require__(383);
var _i18n = __webpack_require__(387);
var constants = _interopRequireWildcard(__webpack_require__(11));
var _dictionariesManager = __webpack_require__(150);
function Handsontable(rootElement, userSettings) {
var instance = new _core.default(rootElement, userSettings || {}, _rootInstance.rootInstanceSymbol);
instance.init();
return instance;
}
(0, _jquery.default)(Handsontable);
Handsontable.Core = function (rootElement) {
var userSettings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return new _core.default(rootElement, userSettings, _rootInstance.rootInstanceSymbol);
};
Handsontable.DefaultSettings = _defaultSettings.default;
Handsontable.EventManager = _eventManager.default;
Handsontable._getListenersCounter = _eventManager.getListenersCounter; // For MemoryLeak tests
Handsontable.packageName = 'handsontable';
Handsontable.buildDate = "19/02/2020 13:44:06";
Handsontable.version = "7.4.2"; // Export Hooks singleton
Handsontable.hooks = _pluginHooks.default.getSingleton(); // TODO: Remove this exports after rewrite tests about this module
Handsontable.__GhostTable = _ghostTable.default; //
// Export all helpers to the Handsontable object
var HELPERS = [arrayHelpers, browserHelpers, dataHelpers, dateHelpers, featureHelpers, functionHelpers, mixedHelpers, numberHelpers, objectHelpers, settingHelpers, stringHelpers, unicodeHelpers, parseTableHelpers];
var DOM = [domHelpers, domEventHelpers];
Handsontable.helper = {};
Handsontable.dom = {}; // Fill general helpers.
arrayHelpers.arrayEach(HELPERS, function (helper) {
arrayHelpers.arrayEach(Object.getOwnPropertyNames(helper), function (key) {
if (key.charAt(0) !== '_') {
Handsontable.helper[key] = helper[key];
}
});
}); // Fill DOM helpers.
arrayHelpers.arrayEach(DOM, function (helper) {
arrayHelpers.arrayEach(Object.getOwnPropertyNames(helper), function (key) {
if (key.charAt(0) !== '_') {
Handsontable.dom[key] = helper[key];
}
});
}); // Export cell types.
Handsontable.cellTypes = {};
arrayHelpers.arrayEach((0, _cellTypes.getRegisteredCellTypeNames)(), function (cellTypeName) {
Handsontable.cellTypes[cellTypeName] = (0, _cellTypes.getCellType)(cellTypeName);
});
Handsontable.cellTypes.registerCellType = _cellTypes.registerCellType;
Handsontable.cellTypes.getCellType = _cellTypes.getCellType; // Export all registered editors from the Handsontable.
Handsontable.editors = {};
arrayHelpers.arrayEach((0, _editors.getRegisteredEditorNames)(), function (editorName) {
Handsontable.editors["".concat(stringHelpers.toUpperCaseFirst(editorName), "Editor")] = (0, _editors.getEditor)(editorName);
});
Handsontable.editors.registerEditor = _editors.registerEditor;
Handsontable.editors.getEditor = _editors.getEditor; // Export all registered renderers from the Handsontable.
Handsontable.renderers = {};
arrayHelpers.arrayEach((0, _renderers.getRegisteredRendererNames)(), function (rendererName) {
var renderer = (0, _renderers.getRenderer)(rendererName);
if (rendererName === 'base') {
Handsontable.renderers.cellDecorator = renderer;
}
Handsontable.renderers["".concat(stringHelpers.toUpperCaseFirst(rendererName), "Renderer")] = renderer;
});
Handsontable.renderers.registerRenderer = _renderers.registerRenderer;
Handsontable.renderers.getRenderer = _renderers.getRenderer; // Export all registered validators from the Handsontable.
Handsontable.validators = {};
arrayHelpers.arrayEach((0, _validators.getRegisteredValidatorNames)(), function (validatorName) {
Handsontable.validators["".concat(stringHelpers.toUpperCaseFirst(validatorName), "Validator")] = (0, _validators.getValidator)(validatorName);
});
Handsontable.validators.registerValidator = _validators.registerValidator;
Handsontable.validators.getValidator = _validators.getValidator; // Export all registered plugins from the Handsontable.
Handsontable.plugins = {};
arrayHelpers.arrayEach(Object.getOwnPropertyNames(plugins), function (pluginName) {
var plugin = plugins[pluginName];
if (pluginName === 'Base') {
Handsontable.plugins["".concat(pluginName, "Plugin")] = plugin;
} else {
Handsontable.plugins[pluginName] = plugin;
}
});
Handsontable.plugins.registerPlugin = _plugins.registerPlugin;
Handsontable.languages = {};
Handsontable.languages.dictionaryKeys = constants;
Handsontable.languages.getLanguageDictionary = _dictionariesManager.getLanguageDictionary;
Handsontable.languages.getLanguagesDictionaries = _dictionariesManager.getLanguagesDictionaries;
Handsontable.languages.registerLanguageDictionary = _dictionariesManager.registerLanguageDictionary; // Alias to `getTranslatedPhrase` function, for more information check it API.
Handsontable.languages.getTranslatedPhrase = function () {
return _i18n.getTranslatedPhrase.apply(void 0, arguments);
};
var _default = Handsontable;
exports.default = _default;
/***/ }),
/* 417 */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(20);
var fails = __webpack_require__(26);
var nativeGetOwnPropertyNames = __webpack_require__(202).f;
var FAILS_ON_PRIMITIVES = fails(function () { return !Object.getOwnPropertyNames(1); });
// `Object.getOwnPropertyNames` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
getOwnPropertyNames: nativeGetOwnPropertyNames
});
/***/ }),
/* 418 */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/* 419 */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/* 420 */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/* 421 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(44);
var definePropertyModule = __webpack_require__(51);
var anObject = __webpack_require__(48);
var objectKeys = __webpack_require__(111);
// `Object.defineProperties` method
// https://tc39.github.io/ecma262/#sec-object.defineproperties
module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = objectKeys(Properties);
var length = keys.length;
var index = 0;
var key;
while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
return O;
};
/***/ }),
/* 422 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var IteratorPrototype = __webpack_require__(205).IteratorPrototype;
var create = __webpack_require__(110);
var createPropertyDescriptor = __webpack_require__(103);
var setToStringTag = __webpack_require__(135);
var Iterators = __webpack_require__(112);
var returnThis = function () { return this; };
module.exports = function (IteratorConstructor, NAME, next) {
var TO_STRING_TAG = NAME + ' Iterator';
IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
Iterators[TO_STRING_TAG] = returnThis;
return IteratorConstructor;
};
/***/ }),
/* 423 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(45);
module.exports = function (it) {
if (!isObject(it) && it !== null) {
throw TypeError("Can't set " + String(it) + ' as a prototype');
} return it;
};
/***/ }),
/* 424 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var TO_STRING_TAG_SUPPORT = __webpack_require__(164);
var classof = __webpack_require__(208);
// `Object.prototype.toString` method implementation
// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
return '[object ' + classof(this) + ']';
};
/***/ }),
/* 425 */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(26);
module.exports = !fails(function () {
return Object.isExtensible(Object.preventExtensions({}));
});
/***/ }),
/* 426 */
/***/ (function(module, exports) {
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
module.exports = _arrayWithoutHoles;
/***/ }),
/* 427 */
/***/ (function(module, exports) {
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
module.exports = _nonIterableSpread;
/***/ }),
/* 428 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var bind = __webpack_require__(113);
var toObject = __webpack_require__(58);
var callWithSafeIterationClosing = __webpack_require__(211);
var isArrayIteratorMethod = __webpack_require__(209);
var toLength = __webpack_require__(49);
var createProperty = __webpack_require__(115);
var getIteratorMethod = __webpack_require__(210);
// `Array.from` method implementation
// https://tc39.github.io/ecma262/#sec-array.from
module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
var O = toObject(arrayLike);
var C = typeof this == 'function' ? this : Array;
var argumentsLength = arguments.length;
var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
var mapping = mapfn !== undefined;
var iteratorMethod = getIteratorMethod(O);
var index = 0;
var length, result, step, iterator, next, value;
if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
// if the target is not iterable or it's an array with the default iterator - use a simple case
if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
iterator = iteratorMethod.call(O);
next = iterator.next;
result = new C();
for (;!(step = next.call(iterator)).done; index++) {
value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
createProperty(result, index, value);
}
} else {
length = toLength(O.length);
result = new C(length);
for (;length > index; index++) {
value = mapping ? mapfn(O[index], index) : O[index];
createProperty(result, index, value);
}
}
result.length = index;
return result;
};
/***/ }),
/* 429 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(48);
var aFunction = __webpack_require__(138);
var wellKnownSymbol = __webpack_require__(36);
var SPECIES = wellKnownSymbol('species');
// `SpeciesConstructor` abstract operation
// https://tc39.github.io/ecma262/#sec-speciesconstructor
module.exports = function (O, defaultConstructor) {
var C = anObject(O).constructor;
var S;
return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
};
/***/ }),
/* 430 */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(26);
var whitespaces = __webpack_require__(221);
var non = '\u200B\u0085\u180E';
// check that a method works with the correct list
// of whitespaces and has a correct name
module.exports = function (METHOD_NAME) {
return fails(function () {
return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
});
};
/***/ }),
/* 431 */
/***/ (function(module, exports) {
function _iterableToArrayLimit(arr, i) {
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
return;
}
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
module.exports = _iterableToArrayLimit;
/***/ }),
/* 432 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
__webpack_require__(15);
__webpack_require__(10);
__webpack_require__(13);
__webpack_require__(24);
__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 _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(5));
var _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _orderView = __webpack_require__(145);
var _base = _interopRequireDefault(__webpack_require__(121));
/**
* Row headers renderer responsible for managing (inserting, tracking, rendering) TR elements belongs to TR.
*
*
(root node)
* ├
--- RowHeadersRenderer
* ├
\
* ├
\
* ├
- CellsRenderer
* ├
/
* └
/
*
* @class {CellsRenderer}
*/
var RowHeadersRenderer =
/*#__PURE__*/
function (_BaseRenderer) {
(0, _inherits2.default)(RowHeadersRenderer, _BaseRenderer);
function RowHeadersRenderer() {
var _this;
(0, _classCallCheck2.default)(this, RowHeadersRenderer);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(RowHeadersRenderer).call(this, 'TH'));
/**
* Cache for OrderView classes connected to specified node.
*
* @type {WeakMap}
*/
_this.orderViews = new WeakMap();
/**
* Row index which specifies the row position of the processed row header.
*
* @type {Number}
*/
_this.sourceRowIndex = 0;
return _this;
}
/**
* Obtains the instance of the SharedOrderView class which is responsible for rendering the nodes to the root node.
*
* @param {HTMLTableRowElement} rootNode The TR element, which is root element for row headers (TH).
* @return {SharedOrderView}
*/
(0, _createClass2.default)(RowHeadersRenderer, [{
key: "obtainOrderView",
value: function obtainOrderView(rootNode) {
var _this2 = this;
var orderView;
if (this.orderViews.has(rootNode)) {
orderView = this.orderViews.get(rootNode);
} else {
orderView = new _orderView.SharedOrderView(rootNode, function (sourceColumnIndex) {
return _this2.nodesPool.obtain(_this2.sourceRowIndex, sourceColumnIndex);
}, this.nodeType);
this.orderViews.set(rootNode, orderView);
}
return orderView;
}
/**
* Renders the cells.
*/
}, {
key: "render",
value: function render() {
var _this$table = this.table,
rowsToRender = _this$table.rowsToRender,
rowHeaderFunctions = _this$table.rowHeaderFunctions,
rowHeadersCount = _this$table.rowHeadersCount,
rows = _this$table.rows,
cells = _this$table.cells;
for (var visibleRowIndex = 0; visibleRowIndex < rowsToRender; visibleRowIndex++) {
var sourceRowIndex = this.table.renderedRowToSource(visibleRowIndex);
var TR = rows.getRenderedNode(visibleRowIndex);
this.sourceRowIndex = sourceRowIndex;
var orderView = this.obtainOrderView(TR);
var cellsView = cells.obtainOrderView(TR);
orderView.appendView(cellsView).setSize(rowHeadersCount).setOffset(this.table.renderedColumnToSource(0)).start();
for (var visibleColumnIndex = 0; visibleColumnIndex < rowHeadersCount; visibleColumnIndex++) {
orderView.render();
var TH = orderView.getCurrentNode();
TH.className = '';
TH.removeAttribute('style');
rowHeaderFunctions[visibleColumnIndex](sourceRowIndex, TH, visibleColumnIndex);
}
orderView.end();
}
}
}]);
return RowHeadersRenderer;
}(_base.default);
exports.default = RowHeadersRenderer;
/***/ }),
/* 433 */
/***/ (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 _viewSize = _interopRequireDefault(__webpack_require__(434));
var _constants = __webpack_require__(233);
/**
* The class is a source of the truth of information about the current and
* next size of the rendered DOM elements and current and next offset of
* the view. That information allows us to calculate diff between current
* DOM order and this which should be rendered without touching the DOM API at all.
*
* Mostly the ViewSizeSet is created for each individual renderer. But in
* the table, there is one case where this size information should be shared
* between two different instances (different table renderers). This is a TR
* element which can contain TH elements - managed by own renderer and
* TD elements - managed by another renderer. To generate correct DOM order
* for them it is required to connect these two instances by reference
* through `sharedSize`.
*
* @class {ViewSizeSet}
*/
var ViewSizeSet =
/*#__PURE__*/
function () {
function ViewSizeSet() {
(0, _classCallCheck2.default)(this, ViewSizeSet);
/**
* Holder for current and next view size and offset.
*
* @type {ViewSize}
*/
this.size = new _viewSize.default();
/**
* Defines if this instance shares its size with another instance. If it's in the shared
* mode it defines what space it occupies ('top' or 'bottom').
*
* @type {Number}
*/
this.workingSpace = _constants.WORKING_SPACE_ALL;
/**
* Shared Size instance.
*
* @type {ViewSize}
*/
this.sharedSize = null;
}
/**
* Sets the size for rendered elements. It can be a size for rows, cells or size for row
* headers etc.
*
* @param {Number} size
*/
(0, _createClass2.default)(ViewSizeSet, [{
key: "setSize",
value: function setSize(size) {
this.size.setSize(size);
}
/**
* 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
*/
}, {
key: "setOffset",
value: function setOffset(offset) {
this.size.setOffset(offset);
}
/**
* Returns ViewSize instance.
*
* @returns {ViewSize}
*/
}, {
key: "getViewSize",
value: function getViewSize() {
return this.size;
}
/**
* Checks if this ViewSizeSet is sharing the size with another instance.
*
* @returns {Boolean}
*/
}, {
key: "isShared",
value: function isShared() {
return this.sharedSize instanceof _viewSize.default;
}
/**
* Checks what working space describes this size instance.
*
* @param {Number} workingSpace The number which describes the type of the working space (see constants.js).
* @returns {Boolean}
*/
}, {
key: "isPlaceOn",
value: function isPlaceOn(workingSpace) {
return this.workingSpace === workingSpace;
}
/**
* Appends the ViewSizeSet instance to this instance that turns it into a shared mode.
*
* @param {ViewSizeSet} viewSizeSet
*/
}, {
key: "append",
value: function append(viewSize) {
this.workingSpace = _constants.WORKING_SPACE_TOP;
viewSize.workingSpace = _constants.WORKING_SPACE_BOTTOM;
this.sharedSize = viewSize.getViewSize();
}
/**
* Prepends the ViewSize instance to this instance that turns it into a shared mode.
*
* @param {ViewSizeSet} viewSizeSet
*/
}, {
key: "prepend",
value: function prepend(viewSize) {
this.workingSpace = _constants.WORKING_SPACE_BOTTOM;
viewSize.workingSpace = _constants.WORKING_SPACE_TOP;
this.sharedSize = viewSize.getViewSize();
}
}]);
return ViewSizeSet;
}();
exports.default = ViewSizeSet;
/***/ }),
/* 434 */
/***/ (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));
/**
* Holder for current and next size (count of rendered and to render DOM elements) and offset.
*
* @class {ViewSize}
*/
var ViewSize =
/*#__PURE__*/
function () {
function ViewSize() {
(0, _classCallCheck2.default)(this, ViewSize);
/**
* Current size of the rendered DOM elements.
*
* @type {Number}
*/
this.currentSize = 0;
/**
* Next size of the rendered DOM elements which should be fulfilled.
*
* @type {Number}
*/
this.nextSize = 0;
/**
* Current offset.
*
* @type {Number}
*/
this.currentOffset = 0;
/**
* Next ofset.
*
* @type {Number}
*/
this.nextOffset = 0;
}
/**
* Sets new size of the rendered DOM elements.
*
* @param {Number} size
*/
(0, _createClass2.default)(ViewSize, [{
key: "setSize",
value: function setSize(size) {
this.currentSize = this.nextSize;
this.nextSize = size;
}
/**
* Sets new offset.
*
* @param {Number} offset
*/
}, {
key: "setOffset",
value: function setOffset(offset) {
this.currentOffset = this.nextOffset;
this.nextOffset = offset;
}
}]);
return ViewSize;
}();
exports.default = ViewSize;
/***/ }),
/* 435 */
/***/ (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 _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _view = _interopRequireDefault(__webpack_require__(232));
/**
* Executive model for TR root nodes.
*
* @class {SharedOrderView}
*/
var SharedOrderView =
/*#__PURE__*/
function (_OrderView) {
(0, _inherits2.default)(SharedOrderView, _OrderView);
function SharedOrderView() {
(0, _classCallCheck2.default)(this, SharedOrderView);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(SharedOrderView).apply(this, arguments));
}
(0, _createClass2.default)(SharedOrderView, [{
key: "prependView",
/**
* The method results in merging external order view into the current order. This happens only for order views which
* operate on the same root node.
*
* In the table, there is only one scenario when this happens. TR root element
* has a common root node with cells order view and row headers order view. Both classes have to share
* information about their order sizes to make proper diff calculations.
*
* @param {OrderView} orderView The order view to merging with. The view will be added at the beginning of the list.
* @returns {SharedOrderView}
*/
value: function prependView(orderView) {
this.sizeSet.prepend(orderView.sizeSet);
orderView.sizeSet.append(this.sizeSet);
return this;
}
/**
* The method results in merging external order view into the current order. This happens only for order views which
* operate on the same root node.
*
* In the table, there is only one scenario when this happens. TR root element
* has a common root node with cells order view and row headers order view. Both classes have to share
* information about their order sizes to make proper diff calculations.
*
* @param {OrderView} orderView The order view to merging with. The view will be added at the end of the list.
* @returns {SharedOrderView}
*/
}, {
key: "appendView",
value: function appendView(orderView) {
this.sizeSet.append(orderView.sizeSet);
orderView.sizeSet.prepend(this.sizeSet);
return this;
}
}]);
return SharedOrderView;
}(_view.default);
exports.default = SharedOrderView;
/***/ }),
/* 436 */
/***/ (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));
/**
* Factory for newly created DOM elements.
*
* @class {NodesPool}
*/
var NodesPool =
/*#__PURE__*/
function () {
function NodesPool(nodeType) {
(0, _classCallCheck2.default)(this, NodesPool);
/**
* Node type to generate (ew 'th', 'td').
*
* @type {String}
*/
this.nodeType = nodeType.toUpperCase();
}
/**
* Set document owner for this instance.
*
* @param {HTMLDocument} rootDocument
*/
(0, _createClass2.default)(NodesPool, [{
key: "setRootDocument",
value: function setRootDocument(rootDocument) {
this.rootDocument = rootDocument;
}
/**
* Obtains an element. The returned elements in the feature can be cached.
*
* @returns {HTMLElement}
*/
}, {
key: "obtain",
value: function obtain() {
return this.rootDocument.createElement(this.nodeType);
}
}]);
return NodesPool;
}();
exports.default = NodesPool;
/***/ }),
/* 437 */
/***/ (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 _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _element = __webpack_require__(8);
var _base = _interopRequireDefault(__webpack_require__(121));
/**
* Column headers renderer responsible for managing (inserting, tracking, rendering) TR and TH elements.
*
* (root node)
* ├
\
* ├
\
* ├
- ColumnHeadersRenderer
* ├
/
* └
/
*
* @class {ColumnHeadersRenderer}
*/
var ColumnHeadersRenderer =
/*#__PURE__*/
function (_BaseRenderer) {
(0, _inherits2.default)(ColumnHeadersRenderer, _BaseRenderer);
function ColumnHeadersRenderer(rootNode) {
(0, _classCallCheck2.default)(this, ColumnHeadersRenderer);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ColumnHeadersRenderer).call(this, null, rootNode)); // NodePool is not implemented for this renderer yet
}
/**
* Adjusts the number of the rendered elements.
*/
(0, _createClass2.default)(ColumnHeadersRenderer, [{
key: "adjust",
value: function adjust() {
var _this$table = this.table,
columnHeadersCount = _this$table.columnHeadersCount,
rowHeadersCount = _this$table.rowHeadersCount;
var TR = this.rootNode.firstChild;
if (columnHeadersCount) {
var columnsToRender = this.table.columnsToRender;
var allColumnsToRender = columnsToRender + rowHeadersCount;
for (var i = 0, len = columnHeadersCount; i < len; i++) {
TR = this.rootNode.childNodes[i];
if (!TR) {
TR = this.table.rootDocument.createElement('tr');
this.rootNode.appendChild(TR);
}
this.renderedNodes = TR.childNodes.length;
while (this.renderedNodes < allColumnsToRender) {
TR.appendChild(this.table.rootDocument.createElement('th'));
this.renderedNodes += 1;
}
while (this.renderedNodes > allColumnsToRender) {
TR.removeChild(TR.lastChild);
this.renderedNodes -= 1;
}
}
var theadChildrenLength = this.rootNode.childNodes.length;
if (theadChildrenLength > columnHeadersCount) {
for (var _i = columnHeadersCount; _i < theadChildrenLength; _i++) {
this.rootNode.removeChild(this.rootNode.lastChild);
}
}
} else if (TR) {
(0, _element.empty)(TR);
}
}
/**
* Renders the TH elements.
*/
}, {
key: "render",
value: function render() {
var columnHeadersCount = this.table.columnHeadersCount;
for (var visibleRowIndex = 0; visibleRowIndex < columnHeadersCount; visibleRowIndex++) {
var _this$table2 = this.table,
columnHeaderFunctions = _this$table2.columnHeaderFunctions,
columnsToRender = _this$table2.columnsToRender,
rowHeadersCount = _this$table2.rowHeadersCount;
var TR = this.rootNode.childNodes[visibleRowIndex];
for (var renderedColumnIndex = -1 * rowHeadersCount; renderedColumnIndex < columnsToRender; renderedColumnIndex++) {
var sourceColumnIndex = this.table.renderedColumnToSource(renderedColumnIndex);
var TH = TR.childNodes[renderedColumnIndex + rowHeadersCount];
TH.className = '';
TH.removeAttribute('style');
columnHeaderFunctions[visibleRowIndex](sourceColumnIndex, TH, visibleRowIndex);
}
}
}
}]);
return ColumnHeadersRenderer;
}(_base.default);
exports.default = ColumnHeadersRenderer;
/***/ }),
/* 438 */
/***/ (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 _inherits2 = _interopRequireDefault(__webpack_require__(7));
var _base = _interopRequireDefault(__webpack_require__(121));
var _element = __webpack_require__(8);
/**
* Colgroup renderer responsible for managing (inserting, tracking, rendering) COL elements.
*
*
(root node)
* ├
\
* ├
\
* ├
- ColGroupRenderer
* ├
/
* └
/
*
* @class {ColGroupRenderer}
*/
var ColGroupRenderer =
/*#__PURE__*/
function (_BaseRenderer) {
(0, _inherits2.default)(ColGroupRenderer, _BaseRenderer);
function ColGroupRenderer(rootNode) {
(0, _classCallCheck2.default)(this, ColGroupRenderer);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ColGroupRenderer).call(this, null, rootNode)); // NodePool is not implemented for this renderer yet
}
/**
* Adjusts the number of the rendered elements.
*/
(0, _createClass2.default)(ColGroupRenderer, [{
key: "adjust",
value: function adjust() {
var _this$table = this.table,
columnsToRender = _this$table.columnsToRender,
rowHeadersCount = _this$table.rowHeadersCount;
var allColumnsToRender = columnsToRender + rowHeadersCount;
while (this.renderedNodes < allColumnsToRender) {
this.rootNode.appendChild(this.table.rootDocument.createElement('col'));
this.renderedNodes += 1;
}
while (this.renderedNodes > allColumnsToRender) {
this.rootNode.removeChild(this.rootNode.lastChild);
this.renderedNodes -= 1;
}
}
/**
* Renders the col group elements.
*/
}, {
key: "render",
value: function render() {
this.adjust();
var _this$table2 = this.table,
columnsToRender = _this$table2.columnsToRender,
rowHeadersCount = _this$table2.rowHeadersCount; // Render column nodes for row headers
for (var visibleColumnIndex = 0; visibleColumnIndex < rowHeadersCount; visibleColumnIndex++) {
var sourceColumnIndex = this.table.renderedColumnToSource(visibleColumnIndex);
var width = this.table.columnUtils.getHeaderWidth(sourceColumnIndex);
this.rootNode.childNodes[visibleColumnIndex].style.width = "".concat(width, "px");
} // Render column nodes for cells
for (var _visibleColumnIndex = 0; _visibleColumnIndex < columnsToRender; _visibleColumnIndex++) {
var _sourceColumnIndex = this.table.renderedColumnToSource(_visibleColumnIndex);
var _width = this.table.columnUtils.getStretchedColumnWidth(_sourceColumnIndex);
this.rootNode.childNodes[_visibleColumnIndex + rowHeadersCount].style.width = "".concat(_width, "px");
}
var firstChild = this.rootNode.firstChild;
if (firstChild) {
(0, _element.addClass)(firstChild, 'rowHeader');
}
}
}]);
return ColGroupRenderer;
}(_base.default);
exports.default = ColGroupRenderer;
/***/ }),
/* 439 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = __webpack_require__(0);
exports.__esModule = true;
exports.default = void 0;
var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(72));
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 _console = __webpack_require__(61);
var _templateLiteralTag = __webpack_require__(73);
var _orderView = __webpack_require__(145);
var _base = _interopRequireDefault(__webpack_require__(121));
function _templateObject() {
var data = (0, _taggedTemplateLiteral2.default)(["Performance tip: Handsontable rendered more than 1000 visible rows. Consider limiting the number \n of rendered rows by specifying the table height and/or turning off the \"renderAllRows\" option."], ["Performance tip: Handsontable rendered more than 1000 visible rows. Consider limiting the number\\x20\n of rendered rows by specifying the table height and/or turning off the \"renderAllRows\" option."]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
var performanceWarningAppeared = false;
/**
* Rows renderer responsible for managing (inserting, tracking, rendering) TR elements belongs to TBODY.
*
*
/
*
* @class {CellsRenderer}
*/
var CellsRenderer =
/*#__PURE__*/
function (_BaseRenderer) {
(0, _inherits2.default)(CellsRenderer, _BaseRenderer);
function CellsRenderer() {
var _this;
(0, _classCallCheck2.default)(this, CellsRenderer);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(CellsRenderer).call(this, 'TD'));
/**
* Cache for OrderView classes connected to specified node.
*
* @type {WeakMap}
*/
_this.orderViews = new WeakMap();
/**
* Row index which specifies the row position of the processed cell.
*
* @type {Number}
*/
_this.sourceRowIndex = 0;
return _this;
}
/**
* Obtains the instance of the SharedOrderView class which is responsible for rendering the nodes to the root node.
*
* @param {HTMLTableRowElement} rootNode The TR element, which is root element for cells (TD).
* @return {SharedOrderView}
*/
(0, _createClass2.default)(CellsRenderer, [{
key: "obtainOrderView",
value: function obtainOrderView(rootNode) {
var _this2 = this;
var orderView;
if (this.orderViews.has(rootNode)) {
orderView = this.orderViews.get(rootNode);
} else {
orderView = new _orderView.SharedOrderView(rootNode, function (sourceColumnIndex) {
return _this2.nodesPool.obtain(_this2.sourceRowIndex, sourceColumnIndex);
}, this.nodeType);
this.orderViews.set(rootNode, orderView);
}
return orderView;
}
/**
* Renders the cells.
*/
}, {
key: "render",
value: function render() {
var _this$table = this.table,
rowsToRender = _this$table.rowsToRender,
columnsToRender = _this$table.columnsToRender,
rows = _this$table.rows,
rowHeaders = _this$table.rowHeaders;
for (var visibleRowIndex = 0; visibleRowIndex < rowsToRender; visibleRowIndex++) {
var sourceRowIndex = this.table.renderedRowToSource(visibleRowIndex);
var TR = rows.getRenderedNode(visibleRowIndex);
this.sourceRowIndex = sourceRowIndex;
var orderView = this.obtainOrderView(TR);
var rowHeadersView = rowHeaders.obtainOrderView(TR); // @TODO(perf-tip): For cells other than "visual 0" generating diff leads/commands can be skipped. New order view
// shoule share state between next orderViews.
orderView.prependView(rowHeadersView).setSize(columnsToRender).setOffset(this.table.renderedColumnToSource(0)).start();
for (var visibleColumnIndex = 0; visibleColumnIndex < columnsToRender; visibleColumnIndex++) {
orderView.render();
var TD = orderView.getCurrentNode();
var sourceColumnIndex = this.table.renderedColumnToSource(visibleColumnIndex);
if (!(0, _element.hasClass)(TD, 'hide')) {
// Workaround for hidden columns plugin
TD.className = '';
}
TD.removeAttribute('style');
this.table.cellRenderer(sourceRowIndex, sourceColumnIndex, TD);
}
orderView.end();
}
}
}]);
return CellsRenderer;
}(_base.default);
exports.default = CellsRenderer;
/***/ }),
/* 446 */
/***/ (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));
/**
* TableRenderer class collects all renderers and properties necessary for table creation. It's
* responsible for adjusting and rendering each renderer.
*
* Below is a diagram of the renderers together with an indication of what they are responisble for.
*