Created
April 30, 2021 14:54
-
-
Save aninde/714f1d0e71e9e87a59c9bb11bb406edb to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*! | |
| * 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: 8.4.0 | |
| * Release date: 11/05/2021 (built at 29/04/2021 16:51:23) | |
| */ | |
| (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 = 473); | |
| /******/ }) | |
| /************************************************************************/ | |
| /******/ ([ | |
| /* 0 */ | |
| /***/ (function(module, exports) { | |
| function _interopRequireDefault(obj) { | |
| return obj && obj.__esModule ? obj : { | |
| "default": obj | |
| }; | |
| } | |
| module.exports = _interopRequireDefault; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 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; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 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; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 3 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.to2dArray = to2dArray; | |
| exports.extendArray = extendArray; | |
| exports.pivot = pivot; | |
| exports.arrayReduce = arrayReduce; | |
| exports.arrayFilter = arrayFilter; | |
| exports.arrayMap = arrayMap; | |
| exports.arrayEach = arrayEach; | |
| exports.arraySum = arraySum; | |
| exports.arrayMax = arrayMax; | |
| exports.arrayMin = arrayMin; | |
| exports.arrayAvg = arrayAvg; | |
| exports.arrayFlatten = arrayFlatten; | |
| exports.arrayUnique = arrayUnique; | |
| exports.getDifferenceOfArrays = getDifferenceOfArrays; | |
| exports.getIntersectionOfArrays = getIntersectionOfArrays; | |
| exports.getUnionOfArrays = getUnionOfArrays; | |
| exports.stringToArray = stringToArray; | |
| __webpack_require__(43); | |
| __webpack_require__(11); | |
| __webpack_require__(19); | |
| __webpack_require__(17); | |
| __webpack_require__(33); | |
| __webpack_require__(30); | |
| __webpack_require__(26); | |
| __webpack_require__(34); | |
| __webpack_require__(12); | |
| __webpack_require__(9); | |
| __webpack_require__(62); | |
| __webpack_require__(13); | |
| __webpack_require__(29); | |
| __webpack_require__(61); | |
| /** | |
| * @param {Array} arr An array to process. | |
| */ | |
| function to2dArray(arr) { | |
| var ilen = arr.length; | |
| var i = 0; | |
| while (i < ilen) { | |
| arr[i] = [arr[i]]; | |
| i += 1; | |
| } | |
| } | |
| /** | |
| * @param {Array} arr An array to extend. | |
| * @param {Array} extension The data to extend from. | |
| */ | |
| function extendArray(arr, extension) { | |
| var ilen = extension.length; | |
| var i = 0; | |
| while (i < ilen) { | |
| arr.push(extension[i]); | |
| i += 1; | |
| } | |
| } | |
| /** | |
| * @param {Array} arr An array to pivot. | |
| * @returns {Array} | |
| */ | |
| 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; | |
| } | |
| /** | |
| * Differences from two or more arrays. | |
| * | |
| * @param {...Array} arrays Array of strings or array of numbers. | |
| * @returns {Array} Returns the difference between arrays. | |
| */ | |
| function getDifferenceOfArrays() { | |
| for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) { | |
| arrays[_key] = arguments[_key]; | |
| } | |
| var _ref = [].concat(arrays), | |
| first = _ref[0], | |
| rest = _ref.slice(1); | |
| var filteredFirstArray = first; | |
| arrayEach(rest, function (array) { | |
| filteredFirstArray = filteredFirstArray.filter(function (value) { | |
| return !array.includes(value); | |
| }); | |
| }); | |
| return filteredFirstArray; | |
| } | |
| /** | |
| * Intersection of two or more arrays. | |
| * | |
| * @param {...Array} arrays Array of strings or array of numbers. | |
| * @returns {Array} Returns elements that exists in every array. | |
| */ | |
| function getIntersectionOfArrays() { | |
| for (var _len2 = arguments.length, arrays = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | |
| arrays[_key2] = arguments[_key2]; | |
| } | |
| var _ref2 = [].concat(arrays), | |
| first = _ref2[0], | |
| rest = _ref2.slice(1); | |
| var filteredFirstArray = first; | |
| arrayEach(rest, function (array) { | |
| filteredFirstArray = filteredFirstArray.filter(function (value) { | |
| return array.includes(value); | |
| }); | |
| }); | |
| return filteredFirstArray; | |
| } | |
| /** | |
| * Union of two or more arrays. | |
| * | |
| * @param {...Array} arrays Array of strings or array of numbers. | |
| * @returns {Array} Returns the elements that exist in any of the arrays, without duplicates. | |
| */ | |
| function getUnionOfArrays() { | |
| for (var _len3 = arguments.length, arrays = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | |
| arrays[_key3] = arguments[_key3]; | |
| } | |
| var _ref3 = [].concat(arrays), | |
| first = _ref3[0], | |
| rest = _ref3.slice(1); | |
| var set = new Set(first); | |
| arrayEach(rest, function (array) { | |
| arrayEach(array, function (value) { | |
| if (!set.has(value)) { | |
| set.add(value); | |
| } | |
| }); | |
| }); | |
| return Array.from(set); | |
| } | |
| /** | |
| * Convert a separated strings to an array of strings. | |
| * | |
| * @param {string} value A string of class name(s). | |
| * @param {string|RegExp} delimiter The pattern describing where each split should occur. | |
| * @returns {string[]} Returns array of string or empty array. | |
| */ | |
| function stringToArray(value) { | |
| var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' '; | |
| return value.split(delimiter); | |
| } | |
| /***/ }), | |
| /* 4 */ | |
| /***/ (function(module, exports) { | |
| function _getPrototypeOf(o) { | |
| module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | |
| return o.__proto__ || Object.getPrototypeOf(o); | |
| }; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| return _getPrototypeOf(o); | |
| } | |
| module.exports = _getPrototypeOf; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 5 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| 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.setProperty = setProperty; | |
| exports.deepObjectSize = deepObjectSize; | |
| exports.createObjectPropListener = createObjectPropListener; | |
| exports.hasOwnProperty = hasOwnProperty; | |
| __webpack_require__(26); | |
| __webpack_require__(34); | |
| __webpack_require__(9); | |
| __webpack_require__(29); | |
| __webpack_require__(61); | |
| __webpack_require__(23); | |
| var _defineProperty2 = _interopRequireDefault(__webpack_require__(37)); | |
| var _typeof2 = _interopRequireDefault(__webpack_require__(56)); | |
| var _array = __webpack_require__(3); | |
| /** | |
| * Generate schema for passed object. | |
| * | |
| * @param {Array|object} object An object to analyze. | |
| * @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 The child class. | |
| * @param {object} Parent The parent class. | |
| * @returns {object} | |
| */ | |
| 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. | |
| * @param {string[]} [writableKeys] An array of keys that are writable to target object. | |
| * @returns {object} | |
| */ | |
| function extend(target, extension, writableKeys) { | |
| var hasWritableKeys = Array.isArray(writableKeys); | |
| objectEach(extension, function (value, key) { | |
| if (hasWritableKeys === false || writableKeys.includes(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. | |
| * @returns {object} | |
| */ | |
| function deepClone(obj) { | |
| if ((0, _typeof2.default)(obj) === 'object') { | |
| return JSON.parse(JSON.stringify(obj)); | |
| } | |
| return obj; | |
| } | |
| /** | |
| * Shallow clone object. | |
| * | |
| * @param {object} object An object to clone. | |
| * @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 The first object to compare. | |
| * @param {object|Array} object2 The second object to compare. | |
| * @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 {*} object An object to check. | |
| * @returns {boolean} | |
| */ | |
| function isObject(object) { | |
| return Object.prototype.toString.call(object) === '[object Object]'; | |
| } | |
| /** | |
| * @param {object} object The object on which to define the property. | |
| * @param {string} property The name of the property to be defined or modified. | |
| * @param {*} value The value associated with the property. | |
| * @param {object} options The descriptor for the property being defined or modified. | |
| */ | |
| 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; | |
| } | |
| /** | |
| * Set a property value on the provided object. Works on nested object prop names as well (e.g. `first.name`). | |
| * | |
| * @param {object} object Object to work on. | |
| * @param {string} name Prop name. | |
| * @param {*} value Value to be assigned at the provided property. | |
| */ | |
| function setProperty(object, name, value) { | |
| var names = name.split('.'); | |
| var workingObject = object; | |
| names.forEach(function (propName, index) { | |
| if (index !== names.length - 1) { | |
| if (!hasOwnProperty(workingObject, propName)) { | |
| workingObject[propName] = {}; | |
| } | |
| workingObject = workingObject[propName]; | |
| } else { | |
| workingObject[propName] = value; | |
| } | |
| }); | |
| } | |
| /** | |
| * 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 (value, key) { | |
| if (key === '__children') { | |
| return; | |
| } | |
| result += recursObjLen(value); | |
| }); | |
| } 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. | |
| * @returns {boolean} | |
| */ | |
| function hasOwnProperty(object, key) { | |
| return Object.prototype.hasOwnProperty.call(object, key); | |
| } | |
| /***/ }), | |
| /* 6 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var getBuiltIn = __webpack_require__(106); | |
| var aFunction = __webpack_require__(107); | |
| var anObject = __webpack_require__(47); | |
| var isObject = __webpack_require__(46); | |
| var create = __webpack_require__(109); | |
| var bind = __webpack_require__(503); | |
| var fails = __webpack_require__(32); | |
| var nativeConstruct = getBuiltIn('Reflect', 'construct'); | |
| // `Reflect.construct` method | |
| // https://tc39.es/ecma262/#sec-reflect.construct | |
| // MS Edge supports only 2 arguments and argumentsList argument is optional | |
| // FF Nightly sets third argument as `new.target`, but does not create `this` from it | |
| var NEW_TARGET_BUG = fails(function () { | |
| function F() { /* empty */ } | |
| return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F); | |
| }); | |
| var ARGS_BUG = !fails(function () { | |
| nativeConstruct(function () { /* empty */ }); | |
| }); | |
| var FORCED = NEW_TARGET_BUG || ARGS_BUG; | |
| $({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, { | |
| construct: function construct(Target, args /* , newTarget */) { | |
| aFunction(Target); | |
| anObject(args); | |
| var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); | |
| if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget); | |
| if (Target == newTarget) { | |
| // w/o altered newTarget, optimization for 0-4 arguments | |
| switch (args.length) { | |
| case 0: return new Target(); | |
| case 1: return new Target(args[0]); | |
| case 2: return new Target(args[0], args[1]); | |
| case 3: return new Target(args[0], args[1], args[2]); | |
| case 4: return new Target(args[0], args[1], args[2], args[3]); | |
| } | |
| // w/o altered newTarget, lot of arguments case | |
| var $args = [null]; | |
| $args.push.apply($args, args); | |
| return new (bind.apply(Target, $args))(); | |
| } | |
| // with altered newTarget, not support built-in constructors | |
| var proto = newTarget.prototype; | |
| var instance = create(isObject(proto) ? proto : Object.prototype); | |
| var result = Function.apply.call(Target, instance, args); | |
| return isObject(result) ? result : instance; | |
| } | |
| }); | |
| /***/ }), | |
| /* 7 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var setPrototypeOf = __webpack_require__(395); | |
| 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; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 8 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var _typeof = __webpack_require__(56)["default"]; | |
| 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; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 9 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var TO_STRING_TAG_SUPPORT = __webpack_require__(187); | |
| var redefine = __webpack_require__(83); | |
| var toString = __webpack_require__(496); | |
| // `Object.prototype.toString` method | |
| // https://tc39.es/ecma262/#sec-object.prototype.tostring | |
| if (!TO_STRING_TAG_SUPPORT) { | |
| redefine(Object.prototype, 'toString', toString, { unsafe: true }); | |
| } | |
| /***/ }), | |
| /* 10 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| 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.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.isDetached = isDetached; | |
| exports.HTML_CHARACTERS = void 0; | |
| var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(25)); | |
| __webpack_require__(192); | |
| __webpack_require__(26); | |
| __webpack_require__(34); | |
| __webpack_require__(33); | |
| __webpack_require__(17); | |
| __webpack_require__(30); | |
| __webpack_require__(29); | |
| __webpack_require__(61); | |
| __webpack_require__(128); | |
| __webpack_require__(52); | |
| __webpack_require__(73); | |
| __webpack_require__(129); | |
| __webpack_require__(51); | |
| __webpack_require__(9); | |
| __webpack_require__(19); | |
| var _feature = __webpack_require__(97); | |
| var _browser = __webpack_require__(84); | |
| var _string = __webpack_require__(75); | |
| /** | |
| * 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. | |
| * @returns {boolean} | |
| */ | |
| 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 {Array<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] The list of elements until the traversing ends. | |
| * @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 {HTMLElement} child Child element An element to check. | |
| * @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; | |
| } | |
| /** | |
| * 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 The element to check. | |
| * @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} overlayType The type of the overlay. | |
| * @param {HTMLElement} element An element to check. | |
| * @param {HTMLElement} root The root element. | |
| * @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; | |
| /** | |
| * @param {string} classNames The element "class" attribute string. | |
| * @returns {string[]} | |
| */ | |
| function filterEmptyClassNames(classNames) { | |
| if (!classNames || !classNames.length) { | |
| return []; | |
| } | |
| return classNames.filter(function (x) { | |
| return !!x; | |
| }); | |
| } | |
| 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 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$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 _className = element.className; | |
| var className = classes; | |
| if (typeof className === 'string') { | |
| className = className.split(' '); | |
| } | |
| className = filterEmptyClassNames(className); | |
| if (_className === '') { | |
| _className = className.join(' '); | |
| } else { | |
| for (var len = 0; len < className.length; len++) { | |
| if (className[len] && !createClassNameRegExp(className[len]).test(_className)) { | |
| _className += " ".concat(className[len]); | |
| } | |
| } | |
| } | |
| 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(' '); | |
| } | |
| className = filterEmptyClassNames(className); | |
| 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 An element to check. | |
| * @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 An element to process. | |
| * @param {string|Array} className Class name as string or array of strings. | |
| */ | |
| function addClass(element, className) { | |
| _addClass(element, className); | |
| } | |
| /** | |
| * Remove class name from an element. | |
| * | |
| * @param {HTMLElement} element An element to process. | |
| * @param {string|Array} className Class name as string or array of strings. | |
| */ | |
| function removeClass(element, className) { | |
| _removeClass(element, className); | |
| } | |
| /** | |
| * @param {HTMLElement} element An element from the text is removed. | |
| */ | |
| function removeTextNodes(element) { | |
| if (element.nodeType === 3) { | |
| element.parentNode.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 {HTMLElement} element An element to clear. | |
| */ | |
| 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. | |
| * | |
| * @param {HTMLElement} element An element to write into. | |
| * @param {string} content The text to write. | |
| * @param {boolean} [sanitizeContent=true] If `true`, the content will be sanitized before writing to the element. | |
| */ | |
| exports.HTML_CHARACTERS = HTML_CHARACTERS; | |
| function fastInnerHTML(element, content) { | |
| var sanitizeContent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | |
| if (HTML_CHARACTERS.test(content)) { | |
| element.innerHTML = sanitizeContent ? (0, _string.sanitize)(content) : content; | |
| } else { | |
| fastInnerText(element, content); | |
| } | |
| } | |
| /** | |
| * Insert text content into element. | |
| * | |
| * @param {HTMLElement} element An element to write into. | |
| * @param {string} content The text to write. | |
| */ | |
| 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 {HTMLElement} element An element to check. | |
| * @returns {boolean} | |
| */ | |
| function isVisible(element) { | |
| var documentElement = element.ownerDocument.documentElement; | |
| var next = element; | |
| while (next !== documentElement) { | |
| // until <html> 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} element An element to get the offset position from. | |
| * @returns {object} Returns object with `top` and `left` props. | |
| */ | |
| function offset(element) { | |
| var rootDocument = element.ownerDocument; | |
| var rootWindow = rootDocument.defaultView; | |
| var documentElement = rootDocument.documentElement; | |
| var elementToCheck = element; | |
| var offsetLeft; | |
| var offsetTop; | |
| var lastElem; | |
| var box; | |
| if ((0, _feature.hasCaptionProblem)() && elementToCheck.firstChild && elementToCheck.firstChild.nodeName === 'CAPTION') { | |
| // fixes problem with Firefox ignoring <caption> 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] The document window owner. | |
| * @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] The document window owner. | |
| * @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 {HTMLElement} element An element to get the scroll top position from. | |
| * @param {Window} [rootWindow] The document window owner. | |
| * @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 {HTMLElement} element An element to get the scroll left position from. | |
| * @param {Window} [rootWindow] The document window owner. | |
| * @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 An element to get the scrollable element from. | |
| * @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 An element to get the style from. | |
| * @param {string} prop Wanted property. | |
| * @param {Window} [rootWindow] The document window owner. | |
| * @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 {HTMLElement} element An element to get style from. | |
| * @param {Window} [rootWindow] The document window owner. | |
| * @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 {HTMLElement} element An element to get the width from. | |
| * @returns {number} Element's outer width. | |
| */ | |
| function outerWidth(element) { | |
| return Math.ceil(element.getBoundingClientRect().width); | |
| } | |
| /** | |
| * Returns the element's outer height. | |
| * | |
| * @param {HTMLElement} element An element to get the height from. | |
| * @returns {number} Element's outer height. | |
| */ | |
| function outerHeight(element) { | |
| if ((0, _feature.hasCaptionProblem)() && element.firstChild && element.firstChild.nodeName === 'CAPTION') { | |
| // fixes problem with Firefox ignoring <caption> 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 element.offsetHeight + element.firstChild.offsetHeight; | |
| } | |
| return element.offsetHeight; | |
| } | |
| /** | |
| * Returns the element's inner height. | |
| * | |
| * @param {HTMLElement} element An element to get the height from. | |
| * @returns {number} Element's inner height. | |
| */ | |
| function innerHeight(element) { | |
| return element.clientHeight || element.innerHeight; | |
| } | |
| /** | |
| * Returns the element's inner width. | |
| * | |
| * @param {HTMLElement} element An element to get the width from. | |
| * @returns {number} Element's inner width. | |
| */ | |
| function innerWidth(element) { | |
| return element.clientWidth || element.innerWidth; | |
| } | |
| /** | |
| * @param {HTMLElement} element An element to which the event is added. | |
| * @param {string} event The event name. | |
| * @param {Function} callback The callback to add. | |
| */ | |
| function addEvent(element, event, callback) { | |
| element.addEventListener(event, callback, false); | |
| } | |
| /** | |
| * @param {HTMLElement} element An element from which the event is removed. | |
| * @param {string} event The event name. | |
| * @param {Function} callback The function reference to remove. | |
| */ | |
| function removeEvent(element, event, callback) { | |
| element.removeEventListener(event, callback, false); | |
| } | |
| /** | |
| * Returns caret position in text input. | |
| * | |
| * @author https://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea | |
| * @param {HTMLElement} el An element to check. | |
| * @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. | |
| * | |
| * @param {HTMLElement} el An element to check. | |
| * @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] The document window owner. | |
| * @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] The document window owner. | |
| */ | |
| // 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 An element to process. | |
| * @param {number} pos The selection start position. | |
| * @param {number} endPos The selection end position. | |
| */ | |
| 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; | |
| } | |
| } | |
| } | |
| 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 The onwer of the document. | |
| * @returns {number} | |
| */ | |
| // 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] The owner of the document. | |
| * @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 An element to check. | |
| * @returns {boolean} | |
| */ | |
| function hasVerticalScrollbar(element) { | |
| return element.offsetWidth !== element.clientWidth; | |
| } | |
| /** | |
| * Checks if the provided element has a vertical scrollbar. | |
| * | |
| * @param {HTMLElement} element An element to check. | |
| * @returns {boolean} | |
| */ | |
| function hasHorizontalScrollbar(element) { | |
| return element.offsetHeight !== element.clientHeight; | |
| } | |
| /** | |
| * Sets overlay position depending on it's type and used browser. | |
| * | |
| * @param {HTMLElement} overlayElem An element to process. | |
| * @param {number} left The left position of the overlay. | |
| * @param {number} top The top position of the overlay. | |
| */ | |
| function setOverlayPosition(overlayElem, left, top) { | |
| if ((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)"); | |
| } | |
| } | |
| /** | |
| * @param {HTMLElement} element An element to process. | |
| * @returns {number|Array} | |
| */ | |
| 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; | |
| } | |
| /** | |
| * @param {HTMLElement} element An element to process. | |
| */ | |
| 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 which have defined 'data-hot-input' attribute. | |
| * | |
| * @param {HTMLElement} element - DOM element. | |
| * @returns {boolean} | |
| */ | |
| function isOutsideInput(element) { | |
| return isInput(element) && element.hasAttribute('data-hot-input') === false; | |
| } | |
| /** | |
| * 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(); | |
| } | |
| } | |
| /** | |
| * Check if the provided element is detached from DOM. | |
| * | |
| * @param {HTMLElement} element HTML element to be checked. | |
| * @returns {boolean} `true` if the element is detached, `false` otherwise. | |
| */ | |
| function isDetached(element) { | |
| return !element.parentNode; | |
| } | |
| /***/ }), | |
| /* 11 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var charAt = __webpack_require__(186).charAt; | |
| var InternalStateModule = __webpack_require__(95); | |
| var defineIterator = __webpack_require__(188); | |
| var STRING_ITERATOR = 'String Iterator'; | |
| var setInternalState = InternalStateModule.set; | |
| var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); | |
| // `String.prototype[@@iterator]` method | |
| // https://tc39.es/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.es/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 }; | |
| }); | |
| /***/ }), | |
| /* 12 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var toIndexedObject = __webpack_require__(74); | |
| var addToUnscopables = __webpack_require__(127); | |
| var Iterators = __webpack_require__(126); | |
| var InternalStateModule = __webpack_require__(95); | |
| var defineIterator = __webpack_require__(188); | |
| var ARRAY_ITERATOR = 'Array Iterator'; | |
| var setInternalState = InternalStateModule.set; | |
| var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); | |
| // `Array.prototype.entries` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.entries | |
| // `Array.prototype.keys` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.keys | |
| // `Array.prototype.values` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.values | |
| // `Array.prototype[@@iterator]` method | |
| // https://tc39.es/ecma262/#sec-array.prototype-@@iterator | |
| // `CreateArrayIterator` internal method | |
| // https://tc39.es/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.es/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.es/ecma262/#sec-createunmappedargumentsobject | |
| // https://tc39.es/ecma262/#sec-createmappedargumentsobject | |
| Iterators.Arguments = Iterators.Array; | |
| // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables | |
| addToUnscopables('keys'); | |
| addToUnscopables('values'); | |
| addToUnscopables('entries'); | |
| /***/ }), | |
| /* 13 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var global = __webpack_require__(40); | |
| var DOMIterables = __webpack_require__(250); | |
| var ArrayIteratorMethods = __webpack_require__(12); | |
| var createNonEnumerableProperty = __webpack_require__(82); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| 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]; | |
| } | |
| } | |
| } | |
| } | |
| /***/ }), | |
| /* 14 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var _typeof = __webpack_require__(56)["default"]; | |
| 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; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 15 */ | |
| /***/ (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"); // eslint-disable-line max-len | |
| 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"); // eslint-disable-line max-len | |
| 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; | |
| /***/ }), | |
| /* 16 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var superPropBase = __webpack_require__(544); | |
| function _get(target, property, receiver) { | |
| if (typeof Reflect !== "undefined" && Reflect.get) { | |
| module.exports = _get = Reflect.get; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| } 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; | |
| }; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| } | |
| return _get(target, property, receiver || target); | |
| } | |
| module.exports = _get; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 17 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| /* eslint-disable es/no-array-prototype-indexof -- required for testing */ | |
| var $ = __webpack_require__(21); | |
| var $indexOf = __webpack_require__(175).indexOf; | |
| var arrayMethodIsStrict = __webpack_require__(108); | |
| var nativeIndexOf = [].indexOf; | |
| var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; | |
| var STRICT_METHOD = arrayMethodIsStrict('indexOf'); | |
| // `Array.prototype.indexOf` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.indexof | |
| $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, { | |
| indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { | |
| return NEGATIVE_ZERO | |
| // convert -0 to +0 | |
| ? nativeIndexOf.apply(this, arguments) || 0 | |
| : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined); | |
| } | |
| }); | |
| /***/ }), | |
| /* 18 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var arrayWithHoles = __webpack_require__(251); | |
| var iterableToArrayLimit = __webpack_require__(491); | |
| var unsupportedIterableToArray = __webpack_require__(191); | |
| var nonIterableRest = __webpack_require__(253); | |
| function _slicedToArray(arr, i) { | |
| return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); | |
| } | |
| module.exports = _slicedToArray; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 19 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var fails = __webpack_require__(32); | |
| var isArray = __webpack_require__(121); | |
| var isObject = __webpack_require__(46); | |
| var toObject = __webpack_require__(68); | |
| var toLength = __webpack_require__(58); | |
| var createProperty = __webpack_require__(122); | |
| var arraySpeciesCreate = __webpack_require__(178); | |
| var arrayMethodHasSpeciesSupport = __webpack_require__(123); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var V8_VERSION = __webpack_require__(153); | |
| 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.es/ecma262/#sec-array.prototype.concat | |
| // with adding support of @@isConcatSpreadable and @@species | |
| $({ target: 'Array', proto: true, forced: FORCED }, { | |
| // eslint-disable-next-line no-unused-vars -- required for `.length` | |
| concat: function concat(arg) { | |
| 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__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| 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__(63)); | |
| __webpack_require__(9); | |
| __webpack_require__(52); | |
| __webpack_require__(497); | |
| __webpack_require__(29); | |
| __webpack_require__(51); | |
| __webpack_require__(61); | |
| __webpack_require__(259); | |
| var _typeof2 = _interopRequireDefault(__webpack_require__(56)); | |
| var _moment = _interopRequireDefault(__webpack_require__(76)); | |
| var _templateLiteralTag = __webpack_require__(64); | |
| var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6; | |
| /** | |
| * Converts any value to string. | |
| * | |
| * @param {*} value The value to stringify. | |
| * @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 || (_templateObject = (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."]))); | |
| }, | |
| expired: function expired(_ref) { | |
| var keyValidityDate = _ref.keyValidityDate, | |
| hotVersion = _ref.hotVersion; | |
| return (0, _templateLiteralTag.toSingleLine)(_templateObject2 || (_templateObject2 = (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."])), keyValidityDate, hotVersion, keyValidityDate); | |
| }, | |
| missing: function missing() { | |
| return (0, _templateLiteralTag.toSingleLine)(_templateObject3 || (_templateObject3 = (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."]))); | |
| }, | |
| non_commercial: function non_commercial() { | |
| return ''; | |
| } | |
| }; | |
| var domMessages = { | |
| invalid: function invalid() { | |
| return (0, _templateLiteralTag.toSingleLine)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable is invalid. \n <a href=\"https://handsontable.com/docs/tutorial-license-key.html\" target=\"_blank\">Read more</a> on how to \n install it properly or contact us at <a href=\"mailto:support@handsontable.com\">support@handsontable.com</a>."], ["\n The license key for Handsontable is invalid.\\x20\n <a href=\"https://handsontable.com/docs/tutorial-license-key.html\" target=\"_blank\">Read more</a> on how to\\x20\n install it properly or contact us at <a href=\"mailto:support@handsontable.com\">support@handsontable.com</a>."]))); | |
| }, | |
| expired: function expired(_ref2) { | |
| var keyValidityDate = _ref2.keyValidityDate, | |
| hotVersion = _ref2.hotVersion; | |
| return (0, _templateLiteralTag.toSingleLine)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable expired on ", ", and is not valid for the installed \n version ", ". <a href=\"https://handsontable.com/pricing\" target=\"_blank\">Renew</a> your \n license key or downgrade to a version released prior to ", ". If you need any \n help, contact us at <a href=\"mailto:sales@handsontable.com\">sales@handsontable.com</a>."], ["\n The license key for Handsontable expired on ", ", and is not valid for the installed\\x20\n version ", ". <a href=\"https://handsontable.com/pricing\" target=\"_blank\">Renew</a> your\\x20\n license key or downgrade to a version released prior to ", ". If you need any\\x20\n help, contact us at <a href=\"mailto:sales@handsontable.com\">sales@handsontable.com</a>."])), keyValidityDate, hotVersion, keyValidityDate); | |
| }, | |
| missing: function missing() { | |
| return (0, _templateLiteralTag.toSingleLine)(_templateObject6 || (_templateObject6 = (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 <a href=\"https://handsontable.com/docs/tutorial-license-key.html\" target=\"_blank\">Read more</a> about it in \n the documentation or contact us at <a href=\"mailto:support@handsontable.com\">support@handsontable.com</a>."], ["\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 <a href=\"https://handsontable.com/docs/tutorial-license-key.html\" target=\"_blank\">Read more</a> about it in\\x20\n the documentation or contact us at <a href=\"mailto:support@handsontable.com\">support@handsontable.com</a>."]))); | |
| }, | |
| 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 = "8.4.0"; | |
| 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)("11/05/2021", '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 */ | |
| /***/ }), | |
| /* 21 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var global = __webpack_require__(40); | |
| var getOwnPropertyDescriptor = __webpack_require__(93).f; | |
| var createNonEnumerableProperty = __webpack_require__(82); | |
| var redefine = __webpack_require__(83); | |
| var setGlobal = __webpack_require__(173); | |
| var copyConstructorProperties = __webpack_require__(232); | |
| var isForced = __webpack_require__(152); | |
| /* | |
| 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); | |
| } | |
| }; | |
| /***/ }), | |
| /* 22 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var global = __webpack_require__(40); | |
| var redefineAll = __webpack_require__(198); | |
| var InternalMetadataModule = __webpack_require__(130); | |
| var collection = __webpack_require__(158); | |
| var collectionWeak = __webpack_require__(388); | |
| var isObject = __webpack_require__(46); | |
| var enforceIternalState = __webpack_require__(95).enforce; | |
| var NATIVE_WEAK_MAP = __webpack_require__(231); | |
| var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; | |
| // eslint-disable-next-line es/no-object-isextensible -- safe | |
| 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.es/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; | |
| } | |
| }); | |
| } | |
| /***/ }), | |
| /* 23 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var global = __webpack_require__(40); | |
| var DOMIterables = __webpack_require__(250); | |
| var forEach = __webpack_require__(487); | |
| var createNonEnumerableProperty = __webpack_require__(82); | |
| for (var COLLECTION_NAME in DOMIterables) { | |
| var Collection = global[COLLECTION_NAME]; | |
| var CollectionPrototype = Collection && Collection.prototype; | |
| // some Chrome versions have non-configurable methods on DOMTokenList | |
| if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try { | |
| createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach); | |
| } catch (error) { | |
| CollectionPrototype.forEach = forEach; | |
| } | |
| } | |
| /***/ }), | |
| /* 24 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.isNumeric = isNumeric; | |
| exports.rangeEach = rangeEach; | |
| exports.rangeEachReverse = rangeEachReverse; | |
| exports.valueAccordingPercent = valueAccordingPercent; | |
| __webpack_require__(29); | |
| __webpack_require__(51); | |
| __webpack_require__(9); | |
| __webpack_require__(52); | |
| var _typeof2 = _interopRequireDefault(__webpack_require__(56)); | |
| /** | |
| * Checks if value of n is a numeric one | |
| * http://jsperf.com/isnan-vs-isnumeric/4. | |
| * | |
| * @param {*} value The value to check. | |
| * @returns {boolean} | |
| */ | |
| function isNumeric(value) { | |
| /* eslint-disable */ | |
| var t = (0, _typeof2.default)(value); | |
| return t == 'number' ? !isNaN(value) && isFinite(value) : t == 'string' ? !value.length ? false : value.length == 1 ? /\d/.test(value) : /^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(value) : t == 'object' ? !!value && typeof value.valueOf() == 'number' && !(value 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; | |
| } | |
| /***/ }), | |
| /* 25 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var arrayWithoutHoles = __webpack_require__(492); | |
| var iterableToArray = __webpack_require__(254); | |
| var unsupportedIterableToArray = __webpack_require__(191); | |
| var nonIterableSpread = __webpack_require__(493); | |
| function _toConsumableArray(arr) { | |
| return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); | |
| } | |
| module.exports = _toConsumableArray; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 26 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var $includes = __webpack_require__(175).includes; | |
| var addToUnscopables = __webpack_require__(127); | |
| // `Array.prototype.includes` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.includes | |
| $({ target: 'Array', proto: true }, { | |
| includes: function includes(el /* , fromIndex = 0 */) { | |
| return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); | |
| } | |
| }); | |
| // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables | |
| addToUnscopables('includes'); | |
| /***/ }), | |
| /* 27 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.BasePlugin = exports.PLUGIN_KEY = void 0; | |
| var _base = __webpack_require__(630); | |
| exports.PLUGIN_KEY = _base.PLUGIN_KEY; | |
| exports.BasePlugin = _base.BasePlugin; | |
| /***/ }), | |
| /* 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; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 29 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var exec = __webpack_require__(182); | |
| // `RegExp.prototype.exec` method | |
| // https://tc39.es/ecma262/#sec-regexp.prototype.exec | |
| $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, { | |
| exec: exec | |
| }); | |
| /***/ }), | |
| /* 30 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var $filter = __webpack_require__(102).filter; | |
| var arrayMethodHasSpeciesSupport = __webpack_require__(123); | |
| var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); | |
| // `Array.prototype.filter` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.filter | |
| // with adding support of @@species | |
| $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { | |
| filter: function filter(callbackfn /* , thisArg */) { | |
| return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); | |
| } | |
| }); | |
| /***/ }), | |
| /* 31 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.getListenersCounter = getListenersCounter; | |
| exports.default = void 0; | |
| __webpack_require__(41); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _feature = __webpack_require__(97); | |
| var _event = __webpack_require__(45); | |
| /** | |
| * 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] An object to which event listeners will be stored. | |
| * @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; | |
| /** | |
| * @param {Event} event The event object. | |
| */ | |
| function callbackProxy(event) { | |
| callback.call(this, extendEvent(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; | |
| }(); | |
| /** | |
| * @private | |
| * @param {Event} event The event object. | |
| * @returns {Event} | |
| */ | |
| function extendEvent(event) { | |
| var nativeStopImmediatePropagation = event.stopImmediatePropagation; | |
| event.stopImmediatePropagation = function () { | |
| nativeStopImmediatePropagation.apply(this); | |
| (0, _event.stopImmediatePropagation)(this); | |
| }; | |
| return event; | |
| } | |
| var _default = EventManager; | |
| /** | |
| * @returns {number} | |
| */ | |
| exports.default = _default; | |
| function getListenersCounter() { | |
| return listenersCounter; | |
| } | |
| /***/ }), | |
| /* 32 */ | |
| /***/ (function(module, exports) { | |
| module.exports = function (exec) { | |
| try { | |
| return !!exec(); | |
| } catch (error) { | |
| return true; | |
| } | |
| }; | |
| /***/ }), | |
| /* 33 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var isObject = __webpack_require__(46); | |
| var isArray = __webpack_require__(121); | |
| var toAbsoluteIndex = __webpack_require__(151); | |
| var toLength = __webpack_require__(58); | |
| var toIndexedObject = __webpack_require__(74); | |
| var createProperty = __webpack_require__(122); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var arrayMethodHasSpeciesSupport = __webpack_require__(123); | |
| var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice'); | |
| var SPECIES = wellKnownSymbol('species'); | |
| var nativeSlice = [].slice; | |
| var max = Math.max; | |
| // `Array.prototype.slice` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.slice | |
| // fallback for not array-like ES3 strings and DOM objects | |
| $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { | |
| 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; | |
| } | |
| }); | |
| /***/ }), | |
| /* 34 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var notARegExp = __webpack_require__(193); | |
| var requireObjectCoercible = __webpack_require__(67); | |
| var correctIsRegExpLogic = __webpack_require__(195); | |
| // `String.prototype.includes` method | |
| // https://tc39.es/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); | |
| } | |
| }); | |
| /***/ }), | |
| /* 35 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var toObject = __webpack_require__(68); | |
| var nativeKeys = __webpack_require__(124); | |
| var fails = __webpack_require__(32); | |
| var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); }); | |
| // `Object.keys` method | |
| // https://tc39.es/ecma262/#sec-object.keys | |
| $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { | |
| keys: function keys(it) { | |
| return nativeKeys(toObject(it)); | |
| } | |
| }); | |
| /***/ }), | |
| /* 36 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.getCondition = getCondition; | |
| exports.getConditionDescriptor = getConditionDescriptor; | |
| exports.registerCondition = registerCondition; | |
| exports.conditions = void 0; | |
| __webpack_require__(19); | |
| 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 | |
| }; | |
| } | |
| /***/ }), | |
| /* 37 */ | |
| /***/ (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; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 38 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireWildcard = __webpack_require__(14); | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.Renderer = void 0; | |
| var _viewportColumns = _interopRequireDefault(__webpack_require__(389)); | |
| exports.ViewportColumnsCalculator = _viewportColumns.default; | |
| var _viewportRows = _interopRequireDefault(__webpack_require__(390)); | |
| exports.ViewportRowsCalculator = _viewportRows.default; | |
| var _coords = _interopRequireDefault(__webpack_require__(131)); | |
| exports.CellCoords = _coords.default; | |
| var _range = _interopRequireDefault(__webpack_require__(391)); | |
| exports.CellRange = _range.default; | |
| var _column = _interopRequireDefault(__webpack_require__(392)); | |
| exports.ColumnFilter = _column.default; | |
| var _row = _interopRequireDefault(__webpack_require__(393)); | |
| exports.RowFilter = _row.default; | |
| var _master = _interopRequireDefault(__webpack_require__(394)); | |
| exports.MasterTable = _master.default; | |
| var _overlay = __webpack_require__(401); | |
| exports.LeftOverlay = _overlay.LeftOverlay; | |
| exports.TopOverlay = _overlay.TopOverlay; | |
| exports.TopLeftCornerOverlay = _overlay.TopLeftCornerOverlay; | |
| exports.BottomOverlay = _overlay.BottomOverlay; | |
| exports.BottomLeftCornerOverlay = _overlay.BottomLeftCornerOverlay; | |
| var _border = _interopRequireDefault(__webpack_require__(404)); | |
| exports.Border = _border.default; | |
| var _core = _interopRequireDefault(__webpack_require__(527)); | |
| exports.default = _core.default; | |
| exports.Core = _core.default; | |
| var _event = _interopRequireDefault(__webpack_require__(405)); | |
| exports.Event = _event.default; | |
| var _overlays = _interopRequireDefault(__webpack_require__(406)); | |
| exports.Overlays = _overlays.default; | |
| var _scroll = _interopRequireDefault(__webpack_require__(407)); | |
| exports.Scroll = _scroll.default; | |
| var _selection = _interopRequireDefault(__webpack_require__(529)); | |
| exports.Selection = _selection.default; | |
| var _settings = _interopRequireDefault(__webpack_require__(408)); | |
| exports.Settings = _settings.default; | |
| var Renderer = _interopRequireWildcard(__webpack_require__(396)); | |
| exports.Renderer = Renderer; | |
| var _orderView = __webpack_require__(159); | |
| exports.OrderView = _orderView.OrderView; | |
| exports.SharedOrderView = _orderView.SharedOrderView; | |
| var _viewport = _interopRequireDefault(__webpack_require__(409)); | |
| exports.Viewport = _viewport.default; | |
| var _eventManager = __webpack_require__(31); | |
| exports.getListenersCounter = _eventManager.getListenersCounter; | |
| /***/ }), | |
| /* 39 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var collection = __webpack_require__(158); | |
| var collectionStrong = __webpack_require__(257); | |
| // `Map` constructor | |
| // https://tc39.es/ecma262/#sec-map-objects | |
| module.exports = collection('Map', function (init) { | |
| return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; | |
| }, collectionStrong); | |
| /***/ }), | |
| /* 40 */ | |
| /***/ (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 es/no-global-this -- safe | |
| check(typeof globalThis == 'object' && globalThis) || | |
| check(typeof window == 'object' && window) || | |
| // eslint-disable-next-line no-restricted-globals -- safe | |
| check(typeof self == 'object' && self) || | |
| check(typeof global == 'object' && global) || | |
| // eslint-disable-next-line no-new-func -- fallback | |
| (function () { return this; })() || Function('return this')(); | |
| /***/ }), | |
| /* 41 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var toAbsoluteIndex = __webpack_require__(151); | |
| var toInteger = __webpack_require__(96); | |
| var toLength = __webpack_require__(58); | |
| var toObject = __webpack_require__(68); | |
| var arraySpeciesCreate = __webpack_require__(178); | |
| var createProperty = __webpack_require__(122); | |
| var arrayMethodHasSpeciesSupport = __webpack_require__(123); | |
| var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); | |
| 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.es/ecma262/#sec-array.prototype.splice | |
| // with adding support of @@species | |
| $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { | |
| 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; | |
| } | |
| }); | |
| /***/ }), | |
| /* 42 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var global = __webpack_require__(40); | |
| var shared = __webpack_require__(149); | |
| var has = __webpack_require__(65); | |
| var uid = __webpack_require__(150); | |
| var NATIVE_SYMBOL = __webpack_require__(179); | |
| var USE_SYMBOL_AS_UID = __webpack_require__(238); | |
| 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) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) { | |
| if (NATIVE_SYMBOL && has(Symbol, name)) { | |
| WellKnownSymbolsStore[name] = Symbol[name]; | |
| } else { | |
| WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); | |
| } | |
| } return WellKnownSymbolsStore[name]; | |
| }; | |
| /***/ }), | |
| /* 43 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var from = __webpack_require__(484); | |
| var checkCorrectnessOfIteration = __webpack_require__(247); | |
| var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { | |
| // eslint-disable-next-line es/no-array-from -- required for testing | |
| Array.from(iterable); | |
| }); | |
| // `Array.from` method | |
| // https://tc39.es/ecma262/#sec-array.from | |
| $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { | |
| from: from | |
| }); | |
| /***/ }), | |
| /* 44 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var global = __webpack_require__(40); | |
| var userAgent = __webpack_require__(154); | |
| 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 -- spec requirement | |
| (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) | |
| }); | |
| /***/ }), | |
| /* 45 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.stopImmediatePropagation = stopImmediatePropagation; | |
| exports.isImmediatePropagationStopped = isImmediatePropagationStopped; | |
| exports.isRightClick = isRightClick; | |
| exports.isLeftClick = isLeftClick; | |
| /** | |
| * Prevent other listeners of the same event from being called. | |
| * | |
| * @param {Event} event The mouse event object. | |
| */ | |
| function stopImmediatePropagation(event) { | |
| event.isImmediatePropagationEnabled = false; | |
| event.cancelBubble = true; | |
| } | |
| /** | |
| * Check if event was stopped by `stopImmediatePropagation`. | |
| * | |
| * @param {Event} event The mouse event object. | |
| * @returns {boolean} | |
| */ | |
| function isImmediatePropagationStopped(event) { | |
| return event.isImmediatePropagationEnabled === false; | |
| } | |
| /** | |
| * Check if provided event was triggered by clicking the right mouse button. | |
| * | |
| * @param {Event} event The mouse event object. | |
| * @returns {boolean} | |
| */ | |
| function isRightClick(event) { | |
| return event.button === 2; | |
| } | |
| /** | |
| * Check if provided event was triggered by clicking the left mouse button. | |
| * | |
| * @param {Event} event The mouse event object. | |
| * @returns {boolean} | |
| */ | |
| function isLeftClick(event) { | |
| return event.button === 0; | |
| } | |
| /***/ }), | |
| /* 46 */ | |
| /***/ (function(module, exports) { | |
| module.exports = function (it) { | |
| return typeof it === 'object' ? it !== null : typeof it === 'function'; | |
| }; | |
| /***/ }), | |
| /* 47 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var isObject = __webpack_require__(46); | |
| module.exports = function (it) { | |
| if (!isObject(it)) { | |
| throw TypeError(String(it) + ' is not an object'); | |
| } return it; | |
| }; | |
| /***/ }), | |
| /* 48 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| __webpack_require__(12); | |
| __webpack_require__(39); | |
| __webpack_require__(9); | |
| __webpack_require__(11); | |
| __webpack_require__(13); | |
| __webpack_require__(17); | |
| __webpack_require__(41); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(63)); | |
| var _array = __webpack_require__(3); | |
| var _object = __webpack_require__(5); | |
| var _string = __webpack_require__(75); | |
| var _console = __webpack_require__(69); | |
| var _templateLiteralTag = __webpack_require__(64); | |
| var _templateObject; | |
| /** | |
| * @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://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| * @example | |
| * ```js | |
| * new Handsontable(element, { | |
| * afterChange: (changes) => { | |
| * changes.forEach(([row, prop, oldValue, newValue]) => { | |
| * // Some logic... | |
| * }); | |
| * } | |
| * }) | |
| * ``` | |
| */ | |
| 'afterChange', | |
| /** | |
| * Fired by {@link ObserveChanges} plugin after detecting changes in the data source. This hook is fired when | |
| * {@link Options#observeChanges} option is enabled. | |
| * | |
| * @event Hooks#afterChangesObserved | |
| */ | |
| 'afterChangesObserved', | |
| /** | |
| * Fired each time user opens {@link ContextMenu} and after setting up the Context Menu's default options. These options are a collection | |
| * which user can select by setting an array of keys or an array of objects in {@link Options#contextMenu} option. | |
| * | |
| * @event Hooks#afterContextMenuDefaultOptions | |
| * @param {Array} predefinedItems An array of objects containing information about the pre-defined Context Menu items. | |
| */ | |
| 'afterContextMenuDefaultOptions', | |
| /** | |
| * Fired each time user opens {@link ContextMenu} plugin before setting up the Context Menu's items but after filtering these options by | |
| * user (`contextMenu` option). This hook can by helpful to determine if user use specified menu item or to set up | |
| * one of the menu item to by always visible. | |
| * | |
| * @event Hooks#beforeContextMenuSetItems | |
| * @param {object[]} menuItems An array of objects containing information about to generated Context Menu items. | |
| */ | |
| 'beforeContextMenuSetItems', | |
| /** | |
| * Fired by {@link DropdownMenu} plugin after setting up the Dropdown Menu's default options. These options are a | |
| * collection which user can select by setting an array of keys or an array of objects in {@link Options#dropdownMenu} | |
| * option. | |
| * | |
| * @event Hooks#afterDropdownMenuDefaultOptions | |
| * @param {object[]} predefinedItems An array of objects containing information about the pre-defined Context Menu items. | |
| */ | |
| 'afterDropdownMenuDefaultOptions', | |
| /** | |
| * Fired by {@link DropdownMenu} plugin before setting up the Dropdown Menu's items but after filtering these options | |
| * by user (`dropdownMenu` option). This hook can by helpful to determine if user use specified menu item or to set | |
| * up one of the menu item to by always visible. | |
| * | |
| * @event Hooks#beforeDropdownMenuSetItems | |
| * @param {object[]} menuItems An array of objects containing information about to generated Dropdown Menu items. | |
| */ | |
| 'beforeDropdownMenuSetItems', | |
| /** | |
| * Fired by {@link ContextMenu} plugin after hiding the Context Menu. This hook is fired when {@link Options#contextMenu} | |
| * option is enabled. | |
| * | |
| * @event Hooks#afterContextMenuHide | |
| * @param {object} context The Context Menu plugin instance. | |
| */ | |
| 'afterContextMenuHide', | |
| /** | |
| * Fired by {@link ContextMenu} plugin before opening the Context Menu. This hook is fired when {@link Options#contextMenu} | |
| * option is enabled. | |
| * | |
| * @event Hooks#beforeContextMenuShow | |
| * @param {object} context The Context Menu instance. | |
| */ | |
| 'beforeContextMenuShow', | |
| /** | |
| * Fired by {@link ContextMenu} plugin after opening the Context Menu. This hook is fired when {@link Options#contextMenu} | |
| * option is enabled. | |
| * | |
| * @event Hooks#afterContextMenuShow | |
| * @param {object} context The Context Menu plugin instance. | |
| */ | |
| 'afterContextMenuShow', | |
| /** | |
| * Fired by {@link CopyPaste} plugin after reaching the copy limit while copying data. This hook is fired when | |
| * {@link Options#copyPaste} option is enabled. | |
| * | |
| * @event Hooks#afterCopyLimit | |
| * @param {number} selectedRows Count of selected copyable rows. | |
| * @param {number} selectedColumns Count of selected copyable columns. | |
| * @param {number} copyRowsLimit Current copy rows limit. | |
| * @param {number} copyColumnsLimit Current copy columns limit. | |
| */ | |
| 'afterCopyLimit', | |
| /** | |
| * Fired before created a new column. | |
| * | |
| * @event Hooks#beforeCreateCol | |
| * @param {number} index Represents the visual index of first newly created column in the data source array. | |
| * @param {number} amount Number of newly created columns in the data source array. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link http://docs.handsontable.com/tutorial-using-callbacks.html#page-source-definition}). | |
| * @returns {*} If `false` then creating columns is cancelled. | |
| * @example | |
| * ```js | |
| * // Return `false` to cancel column inserting. | |
| * new Handsontable(element, { | |
| * beforeCreateCol: function(data, coords) { | |
| * return false; | |
| * } | |
| * }); | |
| * ``` | |
| */ | |
| 'beforeCreateCol', | |
| /** | |
| * Fired after created a new column. | |
| * | |
| * @event Hooks#afterCreateCol | |
| * @param {number} index Represents the visual index of first newly created column in the data source. | |
| * @param {number} amount Number of newly created columns in the data source. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link https://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| */ | |
| 'afterCreateCol', | |
| /** | |
| * Fired before created a new row. | |
| * | |
| * @event Hooks#beforeCreateRow | |
| * @param {number} index Represents the visual index of first newly created row in the data source array. | |
| * @param {number} amount Number of newly created rows in the data source array. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link https://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| * @returns {*|boolean} If false is returned the action is canceled. | |
| */ | |
| 'beforeCreateRow', | |
| /** | |
| * Fired after created a new row. | |
| * | |
| * @event Hooks#afterCreateRow | |
| * @param {number} index Represents the visual index of first newly created row in the data source array. | |
| * @param {number} amount Number of newly created rows in the data source array. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link https://handsontable.com/docs/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 {Array} sourceData Array of arrays or array of objects containing data. | |
| * @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://handsontable.com/docs/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://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| */ | |
| 'afterRemoveRow', | |
| /** | |
| * Fired after the Handsontable table is rendered. | |
| * | |
| * @event Hooks#afterRender | |
| * @param {boolean} isForced Is `true` if rendering was triggered by a change of settings or data; or `false` if | |
| * rendering was triggered by scrolling or moving selection. | |
| */ | |
| 'afterRender', | |
| /** | |
| * Fired before starting rendering the cell. | |
| * | |
| * @event Hooks#beforeRenderer | |
| * @param {HTMLTableCellElement} TD Currently rendered cell's TD element. | |
| * @param {number} row Visual row index. | |
| * @param {number} column Visual column index. | |
| * @param {string|number} prop Column property name or a column index, if datasource is an array of arrays. | |
| * @param {*} value Value of the rendered cell. | |
| * @param {object} cellProperties Object containing the cell's properties. | |
| */ | |
| 'beforeRenderer', | |
| /** | |
| * Fired after finishing rendering the cell (after the renderer finishes). | |
| * | |
| * @event Hooks#afterRenderer | |
| * @param {HTMLTableCellElement} TD Currently rendered cell's TD element. | |
| * @param {number} row Visual row index. | |
| * @param {number} column Visual column index. | |
| * @param {string|number} prop Column property name or a column index, if datasource is an array of arrays. | |
| * @param {*} value Value of the rendered cell. | |
| * @param {object} cellProperties Object containing the cell's properties. | |
| */ | |
| 'afterRenderer', | |
| /** | |
| * Fired after the horizontal scroll event. | |
| * | |
| * @event Hooks#afterScrollHorizontally | |
| */ | |
| 'afterScrollHorizontally', | |
| /** | |
| * Fired after the vertical scroll event. | |
| * | |
| * @event Hooks#afterScrollVertically | |
| */ | |
| 'afterScrollVertically', | |
| /** | |
| * Fired after one or more cells are selected (e.g. During mouse move). | |
| * | |
| * @event Hooks#afterSelection | |
| * @param {number} row Selection start visual row index. | |
| * @param {number} column Selection start visual column index. | |
| * @param {number} row2 Selection end visual row index. | |
| * @param {number} column2 Selection end visual column index. | |
| * @param {object} preventScrolling Object with `value` property where its value change will be observed. | |
| * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified. | |
| * @example | |
| * ```js | |
| * new Handsontable(element, { | |
| * afterSelection: (row, column, row2, column2, preventScrolling, selectionLayerLevel) => { | |
| * // setting if prevent scrolling after selection | |
| * preventScrolling.value = true; | |
| * } | |
| * }) | |
| * ``` | |
| */ | |
| 'afterSelection', | |
| /** | |
| * Fired after one or more cells are selected. | |
| * | |
| * The `prop` and `prop2` arguments represent the source object property name instead of the column number. | |
| * | |
| * @event Hooks#afterSelectionByProp | |
| * @param {number} row Selection start visual row index. | |
| * @param {string} prop Selection start data source object property name. | |
| * @param {number} row2 Selection end visual row index. | |
| * @param {string} prop2 Selection end data source object property name. | |
| * @param {object} preventScrolling Object with `value` property where its value change will be observed. | |
| * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified. | |
| * @example | |
| * ```js | |
| * new Handsontable(element, { | |
| * afterSelectionByProp: (row, column, row2, column2, preventScrolling, selectionLayerLevel) => { | |
| * // setting if prevent scrolling after selection | |
| * preventScrolling.value = true; | |
| * } | |
| * }) | |
| * ``` | |
| */ | |
| 'afterSelectionByProp', | |
| /** | |
| * Fired after one or more cells are selected (e.g. On mouse up). | |
| * | |
| * @event Hooks#afterSelectionEnd | |
| * @param {number} row Selection start visual row index. | |
| * @param {number} column Selection start visual column index. | |
| * @param {number} row2 Selection end visual row index. | |
| * @param {number} column2 Selection end visual column index. | |
| * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified. | |
| */ | |
| 'afterSelectionEnd', | |
| /** | |
| * Fired after one or more cells are selected (e.g. On mouse up). | |
| * | |
| * The `prop` and `prop2` arguments represent the source object property name instead of the column number. | |
| * | |
| * @event Hooks#afterSelectionEndByProp | |
| * @param {number} row Selection start visual row index. | |
| * @param {string} prop Selection start data source object property index. | |
| * @param {number} row2 Selection end visual row index. | |
| * @param {string} prop2 Selection end data source object property index. | |
| * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified. | |
| */ | |
| 'afterSelectionEndByProp', | |
| /** | |
| * Fired after cell meta is changed. | |
| * | |
| * @event Hooks#afterSetCellMeta | |
| * @param {number} row Visual row index. | |
| * @param {number} column Visual column index. | |
| * @param {string} key The updated meta key. | |
| * @param {*} value The updated meta value. | |
| */ | |
| 'afterSetCellMeta', | |
| /** | |
| * Fired after cell meta is removed. | |
| * | |
| * @event Hooks#afterRemoveCellMeta | |
| * @param {number} row Visual row index. | |
| * @param {number} column Visual column index. | |
| * @param {string} key The removed meta key. | |
| * @param {*} value Value which was under removed key of cell meta. | |
| */ | |
| 'afterRemoveCellMeta', | |
| /** | |
| * Fired after cell data was changed. | |
| * | |
| * @event Hooks#afterSetDataAtCell | |
| * @param {Array} changes An array of changes in format `[[row, column, oldValue, value], ...]`. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link https://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| */ | |
| 'afterSetDataAtCell', | |
| /** | |
| * Fired after cell data was changed. | |
| * Called only when `setDataAtRowProp` was executed. | |
| * | |
| * @event Hooks#afterSetDataAtRowProp | |
| * @param {Array} changes An array of changes in format `[[row, prop, oldValue, value], ...]`. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link https://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| */ | |
| 'afterSetDataAtRowProp', | |
| /** | |
| * Fired after cell source data was changed. | |
| * | |
| * @event Hooks#afterSetSourceDataAtCell | |
| * @since 8.0.0 | |
| * @param {Array} changes An array of changes in format `[[row, column, oldValue, value], ...]`. | |
| * @param {string} [source] String that identifies source of hook call. | |
| */ | |
| 'afterSetSourceDataAtCell', | |
| /** | |
| * Fired after calling the `updateSettings` method. | |
| * | |
| * @event Hooks#afterUpdateSettings | |
| * @param {object} newSettings New settings object. | |
| */ | |
| 'afterUpdateSettings', | |
| /** | |
| * @description | |
| * A plugin hook executed after validator function, only if validator function is defined. | |
| * Validation result is the first parameter. This can be used to determinate if validation passed successfully or not. | |
| * | |
| * __Returning false from the callback will mark the cell as invalid__. | |
| * | |
| * @event Hooks#afterValidate | |
| * @param {boolean} isValid `true` if valid, `false` if not. | |
| * @param {*} value The value in question. | |
| * @param {number} row Visual row index. | |
| * @param {string|number} prop Property name / visual column index. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link https://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| * @returns {void | boolean} If `false` the cell will be marked as invalid, `true` otherwise. | |
| */ | |
| '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"]]`. | |
| * @returns {*|boolean} If false is returned the action is canceled. | |
| */ | |
| 'beforeAutofill', | |
| /** | |
| * Fired by {@link Autofill} plugin after populating the data in the autofill feature. This hook is fired when | |
| * {@link Options#fillHandle} option is enabled. | |
| * | |
| * @event Hooks#afterAutofill | |
| * @since 8.0.0 | |
| * @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"]]`. | |
| */ | |
| 'afterAutofill', | |
| /** | |
| * Fired before aligning the cell contents. | |
| * | |
| * @event Hooks#beforeCellAlignment | |
| * @param {object} stateBefore An object with class names defining the cell alignment. | |
| * @param {CellRange[]} range An array of CellRange coordinates where the alignment will be applied. | |
| * @param {string} type Type of the alignment - either `horizontal` or `vertical`. | |
| * @param {string} alignmentClass String defining the alignment class added to the cell. | |
| * Possible values: | |
| * * `htLeft` | |
| * * `htCenter` | |
| * * `htRight` | |
| * * `htJustify` | |
| * * `htTop` | |
| * * `htMiddle` | |
| * * `htBottom`. | |
| */ | |
| 'beforeCellAlignment', | |
| /** | |
| * Fired before one or more cells is changed. Its main purpose is to alter changes silently after input and before | |
| * table rendering. | |
| * | |
| * @event Hooks#beforeChange | |
| * @param {Array[]} changes 2D array containing information about each of the edited cells. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link https://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| * @returns {void | boolean} If `false` all changes were cancelled, `true` otherwise. | |
| * @example | |
| * ```js | |
| * // To disregard a single change, set changes[i] to null or remove it from array using changes.splice(i, 1). | |
| * new Handsontable(element, { | |
| * beforeChange: (changes, source) => { | |
| * // [[row, prop, oldVal, newVal], ...] | |
| * changes[0] = null; | |
| * } | |
| * }); | |
| * // To alter a single change, overwrite the desired value to changes[i][3]. | |
| * new Handsontable(element, { | |
| * beforeChange: (changes, source) => { | |
| * // [[row, prop, oldVal, newVal], ...] | |
| * changes[0][3] = 10; | |
| * } | |
| * }); | |
| * // To cancel all edit, return false from the callback or set array length to 0 (changes.length = 0). | |
| * new Handsontable(element, { | |
| * beforeChange: (changes, source) => { | |
| * // [[row, prop, oldVal, newVal], ...] | |
| * return false; | |
| * } | |
| * }); | |
| * ``` | |
| */ | |
| 'beforeChange', | |
| /** | |
| * Fired right before rendering the changes. | |
| * | |
| * @event Hooks#beforeChangeRender | |
| * @param {Array[]} changes Array in form of `[row, prop, oldValue, newValue]`. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link https://handsontable.com/docs/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. | |
| * @returns {*|boolean} If false is returned the action is canceled. | |
| */ | |
| '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 new data is loaded (by `loadData` or `updateSettings` method) into the data source array. | |
| * | |
| * @event Hooks#beforeLoadData | |
| * @since 8.0.0 | |
| * @param {Array} sourceData Array of arrays or array of objects containing data. | |
| * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization. | |
| */ | |
| 'beforeLoadData', | |
| /** | |
| * 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://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| * @returns {*|boolean} If false is returned the action is canceled. | |
| */ | |
| '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://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| * @returns {*|boolean} If false is returned the action is canceled. | |
| */ | |
| '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. | |
| * @param {object} skipRender Object with `skipRender` property, if it is set to `true ` the next rendering cycle will be skipped. | |
| */ | |
| 'beforeRender', | |
| /** | |
| * Fired before cell meta is changed. | |
| * | |
| * @event Hooks#beforeSetCellMeta | |
| * @since 8.0.0 | |
| * @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. | |
| * @returns {*|boolean} If false is returned the action is canceled. | |
| */ | |
| 'beforeSetCellMeta', | |
| /** | |
| * Fired before setting range is started but not finished yet. | |
| * | |
| * @event Hooks#beforeSetRangeStartOnly | |
| * @param {CellCoords} coords CellCoords instance. | |
| */ | |
| 'beforeSetRangeStartOnly', | |
| /** | |
| * Fired before setting range is started. | |
| * | |
| * @event Hooks#beforeSetRangeStart | |
| * @param {CellCoords} coords CellCoords instance. | |
| */ | |
| 'beforeSetRangeStart', | |
| /** | |
| * Fired before setting range is ended. | |
| * | |
| * @event Hooks#beforeSetRangeEnd | |
| * @param {CellCoords} coords CellCoords instance. | |
| */ | |
| 'beforeSetRangeEnd', | |
| /** | |
| * Fired before the logic of handling a touch scroll, when user started scrolling on a touch-enabled device. | |
| * | |
| * @event Hooks#beforeTouchScroll | |
| */ | |
| 'beforeTouchScroll', | |
| /** | |
| * Fired before cell validation, only if validator function is defined. This can be used to manipulate the value | |
| * of changed cell before it is applied to the validator function. | |
| * | |
| * __Note:__ this will not affect values of changes. This will change value *ONLY* for validation. | |
| * | |
| * @event Hooks#beforeValidate | |
| * @param {*} value Value of the cell. | |
| * @param {number} row Visual row index. | |
| * @param {string|number} prop Property name / column index. | |
| * @param {string} [source] String that identifies source of hook call | |
| * ([list of all available sources]{@link https://handsontable.com/docs/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 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 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 Physical row height. | |
| * @param {number} column Physical 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 from the source data set. | |
| * | |
| * @event Hooks#modifySourceData | |
| * @since 8.0.0 | |
| * @param {number} row Physical row index. | |
| * @param {number} column Physical 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`). | |
| */ | |
| 'modifySourceData', | |
| /** | |
| * 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, opening editor, getting value from the editor | |
| * and saving values from the closed editor. | |
| * | |
| * @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', | |
| /** | |
| * Allows modify the visual row index that is used to retrieve the row header element (TH) before it's | |
| * highlighted (proper CSS class names are added). Modifying the visual row index allows building a custom | |
| * implementation of the nested headers feature or other features that require highlighting other DOM | |
| * elements than that the rendering engine, by default, would have highlighted. | |
| * | |
| * @event Hooks#beforeHighlightingRowHeader | |
| * @since 8.4.0 | |
| * @param {number} row Visual row index. | |
| * @param {number} headerLevel Column header level (0 = most distant to the table). | |
| * @param {object} highlightMeta An object that contains additional information about processed selection. | |
| * @returns {number|undefined} | |
| */ | |
| 'beforeHighlightingRowHeader', | |
| /** | |
| * Allows modify the visual column index that is used to retrieve the column header element (TH) before it's | |
| * highlighted (proper CSS class names are added). Modifying the visual column index allows building a custom | |
| * implementation of the nested headers feature or other features that require highlighting other DOM | |
| * elements than that the rendering engine, by default, would have highlighted. | |
| * | |
| * @event Hooks#beforeHighlightingColumnHeader | |
| * @since 8.4.0 | |
| * @param {number} column Visual column index. | |
| * @param {number} headerLevel Row header level (0 = most distant to the table). | |
| * @param {object} highlightMeta An object that contains additional information about processed selection. | |
| * @returns {number|undefined} | |
| */ | |
| 'beforeHighlightingColumnHeader', | |
| /** | |
| * 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). | |
| * @returns {boolean | void} If `false` the column will not be sorted, `true` otherwise. | |
| */ | |
| '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 {Array} movedColumns Array of visual column indexes to be moved. | |
| * @param {number} finalIndex Visual column index, being a start index for the moved columns. Points to where the elements will be placed after the moving action. To check visualization of final index please take a look at [documentation](/docs/demo-moving.html). | |
| * @param {number|undefined} dropIndex Visual column index, being a drop index for the moved columns. Points to where we are going to drop the moved elements. To check visualization of drop index please take a look at [documentation](/docs/demo-moving.html). It's `undefined` when `dragColumns` function wasn't called. | |
| * @param {boolean} movePossible Indicates if it's possible to move rows to the desired position. | |
| * @returns {void | boolean} If `false` the column will not be moved, `true` otherwise. | |
| */ | |
| '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 {Array} movedColumns Array of visual column indexes to be moved. | |
| * @param {number} finalIndex Visual column index, being a start index for the moved columns. Points to where the elements will be placed after the moving action. To check visualization of final index please take a look at [documentation](/docs/demo-moving.html). | |
| * @param {number|undefined} dropIndex Visual column index, being a drop index for the moved columns. Points to where we are going to drop the moved elements. To check visualization of drop index please take a look at [documentation](/docs/demo-moving.html). It's `undefined` when `dragColumns` function wasn't called. | |
| * @param {boolean} movePossible Indicates if it was possible to move columns to the desired position. | |
| * @param {boolean} orderChanged Indicates if order of columns was changed by move. | |
| */ | |
| 'afterColumnMove', | |
| /** | |
| * Fired by {@link ManualRowMove} plugin before changing the order of the visual indexes. This hook is fired when | |
| * {@link Options#manualRowMove} option is enabled. | |
| * | |
| * @event Hooks#beforeRowMove | |
| * @param {Array} movedRows Array of visual row indexes to be moved. | |
| * @param {number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements will be placed after the moving action. To check visualization of final index please take a look at [documentation](/docs/demo-moving.html). | |
| * @param {number|undefined} dropIndex Visual row index, being a drop index for the moved rows. Points to where we are going to drop the moved elements. To check visualization of drop index please take a look at [documentation](/docs/demo-moving.html). It's `undefined` when `dragRows` function wasn't called. | |
| * @param {boolean} movePossible Indicates if it's possible to move rows to the desired position. | |
| * @returns {*|boolean} If false is returned the action is canceled. | |
| */ | |
| 'beforeRowMove', | |
| /** | |
| * Fired by {@link ManualRowMove} plugin after changing the order of the visual indexes. This hook is fired when | |
| * {@link Options#manualRowMove} option is enabled. | |
| * | |
| * @event Hooks#afterRowMove | |
| * @param {Array} movedRows Array of visual row indexes to be moved. | |
| * @param {number} finalIndex Visual row index, being a start index for the moved rows. Points to where the elements will be placed after the moving action. To check visualization of final index please take a look at [documentation](/docs/demo-moving.html). | |
| * @param {number|undefined} dropIndex Visual row index, being a drop index for the moved rows. Points to where we are going to drop the moved elements. To check visualization of drop index please take a look at [documentation](/docs/demo-moving.html). It's `undefined` when `dragRows` function wasn't called. | |
| * @param {boolean} movePossible Indicates if it was possible to move rows to the desired position. | |
| * @param {boolean} orderChanged Indicates if order of rows was changed by move. | |
| */ | |
| 'afterRowMove', | |
| /** | |
| * Fired by {@link ManualColumnResize} plugin before rendering the table with modified column sizes. This hook is | |
| * fired when {@link Options#manualColumnResize} option is enabled. | |
| * | |
| * @event Hooks#beforeColumnResize | |
| * @param {number} newSize Calculated new column width. | |
| * @param {number} column Visual index of the resized column. | |
| * @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} newSize Calculated new column width. | |
| * @param {number} column Visual index of the resized column. | |
| * @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} newSize Calculated new row height. | |
| * @param {number} row Visual index of the resized row. | |
| * @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} newSize Calculated new row height. | |
| * @param {number} row Visual index of the resized row. | |
| * @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', | |
| /* eslint-disable jsdoc/require-description-complete-sentence */ | |
| /** | |
| * Fired by {@link Filters} plugin before applying [filtering]{@link https://handsontable.com/docs/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', | |
| /* eslint-enable jsdoc/require-description-complete-sentence */ | |
| /* eslint-disable jsdoc/require-description-complete-sentence */ | |
| /** | |
| * Fired by {@link Filters} plugin after applying [filtering]{@link https://handsontable.com/docs/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', | |
| /* eslint-enable jsdoc/require-description-complete-sentence */ | |
| /** | |
| * 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'`). | |
| * @returns {*|boolean} If false is returned the action is canceled. | |
| */ | |
| 'beforeUndo', | |
| /** | |
| * Fired by {@link UndoRedo} plugin before changing undo stack. | |
| * | |
| * @event Hooks#beforeUndoStackChange | |
| * @since 8.4.0 | |
| * @param {Array} doneActions Stack of actions which may be undone. | |
| * @param {string} [source] String that identifies source of action ([list of all available sources]{@link https://handsontable.com/docs/tutorial-using-callbacks.html#page-source-definition}). | |
| * @returns {*|boolean} If false is returned the action of changing undo stack is canceled. | |
| */ | |
| 'beforeUndoStackChange', | |
| /** | |
| * 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 after changing undo stack. | |
| * | |
| * @event Hooks#afterUndoStackChange | |
| * @since 8.4.0 | |
| * @param {Array} doneActionsBefore Stack of actions which could be undone before performing new action. | |
| * @param {Array} doneActionsAfter Stack of actions which can be undone after performing new action. | |
| */ | |
| 'afterUndoStackChange', | |
| /** | |
| * 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'`). | |
| * @returns {*|boolean} If false is returned the action is canceled. | |
| */ | |
| 'beforeRedo', | |
| /** | |
| * Fired by {@link UndoRedo} plugin before changing redo stack. | |
| * | |
| * @event Hooks#beforeRedoStackChange | |
| * @since 8.4.0 | |
| * @param {Array} undoneActions Stack of actions which may be redone. | |
| */ | |
| 'beforeRedoStackChange', | |
| /** | |
| * 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 by {@link UndoRedo} plugin after changing redo stack. | |
| * | |
| * @event Hooks#afterRedoStackChange | |
| * @since 8.4.0 | |
| * @param {Array} undoneActionsBefore Stack of actions which could be redone before performing new action. | |
| * @param {Array} undoneActionsAfter Stack of actions which can be redone after performing new action. | |
| */ | |
| 'afterRedoStackChange', | |
| /** | |
| * 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. | |
| * This hook should be added before Handsontable is initialized. | |
| * | |
| * @event Hooks#afterPluginsInitialized | |
| * | |
| * @example | |
| * ```js | |
| * Handsontable.hooks.add('afterPluginsInitialized', myCallback); | |
| * ``` | |
| */ | |
| 'afterPluginsInitialized', | |
| /** | |
| * Fired by {@link HiddenRows} plugin before marking the rows as hidden. Fired only if the {@link Options#hiddenRows} option is enabled. | |
| * Returning `false` in the callback will prevent the hiding action from completing. | |
| * | |
| * @event Hooks#beforeHideRows | |
| * @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes. | |
| * @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes. | |
| * @param {boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the hiding action will not be completed. | |
| */ | |
| 'beforeHideRows', | |
| /** | |
| * Fired by {@link HiddenRows} plugin after marking the rows as hidden. Fired only if the {@link Options#hiddenRows} option is enabled. | |
| * | |
| * @event Hooks#afterHideRows | |
| * @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes. | |
| * @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes. | |
| * @param {boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise. | |
| * @param {boolean} stateChanged `true`, if the action affected any non-hidden rows, `false` otherwise. | |
| */ | |
| 'afterHideRows', | |
| /** | |
| * Fired by {@link HiddenRows} plugin before marking the rows as not hidden. Fired only if the {@link Options#hiddenRows} option is enabled. | |
| * Returning `false` in the callback will prevent the row revealing action from completing. | |
| * | |
| * @event Hooks#beforeUnhideRows | |
| * @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes. | |
| * @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes. | |
| * @param {boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the revealing action will not be completed. | |
| */ | |
| 'beforeUnhideRows', | |
| /** | |
| * Fired by {@link HiddenRows} plugin after marking the rows as not hidden. Fired only if the {@link Options#hiddenRows} option is enabled. | |
| * | |
| * @event Hooks#afterUnhideRows | |
| * @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes. | |
| * @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes. | |
| * @param {boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise. | |
| * @param {boolean} stateChanged `true`, if the action affected any hidden rows, `false` otherwise. | |
| */ | |
| 'afterUnhideRows', | |
| /** | |
| * Fired by {@link HiddenColumns} plugin before marking the columns as hidden. Fired only if the {@link Options#hiddenColumns} option is enabled. | |
| * Returning `false` in the callback will prevent the hiding action from completing. | |
| * | |
| * @event Hooks#beforeHideColumns | |
| * @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes. | |
| * @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes. | |
| * @param {boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the hiding action will not be completed. | |
| */ | |
| 'beforeHideColumns', | |
| /** | |
| * Fired by {@link HiddenColumns} plugin after marking the columns as hidden. Fired only if the {@link Options#hiddenColumns} option is enabled. | |
| * | |
| * @event Hooks#afterHideColumns | |
| * @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes. | |
| * @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes. | |
| * @param {boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise. | |
| * @param {boolean} stateChanged `true`, if the action affected any non-hidden columns, `false` otherwise. | |
| */ | |
| 'afterHideColumns', | |
| /** | |
| * Fired by {@link HiddenColumns} plugin before marking the columns as not hidden. Fired only if the {@link Options#hiddenColumns} option is enabled. | |
| * Returning `false` in the callback will prevent the column revealing action from completing. | |
| * | |
| * @event Hooks#beforeUnhideColumns | |
| * @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes. | |
| * @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes. | |
| * @param {boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the hiding action will not be completed. | |
| */ | |
| 'beforeUnhideColumns', | |
| /** | |
| * Fired by {@link HiddenColumns} plugin after marking the columns as not hidden. Fired only if the {@link Options#hiddenColumns} option is enabled. | |
| * | |
| * @event Hooks#afterUnhideColumns | |
| * @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes. | |
| * @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes. | |
| * @param {boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise. | |
| * @param {boolean} stateChanged `true`, if the action affected any hidden columns, `false` otherwise. | |
| */ | |
| 'afterUnhideColumns', | |
| /** | |
| * Fired by {@link TrimRows} plugin before trimming rows. This hook is fired when {@link Options#trimRows} option is enabled. | |
| * | |
| * @event Hooks#beforeTrimRow | |
| * @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes. | |
| * @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes. | |
| * @param {boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the trimming action will not be completed. | |
| */ | |
| 'beforeTrimRow', | |
| /** | |
| * Fired by {@link TrimRows} plugin after trimming rows. This hook is fired when {@link Options#trimRows} option is enabled. | |
| * | |
| * @event Hooks#afterTrimRow | |
| * @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes. | |
| * @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes. | |
| * @param {boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise. | |
| * @param {boolean} stateChanged `true`, if the action affected any non-trimmed rows, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the trimming action will not be completed. | |
| */ | |
| 'afterTrimRow', | |
| /** | |
| * Fired by {@link TrimRows} plugin before untrimming rows. This hook is fired when {@link Options#trimRows} option is enabled. | |
| * | |
| * @event Hooks#beforeUntrimRow | |
| * @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes. | |
| * @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes. | |
| * @param {boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the untrimming action will not be completed. | |
| */ | |
| 'beforeUntrimRow', | |
| /** | |
| * Fired by {@link TrimRows} plugin after untrimming rows. This hook is fired when {@link Options#trimRows} option is enabled. | |
| * | |
| * @event Hooks#afterUntrimRow | |
| * @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes. | |
| * @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes. | |
| * @param {boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise. | |
| * @param {boolean} stateChanged `true`, if the action affected any trimmed rows, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the untrimming action will not be completed. | |
| */ | |
| 'afterUntrimRow', | |
| /** | |
| * Fired by {@link DropdownMenu} plugin before opening the dropdown menu. This hook is fired when {@link Options#dropdownMenu} | |
| * option is enabled. | |
| * | |
| * @event Hooks#beforeDropdownMenuShow | |
| * @param {DropdownMenu} dropdownMenu The DropdownMenu instance. | |
| */ | |
| 'beforeDropdownMenuShow', | |
| /** | |
| * Fired by {@link DropdownMenu} plugin after opening the Dropdown Menu. This hook is fired when {@link Options#dropdownMenu} | |
| * option is enabled. | |
| * | |
| * @event Hooks#afterDropdownMenuShow | |
| * @param {DropdownMenu} dropdownMenu The DropdownMenu instance. | |
| */ | |
| 'afterDropdownMenuShow', | |
| /** | |
| * Fired by {@link DropdownMenu} plugin after hiding the Dropdown Menu. This hook is fired when {@link Options#dropdownMenu} | |
| * option is enabled. | |
| * | |
| * @event Hooks#afterDropdownMenuHide | |
| * @param {DropdownMenu} instance The DropdownMenu instance. | |
| */ | |
| 'afterDropdownMenuHide', | |
| /** | |
| * Fired by {@link 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', | |
| /** | |
| * Fired by {@link CollapsibleColumns} plugin before columns collapse. This hook is fired when {@link Options#collapsibleColumns} option is enabled. | |
| * | |
| * @event Hooks#beforeColumnCollapse | |
| * @since 8.0.0 | |
| * @param {Array} currentCollapsedColumns Current collapsible configuration - a list of collapsible physical column indexes. | |
| * @param {Array} destinationCollapsedColumns Destination collapsible configuration - a list of collapsible physical column indexes. | |
| * @param {boolean} collapsePossible `true`, if all of the column indexes are withing the bounds of the collapsed sections, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the collapsing action will not be completed. | |
| */ | |
| 'beforeColumnCollapse', | |
| /** | |
| * Fired by {@link CollapsibleColumns} plugin before columns collapse. This hook is fired when {@link Options#collapsibleColumns} option is enabled. | |
| * | |
| * @event Hooks#afterColumnCollapse | |
| * @since 8.0.0 | |
| * @param {Array} currentCollapsedColumns Current collapsible configuration - a list of collapsible physical column indexes. | |
| * @param {Array} destinationCollapsedColumns Destination collapsible configuration - a list of collapsible physical column indexes. | |
| * @param {boolean} collapsePossible `true`, if all of the column indexes are withing the bounds of the collapsed sections, `false` otherwise. | |
| * @param {boolean} successfullyCollapsed `true`, if the action affected any non-collapsible column, `false` otherwise. | |
| */ | |
| 'afterColumnCollapse', | |
| /** | |
| * Fired by {@link CollapsibleColumns} plugin before columns expand. This hook is fired when {@link Options#collapsibleColumns} option is enabled. | |
| * | |
| * @event Hooks#beforeColumnExpand | |
| * @since 8.0.0 | |
| * @param {Array} currentCollapsedColumns Current collapsible configuration - a list of collapsible physical column indexes. | |
| * @param {Array} destinationCollapsedColumns Destination collapsible configuration - a list of collapsible physical column indexes. | |
| * @param {boolean} expandPossible `true`, if all of the column indexes are withing the bounds of the collapsed sections, `false` otherwise. | |
| * @returns {undefined|boolean} If the callback returns `false`, the expanding action will not be completed. | |
| */ | |
| 'beforeColumnExpand', | |
| /** | |
| * Fired by {@link CollapsibleColumns} plugin before columns expand. This hook is fired when {@link Options#collapsibleColumns} option is enabled. | |
| * | |
| * @event Hooks#afterColumnExpand | |
| * @since 8.0.0 | |
| * @param {Array} currentCollapsedColumns Current collapsible configuration - a list of collapsible physical column indexes. | |
| * @param {Array} destinationCollapsedColumns Destination collapsible configuration - a list of collapsible physical column indexes. | |
| * @param {boolean} expandPossible `true`, if all of the column indexes are withing the bounds of the collapsed sections, `false` otherwise. | |
| * @param {boolean} successfullyExpanded `true`, if the action affected any non-collapsible column, `false` otherwise. | |
| */ | |
| 'afterColumnExpand', | |
| /** | |
| * Fired by {@link AutoColumnSize} plugin within {@link SampleGenerator} utility. | |
| * | |
| * @event Hooks#modifyAutoColumnSizeSeed | |
| * @since 8.4.0 | |
| * @param {string|undefined} seed Seed ID, unique name to categorize samples. | |
| * @param {object} cellProperties Object containing the cell properties. | |
| * @param {*} cellValue Value of the cell. | |
| */ | |
| 'modifyAutoColumnSizeSeed']; | |
| /** | |
| * Template warning message for removed hooks. | |
| * | |
| * @type {string} | |
| */ | |
| var REMOVED_MESSAGE = (0, _templateLiteralTag.toSingleLine)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["The plugin hook \"[hookName]\" was removed in Handsontable [removedInVersion]. \n Please consult release notes https://github.com/handsontable/handsontable/releases/tag/[removedInVersion] to \n learn about the migration path."], ["The plugin hook \"[hookName]\" was removed in Handsontable [removedInVersion].\\x20\n Please consult release notes https://github.com/handsontable/handsontable/releases/tag/[removedInVersion] to\\x20\n learn about the migration path."]))); | |
| /** | |
| * The list of the hooks which are removed from the API. The warning message is printed out in | |
| * the developer console when the hook is used. | |
| * | |
| * The Map key is represented by hook name and its value points to the Handsontable version | |
| * in which it was removed. | |
| * | |
| * @type {Map<string, string>} | |
| */ | |
| var REMOVED_HOOKS = new Map([['modifyRow', '8.0.0'], ['modifyCol', '8.0.0'], ['unmodifyRow', '8.0.0'], ['unmodifyCol', '8.0.0'], ['skipLengthCache', '8.0.0'], ['hiddenColumn', '8.0.0'], ['hiddenRow', '8.0.0']]); | |
| /* eslint-disable jsdoc/require-description-complete-sentence */ | |
| /** | |
| * The list of the hooks which are deprecated. The warning message is printed out in | |
| * the developer console when the hook is used. | |
| * | |
| * The Map key is represented by hook name and its value keeps message which whould be | |
| * printed out when the hook is used. | |
| * | |
| * Usage: | |
| * ```js | |
| * ... | |
| * New Map([ | |
| * ['beforeColumnExpand', 'The plugin hook "beforeColumnExpand" is deprecated. Use "beforeColumnExpand2" instead.'], | |
| * ]) | |
| * ... | |
| * ``` | |
| * | |
| * | |
| * @type {Map<string, string>} | |
| */ | |
| /* eslint-enable jsdoc/require-description-complete-sentence */ | |
| var DEPRECATED_HOOKS = new Map([]); | |
| var Hooks = /*#__PURE__*/function () { | |
| /** | |
| * | |
| */ | |
| 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 { | |
| if (REMOVED_HOOKS.has(key)) { | |
| (0, _console.warn)((0, _string.substitute)(REMOVED_MESSAGE, { | |
| hookName: key, | |
| removedInVersion: REMOVED_HOOKS.get(key) | |
| })); | |
| } | |
| if (DEPRECATED_HOOKS.has(key)) { | |
| (0, _console.warn)(DEPRECATED_HOOKS.get(key)); | |
| } | |
| 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. | |
| * @returns {boolean} Returns `true` if hook was removed, `false` otherwise. | |
| * | |
| * @example | |
| * ```js | |
| * Handsontable.hooks.remove('beforeInit', myCallback); | |
| * ``` | |
| */ | |
| }, { | |
| key: "remove", | |
| value: function remove(key, callback) { | |
| var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | |
| var bucket = this.getBucket(context); | |
| if (typeof bucket[key] !== 'undefined') { | |
| if (bucket[key].indexOf(callback) >= 0) { | |
| callback.skip = true; | |
| return true; | |
| } | |
| } | |
| return false; | |
| } | |
| /** | |
| * Checks whether there are any registered listeners for the provided hook name. | |
| * If the `context` parameter is provided, it only checks for listeners assigned to the given Handsontable instance. | |
| * | |
| * @param {string} key Hook name. | |
| * @param {object} [context=null] A Handsontable instance. | |
| * @returns {boolean} `true` for success, `false` otherwise. | |
| */ | |
| }, { | |
| key: "has", | |
| value: function has(key) { | |
| var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | |
| var bucket = this.getBucket(context); | |
| return !!(bucket[key] !== void 0 && bucket[key].length); | |
| } | |
| /** | |
| * Runs all local and global callbacks assigned to the hook identified by the `key` parameter. | |
| * It returns either a return value from the last called callback or the first parameter (`p1`) passed to the `run` function. | |
| * | |
| * @see Core#runHooks | |
| * @param {object} context Handsontable instance. | |
| * @param {string} key Hook/Event name. | |
| * @param {*} [p1] Parameter to be passed as an argument to the callback function. | |
| * @param {*} [p2] Parameter to be passed as an argument to the callback function. | |
| * @param {*} [p3] Parameter to be passed as an argument to the callback function. | |
| * @param {*} [p4] Parameter to be passed as an argument to the callback function. | |
| * @param {*} [p5] Parameter to be passed as an argument to the callback function. | |
| * @param {*} [p6] Parameter to be passed as an argument to the callback function. | |
| * @returns {*} Either a return value from the last called callback or `p1`. | |
| * | |
| * @example | |
| * ```js | |
| * Handsontable.hooks.run(hot, 'beforeInit'); | |
| * ``` | |
| */ | |
| }, { | |
| key: "run", | |
| value: function run(context, key, p1, p2, p3, p4, p5, p6) { | |
| { | |
| var globalHandlers = this.globalBucket[key]; | |
| var length = globalHandlers ? globalHandlers.length : 0; | |
| var index = 0; | |
| if (length) { | |
| // Do not optimise this loop with arrayEach or arrow function! If you do You'll decrease perf because of GC. | |
| while (index < length) { | |
| if (!globalHandlers[index] || globalHandlers[index].skip) { | |
| index += 1; | |
| /* eslint-disable no-continue */ | |
| continue; | |
| } // performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture | |
| var res = globalHandlers[index].call(context, p1, p2, p3, p4, p5, p6); | |
| if (res !== void 0) { | |
| // eslint-disable-next-line no-param-reassign | |
| p1 = res; | |
| } | |
| if (globalHandlers[index] && globalHandlers[index].runOnce) { | |
| this.remove(key, globalHandlers[index]); | |
| } | |
| index += 1; | |
| } | |
| } | |
| } | |
| { | |
| var localHandlers = this.getBucket(context)[key]; | |
| var _length = localHandlers ? localHandlers.length : 0; | |
| var _index = 0; | |
| if (_length) { | |
| // Do not optimise this loop with arrayEach or arrow function! If you do You'll decrease perf because of GC. | |
| while (_index < _length) { | |
| if (!localHandlers[_index] || localHandlers[_index].skip) { | |
| _index += 1; | |
| /* eslint-disable no-continue */ | |
| continue; | |
| } // performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture | |
| var _res = localHandlers[_index].call(context, p1, p2, p3, p4, p5, p6); | |
| if (_res !== void 0) { | |
| // eslint-disable-next-line no-param-reassign | |
| p1 = _res; | |
| } | |
| if (localHandlers[_index] && localHandlers[_index].runOnce) { | |
| this.remove(key, localHandlers[_index], context); | |
| } | |
| _index += 1; | |
| } | |
| } | |
| } | |
| return p1; | |
| } | |
| /** | |
| * Destroy all listeners connected to the context. If no context is provided, the global listeners will be destroyed. | |
| * | |
| * @param {object} [context=null] A Handsontable instance. | |
| * @example | |
| * ```js | |
| * // destroy the global listeners | |
| * Handsontable.hooks.destroy(); | |
| * | |
| * // destroy the local listeners | |
| * Handsontable.hooks.destroy(hotInstance); | |
| * ``` | |
| */ | |
| }, { | |
| key: "destroy", | |
| value: function destroy() { | |
| var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | |
| // eslint-disable-next-line no-return-assign | |
| (0, _object.objectEach)(this.getBucket(context), function (value, key, bucket) { | |
| return bucket[key].length = 0; | |
| }); | |
| } | |
| /** | |
| * Registers a hook name (adds it to the list of the known hook names). Used by plugins. | |
| * It is not necessary to call register, but if you use it, your plugin hook will be used returned by | |
| * the `getRegistered` method. (which itself is used in the demo https://handsontable.com/docs/tutorial-using-callbacks.html). | |
| * | |
| * @param {string} key 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 {string} key The 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 value depending on if a hook by such name has been removed or deprecated. | |
| * | |
| * @param {string} hookName The hook name to check. | |
| * @returns {boolean} Returns `true` if the provided hook name was marked as deprecated or | |
| * removed from API, `false` otherwise. | |
| * @example | |
| * ```js | |
| * Handsontable.hooks.isDeprecated('skipLengthCache'); | |
| * | |
| * // Results: | |
| * true | |
| * ``` | |
| */ | |
| }, { | |
| key: "isDeprecated", | |
| value: function isDeprecated(hookName) { | |
| return DEPRECATED_HOOKS.has(hookName) || REMOVED_HOOKS.has(hookName); | |
| } | |
| /** | |
| * Returns a boolean depending on if a hook by such name has been registered. | |
| * | |
| * @param {string} hookName The hook name to check. | |
| * @returns {boolean} `true` for success, `false` otherwise. | |
| * @example | |
| * ```js | |
| * Handsontable.hooks.isRegistered('beforeInit'); | |
| * | |
| * // Results: | |
| * true | |
| * ``` | |
| */ | |
| }, { | |
| key: "isRegistered", | |
| value: function isRegistered(hookName) { | |
| return REGISTERED_HOOKS.indexOf(hookName) >= 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; | |
| } | |
| }], [{ | |
| key: "getSingleton", | |
| value: function getSingleton() { | |
| return getGlobalSingleton(); | |
| } | |
| }]); | |
| return Hooks; | |
| }(); | |
| var globalSingleton = new Hooks(); | |
| /** | |
| * @returns {Hooks} | |
| */ | |
| function getGlobalSingleton() { | |
| return globalSingleton; | |
| } | |
| var _default = Hooks; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 49 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var global = __webpack_require__(40); | |
| var getBuiltIn = __webpack_require__(106); | |
| var IS_PURE = __webpack_require__(105); | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var NATIVE_SYMBOL = __webpack_require__(179); | |
| var USE_SYMBOL_AS_UID = __webpack_require__(238); | |
| var fails = __webpack_require__(32); | |
| var has = __webpack_require__(65); | |
| var isArray = __webpack_require__(121); | |
| var isObject = __webpack_require__(46); | |
| var anObject = __webpack_require__(47); | |
| var toObject = __webpack_require__(68); | |
| var toIndexedObject = __webpack_require__(74); | |
| var toPrimitive = __webpack_require__(118); | |
| var createPropertyDescriptor = __webpack_require__(116); | |
| var nativeObjectCreate = __webpack_require__(109); | |
| var objectKeys = __webpack_require__(124); | |
| var getOwnPropertyNamesModule = __webpack_require__(120); | |
| var getOwnPropertyNamesExternal = __webpack_require__(236); | |
| var getOwnPropertySymbolsModule = __webpack_require__(177); | |
| var getOwnPropertyDescriptorModule = __webpack_require__(93); | |
| var definePropertyModule = __webpack_require__(66); | |
| var propertyIsEnumerableModule = __webpack_require__(147); | |
| var createNonEnumerableProperty = __webpack_require__(82); | |
| var redefine = __webpack_require__(83); | |
| var shared = __webpack_require__(149); | |
| var sharedKey = __webpack_require__(148); | |
| var hiddenKeys = __webpack_require__(119); | |
| var uid = __webpack_require__(150); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var wrappedWellKnownSymbolModule = __webpack_require__(419); | |
| var defineWellKnownSymbol = __webpack_require__(420); | |
| var setToStringTag = __webpack_require__(157); | |
| var InternalStateModule = __webpack_require__(95); | |
| var $forEach = __webpack_require__(102).forEach; | |
| var HIDDEN = sharedKey('hidden'); | |
| var SYMBOL = 'Symbol'; | |
| var PROTOTYPE = 'prototype'; | |
| var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); | |
| var setInternalState = InternalStateModule.set; | |
| var getInternalState = InternalStateModule.getterFor(SYMBOL); | |
| var ObjectPrototype = Object[PROTOTYPE]; | |
| var $Symbol = global.Symbol; | |
| var $stringify = getBuiltIn('JSON', 'stringify'); | |
| var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; | |
| var nativeDefineProperty = definePropertyModule.f; | |
| var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; | |
| var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; | |
| var AllSymbols = shared('symbols'); | |
| var ObjectPrototypeSymbols = shared('op-symbols'); | |
| var StringToSymbolRegistry = shared('string-to-symbol-registry'); | |
| var SymbolToStringRegistry = shared('symbol-to-string-registry'); | |
| var WellKnownSymbolsStore = shared('wks'); | |
| var QObject = global.QObject; | |
| // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 | |
| var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; | |
| // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 | |
| var setSymbolDescriptor = DESCRIPTORS && fails(function () { | |
| return nativeObjectCreate(nativeDefineProperty({}, 'a', { | |
| get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; } | |
| })).a != 7; | |
| }) ? function (O, P, Attributes) { | |
| var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P); | |
| if (ObjectPrototypeDescriptor) delete ObjectPrototype[P]; | |
| nativeDefineProperty(O, P, Attributes); | |
| if (ObjectPrototypeDescriptor && O !== ObjectPrototype) { | |
| nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor); | |
| } | |
| } : nativeDefineProperty; | |
| var wrap = function (tag, description) { | |
| var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]); | |
| setInternalState(symbol, { | |
| type: SYMBOL, | |
| tag: tag, | |
| description: description | |
| }); | |
| if (!DESCRIPTORS) symbol.description = description; | |
| return symbol; | |
| }; | |
| var isSymbol = USE_SYMBOL_AS_UID ? function (it) { | |
| return typeof it == 'symbol'; | |
| } : function (it) { | |
| return Object(it) instanceof $Symbol; | |
| }; | |
| var $defineProperty = function defineProperty(O, P, Attributes) { | |
| if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes); | |
| anObject(O); | |
| var key = toPrimitive(P, true); | |
| anObject(Attributes); | |
| if (has(AllSymbols, key)) { | |
| if (!Attributes.enumerable) { | |
| if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); | |
| O[HIDDEN][key] = true; | |
| } else { | |
| if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; | |
| Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); | |
| } return setSymbolDescriptor(O, key, Attributes); | |
| } return nativeDefineProperty(O, key, Attributes); | |
| }; | |
| var $defineProperties = function defineProperties(O, Properties) { | |
| anObject(O); | |
| var properties = toIndexedObject(Properties); | |
| var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); | |
| $forEach(keys, function (key) { | |
| if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]); | |
| }); | |
| return O; | |
| }; | |
| var $create = function create(O, Properties) { | |
| return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); | |
| }; | |
| var $propertyIsEnumerable = function propertyIsEnumerable(V) { | |
| var P = toPrimitive(V, true); | |
| var enumerable = nativePropertyIsEnumerable.call(this, P); | |
| if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false; | |
| return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; | |
| }; | |
| var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { | |
| var it = toIndexedObject(O); | |
| var key = toPrimitive(P, true); | |
| if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return; | |
| var descriptor = nativeGetOwnPropertyDescriptor(it, key); | |
| if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) { | |
| descriptor.enumerable = true; | |
| } | |
| return descriptor; | |
| }; | |
| var $getOwnPropertyNames = function getOwnPropertyNames(O) { | |
| var names = nativeGetOwnPropertyNames(toIndexedObject(O)); | |
| var result = []; | |
| $forEach(names, function (key) { | |
| if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key); | |
| }); | |
| return result; | |
| }; | |
| var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { | |
| var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; | |
| var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); | |
| var result = []; | |
| $forEach(names, function (key) { | |
| if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) { | |
| result.push(AllSymbols[key]); | |
| } | |
| }); | |
| return result; | |
| }; | |
| // `Symbol` constructor | |
| // https://tc39.es/ecma262/#sec-symbol-constructor | |
| if (!NATIVE_SYMBOL) { | |
| $Symbol = function Symbol() { | |
| if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor'); | |
| var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]); | |
| var tag = uid(description); | |
| var setter = function (value) { | |
| if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value); | |
| if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; | |
| setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); | |
| }; | |
| if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); | |
| return wrap(tag, description); | |
| }; | |
| redefine($Symbol[PROTOTYPE], 'toString', function toString() { | |
| return getInternalState(this).tag; | |
| }); | |
| redefine($Symbol, 'withoutSetter', function (description) { | |
| return wrap(uid(description), description); | |
| }); | |
| propertyIsEnumerableModule.f = $propertyIsEnumerable; | |
| definePropertyModule.f = $defineProperty; | |
| getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor; | |
| getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; | |
| getOwnPropertySymbolsModule.f = $getOwnPropertySymbols; | |
| wrappedWellKnownSymbolModule.f = function (name) { | |
| return wrap(wellKnownSymbol(name), name); | |
| }; | |
| if (DESCRIPTORS) { | |
| // https://github.com/tc39/proposal-Symbol-description | |
| nativeDefineProperty($Symbol[PROTOTYPE], 'description', { | |
| configurable: true, | |
| get: function description() { | |
| return getInternalState(this).description; | |
| } | |
| }); | |
| if (!IS_PURE) { | |
| redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true }); | |
| } | |
| } | |
| } | |
| $({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, { | |
| Symbol: $Symbol | |
| }); | |
| $forEach(objectKeys(WellKnownSymbolsStore), function (name) { | |
| defineWellKnownSymbol(name); | |
| }); | |
| $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, { | |
| // `Symbol.for` method | |
| // https://tc39.es/ecma262/#sec-symbol.for | |
| 'for': function (key) { | |
| var string = String(key); | |
| if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; | |
| var symbol = $Symbol(string); | |
| StringToSymbolRegistry[string] = symbol; | |
| SymbolToStringRegistry[symbol] = string; | |
| return symbol; | |
| }, | |
| // `Symbol.keyFor` method | |
| // https://tc39.es/ecma262/#sec-symbol.keyfor | |
| keyFor: function keyFor(sym) { | |
| if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol'); | |
| if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; | |
| }, | |
| useSetter: function () { USE_SETTER = true; }, | |
| useSimple: function () { USE_SETTER = false; } | |
| }); | |
| $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, { | |
| // `Object.create` method | |
| // https://tc39.es/ecma262/#sec-object.create | |
| create: $create, | |
| // `Object.defineProperty` method | |
| // https://tc39.es/ecma262/#sec-object.defineproperty | |
| defineProperty: $defineProperty, | |
| // `Object.defineProperties` method | |
| // https://tc39.es/ecma262/#sec-object.defineproperties | |
| defineProperties: $defineProperties, | |
| // `Object.getOwnPropertyDescriptor` method | |
| // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors | |
| getOwnPropertyDescriptor: $getOwnPropertyDescriptor | |
| }); | |
| $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, { | |
| // `Object.getOwnPropertyNames` method | |
| // https://tc39.es/ecma262/#sec-object.getownpropertynames | |
| getOwnPropertyNames: $getOwnPropertyNames, | |
| // `Object.getOwnPropertySymbols` method | |
| // https://tc39.es/ecma262/#sec-object.getownpropertysymbols | |
| getOwnPropertySymbols: $getOwnPropertySymbols | |
| }); | |
| // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives | |
| // https://bugs.chromium.org/p/v8/issues/detail?id=3443 | |
| $({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, { | |
| getOwnPropertySymbols: function getOwnPropertySymbols(it) { | |
| return getOwnPropertySymbolsModule.f(toObject(it)); | |
| } | |
| }); | |
| // `JSON.stringify` method behavior with symbols | |
| // https://tc39.es/ecma262/#sec-json.stringify | |
| if ($stringify) { | |
| var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () { | |
| var symbol = $Symbol(); | |
| // MS Edge converts symbol values to JSON as {} | |
| return $stringify([symbol]) != '[null]' | |
| // WebKit converts symbol values to JSON as null | |
| || $stringify({ a: symbol }) != '{}' | |
| // V8 throws on boxed symbols | |
| || $stringify(Object(symbol)) != '{}'; | |
| }); | |
| $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, { | |
| // eslint-disable-next-line no-unused-vars -- required for `.length` | |
| stringify: function stringify(it, replacer, space) { | |
| var args = [it]; | |
| var index = 1; | |
| var $replacer; | |
| while (arguments.length > index) args.push(arguments[index++]); | |
| $replacer = replacer; | |
| if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined | |
| if (!isArray(replacer)) replacer = function (key, value) { | |
| if (typeof $replacer == 'function') value = $replacer.call(this, key, value); | |
| if (!isSymbol(value)) return value; | |
| }; | |
| args[1] = replacer; | |
| return $stringify.apply(null, args); | |
| } | |
| }); | |
| } | |
| // `Symbol.prototype[@@toPrimitive]` method | |
| // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive | |
| if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) { | |
| createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); | |
| } | |
| // `Symbol.prototype[@@toStringTag]` property | |
| // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag | |
| setToStringTag($Symbol, SYMBOL); | |
| hiddenKeys[HIDDEN] = true; | |
| /***/ }), | |
| /* 50 */ | |
| /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__.r(__webpack_exports__); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR", function() { return ERROR; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_DIV_ZERO", function() { return ERROR_DIV_ZERO; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_NAME", function() { return ERROR_NAME; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_NOT_AVAILABLE", function() { return ERROR_NOT_AVAILABLE; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_NULL", function() { return ERROR_NULL; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_NUM", function() { return ERROR_NUM; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_REF", function() { return ERROR_REF; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_VALUE", function() { return ERROR_VALUE; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return error; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidStrict", function() { return isValidStrict; }); | |
| var _errors; | |
| 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; } | |
| var ERROR = 'ERROR'; | |
| var ERROR_DIV_ZERO = 'DIV/0'; | |
| var ERROR_NAME = 'NAME'; | |
| var ERROR_NOT_AVAILABLE = 'N/A'; | |
| var ERROR_NULL = 'NULL'; | |
| var ERROR_NUM = 'NUM'; | |
| var ERROR_REF = 'REF'; | |
| var ERROR_VALUE = 'VALUE'; | |
| var errors = (_errors = {}, _defineProperty(_errors, ERROR, '#ERROR!'), _defineProperty(_errors, ERROR_DIV_ZERO, '#DIV/0!'), _defineProperty(_errors, ERROR_NAME, '#NAME?'), _defineProperty(_errors, ERROR_NOT_AVAILABLE, '#N/A'), _defineProperty(_errors, ERROR_NULL, '#NULL!'), _defineProperty(_errors, ERROR_NUM, '#NUM!'), _defineProperty(_errors, ERROR_REF, '#REF!'), _defineProperty(_errors, ERROR_VALUE, '#VALUE!'), _errors); | |
| /** | |
| * Return error type based on provided error id. | |
| * | |
| * @param {String} type Error type. | |
| * @returns {String|null} Returns error id. | |
| */ | |
| function error(type) { | |
| var result; | |
| type = (type + '').replace(/#|!|\?/g, ''); | |
| if (errors[type]) { | |
| result = errors[type]; | |
| } | |
| return result ? result : null; | |
| } | |
| /** | |
| * Check if error type is strict valid with knows errors. | |
| * | |
| * @param {String} Error type. | |
| * @return {Boolean} | |
| */ | |
| function isValidStrict(type) { | |
| var valid = false; | |
| for (var i in errors) { | |
| if (Object.prototype.hasOwnProperty.call(errors, i) && errors[i] === type) { | |
| valid = true; | |
| break; | |
| } | |
| } | |
| return valid; | |
| } | |
| /***/ }), | |
| /* 51 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var fixRegExpWellKnownSymbolLogic = __webpack_require__(155); | |
| var anObject = __webpack_require__(47); | |
| var toLength = __webpack_require__(58); | |
| var toInteger = __webpack_require__(96); | |
| var requireObjectCoercible = __webpack_require__(67); | |
| var advanceStringIndex = __webpack_require__(185); | |
| var getSubstitution = __webpack_require__(483); | |
| var regExpExec = __webpack_require__(156); | |
| var max = Math.max; | |
| var min = Math.min; | |
| 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.es/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.es/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); | |
| } | |
| ]; | |
| }); | |
| /***/ }), | |
| /* 52 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var redefine = __webpack_require__(83); | |
| var anObject = __webpack_require__(47); | |
| var fails = __webpack_require__(32); | |
| var flags = __webpack_require__(183); | |
| 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.es/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 }); | |
| } | |
| /***/ }), | |
| /* 53 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.isFunction = isFunction; | |
| exports.throttle = throttle; | |
| exports.throttleAfterHits = throttleAfterHits; | |
| exports.debounce = debounce; | |
| exports.pipe = pipe; | |
| exports.partial = partial; | |
| exports.curry = curry; | |
| exports.curryRight = curryRight; | |
| __webpack_require__(44); | |
| __webpack_require__(33); | |
| __webpack_require__(19); | |
| __webpack_require__(190); | |
| var _array = __webpack_require__(3); | |
| /** | |
| * Checks if given variable is function. | |
| * | |
| * @param {*} func Variable to check. | |
| * @returns {boolean} | |
| */ | |
| function isFunction(func) { | |
| return typeof func === 'function'; | |
| } | |
| /** | |
| * Creates throttle function that enforces a maximum number of times a function (`func`) can be called over time (`wait`). | |
| * | |
| * @param {Function} func Function to invoke. | |
| * @param {number} wait Delay in miliseconds. | |
| * @returns {Function} | |
| */ | |
| function throttle(func) { | |
| var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; | |
| var lastCalled = 0; | |
| var result = { | |
| lastCallThrottled: true | |
| }; | |
| var lastTimer = null; | |
| /** | |
| * @param {...*} args The list of arguments passed during the function invocation. | |
| * @returns {object} | |
| */ | |
| function _throttle() { | |
| var _this = this; | |
| for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | |
| args[_key] = arguments[_key]; | |
| } | |
| var stamp = Date.now(); | |
| var needCall = false; | |
| result.lastCallThrottled = true; | |
| if (!lastCalled) { | |
| lastCalled = stamp; | |
| needCall = true; | |
| } | |
| var remaining = wait - (stamp - lastCalled); | |
| if (needCall) { | |
| result.lastCallThrottled = false; | |
| func.apply(this, args); | |
| } else { | |
| if (lastTimer) { | |
| clearTimeout(lastTimer); | |
| } | |
| lastTimer = setTimeout(function () { | |
| result.lastCallThrottled = false; | |
| func.apply(_this, args); | |
| lastCalled = 0; | |
| lastTimer = void 0; | |
| }, remaining); | |
| } | |
| return result; | |
| } | |
| return _throttle; | |
| } | |
| /** | |
| * Creates throttle function that enforces a maximum number of times a function (`func`) can be called over | |
| * time (`wait`) after specified hits. | |
| * | |
| * @param {Function} func Function to invoke. | |
| * @param {number} wait Delay in miliseconds. | |
| * @param {number} hits Number of hits after throttling will be applied. | |
| * @returns {Function} | |
| */ | |
| function throttleAfterHits(func) { | |
| var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; | |
| var hits = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10; | |
| var funcThrottle = throttle(func, wait); | |
| var remainHits = hits; | |
| /** | |
| * | |
| */ | |
| function _clearHits() { | |
| remainHits = hits; | |
| } | |
| /** | |
| * @param {*} args The list of arguments passed during the function invocation. | |
| * @returns {*} | |
| */ | |
| function _throttleAfterHits() { | |
| for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | |
| args[_key2] = arguments[_key2]; | |
| } | |
| if (remainHits) { | |
| remainHits -= 1; | |
| return func.apply(this, args); | |
| } | |
| return funcThrottle.apply(this, args); | |
| } | |
| _throttleAfterHits.clearHits = _clearHits; | |
| return _throttleAfterHits; | |
| } | |
| /** | |
| * Creates debounce function that enforces a function (`func`) not be called again until a certain amount of time (`wait`) | |
| * has passed without it being called. | |
| * | |
| * @param {Function} func Function to invoke. | |
| * @param {number} wait Delay in milliseconds. | |
| * @returns {Function} | |
| */ | |
| function debounce(func) { | |
| var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; | |
| var lastTimer = null; | |
| var result; | |
| /** | |
| * @param {*} args The list of arguments passed during the function invocation. | |
| * @returns {*} | |
| */ | |
| function _debounce() { | |
| var _this2 = this; | |
| for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | |
| args[_key3] = arguments[_key3]; | |
| } | |
| if (lastTimer) { | |
| clearTimeout(lastTimer); | |
| } | |
| lastTimer = setTimeout(function () { | |
| result = func.apply(_this2, args); | |
| }, wait); | |
| return result; | |
| } | |
| return _debounce; | |
| } | |
| /** | |
| * Creates the function that returns the result of calling the given functions. Result of the first function is passed to | |
| * the second as an argument and so on. Only first function in the chain can handle multiple arguments. | |
| * | |
| * @param {Function} functions Functions to compose. | |
| * @returns {Function} | |
| */ | |
| function pipe() { | |
| for (var _len4 = arguments.length, functions = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | |
| functions[_key4] = arguments[_key4]; | |
| } | |
| var firstFunc = functions[0], | |
| restFunc = functions.slice(1); | |
| return function _pipe() { | |
| for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | |
| args[_key5] = arguments[_key5]; | |
| } | |
| return (0, _array.arrayReduce)(restFunc, function (acc, fn) { | |
| return fn(acc); | |
| }, firstFunc.apply(this, args)); | |
| }; | |
| } | |
| /** | |
| * Creates the function that returns the function with cached arguments. | |
| * | |
| * @param {Function} func Function to partialization. | |
| * @param {Array} params Function arguments to cache. | |
| * @returns {Function} | |
| */ | |
| function partial(func) { | |
| for (var _len6 = arguments.length, params = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { | |
| params[_key6 - 1] = arguments[_key6]; | |
| } | |
| return function _partial() { | |
| for (var _len7 = arguments.length, restParams = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { | |
| restParams[_key7] = arguments[_key7]; | |
| } | |
| return func.apply(this, params.concat(restParams)); | |
| }; | |
| } | |
| /** | |
| * Creates the functions that returns the function with cached arguments. If count if passed arguments will be matched | |
| * to the arguments defined in `func` then function will be invoked. | |
| * Arguments are added to the stack in direction from the left to the right. | |
| * | |
| * @example | |
| * ``` | |
| * var replace = curry(function(find, replace, string) { | |
| * return string.replace(find, replace); | |
| * }); | |
| * | |
| * // returns function with bounded first argument | |
| * var replace = replace('foo') | |
| * | |
| * // returns replaced string - all arguments was passed so function was invoked | |
| * replace('bar', 'Some test with foo...'); | |
| * | |
| * ``` | |
| * | |
| * @param {Function} func Function to currying. | |
| * @returns {Function} | |
| */ | |
| function curry(func) { | |
| var argsLength = func.length; | |
| /** | |
| * @param {*} argsSoFar The list of arguments passed during the function invocation. | |
| * @returns {Function} | |
| */ | |
| function given(argsSoFar) { | |
| return function _curry() { | |
| for (var _len8 = arguments.length, params = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { | |
| params[_key8] = arguments[_key8]; | |
| } | |
| var passedArgsSoFar = argsSoFar.concat(params); | |
| var result; | |
| if (passedArgsSoFar.length >= argsLength) { | |
| result = func.apply(this, passedArgsSoFar); | |
| } else { | |
| result = given(passedArgsSoFar); | |
| } | |
| return result; | |
| }; | |
| } | |
| return given([]); | |
| } | |
| /** | |
| * Creates the functions that returns the function with cached arguments. If count if passed arguments will be matched | |
| * to the arguments defined in `func` then function will be invoked. | |
| * Arguments are added to the stack in direction from the right to the left. | |
| * | |
| * @example | |
| * ``` | |
| * var replace = curry(function(find, replace, string) { | |
| * return string.replace(find, replace); | |
| * }); | |
| * | |
| * // returns function with bounded first argument | |
| * var replace = replace('Some test with foo...') | |
| * | |
| * // returns replaced string - all arguments was passed so function was invoked | |
| * replace('bar', 'foo'); | |
| * | |
| * ``` | |
| * | |
| * @param {Function} func Function to currying. | |
| * @returns {Function} | |
| */ | |
| function curryRight(func) { | |
| var argsLength = func.length; | |
| /** | |
| * @param {*} argsSoFar The list of arguments passed during the function invocation. | |
| * @returns {Function} | |
| */ | |
| function given(argsSoFar) { | |
| return function _curry() { | |
| for (var _len9 = arguments.length, params = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { | |
| params[_key9] = arguments[_key9]; | |
| } | |
| var passedArgsSoFar = argsSoFar.concat(params.reverse()); | |
| var result; | |
| if (passedArgsSoFar.length >= argsLength) { | |
| result = func.apply(this, passedArgsSoFar); | |
| } else { | |
| result = given(passedArgsSoFar); | |
| } | |
| return result; | |
| }; | |
| } | |
| return given([]); | |
| } | |
| /***/ }), | |
| /* 54 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__(23); | |
| __webpack_require__(35); | |
| exports.__esModule = true; | |
| var _exportNames = { | |
| IndexMapper: true, | |
| getRegisteredMapsCounter: true, | |
| getIncreasedIndexes: true, | |
| getDecreasedIndexes: true, | |
| alterUtilsFactory: true | |
| }; | |
| exports.alterUtilsFactory = exports.getDecreasedIndexes = exports.getIncreasedIndexes = exports.getRegisteredMapsCounter = exports.IndexMapper = void 0; | |
| var _indexMapper = __webpack_require__(541); | |
| exports.IndexMapper = _indexMapper.IndexMapper; | |
| var _mapCollection = __webpack_require__(207); | |
| exports.getRegisteredMapsCounter = _mapCollection.getRegisteredMapsCounter; | |
| var _utils = __webpack_require__(416); | |
| exports.getIncreasedIndexes = _utils.getIncreasedIndexes; | |
| exports.getDecreasedIndexes = _utils.getDecreasedIndexes; | |
| exports.alterUtilsFactory = _utils.alterUtilsFactory; | |
| var _maps = __webpack_require__(414); | |
| Object.keys(_maps).forEach(function (key) { | |
| if (key === "default" || key === "__esModule") return; | |
| if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
| if (key in exports && exports[key] === _maps[key]) return; | |
| exports[key] = _maps[key]; | |
| }); | |
| /***/ }), | |
| /* 55 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| var _array = __webpack_require__(3); | |
| var _object = __webpack_require__(5); | |
| 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 The hook name. | |
| * @param {Function} callback The 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 The hook name. | |
| * @param {*} params Additional parameters passed to callback function. | |
| */ | |
| 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; | |
| /***/ }), | |
| /* 56 */ | |
| /***/ (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; | |
| }; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| } else { | |
| module.exports = _typeof = function _typeof(obj) { | |
| return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | |
| }; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| } | |
| return _typeof(obj); | |
| } | |
| module.exports = _typeof; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 57 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var fails = __webpack_require__(32); | |
| // Detect IE8's incomplete defineProperty implementation | |
| module.exports = !fails(function () { | |
| // eslint-disable-next-line es/no-object-defineproperty -- required for testing | |
| return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; | |
| }); | |
| /***/ }), | |
| /* 58 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var toInteger = __webpack_require__(96); | |
| var min = Math.min; | |
| // `ToLength` abstract operation | |
| // https://tc39.es/ecma262/#sec-tolength | |
| module.exports = function (argument) { | |
| return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 | |
| }; | |
| /***/ }), | |
| /* 59 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var isInteger = __webpack_require__(480); | |
| // `Number.isInteger` method | |
| // https://tc39.es/ecma262/#sec-number.isinteger | |
| $({ target: 'Number', stat: true }, { | |
| isInteger: isInteger | |
| }); | |
| /***/ }), | |
| /* 60 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var global = __webpack_require__(40); | |
| var isForced = __webpack_require__(152); | |
| var redefine = __webpack_require__(83); | |
| var has = __webpack_require__(65); | |
| var classof = __webpack_require__(94); | |
| var inheritIfRequired = __webpack_require__(181); | |
| var toPrimitive = __webpack_require__(118); | |
| var fails = __webpack_require__(32); | |
| var create = __webpack_require__(109); | |
| var getOwnPropertyNames = __webpack_require__(120).f; | |
| var getOwnPropertyDescriptor = __webpack_require__(93).f; | |
| var defineProperty = __webpack_require__(66).f; | |
| var trim = __webpack_require__(241).trim; | |
| var NUMBER = 'Number'; | |
| var NativeNumber = global[NUMBER]; | |
| var NumberPrototype = NativeNumber.prototype; | |
| // Opera ~12 has broken Object#toString | |
| var BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER; | |
| // `ToNumber` abstract operation | |
| // https://tc39.es/ecma262/#sec-tonumber | |
| var toNumber = function (argument) { | |
| var it = toPrimitive(argument, false); | |
| var first, third, radix, maxCode, digits, length, index, code; | |
| if (typeof it == 'string' && it.length > 2) { | |
| it = trim(it); | |
| first = it.charCodeAt(0); | |
| if (first === 43 || first === 45) { | |
| third = it.charCodeAt(2); | |
| if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix | |
| } else if (first === 48) { | |
| switch (it.charCodeAt(1)) { | |
| case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i | |
| case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i | |
| default: return +it; | |
| } | |
| digits = it.slice(2); | |
| length = digits.length; | |
| for (index = 0; index < length; index++) { | |
| code = digits.charCodeAt(index); | |
| // parseInt parses a string to a first unavailable symbol | |
| // but ToNumber should return NaN if a string contains unavailable symbols | |
| if (code < 48 || code > maxCode) return NaN; | |
| } return parseInt(digits, radix); | |
| } | |
| } return +it; | |
| }; | |
| // `Number` constructor | |
| // https://tc39.es/ecma262/#sec-number-constructor | |
| if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { | |
| var NumberWrapper = function Number(value) { | |
| var it = arguments.length < 1 ? 0 : value; | |
| var dummy = this; | |
| return dummy instanceof NumberWrapper | |
| // check on 1..constructor(foo) case | |
| && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER) | |
| ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it); | |
| }; | |
| for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : ( | |
| // ES3: | |
| 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + | |
| // ES2015 (in case, if modules with ES2015 Number statics required before): | |
| 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + | |
| 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' + | |
| // ESNext | |
| 'fromString,range' | |
| ).split(','), j = 0, key; keys.length > j; j++) { | |
| if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) { | |
| defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key)); | |
| } | |
| } | |
| NumberWrapper.prototype = NumberPrototype; | |
| NumberPrototype.constructor = NumberWrapper; | |
| redefine(global, NUMBER, NumberWrapper); | |
| } | |
| /***/ }), | |
| /* 61 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var fixRegExpWellKnownSymbolLogic = __webpack_require__(155); | |
| var isRegExp = __webpack_require__(194); | |
| var anObject = __webpack_require__(47); | |
| var requireObjectCoercible = __webpack_require__(67); | |
| var speciesConstructor = __webpack_require__(494); | |
| var advanceStringIndex = __webpack_require__(185); | |
| var toLength = __webpack_require__(58); | |
| var callRegExpExec = __webpack_require__(156); | |
| var regexpExec = __webpack_require__(182); | |
| var stickyHelpers = __webpack_require__(184); | |
| var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; | |
| var arrayPush = [].push; | |
| var min = Math.min; | |
| var MAX_UINT32 = 0xFFFFFFFF; | |
| // @@split logic | |
| fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) { | |
| var internalSplit; | |
| if ( | |
| 'abbc'.split(/(b)*/)[1] == 'c' || | |
| // eslint-disable-next-line regexp/no-empty-group -- required for testing | |
| 'test'.split(/(?:)/, -1).length != 4 || | |
| 'ab'.split(/(?:ab)*/).length != 2 || | |
| '.'.split(/(.?)(.?)/).length != 4 || | |
| // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing | |
| '.'.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.es/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.es/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' : '') + | |
| (UNSUPPORTED_Y ? 'g' : 'y'); | |
| // ^(? + rx + ) is needed, in combination with some S slicing, to | |
| // simulate the 'y' flag. | |
| var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, 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 = UNSUPPORTED_Y ? 0 : q; | |
| var z = callRegExpExec(splitter, UNSUPPORTED_Y ? S.slice(q) : S); | |
| var e; | |
| if ( | |
| z === null || | |
| (e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), 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; | |
| } | |
| ]; | |
| }, UNSUPPORTED_Y); | |
| /***/ }), | |
| /* 62 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var collection = __webpack_require__(158); | |
| var collectionStrong = __webpack_require__(257); | |
| // `Set` constructor | |
| // https://tc39.es/ecma262/#sec-set-objects | |
| module.exports = collection('Set', function (init) { | |
| return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; | |
| }, collectionStrong); | |
| /***/ }), | |
| /* 63 */ | |
| /***/ (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; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 64 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.toSingleLine = toSingleLine; | |
| __webpack_require__(29); | |
| __webpack_require__(51); | |
| __webpack_require__(129); | |
| var _array = __webpack_require__(3); | |
| /** | |
| * 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(); | |
| } | |
| /***/ }), | |
| /* 65 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var toObject = __webpack_require__(68); | |
| var hasOwnProperty = {}.hasOwnProperty; | |
| module.exports = function hasOwn(it, key) { | |
| return hasOwnProperty.call(toObject(it), key); | |
| }; | |
| /***/ }), | |
| /* 66 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var IE8_DOM_DEFINE = __webpack_require__(229); | |
| var anObject = __webpack_require__(47); | |
| var toPrimitive = __webpack_require__(118); | |
| // eslint-disable-next-line es/no-object-defineproperty -- safe | |
| var $defineProperty = Object.defineProperty; | |
| // `Object.defineProperty` method | |
| // https://tc39.es/ecma262/#sec-object.defineproperty | |
| exports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attributes) { | |
| anObject(O); | |
| P = toPrimitive(P, true); | |
| anObject(Attributes); | |
| if (IE8_DOM_DEFINE) try { | |
| return $defineProperty(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; | |
| }; | |
| /***/ }), | |
| /* 67 */ | |
| /***/ (function(module, exports) { | |
| // `RequireObjectCoercible` abstract operation | |
| // https://tc39.es/ecma262/#sec-requireobjectcoercible | |
| module.exports = function (it) { | |
| if (it == undefined) throw TypeError("Can't call method on " + it); | |
| return it; | |
| }; | |
| /***/ }), | |
| /* 68 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var requireObjectCoercible = __webpack_require__(67); | |
| // `ToObject` abstract operation | |
| // https://tc39.es/ecma262/#sec-toobject | |
| module.exports = function (argument) { | |
| return Object(requireObjectCoercible(argument)); | |
| }; | |
| /***/ }), | |
| /* 69 */ | |
| /***/ (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__(20); | |
| /* 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); | |
| } | |
| } | |
| /***/ }), | |
| /* 70 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.isPrintableChar = isPrintableChar; | |
| exports.isMetaKey = isMetaKey; | |
| exports.isCtrlKey = isCtrlKey; | |
| exports.isCtrlMetaKey = isCtrlMetaKey; | |
| exports.isKey = isKey; | |
| exports.KEY_CODES = void 0; | |
| __webpack_require__(17); | |
| __webpack_require__(26); | |
| __webpack_require__(34); | |
| __webpack_require__(29); | |
| __webpack_require__(61); | |
| var _array = __webpack_require__(3); | |
| var KEY_CODES = { | |
| MOUSE_LEFT: 1, | |
| MOUSE_RIGHT: 3, | |
| MOUSE_MIDDLE: 2, | |
| BACKSPACE: 8, | |
| COMMA: 188, | |
| INSERT: 45, | |
| DELETE: 46, | |
| END: 35, | |
| ENTER: 13, | |
| ESCAPE: 27, | |
| CONTROL: 17, | |
| COMMAND_LEFT: 91, | |
| COMMAND_RIGHT: 93, | |
| COMMAND_FIREFOX: 224, | |
| ALT: 18, | |
| HOME: 36, | |
| PAGE_DOWN: 34, | |
| PAGE_UP: 33, | |
| PERIOD: 190, | |
| SPACE: 32, | |
| SHIFT: 16, | |
| CAPS_LOCK: 20, | |
| TAB: 9, | |
| ARROW_RIGHT: 39, | |
| ARROW_LEFT: 37, | |
| ARROW_UP: 38, | |
| ARROW_DOWN: 40, | |
| F1: 112, | |
| F2: 113, | |
| F3: 114, | |
| F4: 115, | |
| F5: 116, | |
| F6: 117, | |
| F7: 118, | |
| F8: 119, | |
| F9: 120, | |
| F10: 121, | |
| F11: 122, | |
| F12: 123, | |
| A: 65, | |
| C: 67, | |
| D: 68, | |
| F: 70, | |
| L: 76, | |
| O: 79, | |
| P: 80, | |
| S: 83, | |
| V: 86, | |
| X: 88 | |
| }; | |
| /** | |
| * Returns true if keyCode represents a printable character. | |
| * | |
| * @param {number} keyCode The keyboard key code. | |
| * @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 The keyboard key code. | |
| * @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 The keyboard key code. | |
| * @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 The keyboard key code. | |
| * @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 The keyboard key code. | |
| * @param {string} baseCode The list of the key codes to compare with. | |
| * @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; | |
| } | |
| /***/ }), | |
| /* 71 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var fails = __webpack_require__(32); | |
| var toIndexedObject = __webpack_require__(74); | |
| var nativeGetOwnPropertyDescriptor = __webpack_require__(93).f; | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); }); | |
| var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES; | |
| // `Object.getOwnPropertyDescriptor` method | |
| // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor | |
| $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, { | |
| getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { | |
| return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key); | |
| } | |
| }); | |
| /***/ }), | |
| /* 72 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var ownKeys = __webpack_require__(233); | |
| var toIndexedObject = __webpack_require__(74); | |
| var getOwnPropertyDescriptorModule = __webpack_require__(93); | |
| var createProperty = __webpack_require__(122); | |
| // `Object.getOwnPropertyDescriptors` method | |
| // https://tc39.es/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; | |
| } | |
| }); | |
| /***/ }), | |
| /* 73 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var IndexedObject = __webpack_require__(117); | |
| var toIndexedObject = __webpack_require__(74); | |
| var arrayMethodIsStrict = __webpack_require__(108); | |
| var nativeJoin = [].join; | |
| var ES3_STRINGS = IndexedObject != Object; | |
| var STRICT_METHOD = arrayMethodIsStrict('join', ','); | |
| // `Array.prototype.join` method | |
| // https://tc39.es/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); | |
| } | |
| }); | |
| /***/ }), | |
| /* 74 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| // toObject with fallback for non-array-like ES3 strings | |
| var IndexedObject = __webpack_require__(117); | |
| var requireObjectCoercible = __webpack_require__(67); | |
| module.exports = function (it) { | |
| return IndexedObject(requireObjectCoercible(it)); | |
| }; | |
| /***/ }), | |
| /* 75 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.toUpperCaseFirst = toUpperCaseFirst; | |
| exports.equalsIgnoreCase = equalsIgnoreCase; | |
| exports.randomString = randomString; | |
| exports.isPercentValue = isPercentValue; | |
| exports.substitute = substitute; | |
| exports.stripTags = stripTags; | |
| exports.sanitize = sanitize; | |
| __webpack_require__(17); | |
| __webpack_require__(9); | |
| __webpack_require__(52); | |
| __webpack_require__(29); | |
| __webpack_require__(51); | |
| var _dompurify = _interopRequireDefault(__webpack_require__(258)); | |
| var _mixed = __webpack_require__(20); | |
| /** | |
| * 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. | |
| * | |
| * @returns {string} Returns 16-long character random string (eq. `'92b1bfc74ec4'`). | |
| */ | |
| function randomString() { | |
| /** | |
| * @returns {string} | |
| */ | |
| 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 The value to check. | |
| * @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]; | |
| }); | |
| } | |
| /** | |
| * Strip any HTML tag from the string. | |
| * | |
| * @param {string} string String to cut HTML from. | |
| * @returns {string} | |
| */ | |
| function stripTags(string) { | |
| return sanitize("".concat(string), { | |
| ALLOWED_TAGS: [] | |
| }); | |
| } | |
| /** | |
| * Sanitizes string from potential security vulnerabilities. | |
| * | |
| * @param {string} string String to sanitize. | |
| * @param {object} [options] DOMPurify's configuration object. | |
| * @returns {string} | |
| */ | |
| function sanitize(string, options) { | |
| return _dompurify.default.sanitize(string, options); | |
| } | |
| /***/ }), | |
| /* 76 */ | |
| /***/ (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__(501)("./" + 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', // <input type="datetime-local" /> | |
| DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" /> | |
| DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" /> | |
| DATE: 'YYYY-MM-DD', // <input type="date" /> | |
| TIME: 'HH:mm', // <input type="time" /> | |
| TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" /> | |
| TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" /> | |
| WEEK: 'GGGG-[W]WW', // <input type="week" /> | |
| MONTH: 'YYYY-MM' // <input type="month" /> | |
| }; | |
| return hooks; | |
| }))); | |
| /*** EXPORTS FROM exports-to-window-loader ***/ | |
| window['moment'] = __webpack_require__(76); | |
| /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(500)(module))) | |
| /***/ }), | |
| /* 77 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var $map = __webpack_require__(102).map; | |
| var arrayMethodHasSpeciesSupport = __webpack_require__(123); | |
| var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map'); | |
| // `Array.prototype.map` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.map | |
| // with adding support of @@species | |
| $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { | |
| map: function map(callbackfn /* , thisArg */) { | |
| return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); | |
| } | |
| }); | |
| /***/ }), | |
| /* 78 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| 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; | |
| __webpack_require__(17); | |
| __webpack_require__(29); | |
| __webpack_require__(51); | |
| __webpack_require__(19); | |
| __webpack_require__(33); | |
| __webpack_require__(79); | |
| __webpack_require__(190); | |
| var _array = __webpack_require__(3); | |
| var _element = __webpack_require__(10); | |
| var _separator = __webpack_require__(217); | |
| /** | |
| * @param {CellRange[]} selRanges An array of the cell ranges. | |
| * @returns {object[]} | |
| */ | |
| function normalizeSelection(selRanges) { | |
| return (0, _array.arrayMap)(selRanges, function (range) { | |
| return { | |
| start: range.getTopLeftCorner(), | |
| end: range.getBottomRightCorner() | |
| }; | |
| }); | |
| } | |
| /** | |
| * @param {HTMLElement} cell The HTML cell element to check. | |
| * @returns {boolean} | |
| */ | |
| function isSeparator(cell) { | |
| return (0, _element.hasClass)(cell, 'htSeparator'); | |
| } | |
| /** | |
| * @param {HTMLElement} cell The HTML cell element to check. | |
| * @returns {boolean} | |
| */ | |
| function hasSubMenu(cell) { | |
| return (0, _element.hasClass)(cell, 'htSubmenu'); | |
| } | |
| /** | |
| * @param {HTMLElement} cell The HTML cell element to check. | |
| * @returns {boolean} | |
| */ | |
| function isDisabled(cell) { | |
| return (0, _element.hasClass)(cell, 'htDisabled'); | |
| } | |
| /** | |
| * @param {HTMLElement} cell The HTML cell element to check. | |
| * @returns {boolean} | |
| */ | |
| function isSelectionDisabled(cell) { | |
| return (0, _element.hasClass)(cell, 'htSelectionDisabled'); | |
| } | |
| /** | |
| * @param {Core} hot The Handsontable instance. | |
| * @returns {Array[]|null} | |
| */ | |
| function getValidSelection(hot) { | |
| var selected = hot.getSelected(); | |
| if (!selected) { | |
| return null; | |
| } | |
| if (selected[0] < 0) { | |
| return null; | |
| } | |
| return selected; | |
| } | |
| /** | |
| * @param {string} className The full element class name to process. | |
| * @param {string} alignment The slignment class name to compare with. | |
| * @returns {string} | |
| */ | |
| 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); | |
| } | |
| /** | |
| * @param {string} className The full element class name to process. | |
| * @param {string} alignment The slignment class name to compare with. | |
| * @returns {string} | |
| */ | |
| 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); | |
| } | |
| /** | |
| * @param {CellRange[]} ranges An array of the cell ranges. | |
| * @param {Function} callback The callback function. | |
| * @returns {object} | |
| */ | |
| function getAlignmentClasses(ranges, callback) { | |
| var classes = {}; | |
| (0, _array.arrayEach)(ranges, function (range) { | |
| range.forAll(function (row, col) { | |
| // Alignment classes should only collected within cell ranges. We skip header coordinates. | |
| if (row >= 0 && col >= 0) { | |
| if (!classes[row]) { | |
| classes[row] = []; | |
| } | |
| classes[row][col] = callback(row, col); | |
| } | |
| }); | |
| }); | |
| return classes; | |
| } | |
| /** | |
| * @param {CellRange[]} ranges An array of the cell ranges. | |
| * @param {string} type The type of the alignment axis ('horizontal' or 'vertical'). | |
| * @param {string} alignment CSS class name to add. | |
| * @param {Function} cellDescriptor The function which fetches the cell meta object based in passed coordinates. | |
| * @param {Function} propertySetter The function which contains logic for added/removed alignment. | |
| */ | |
| function align(ranges, type, alignment, cellDescriptor, propertySetter) { | |
| (0, _array.arrayEach)(ranges, function (range) { | |
| range.forAll(function (row, col) { | |
| // Alignment classes should only collected within cell ranges. We skip header coordinates. | |
| if (row >= 0 && col >= 0) { | |
| applyAlignClassName(row, col, type, alignment, cellDescriptor, propertySetter); | |
| } | |
| }); | |
| }); | |
| } | |
| /** | |
| * @param {number} row The visual row index. | |
| * @param {number} col The visual column index. | |
| * @param {string} type The type of the alignment axis ('horizontal' or 'vertical'). | |
| * @param {string} alignment CSS class name to add. | |
| * @param {Function} cellDescriptor The function which fetches the cell meta object based in passed coordinates. | |
| * @param {Function} propertySetter The function which contains logic for added/removed alignment. | |
| */ | |
| 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); | |
| } | |
| /** | |
| * @param {CellRange[]} ranges An array of the cell ranges. | |
| * @param {Function} comparator The comparator function. | |
| * @returns {boolean} | |
| */ | |
| function checkSelectionConsistency(ranges, comparator) { | |
| var result = false; | |
| if (Array.isArray(ranges)) { | |
| (0, _array.arrayEach)(ranges, function (range) { | |
| range.forAll(function (row, col) { | |
| // Selection consistency should only check within cell ranges. We skip header coordinates. | |
| if (row >= 0 && col >= 0 && comparator(row, col)) { | |
| result = true; | |
| return false; | |
| } | |
| }); | |
| return result; | |
| }); | |
| } | |
| return result; | |
| } | |
| /** | |
| * @param {string} label The label text. | |
| * @returns {string} | |
| */ | |
| function markLabelAsSelected(label) { | |
| // workaround for https://github.com/handsontable/handsontable/issues/1946 | |
| return "<span class=\"selected\">".concat(String.fromCharCode(10003), "</span>").concat(label); | |
| } | |
| /** | |
| * @param {object} item The object which describes the context menu item properties. | |
| * @param {Core} instance The Handsontable instance. | |
| * @returns {boolean} | |
| */ | |
| function isItemHidden(item, instance) { | |
| return !item.hidden || !(typeof item.hidden === 'function' && item.hidden.call(instance)); | |
| } | |
| /** | |
| * @param {object[]} items The context menu items collection. | |
| * @param {string} separator The string which identifies the context menu separator item. | |
| * @returns {object[]} | |
| */ | |
| 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; | |
| } | |
| /** | |
| * @param {object[]} items The context menu items collection. | |
| * @param {string} separator The string which identifies the context menu separator item. | |
| * @returns {object[]} | |
| */ | |
| function popSeparators(items, separator) { | |
| var result = items.slice(0); | |
| result.reverse(); | |
| result = shiftSeparators(result, separator); | |
| result.reverse(); | |
| return result; | |
| } | |
| /** | |
| * Removes duplicated menu separators from the context menu items collection. | |
| * | |
| * @param {object[]} items The context menu items collection. | |
| * @returns {object[]} | |
| */ | |
| 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; | |
| } | |
| /** | |
| * Removes menu separators from the context menu items collection. | |
| * | |
| * @param {object[]} items The context menu items collection. | |
| * @param {string} separator The string which identifies the context menu separator item. | |
| * @returns {object[]} | |
| */ | |
| 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; | |
| } | |
| /***/ }), | |
| /* 79 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var defineProperty = __webpack_require__(66).f; | |
| var FunctionPrototype = Function.prototype; | |
| var FunctionPrototypeToString = FunctionPrototype.toString; | |
| var nameRE = /^\s*function ([^ (]*)/; | |
| var NAME = 'name'; | |
| // Function instances `.name` property | |
| // https://tc39.es/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 ''; | |
| } | |
| } | |
| }); | |
| } | |
| /***/ }), | |
| /* 80 */ | |
| /***/ (function(module, exports) { | |
| exports.nil = new Error('#NULL!'); | |
| exports.div0 = new Error('#DIV/0!'); | |
| exports.value = new Error('#VALUE!'); | |
| exports.ref = new Error('#REF!'); | |
| exports.name = new Error('#NAME?'); | |
| exports.num = new Error('#NUM!'); | |
| exports.na = new Error('#N/A'); | |
| exports.error = new Error('#ERROR!'); | |
| exports.data = new Error('#GETTING_DATA'); | |
| /***/ }), | |
| /* 81 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var aFunction = __webpack_require__(107); | |
| var toObject = __webpack_require__(68); | |
| var fails = __webpack_require__(32); | |
| var arrayMethodIsStrict = __webpack_require__(108); | |
| var test = []; | |
| var nativeSort = test.sort; | |
| // IE8- | |
| var FAILS_ON_UNDEFINED = fails(function () { | |
| test.sort(undefined); | |
| }); | |
| // V8 bug | |
| var FAILS_ON_NULL = fails(function () { | |
| test.sort(null); | |
| }); | |
| // Old WebKit | |
| var STRICT_METHOD = arrayMethodIsStrict('sort'); | |
| var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD; | |
| // `Array.prototype.sort` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.sort | |
| $({ target: 'Array', proto: true, forced: FORCED }, { | |
| sort: function sort(comparefn) { | |
| return comparefn === undefined | |
| ? nativeSort.call(toObject(this)) | |
| : nativeSort.call(toObject(this), aFunction(comparefn)); | |
| } | |
| }); | |
| /***/ }), | |
| /* 82 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var definePropertyModule = __webpack_require__(66); | |
| var createPropertyDescriptor = __webpack_require__(116); | |
| module.exports = DESCRIPTORS ? function (object, key, value) { | |
| return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); | |
| } : function (object, key, value) { | |
| object[key] = value; | |
| return object; | |
| }; | |
| /***/ }), | |
| /* 83 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var global = __webpack_require__(40); | |
| var createNonEnumerableProperty = __webpack_require__(82); | |
| var has = __webpack_require__(65); | |
| var setGlobal = __webpack_require__(173); | |
| var inspectSource = __webpack_require__(230); | |
| var InternalStateModule = __webpack_require__(95); | |
| 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; | |
| var state; | |
| if (typeof value == 'function') { | |
| if (typeof key == 'string' && !has(value, 'name')) { | |
| createNonEnumerableProperty(value, 'name', key); | |
| } | |
| state = enforceInternalState(value); | |
| if (!state.source) { | |
| state.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); | |
| }); | |
| /***/ }), | |
| /* 84 */ | |
| /***/ (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.isIE9 = isIE9; | |
| exports.isMSBrowser = isMSBrowser; | |
| exports.isMobileBrowser = isMobileBrowser; | |
| exports.isIOS = isIOS; | |
| exports.isIpadOS = isIpadOS; | |
| exports.isSafari = isSafari; | |
| exports.isFirefox = isFirefox; | |
| exports.isWindowsOS = isWindowsOS; | |
| exports.isMacOS = isMacOS; | |
| exports.isLinuxOS = isLinuxOS; | |
| var _object = __webpack_require__(5); | |
| 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 | |
| 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); | |
| }), | |
| ios: tester(function (ua) { | |
| return /iPhone|iPad|iPod/i.test(ua); | |
| }) | |
| }; | |
| /** | |
| * @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(); | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isChrome() { | |
| return browsers.chrome.value; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isEdge() { | |
| return browsers.edge.value; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isIE() { | |
| return browsers.ie.value; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isIE9() { | |
| return browsers.ie9.value; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isMSBrowser() { | |
| return browsers.ie.value || browsers.edge.value; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isMobileBrowser() { | |
| return browsers.mobile.value; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isIOS() { | |
| return platforms.ios.value; | |
| } | |
| /** | |
| * A hacky way to recognize the iPad. Since iOS 13, the iPad on Safari mimics macOS behavior and user agent. | |
| * | |
| * @see {@https://stackoverflow.com/a/57838385} | |
| * @param {object} [metaObject] The browser identity collection. | |
| * @returns {boolean} | |
| */ | |
| function isIpadOS() { | |
| var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : navigator, | |
| maxTouchPoints = _ref5.maxTouchPoints; | |
| return maxTouchPoints > 2 && platforms.mac.value; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isSafari() { | |
| return browsers.safari.value; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| 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; | |
| } | |
| /***/ }), | |
| /* 85 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.CUSTOM_SELECTION_TYPE = exports.HEADER_TYPE = exports.FILL_TYPE = exports.CELL_TYPE = exports.AREA_TYPE = exports.ACTIVE_HEADER_TYPE = void 0; | |
| 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_TYPE = 'custom-selection'; | |
| exports.CUSTOM_SELECTION_TYPE = CUSTOM_SELECTION_TYPE; | |
| /***/ }), | |
| /* 86 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var error = __webpack_require__(80); | |
| exports.flattenShallow = function(array) { | |
| if (!array || !array.reduce) { | |
| return array; | |
| } | |
| return array.reduce(function(a, b) { | |
| var aIsArray = Array.isArray(a); | |
| var bIsArray = Array.isArray(b); | |
| if (aIsArray && bIsArray ) { | |
| return a.concat(b); | |
| } | |
| if (aIsArray) { | |
| a.push(b); | |
| return a; | |
| } | |
| if (bIsArray) { | |
| return [a].concat(b); | |
| } | |
| return [a, b]; | |
| }); | |
| }; | |
| exports.isFlat = function(array) { | |
| if (!array) { | |
| return false; | |
| } | |
| for (var i = 0; i < array.length; ++i) { | |
| if (Array.isArray(array[i])) { | |
| return false; | |
| } | |
| } | |
| return true; | |
| }; | |
| exports.flatten = function() { | |
| var result = exports.argsToArray.apply(null, arguments); | |
| while (!exports.isFlat(result)) { | |
| result = exports.flattenShallow(result); | |
| } | |
| return result; | |
| }; | |
| exports.argsToArray = function(args) { | |
| var result = []; | |
| exports.arrayEach(args, function(value) { | |
| result.push(value); | |
| }); | |
| return result; | |
| }; | |
| exports.numbers = function() { | |
| var possibleNumbers = this.flatten.apply(null, arguments); | |
| return possibleNumbers.filter(function(el) { | |
| return typeof el === 'number'; | |
| }); | |
| }; | |
| exports.cleanFloat = function(number) { | |
| var power = 1e14; | |
| return Math.round(number * power) / power; | |
| }; | |
| exports.parseBool = function(bool) { | |
| if (typeof bool === 'boolean') { | |
| return bool; | |
| } | |
| if (bool instanceof Error) { | |
| return bool; | |
| } | |
| if (typeof bool === 'number') { | |
| return bool !== 0; | |
| } | |
| if (typeof bool === 'string') { | |
| var up = bool.toUpperCase(); | |
| if (up === 'TRUE') { | |
| return true; | |
| } | |
| if (up === 'FALSE') { | |
| return false; | |
| } | |
| } | |
| if (bool instanceof Date && !isNaN(bool)) { | |
| return true; | |
| } | |
| return error.value; | |
| }; | |
| exports.parseNumber = function(string) { | |
| if (string === undefined || string === '') { | |
| return error.value; | |
| } | |
| if (!isNaN(string)) { | |
| return parseFloat(string); | |
| } | |
| return error.value; | |
| }; | |
| exports.parseNumberArray = function(arr) { | |
| var len; | |
| if (!arr || (len = arr.length) === 0) { | |
| return error.value; | |
| } | |
| var parsed; | |
| while (len--) { | |
| parsed = exports.parseNumber(arr[len]); | |
| if (parsed === error.value) { | |
| return parsed; | |
| } | |
| arr[len] = parsed; | |
| } | |
| return arr; | |
| }; | |
| exports.parseMatrix = function(matrix) { | |
| var n; | |
| if (!matrix || (n = matrix.length) === 0) { | |
| return error.value; | |
| } | |
| var pnarr; | |
| for (var i = 0; i < matrix.length; i++) { | |
| pnarr = exports.parseNumberArray(matrix[i]); | |
| matrix[i] = pnarr; | |
| if (pnarr instanceof Error) { | |
| return pnarr; | |
| } | |
| } | |
| return matrix; | |
| }; | |
| var d1900 = new Date(Date.UTC(1900, 0, 1)); | |
| exports.parseDate = function(date) { | |
| if (!isNaN(date)) { | |
| if (date instanceof Date) { | |
| return new Date(date); | |
| } | |
| var d = parseInt(date, 10); | |
| if (d < 0) { | |
| return error.num; | |
| } | |
| if (d <= 60) { | |
| return new Date(d1900.getTime() + (d - 1) * 86400000); | |
| } | |
| return new Date(d1900.getTime() + (d - 2) * 86400000); | |
| } | |
| if (typeof date === 'string') { | |
| date = new Date(date); | |
| if (!isNaN(date)) { | |
| return date; | |
| } | |
| } | |
| return error.value; | |
| }; | |
| exports.parseDateArray = function(arr) { | |
| var len = arr.length; | |
| var parsed; | |
| while (len--) { | |
| parsed = this.parseDate(arr[len]); | |
| if (parsed === error.value) { | |
| return parsed; | |
| } | |
| arr[len] = parsed; | |
| } | |
| return arr; | |
| }; | |
| exports.anyIsError = function() { | |
| var n = arguments.length; | |
| while (n--) { | |
| if (arguments[n] instanceof Error) { | |
| return true; | |
| } | |
| } | |
| return false; | |
| }; | |
| exports.arrayValuesToNumbers = function(arr) { | |
| var n = arr.length; | |
| var el; | |
| while (n--) { | |
| el = arr[n]; | |
| if (typeof el === 'number') { | |
| continue; | |
| } | |
| if (el === true) { | |
| arr[n] = 1; | |
| continue; | |
| } | |
| if (el === false) { | |
| arr[n] = 0; | |
| continue; | |
| } | |
| if (typeof el === 'string') { | |
| var number = this.parseNumber(el); | |
| if (number instanceof Error) { | |
| arr[n] = 0; | |
| } else { | |
| arr[n] = number; | |
| } | |
| } | |
| } | |
| return arr; | |
| }; | |
| exports.rest = function(array, idx) { | |
| idx = idx || 1; | |
| if (!array || typeof array.slice !== 'function') { | |
| return array; | |
| } | |
| return array.slice(idx); | |
| }; | |
| exports.initial = function(array, idx) { | |
| idx = idx || 1; | |
| if (!array || typeof array.slice !== 'function') { | |
| return array; | |
| } | |
| return array.slice(0, array.length - idx); | |
| }; | |
| exports.arrayEach = function(array, iteratee) { | |
| var index = -1, length = array.length; | |
| while (++index < length) { | |
| if (iteratee(array[index], index, array) === false) { | |
| break; | |
| } | |
| } | |
| return array; | |
| }; | |
| exports.transpose = function(matrix) { | |
| if(!matrix) { | |
| return error.value; | |
| } | |
| return matrix[0].map(function(col, i) { | |
| return matrix.map(function(row) { | |
| return row[i]; | |
| }); | |
| }); | |
| }; | |
| /***/ }), | |
| /* 87 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.CLONE_TYPES = exports.CLONE_BOTTOM_LEFT_CORNER = exports.CLONE_TOP_LEFT_CORNER = exports.CLONE_LEFT = exports.CLONE_BOTTOM = exports.CLONE_TOP = void 0; | |
| var CLONE_TOP = 'top'; | |
| exports.CLONE_TOP = CLONE_TOP; | |
| var CLONE_BOTTOM = 'bottom'; | |
| exports.CLONE_BOTTOM = CLONE_BOTTOM; | |
| var CLONE_LEFT = 'left'; | |
| exports.CLONE_LEFT = CLONE_LEFT; | |
| var CLONE_TOP_LEFT_CORNER = 'top_left_corner'; | |
| exports.CLONE_TOP_LEFT_CORNER = CLONE_TOP_LEFT_CORNER; | |
| var CLONE_BOTTOM_LEFT_CORNER = 'bottom_left_corner'; | |
| exports.CLONE_BOTTOM_LEFT_CORNER = CLONE_BOTTOM_LEFT_CORNER; | |
| var CLONE_TYPES = [CLONE_TOP, CLONE_BOTTOM, CLONE_LEFT, CLONE_TOP_LEFT_CORNER, CLONE_BOTTOM_LEFT_CORNER]; | |
| exports.CLONE_TYPES = CLONE_TYPES; | |
| /***/ }), | |
| /* 88 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var classApplyDescriptorGet = __webpack_require__(551); | |
| var classExtractFieldDescriptor = __webpack_require__(417); | |
| function _classPrivateFieldGet(receiver, privateMap) { | |
| var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get"); | |
| return classApplyDescriptorGet(receiver, descriptor); | |
| } | |
| module.exports = _classPrivateFieldGet; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 89 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var classApplyDescriptorSet = __webpack_require__(552); | |
| var classExtractFieldDescriptor = __webpack_require__(417); | |
| function _classPrivateFieldSet(receiver, privateMap, value) { | |
| var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); | |
| classApplyDescriptorSet(receiver, descriptor, value); | |
| return value; | |
| } | |
| module.exports = _classPrivateFieldSet; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 90 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var objectWithoutPropertiesLoose = __webpack_require__(560); | |
| function _objectWithoutProperties(source, excluded) { | |
| if (source == null) return {}; | |
| var target = objectWithoutPropertiesLoose(source, excluded); | |
| var key, i; | |
| if (Object.getOwnPropertySymbols) { | |
| var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | |
| for (i = 0; i < sourceSymbolKeys.length; i++) { | |
| key = sourceSymbolKeys[i]; | |
| if (excluded.indexOf(key) >= 0) continue; | |
| if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | |
| target[key] = source[key]; | |
| } | |
| } | |
| return target; | |
| } | |
| module.exports = _objectWithoutProperties; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 91 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| var _interopRequireWildcard = __webpack_require__(14); | |
| exports.__esModule = true; | |
| exports.predefinedItems = predefinedItems; | |
| exports.addItem = addItem; | |
| exports.ITEMS = exports.UNDO = exports.NO_ITEMS = exports.SEPARATOR = exports.ROW_BELOW = exports.ROW_ABOVE = exports.REMOVE_ROW = exports.REMOVE_COLUMN = exports.REDO = exports.READ_ONLY = exports.COLUMN_RIGHT = exports.COLUMN_LEFT = exports.CLEAR_COLUMN = exports.ALIGNMENT = void 0; | |
| __webpack_require__(17); | |
| var _defineProperty2 = _interopRequireDefault(__webpack_require__(37)); | |
| var _object = __webpack_require__(5); | |
| var _alignment = _interopRequireWildcard(__webpack_require__(658)); | |
| exports.ALIGNMENT = _alignment.KEY; | |
| var _clearColumn = _interopRequireWildcard(__webpack_require__(659)); | |
| exports.CLEAR_COLUMN = _clearColumn.KEY; | |
| var _columnLeft = _interopRequireWildcard(__webpack_require__(660)); | |
| exports.COLUMN_LEFT = _columnLeft.KEY; | |
| var _columnRight = _interopRequireWildcard(__webpack_require__(661)); | |
| exports.COLUMN_RIGHT = _columnRight.KEY; | |
| var _readOnly = _interopRequireWildcard(__webpack_require__(662)); | |
| exports.READ_ONLY = _readOnly.KEY; | |
| var _redo = _interopRequireWildcard(__webpack_require__(663)); | |
| exports.REDO = _redo.KEY; | |
| var _removeColumn = _interopRequireWildcard(__webpack_require__(664)); | |
| exports.REMOVE_COLUMN = _removeColumn.KEY; | |
| var _removeRow = _interopRequireWildcard(__webpack_require__(665)); | |
| exports.REMOVE_ROW = _removeRow.KEY; | |
| var _rowAbove = _interopRequireWildcard(__webpack_require__(666)); | |
| exports.ROW_ABOVE = _rowAbove.KEY; | |
| var _rowBelow = _interopRequireWildcard(__webpack_require__(667)); | |
| exports.ROW_BELOW = _rowBelow.KEY; | |
| var _separator = _interopRequireWildcard(__webpack_require__(217)); | |
| exports.SEPARATOR = _separator.KEY; | |
| var _noItems = _interopRequireWildcard(__webpack_require__(668)); | |
| exports.NO_ITEMS = _noItems.KEY; | |
| var _undo = _interopRequireWildcard(__webpack_require__(669)); | |
| exports.UNDO = _undo.KEY; | |
| var _predefinedItems2; | |
| var ITEMS = [_rowAbove.KEY, _rowBelow.KEY, _columnLeft.KEY, _columnRight.KEY, _clearColumn.KEY, _removeRow.KEY, _removeColumn.KEY, _undo.KEY, _redo.KEY, _readOnly.KEY, _alignment.KEY, _separator.KEY, _noItems.KEY]; | |
| exports.ITEMS = ITEMS; | |
| var _predefinedItems = (_predefinedItems2 = {}, (0, _defineProperty2.default)(_predefinedItems2, _separator.KEY, _separator.default), (0, _defineProperty2.default)(_predefinedItems2, _noItems.KEY, _noItems.default), (0, _defineProperty2.default)(_predefinedItems2, _rowAbove.KEY, _rowAbove.default), (0, _defineProperty2.default)(_predefinedItems2, _rowBelow.KEY, _rowBelow.default), (0, _defineProperty2.default)(_predefinedItems2, _columnLeft.KEY, _columnLeft.default), (0, _defineProperty2.default)(_predefinedItems2, _columnRight.KEY, _columnRight.default), (0, _defineProperty2.default)(_predefinedItems2, _clearColumn.KEY, _clearColumn.default), (0, _defineProperty2.default)(_predefinedItems2, _removeRow.KEY, _removeRow.default), (0, _defineProperty2.default)(_predefinedItems2, _removeColumn.KEY, _removeColumn.default), (0, _defineProperty2.default)(_predefinedItems2, _undo.KEY, _undo.default), (0, _defineProperty2.default)(_predefinedItems2, _redo.KEY, _redo.default), (0, _defineProperty2.default)(_predefinedItems2, _readOnly.KEY, _readOnly.default), (0, _defineProperty2.default)(_predefinedItems2, _alignment.KEY, _alignment.default), _predefinedItems2); | |
| /** | |
| * Gets new object with all predefined menu items. | |
| * | |
| * @returns {object} | |
| */ | |
| function predefinedItems() { | |
| var items = {}; | |
| (0, _object.objectEach)(_predefinedItems, function (itemFactory, key) { | |
| items[key] = itemFactory(); | |
| }); | |
| return items; | |
| } | |
| /** | |
| * Add new predefined menu item to the collection. | |
| * | |
| * @param {string} key Menu command id. | |
| * @param {object} item Object command descriptor. | |
| */ | |
| function addItem(key, item) { | |
| if (ITEMS.indexOf(key) === -1) { | |
| _predefinedItems[key] = item; | |
| } | |
| } | |
| /***/ }), | |
| /* 92 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__(6); | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| __webpack_require__(17); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _inherits2 = _interopRequireDefault(__webpack_require__(7)); | |
| var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(8)); | |
| var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(4)); | |
| var _hotFormulaParser = __webpack_require__(145); | |
| var _array = __webpack_require__(3); | |
| var _base = _interopRequireDefault(__webpack_require__(467)); | |
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | |
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | |
| var STATE_OUT_OFF_DATE = 1; | |
| var STATE_COMPUTING = 2; | |
| var STATE_UP_TO_DATE = 3; | |
| var states = [STATE_OUT_OFF_DATE, STATE_COMPUTING, STATE_UP_TO_DATE]; | |
| /** | |
| * Class responsible for wrapping formula expression. It contains calculated value of | |
| * the formula, an error if it has happened and cell references which indicates a relationship with regular | |
| * cells. This object uses physical cell coordinates. | |
| * | |
| * @class CellValue | |
| * @util | |
| */ | |
| var CellValue = /*#__PURE__*/function (_BaseCell) { | |
| (0, _inherits2.default)(CellValue, _BaseCell); | |
| var _super = _createSuper(CellValue); | |
| function CellValue(row, column) { | |
| var _this; | |
| (0, _classCallCheck2.default)(this, CellValue); | |
| _this = _super.call(this, row, column); | |
| /** | |
| * List of precedents cells. | |
| * | |
| * @type {Array} | |
| */ | |
| _this.precedents = []; | |
| /** | |
| * Computed value. | |
| * | |
| * @type {*} | |
| */ | |
| _this.value = null; | |
| /** | |
| * Error name. | |
| * | |
| * @type {string|null} | |
| */ | |
| _this.error = null; | |
| /** | |
| * Indicates cell state. | |
| * | |
| * @type {string} | |
| */ | |
| _this.state = CellValue.STATE_UP_TO_DATE; | |
| return _this; | |
| } | |
| /** | |
| * Set computed value. | |
| * | |
| * @param {*} value The calculated formula value. | |
| */ | |
| (0, _createClass2.default)(CellValue, [{ | |
| key: "setValue", | |
| value: function setValue(value) { | |
| this.value = value; | |
| } | |
| /** | |
| * Get computed value. | |
| * | |
| * @returns {*} | |
| */ | |
| }, { | |
| key: "getValue", | |
| value: function getValue() { | |
| return this.value; | |
| } | |
| /** | |
| * Set error message for this cell. | |
| * | |
| * @param {string} error Error name. | |
| */ | |
| }, { | |
| key: "setError", | |
| value: function setError(error) { | |
| this.error = error; | |
| } | |
| /** | |
| * Get error name for this cell. | |
| * | |
| * @returns {string|null} | |
| */ | |
| }, { | |
| key: "getError", | |
| value: function getError() { | |
| return this.error; | |
| } | |
| /** | |
| * Check if cell value is marked as error. | |
| * | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "hasError", | |
| value: function hasError() { | |
| return this.error !== null; | |
| } | |
| /** | |
| * Set cell state. | |
| * | |
| * @param {number} state Cell state. | |
| */ | |
| }, { | |
| key: "setState", | |
| value: function setState(state) { | |
| if (states.indexOf(state) === -1) { | |
| throw Error("Unrecognized state: ".concat(state)); | |
| } | |
| this.state = state; | |
| } | |
| /** | |
| * Check cell state. | |
| * | |
| * @param {number} state The state to compare with. | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isState", | |
| value: function isState(state) { | |
| return this.state === state; | |
| } | |
| /** | |
| * Add precedent cell to the collection. | |
| * | |
| * @param {CellReference} cellReference Cell reference object. | |
| */ | |
| }, { | |
| key: "addPrecedent", | |
| value: function addPrecedent(cellReference) { | |
| if (this.isEqual(cellReference)) { | |
| throw Error(_hotFormulaParser.ERROR_REF); | |
| } | |
| if (!this.hasPrecedent(cellReference)) { | |
| this.precedents.push(cellReference); | |
| } | |
| } | |
| /** | |
| * Remove precedent cell from the collection. | |
| * | |
| * @param {CellReference} cellReference Cell reference object. | |
| */ | |
| }, { | |
| key: "removePrecedent", | |
| value: function removePrecedent(cellReference) { | |
| if (this.isEqual(cellReference)) { | |
| throw Error(_hotFormulaParser.ERROR_REF); | |
| } | |
| this.precedents = (0, _array.arrayFilter)(this.precedents, function (cell) { | |
| return !cell.isEqual(cellReference); | |
| }); | |
| } | |
| /** | |
| * Clear all precedent cells. | |
| */ | |
| }, { | |
| key: "clearPrecedents", | |
| value: function clearPrecedents() { | |
| this.precedents.length = 0; | |
| } | |
| /** | |
| * Get precedent cells. | |
| * | |
| * @returns {Array} | |
| */ | |
| }, { | |
| key: "getPrecedents", | |
| value: function getPrecedents() { | |
| return this.precedents; | |
| } | |
| /** | |
| * Check if cell value has precedents cells. | |
| * | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "hasPrecedents", | |
| value: function hasPrecedents() { | |
| return this.precedents.length > 0; | |
| } | |
| /** | |
| * Check if cell reference is precedents this cell. | |
| * | |
| * @param {CellReference} cellReference Cell reference object. | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "hasPrecedent", | |
| value: function hasPrecedent(cellReference) { | |
| return (0, _array.arrayFilter)(this.precedents, function (cell) { | |
| return cell.isEqual(cellReference); | |
| }).length > 0; | |
| } | |
| }], [{ | |
| key: "STATE_OUT_OFF_DATE", | |
| get: | |
| /** | |
| * Out of date state indicates cells ready for recomputing. | |
| * | |
| * @returns {number} | |
| */ | |
| function get() { | |
| return 1; // PhantomJS crashes when we want to use constant above | |
| } | |
| /** | |
| * Computing state indicates cells under processing. | |
| * | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "STATE_COMPUTING", | |
| get: function get() { | |
| return 2; // PhantomJS crashes when we want to use constant above | |
| } | |
| /** | |
| * Up to date state indicates cells with fresh computed value. | |
| * | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "STATE_UP_TO_DATE", | |
| get: function get() { | |
| return 3; // PhantomJS crashes when we want to use constant above | |
| } | |
| }]); | |
| return CellValue; | |
| }(_base.default); | |
| var _default = CellValue; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 93 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var propertyIsEnumerableModule = __webpack_require__(147); | |
| var createPropertyDescriptor = __webpack_require__(116); | |
| var toIndexedObject = __webpack_require__(74); | |
| var toPrimitive = __webpack_require__(118); | |
| var has = __webpack_require__(65); | |
| var IE8_DOM_DEFINE = __webpack_require__(229); | |
| // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe | |
| var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | |
| // `Object.getOwnPropertyDescriptor` method | |
| // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor | |
| exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { | |
| O = toIndexedObject(O); | |
| P = toPrimitive(P, true); | |
| if (IE8_DOM_DEFINE) try { | |
| return $getOwnPropertyDescriptor(O, P); | |
| } catch (error) { /* empty */ } | |
| if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); | |
| }; | |
| /***/ }), | |
| /* 94 */ | |
| /***/ (function(module, exports) { | |
| var toString = {}.toString; | |
| module.exports = function (it) { | |
| return toString.call(it).slice(8, -1); | |
| }; | |
| /***/ }), | |
| /* 95 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var NATIVE_WEAK_MAP = __webpack_require__(231); | |
| var global = __webpack_require__(40); | |
| var isObject = __webpack_require__(46); | |
| var createNonEnumerableProperty = __webpack_require__(82); | |
| var objectHas = __webpack_require__(65); | |
| var shared = __webpack_require__(174); | |
| var sharedKey = __webpack_require__(148); | |
| var hiddenKeys = __webpack_require__(119); | |
| var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; | |
| var WeakMap = global.WeakMap; | |
| var set, get, has; | |
| var enforce = function (it) { | |
| return has(it) ? get(it) : set(it, {}); | |
| }; | |
| var getterFor = function (TYPE) { | |
| return function (it) { | |
| var state; | |
| if (!isObject(it) || (state = get(it)).type !== TYPE) { | |
| throw TypeError('Incompatible receiver, ' + TYPE + ' required'); | |
| } return state; | |
| }; | |
| }; | |
| if (NATIVE_WEAK_MAP) { | |
| var store = shared.state || (shared.state = new WeakMap()); | |
| var wmget = store.get; | |
| var wmhas = store.has; | |
| var wmset = store.set; | |
| set = function (it, metadata) { | |
| if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); | |
| metadata.facade = it; | |
| wmset.call(store, it, metadata); | |
| return metadata; | |
| }; | |
| get = function (it) { | |
| return wmget.call(store, it) || {}; | |
| }; | |
| has = function (it) { | |
| return wmhas.call(store, it); | |
| }; | |
| } else { | |
| var STATE = sharedKey('state'); | |
| hiddenKeys[STATE] = true; | |
| set = function (it, metadata) { | |
| if (objectHas(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); | |
| metadata.facade = it; | |
| createNonEnumerableProperty(it, STATE, metadata); | |
| return metadata; | |
| }; | |
| get = function (it) { | |
| return objectHas(it, STATE) ? it[STATE] : {}; | |
| }; | |
| has = function (it) { | |
| return objectHas(it, STATE); | |
| }; | |
| } | |
| module.exports = { | |
| set: set, | |
| get: get, | |
| has: has, | |
| enforce: enforce, | |
| getterFor: getterFor | |
| }; | |
| /***/ }), | |
| /* 96 */ | |
| /***/ (function(module, exports) { | |
| var ceil = Math.ceil; | |
| var floor = Math.floor; | |
| // `ToInteger` abstract operation | |
| // https://tc39.es/ecma262/#sec-tointeger | |
| module.exports = function (argument) { | |
| return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); | |
| }; | |
| /***/ }), | |
| /* 97 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.requestAnimationFrame = requestAnimationFrame; | |
| exports.isClassListSupported = isClassListSupported; | |
| exports.isTextContentSupported = isTextContentSupported; | |
| exports.isGetComputedStyleSupported = isGetComputedStyleSupported; | |
| exports.cancelAnimationFrame = cancelAnimationFrame; | |
| exports.isTouchSupported = isTouchSupported; | |
| exports.hasCaptionProblem = hasCaptionProblem; | |
| exports.getComparisonFunction = getComparisonFunction; | |
| exports.isPassiveEventSupported = isPassiveEventSupported; | |
| var _typeof2 = _interopRequireDefault(__webpack_require__(56)); | |
| __webpack_require__(44); | |
| // 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 The function to call when it's time. | |
| * @returns {number} | |
| */ | |
| function requestAnimationFrame(callback) { | |
| return _requestAnimationFrame.call(window, callback); | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isClassListSupported() { | |
| return !!document.documentElement.classList; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isTextContentSupported() { | |
| return !!document.createTextNode('test').textContent; | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isGetComputedStyleSupported() { | |
| return !!window.getComputedStyle; | |
| } | |
| /** | |
| * Polyfill for cancelAnimationFrame. | |
| * | |
| * @param {number} id The request Id, generated by `requestAnimationFrame`. | |
| */ | |
| function cancelAnimationFrame(id) { | |
| _cancelAnimationFrame.call(window, id); | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function isTouchSupported() { | |
| return 'ontouchstart' in window; | |
| } | |
| 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 = '<tr><td>t<br>t</td></tr>'; | |
| var CAPTION = document.createElement('CAPTION'); | |
| CAPTION.innerHTML = 'c<br>c<br>c<br>c'; | |
| CAPTION.style.padding = '0'; | |
| CAPTION.style.margin = '0'; | |
| TABLE.insertBefore(CAPTION, TBODY); | |
| document.body.appendChild(TABLE); | |
| _hasCaptionProblem = TABLE.offsetHeight < 2 * TABLE.lastChild.offsetHeight; // boolean | |
| document.body.removeChild(TABLE); | |
| } | |
| /** | |
| * @returns {boolean} | |
| */ | |
| function hasCaptionProblem() { | |
| if (_hasCaptionProblem === void 0) { | |
| detectCaptionProblem(); | |
| } | |
| return _hasCaptionProblem; | |
| } | |
| var comparisonFunction; | |
| /** | |
| * Get string comparison function for sorting purposes. It supports multilingual string comparison base on Internationalization API. | |
| * | |
| * @param {string} [language] The language code used for phrases sorting. | |
| * @param {object} [options] Additional options for sort comparator. | |
| * @returns {*} | |
| */ | |
| function getComparisonFunction(language) { | |
| var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
| if (comparisonFunction) { | |
| return comparisonFunction; | |
| } | |
| if ((typeof Intl === "undefined" ? "undefined" : (0, _typeof2.default)(Intl)) === 'object') { | |
| comparisonFunction = new Intl.Collator(language, options).compare; | |
| } else if (typeof String.prototype.localeCompare === 'function') { | |
| comparisonFunction = function comparisonFunction(a, b) { | |
| return "".concat(a).localeCompare(b); | |
| }; | |
| } else { | |
| comparisonFunction = function comparisonFunction(a, b) { | |
| if (a === b) { | |
| return 0; | |
| } | |
| return a > b ? -1 : 1; | |
| }; | |
| } | |
| return comparisonFunction; | |
| } | |
| var passiveSupported; | |
| /** | |
| * Checks if browser supports passive events. | |
| * | |
| * @returns {boolean} | |
| */ | |
| function isPassiveEventSupported() { | |
| if (passiveSupported !== void 0) { | |
| return passiveSupported; | |
| } | |
| try { | |
| var options = { | |
| get passive() { | |
| passiveSupported = true; | |
| } | |
| }; // eslint-disable-next-line no-restricted-globals | |
| window.addEventListener('test', options, options); // eslint-disable-next-line no-restricted-globals | |
| window.removeEventListener('test', options, options); | |
| } catch (err) { | |
| passiveSupported = false; | |
| } | |
| return passiveSupported; | |
| } | |
| /***/ }), | |
| /* 98 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.default = staticRegister; | |
| exports.collection = void 0; | |
| var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(25)); | |
| __webpack_require__(12); | |
| __webpack_require__(39); | |
| __webpack_require__(9); | |
| __webpack_require__(11); | |
| __webpack_require__(13); | |
| var collection = new Map(); | |
| /** | |
| * @param {string} namespace The namespace for the storage. | |
| * @returns {object} | |
| */ | |
| exports.collection = collection; | |
| function staticRegister() { | |
| var namespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'common'; | |
| if (!collection.has(namespace)) { | |
| collection.set(namespace, new Map()); | |
| } | |
| var subCollection = collection.get(namespace); | |
| /** | |
| * Register an item to the collection. If the item under the same was exist earlier then this item will be replaced with new one. | |
| * | |
| * @param {string} name Identification of the item. | |
| * @param {*} item Item to save in the collection. | |
| */ | |
| function register(name, item) { | |
| subCollection.set(name, item); | |
| } | |
| /** | |
| * Retrieve the item from the collection. | |
| * | |
| * @param {string} name Identification of the item. | |
| * @returns {*} Returns item which was saved in the collection. | |
| */ | |
| function getItem(name) { | |
| return subCollection.get(name); | |
| } | |
| /** | |
| * Check if item under specified name is exists. | |
| * | |
| * @param {string} name Identification of the item. | |
| * @returns {boolean} Returns `true` or `false` depends on if element exists in the collection. | |
| */ | |
| function hasItem(name) { | |
| return subCollection.has(name); | |
| } | |
| /** | |
| * Retrieve list of names registered from the collection. | |
| * | |
| * @returns {Array} Returns an array of strings with all names under which objects are stored. | |
| */ | |
| function getNames() { | |
| return (0, _toConsumableArray2.default)(subCollection.keys()); | |
| } | |
| /** | |
| * Retrieve all registered values from the collection. | |
| * | |
| * @returns {Array} Returns an array with all values stored in the collection. | |
| */ | |
| function getValues() { | |
| return (0, _toConsumableArray2.default)(subCollection.values()); | |
| } | |
| return { | |
| register: register, | |
| getItem: getItem, | |
| hasItem: hasItem, | |
| getNames: getNames, | |
| getValues: getValues | |
| }; | |
| } | |
| /***/ }), | |
| /* 99 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__(81); | |
| exports.__esModule = true; | |
| var _registry = __webpack_require__(446); | |
| exports.registerRootComparator = _registry.registerRootComparator; | |
| exports.getRootComparator = _registry.getRootComparator; | |
| exports.getCompareFunctionFactory = _registry.getCompareFunctionFactory; | |
| var _engine = __webpack_require__(648); | |
| exports.FIRST_AFTER_SECOND = _engine.FIRST_AFTER_SECOND; | |
| exports.FIRST_BEFORE_SECOND = _engine.FIRST_BEFORE_SECOND; | |
| exports.DO_NOT_SWAP = _engine.DO_NOT_SWAP; | |
| exports.sort = _engine.sort; | |
| /***/ }), | |
| /* 100 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.isFormulaExpression = isFormulaExpression; | |
| exports.isFormulaExpressionEscaped = isFormulaExpressionEscaped; | |
| exports.unescapeFormulaExpression = unescapeFormulaExpression; | |
| exports.toUpperCaseFormula = toUpperCaseFormula; | |
| exports.cellCoordFactory = cellCoordFactory; | |
| __webpack_require__(29); | |
| __webpack_require__(135); | |
| __webpack_require__(51); | |
| /** | |
| * Check if provided expression is valid formula expression. | |
| * | |
| * @param {*} expression Expression to check. | |
| * @returns {boolean} | |
| */ | |
| function isFormulaExpression(expression) { | |
| return typeof expression === 'string' && expression.length >= 2 && expression.charAt(0) === '='; | |
| } | |
| /** | |
| * Check if provided formula expression is escaped. | |
| * | |
| * @param {*} expression Expression to check. | |
| * @returns {boolean} | |
| */ | |
| function isFormulaExpressionEscaped(expression) { | |
| return typeof expression === 'string' && expression.charAt(0) === '\'' && expression.charAt(1) === '='; | |
| } | |
| /** | |
| * Replace escaped formula expression into valid string. | |
| * | |
| * @param {string} expression Expression to process. | |
| * @returns {string} | |
| */ | |
| function unescapeFormulaExpression(expression) { | |
| return isFormulaExpressionEscaped(expression) ? expression.substr(1) : expression; | |
| } | |
| /** | |
| * Upper case formula expression. | |
| * | |
| * @param {string} expression Formula expression. | |
| * @returns {string} | |
| */ | |
| function toUpperCaseFormula(expression) { | |
| var PATTERN = /(\\"|"(?:\\"|[^"])*"|(\+))|(\\'|'(?:\\'|[^'])*'|(\+))/g; | |
| var strings = expression.match(PATTERN) || []; | |
| var index = -1; | |
| return expression.toUpperCase().replace(PATTERN, function () { | |
| index += 1; | |
| return strings[index]; | |
| }); | |
| } | |
| /** | |
| * Cell coordinates function factory. | |
| * | |
| * @param {string} axis An axis name (`row` or `column`) which default index will be applied to. | |
| * @param {number} defaultIndex Default index. | |
| * @returns {Function} | |
| */ | |
| function cellCoordFactory(axis, defaultIndex) { | |
| return function (cell) { | |
| return { | |
| row: axis === 'row' ? defaultIndex : cell.row, | |
| column: axis === 'column' ? defaultIndex : cell.column | |
| }; | |
| }; | |
| } | |
| /***/ }), | |
| /* 101 */ | |
| /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__.r(__webpack_exports__); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rowLabelToIndex", function() { return rowLabelToIndex; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rowIndexToLabel", function() { return rowIndexToLabel; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "columnLabelToIndex", function() { return columnLabelToIndex; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "columnIndexToLabel", function() { return columnIndexToLabel; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractLabel", function() { return extractLabel; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toLabel", function() { return toLabel; }); | |
| function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | |
| function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
| function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | |
| function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | |
| function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) 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; } | |
| function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | |
| /** | |
| * Convert row label to index. | |
| * | |
| * @param {String} label Row label (eq. '1', '5') | |
| * @returns {Number} Returns -1 if label is not recognized otherwise proper row index. | |
| */ | |
| function rowLabelToIndex(label) { | |
| var result = parseInt(label, 10); | |
| if (isNaN(result)) { | |
| result = -1; | |
| } else { | |
| result = Math.max(result - 1, -1); | |
| } | |
| return result; | |
| } | |
| /** | |
| * Convert row index to label. | |
| * | |
| * @param {Number} row Row index. | |
| * @returns {String} Returns row label (eq. '1', '7'). | |
| */ | |
| function rowIndexToLabel(row) { | |
| var result = ''; | |
| if (row >= 0) { | |
| result = "".concat(row + 1); | |
| } | |
| return result; | |
| } | |
| var COLUMN_LABEL_BASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| var COLUMN_LABEL_BASE_LENGTH = COLUMN_LABEL_BASE.length; | |
| /** | |
| * Convert column label to index. | |
| * | |
| * @param {String} label Column label (eq. 'ABB', 'CNQ') | |
| * @returns {Number} Returns -1 if label is not recognized otherwise proper column index. | |
| */ | |
| function columnLabelToIndex(label) { | |
| var result = 0; | |
| if (typeof label === 'string') { | |
| label = label.toUpperCase(); | |
| for (var i = 0, j = label.length - 1; i < label.length; i += 1, j -= 1) { | |
| result += Math.pow(COLUMN_LABEL_BASE_LENGTH, j) * (COLUMN_LABEL_BASE.indexOf(label[i]) + 1); | |
| } | |
| } | |
| --result; | |
| return result; | |
| } | |
| /** | |
| * Convert column index to label. | |
| * | |
| * @param {Number} column Column index. | |
| * @returns {String} Returns column label (eq. 'ABB', 'CNQ'). | |
| */ | |
| function columnIndexToLabel(column) { | |
| var result = ''; | |
| while (column >= 0) { | |
| result = String.fromCharCode(column % COLUMN_LABEL_BASE_LENGTH + 97) + result; | |
| column = Math.floor(column / COLUMN_LABEL_BASE_LENGTH) - 1; | |
| } | |
| return result.toUpperCase(); | |
| } | |
| var LABEL_EXTRACT_REGEXP = /^([$])?([A-Za-z]+)([$])?([0-9]+)$/; | |
| /** | |
| * Extract cell coordinates. | |
| * | |
| * @param {String} label Cell coordinates (eq. 'A1', '$B6', '$N$98'). | |
| * @returns {Array} Returns an array of objects. | |
| */ | |
| function extractLabel(label) { | |
| if (typeof label !== 'string' || !LABEL_EXTRACT_REGEXP.test(label)) { | |
| return []; | |
| } | |
| var _label$toUpperCase$ma = label.toUpperCase().match(LABEL_EXTRACT_REGEXP), | |
| _label$toUpperCase$ma2 = _slicedToArray(_label$toUpperCase$ma, 5), | |
| columnAbs = _label$toUpperCase$ma2[1], | |
| column = _label$toUpperCase$ma2[2], | |
| rowAbs = _label$toUpperCase$ma2[3], | |
| row = _label$toUpperCase$ma2[4]; | |
| return [{ | |
| index: rowLabelToIndex(row), | |
| label: row, | |
| isAbsolute: rowAbs === '$' | |
| }, { | |
| index: columnLabelToIndex(column), | |
| label: column, | |
| isAbsolute: columnAbs === '$' | |
| }]; | |
| } | |
| /** | |
| * Convert row and column indexes into cell label. | |
| * | |
| * @param {Object} row Object with `index` and `isAbsolute` properties. | |
| * @param {Object} column Object with `index` and `isAbsolute` properties. | |
| * @returns {String} Returns cell label. | |
| */ | |
| function toLabel(row, column) { | |
| var rowLabel = (row.isAbsolute ? '$' : '') + rowIndexToLabel(row.index); | |
| var columnLabel = (column.isAbsolute ? '$' : '') + columnIndexToLabel(column.index); | |
| return columnLabel + rowLabel; | |
| } | |
| /***/ }), | |
| /* 102 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var bind = __webpack_require__(125); | |
| var IndexedObject = __webpack_require__(117); | |
| var toObject = __webpack_require__(68); | |
| var toLength = __webpack_require__(58); | |
| var arraySpeciesCreate = __webpack_require__(178); | |
| var push = [].push; | |
| // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` 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 IS_FILTER_OUT = TYPE == 7; | |
| 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 || IS_FILTER_OUT ? 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 switch (TYPE) { | |
| case 4: return false; // every | |
| case 7: push.call(target, value); // filterOut | |
| } | |
| } | |
| } | |
| return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; | |
| }; | |
| }; | |
| module.exports = { | |
| // `Array.prototype.forEach` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.foreach | |
| forEach: createMethod(0), | |
| // `Array.prototype.map` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.map | |
| map: createMethod(1), | |
| // `Array.prototype.filter` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.filter | |
| filter: createMethod(2), | |
| // `Array.prototype.some` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.some | |
| some: createMethod(3), | |
| // `Array.prototype.every` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.every | |
| every: createMethod(4), | |
| // `Array.prototype.find` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.find | |
| find: createMethod(5), | |
| // `Array.prototype.findIndex` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.findIndex | |
| findIndex: createMethod(6), | |
| // `Array.prototype.filterOut` method | |
| // https://github.com/tc39/proposal-array-filtering | |
| filterOut: createMethod(7) | |
| }; | |
| /***/ }), | |
| /* 103 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.TextEditor = exports.EDITOR_TYPE = void 0; | |
| var _textEditor = __webpack_require__(578); | |
| exports.EDITOR_TYPE = _textEditor.EDITOR_TYPE; | |
| exports.TextEditor = _textEditor.TextEditor; | |
| /***/ }), | |
| /* 104 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.textRenderer = exports.RENDERER_TYPE = void 0; | |
| var _textRenderer = __webpack_require__(581); | |
| exports.RENDERER_TYPE = _textRenderer.RENDERER_TYPE; | |
| exports.textRenderer = _textRenderer.textRenderer; | |
| /***/ }), | |
| /* 105 */ | |
| /***/ (function(module, exports) { | |
| module.exports = false; | |
| /***/ }), | |
| /* 106 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var path = __webpack_require__(234); | |
| var global = __webpack_require__(40); | |
| var aFunction = function (variable) { | |
| return typeof variable == 'function' ? variable : undefined; | |
| }; | |
| module.exports = function (namespace, method) { | |
| return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) | |
| : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; | |
| }; | |
| /***/ }), | |
| /* 107 */ | |
| /***/ (function(module, exports) { | |
| module.exports = function (it) { | |
| if (typeof it != 'function') { | |
| throw TypeError(String(it) + ' is not a function'); | |
| } return it; | |
| }; | |
| /***/ }), | |
| /* 108 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var fails = __webpack_require__(32); | |
| module.exports = function (METHOD_NAME, argument) { | |
| var method = [][METHOD_NAME]; | |
| return !!method && fails(function () { | |
| // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing | |
| method.call(null, argument || function () { throw 1; }, 1); | |
| }); | |
| }; | |
| /***/ }), | |
| /* 109 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var anObject = __webpack_require__(47); | |
| var defineProperties = __webpack_require__(482); | |
| var enumBugKeys = __webpack_require__(176); | |
| var hiddenKeys = __webpack_require__(119); | |
| var html = __webpack_require__(240); | |
| var documentCreateElement = __webpack_require__(172); | |
| var sharedKey = __webpack_require__(148); | |
| var GT = '>'; | |
| var LT = '<'; | |
| var PROTOTYPE = 'prototype'; | |
| var SCRIPT = 'script'; | |
| var IE_PROTO = sharedKey('IE_PROTO'); | |
| var EmptyConstructor = function () { /* empty */ }; | |
| var scriptTag = function (content) { | |
| return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; | |
| }; | |
| // Create object with fake `null` prototype: use ActiveX Object with cleared prototype | |
| var NullProtoObjectViaActiveX = function (activeXDocument) { | |
| activeXDocument.write(scriptTag('')); | |
| activeXDocument.close(); | |
| var temp = activeXDocument.parentWindow.Object; | |
| activeXDocument = null; // avoid memory leak | |
| return temp; | |
| }; | |
| // Create object with fake `null` prototype: use iframe Object with cleared prototype | |
| var NullProtoObjectViaIFrame = function () { | |
| // Thrash, waste and sodomy: IE GC bug | |
| var iframe = documentCreateElement('iframe'); | |
| var JS = 'java' + SCRIPT + ':'; | |
| var iframeDocument; | |
| iframe.style.display = 'none'; | |
| html.appendChild(iframe); | |
| // https://github.com/zloirock/core-js/issues/475 | |
| iframe.src = String(JS); | |
| iframeDocument = iframe.contentWindow.document; | |
| iframeDocument.open(); | |
| iframeDocument.write(scriptTag('document.F=Object')); | |
| iframeDocument.close(); | |
| return iframeDocument.F; | |
| }; | |
| // Check for document.domain and active x support | |
| // No need to use active x approach when document.domain is not set | |
| // see https://github.com/es-shims/es5-shim/issues/150 | |
| // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 | |
| // avoid IE GC bug | |
| var activeXDocument; | |
| var NullProtoObject = function () { | |
| try { | |
| /* global ActiveXObject -- old IE */ | |
| activeXDocument = document.domain && new ActiveXObject('htmlfile'); | |
| } catch (error) { /* ignore */ } | |
| NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame(); | |
| var length = enumBugKeys.length; | |
| while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; | |
| return NullProtoObject(); | |
| }; | |
| hiddenKeys[IE_PROTO] = true; | |
| // `Object.create` method | |
| // https://tc39.es/ecma262/#sec-object.create | |
| module.exports = Object.create || function create(O, Properties) { | |
| var result; | |
| if (O !== null) { | |
| EmptyConstructor[PROTOTYPE] = anObject(O); | |
| result = new EmptyConstructor(); | |
| EmptyConstructor[PROTOTYPE] = null; | |
| // add "__proto__" for Object.getPrototypeOf polyfill | |
| result[IE_PROTO] = O; | |
| } else result = NullProtoObject(); | |
| return Properties === undefined ? result : defineProperties(result, Properties); | |
| }; | |
| /***/ }), | |
| /* 110 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| __webpack_require__(43); | |
| __webpack_require__(11); | |
| __webpack_require__(26); | |
| __webpack_require__(23); | |
| var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(25)); | |
| var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18)); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _element = __webpack_require__(10); | |
| var _function = __webpack_require__(53); | |
| var _coords = _interopRequireDefault(__webpack_require__(131)); | |
| var _column = _interopRequireDefault(__webpack_require__(392)); | |
| var _row = _interopRequireDefault(__webpack_require__(393)); | |
| var _renderer = __webpack_require__(396); | |
| var _column2 = _interopRequireDefault(__webpack_require__(514)); | |
| var _row2 = _interopRequireDefault(__webpack_require__(515)); | |
| var _registerer = __webpack_require__(399); | |
| var _constants = __webpack_require__(87); | |
| /** | |
| * | |
| */ | |
| var Table = /*#__PURE__*/function () { | |
| /** | |
| * @param {Walkontable} wotInstance The Walkontable instance. | |
| * @param {HTMLTableElement} table An element to the Walkontable generated table is injected. | |
| */ | |
| function Table(wotInstance, table) { | |
| var _this = this; | |
| (0, _classCallCheck2.default)(this, Table); | |
| /** | |
| * Indicates if this instance is of type `MasterTable` (i.e. It is NOT an overlay). | |
| * | |
| * @type {boolean} | |
| */ | |
| this.isMaster = !wotInstance.cloneOverlay; // "instanceof" operator isn't used, because it caused a circular reference in Webpack | |
| this.wot = wotInstance; // legacy support | |
| this.instance = this.wot; | |
| this.TABLE = table; | |
| this.TBODY = null; | |
| this.THEAD = null; | |
| this.COLGROUP = null; | |
| this.tableOffset = 0; | |
| this.holderOffset = 0; | |
| /** | |
| * Indicates if the table has height bigger than 0px. | |
| * | |
| * @type {boolean} | |
| */ | |
| this.hasTableHeight = true; | |
| /** | |
| * Indicates if the table has width bigger than 0px. | |
| * | |
| * @type {boolean} | |
| */ | |
| this.hasTableWidth = true; | |
| /** | |
| * Indicates if the table is visible. By visible, it means that the holder | |
| * element has CSS 'display' property different than 'none'. | |
| * | |
| * @type {boolean} | |
| */ | |
| this.isTableVisible = false; | |
| (0, _element.removeTextNodes)(this.TABLE); | |
| this.spreader = this.createSpreader(this.TABLE); | |
| this.hider = this.createHider(this.spreader); | |
| this.holder = this.createHolder(this.hider); | |
| this.wtRootElement = this.holder.parentNode; | |
| if (this.isMaster) { | |
| this.alignOverlaysWithTrimmingContainer(); | |
| } | |
| this.fixTableDomTree(); | |
| this.rowFilter = null; | |
| this.columnFilter = null; | |
| this.correctHeaderWidth = false; | |
| var origRowHeaderWidth = this.wot.wtSettings.settings.rowHeaderWidth; // Fix for jumping row headers (https://github.com/handsontable/handsontable/issues/3850) | |
| this.wot.wtSettings.settings.rowHeaderWidth = function () { | |
| return _this._modifyRowHeaderWidth(origRowHeaderWidth); | |
| }; | |
| this.rowUtils = new _row2.default(this.wot); | |
| this.columnUtils = new _column2.default(this.wot); | |
| this.tableRenderer = new _renderer.Renderer({ | |
| TABLE: this.TABLE, | |
| THEAD: this.THEAD, | |
| COLGROUP: this.COLGROUP, | |
| TBODY: this.TBODY, | |
| rowUtils: this.rowUtils, | |
| columnUtils: this.columnUtils, | |
| cellRenderer: this.wot.wtSettings.settings.cellRenderer | |
| }); | |
| } | |
| /** | |
| * Returns a boolean that is true if this intance of Table represents a specific overlay, identified by the overlay name. | |
| * For MasterTable, it returns false. | |
| * | |
| * @param {string} overlayTypeName The overlay type. | |
| * @returns {boolean} | |
| */ | |
| (0, _createClass2.default)(Table, [{ | |
| key: "is", | |
| value: function is(overlayTypeName) { | |
| return (0, _registerer.isOverlayTypeOf)(this.wot.cloneOverlay, overlayTypeName); | |
| } | |
| /** | |
| * | |
| */ | |
| }, { | |
| key: "fixTableDomTree", | |
| value: function fixTableDomTree() { | |
| var rootDocument = this.wot.rootDocument; | |
| this.TBODY = this.TABLE.querySelector('tbody'); | |
| if (!this.TBODY) { | |
| this.TBODY = rootDocument.createElement('tbody'); | |
| this.TABLE.appendChild(this.TBODY); | |
| } | |
| this.THEAD = this.TABLE.querySelector('thead'); | |
| if (!this.THEAD) { | |
| this.THEAD = rootDocument.createElement('thead'); | |
| this.TABLE.insertBefore(this.THEAD, this.TBODY); | |
| } | |
| this.COLGROUP = this.TABLE.querySelector('colgroup'); | |
| if (!this.COLGROUP) { | |
| this.COLGROUP = rootDocument.createElement('colgroup'); | |
| this.TABLE.insertBefore(this.COLGROUP, this.THEAD); | |
| } | |
| if (this.wot.getSetting('columnHeaders').length && !this.THEAD.childNodes.length) { | |
| this.THEAD.appendChild(rootDocument.createElement('TR')); | |
| } | |
| } | |
| /** | |
| * @param {HTMLTableElement} table An element to process. | |
| * @returns {HTMLElement} | |
| */ | |
| }, { | |
| key: "createSpreader", | |
| value: function createSpreader(table) { | |
| var parent = table.parentNode; | |
| var spreader; | |
| if (!parent || parent.nodeType !== Node.ELEMENT_NODE || !(0, _element.hasClass)(parent, 'wtHolder')) { | |
| spreader = this.wot.rootDocument.createElement('div'); | |
| spreader.className = 'wtSpreader'; | |
| if (parent) { | |
| // if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it | |
| parent.insertBefore(spreader, table); | |
| } | |
| spreader.appendChild(table); | |
| } | |
| spreader.style.position = 'relative'; | |
| return spreader; | |
| } | |
| /** | |
| * @param {HTMLElement} spreader An element to the hider element is injected. | |
| * @returns {HTMLElement} | |
| */ | |
| }, { | |
| key: "createHider", | |
| value: function createHider(spreader) { | |
| var parent = spreader.parentNode; | |
| var hider; | |
| if (!parent || parent.nodeType !== Node.ELEMENT_NODE || !(0, _element.hasClass)(parent, 'wtHolder')) { | |
| hider = this.wot.rootDocument.createElement('div'); | |
| hider.className = 'wtHider'; | |
| if (parent) { | |
| // if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it | |
| parent.insertBefore(hider, spreader); | |
| } | |
| hider.appendChild(spreader); | |
| } | |
| return hider; | |
| } | |
| /** | |
| * | |
| * @param {HTMLElement} hider An element to the holder element is injected. | |
| * @returns {HTMLElement} | |
| */ | |
| }, { | |
| key: "createHolder", | |
| value: function createHolder(hider) { | |
| var parent = hider.parentNode; | |
| var holder; | |
| if (!parent || parent.nodeType !== Node.ELEMENT_NODE || !(0, _element.hasClass)(parent, 'wtHolder')) { | |
| holder = this.wot.rootDocument.createElement('div'); | |
| holder.style.position = 'relative'; | |
| holder.className = 'wtHolder'; | |
| if (parent) { | |
| // if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it | |
| parent.insertBefore(holder, hider); | |
| } | |
| if (this.isMaster) { | |
| holder.parentNode.className += 'ht_master handsontable'; | |
| } | |
| holder.appendChild(hider); | |
| } | |
| return holder; | |
| } | |
| /** | |
| * Redraws the table. | |
| * | |
| * @param {boolean} [fastDraw=false] If TRUE, will try to avoid full redraw and only update the border positions. | |
| * If FALSE or UNDEFINED, will perform a full redraw. | |
| * @returns {Table} | |
| */ | |
| }, { | |
| key: "draw", | |
| value: function draw() { | |
| var fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | |
| var wot = this.wot; | |
| var wtOverlays = wot.wtOverlays, | |
| wtViewport = wot.wtViewport; | |
| var totalRows = wot.getSetting('totalRows'); | |
| var totalColumns = wot.getSetting('totalColumns'); | |
| var rowHeaders = wot.getSetting('rowHeaders'); | |
| var rowHeadersCount = rowHeaders.length; | |
| var columnHeaders = wot.getSetting('columnHeaders'); | |
| var columnHeadersCount = columnHeaders.length; | |
| var syncScroll = false; | |
| var runFastDraw = fastDraw; | |
| if (this.isMaster) { | |
| this.holderOffset = (0, _element.offset)(this.holder); | |
| runFastDraw = wtViewport.createRenderCalculators(runFastDraw); | |
| if (rowHeadersCount && !wot.getSetting('fixedColumnsLeft')) { | |
| var leftScrollPos = wtOverlays.leftOverlay.getScrollPosition(); | |
| var previousState = this.correctHeaderWidth; | |
| this.correctHeaderWidth = leftScrollPos > 0; | |
| if (previousState !== this.correctHeaderWidth) { | |
| runFastDraw = false; | |
| } | |
| } | |
| } | |
| if (this.isMaster) { | |
| syncScroll = wtOverlays.prepareOverlays(); | |
| } | |
| if (runFastDraw) { | |
| if (this.isMaster) { | |
| // in case we only scrolled without redraw, update visible rows information in oldRowsCalculator | |
| wtViewport.createVisibleCalculators(); | |
| } | |
| if (wtOverlays) { | |
| wtOverlays.refresh(true); | |
| } | |
| } else { | |
| if (this.isMaster) { | |
| this.tableOffset = (0, _element.offset)(this.TABLE); | |
| } else { | |
| this.tableOffset = this.wot.cloneSource.wtTable.tableOffset; | |
| } | |
| var startRow = totalRows > 0 ? this.getFirstRenderedRow() : 0; | |
| var startColumn = totalColumns > 0 ? this.getFirstRenderedColumn() : 0; | |
| this.rowFilter = new _row.default(startRow, totalRows, columnHeadersCount); | |
| this.columnFilter = new _column.default(startColumn, totalColumns, rowHeadersCount); | |
| var performRedraw = true; // Only master table rendering can be skipped | |
| if (this.isMaster) { | |
| this.alignOverlaysWithTrimmingContainer(); | |
| var skipRender = {}; | |
| this.wot.getSetting('beforeDraw', true, skipRender); | |
| performRedraw = skipRender.skipRender !== true; | |
| } | |
| if (performRedraw) { | |
| this.tableRenderer.setHeaderContentRenderers(rowHeaders, columnHeaders); | |
| if (this.is(_constants.CLONE_BOTTOM) || this.is(_constants.CLONE_BOTTOM_LEFT_CORNER)) { | |
| // do NOT render headers on the bottom or bottom-left corner overlay | |
| this.tableRenderer.setHeaderContentRenderers(rowHeaders, []); | |
| } | |
| this.resetOversizedRows(); | |
| this.tableRenderer.setViewportSize(this.getRenderedRowsCount(), this.getRenderedColumnsCount()).setFilters(this.rowFilter, this.columnFilter).render(); | |
| var workspaceWidth; | |
| if (this.isMaster) { | |
| workspaceWidth = this.wot.wtViewport.getWorkspaceWidth(); | |
| this.wot.wtViewport.containerWidth = null; | |
| this.markOversizedColumnHeaders(); | |
| } | |
| this.adjustColumnHeaderHeights(); | |
| if (this.isMaster || this.is(_constants.CLONE_BOTTOM)) { | |
| this.markOversizedRows(); | |
| } | |
| if (this.isMaster) { | |
| this.wot.wtViewport.createVisibleCalculators(); | |
| this.wot.wtOverlays.refresh(false); | |
| this.wot.wtOverlays.applyToDOM(); | |
| var hiderWidth = (0, _element.outerWidth)(this.hider); | |
| var tableWidth = (0, _element.outerWidth)(this.TABLE); | |
| if (hiderWidth !== 0 && tableWidth !== hiderWidth) { | |
| // Recalculate the column widths, if width changes made in the overlays removed the scrollbar, thus changing the viewport width. | |
| this.columnUtils.calculateWidths(); | |
| this.tableRenderer.renderer.colGroup.render(); | |
| } | |
| if (workspaceWidth !== this.wot.wtViewport.getWorkspaceWidth()) { | |
| // workspace width changed though to shown/hidden vertical scrollbar. Let's reapply stretching | |
| this.wot.wtViewport.containerWidth = null; | |
| this.columnUtils.calculateWidths(); | |
| this.tableRenderer.renderer.colGroup.render(); | |
| } | |
| this.wot.getSetting('onDraw', true); | |
| } else if (this.is(_constants.CLONE_BOTTOM)) { | |
| this.wot.cloneSource.wtOverlays.adjustElementsSize(); | |
| } | |
| } | |
| } | |
| if (this.isMaster) { | |
| var positionChanged = wtOverlays.topOverlay.resetFixedPosition(); | |
| if (wtOverlays.bottomOverlay.clone) { | |
| positionChanged = wtOverlays.bottomOverlay.resetFixedPosition() || positionChanged; | |
| } | |
| positionChanged = wtOverlays.leftOverlay.resetFixedPosition() || positionChanged; | |
| if (wtOverlays.topLeftCornerOverlay) { | |
| wtOverlays.topLeftCornerOverlay.resetFixedPosition(); | |
| } | |
| if (wtOverlays.bottomLeftCornerOverlay && wtOverlays.bottomLeftCornerOverlay.clone) { | |
| wtOverlays.bottomLeftCornerOverlay.resetFixedPosition(); | |
| } | |
| if (positionChanged) { | |
| // It refreshes the cells borders caused by a 1px shift (introduced by overlays which add or | |
| // remove `innerBorderTop` and `innerBorderLeft` CSS classes to the DOM element. This happens | |
| // when there is a switch between rendering from 0 to N rows/columns and vice versa). | |
| wtOverlays.refreshAll(); | |
| wtOverlays.adjustElementsSize(); | |
| } | |
| } | |
| this.refreshSelections(runFastDraw); | |
| if (syncScroll) { | |
| wtOverlays.syncScrollWithMaster(); | |
| } | |
| wot.drawn = true; | |
| return this; | |
| } | |
| /** | |
| * @param {number} col The visual column index. | |
| */ | |
| }, { | |
| key: "markIfOversizedColumnHeader", | |
| value: function markIfOversizedColumnHeader(col) { | |
| var sourceColIndex = this.wot.wtTable.columnFilter.renderedToSource(col); | |
| var level = this.wot.getSetting('columnHeaders').length; | |
| var defaultRowHeight = this.wot.wtSettings.settings.defaultRowHeight; | |
| var previousColHeaderHeight; | |
| var currentHeader; | |
| var currentHeaderHeight; | |
| var columnHeaderHeightSetting = this.wot.getSetting('columnHeaderHeight') || []; | |
| while (level) { | |
| level -= 1; | |
| previousColHeaderHeight = this.wot.wtTable.getColumnHeaderHeight(level); | |
| currentHeader = this.wot.wtTable.getColumnHeader(sourceColIndex, level); | |
| if (!currentHeader) { | |
| /* eslint-disable no-continue */ | |
| continue; | |
| } | |
| currentHeaderHeight = (0, _element.innerHeight)(currentHeader); | |
| if (!previousColHeaderHeight && defaultRowHeight < currentHeaderHeight || previousColHeaderHeight < currentHeaderHeight) { | |
| this.wot.wtViewport.oversizedColumnHeaders[level] = currentHeaderHeight; | |
| } | |
| if (Array.isArray(columnHeaderHeightSetting)) { | |
| if (columnHeaderHeightSetting[level] !== null && columnHeaderHeightSetting[level] !== void 0) { | |
| this.wot.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting[level]; | |
| } | |
| } else if (!isNaN(columnHeaderHeightSetting)) { | |
| this.wot.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting; | |
| } | |
| if (this.wot.wtViewport.oversizedColumnHeaders[level] < (columnHeaderHeightSetting[level] || columnHeaderHeightSetting)) { | |
| this.wot.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting[level] || columnHeaderHeightSetting; // eslint-disable-line max-len | |
| } | |
| } | |
| } | |
| /** | |
| * | |
| */ | |
| }, { | |
| key: "adjustColumnHeaderHeights", | |
| value: function adjustColumnHeaderHeights() { | |
| var wot = this.wot; | |
| var children = wot.wtTable.THEAD.childNodes; | |
| var oversizedColumnHeaders = wot.wtViewport.oversizedColumnHeaders; | |
| var columnHeaders = wot.getSetting('columnHeaders'); | |
| for (var i = 0, len = columnHeaders.length; i < len; i++) { | |
| if (oversizedColumnHeaders[i]) { | |
| if (!children[i] || children[i].childNodes.length === 0) { | |
| return; | |
| } | |
| children[i].childNodes[0].style.height = "".concat(oversizedColumnHeaders[i], "px"); | |
| } | |
| } | |
| } | |
| /** | |
| * Resets cache of row heights. The cache should be cached for each render cycle in a case | |
| * when new cell values have content which increases/decreases cell height. | |
| */ | |
| }, { | |
| key: "resetOversizedRows", | |
| value: function resetOversizedRows() { | |
| var wot = this.wot; | |
| if (!this.isMaster && !this.is(_constants.CLONE_BOTTOM)) { | |
| return; | |
| } | |
| if (!wot.getSetting('externalRowCalculator')) { | |
| var rowsToRender = this.getRenderedRowsCount(); // Reset the oversized row cache for rendered rows | |
| for (var visibleRowIndex = 0; visibleRowIndex < rowsToRender; visibleRowIndex++) { | |
| var sourceRow = this.rowFilter.renderedToSource(visibleRowIndex); | |
| if (wot.wtViewport.oversizedRows && wot.wtViewport.oversizedRows[sourceRow]) { | |
| wot.wtViewport.oversizedRows[sourceRow] = void 0; | |
| } | |
| } | |
| } | |
| } | |
| /** | |
| * @param {string} className The CSS class name to remove from the table cells. | |
| */ | |
| }, { | |
| key: "removeClassFromCells", | |
| value: function removeClassFromCells(className) { | |
| var nodes = this.TABLE.querySelectorAll(".".concat(className)); | |
| for (var i = 0, len = nodes.length; i < len; i++) { | |
| (0, _element.removeClass)(nodes[i], className); | |
| } | |
| } | |
| /** | |
| * Refresh the table selection by re-rendering Selection instances connected with that instance. | |
| * | |
| * @param {boolean} fastDraw If fast drawing is enabled than additionally className clearing is applied. | |
| */ | |
| }, { | |
| key: "refreshSelections", | |
| value: function refreshSelections(fastDraw) { | |
| var wot = this.wot; | |
| if (!wot.selections) { | |
| return; | |
| } | |
| var highlights = Array.from(wot.selections); | |
| var len = highlights.length; | |
| if (fastDraw) { | |
| var classesToRemove = []; | |
| for (var i = 0; i < len; i++) { | |
| var _highlights$i$setting = highlights[i].settings, | |
| highlightHeaderClassName = _highlights$i$setting.highlightHeaderClassName, | |
| highlightRowClassName = _highlights$i$setting.highlightRowClassName, | |
| highlightColumnClassName = _highlights$i$setting.highlightColumnClassName; | |
| var classNames = highlights[i].classNames; | |
| var classNamesLength = classNames.length; | |
| for (var j = 0; j < classNamesLength; j++) { | |
| if (!classesToRemove.includes(classNames[j])) { | |
| classesToRemove.push(classNames[j]); | |
| } | |
| } | |
| if (highlightHeaderClassName && !classesToRemove.includes(highlightHeaderClassName)) { | |
| classesToRemove.push(highlightHeaderClassName); | |
| } | |
| if (highlightRowClassName && !classesToRemove.includes(highlightRowClassName)) { | |
| classesToRemove.push(highlightRowClassName); | |
| } | |
| if (highlightColumnClassName && !classesToRemove.includes(highlightColumnClassName)) { | |
| classesToRemove.push(highlightColumnClassName); | |
| } | |
| } | |
| var additionalClassesToRemove = wot.getSetting('onBeforeRemoveCellClassNames'); | |
| if (Array.isArray(additionalClassesToRemove)) { | |
| for (var _i = 0; _i < additionalClassesToRemove.length; _i++) { | |
| classesToRemove.push(additionalClassesToRemove[_i]); | |
| } | |
| } | |
| var classesToRemoveLength = classesToRemove.length; | |
| for (var _i2 = 0; _i2 < classesToRemoveLength; _i2++) { | |
| // there was no rerender, so we need to remove classNames by ourselves | |
| this.removeClassFromCells(classesToRemove[_i2]); | |
| } | |
| } | |
| for (var _i3 = 0; _i3 < len; _i3++) { | |
| highlights[_i3].draw(wot, fastDraw); | |
| } | |
| } | |
| /** | |
| * Get cell element at coords. | |
| * Negative coords.row or coords.col are used to retrieve header cells. If there are multiple header levels, the | |
| * negative value corresponds to the distance from the working area. For example, when there are 3 levels of column | |
| * headers, coords.col=-1 corresponds to the most inner header element, while coords.col=-3 corresponds to the | |
| * outmost header element. | |
| * | |
| * In case an element for the coords is not rendered, the method returns an error code. | |
| * To produce the error code, the input parameters are validated in the order in which they | |
| * are given. Thus, if both the row and the column coords are out of the rendered bounds, | |
| * the method returns the error code for the row. | |
| * | |
| * @param {CellCoords} coords The cell coordinates. | |
| * @returns {HTMLElement|number} HTMLElement on success or Number one of the exit codes on error: | |
| * -1 row before viewport | |
| * -2 row after viewport | |
| * -3 column before viewport | |
| * -4 column after viewport. | |
| */ | |
| }, { | |
| key: "getCell", | |
| value: function getCell(coords) { | |
| var row = coords.row; | |
| var column = coords.col; | |
| var hookResult = this.wot.getSetting('onModifyGetCellCoords', row, column); | |
| if (hookResult && Array.isArray(hookResult)) { | |
| var _hookResult = (0, _slicedToArray2.default)(hookResult, 2); | |
| row = _hookResult[0]; | |
| column = _hookResult[1]; | |
| } | |
| if (this.isRowBeforeRenderedRows(row)) { | |
| // row before rendered rows | |
| return -1; | |
| } else if (this.isRowAfterRenderedRows(row)) { | |
| // row after rendered rows | |
| return -2; | |
| } else if (this.isColumnBeforeRenderedColumns(column)) { | |
| // column before rendered columns | |
| return -3; | |
| } else if (this.isColumnAfterRenderedColumns(column)) { | |
| // column after rendered columns | |
| return -4; | |
| } | |
| var TR; | |
| if (row < 0) { | |
| TR = this.THEAD.childNodes[this.rowFilter.sourceRowToVisibleColHeadedRow(row)]; | |
| } else { | |
| TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)]; | |
| } | |
| if (!TR && row >= 0) { | |
| throw new Error('TR was expected to be rendered but is not'); | |
| } | |
| var TD = TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(column)]; | |
| if (!TD && column >= 0) { | |
| throw new Error('TD or TH was expected to be rendered but is not'); | |
| } | |
| return TD; | |
| } | |
| /** | |
| * GetColumnHeader. | |
| * | |
| * @param {number} col Column index. | |
| * @param {number} [level=0] Header level (0 = most distant to the table). | |
| * @returns {object} HTMLElement on success or undefined on error. | |
| */ | |
| }, { | |
| key: "getColumnHeader", | |
| value: function getColumnHeader(col) { | |
| var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | |
| var TR = this.THEAD.childNodes[level]; | |
| return TR === null || TR === void 0 ? void 0 : TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(col)]; | |
| } | |
| /** | |
| * Gets all columns headers (TH elements) from the table. | |
| * | |
| * @param {number} column A source column index. | |
| * @returns {HTMLTableCellElement[]} | |
| */ | |
| }, { | |
| key: "getColumnHeaders", | |
| value: function getColumnHeaders(column) { | |
| var THs = []; | |
| var visibleColumn = this.columnFilter.sourceColumnToVisibleRowHeadedColumn(column); | |
| this.THEAD.childNodes.forEach(function (TR) { | |
| var TH = TR.childNodes[visibleColumn]; | |
| if (TH) { | |
| THs.push(TH); | |
| } | |
| }); | |
| return THs; | |
| } | |
| /** | |
| * GetRowHeader. | |
| * | |
| * @param {number} row Row index. | |
| * @param {number} [level=0] Header level (0 = most distant to the table). | |
| * @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have row headers`. | |
| */ | |
| }, { | |
| key: "getRowHeader", | |
| value: function getRowHeader(row) { | |
| var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | |
| if (this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0) === 0) { | |
| return; | |
| } | |
| var rowHeadersCount = this.wot.getSetting('rowHeaders').length; | |
| if (level >= rowHeadersCount) { | |
| return; | |
| } | |
| var TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)]; | |
| return TR === null || TR === void 0 ? void 0 : TR.childNodes[level]; | |
| } | |
| /** | |
| * Gets all rows headers (TH elements) from the table. | |
| * | |
| * @param {number} row A source row index. | |
| * @returns {HTMLTableCellElement[]} | |
| */ | |
| }, { | |
| key: "getRowHeaders", | |
| value: function getRowHeaders(row) { | |
| if (this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0) === 0) { | |
| return []; | |
| } | |
| var THs = []; | |
| var rowHeadersCount = this.wot.getSetting('rowHeaders').length; | |
| for (var renderedRowIndex = 0; renderedRowIndex < rowHeadersCount; renderedRowIndex++) { | |
| var TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)]; | |
| var TH = TR === null || TR === void 0 ? void 0 : TR.childNodes[renderedRowIndex]; | |
| if (TH) { | |
| THs.push(TH); | |
| } | |
| } | |
| return THs; | |
| } | |
| /** | |
| * Returns cell coords object for a given TD (or a child element of a TD element). | |
| * | |
| * @param {HTMLTableCellElement} TD A cell DOM element (or a child of one). | |
| * @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the provided element is not applicable. | |
| */ | |
| }, { | |
| key: "getCoords", | |
| value: function getCoords(TD) { | |
| var cellElement = TD; | |
| if (cellElement.nodeName !== 'TD' && cellElement.nodeName !== 'TH') { | |
| cellElement = (0, _element.closest)(cellElement, ['TD', 'TH']); | |
| } | |
| if (cellElement === null) { | |
| return null; | |
| } | |
| var TR = cellElement.parentNode; | |
| var CONTAINER = TR.parentNode; | |
| var row = (0, _element.index)(TR); | |
| var col = cellElement.cellIndex; | |
| if ((0, _element.overlayContainsElement)(_constants.CLONE_TOP_LEFT_CORNER, cellElement, this.wtRootElement) || (0, _element.overlayContainsElement)(_constants.CLONE_TOP, cellElement, this.wtRootElement)) { | |
| if (CONTAINER.nodeName === 'THEAD') { | |
| row -= CONTAINER.childNodes.length; | |
| } | |
| } else if ((0, _element.overlayContainsElement)(_constants.CLONE_BOTTOM_LEFT_CORNER, cellElement, this.wtRootElement) || (0, _element.overlayContainsElement)(_constants.CLONE_BOTTOM, cellElement, this.wtRootElement)) { | |
| var totalRows = this.wot.getSetting('totalRows'); | |
| row = totalRows - CONTAINER.childNodes.length + row; | |
| } else if (CONTAINER === this.THEAD) { | |
| row = this.rowFilter.visibleColHeadedRowToSourceRow(row); | |
| } else { | |
| row = this.rowFilter.renderedToSource(row); | |
| } | |
| if ((0, _element.overlayContainsElement)(_constants.CLONE_TOP_LEFT_CORNER, cellElement, this.wtRootElement) || (0, _element.overlayContainsElement)(_constants.CLONE_LEFT, cellElement, this.wtRootElement) || (0, _element.overlayContainsElement)(_constants.CLONE_BOTTOM_LEFT_CORNER, cellElement, this.wtRootElement)) { | |
| col = this.columnFilter.offsettedTH(col); | |
| } else { | |
| col = this.columnFilter.visibleRowHeadedColumnToSourceColumn(col); | |
| } | |
| return new _coords.default(row, col); | |
| } | |
| /** | |
| * Check if any of the rendered rows is higher than expected, and if so, cache them. | |
| */ | |
| }, { | |
| key: "markOversizedRows", | |
| value: function markOversizedRows() { | |
| if (this.wot.getSetting('externalRowCalculator')) { | |
| return; | |
| } | |
| var rowCount = this.TBODY.childNodes.length; | |
| var expectedTableHeight = rowCount * this.wot.wtSettings.settings.defaultRowHeight; | |
| var actualTableHeight = (0, _element.innerHeight)(this.TBODY) - 1; | |
| var previousRowHeight; | |
| var rowInnerHeight; | |
| var sourceRowIndex; | |
| var currentTr; | |
| var rowHeader; | |
| if (expectedTableHeight === actualTableHeight && !this.wot.getSetting('fixedRowsBottom')) { | |
| // If the actual table height equals rowCount * default single row height, no row is oversized -> no need to iterate over them | |
| return; | |
| } | |
| while (rowCount) { | |
| rowCount -= 1; | |
| sourceRowIndex = this.rowFilter.renderedToSource(rowCount); | |
| previousRowHeight = this.getRowHeight(sourceRowIndex); | |
| currentTr = this.getTrForRow(sourceRowIndex); | |
| rowHeader = currentTr.querySelector('th'); | |
| if (rowHeader) { | |
| rowInnerHeight = (0, _element.innerHeight)(rowHeader); | |
| } else { | |
| rowInnerHeight = (0, _element.innerHeight)(currentTr) - 1; | |
| } | |
| if (!previousRowHeight && this.wot.wtSettings.settings.defaultRowHeight < rowInnerHeight || previousRowHeight < rowInnerHeight) { | |
| rowInnerHeight += 1; | |
| this.wot.wtViewport.oversizedRows[sourceRowIndex] = rowInnerHeight; | |
| } | |
| } | |
| } | |
| /** | |
| * @param {number} row The visual row index. | |
| * @returns {HTMLTableElement} | |
| */ | |
| }, { | |
| key: "getTrForRow", | |
| value: function getTrForRow(row) { | |
| return this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)]; | |
| } | |
| /** | |
| * Checks if the column index (negative value from -1 to N) is rendered. | |
| * | |
| * @param {number} column The column index (negative value from -1 to N). | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isColumnHeaderRendered", | |
| value: function isColumnHeaderRendered(column) { | |
| if (column >= 0) { | |
| return false; | |
| } | |
| var rowHeaders = this.wot.getSetting('rowHeaders'); | |
| var rowHeadersCount = rowHeaders.length; | |
| return Math.abs(column) <= rowHeadersCount; | |
| } | |
| /** | |
| * Checks if the row index (negative value from -1 to N) is rendered. | |
| * | |
| * @param {number} row The row index (negative value from -1 to N). | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isRowHeaderRendered", | |
| value: function isRowHeaderRendered(row) { | |
| if (row >= 0) { | |
| return false; | |
| } | |
| var columnHeaders = this.wot.getSetting('columnHeaders'); | |
| var columnHeadersCount = columnHeaders.length; | |
| return Math.abs(row) <= columnHeadersCount; | |
| } | |
| /* eslint-disable jsdoc/require-description-complete-sentence */ | |
| /** | |
| * Check if the given row index is lower than the index of the first row that | |
| * is currently rendered and return TRUE in that case, or FALSE otherwise. | |
| * | |
| * Negative row index is used to check the columns' headers. | |
| * | |
| * Headers | |
| * +--------------+ │ | |
| * -3 │ │ │ │ │ | |
| * +--------------+ │ | |
| * -2 │ │ │ │ │ TRUE | |
| * +--------------+ │ | |
| * -1 │ │ │ │ │ | |
| * Cells +==================+ │ | |
| * 0 ┇ ┇ ┇ ┇ <--- For fixedRowsTop: 1 │ | |
| * +--------------+ the master overlay do ---+ first rendered row (index 1) | |
| * 1 │ A2 │ B2 │ C2 │ not render the first row. │ | |
| * +--------------+ │ FALSE | |
| * 2 │ A3 │ B3 │ C3 │ │ | |
| * +--------------+ ---+ last rendered row | |
| * │ | |
| * │ FALSE | |
| * | |
| * @param {number} row The visual row index. | |
| * @memberof Table# | |
| * @function isRowBeforeRenderedRows | |
| * @returns {boolean} | |
| */ | |
| /* eslint-enable jsdoc/require-description-complete-sentence */ | |
| }, { | |
| key: "isRowBeforeRenderedRows", | |
| value: function isRowBeforeRenderedRows(row) { | |
| var first = this.getFirstRenderedRow(); // Check the headers only in case when the first rendered row is -1 or 0. | |
| // This is an indication that the overlay is placed on the most top position. | |
| if (row < 0 && first <= 0) { | |
| return !this.isRowHeaderRendered(row); | |
| } | |
| return row < first; | |
| } | |
| /* eslint-disable jsdoc/require-description-complete-sentence */ | |
| /** | |
| * Check if the given column index is greater than the index of the last column that | |
| * is currently rendered and return TRUE in that case, or FALSE otherwise. | |
| * | |
| * The negative row index is used to check the columns' headers. However, | |
| * keep in mind that for negative indexes, the method always returns FALSE as | |
| * it is not possible to render headers partially. The "after" index can not be | |
| * lower than -1. | |
| * | |
| * Headers | |
| * +--------------+ │ | |
| * -3 │ │ │ │ │ | |
| * +--------------+ │ | |
| * -2 │ │ │ │ │ FALSE | |
| * +--------------+ │ | |
| * -1 │ │ │ │ │ | |
| * Cells +==================+ │ | |
| * 0 ┇ ┇ ┇ ┇ <--- For fixedRowsTop: 1 │ | |
| * +--------------+ the master overlay do ---+ first rendered row (index 1) | |
| * 1 │ A2 │ B2 │ C2 │ not render the first rows │ | |
| * +--------------+ │ FALSE | |
| * 2 │ A3 │ B3 │ C3 │ │ | |
| * +--------------+ ---+ last rendered row | |
| * │ | |
| * │ TRUE | |
| * | |
| * @param {number} row The visual row index. | |
| * @memberof Table# | |
| * @function isRowAfterRenderedRows | |
| * @returns {boolean} | |
| */ | |
| /* eslint-enable jsdoc/require-description-complete-sentence */ | |
| }, { | |
| key: "isRowAfterRenderedRows", | |
| value: function isRowAfterRenderedRows(row) { | |
| return row > this.getLastRenderedRow(); | |
| } | |
| /* eslint-disable jsdoc/require-description-complete-sentence */ | |
| /** | |
| * Check if the given column index is lower than the index of the first column that | |
| * is currently rendered and return TRUE in that case, or FALSE otherwise. | |
| * | |
| * Negative column index is used to check the rows' headers. | |
| * | |
| * For fixedColumnsLeft: 1 the master overlay | |
| * do not render this first columns. | |
| * Headers -3 -2 -1 | | |
| * +----+----+----║┄ ┄ +------+------+ | |
| * │ │ │ ║ │ B1 │ C1 │ | |
| * +--------------║┄ ┄ --------------│ | |
| * │ │ │ ║ │ B2 │ C2 │ | |
| * +--------------║┄ ┄ --------------│ | |
| * │ │ │ ║ │ B3 │ C3 │ | |
| * +----+----+----║┄ ┄ +------+------+ | |
| * ╷ ╷ | |
| * -------------------------+-------------+----------------> | |
| * TRUE first FALSE last FALSE | |
| * rendered rendered | |
| * column column | |
| * | |
| * @param {number} column The visual column index. | |
| * @memberof Table# | |
| * @function isColumnBeforeRenderedColumns | |
| * @returns {boolean} | |
| */ | |
| /* eslint-enable jsdoc/require-description-complete-sentence */ | |
| }, { | |
| key: "isColumnBeforeRenderedColumns", | |
| value: function isColumnBeforeRenderedColumns(column) { | |
| var first = this.getFirstRenderedColumn(); // Check the headers only in case when the first rendered column is -1 or 0. | |
| // This is an indication that the overlay is placed on the most left position. | |
| if (column < 0 && first <= 0) { | |
| return !this.isColumnHeaderRendered(column); | |
| } | |
| return column < first; | |
| } | |
| /* eslint-disable jsdoc/require-description-complete-sentence */ | |
| /** | |
| * Check if the given column index is greater than the index of the last column that | |
| * is currently rendered and return TRUE in that case, or FALSE otherwise. | |
| * | |
| * The negative column index is used to check the rows' headers. However, | |
| * keep in mind that for negative indexes, the method always returns FALSE as | |
| * it is not possible to render headers partially. The "after" index can not be | |
| * lower than -1. | |
| * | |
| * For fixedColumnsLeft: 1 the master overlay | |
| * do not render this first columns. | |
| * Headers -3 -2 -1 | | |
| * +----+----+----║┄ ┄ +------+------+ | |
| * │ │ │ ║ │ B1 │ C1 │ | |
| * +--------------║┄ ┄ --------------│ | |
| * │ │ │ ║ │ B2 │ C2 │ | |
| * +--------------║┄ ┄ --------------│ | |
| * │ │ │ ║ │ B3 │ C3 │ | |
| * +----+----+----║┄ ┄ +------+------+ | |
| * ╷ ╷ | |
| * -------------------------+-------------+----------------> | |
| * FALSE first FALSE last TRUE | |
| * rendered rendered | |
| * column column | |
| * | |
| * @param {number} column The visual column index. | |
| * @memberof Table# | |
| * @function isColumnAfterRenderedColumns | |
| * @returns {boolean} | |
| */ | |
| /* eslint-enable jsdoc/require-description-complete-sentence */ | |
| }, { | |
| key: "isColumnAfterRenderedColumns", | |
| value: function isColumnAfterRenderedColumns(column) { | |
| return this.columnFilter && column > this.getLastRenderedColumn(); | |
| } | |
| }, { | |
| key: "isColumnAfterViewport", | |
| value: function isColumnAfterViewport(column) { | |
| return this.columnFilter && column > this.getLastVisibleColumn(); | |
| } | |
| }, { | |
| key: "isRowAfterViewport", | |
| value: function isRowAfterViewport(row) { | |
| return this.rowFilter && row > this.getLastVisibleRow(); | |
| } | |
| }, { | |
| key: "isColumnBeforeViewport", | |
| value: function isColumnBeforeViewport(column) { | |
| return this.columnFilter && this.columnFilter.sourceToRendered(column) < 0 && column >= 0; | |
| } | |
| }, { | |
| key: "isLastRowFullyVisible", | |
| value: function isLastRowFullyVisible() { | |
| return this.getLastVisibleRow() === this.getLastRenderedRow(); | |
| } | |
| }, { | |
| key: "isLastColumnFullyVisible", | |
| value: function isLastColumnFullyVisible() { | |
| return this.getLastVisibleColumn() === this.getLastRenderedColumn(); | |
| } | |
| }, { | |
| key: "allRowsInViewport", | |
| value: function allRowsInViewport() { | |
| return this.wot.getSetting('totalRows') === this.getVisibleRowsCount(); | |
| } | |
| }, { | |
| key: "allColumnsInViewport", | |
| value: function allColumnsInViewport() { | |
| return this.wot.getSetting('totalColumns') === this.getVisibleColumnsCount(); | |
| } | |
| /** | |
| * Checks if any of the row's cells content exceeds its initial height, and if so, returns the oversized height. | |
| * | |
| * @param {number} sourceRow The physical row index. | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "getRowHeight", | |
| value: function getRowHeight(sourceRow) { | |
| return this.rowUtils.getHeight(sourceRow); | |
| } | |
| /** | |
| * @param {number} level The column level. | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "getColumnHeaderHeight", | |
| value: function getColumnHeaderHeight(level) { | |
| return this.columnUtils.getHeaderHeight(level); | |
| } | |
| /** | |
| * @param {number} sourceColumn The physical column index. | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "getColumnWidth", | |
| value: function getColumnWidth(sourceColumn) { | |
| return this.columnUtils.getWidth(sourceColumn); | |
| } | |
| /** | |
| * @param {number} sourceColumn The physical column index. | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "getStretchedColumnWidth", | |
| value: function getStretchedColumnWidth(sourceColumn) { | |
| return this.columnUtils.getStretchedColumnWidth(sourceColumn); | |
| } | |
| /** | |
| * Checks if the table has defined size. It returns `true` when the table has width and height | |
| * set bigger than `0px`. | |
| * | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "hasDefinedSize", | |
| value: function hasDefinedSize() { | |
| return this.hasTableHeight && this.hasTableWidth; | |
| } | |
| /** | |
| * Checks if the table is visible. It returns `true` when the holder element (or its parents) | |
| * has CSS 'display' property different than 'none'. | |
| * | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isVisible", | |
| value: function isVisible() { | |
| return (0, _element.isVisible)(this.TABLE); | |
| } | |
| /** | |
| * Modify row header widths provided by user in class contructor. | |
| * | |
| * @private | |
| * @param {Function} rowHeaderWidthFactory The function which can provide default width values for rows.. | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "_modifyRowHeaderWidth", | |
| value: function _modifyRowHeaderWidth(rowHeaderWidthFactory) { | |
| var widths = (0, _function.isFunction)(rowHeaderWidthFactory) ? rowHeaderWidthFactory() : null; | |
| if (Array.isArray(widths)) { | |
| widths = (0, _toConsumableArray2.default)(widths); | |
| widths[widths.length - 1] = this._correctRowHeaderWidth(widths[widths.length - 1]); | |
| } else { | |
| widths = this._correctRowHeaderWidth(widths); | |
| } | |
| return widths; | |
| } | |
| /** | |
| * Correct row header width if necessary. | |
| * | |
| * @private | |
| * @param {number} width The width to process. | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "_correctRowHeaderWidth", | |
| value: function _correctRowHeaderWidth(width) { | |
| var rowHeaderWidth = width; | |
| if (typeof width !== 'number') { | |
| rowHeaderWidth = this.wot.getSetting('defaultColumnWidth'); | |
| } | |
| if (this.correctHeaderWidth) { | |
| rowHeaderWidth += 1; | |
| } | |
| return rowHeaderWidth; | |
| } | |
| }]); | |
| return Table; | |
| }(); | |
| var _default = Table; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 111 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var setPrototypeOf = __webpack_require__(395); | |
| var isNativeReflectConstruct = __webpack_require__(517); | |
| function _construct(Parent, args, Class) { | |
| if (isNativeReflectConstruct()) { | |
| module.exports = _construct = Reflect.construct; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| } else { | |
| module.exports = _construct = function _construct(Parent, args, Class) { | |
| var a = [null]; | |
| a.push.apply(a, args); | |
| var Constructor = Function.bind.apply(Parent, a); | |
| var instance = new Constructor(); | |
| if (Class) setPrototypeOf(instance, Class.prototype); | |
| return instance; | |
| }; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| } | |
| return _construct.apply(null, arguments); | |
| } | |
| module.exports = _construct; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 112 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.Overlay = void 0; | |
| __webpack_require__(17); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _element = __webpack_require__(10); | |
| var _object = __webpack_require__(5); | |
| var _array = __webpack_require__(3); | |
| var _console = __webpack_require__(69); | |
| var _eventManager = _interopRequireDefault(__webpack_require__(31)); | |
| var _constants = __webpack_require__(87); | |
| /** | |
| * Creates an overlay over the original Walkontable instance. The overlay renders the clone of the original Walkontable | |
| * and (optionally) implements behavior needed for native horizontal and vertical scrolling. | |
| * | |
| * @class Overlay | |
| */ | |
| var Overlay = /*#__PURE__*/function () { | |
| /** | |
| * @param {Walkontable} wotInstance The Walkontable instance. | |
| */ | |
| function Overlay(wotInstance) { | |
| (0, _classCallCheck2.default)(this, Overlay); | |
| (0, _object.defineGetter)(this, 'wot', wotInstance, { | |
| writable: false | |
| }); | |
| var _this$wot$wtTable = this.wot.wtTable, | |
| TABLE = _this$wot$wtTable.TABLE, | |
| hider = _this$wot$wtTable.hider, | |
| spreader = _this$wot$wtTable.spreader, | |
| holder = _this$wot$wtTable.holder, | |
| wtRootElement = _this$wot$wtTable.wtRootElement; // legacy support, deprecated in the future | |
| this.instance = this.wot; | |
| this.type = ''; | |
| this.mainTableScrollableElement = null; | |
| this.TABLE = TABLE; | |
| this.hider = hider; | |
| this.spreader = spreader; | |
| this.holder = holder; | |
| this.wtRootElement = wtRootElement; | |
| this.trimmingContainer = (0, _element.getTrimmingContainer)(this.hider.parentNode.parentNode); | |
| this.updateStateOfRendering(); | |
| } | |
| /** | |
| * Update internal state of object with an information about the need of full rendering of the overlay. | |
| * | |
| * @returns {boolean} Returns `true` if the state has changed since the last check. | |
| */ | |
| (0, _createClass2.default)(Overlay, [{ | |
| key: "updateStateOfRendering", | |
| value: function updateStateOfRendering() { | |
| var previousState = this.needFullRender; | |
| this.needFullRender = this.shouldBeRendered(); | |
| var changed = previousState !== this.needFullRender; | |
| if (changed && !this.needFullRender) { | |
| this.reset(); | |
| } | |
| return changed; | |
| } | |
| /** | |
| * Checks if overlay should be fully rendered. | |
| * | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "shouldBeRendered", | |
| value: function shouldBeRendered() { | |
| return true; | |
| } | |
| /** | |
| * Update the trimming container. | |
| */ | |
| }, { | |
| key: "updateTrimmingContainer", | |
| value: function updateTrimmingContainer() { | |
| this.trimmingContainer = (0, _element.getTrimmingContainer)(this.hider.parentNode.parentNode); | |
| } | |
| /** | |
| * Update the main scrollable element. | |
| */ | |
| }, { | |
| key: "updateMainScrollableElement", | |
| value: function updateMainScrollableElement() { | |
| var _this$wot = this.wot, | |
| wtTable = _this$wot.wtTable, | |
| rootWindow = _this$wot.rootWindow; | |
| if (rootWindow.getComputedStyle(wtTable.wtRootElement.parentNode).getPropertyValue('overflow') === 'hidden') { | |
| this.mainTableScrollableElement = this.wot.wtTable.holder; | |
| } else { | |
| this.mainTableScrollableElement = (0, _element.getScrollableElement)(wtTable.TABLE); | |
| } | |
| } | |
| /** | |
| * Calculates coordinates of the provided element, relative to the root Handsontable element. | |
| * NOTE: The element needs to be a child of the overlay in order for the method to work correctly. | |
| * | |
| * @param {HTMLElement} element The cell element to calculate the position for. | |
| * @param {number} rowIndex Visual row index. | |
| * @param {number} columnIndex Visual column index. | |
| * @returns {{top: number, left: number}|undefined} | |
| */ | |
| }, { | |
| key: "getRelativeCellPosition", | |
| value: function getRelativeCellPosition(element, rowIndex, columnIndex) { | |
| if (this.clone.wtTable.holder.contains(element) === false) { | |
| (0, _console.warn)("The provided element is not a child of the ".concat(this.type, " overlay")); | |
| return; | |
| } | |
| var windowScroll = this.mainTableScrollableElement === this.wot.rootWindow; | |
| var fixedColumn = columnIndex < this.wot.getSetting('fixedColumnsLeft'); | |
| var fixedRowTop = rowIndex < this.wot.getSetting('fixedRowsTop'); | |
| var fixedRowBottom = rowIndex >= this.wot.getSetting('totalRows') - this.wot.getSetting('fixedRowsBottom'); | |
| var spreaderOffset = { | |
| left: this.clone.wtTable.spreader.offsetLeft, | |
| top: this.clone.wtTable.spreader.offsetTop | |
| }; | |
| var elementOffset = { | |
| left: element.offsetLeft, | |
| top: element.offsetTop | |
| }; | |
| var offsetObject = null; | |
| if (windowScroll) { | |
| offsetObject = this.getRelativeCellPositionWithinWindow(fixedRowTop, fixedColumn, elementOffset, spreaderOffset); | |
| } else { | |
| offsetObject = this.getRelativeCellPositionWithinHolder(fixedRowTop, fixedRowBottom, fixedColumn, elementOffset, spreaderOffset); | |
| } | |
| return offsetObject; | |
| } | |
| /** | |
| * Calculates coordinates of the provided element, relative to the root Handsontable element within a table with window | |
| * as a scrollable element. | |
| * | |
| * @private | |
| * @param {boolean} onFixedRowTop `true` if the coordinates point to a place within the top fixed rows. | |
| * @param {boolean} onFixedColumn `true` if the coordinates point to a place within the fixed columns. | |
| * @param {number} elementOffset Offset position of the cell element. | |
| * @param {number} spreaderOffset Offset position of the spreader element. | |
| * @returns {{top: number, left: number}} | |
| */ | |
| }, { | |
| key: "getRelativeCellPositionWithinWindow", | |
| value: function getRelativeCellPositionWithinWindow(onFixedRowTop, onFixedColumn, elementOffset, spreaderOffset) { | |
| var absoluteRootElementPosition = this.wot.wtTable.wtRootElement.getBoundingClientRect(); | |
| var horizontalOffset = 0; | |
| var verticalOffset = 0; | |
| if (!onFixedColumn) { | |
| horizontalOffset = spreaderOffset.left; | |
| } else { | |
| horizontalOffset = absoluteRootElementPosition.left <= 0 ? -1 * absoluteRootElementPosition.left : 0; | |
| } | |
| if (onFixedRowTop) { | |
| var absoluteOverlayPosition = this.clone.wtTable.TABLE.getBoundingClientRect(); | |
| verticalOffset = absoluteOverlayPosition.top - absoluteRootElementPosition.top; | |
| } else { | |
| verticalOffset = spreaderOffset.top; | |
| } | |
| return { | |
| left: elementOffset.left + horizontalOffset, | |
| top: elementOffset.top + verticalOffset | |
| }; | |
| } | |
| /** | |
| * Calculates coordinates of the provided element, relative to the root Handsontable element within a table with window | |
| * as a scrollable element. | |
| * | |
| * @private | |
| * @param {boolean} onFixedRowTop `true` if the coordinates point to a place within the top fixed rows. | |
| * @param {boolean} onFixedRowBottom `true` if the coordinates point to a place within the bottom fixed rows. | |
| * @param {boolean} onFixedColumn `true` if the coordinates point to a place within the fixed columns. | |
| * @param {number} elementOffset Offset position of the cell element. | |
| * @param {number} spreaderOffset Offset position of the spreader element. | |
| * @returns {{top: number, left: number}} | |
| */ | |
| }, { | |
| key: "getRelativeCellPositionWithinHolder", | |
| value: function getRelativeCellPositionWithinHolder(onFixedRowTop, onFixedRowBottom, onFixedColumn, elementOffset, spreaderOffset) { | |
| var tableScrollPosition = { | |
| horizontal: this.clone.cloneSource.wtOverlays.leftOverlay.getScrollPosition(), | |
| vertical: this.clone.cloneSource.wtOverlays.topOverlay.getScrollPosition() | |
| }; | |
| var horizontalOffset = 0; | |
| var verticalOffset = 0; | |
| if (!onFixedColumn) { | |
| horizontalOffset = tableScrollPosition.horizontal - spreaderOffset.left; | |
| } | |
| if (onFixedRowBottom) { | |
| var absoluteRootElementPosition = this.wot.wtTable.wtRootElement.getBoundingClientRect(); | |
| var absoluteOverlayPosition = this.clone.wtTable.TABLE.getBoundingClientRect(); | |
| verticalOffset = absoluteOverlayPosition.top * -1 + absoluteRootElementPosition.top; | |
| } else if (!onFixedRowTop) { | |
| verticalOffset = tableScrollPosition.vertical - spreaderOffset.top; | |
| } | |
| return { | |
| left: elementOffset.left - horizontalOffset, | |
| top: elementOffset.top - verticalOffset | |
| }; | |
| } | |
| /** | |
| * Make a clone of table for overlay. | |
| * | |
| * @param {string} direction Can be `Overlay.CLONE_TOP`, `Overlay.CLONE_LEFT`, | |
| * `Overlay.CLONE_TOP_LEFT_CORNER`. | |
| * @returns {Walkontable} | |
| */ | |
| }, { | |
| key: "makeClone", | |
| value: function makeClone(direction) { | |
| if (_constants.CLONE_TYPES.indexOf(direction) === -1) { | |
| throw new Error("Clone type \"".concat(direction, "\" is not supported.")); | |
| } | |
| var _this$wot2 = this.wot, | |
| wtTable = _this$wot2.wtTable, | |
| rootDocument = _this$wot2.rootDocument, | |
| rootWindow = _this$wot2.rootWindow; | |
| var clone = rootDocument.createElement('DIV'); | |
| var clonedTable = rootDocument.createElement('TABLE'); | |
| var tableParent = wtTable.wtRootElement.parentNode; | |
| clone.className = "ht_clone_".concat(direction, " handsontable"); | |
| clone.style.position = 'absolute'; | |
| clone.style.top = 0; | |
| clone.style.left = 0; | |
| clone.style.overflow = 'visible'; | |
| clonedTable.className = wtTable.TABLE.className; | |
| clone.appendChild(clonedTable); | |
| this.type = direction; | |
| tableParent.appendChild(clone); | |
| var preventOverflow = this.wot.getSetting('preventOverflow'); | |
| if (preventOverflow === true || preventOverflow === 'horizontal' && this.type === _constants.CLONE_TOP || preventOverflow === 'vertical' && this.type === _constants.CLONE_LEFT) { | |
| this.mainTableScrollableElement = rootWindow; | |
| } else if (rootWindow.getComputedStyle(tableParent).getPropertyValue('overflow') === 'hidden') { | |
| this.mainTableScrollableElement = wtTable.holder; | |
| } else { | |
| this.mainTableScrollableElement = (0, _element.getScrollableElement)(wtTable.TABLE); | |
| } // Create a new instance of the Walkontable class | |
| return new this.wot.constructor({ | |
| cloneSource: this.wot, | |
| cloneOverlay: this, | |
| table: clonedTable | |
| }); | |
| } | |
| /** | |
| * Refresh/Redraw overlay. | |
| * | |
| * @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. | |
| */ | |
| }, { | |
| key: "refresh", | |
| value: function refresh() { | |
| var fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | |
| // When hot settings are changed we allow to refresh overlay once before blocking | |
| var nextCycleRenderFlag = this.shouldBeRendered(); | |
| if (this.clone && (this.needFullRender || nextCycleRenderFlag)) { | |
| this.clone.draw(fastDraw); | |
| } | |
| this.needFullRender = nextCycleRenderFlag; | |
| } | |
| /** | |
| * Reset overlay styles to initial values. | |
| */ | |
| }, { | |
| key: "reset", | |
| value: function reset() { | |
| if (!this.clone) { | |
| return; | |
| } | |
| var holder = this.clone.wtTable.holder; | |
| var hider = this.clone.wtTable.hider; | |
| var holderStyle = holder.style; | |
| var hidderStyle = hider.style; | |
| var rootStyle = holder.parentNode.style; | |
| (0, _array.arrayEach)([holderStyle, hidderStyle, rootStyle], function (style) { | |
| style.width = ''; | |
| style.height = ''; | |
| }); | |
| } | |
| /** | |
| * Destroy overlay instance. | |
| */ | |
| }, { | |
| key: "destroy", | |
| value: function destroy() { | |
| new _eventManager.default(this.clone).destroy(); | |
| } | |
| }]); | |
| return Overlay; | |
| }(); | |
| exports.Overlay = Overlay; | |
| /***/ }), | |
| /* 113 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__(6); | |
| var _interopRequireDefault = __webpack_require__(0); | |
| 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 _get2 = _interopRequireDefault(__webpack_require__(16)); | |
| var _inherits2 = _interopRequireDefault(__webpack_require__(7)); | |
| var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(8)); | |
| var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(4)); | |
| var _src = __webpack_require__(38); | |
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | |
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | |
| var VisualSelection = /*#__PURE__*/function (_Selection) { | |
| (0, _inherits2.default)(VisualSelection, _Selection); | |
| var _super = _createSuper(VisualSelection); | |
| function VisualSelection(settings, visualCellRange) { | |
| var _this; | |
| (0, _classCallCheck2.default)(this, VisualSelection); | |
| _this = _super.call(this, settings, null); | |
| /** | |
| * Range of selection visually. Visual representation may have representation in a rendered selection. | |
| * | |
| * @type {null|CellRange} | |
| */ | |
| _this.visualCellRange = visualCellRange || null; | |
| _this.commit(); | |
| return _this; | |
| } | |
| /** | |
| * Adds a cell coords to the selection. | |
| * | |
| * @param {CellCoords} coords Visual coordinates of a cell. | |
| * @returns {VisualSelection} | |
| */ | |
| (0, _createClass2.default)(VisualSelection, [{ | |
| key: "add", | |
| value: function add(coords) { | |
| if (this.visualCellRange === null) { | |
| this.visualCellRange = new _src.CellRange(coords); | |
| } else { | |
| this.visualCellRange.expand(coords); | |
| } | |
| return this; | |
| } | |
| /** | |
| * Clears visual and renderable selection. | |
| * | |
| * @returns {VisualSelection} | |
| */ | |
| }, { | |
| key: "clear", | |
| value: function clear() { | |
| this.visualCellRange = null; | |
| return (0, _get2.default)((0, _getPrototypeOf2.default)(VisualSelection.prototype), "clear", this).call(this); | |
| } | |
| /** | |
| * Search for the first visible coordinates in the range as range may start and/or end with the hidden index. | |
| * | |
| * @private | |
| * @param {CellCoords} startCoords Visual start coordinates for the range. Starting point for finding destination coordinates | |
| * with visible coordinates (we are going from the starting coordinates to the end coordinates until the criteria are met). | |
| * @param {CellCoords} endCoords Visual end coordinates for the range. | |
| * @param {number} incrementByRow We are searching for a next visible rows by increasing (to be precise, or decreasing) indexes. | |
| * This variable represent indexes shift. We are looking for an index: | |
| * - for rows: from the left to the right (increasing indexes, then variable should have value 1) or | |
| * other way around (decreasing indexes, then variable should have the value -1) | |
| * - for columns: from the top to the bottom (increasing indexes, then variable should have value 1) | |
| * or other way around (decreasing indexes, then variable should have the value -1). | |
| * @param {number} incrementByColumn As above, just indexes shift for columns. | |
| * @returns {null|CellCoords} Visual cell coordinates. | |
| */ | |
| }, { | |
| key: "findVisibleCoordsInRange", | |
| value: function findVisibleCoordsInRange(startCoords, endCoords, incrementByRow) { | |
| var incrementByColumn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : incrementByRow; | |
| var nextVisibleRow = this.findVisibleCoordsInRowsRange(startCoords.row, endCoords.row, incrementByRow); // There are no more visual rows in the range. | |
| if (nextVisibleRow === null) { | |
| return null; | |
| } | |
| var nextVisibleColumn = this.findVisibleCoordsInColumnsRange(startCoords.col, endCoords.col, incrementByColumn); // There are no more visual columns in the range. | |
| if (nextVisibleColumn === null) { | |
| return null; | |
| } | |
| return new _src.CellCoords(nextVisibleRow, nextVisibleColumn); | |
| } | |
| /** | |
| * Searches the nearest visible row index, which is not hidden (is renderable). | |
| * | |
| * @private | |
| * @param {CellCoords} startVisibleRow Visual row index which starts the range. Starting point for finding | |
| * destination coordinates with visible coordinates (we are going from the starting coordinates to the end | |
| * coordinates until the criteria are met). | |
| * @param {CellCoords} endVisibleRow Visual row index which ends the range. | |
| * @param {number} incrementBy We are searching for a next visible rows by increasing (to be precise, or decreasing) | |
| * indexes. This variable represent indexes shift. From the left to the right (increasing indexes, then variable | |
| * should have value 1) or other way around (decreasing indexes, then variable should have the value -1). | |
| * @returns {number|null} The visual row index. | |
| */ | |
| }, { | |
| key: "findVisibleCoordsInRowsRange", | |
| value: function findVisibleCoordsInRowsRange(startVisibleRow, endVisibleRow, incrementBy) { | |
| var _this$settings$visual = this.settings.visualToRenderableCoords({ | |
| row: startVisibleRow, | |
| col: -1 | |
| }), | |
| startRowRenderable = _this$settings$visual.row; // There are no more visual rows in the range. | |
| if (endVisibleRow === startVisibleRow && startRowRenderable === null) { | |
| return null; | |
| } // We are looking for a next visible row in the range. | |
| if (startRowRenderable === null) { | |
| return this.findVisibleCoordsInRowsRange(startVisibleRow + incrementBy, endVisibleRow, incrementBy); | |
| } // We found visible row index in the range. | |
| return startVisibleRow; | |
| } | |
| /** | |
| * Searches the nearest visible column index, which is not hidden (is renderable). | |
| * | |
| * @private | |
| * @param {CellCoords} startVisibleColumn Visual column index which starts the range. Starting point for finding | |
| * destination coordinates with visible coordinates (we are going from the starting coordinates to the end | |
| * coordinates until the criteria are met). | |
| * @param {CellCoords} endVisibleColumn Visual column index which ends the range. | |
| * @param {number} incrementBy We are searching for a next visible columns by increasing (to be precise, or decreasing) | |
| * indexes. This variable represent indexes shift. From the top to the bottom (increasing indexes, then variable | |
| * should have value 1) or other way around (decreasing indexes, then variable should have the value -1). | |
| * @returns {number|null} The visual column index. | |
| */ | |
| }, { | |
| key: "findVisibleCoordsInColumnsRange", | |
| value: function findVisibleCoordsInColumnsRange(startVisibleColumn, endVisibleColumn, incrementBy) { | |
| var _this$settings$visual2 = this.settings.visualToRenderableCoords({ | |
| row: -1, | |
| col: startVisibleColumn | |
| }), | |
| startColumnRenderable = _this$settings$visual2.col; // There are no more visual columns in the range. | |
| if (endVisibleColumn === startVisibleColumn && startColumnRenderable === null) { | |
| return null; | |
| } // We are looking for a next visible column in the range. | |
| if (startColumnRenderable === null) { | |
| return this.findVisibleCoordsInColumnsRange(startVisibleColumn + incrementBy, endVisibleColumn, incrementBy); | |
| } // We found visible column index in the range. | |
| return startVisibleColumn; | |
| } | |
| /** | |
| * Searches the nearest visible column and row index, which is not hidden (is renderable). If one | |
| * of the axes' range is entirely hidden, then created CellCoords object will hold the `null` value | |
| * under a specific axis. For example, when we select the hidden column, then the calculated `col` | |
| * prop will be `null`. In that case, rows are calculated further (regardless of the column result) | |
| * to make rows header highlightable. | |
| * | |
| * @private | |
| * @param {CellCoords} visualFromCoords Visual start coordinates for the range. Starting point for finding destination coordinates | |
| * with visible coordinates (we are going from the starting coordinates to the end coordinates until the criteria are met). | |
| * @param {CellCoords} visualToCoords Visual end coordinates for the range. | |
| * @param {number} incrementByRow We are searching for a next visible rows by increasing (to be precise, or decreasing) indexes. | |
| * This variable represent indexes shift. We are looking for an index: | |
| * - for rows: from the left to the right (increasing indexes, then variable should have value 1) or | |
| * other way around (decreasing indexes, then variable should have the value -1) | |
| * - for columns: from the top to the bottom (increasing indexes, then variable should have value 1) | |
| * or other way around (decreasing indexes, then variable should have the value -1). | |
| * @param {number} incrementByColumn As above, just indexes shift for columns. | |
| * @returns {CellCoords[]|null} Visual cell coordinates. | |
| */ | |
| }, { | |
| key: "findVisibleHeaderRange", | |
| value: function findVisibleHeaderRange(visualFromCoords, visualToCoords, incrementByRow, incrementByColumn) { | |
| var fromRangeVisualRow = this.findVisibleCoordsInRowsRange(visualFromCoords.row, visualToCoords.row, incrementByRow); | |
| var toRangeVisualRow = this.findVisibleCoordsInRowsRange(visualToCoords.row, visualFromCoords.row, -incrementByRow); | |
| var fromRangeVisualColumn = this.findVisibleCoordsInColumnsRange(visualFromCoords.col, visualToCoords.col, incrementByColumn); | |
| var toRangeVisualColumn = this.findVisibleCoordsInColumnsRange(visualToCoords.col, visualFromCoords.col, -incrementByColumn); // All rows and columns ranges are hidden. | |
| if (fromRangeVisualRow === null && toRangeVisualRow === null && fromRangeVisualColumn === null && toRangeVisualColumn === null) { | |
| return null; | |
| } | |
| return [new _src.CellCoords(fromRangeVisualRow, fromRangeVisualColumn), new _src.CellCoords(toRangeVisualRow, toRangeVisualColumn)]; | |
| } | |
| /** | |
| * Override internally stored visual indexes added by the Selection's `add` function. It should be executed | |
| * at the end of process of adding visual selection coordinates. | |
| * | |
| * @returns {VisualSelection} | |
| */ | |
| }, { | |
| key: "commit", | |
| value: function commit() { | |
| // There is no information about visual ranges, thus no selection may be displayed. | |
| if (this.visualCellRange === null) { | |
| return this; | |
| } | |
| var _this$visualCellRange = this.visualCellRange, | |
| visualFromCoords = _this$visualCellRange.from, | |
| visualToCoords = _this$visualCellRange.to; // We may move in two different directions while searching for visible rows and visible columns. | |
| var incrementByRow = this.getRowSearchDirection(this.visualCellRange); | |
| var incrementByColumn = this.getColumnSearchDirection(this.visualCellRange); | |
| var fromRangeVisual = this.findVisibleCoordsInRange(visualFromCoords, visualToCoords, incrementByRow, incrementByColumn); | |
| var toRangeVisual = this.findVisibleCoordsInRange(visualToCoords, visualFromCoords, -incrementByRow, -incrementByColumn); // There is no visual start point (and also visual end point) in the range. | |
| // We are looking for the first visible cell in a broader range. | |
| if (fromRangeVisual === null || toRangeVisual === null) { | |
| var isHeaderSelectionType = this.settings.type === 'header'; | |
| var cellRange = null; // For the "header" selection type, find rows and column indexes, which should be | |
| // highlighted, although one of the axes is completely hidden. | |
| if (isHeaderSelectionType) { | |
| var _this$findVisibleHead = this.findVisibleHeaderRange(visualFromCoords, visualToCoords, incrementByRow, incrementByColumn), | |
| _this$findVisibleHead2 = (0, _slicedToArray2.default)(_this$findVisibleHead, 2), | |
| fromRangeVisualHeader = _this$findVisibleHead2[0], | |
| toRangeVisualHeader = _this$findVisibleHead2[1]; | |
| cellRange = this.createRenderableCellRange(fromRangeVisualHeader, toRangeVisualHeader); | |
| } | |
| this.cellRange = cellRange; | |
| } else { | |
| this.cellRange = this.createRenderableCellRange(fromRangeVisual, toRangeVisual); | |
| } | |
| return this; | |
| } | |
| /** | |
| * Some selection may be a part of broader cell range. This function adjusting coordinates of current selection | |
| * and the broader cell range when needed (current selection can't be presented visually). | |
| * | |
| * @param {CellRange} broaderCellRange Visual range. Actual cell range may be contained in the broader cell range. | |
| * When there is no way to represent some cell range visually we try to find range containing just the first visible cell. | |
| * | |
| * Warn: Please keep in mind that this function may change coordinates of the handled broader range. | |
| * | |
| * @returns {VisualSelection} | |
| */ | |
| }, { | |
| key: "adjustCoordinates", | |
| value: function adjustCoordinates(broaderCellRange) { | |
| // We may move in two different directions while searching for visible rows and visible columns. | |
| var incrementByRow = this.getRowSearchDirection(broaderCellRange); | |
| var incrementByColumn = this.getColumnSearchDirection(broaderCellRange); | |
| var normFromCoords = broaderCellRange.from.clone().normalize(); | |
| var normToCoords = broaderCellRange.to.clone().normalize(); | |
| var singleCellRangeVisual = this.findVisibleCoordsInRange(normFromCoords, normToCoords, incrementByRow, incrementByColumn); | |
| if (singleCellRangeVisual !== null) { | |
| // We can't show selection visually now, but we found fist visible range in the broader cell range. | |
| if (this.cellRange === null) { | |
| var singleCellRangeRenderable = this.settings.visualToRenderableCoords(singleCellRangeVisual); | |
| this.cellRange = new _src.CellRange(singleCellRangeRenderable); | |
| } // We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range) | |
| // TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it? | |
| broaderCellRange.setHighlight(singleCellRangeVisual); | |
| return this; | |
| } // Fallback to the start of the range. It resets the previous highlight (for example, when all columns have been hidden). | |
| broaderCellRange.setHighlight(broaderCellRange.from); | |
| return this; | |
| } | |
| /** | |
| * Returns the top left (TL) and bottom right (BR) selection coordinates (renderable indexes). | |
| * The method overwrites the original method to support header selection for hidden cells. | |
| * To make the header selection working, the CellCoords and CellRange have to support not | |
| * complete coordinates (`null` values for example, `row: null`, `col: 2`). | |
| * | |
| * @returns {Array} Returns array of coordinates for example `[1, 1, 5, 5]`. | |
| */ | |
| }, { | |
| key: "getCorners", | |
| value: function getCorners() { | |
| var _this$cellRange = this.cellRange, | |
| from = _this$cellRange.from, | |
| to = _this$cellRange.to; | |
| var isRowUndefined = from.row === null || to.row === null; | |
| var isColumnUndefined = from.col === null || to.col === null; | |
| var topLeftCorner = new _src.CellCoords(isRowUndefined ? null : Math.min(from.row, to.row), isColumnUndefined ? null : Math.min(from.col, to.col)); | |
| var bottomRightCorner = new _src.CellCoords(isRowUndefined ? null : Math.max(from.row, to.row), isColumnUndefined ? null : Math.max(from.col, to.col)); | |
| return [topLeftCorner.row, topLeftCorner.col, bottomRightCorner.row, bottomRightCorner.col]; | |
| } | |
| /** | |
| * Returns the top left (TL) and bottom right (BR) selection coordinates (visual indexes). | |
| * | |
| * @returns {Array} Returns array of coordinates for example `[1, 1, 5, 5]`. | |
| */ | |
| }, { | |
| key: "getVisualCorners", | |
| value: function getVisualCorners() { | |
| var topLeft = this.settings.renderableToVisualCoords(this.cellRange.getTopLeftCorner()); | |
| var bottomRight = this.settings.renderableToVisualCoords(this.cellRange.getBottomRightCorner()); | |
| return [topLeft.row, topLeft.col, bottomRight.row, bottomRight.col]; | |
| } | |
| /** | |
| * Creates a new CellRange object based on visual coordinates which before object creation are | |
| * translated to renderable indexes. | |
| * | |
| * @param {CellCoords} visualFromCoords The CellCoords object which contains coordinates that | |
| * points to the begining of the selection. | |
| * @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that | |
| * points to the end of the selection. | |
| * @returns {CellRange} | |
| */ | |
| }, { | |
| key: "createRenderableCellRange", | |
| value: function createRenderableCellRange(visualFromCoords, visualToCoords) { | |
| var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords); | |
| var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords); | |
| return new _src.CellRange(renderableFromCoords, renderableFromCoords, renderableToCoords); | |
| } | |
| /** | |
| * It returns rows shift needed for searching visual row. | |
| * | |
| * @private | |
| * @param {CellRange} cellRange Selection range. | |
| * @returns {number} Rows shift. It return 1 when we should increase indexes (moving from the top to the bottom) or | |
| * -1 when we should decrease indexes (moving other way around). | |
| */ | |
| }, { | |
| key: "getRowSearchDirection", | |
| value: function getRowSearchDirection(cellRange) { | |
| if (cellRange.from.row < cellRange.to.row) { | |
| return 1; // Increasing row indexes. | |
| } | |
| return -1; // Decreasing row indexes. | |
| } | |
| /** | |
| * It returns columns shift needed for searching visual column. | |
| * | |
| * @private | |
| * @param {CellRange} cellRange Selection range. | |
| * @returns {number} Columns shift. It return 1 when we should increase indexes (moving from the left to the right) or | |
| * -1 when we should decrease indexes (moving other way around). | |
| */ | |
| }, { | |
| key: "getColumnSearchDirection", | |
| value: function getColumnSearchDirection(cellRange) { | |
| if (cellRange.from.col < cellRange.to.col) { | |
| return 1; // Increasing column indexes. | |
| } | |
| return -1; // Decreasing column indexes. | |
| } | |
| }]); | |
| return VisualSelection; | |
| }(_src.Selection); | |
| var _default = VisualSelection; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 114 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.createId = createId; | |
| exports.createDefaultCustomBorder = createDefaultCustomBorder; | |
| exports.createSingleEmptyBorder = createSingleEmptyBorder; | |
| exports.createDefaultHtBorder = createDefaultHtBorder; | |
| exports.createEmptyBorders = createEmptyBorders; | |
| exports.extendDefaultBorder = extendDefaultBorder; | |
| exports.checkSelectionBorders = checkSelectionBorders; | |
| exports.markSelected = markSelected; | |
| __webpack_require__(19); | |
| var _object = __webpack_require__(5); | |
| var _array = __webpack_require__(3); | |
| /** | |
| * Create separated id for borders for each cell. | |
| * | |
| * @param {number} row Visual row index. | |
| * @param {number} col Visual column index. | |
| * @returns {string} | |
| */ | |
| function createId(row, col) { | |
| return "border_row".concat(row, "col").concat(col); | |
| } | |
| /** | |
| * Create default single border for each position (top/right/bottom/left). | |
| * | |
| * @returns {object} `{{width: number, color: string}}`. | |
| */ | |
| function createDefaultCustomBorder() { | |
| return { | |
| width: 1, | |
| color: '#000' | |
| }; | |
| } | |
| /** | |
| * Create default object for empty border. | |
| * | |
| * @returns {object} `{{hide: boolean}}`. | |
| */ | |
| function createSingleEmptyBorder() { | |
| return { | |
| hide: true | |
| }; | |
| } | |
| /** | |
| * Create default Handsontable border object. | |
| * | |
| * @returns {object} `{{width: number, color: string, cornerVisible: boolean}}`. | |
| */ | |
| function createDefaultHtBorder() { | |
| return { | |
| width: 1, | |
| color: '#000', | |
| cornerVisible: false | |
| }; | |
| } | |
| /** | |
| * Prepare empty border for each cell with all custom borders hidden. | |
| * | |
| * @param {number} row Visual row index. | |
| * @param {number} col Visual column index. | |
| * @returns {object} Returns border configuration containing visual indexes. Example of an object defining it: | |
| * `{{id: *, border: *, row: *, col: *, top: {hide: boolean}, right: {hide: boolean}, bottom: {hide: boolean}, left: {hide: boolean}}}`. | |
| */ | |
| function createEmptyBorders(row, col) { | |
| return { | |
| id: createId(row, col), | |
| border: createDefaultHtBorder(), | |
| row: row, | |
| col: col, | |
| top: createSingleEmptyBorder(), | |
| right: createSingleEmptyBorder(), | |
| bottom: createSingleEmptyBorder(), | |
| left: createSingleEmptyBorder() | |
| }; | |
| } | |
| /** | |
| * @param {object} defaultBorder The default border object. | |
| * @param {object} customBorder The border object with custom settings. | |
| * @returns {object} | |
| */ | |
| function extendDefaultBorder(defaultBorder, customBorder) { | |
| if ((0, _object.hasOwnProperty)(customBorder, 'border')) { | |
| defaultBorder.border = customBorder.border; | |
| } | |
| if ((0, _object.hasOwnProperty)(customBorder, 'top')) { | |
| if (customBorder.top) { | |
| if (!(0, _object.isObject)(customBorder.top)) { | |
| customBorder.top = createDefaultCustomBorder(); | |
| } | |
| defaultBorder.top = customBorder.top; | |
| } else { | |
| customBorder.top = createSingleEmptyBorder(); | |
| defaultBorder.top = customBorder.top; | |
| } | |
| } | |
| if ((0, _object.hasOwnProperty)(customBorder, 'right')) { | |
| if (customBorder.right) { | |
| if (!(0, _object.isObject)(customBorder.right)) { | |
| customBorder.right = createDefaultCustomBorder(); | |
| } | |
| defaultBorder.right = customBorder.right; | |
| } else { | |
| customBorder.right = createSingleEmptyBorder(); | |
| defaultBorder.right = customBorder.right; | |
| } | |
| } | |
| if ((0, _object.hasOwnProperty)(customBorder, 'bottom')) { | |
| if (customBorder.bottom) { | |
| if (!(0, _object.isObject)(customBorder.bottom)) { | |
| customBorder.bottom = createDefaultCustomBorder(); | |
| } | |
| defaultBorder.bottom = customBorder.bottom; | |
| } else { | |
| customBorder.bottom = createSingleEmptyBorder(); | |
| defaultBorder.bottom = customBorder.bottom; | |
| } | |
| } | |
| if ((0, _object.hasOwnProperty)(customBorder, 'left')) { | |
| if (customBorder.left) { | |
| if (!(0, _object.isObject)(customBorder.left)) { | |
| customBorder.left = createDefaultCustomBorder(); | |
| } | |
| defaultBorder.left = customBorder.left; | |
| } else { | |
| customBorder.left = createSingleEmptyBorder(); | |
| defaultBorder.left = customBorder.left; | |
| } | |
| } | |
| return defaultBorder; | |
| } | |
| /** | |
| * Check if selection has border. | |
| * | |
| * @param {Core} hot The Handsontable instance. | |
| * @param {string} [direction] If set ('left' or 'top') then only the specified border side will be checked. | |
| * @returns {boolean} | |
| */ | |
| function checkSelectionBorders(hot, direction) { | |
| var atLeastOneHasBorder = false; | |
| (0, _array.arrayEach)(hot.getSelectedRange(), function (range) { | |
| range.forAll(function (r, c) { | |
| if (r < 0 || c < 0) { | |
| return; | |
| } | |
| var metaBorders = hot.getCellMeta(r, c).borders; | |
| if (metaBorders) { | |
| if (direction) { | |
| if (!(0, _object.hasOwnProperty)(metaBorders[direction], 'hide') || metaBorders[direction].hide === false) { | |
| atLeastOneHasBorder = true; | |
| return false; // breaks forAll | |
| } | |
| } else { | |
| atLeastOneHasBorder = true; | |
| return false; // breaks forAll | |
| } | |
| } | |
| }); | |
| }); | |
| return atLeastOneHasBorder; | |
| } | |
| /** | |
| * Mark label in contextMenu as selected. | |
| * | |
| * @param {string} label The label text. | |
| * @returns {string} | |
| */ | |
| function markSelected(label) { | |
| return "<span class=\"selected\">".concat(String.fromCharCode(10003), "</span>").concat(label); // workaround for https://github.com/handsontable/handsontable/issues/1946 | |
| } | |
| /***/ }), | |
| /* 115 */ | |
| /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__.r(__webpack_exports__); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toNumber", function() { return toNumber; }); | |
| /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invertNumber", function() { return invertNumber; }); | |
| /** | |
| * Convert value into number. | |
| * | |
| * @param {String|Number} number | |
| * @returns {*} | |
| */ | |
| function toNumber(number) { | |
| var result; | |
| if (typeof number === 'number') { | |
| result = number; | |
| } else if (typeof number === 'string') { | |
| result = number.indexOf('.') > -1 ? parseFloat(number) : parseInt(number, 10); | |
| } | |
| return result; | |
| } | |
| /** | |
| * Invert provided number. | |
| * | |
| * @param {Number} number | |
| * @returns {Number} Returns inverted number. | |
| */ | |
| function invertNumber(number) { | |
| return -1 * toNumber(number); | |
| } | |
| /***/ }), | |
| /* 116 */ | |
| /***/ (function(module, exports) { | |
| module.exports = function (bitmap, value) { | |
| return { | |
| enumerable: !(bitmap & 1), | |
| configurable: !(bitmap & 2), | |
| writable: !(bitmap & 4), | |
| value: value | |
| }; | |
| }; | |
| /***/ }), | |
| /* 117 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var fails = __webpack_require__(32); | |
| var classof = __webpack_require__(94); | |
| var split = ''.split; | |
| // fallback for non-array-like ES3 and non-enumerable old V8 strings | |
| module.exports = fails(function () { | |
| // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 | |
| // eslint-disable-next-line no-prototype-builtins -- safe | |
| return !Object('z').propertyIsEnumerable(0); | |
| }) ? function (it) { | |
| return classof(it) == 'String' ? split.call(it, '') : Object(it); | |
| } : Object; | |
| /***/ }), | |
| /* 118 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var isObject = __webpack_require__(46); | |
| // `ToPrimitive` abstract operation | |
| // https://tc39.es/ecma262/#sec-toprimitive | |
| // instead of the ES6 spec version, we didn't implement @@toPrimitive case | |
| // and the second argument - flag - preferred type is a string | |
| module.exports = function (input, PREFERRED_STRING) { | |
| if (!isObject(input)) return input; | |
| var fn, val; | |
| if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | |
| if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; | |
| if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | |
| throw TypeError("Can't convert object to primitive value"); | |
| }; | |
| /***/ }), | |
| /* 119 */ | |
| /***/ (function(module, exports) { | |
| module.exports = {}; | |
| /***/ }), | |
| /* 120 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var internalObjectKeys = __webpack_require__(235); | |
| var enumBugKeys = __webpack_require__(176); | |
| var hiddenKeys = enumBugKeys.concat('length', 'prototype'); | |
| // `Object.getOwnPropertyNames` method | |
| // https://tc39.es/ecma262/#sec-object.getownpropertynames | |
| // eslint-disable-next-line es/no-object-getownpropertynames -- safe | |
| exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { | |
| return internalObjectKeys(O, hiddenKeys); | |
| }; | |
| /***/ }), | |
| /* 121 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var classof = __webpack_require__(94); | |
| // `IsArray` abstract operation | |
| // https://tc39.es/ecma262/#sec-isarray | |
| // eslint-disable-next-line es/no-array-isarray -- safe | |
| module.exports = Array.isArray || function isArray(arg) { | |
| return classof(arg) == 'Array'; | |
| }; | |
| /***/ }), | |
| /* 122 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var toPrimitive = __webpack_require__(118); | |
| var definePropertyModule = __webpack_require__(66); | |
| var createPropertyDescriptor = __webpack_require__(116); | |
| module.exports = function (object, key, value) { | |
| var propertyKey = toPrimitive(key); | |
| if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); | |
| else object[propertyKey] = value; | |
| }; | |
| /***/ }), | |
| /* 123 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var fails = __webpack_require__(32); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var V8_VERSION = __webpack_require__(153); | |
| var SPECIES = wellKnownSymbol('species'); | |
| module.exports = function (METHOD_NAME) { | |
| // We can't use this feature detection in V8 since it causes | |
| // deoptimization and serious performance degradation | |
| // https://github.com/zloirock/core-js/issues/677 | |
| return V8_VERSION >= 51 || !fails(function () { | |
| var array = []; | |
| var constructor = array.constructor = {}; | |
| constructor[SPECIES] = function () { | |
| return { foo: 1 }; | |
| }; | |
| return array[METHOD_NAME](Boolean).foo !== 1; | |
| }); | |
| }; | |
| /***/ }), | |
| /* 124 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var internalObjectKeys = __webpack_require__(235); | |
| var enumBugKeys = __webpack_require__(176); | |
| // `Object.keys` method | |
| // https://tc39.es/ecma262/#sec-object.keys | |
| // eslint-disable-next-line es/no-object-keys -- safe | |
| module.exports = Object.keys || function keys(O) { | |
| return internalObjectKeys(O, enumBugKeys); | |
| }; | |
| /***/ }), | |
| /* 125 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var aFunction = __webpack_require__(107); | |
| // optional / simple context binding | |
| module.exports = function (fn, that, length) { | |
| aFunction(fn); | |
| if (that === undefined) return fn; | |
| switch (length) { | |
| case 0: return function () { | |
| return fn.call(that); | |
| }; | |
| case 1: return function (a) { | |
| return fn.call(that, a); | |
| }; | |
| case 2: return function (a, b) { | |
| return fn.call(that, a, b); | |
| }; | |
| case 3: return function (a, b, c) { | |
| return fn.call(that, a, b, c); | |
| }; | |
| } | |
| return function (/* ...args */) { | |
| return fn.apply(that, arguments); | |
| }; | |
| }; | |
| /***/ }), | |
| /* 126 */ | |
| /***/ (function(module, exports) { | |
| module.exports = {}; | |
| /***/ }), | |
| /* 127 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var create = __webpack_require__(109); | |
| var definePropertyModule = __webpack_require__(66); | |
| var UNSCOPABLES = wellKnownSymbol('unscopables'); | |
| var ArrayPrototype = Array.prototype; | |
| // Array.prototype[@@unscopables] | |
| // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables | |
| if (ArrayPrototype[UNSCOPABLES] == undefined) { | |
| definePropertyModule.f(ArrayPrototype, UNSCOPABLES, { | |
| configurable: true, | |
| value: create(null) | |
| }); | |
| } | |
| // add a key to Array.prototype[@@unscopables] | |
| module.exports = function (key) { | |
| ArrayPrototype[UNSCOPABLES][key] = true; | |
| }; | |
| /***/ }), | |
| /* 128 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var global = __webpack_require__(40); | |
| var isForced = __webpack_require__(152); | |
| var inheritIfRequired = __webpack_require__(181); | |
| var defineProperty = __webpack_require__(66).f; | |
| var getOwnPropertyNames = __webpack_require__(120).f; | |
| var isRegExp = __webpack_require__(194); | |
| var getFlags = __webpack_require__(183); | |
| var stickyHelpers = __webpack_require__(184); | |
| var redefine = __webpack_require__(83); | |
| var fails = __webpack_require__(32); | |
| var enforceInternalState = __webpack_require__(95).enforce; | |
| var setSpecies = __webpack_require__(255); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var MATCH = wellKnownSymbol('match'); | |
| var NativeRegExp = global.RegExp; | |
| var RegExpPrototype = NativeRegExp.prototype; | |
| var re1 = /a/g; | |
| var re2 = /a/g; | |
| // "new" should create a new object, old webkit bug | |
| var CORRECT_NEW = new NativeRegExp(re1) !== re1; | |
| var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; | |
| var FORCED = DESCRIPTORS && isForced('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () { | |
| re2[MATCH] = false; | |
| // RegExp constructor can alter flags and IsRegExp works correct with @@match | |
| return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; | |
| }))); | |
| // `RegExp` constructor | |
| // https://tc39.es/ecma262/#sec-regexp-constructor | |
| if (FORCED) { | |
| var RegExpWrapper = function RegExp(pattern, flags) { | |
| var thisIsRegExp = this instanceof RegExpWrapper; | |
| var patternIsRegExp = isRegExp(pattern); | |
| var flagsAreUndefined = flags === undefined; | |
| var sticky; | |
| if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) { | |
| return pattern; | |
| } | |
| if (CORRECT_NEW) { | |
| if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source; | |
| } else if (pattern instanceof RegExpWrapper) { | |
| if (flagsAreUndefined) flags = getFlags.call(pattern); | |
| pattern = pattern.source; | |
| } | |
| if (UNSUPPORTED_Y) { | |
| sticky = !!flags && flags.indexOf('y') > -1; | |
| if (sticky) flags = flags.replace(/y/g, ''); | |
| } | |
| var result = inheritIfRequired( | |
| CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags), | |
| thisIsRegExp ? this : RegExpPrototype, | |
| RegExpWrapper | |
| ); | |
| if (UNSUPPORTED_Y && sticky) { | |
| var state = enforceInternalState(result); | |
| state.sticky = true; | |
| } | |
| return result; | |
| }; | |
| var proxy = function (key) { | |
| key in RegExpWrapper || defineProperty(RegExpWrapper, key, { | |
| configurable: true, | |
| get: function () { return NativeRegExp[key]; }, | |
| set: function (it) { NativeRegExp[key] = it; } | |
| }); | |
| }; | |
| var keys = getOwnPropertyNames(NativeRegExp); | |
| var index = 0; | |
| while (keys.length > index) proxy(keys[index++]); | |
| RegExpPrototype.constructor = RegExpWrapper; | |
| RegExpWrapper.prototype = RegExpPrototype; | |
| redefine(global, 'RegExp', RegExpWrapper); | |
| } | |
| // https://tc39.es/ecma262/#sec-get-regexp-@@species | |
| setSpecies('RegExp'); | |
| /***/ }), | |
| /* 129 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var $trim = __webpack_require__(241).trim; | |
| var forcedStringTrimMethod = __webpack_require__(495); | |
| // `String.prototype.trim` method | |
| // https://tc39.es/ecma262/#sec-string.prototype.trim | |
| $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { | |
| trim: function trim() { | |
| return $trim(this); | |
| } | |
| }); | |
| /***/ }), | |
| /* 130 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var hiddenKeys = __webpack_require__(119); | |
| var isObject = __webpack_require__(46); | |
| var has = __webpack_require__(65); | |
| var defineProperty = __webpack_require__(66).f; | |
| var uid = __webpack_require__(150); | |
| var FREEZING = __webpack_require__(256); | |
| var METADATA = uid('meta'); | |
| var id = 0; | |
| // eslint-disable-next-line es/no-object-isextensible -- safe | |
| var isExtensible = Object.isExtensible || function () { | |
| return true; | |
| }; | |
| var setMetadata = function (it) { | |
| defineProperty(it, METADATA, { value: { | |
| objectID: 'O' + ++id, // object ID | |
| weakData: {} // weak collections IDs | |
| } }); | |
| }; | |
| var fastKey = function (it, create) { | |
| // return a primitive with prefix | |
| if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; | |
| if (!has(it, METADATA)) { | |
| // can't set metadata to uncaught frozen object | |
| if (!isExtensible(it)) return 'F'; | |
| // not necessary to add metadata | |
| if (!create) return 'E'; | |
| // add missing metadata | |
| setMetadata(it); | |
| // return object ID | |
| } return it[METADATA].objectID; | |
| }; | |
| var getWeakData = function (it, create) { | |
| if (!has(it, METADATA)) { | |
| // can't set metadata to uncaught frozen object | |
| if (!isExtensible(it)) return true; | |
| // not necessary to add metadata | |
| if (!create) return false; | |
| // add missing metadata | |
| setMetadata(it); | |
| // return the store of weak collections IDs | |
| } return it[METADATA].weakData; | |
| }; | |
| // add metadata on freeze-family methods calling | |
| var onFreeze = function (it) { | |
| if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); | |
| return it; | |
| }; | |
| var meta = module.exports = { | |
| REQUIRED: false, | |
| fastKey: fastKey, | |
| getWeakData: getWeakData, | |
| onFreeze: onFreeze | |
| }; | |
| hiddenKeys[METADATA] = true; | |
| /***/ }), | |
| /* 131 */ | |
| /***/ (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)); | |
| /** | |
| * CellCoords holds cell coordinates (row, column) and few method to validate them and retrieve as an array or an object. | |
| * | |
| * @util | |
| */ | |
| var CellCoords = /*#__PURE__*/function () { | |
| function CellCoords(row, column) { | |
| (0, _classCallCheck2.default)(this, CellCoords); | |
| /** | |
| * Row index. | |
| * | |
| * @type {number} | |
| */ | |
| this.row = null; | |
| /** | |
| * Column index. | |
| * | |
| * @type {number} | |
| */ | |
| this.col = null; | |
| if (typeof row !== 'undefined' && typeof column !== 'undefined') { | |
| this.row = row; | |
| this.col = column; | |
| } | |
| } | |
| /** | |
| * Checks if given set of coordinates is valid in context of a given Walkontable instance. | |
| * | |
| * @param {Walkontable} wot A Walkontable instance. | |
| * @returns {boolean} | |
| */ | |
| (0, _createClass2.default)(CellCoords, [{ | |
| key: "isValid", | |
| value: function isValid(wot) { | |
| // is it a valid cell index (0 or higher) | |
| if (this.row < 0 || this.col < 0) { | |
| return false; | |
| } // is selection within total rows and columns | |
| if (this.row >= wot.getSetting('totalRows') || this.col >= wot.getSetting('totalColumns')) { | |
| return false; | |
| } | |
| return true; | |
| } | |
| /** | |
| * Checks if this cell coordinates are the same as cell coordinates given as an argument. | |
| * | |
| * @param {CellCoords} cellCoords Cell coordinates to equal. | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isEqual", | |
| value: function isEqual(cellCoords) { | |
| if (cellCoords === this) { | |
| return true; | |
| } | |
| return this.row === cellCoords.row && this.col === cellCoords.col; | |
| } | |
| /** | |
| * Checks if tested coordinates are positioned in south-east from this cell coordinates. | |
| * | |
| * @param {object} testedCoords Cell coordinates to check. | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isSouthEastOf", | |
| value: function isSouthEastOf(testedCoords) { | |
| return this.row >= testedCoords.row && this.col >= testedCoords.col; | |
| } | |
| /** | |
| * Checks if tested coordinates are positioned in north-east from this cell coordinates. | |
| * | |
| * @param {object} testedCoords Cell coordinates to check. | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isNorthWestOf", | |
| value: function isNorthWestOf(testedCoords) { | |
| return this.row <= testedCoords.row && this.col <= testedCoords.col; | |
| } | |
| /** | |
| * Checks if tested coordinates are positioned in south-west from this cell coordinates. | |
| * | |
| * @param {object} testedCoords Cell coordinates to check. | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isSouthWestOf", | |
| value: function isSouthWestOf(testedCoords) { | |
| return this.row >= testedCoords.row && this.col <= testedCoords.col; | |
| } | |
| /** | |
| * Checks if tested coordinates are positioned in north-east from this cell coordinates. | |
| * | |
| * @param {object} testedCoords Cell coordinates to check. | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isNorthEastOf", | |
| value: function isNorthEastOf(testedCoords) { | |
| return this.row <= testedCoords.row && this.col >= testedCoords.col; | |
| } | |
| /** | |
| * Normalizes the coordinates to the nearest valid position. The coordinates that point | |
| * to the headers (negative values) are normalized to 0. | |
| * | |
| * @returns {CellCoords} | |
| */ | |
| }, { | |
| key: "normalize", | |
| value: function normalize() { | |
| this.row = this.row === null ? this.row : Math.max(this.row, 0); | |
| this.col = this.col === null ? this.col : Math.max(this.col, 0); | |
| return this; | |
| } | |
| /** | |
| * Clones the coordinates. | |
| * | |
| * @returns {CellCoords} | |
| */ | |
| }, { | |
| key: "clone", | |
| value: function clone() { | |
| return new CellCoords(this.row, this.col); | |
| } | |
| /** | |
| * Converts CellCoords to literal object with `row` and `col` properties. | |
| * | |
| * @returns {object} Returns a literal object with `row` and `col` properties. | |
| */ | |
| }, { | |
| key: "toObject", | |
| value: function toObject() { | |
| return { | |
| row: this.row, | |
| col: this.col | |
| }; | |
| } | |
| }]); | |
| return CellCoords; | |
| }(); | |
| var _default = CellCoords; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 132 */ | |
| /***/ (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 _nodesPool = _interopRequireDefault(__webpack_require__(508)); | |
| /** | |
| * Base renderer class, abstract logic for specialized renderers. | |
| * | |
| * @class BaseRenderer | |
| */ | |
| var BaseRenderer = /*#__PURE__*/function () { | |
| function BaseRenderer(nodeType, rootNode) { | |
| (0, _classCallCheck2.default)(this, BaseRenderer); | |
| /** | |
| * Factory for newly created DOM elements. | |
| * | |
| * NodePool should be used for each renderer. For the first stage of the refactoring | |
| * process, only some of the renderers are implemented a new approach. | |
| * | |
| * @type {NodesPool|null} | |
| */ | |
| this.nodesPool = typeof nodeType === 'string' ? new _nodesPool.default(nodeType) : null; | |
| /** | |
| * Node type which the renderer will manage while building the table (eg. 'TD', 'TR', 'TH'). | |
| * | |
| * @type {string} | |
| */ | |
| this.nodeType = nodeType; | |
| /** | |
| * The root node to which newly created elements will be inserted. | |
| * | |
| * @type {HTMLElement} | |
| */ | |
| this.rootNode = rootNode; | |
| /** | |
| * The instance of the Table class, a wrapper for all renderers and holder for properties describe table state. | |
| * | |
| * @type {TableRenderer} | |
| */ | |
| this.table = null; | |
| /** | |
| * Counter of nodes already added. | |
| * | |
| * @type {number} | |
| */ | |
| this.renderedNodes = 0; | |
| } | |
| /** | |
| * Sets the table renderer instance to the current renderer. | |
| * | |
| * @param {TableRenderer} table The TableRenderer instance. | |
| */ | |
| (0, _createClass2.default)(BaseRenderer, [{ | |
| key: "setTable", | |
| value: function setTable(table) { | |
| if (this.nodesPool) { | |
| this.nodesPool.setRootDocument(table.rootDocument); | |
| } | |
| this.table = table; | |
| } | |
| /** | |
| * Adjusts the number of rendered nodes. | |
| */ | |
| }, { | |
| key: "adjust", | |
| value: function adjust() {} | |
| /** | |
| * Renders the contents to the elements. | |
| */ | |
| }, { | |
| key: "render", | |
| value: function render() {} | |
| }]); | |
| return BaseRenderer; | |
| }(); | |
| exports.default = BaseRenderer; | |
| /***/ }), | |
| /* 133 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| 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; | |
| __webpack_require__(12); | |
| __webpack_require__(9); | |
| __webpack_require__(11); | |
| __webpack_require__(22); | |
| __webpack_require__(13); | |
| var _pluginHooks = _interopRequireDefault(__webpack_require__(48)); | |
| var _staticRegister2 = _interopRequireDefault(__webpack_require__(98)); | |
| /** | |
| * 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; | |
| /** | |
| * @param {BaseEditor} editorClass The editor constructor. | |
| */ | |
| exports.getRegisteredEditors = getValues; | |
| exports.getRegisteredEditorNames = getNames; | |
| exports.hasEditor = hasItem; | |
| 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) { | |
| if (name && typeof name !== 'string') { | |
| editorClass = name; | |
| name = editorClass.EDITOR_TYPE; | |
| } | |
| var editorWrapper = new RegisteredEditor(editorClass); | |
| if (typeof name === 'string') { | |
| register(name, editorWrapper); | |
| } | |
| registeredEditorClasses.set(editorClass, editorWrapper); | |
| } | |
| /***/ }), | |
| /* 134 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.BaseEditor = exports.EDITOR_TYPE = exports.EDITOR_STATE = void 0; | |
| var _baseEditor = __webpack_require__(531); | |
| exports.EDITOR_STATE = _baseEditor.EDITOR_STATE; | |
| exports.EDITOR_TYPE = _baseEditor.EDITOR_TYPE; | |
| exports.BaseEditor = _baseEditor.BaseEditor; | |
| /***/ }), | |
| /* 135 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var fixRegExpWellKnownSymbolLogic = __webpack_require__(155); | |
| var anObject = __webpack_require__(47); | |
| var toLength = __webpack_require__(58); | |
| var requireObjectCoercible = __webpack_require__(67); | |
| var advanceStringIndex = __webpack_require__(185); | |
| var regExpExec = __webpack_require__(156); | |
| // @@match logic | |
| fixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) { | |
| return [ | |
| // `String.prototype.match` method | |
| // https://tc39.es/ecma262/#sec-string.prototype.match | |
| function match(regexp) { | |
| var O = requireObjectCoercible(this); | |
| var matcher = regexp == undefined ? undefined : regexp[MATCH]; | |
| return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); | |
| }, | |
| // `RegExp.prototype[@@match]` method | |
| // https://tc39.es/ecma262/#sec-regexp.prototype-@@match | |
| function (regexp) { | |
| var res = maybeCallNative(nativeMatch, regexp, this); | |
| if (res.done) return res.value; | |
| var rx = anObject(regexp); | |
| var S = String(this); | |
| if (!rx.global) return regExpExec(rx, S); | |
| var fullUnicode = rx.unicode; | |
| rx.lastIndex = 0; | |
| var A = []; | |
| var n = 0; | |
| var result; | |
| while ((result = regExpExec(rx, S)) !== null) { | |
| var matchStr = String(result[0]); | |
| A[n] = matchStr; | |
| if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); | |
| n++; | |
| } | |
| return n === 0 ? null : A; | |
| } | |
| ]; | |
| }); | |
| /***/ }), | |
| /* 136 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.spreadsheetColumnLabel = spreadsheetColumnLabel; | |
| exports.spreadsheetColumnIndex = spreadsheetColumnIndex; | |
| exports.createSpreadsheetData = createSpreadsheetData; | |
| exports.createSpreadsheetObjectData = createSpreadsheetObjectData; | |
| exports.createEmptySpreadsheetData = createEmptySpreadsheetData; | |
| exports.translateRowsToColumns = translateRowsToColumns; | |
| exports.cellMethodLookupFactory = cellMethodLookupFactory; | |
| exports.dataRowToChangesArray = dataRowToChangesArray; | |
| exports.countFirstRowKeys = countFirstRowKeys; | |
| __webpack_require__(192); | |
| __webpack_require__(23); | |
| __webpack_require__(35); | |
| var _registry = __webpack_require__(137); | |
| var _object = __webpack_require__(5); | |
| var COLUMN_LABEL_BASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| var COLUMN_LABEL_BASE_LENGTH = COLUMN_LABEL_BASE.length; | |
| /** | |
| * Generates spreadsheet-like column names: A, B, C, ..., Z, AA, AB, etc. | |
| * | |
| * @param {number} index Column index. | |
| * @returns {string} | |
| */ | |
| function spreadsheetColumnLabel(index) { | |
| var dividend = index + 1; | |
| var columnLabel = ''; | |
| var modulo; | |
| while (dividend > 0) { | |
| modulo = (dividend - 1) % COLUMN_LABEL_BASE_LENGTH; | |
| columnLabel = String.fromCharCode(65 + modulo) + columnLabel; | |
| dividend = parseInt((dividend - modulo) / COLUMN_LABEL_BASE_LENGTH, 10); | |
| } | |
| return columnLabel; | |
| } | |
| /** | |
| * Generates spreadsheet-like column index from theirs labels: A, B, C ...., Z, AA, AB, etc. | |
| * | |
| * @param {string} label Column label. | |
| * @returns {number} | |
| */ | |
| function spreadsheetColumnIndex(label) { | |
| var result = 0; | |
| if (label) { | |
| for (var i = 0, j = label.length - 1; i < label.length; i += 1, j -= 1) { | |
| result += Math.pow(COLUMN_LABEL_BASE_LENGTH, j) * (COLUMN_LABEL_BASE.indexOf(label[i]) + 1); | |
| } | |
| } | |
| result -= 1; | |
| return result; | |
| } | |
| /** | |
| * Creates 2D array of Excel-like values "A1", "A2", ... | |
| * | |
| * @param {number} rows Number of rows to generate. | |
| * @param {number} columns Number of columns to generate. | |
| * @returns {Array} | |
| */ | |
| function createSpreadsheetData() { | |
| var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100; | |
| var columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; | |
| var _rows = []; | |
| var i; | |
| var j; | |
| for (i = 0; i < rows; i++) { | |
| var row = []; | |
| for (j = 0; j < columns; j++) { | |
| row.push(spreadsheetColumnLabel(j) + (i + 1)); | |
| } | |
| _rows.push(row); | |
| } | |
| return _rows; | |
| } | |
| /** | |
| * Creates 2D array of Excel-like values "A1", "A2", as an array of objects. | |
| * | |
| * @param {number} rows Number of rows to generate. | |
| * @param {number} colCount Number of columns to generate. | |
| * @returns {Array} | |
| */ | |
| function createSpreadsheetObjectData() { | |
| var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100; | |
| var colCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; | |
| var _rows = []; | |
| var i; | |
| var j; | |
| for (i = 0; i < rows; i++) { | |
| var row = {}; | |
| for (j = 0; j < colCount; j++) { | |
| row["prop".concat(j)] = spreadsheetColumnLabel(j) + (i + 1); | |
| } | |
| _rows.push(row); | |
| } | |
| return _rows; | |
| } | |
| /** | |
| * Generates an empty data object. | |
| * | |
| * @param {number} rows Number of rows to generate. | |
| * @param {number} columns Number of columns to generate. | |
| * @returns {Array} | |
| */ | |
| function createEmptySpreadsheetData(rows, columns) { | |
| var data = []; | |
| var row; | |
| for (var i = 0; i < rows; i++) { | |
| row = []; | |
| for (var j = 0; j < columns; j++) { | |
| row.push(''); | |
| } | |
| data.push(row); | |
| } | |
| return data; | |
| } | |
| /** | |
| * @param {Array} input The data to translate. | |
| * @returns {Array} | |
| */ | |
| function translateRowsToColumns(input) { | |
| var output = []; | |
| var i; | |
| var ilen; | |
| var j; | |
| var jlen; | |
| var olen = 0; | |
| for (i = 0, ilen = input.length; i < ilen; i++) { | |
| for (j = 0, jlen = input[i].length; j < jlen; j++) { | |
| if (j === olen) { | |
| output.push([]); | |
| olen += 1; | |
| } | |
| output[j].push(input[i][j]); | |
| } | |
| } | |
| return output; | |
| } | |
| /** | |
| * Factory that produces a function for searching methods (or any properties) which could be defined directly in | |
| * table configuration or implicitly, within cell type definition. | |
| * | |
| * For example: renderer can be defined explicitly using "renderer" property in column configuration or it can be | |
| * defined implicitly using "type" property. | |
| * | |
| * Methods/properties defined explicitly always takes precedence over those defined through "type". | |
| * | |
| * If the method/property is not found in an object, searching is continued recursively through prototype chain, until | |
| * it reaches the Object.prototype. | |
| * | |
| * | |
| * @param {string} methodName Name of the method/property to search (i.e. 'renderer', 'validator', 'copyable'). | |
| * @param {boolean} [allowUndefined] If `false`, the search is continued if methodName has not been found in cell "type". | |
| * @returns {Function} | |
| */ | |
| function cellMethodLookupFactory(methodName, allowUndefined) { | |
| var isUndefinedAllowed = typeof allowUndefined === 'undefined' ? true : allowUndefined; | |
| return function cellMethodLookup(row, col) { | |
| return function getMethodFromProperties(properties) { | |
| if (!properties) { | |
| return; // method or property not found | |
| } | |
| if ((0, _object.hasOwnProperty)(properties, methodName) && properties[methodName] !== void 0) { | |
| // check if it is own and is not empty | |
| return properties[methodName]; // method defined directly | |
| } else if ((0, _object.hasOwnProperty)(properties, 'type') && properties.type) { | |
| // check if it is own and is not empty | |
| if (typeof properties.type !== 'string') { | |
| throw new Error('Cell "type" must be a string'); | |
| } | |
| var type = (0, _registry.getCellType)(properties.type); | |
| if ((0, _object.hasOwnProperty)(type, methodName)) { | |
| return type[methodName]; // method defined in type. | |
| } else if (isUndefinedAllowed) { | |
| return; // method does not defined in type (eg. validator), returns undefined | |
| } | |
| } | |
| return getMethodFromProperties(Object.getPrototypeOf(properties)); | |
| }(typeof row === 'number' ? this.getCellMeta(row, col) : row); | |
| }; | |
| } | |
| /** | |
| * Transform a data row (either an array or an object) or an array of data rows to array of changes in a form of `[row, prop/col, value]`. | |
| * Convenient to use with `setDataAtRowProp` and `setSourceDataAtCell` methods. | |
| * | |
| * @param {Array|object} dataRow Object of row data, array of row data or an array of either. | |
| * @param {number} rowOffset Row offset to be passed to the resulting change list. Defaults to `0`. | |
| * @returns {Array} Array of changes (in a form of an array). | |
| */ | |
| function dataRowToChangesArray(dataRow) { | |
| var rowOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | |
| var dataRows = dataRow; | |
| var changesArray = []; | |
| if (!Array.isArray(dataRow) || !Array.isArray(dataRow[0])) { | |
| dataRows = [dataRow]; | |
| } | |
| dataRows.forEach(function (row, rowIndex) { | |
| if (Array.isArray(row)) { | |
| row.forEach(function (value, column) { | |
| changesArray.push([rowIndex + rowOffset, column, value]); | |
| }); | |
| } else { | |
| Object.keys(row).forEach(function (propName) { | |
| changesArray.push([rowIndex + rowOffset, propName, row[propName]]); | |
| }); | |
| } | |
| }); | |
| return changesArray; | |
| } | |
| /** | |
| * Count the number of keys (or, basically, columns when the data is an array or arrays) in the first row of the provided dataset. | |
| * | |
| * @param {Array} data The dataset. | |
| * @returns {number} Number of keys in the first row of the dataset. | |
| */ | |
| function countFirstRowKeys(data) { | |
| var result = 0; | |
| if (Array.isArray(data)) { | |
| if (data[0] && Array.isArray(data[0])) { | |
| result = data[0].length; | |
| } else if (data[0] && (0, _object.isObject)(data[0])) { | |
| result = (0, _object.deepObjectSize)(data[0]); | |
| } | |
| } | |
| return result; | |
| } | |
| /***/ }), | |
| /* 137 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.registerCellType = _register; | |
| exports.getCellType = _getItem; | |
| exports.getRegisteredCellTypes = exports.getRegisteredCellTypeNames = exports.hasCellType = void 0; | |
| var _staticRegister2 = _interopRequireDefault(__webpack_require__(98)); | |
| var _registry = __webpack_require__(133); | |
| var _registry2 = __webpack_require__(161); | |
| var _registry3 = __webpack_require__(162); | |
| var _staticRegister = (0, _staticRegister2.default)('cellTypes'), | |
| register = _staticRegister.register, | |
| getItem = _staticRegister.getItem, | |
| hasItem = _staticRegister.hasItem, | |
| getNames = _staticRegister.getNames, | |
| getValues = _staticRegister.getValues; | |
| /** | |
| * Retrieve cell type object. | |
| * | |
| * @param {string} name Cell type identification. | |
| * @returns {object} Returns cell type object. | |
| */ | |
| exports.getRegisteredCellTypes = getValues; | |
| exports.getRegisteredCellTypeNames = getNames; | |
| exports.hasCellType = hasItem; | |
| function _getItem(name) { | |
| if (!hasItem(name)) { | |
| throw Error("You declared cell type \"".concat(name, "\" as a string that is not mapped to a known object.\n Cell type must be an object or a string mapped to an object registered by\n \"Handsontable.cellTypes.registerCellType\" method")); | |
| } | |
| return getItem(name); | |
| } | |
| /** | |
| * Register cell type under specified name. | |
| * | |
| * @param {string} name Cell type identification. | |
| * @param {object} type An object with contains keys (eq: `editor`, `renderer`, `validator`) which describes specified behaviour of the cell. | |
| */ | |
| function _register(name, type) { | |
| if (typeof name !== 'string') { | |
| type = name; | |
| name = type.CELL_TYPE; | |
| } | |
| var _type = type, | |
| editor = _type.editor, | |
| renderer = _type.renderer, | |
| validator = _type.validator; | |
| if (editor) { | |
| (0, _registry.registerEditor)(name, editor); | |
| } | |
| if (renderer) { | |
| (0, _registry2.registerRenderer)(name, renderer); | |
| } | |
| if (validator) { | |
| (0, _registry3.registerValidator)(name, validator); | |
| } | |
| register(name, type); | |
| } | |
| /***/ }), | |
| /* 138 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| // `Symbol.prototype.description` getter | |
| // https://tc39.es/ecma262/#sec-symbol.prototype.description | |
| var $ = __webpack_require__(21); | |
| var DESCRIPTORS = __webpack_require__(57); | |
| var global = __webpack_require__(40); | |
| var has = __webpack_require__(65); | |
| var isObject = __webpack_require__(46); | |
| var defineProperty = __webpack_require__(66).f; | |
| var copyConstructorProperties = __webpack_require__(232); | |
| var NativeSymbol = global.Symbol; | |
| if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) || | |
| // Safari 12 bug | |
| NativeSymbol().description !== undefined | |
| )) { | |
| var EmptyStringDescriptionStore = {}; | |
| // wrap Symbol constructor for correct work with undefined description | |
| var SymbolWrapper = function Symbol() { | |
| var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]); | |
| var result = this instanceof SymbolWrapper | |
| ? new NativeSymbol(description) | |
| // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)' | |
| : description === undefined ? NativeSymbol() : NativeSymbol(description); | |
| if (description === '') EmptyStringDescriptionStore[result] = true; | |
| return result; | |
| }; | |
| copyConstructorProperties(SymbolWrapper, NativeSymbol); | |
| var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype; | |
| symbolPrototype.constructor = SymbolWrapper; | |
| var symbolToString = symbolPrototype.toString; | |
| var native = String(NativeSymbol('test')) == 'Symbol(test)'; | |
| var regexp = /^Symbol\((.*)\)[^)]+$/; | |
| defineProperty(symbolPrototype, 'description', { | |
| configurable: true, | |
| get: function description() { | |
| var symbol = isObject(this) ? this.valueOf() : this; | |
| var string = symbolToString.call(symbol); | |
| if (has(EmptyStringDescriptionStore, symbol)) return ''; | |
| var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1'); | |
| return desc === '' ? undefined : desc; | |
| } | |
| }); | |
| $({ global: true, forced: true }, { | |
| Symbol: SymbolWrapper | |
| }); | |
| } | |
| /***/ }), | |
| /* 139 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var getOwnPropertyDescriptor = __webpack_require__(93).f; | |
| var toLength = __webpack_require__(58); | |
| var notARegExp = __webpack_require__(193); | |
| var requireObjectCoercible = __webpack_require__(67); | |
| var correctIsRegExpLogic = __webpack_require__(195); | |
| var IS_PURE = __webpack_require__(105); | |
| // eslint-disable-next-line es/no-string-prototype-startswith -- safe | |
| var $startsWith = ''.startsWith; | |
| var min = Math.min; | |
| var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith'); | |
| // https://github.com/zloirock/core-js/pull/702 | |
| var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () { | |
| var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith'); | |
| return descriptor && !descriptor.writable; | |
| }(); | |
| // `String.prototype.startsWith` method | |
| // https://tc39.es/ecma262/#sec-string.prototype.startswith | |
| $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { | |
| startsWith: function startsWith(searchString /* , position = 0 */) { | |
| var that = String(requireObjectCoercible(this)); | |
| notARegExp(searchString); | |
| var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length)); | |
| var search = String(searchString); | |
| return $startsWith | |
| ? $startsWith.call(that, search, index) | |
| : that.slice(index, index + search.length) === search; | |
| } | |
| }); | |
| /***/ }), | |
| /* 140 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.expandMetaType = expandMetaType; | |
| exports.columnFactory = columnFactory; | |
| exports.isUnsignedNumber = isUnsignedNumber; | |
| exports.assert = assert; | |
| exports.isNullish = isNullish; | |
| __webpack_require__(59); | |
| __webpack_require__(60); | |
| var _object = __webpack_require__(5); | |
| var _registry = __webpack_require__(137); | |
| /** | |
| * Expands "type" property of the meta object to single values. For example `type: 'numeric'` sets | |
| * "renderer", "editor", "validator" properties to specific functions designed for numeric values. | |
| * If "type" is passed as an object that object will be returned, excluding properties that | |
| * already exist in the "metaObject" if passed. | |
| * | |
| * @param {object|string} type Type to expand;. | |
| * @param {object|undefined} [metaObject] Source meta object. | |
| * @returns {object|undefined} | |
| */ | |
| function expandMetaType(type, metaObject) { | |
| var validType = typeof type === 'string' ? (0, _registry.getCellType)(type) : type; | |
| if (!(0, _object.isObject)(validType)) { | |
| return; | |
| } | |
| var preventSourceOverwrite = (0, _object.isObject)(metaObject); | |
| var expandedType = {}; | |
| (0, _object.objectEach)(validType, function (value, property) { | |
| if (property !== 'CELL_TYPE' && (!preventSourceOverwrite || preventSourceOverwrite && !(0, _object.hasOwnProperty)(metaObject, property))) { | |
| expandedType[property] = value; | |
| } | |
| }); | |
| return expandedType; | |
| } | |
| /** | |
| * Creates new class which extends properties from TableMeta layer class. | |
| * | |
| * @param {TableMeta} TableMeta The TableMeta which the new ColumnMeta is created from. | |
| * @param {string[]} [conflictList] List of the properties which are conflicted with the column meta layer. | |
| * Conflicted properties are overwritten by `undefined` value, to separate them | |
| * from the TableMeta layer. | |
| * @returns {ColumnMeta} Returns constructor ready to initialize with `new` operator. | |
| */ | |
| function columnFactory(TableMeta) { | |
| var conflictList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | |
| // Do not use ES6 "class extends" syntax here. It seems that the babel produces code | |
| // which drastically decreases the performance of the ColumnMeta class creation. | |
| /** | |
| * Base "class" for column meta. | |
| */ | |
| function ColumnMeta() {} | |
| (0, _object.inherit)(ColumnMeta, TableMeta); // Clear conflict settings | |
| for (var i = 0; i < conflictList.length; i++) { | |
| ColumnMeta.prototype[conflictList[i]] = void 0; | |
| } | |
| return ColumnMeta; | |
| } | |
| /** | |
| * Helper which checks if the provided argument is an unsigned number. | |
| * | |
| * @param {*} value Value to check. | |
| * @returns {boolean} | |
| */ | |
| function isUnsignedNumber(value) { | |
| return Number.isInteger(value) && value >= 0; | |
| } | |
| /** | |
| * Function which makes assertion by custom condition. Function throws an error when assertion doesn't meet the spec. | |
| * | |
| * @param {Function} condition Function with custom logic. The condition has to return boolean values. | |
| * @param {string} errorMessage String which describes assertion error. | |
| */ | |
| function assert(condition, errorMessage) { | |
| if (!condition()) { | |
| throw new Error("Assertion failed: ".concat(errorMessage)); | |
| } | |
| } | |
| /** | |
| * Check if given variable is null or undefined. | |
| * | |
| * @param {*} variable Variable to check. | |
| * @returns {boolean} | |
| */ | |
| function isNullish(variable) { | |
| return variable === null || variable === void 0; | |
| } | |
| /***/ }), | |
| /* 141 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.autocompleteRenderer = exports.RENDERER_TYPE = void 0; | |
| var _autocompleteRenderer = __webpack_require__(597); | |
| exports.RENDERER_TYPE = _autocompleteRenderer.RENDERER_TYPE; | |
| exports.autocompleteRenderer = _autocompleteRenderer.autocompleteRenderer; | |
| /***/ }), | |
| /* 142 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.sortComparison = sortComparison; | |
| exports.toVisualValue = toVisualValue; | |
| exports.createArrayAssertion = createArrayAssertion; | |
| exports.toEmptyString = toEmptyString; | |
| exports.unifyColumnValues = unifyColumnValues; | |
| exports.intersectValues = intersectValues; | |
| __webpack_require__(12); | |
| __webpack_require__(9); | |
| __webpack_require__(62); | |
| __webpack_require__(11); | |
| __webpack_require__(13); | |
| __webpack_require__(43); | |
| __webpack_require__(17); | |
| __webpack_require__(81); | |
| var _feature = __webpack_require__(97); | |
| var _array = __webpack_require__(3); | |
| var sortCompare = (0, _feature.getComparisonFunction)(); | |
| /** | |
| * Comparison function for sorting purposes. | |
| * | |
| * @param {*} a The first value to compare. | |
| * @param {*} b The second value to compare. | |
| * @returns {number} Returns number from -1 to 1. | |
| */ | |
| function sortComparison(a, b) { | |
| if (typeof a === 'number' && typeof b === 'number') { | |
| return a - b; | |
| } | |
| return sortCompare(a, b); | |
| } | |
| /** | |
| * Convert raw value into visual value. | |
| * | |
| * @param {*} value The value to convert. | |
| * @param {string} defaultEmptyValue Default value for empty cells. | |
| * @returns {*} | |
| */ | |
| function toVisualValue(value, defaultEmptyValue) { | |
| var visualValue = value; | |
| if (visualValue === '') { | |
| visualValue = "(".concat(defaultEmptyValue, ")"); | |
| } | |
| return visualValue; | |
| } | |
| var SUPPORT_SET_CONSTRUCTOR = new Set([1]).has(1); | |
| var SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'function'; | |
| /** | |
| * Create an array assertion to compare if an element exists in that array (in a more efficient way than .indexOf). | |
| * | |
| * @param {Array} initialData Values to compare. | |
| * @returns {Function} | |
| */ | |
| function createArrayAssertion(initialData) { | |
| var dataset = initialData; | |
| if (SUPPORT_SET_CONSTRUCTOR) { | |
| dataset = new Set(dataset); | |
| } | |
| return function (value) { | |
| var result; | |
| if (SUPPORT_SET_CONSTRUCTOR) { | |
| result = dataset.has(value); | |
| } else { | |
| /* eslint-disable no-bitwise */ | |
| result = !!~dataset.indexOf(value); | |
| } | |
| return result; | |
| }; | |
| } | |
| /** | |
| * Convert empty-ish values like null and undefined to an empty string. | |
| * | |
| * @param {*} value Value to check. | |
| * @returns {string} | |
| */ | |
| function toEmptyString(value) { | |
| return value === null || value === void 0 ? '' : value; | |
| } | |
| /** | |
| * Unify column values (replace `null` and `undefined` values into empty string, unique values and sort them). | |
| * | |
| * @param {Array} values An array of values. | |
| * @returns {Array} | |
| */ | |
| function unifyColumnValues(values) { | |
| var unifiedValues = values; | |
| if (SUPPORT_FAST_DEDUPE) { | |
| unifiedValues = Array.from(new Set(unifiedValues)); | |
| } else { | |
| unifiedValues = (0, _array.arrayUnique)(unifiedValues); | |
| } | |
| unifiedValues = unifiedValues.sort(function (a, b) { | |
| if (typeof a === 'number' && typeof b === 'number') { | |
| return a - b; | |
| } | |
| if (a === b) { | |
| return 0; | |
| } | |
| return a > b ? 1 : -1; | |
| }); | |
| return unifiedValues; | |
| } | |
| /** | |
| * Intersect 'base' values with 'selected' values and return an array of object. | |
| * | |
| * @param {Array} base An array of base values. | |
| * @param {Array} selected An array of selected values. | |
| * @param {string} defaultEmptyValue Default value for empty cells. | |
| * @param {Function} [callback] A callback function which is invoked for every item in an array. | |
| * @returns {Array} | |
| */ | |
| function intersectValues(base, selected, defaultEmptyValue, callback) { | |
| var result = []; | |
| var same = base === selected; | |
| var selectedItemsAssertion; | |
| if (!same) { | |
| selectedItemsAssertion = createArrayAssertion(selected); | |
| } | |
| (0, _array.arrayEach)(base, function (value) { | |
| var checked = false; | |
| if (same || selectedItemsAssertion(value)) { | |
| checked = true; | |
| } | |
| var item = { | |
| checked: checked, | |
| value: value, | |
| visualValue: toVisualValue(value, defaultEmptyValue) | |
| }; | |
| if (callback) { | |
| callback(item); | |
| } | |
| result.push(item); | |
| }); | |
| return result; | |
| } | |
| /***/ }), | |
| /* 143 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.getOperationFunc = getOperationFunc; | |
| exports.getOperationName = getOperationName; | |
| exports.registerOperation = registerOperation; | |
| exports.operations = void 0; | |
| __webpack_require__(79); | |
| var operations = {}; | |
| /** | |
| * Get operation closure with pre-bound arguments. | |
| * | |
| * @param {string} id Operator `id`. | |
| * @returns {Function} | |
| */ | |
| exports.operations = operations; | |
| function getOperationFunc(id) { | |
| if (!operations[id]) { | |
| throw Error("Operation with id \"".concat(id, "\" does not exist.")); | |
| } | |
| var func = operations[id].func; | |
| return function (conditions, value) { | |
| return func(conditions, value); | |
| }; | |
| } | |
| /** | |
| * Return name of operation which is displayed inside UI component, basing on it's `id`. | |
| * | |
| * @param {string} id `Id` of operation. | |
| * @returns {string} | |
| */ | |
| function getOperationName(id) { | |
| return operations[id].name; | |
| } | |
| /** | |
| * Operator registerer. | |
| * | |
| * @param {string} id Operation `id`. | |
| * @param {string} name Operation name which is displayed inside UI component. | |
| * @param {Function} func Operation function. | |
| */ | |
| function registerOperation(id, name, func) { | |
| operations[id] = { | |
| name: name, | |
| func: func | |
| }; | |
| } | |
| /***/ }), | |
| /* 144 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireWildcard = __webpack_require__(14); | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| __webpack_require__(139); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _object = __webpack_require__(5); | |
| var _localHooks = _interopRequireDefault(__webpack_require__(55)); | |
| var _eventManager = _interopRequireDefault(__webpack_require__(31)); | |
| var _element = __webpack_require__(10); | |
| var _array = __webpack_require__(3); | |
| var C = _interopRequireWildcard(__webpack_require__(15)); | |
| var STATE_BUILT = 'built'; | |
| var STATE_BUILDING = 'building'; | |
| var EVENTS_TO_REGISTER = ['click', 'input', 'keydown', 'keypress', 'keyup', 'focus', 'blur', 'change']; | |
| /** | |
| * @class | |
| * @private | |
| */ | |
| var BaseUI = /*#__PURE__*/function () { | |
| function BaseUI(hotInstance, options) { | |
| (0, _classCallCheck2.default)(this, BaseUI); | |
| /** | |
| * Instance of Handsontable. | |
| * | |
| * @type {Core} | |
| */ | |
| this.hot = hotInstance; | |
| /** | |
| * Instance of EventManager. | |
| * | |
| * @type {EventManager} | |
| */ | |
| this.eventManager = new _eventManager.default(this); | |
| /** | |
| * List of element options. | |
| * | |
| * @type {object} | |
| */ | |
| this.options = (0, _object.extend)(BaseUI.DEFAULTS, options); | |
| /** | |
| * Build root DOM element. | |
| * | |
| * @type {Element} | |
| * @private | |
| */ | |
| this._element = this.hot.rootDocument.createElement(this.options.wrapIt ? 'div' : this.options.tagName); | |
| /** | |
| * Flag which determines build state of element. | |
| * | |
| * @type {boolean} | |
| */ | |
| this.buildState = false; | |
| } | |
| /** | |
| * Set the element value. | |
| * | |
| * @param {*} value Set the component value. | |
| */ | |
| (0, _createClass2.default)(BaseUI, [{ | |
| key: "setValue", | |
| value: function setValue(value) { | |
| this.options.value = value; | |
| this.update(); | |
| } | |
| /** | |
| * Get the element value. | |
| * | |
| * @returns {*} | |
| */ | |
| }, { | |
| key: "getValue", | |
| value: function getValue() { | |
| return this.options.value; | |
| } | |
| /** | |
| * Get element as a DOM object. | |
| * | |
| * @returns {Element} | |
| */ | |
| }, { | |
| key: "element", | |
| get: function get() { | |
| if (this.buildState === STATE_BUILDING) { | |
| return this._element; | |
| } | |
| if (this.buildState === STATE_BUILT) { | |
| this.update(); | |
| return this._element; | |
| } | |
| this.buildState = STATE_BUILDING; | |
| this.build(); | |
| this.buildState = STATE_BUILT; | |
| return this._element; | |
| } | |
| /** | |
| * Check if element was built (built whole DOM structure). | |
| * | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isBuilt", | |
| value: function isBuilt() { | |
| return this.buildState === STATE_BUILT; | |
| } | |
| /** | |
| * Translate value if it is possible. It's checked if value belongs to namespace of translated phrases. | |
| * | |
| * @param {*} value Value which will may be translated. | |
| * @returns {*} Translated value if translation was possible, original value otherwise. | |
| */ | |
| }, { | |
| key: "translateIfPossible", | |
| value: function translateIfPossible(value) { | |
| if (typeof value === 'string' && value.startsWith(C.FILTERS_NAMESPACE)) { | |
| return this.hot.getTranslatedPhrase(value); | |
| } | |
| return value; | |
| } | |
| /** | |
| * Build DOM structure. | |
| */ | |
| }, { | |
| key: "build", | |
| value: function build() { | |
| var _this = this; | |
| var registerEvent = function registerEvent(element, eventName) { | |
| _this.eventManager.addEventListener(element, eventName, function (event) { | |
| return _this.runLocalHooks(eventName, event, _this); | |
| }); | |
| }; | |
| if (!this.buildState) { | |
| this.buildState = STATE_BUILDING; | |
| } | |
| if (this.options.className) { | |
| (0, _element.addClass)(this._element, this.options.className); | |
| } | |
| if (this.options.children.length) { | |
| (0, _array.arrayEach)(this.options.children, function (element) { | |
| return _this._element.appendChild(element.element); | |
| }); | |
| } else if (this.options.wrapIt) { | |
| var element = this.hot.rootDocument.createElement(this.options.tagName); | |
| (0, _object.objectEach)(this.options, function (value, key) { | |
| if (element[key] !== void 0 && key !== 'className' && key !== 'tagName' && key !== 'children') { | |
| element[key] = _this.translateIfPossible(value); | |
| } | |
| }); | |
| this._element.appendChild(element); | |
| (0, _array.arrayEach)(EVENTS_TO_REGISTER, function (eventName) { | |
| return registerEvent(element, eventName); | |
| }); | |
| } else { | |
| (0, _array.arrayEach)(EVENTS_TO_REGISTER, function (eventName) { | |
| return registerEvent(_this._element, eventName); | |
| }); | |
| } | |
| } | |
| /** | |
| * Update DOM structure. | |
| */ | |
| }, { | |
| key: "update", | |
| value: function update() {} | |
| /** | |
| * Reset to initial state. | |
| */ | |
| }, { | |
| key: "reset", | |
| value: function reset() { | |
| this.options.value = ''; | |
| this.update(); | |
| } | |
| /** | |
| * Show element. | |
| */ | |
| }, { | |
| key: "show", | |
| value: function show() { | |
| this.element.style.display = ''; | |
| } | |
| /** | |
| * Hide element. | |
| */ | |
| }, { | |
| key: "hide", | |
| value: function hide() { | |
| this.element.style.display = 'none'; | |
| } | |
| /** | |
| * Focus element. | |
| */ | |
| }, { | |
| key: "focus", | |
| value: function focus() {} | |
| }, { | |
| key: "destroy", | |
| value: function destroy() { | |
| this.eventManager.destroy(); | |
| this.eventManager = null; | |
| this.hot = null; | |
| if (this._element.parentNode) { | |
| this._element.parentNode.removeChild(this._element); | |
| } | |
| this._element = null; | |
| } | |
| }], [{ | |
| key: "DEFAULTS", | |
| get: function get() { | |
| return (0, _object.clone)({ | |
| className: '', | |
| value: '', | |
| tagName: 'div', | |
| children: [], | |
| wrapIt: true | |
| }); | |
| } | |
| }]); | |
| return BaseUI; | |
| }(); | |
| (0, _object.mixin)(BaseUI, _localHooks.default); | |
| var _default = BaseUI; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 145 */ | |
| /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__.r(__webpack_exports__); | |
| /* harmony import */ var _parser_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(463); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Parser", function() { return _parser_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]; }); | |
| /* harmony import */ var _supported_formulas_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(227); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SUPPORTED_FORMULAS", function() { return _supported_formulas_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]; }); | |
| /* harmony import */ var _error_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR", function() { return _error_mjs__WEBPACK_IMPORTED_MODULE_2__["ERROR"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_DIV_ZERO", function() { return _error_mjs__WEBPACK_IMPORTED_MODULE_2__["ERROR_DIV_ZERO"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_NAME", function() { return _error_mjs__WEBPACK_IMPORTED_MODULE_2__["ERROR_NAME"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_NOT_AVAILABLE", function() { return _error_mjs__WEBPACK_IMPORTED_MODULE_2__["ERROR_NOT_AVAILABLE"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_NULL", function() { return _error_mjs__WEBPACK_IMPORTED_MODULE_2__["ERROR_NULL"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_NUM", function() { return _error_mjs__WEBPACK_IMPORTED_MODULE_2__["ERROR_NUM"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_REF", function() { return _error_mjs__WEBPACK_IMPORTED_MODULE_2__["ERROR_REF"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_VALUE", function() { return _error_mjs__WEBPACK_IMPORTED_MODULE_2__["ERROR_VALUE"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "error", function() { return _error_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]; }); | |
| /* harmony import */ var _helper_cell_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(101); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "extractLabel", function() { return _helper_cell_mjs__WEBPACK_IMPORTED_MODULE_3__["extractLabel"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toLabel", function() { return _helper_cell_mjs__WEBPACK_IMPORTED_MODULE_3__["toLabel"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "columnIndexToLabel", function() { return _helper_cell_mjs__WEBPACK_IMPORTED_MODULE_3__["columnIndexToLabel"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "columnLabelToIndex", function() { return _helper_cell_mjs__WEBPACK_IMPORTED_MODULE_3__["columnLabelToIndex"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "rowIndexToLabel", function() { return _helper_cell_mjs__WEBPACK_IMPORTED_MODULE_3__["rowIndexToLabel"]; }); | |
| /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "rowLabelToIndex", function() { return _helper_cell_mjs__WEBPACK_IMPORTED_MODULE_3__["rowLabelToIndex"]; }); | |
| /***/ }), | |
| /* 146 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| __webpack_require__(29); | |
| __webpack_require__(51); | |
| __webpack_require__(17); | |
| __webpack_require__(139); | |
| __webpack_require__(135); | |
| __webpack_require__(61); | |
| var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18)); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _hotFormulaParser = __webpack_require__(145); | |
| var _array = __webpack_require__(3); | |
| var _object = __webpack_require__(5); | |
| var _localHooks = _interopRequireDefault(__webpack_require__(55)); | |
| var _utils = __webpack_require__(100); | |
| var BARE_CELL_STRICT_REGEX = /^\$?[A-Z]+\$?\d+$/; | |
| var BARE_CELL_REGEX = /\$?[A-Z]+\$?\d+/; | |
| var CELL_REGEX = /(?:[^0-9A-Z$: ]|^)\s*(\$?[A-Z]+\$?\d+)\s*(?![0-9A-Z_: ])/g; | |
| var RANGE_REGEX = /\$?[A-Z]+\$?\d+\s*:\s*\$?[A-Z]+\$?\d+/g; | |
| var CELL_AND_RANGE_REGEX = /((?:[^0-9A-Z$: ]|^)\s*(\$?[A-Z]+\$?\d+)\s*(?![0-9A-Z_: ]))|(\$?[A-Z]+\$?\d+\s*:\s*\$?[A-Z]+\$?\d+)/g; // eslint-disable-line max-len | |
| /** | |
| * Component adds an ability to parse and modify formula expressions. It is designed for translating cell | |
| * coordinates and cell ranges in any direction. By default, component translates only relative coordinates but this | |
| * behavior can be overwritten by passing custom modifier which controls translating process. | |
| * | |
| * @class ExpressionModifier | |
| * @util | |
| */ | |
| var ExpressionModifier = /*#__PURE__*/function () { | |
| function ExpressionModifier(expression) { | |
| (0, _classCallCheck2.default)(this, ExpressionModifier); | |
| /** | |
| * Formula expression to modify. | |
| * | |
| * @type {string} | |
| */ | |
| this.expression = ''; | |
| /** | |
| * Extracted cells and cells ranges. | |
| * | |
| * @type {Array} | |
| */ | |
| this.cells = []; | |
| /** | |
| * Function which can modify default behaviour of how cells and cell ranges will be translated. | |
| * | |
| * @type {null|Function} | |
| */ | |
| this.customModifier = null; | |
| if (typeof expression === 'string') { | |
| this.setExpression(expression); | |
| } | |
| } | |
| /** | |
| * Set formula expression to modify. | |
| * | |
| * @param {string} expression Formula expression to process. | |
| * @returns {ExpressionModifier} | |
| */ | |
| (0, _createClass2.default)(ExpressionModifier, [{ | |
| key: "setExpression", | |
| value: function setExpression(expression) { | |
| this.cells.length = 0; | |
| this.expression = (0, _utils.toUpperCaseFormula)(expression); | |
| this._extractCells(); | |
| this._extractCellsRange(); | |
| return this; | |
| } | |
| /** | |
| * Set function which can modify default behavior of how cells and cell ranges will be translated. | |
| * The passed function will be called with 4 arguments: | |
| * - cell, A cell object with structure | |
| * like this: {start: {row, column}, end: {row, column}, origLabel, type: 'cell|range', refError, toLabel: () => {}} | |
| * - axis, Type of currently processing axis ('row' or 'column') | |
| * - delta, Number as distance to translate. Can be positive or negative. | |
| * - startFromIndex, Base index which translation will be applied from. | |
| * | |
| * The function must return an array with 3 items, where: | |
| * [ | |
| * deltaStart, Number as a delta to translate first part of coordinates. | |
| * DeltaEnd, Number as a delta to translate second part of coordinates (if cell range is modified). | |
| * RefError, Defines an error which refers to the situation when translated cell overcrossed the data boundary. | |
| * ]. | |
| * | |
| * | |
| * @param {Function} customModifier Function with custom logic. | |
| */ | |
| }, { | |
| key: "useCustomModifier", | |
| value: function useCustomModifier(customModifier) { | |
| this.customModifier = customModifier; | |
| } | |
| /** | |
| * Translate formula expression cells. | |
| * | |
| * @param {object} delta Distance to move in proper direction. | |
| * @param {object} [startFrom] Coordinates which translation will be applied from. | |
| * @returns {ExpressionModifier} | |
| */ | |
| }, { | |
| key: "translate", | |
| value: function translate(_ref) { | |
| var _this = this; | |
| var deltaRow = _ref.row, | |
| deltaColumn = _ref.column; | |
| var startFrom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
| (0, _array.arrayEach)(this.cells, function (cell) { | |
| if (deltaRow !== null && deltaRow !== void 0) { | |
| _this._translateCell(cell, 'row', deltaRow, startFrom.row); | |
| } | |
| if (deltaColumn !== null && deltaColumn !== void 0) { | |
| _this._translateCell(cell, 'column', deltaColumn, startFrom.column); | |
| } | |
| }); | |
| return this; | |
| } | |
| /** | |
| * Translate object into string representation. | |
| * | |
| * @returns {string} | |
| */ | |
| }, { | |
| key: "toString", | |
| value: function toString() { | |
| var _this2 = this; | |
| var expression = this.expression.replace(CELL_AND_RANGE_REGEX, function (match, p1, p2) { | |
| var isSingleCell = match.indexOf(':') === -1; | |
| var result = match; | |
| var cellLabel = match; | |
| var translatedCellLabel = null; | |
| if (isSingleCell) { | |
| cellLabel = BARE_CELL_STRICT_REGEX.test(p1) ? p1 : p2; | |
| } | |
| var cell = _this2._searchCell(cellLabel); | |
| if (cell) { | |
| translatedCellLabel = cell.refError ? (0, _hotFormulaParser.error)(_hotFormulaParser.ERROR_REF) : cell.toLabel(); | |
| if (isSingleCell) { | |
| result = match.replace(cellLabel, translatedCellLabel); | |
| } else { | |
| result = translatedCellLabel; | |
| } | |
| } | |
| return result; | |
| }); | |
| if (!expression.startsWith('=')) { | |
| expression = "=".concat(expression); | |
| } | |
| return expression; | |
| } | |
| /** | |
| * Translate single cell. | |
| * | |
| * @param {object} cell Cell object. | |
| * @param {string} axis Axis to modify. | |
| * @param {number} delta Distance to move. | |
| * @param {number} [startFromIndex] Base index which translation will be applied from. | |
| * @private | |
| */ | |
| }, { | |
| key: "_translateCell", | |
| value: function _translateCell(cell, axis, delta, startFromIndex) { | |
| var start = cell.start, | |
| end = cell.end; | |
| var startIndex = start[axis].index; | |
| var endIndex = end[axis].index; | |
| var deltaStart = delta; | |
| var deltaEnd = delta; | |
| var refError = false; | |
| if (this.customModifier) { | |
| var _this$customModifier = this.customModifier(cell, axis, delta, startFromIndex); | |
| var _this$customModifier2 = (0, _slicedToArray2.default)(_this$customModifier, 3); | |
| deltaStart = _this$customModifier2[0]; | |
| deltaEnd = _this$customModifier2[1]; | |
| refError = _this$customModifier2[2]; | |
| } else { | |
| // By default only relative cells are translated, if meets absolute reset deltas to 0 | |
| if (start[axis].isAbsolute) { | |
| deltaStart = 0; | |
| } | |
| if (end[axis].isAbsolute) { | |
| deltaEnd = 0; | |
| } | |
| } | |
| if (deltaStart && !refError) { | |
| if (startIndex + deltaStart < 0) { | |
| refError = true; | |
| } | |
| start[axis].index = Math.max(startIndex + deltaStart, 0); | |
| } | |
| if (deltaEnd && !refError) { | |
| if (endIndex + deltaEnd < 0) { | |
| refError = true; | |
| } | |
| end[axis].index = Math.max(endIndex + deltaEnd, 0); | |
| } | |
| if (refError) { | |
| cell.refError = true; | |
| } | |
| } | |
| /** | |
| * Extract all cells from the formula expression. | |
| * | |
| * @private | |
| */ | |
| }, { | |
| key: "_extractCells", | |
| value: function _extractCells() { | |
| var _this3 = this; | |
| var matches = this.expression.match(CELL_REGEX); | |
| if (!matches) { | |
| return; | |
| } | |
| (0, _array.arrayEach)(matches, function (coord) { | |
| var cellCoords = coord.match(BARE_CELL_REGEX); | |
| if (!cellCoords) { | |
| return; | |
| } | |
| var _extractLabel = (0, _hotFormulaParser.extractLabel)(cellCoords[0]), | |
| _extractLabel2 = (0, _slicedToArray2.default)(_extractLabel, 2), | |
| row = _extractLabel2[0], | |
| column = _extractLabel2[1]; | |
| _this3.cells.push(_this3._createCell({ | |
| row: row, | |
| column: column | |
| }, { | |
| row: row, | |
| column: column | |
| }, cellCoords[0])); | |
| }); | |
| } | |
| /** | |
| * Extract all cells range from the formula expression. | |
| * | |
| * @private | |
| */ | |
| }, { | |
| key: "_extractCellsRange", | |
| value: function _extractCellsRange() { | |
| var _this4 = this; | |
| var matches = this.expression.match(RANGE_REGEX); | |
| if (!matches) { | |
| return; | |
| } | |
| (0, _array.arrayEach)(matches, function (match) { | |
| var _match$split = match.split(':'), | |
| _match$split2 = (0, _slicedToArray2.default)(_match$split, 2), | |
| start = _match$split2[0], | |
| end = _match$split2[1]; | |
| var _extractLabel3 = (0, _hotFormulaParser.extractLabel)(start), | |
| _extractLabel4 = (0, _slicedToArray2.default)(_extractLabel3, 2), | |
| startRow = _extractLabel4[0], | |
| startColumn = _extractLabel4[1]; | |
| var _extractLabel5 = (0, _hotFormulaParser.extractLabel)(end), | |
| _extractLabel6 = (0, _slicedToArray2.default)(_extractLabel5, 2), | |
| endRow = _extractLabel6[0], | |
| endColumn = _extractLabel6[1]; | |
| var startCell = { | |
| row: startRow, | |
| column: startColumn | |
| }; | |
| var endCell = { | |
| row: endRow, | |
| column: endColumn | |
| }; | |
| _this4.cells.push(_this4._createCell(startCell, endCell, match)); | |
| }); | |
| } | |
| /** | |
| * Search cell by its label. | |
| * | |
| * @param {string} label Cell label eq. `B4` or `$B$6`. | |
| * @returns {object|null} | |
| * @private | |
| */ | |
| }, { | |
| key: "_searchCell", | |
| value: function _searchCell(label) { | |
| var _arrayFilter = (0, _array.arrayFilter)(this.cells, function (cellMeta) { | |
| return cellMeta.origLabel === label; | |
| }), | |
| _arrayFilter2 = (0, _slicedToArray2.default)(_arrayFilter, 1), | |
| cell = _arrayFilter2[0]; | |
| return cell || null; | |
| } | |
| /** | |
| * Create object cell. | |
| * | |
| * @param {object} start Start coordinates (top-left). | |
| * @param {object} end End coordinates (bottom-right). | |
| * @param {string} label Original label name. | |
| * @returns {object} | |
| * @private | |
| */ | |
| }, { | |
| key: "_createCell", | |
| value: function _createCell(start, end, label) { | |
| return { | |
| start: start, | |
| end: end, | |
| origLabel: label, | |
| type: label.indexOf(':') === -1 ? 'cell' : 'range', | |
| refError: false, | |
| toLabel: function toLabel() { | |
| var newLabel = (0, _hotFormulaParser.toLabel)(this.start.row, this.start.column); | |
| if (this.type === 'range') { | |
| newLabel += ":".concat((0, _hotFormulaParser.toLabel)(this.end.row, this.end.column)); | |
| } | |
| return newLabel; | |
| } | |
| }; | |
| } | |
| }]); | |
| return ExpressionModifier; | |
| }(); | |
| (0, _object.mixin)(ExpressionModifier, _localHooks.default); | |
| var _default = ExpressionModifier; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 147 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $propertyIsEnumerable = {}.propertyIsEnumerable; | |
| // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe | |
| var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | |
| // Nashorn ~ JDK8 bug | |
| var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1); | |
| // `Object.prototype.propertyIsEnumerable` method implementation | |
| // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable | |
| exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { | |
| var descriptor = getOwnPropertyDescriptor(this, V); | |
| return !!descriptor && descriptor.enumerable; | |
| } : $propertyIsEnumerable; | |
| /***/ }), | |
| /* 148 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var shared = __webpack_require__(149); | |
| var uid = __webpack_require__(150); | |
| var keys = shared('keys'); | |
| module.exports = function (key) { | |
| return keys[key] || (keys[key] = uid(key)); | |
| }; | |
| /***/ }), | |
| /* 149 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var IS_PURE = __webpack_require__(105); | |
| var store = __webpack_require__(174); | |
| (module.exports = function (key, value) { | |
| return store[key] || (store[key] = value !== undefined ? value : {}); | |
| })('versions', []).push({ | |
| version: '3.11.1', | |
| mode: IS_PURE ? 'pure' : 'global', | |
| copyright: '© 2021 Denis Pushkarev (zloirock.ru)' | |
| }); | |
| /***/ }), | |
| /* 150 */ | |
| /***/ (function(module, exports) { | |
| var id = 0; | |
| var postfix = Math.random(); | |
| module.exports = function (key) { | |
| return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); | |
| }; | |
| /***/ }), | |
| /* 151 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var toInteger = __webpack_require__(96); | |
| var max = Math.max; | |
| var min = Math.min; | |
| // Helper for a popular repeating case of the spec: | |
| // Let integer be ? ToInteger(index). | |
| // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). | |
| module.exports = function (index, length) { | |
| var integer = toInteger(index); | |
| return integer < 0 ? max(integer + length, 0) : min(integer, length); | |
| }; | |
| /***/ }), | |
| /* 152 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var fails = __webpack_require__(32); | |
| var replacement = /#|\.prototype\./; | |
| var isForced = function (feature, detection) { | |
| var value = data[normalize(feature)]; | |
| return value == POLYFILL ? true | |
| : value == NATIVE ? false | |
| : typeof detection == 'function' ? fails(detection) | |
| : !!detection; | |
| }; | |
| var normalize = isForced.normalize = function (string) { | |
| return String(string).replace(replacement, '.').toLowerCase(); | |
| }; | |
| var data = isForced.data = {}; | |
| var NATIVE = isForced.NATIVE = 'N'; | |
| var POLYFILL = isForced.POLYFILL = 'P'; | |
| module.exports = isForced; | |
| /***/ }), | |
| /* 153 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var global = __webpack_require__(40); | |
| var userAgent = __webpack_require__(154); | |
| 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; | |
| /***/ }), | |
| /* 154 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var getBuiltIn = __webpack_require__(106); | |
| module.exports = getBuiltIn('navigator', 'userAgent') || ''; | |
| /***/ }), | |
| /* 155 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| // TODO: Remove from `core-js@4` since it's moved to entry points | |
| __webpack_require__(29); | |
| var redefine = __webpack_require__(83); | |
| var fails = __webpack_require__(32); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var createNonEnumerableProperty = __webpack_require__(82); | |
| var SPECIES = wellKnownSymbol('species'); | |
| var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { | |
| // #replace needs built-in support for named groups. | |
| // #match works fine because it just return the exec results, even if it has | |
| // a "grops" property. | |
| var re = /./; | |
| re.exec = function () { | |
| var result = []; | |
| result.groups = { a: '7' }; | |
| return result; | |
| }; | |
| return ''.replace(re, '$<a>') !== '7'; | |
| }); | |
| // IE <= 11 replaces $0 with the whole match, as if it was $& | |
| // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 | |
| var REPLACE_KEEPS_$0 = (function () { | |
| // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing | |
| return 'a'.replace(/./, '$0') === '$0'; | |
| })(); | |
| var REPLACE = wellKnownSymbol('replace'); | |
| // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string | |
| var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { | |
| if (/./[REPLACE]) { | |
| return /./[REPLACE]('a', '$0') === ''; | |
| } | |
| return false; | |
| })(); | |
| // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec | |
| // Weex JS has frozen built-in prototypes, so use try / catch wrapper | |
| var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { | |
| // eslint-disable-next-line regexp/no-empty-group -- required for testing | |
| var re = /(?:)/; | |
| var originalExec = re.exec; | |
| re.exec = function () { return originalExec.apply(this, arguments); }; | |
| var result = 'ab'.split(re); | |
| return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; | |
| }); | |
| module.exports = function (KEY, length, exec, sham) { | |
| var SYMBOL = wellKnownSymbol(KEY); | |
| var DELEGATES_TO_SYMBOL = !fails(function () { | |
| // String methods call symbol-named RegEp methods | |
| var O = {}; | |
| O[SYMBOL] = function () { return 7; }; | |
| return ''[KEY](O) != 7; | |
| }); | |
| var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () { | |
| // Symbol-named RegExp methods call .exec | |
| var execCalled = false; | |
| var re = /a/; | |
| if (KEY === 'split') { | |
| // We can't use real regex here since it causes deoptimization | |
| // and serious performance degradation in V8 | |
| // https://github.com/zloirock/core-js/issues/306 | |
| re = {}; | |
| // RegExp[@@split] doesn't call the regex's exec method, but first creates | |
| // a new one. We need to return the patched regex when creating the new one. | |
| re.constructor = {}; | |
| re.constructor[SPECIES] = function () { return re; }; | |
| re.flags = ''; | |
| re[SYMBOL] = /./[SYMBOL]; | |
| } | |
| re.exec = function () { execCalled = true; return null; }; | |
| re[SYMBOL](''); | |
| return !execCalled; | |
| }); | |
| if ( | |
| !DELEGATES_TO_SYMBOL || | |
| !DELEGATES_TO_EXEC || | |
| (KEY === 'replace' && !( | |
| REPLACE_SUPPORTS_NAMED_GROUPS && | |
| REPLACE_KEEPS_$0 && | |
| !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE | |
| )) || | |
| (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) | |
| ) { | |
| var nativeRegExpMethod = /./[SYMBOL]; | |
| var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { | |
| if (regexp.exec === RegExp.prototype.exec) { | |
| if (DELEGATES_TO_SYMBOL && !forceStringMethod) { | |
| // The native String method already delegates to @@method (this | |
| // polyfilled function), leasing to infinite recursion. | |
| // We avoid it by directly calling the native @@method method. | |
| return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; | |
| } | |
| return { done: true, value: nativeMethod.call(str, regexp, arg2) }; | |
| } | |
| return { done: false }; | |
| }, { | |
| REPLACE_KEEPS_$0: REPLACE_KEEPS_$0, | |
| REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE | |
| }); | |
| var stringMethod = methods[0]; | |
| var regexMethod = methods[1]; | |
| redefine(String.prototype, KEY, stringMethod); | |
| redefine(RegExp.prototype, SYMBOL, length == 2 | |
| // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) | |
| // 21.2.5.11 RegExp.prototype[@@split](string, limit) | |
| ? function (string, arg) { return regexMethod.call(string, this, arg); } | |
| // 21.2.5.6 RegExp.prototype[@@match](string) | |
| // 21.2.5.9 RegExp.prototype[@@search](string) | |
| : function (string) { return regexMethod.call(string, this); } | |
| ); | |
| } | |
| if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true); | |
| }; | |
| /***/ }), | |
| /* 156 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var classof = __webpack_require__(94); | |
| var regexpExec = __webpack_require__(182); | |
| // `RegExpExec` abstract operation | |
| // https://tc39.es/ecma262/#sec-regexpexec | |
| module.exports = function (R, S) { | |
| var exec = R.exec; | |
| if (typeof exec === 'function') { | |
| var result = exec.call(R, S); | |
| if (typeof result !== 'object') { | |
| throw TypeError('RegExp exec method returned something other than an Object or null'); | |
| } | |
| return result; | |
| } | |
| if (classof(R) !== 'RegExp') { | |
| throw TypeError('RegExp#exec called on incompatible receiver'); | |
| } | |
| return regexpExec.call(R, S); | |
| }; | |
| /***/ }), | |
| /* 157 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var defineProperty = __webpack_require__(66).f; | |
| var has = __webpack_require__(65); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var TO_STRING_TAG = wellKnownSymbol('toStringTag'); | |
| module.exports = function (it, TAG, STATIC) { | |
| if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { | |
| defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG }); | |
| } | |
| }; | |
| /***/ }), | |
| /* 158 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var global = __webpack_require__(40); | |
| var isForced = __webpack_require__(152); | |
| var redefine = __webpack_require__(83); | |
| var InternalMetadataModule = __webpack_require__(130); | |
| var iterate = __webpack_require__(196); | |
| var anInstance = __webpack_require__(197); | |
| var isObject = __webpack_require__(46); | |
| var fails = __webpack_require__(32); | |
| var checkCorrectnessOfIteration = __webpack_require__(247); | |
| var setToStringTag = __webpack_require__(157); | |
| var inheritIfRequired = __webpack_require__(181); | |
| module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { | |
| var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; | |
| var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; | |
| var ADDER = IS_MAP ? 'set' : 'add'; | |
| var NativeConstructor = global[CONSTRUCTOR_NAME]; | |
| var NativePrototype = NativeConstructor && NativeConstructor.prototype; | |
| var Constructor = NativeConstructor; | |
| var exported = {}; | |
| var fixMethod = function (KEY) { | |
| var nativeMethod = NativePrototype[KEY]; | |
| redefine(NativePrototype, KEY, | |
| KEY == 'add' ? function add(value) { | |
| nativeMethod.call(this, value === 0 ? 0 : value); | |
| return this; | |
| } : KEY == 'delete' ? function (key) { | |
| return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); | |
| } : KEY == 'get' ? function get(key) { | |
| return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key); | |
| } : KEY == 'has' ? function has(key) { | |
| return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); | |
| } : function set(key, value) { | |
| nativeMethod.call(this, key === 0 ? 0 : key, value); | |
| return this; | |
| } | |
| ); | |
| }; | |
| var REPLACE = isForced( | |
| CONSTRUCTOR_NAME, | |
| typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () { | |
| new NativeConstructor().entries().next(); | |
| })) | |
| ); | |
| if (REPLACE) { | |
| // create collection constructor | |
| Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); | |
| InternalMetadataModule.REQUIRED = true; | |
| } else if (isForced(CONSTRUCTOR_NAME, true)) { | |
| var instance = new Constructor(); | |
| // early implementations not supports chaining | |
| var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; | |
| // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false | |
| var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); | |
| // most early implementations doesn't supports iterables, most modern - not close it correctly | |
| // eslint-disable-next-line no-new -- required for testing | |
| var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); }); | |
| // for early implementations -0 and +0 not the same | |
| var BUGGY_ZERO = !IS_WEAK && fails(function () { | |
| // V8 ~ Chromium 42- fails only with 5+ elements | |
| var $instance = new NativeConstructor(); | |
| var index = 5; | |
| while (index--) $instance[ADDER](index, index); | |
| return !$instance.has(-0); | |
| }); | |
| if (!ACCEPT_ITERABLES) { | |
| Constructor = wrapper(function (dummy, iterable) { | |
| anInstance(dummy, Constructor, CONSTRUCTOR_NAME); | |
| var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); | |
| if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); | |
| return that; | |
| }); | |
| Constructor.prototype = NativePrototype; | |
| NativePrototype.constructor = Constructor; | |
| } | |
| if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { | |
| fixMethod('delete'); | |
| fixMethod('has'); | |
| IS_MAP && fixMethod('get'); | |
| } | |
| if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); | |
| // weak collections should not contains .clear method | |
| if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear; | |
| } | |
| exported[CONSTRUCTOR_NAME] = Constructor; | |
| $({ global: true, forced: Constructor != NativeConstructor }, exported); | |
| setToStringTag(Constructor, CONSTRUCTOR_NAME); | |
| if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); | |
| return Constructor; | |
| }; | |
| /***/ }), | |
| /* 159 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| var _view = _interopRequireDefault(__webpack_require__(397)); | |
| exports.OrderView = _view.default; | |
| var _sharedView = _interopRequireDefault(__webpack_require__(507)); | |
| exports.SharedOrderView = _sharedView.default; | |
| /***/ }), | |
| /* 160 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var $find = __webpack_require__(102).find; | |
| var addToUnscopables = __webpack_require__(127); | |
| var FIND = 'find'; | |
| var SKIPS_HOLES = true; | |
| // Shouldn't skip holes | |
| if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); | |
| // `Array.prototype.find` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.find | |
| $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { | |
| find: function find(callbackfn /* , that = undefined */) { | |
| return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); | |
| } | |
| }); | |
| // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables | |
| addToUnscopables(FIND); | |
| /***/ }), | |
| /* 161 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.registerRenderer = _register; | |
| exports.getRenderer = _getItem; | |
| exports.getRegisteredRenderers = exports.getRegisteredRendererNames = exports.hasRenderer = void 0; | |
| var _staticRegister2 = _interopRequireDefault(__webpack_require__(98)); | |
| var _staticRegister = (0, _staticRegister2.default)('renderers'), | |
| register = _staticRegister.register, | |
| getItem = _staticRegister.getItem, | |
| hasItem = _staticRegister.hasItem, | |
| getNames = _staticRegister.getNames, | |
| getValues = _staticRegister.getValues; | |
| /** | |
| * Retrieve renderer function. | |
| * | |
| * @param {string} name Renderer identification. | |
| * @returns {Function} Returns renderer function. | |
| */ | |
| exports.getRegisteredRenderers = getValues; | |
| exports.getRegisteredRendererNames = getNames; | |
| exports.hasRenderer = hasItem; | |
| 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); | |
| } | |
| /** | |
| * Register renderer under its alias. | |
| * | |
| * @param {string|Function} name Renderer's alias or renderer function with its descriptor. | |
| * @param {Function} [renderer] Renderer function. | |
| */ | |
| function _register(name, renderer) { | |
| if (typeof name !== 'string') { | |
| renderer = name; | |
| name = renderer.RENDERER_TYPE; | |
| } | |
| register(name, renderer); | |
| } | |
| /***/ }), | |
| /* 162 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.registerValidator = _register; | |
| exports.getValidator = _getItem; | |
| exports.getRegisteredValidators = exports.getRegisteredValidatorNames = exports.hasValidator = void 0; | |
| var _staticRegister2 = _interopRequireDefault(__webpack_require__(98)); | |
| var _staticRegister = (0, _staticRegister2.default)('validators'), | |
| register = _staticRegister.register, | |
| getItem = _staticRegister.getItem, | |
| hasItem = _staticRegister.hasItem, | |
| getNames = _staticRegister.getNames, | |
| getValues = _staticRegister.getValues; | |
| /** | |
| * Retrieve validator function. | |
| * | |
| * @param {string} name Validator identification. | |
| * @returns {Function} Returns validator function. | |
| */ | |
| exports.getRegisteredValidators = getValues; | |
| exports.getRegisteredValidatorNames = getNames; | |
| exports.hasValidator = hasItem; | |
| function _getItem(name) { | |
| if (typeof name === 'function') { | |
| return name; | |
| } | |
| if (!hasItem(name)) { | |
| throw Error("No registered validator found under \"".concat(name, "\" name")); | |
| } | |
| return getItem(name); | |
| } | |
| /** | |
| * Register validator under its alias. | |
| * | |
| * @param {string|Function} name Validator's alias or validator function with its descriptor. | |
| * @param {Function} [validator] Validator function. | |
| */ | |
| function _register(name, validator) { | |
| if (typeof name !== 'string') { | |
| validator = name; | |
| name = validator.VALIDATOR_TYPE; | |
| } | |
| register(name, validator); | |
| } | |
| /***/ }), | |
| /* 163 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var fill = __webpack_require__(542); | |
| var addToUnscopables = __webpack_require__(127); | |
| // `Array.prototype.fill` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.fill | |
| $({ target: 'Array', proto: true }, { | |
| fill: fill | |
| }); | |
| // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables | |
| addToUnscopables('fill'); | |
| /***/ }), | |
| /* 164 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.IndexMap = void 0; | |
| __webpack_require__(33); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _number = __webpack_require__(24); | |
| var _object = __webpack_require__(5); | |
| var _function = __webpack_require__(53); | |
| var _localHooks = _interopRequireDefault(__webpack_require__(55)); | |
| /** | |
| * Map for storing mappings from an index to a value. | |
| */ | |
| var IndexMap = /*#__PURE__*/function () { | |
| function IndexMap() { | |
| var initValueOrFn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | |
| (0, _classCallCheck2.default)(this, IndexMap); | |
| /** | |
| * List of values for particular indexes. | |
| * | |
| * @private | |
| * @type {Array} | |
| */ | |
| this.indexedValues = []; | |
| /** | |
| * Initial value or function for each existing index. | |
| * | |
| * @private | |
| * @type {*} | |
| */ | |
| this.initValueOrFn = initValueOrFn; | |
| } | |
| /** | |
| * Get full list of values for particular indexes. | |
| * | |
| * @returns {Array} | |
| */ | |
| (0, _createClass2.default)(IndexMap, [{ | |
| key: "getValues", | |
| value: function getValues() { | |
| return this.indexedValues; | |
| } | |
| /** | |
| * Get value for the particular index. | |
| * | |
| * @param {number} index Index for which value is got. | |
| * @returns {*} | |
| */ | |
| }, { | |
| key: "getValueAtIndex", | |
| value: function getValueAtIndex(index) { | |
| var values = this.indexedValues; | |
| if (index < values.length) { | |
| return values[index]; | |
| } | |
| } | |
| /** | |
| * Set new values for particular indexes. | |
| * | |
| * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. | |
| * | |
| * @param {Array} values List of set values. | |
| */ | |
| }, { | |
| key: "setValues", | |
| value: function setValues(values) { | |
| this.indexedValues = values.slice(); | |
| this.runLocalHooks('change'); | |
| } | |
| /** | |
| * Set new value for the particular index. | |
| * | |
| * @param {number} index The index. | |
| * @param {*} value The value to save. | |
| * | |
| * Note: Please keep in mind that it is not possible to set value beyond the map (not respecting already set | |
| * map's size). Please use the `setValues` method when you would like to extend the map. | |
| * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. | |
| * | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "setValueAtIndex", | |
| value: function setValueAtIndex(index, value) { | |
| if (index < this.indexedValues.length) { | |
| this.indexedValues[index] = value; | |
| this.runLocalHooks('change'); | |
| return true; | |
| } | |
| return false; | |
| } | |
| /** | |
| * Clear all values to the defaults. | |
| */ | |
| }, { | |
| key: "clear", | |
| value: function clear() { | |
| this.setDefaultValues(); | |
| } | |
| /** | |
| * Get length of the index map. | |
| * | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "getLength", | |
| value: function getLength() { | |
| return this.getValues().length; | |
| } | |
| /** | |
| * Set default values for elements from `0` to `n`, where `n` is equal to the handled variable. | |
| * | |
| * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. | |
| * | |
| * @private | |
| * @param {number} [length] Length of list. | |
| */ | |
| }, { | |
| key: "setDefaultValues", | |
| value: function setDefaultValues() { | |
| var _this = this; | |
| var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.indexedValues.length; | |
| this.indexedValues.length = 0; | |
| if ((0, _function.isFunction)(this.initValueOrFn)) { | |
| (0, _number.rangeEach)(length - 1, function (index) { | |
| return _this.indexedValues.push(_this.initValueOrFn(index)); | |
| }); | |
| } else { | |
| (0, _number.rangeEach)(length - 1, function () { | |
| return _this.indexedValues.push(_this.initValueOrFn); | |
| }); | |
| } | |
| this.runLocalHooks('change'); | |
| } | |
| /** | |
| * Initialize list with default values for particular indexes. | |
| * | |
| * @private | |
| * @param {number} length New length of indexed list. | |
| * @returns {IndexMap} | |
| */ | |
| }, { | |
| key: "init", | |
| value: function init(length) { | |
| this.setDefaultValues(length); | |
| this.runLocalHooks('init'); | |
| return this; | |
| } | |
| /** | |
| * Add values to the list. | |
| * | |
| * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. | |
| * | |
| * @private | |
| */ | |
| }, { | |
| key: "insert", | |
| value: function insert() { | |
| this.runLocalHooks('change'); | |
| } | |
| /** | |
| * Remove values from the list. | |
| * | |
| * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. | |
| * | |
| * @private | |
| */ | |
| }, { | |
| key: "remove", | |
| value: function remove() { | |
| this.runLocalHooks('change'); | |
| } | |
| /** | |
| * Destroys the Map instance. | |
| */ | |
| }, { | |
| key: "destroy", | |
| value: function destroy() { | |
| this.clearLocalHooks(); | |
| this.indexedValues = null; | |
| this.initValueOrFn = null; | |
| } | |
| }]); | |
| return IndexMap; | |
| }(); | |
| exports.IndexMap = IndexMap; | |
| (0, _object.mixin)(IndexMap, _localHooks.default); | |
| /***/ }), | |
| /* 165 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.getListWithInsertedItems = getListWithInsertedItems; | |
| exports.getListWithRemovedItems = getListWithRemovedItems; | |
| __webpack_require__(19); | |
| __webpack_require__(33); | |
| __webpack_require__(26); | |
| __webpack_require__(34); | |
| var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(25)); | |
| var _array = __webpack_require__(3); | |
| /** | |
| * Insert new items to the list. | |
| * | |
| * @private | |
| * @param {Array} indexedValues List of values for particular indexes. | |
| * @param {number} insertionIndex Position inside the actual list. | |
| * @param {Array} insertedIndexes List of inserted indexes. | |
| * @returns {Array} List with new mappings. | |
| */ | |
| function getListWithInsertedItems(indexedValues, insertionIndex, insertedIndexes) { | |
| return [].concat((0, _toConsumableArray2.default)(indexedValues.slice(0, insertionIndex)), (0, _toConsumableArray2.default)(insertedIndexes), (0, _toConsumableArray2.default)(indexedValues.slice(insertionIndex))); | |
| } | |
| /** | |
| * Filter items from the list. | |
| * | |
| * @private | |
| * @param {Array} indexedValues List of values for particular indexes. | |
| * @param {Array} removedIndexes List of removed indexes. | |
| * @returns {Array} Reduced list of mappings. | |
| */ | |
| function getListWithRemovedItems(indexedValues, removedIndexes) { | |
| return (0, _array.arrayFilter)(indexedValues, function (index) { | |
| return removedIndexes.includes(index) === false; | |
| }); | |
| } | |
| /***/ }), | |
| /* 166 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports._getRefCount = _getRefCount; | |
| exports._resetState = _resetState; | |
| exports.isPressed = isPressed; | |
| exports.isPressedCtrlKey = isPressedCtrlKey; | |
| exports.startObserving = startObserving; | |
| exports.stopObserving = stopObserving; | |
| __webpack_require__(12); | |
| __webpack_require__(9); | |
| __webpack_require__(62); | |
| __webpack_require__(11); | |
| __webpack_require__(13); | |
| __webpack_require__(43); | |
| var _eventManager = _interopRequireDefault(__webpack_require__(31)); | |
| var _unicode = __webpack_require__(70); | |
| var eventManager = new _eventManager.default(); | |
| var pressedKeys = new Set(); | |
| var refCount = 0; | |
| /** | |
| * Begins observing keyboard keys states. | |
| * | |
| * @param {Document} rootDocument The document owner. | |
| */ | |
| function startObserving(rootDocument) { | |
| if (refCount === 0) { | |
| eventManager.addEventListener(rootDocument, 'keydown', function (event) { | |
| if (!pressedKeys.has(event.keyCode)) { | |
| pressedKeys.add(event.keyCode); | |
| } | |
| }); | |
| eventManager.addEventListener(rootDocument, 'keyup', function (event) { | |
| if (pressedKeys.has(event.keyCode)) { | |
| pressedKeys.delete(event.keyCode); | |
| } | |
| }); | |
| eventManager.addEventListener(rootDocument, 'visibilitychange', function () { | |
| if (rootDocument.hidden) { | |
| pressedKeys.clear(); | |
| } | |
| }); | |
| eventManager.addEventListener(rootDocument.defaultView, 'blur', function () { | |
| pressedKeys.clear(); | |
| }); | |
| } | |
| refCount += 1; | |
| } | |
| /** | |
| * Stops observing keyboard keys states and clear all previously saved states. | |
| */ | |
| function stopObserving() { | |
| if (refCount > 0) { | |
| refCount -= 1; | |
| } | |
| if (refCount === 0) { | |
| _resetState(); | |
| } | |
| } | |
| /** | |
| * Remove all listeners attached to the DOM and clear all previously saved states. | |
| */ | |
| function _resetState() { | |
| eventManager.clearEvents(); | |
| pressedKeys.clear(); | |
| refCount = 0; | |
| } | |
| /** | |
| * Checks if provided keyCode or keyCodes are pressed. | |
| * | |
| * @param {string} keyCodes The key codes passed as a string defined in helpers/unicode.js file delimited with '|'. | |
| * @returns {boolean} | |
| */ | |
| function isPressed(keyCodes) { | |
| return Array.from(pressedKeys.values()).some(function (_keyCode) { | |
| return (0, _unicode.isKey)(_keyCode, keyCodes); | |
| }); | |
| } | |
| /** | |
| * Checks if ctrl keys are pressed. | |
| * | |
| * @returns {boolean} | |
| */ | |
| function isPressedCtrlKey() { | |
| var values = Array.from(pressedKeys.values()); | |
| return values.some(function (_keyCode) { | |
| return (0, _unicode.isCtrlMetaKey)(_keyCode); | |
| }); | |
| } | |
| /** | |
| * Returns reference count. Useful for debugging and testing purposes. | |
| * | |
| * @returns {number} | |
| */ | |
| function _getRefCount() { | |
| return refCount; | |
| } | |
| /***/ }), | |
| /* 167 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.detectSelectionType = detectSelectionType; | |
| exports.normalizeSelectionFactory = normalizeSelectionFactory; | |
| exports.transformSelectionToColumnDistance = transformSelectionToColumnDistance; | |
| exports.transformSelectionToRowDistance = transformSelectionToRowDistance; | |
| exports.isValidCoord = isValidCoord; | |
| exports.SELECTION_TYPES = exports.SELECTION_TYPE_OBJECT = exports.SELECTION_TYPE_ARRAY = exports.SELECTION_TYPE_EMPTY = exports.SELECTION_TYPE_UNRECOGNIZED = void 0; | |
| var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18)); | |
| var _typeof2 = _interopRequireDefault(__webpack_require__(56)); | |
| __webpack_require__(49); | |
| __webpack_require__(138); | |
| __webpack_require__(9); | |
| __webpack_require__(26); | |
| __webpack_require__(34); | |
| __webpack_require__(12); | |
| __webpack_require__(62); | |
| __webpack_require__(11); | |
| __webpack_require__(13); | |
| __webpack_require__(43); | |
| __webpack_require__(81); | |
| var _src = __webpack_require__(38); | |
| var _array = __webpack_require__(3); | |
| var _mixed = __webpack_require__(20); | |
| var SELECTION_TYPE_UNRECOGNIZED = 0; | |
| exports.SELECTION_TYPE_UNRECOGNIZED = SELECTION_TYPE_UNRECOGNIZED; | |
| var SELECTION_TYPE_EMPTY = 1; | |
| exports.SELECTION_TYPE_EMPTY = SELECTION_TYPE_EMPTY; | |
| var SELECTION_TYPE_ARRAY = 2; | |
| exports.SELECTION_TYPE_ARRAY = SELECTION_TYPE_ARRAY; | |
| var SELECTION_TYPE_OBJECT = 3; | |
| exports.SELECTION_TYPE_OBJECT = SELECTION_TYPE_OBJECT; | |
| var SELECTION_TYPES = [SELECTION_TYPE_OBJECT, SELECTION_TYPE_ARRAY]; | |
| exports.SELECTION_TYPES = SELECTION_TYPES; | |
| var ARRAY_TYPE_PATTERN = [['number'], ['number', 'string'], ['number', 'undefined'], ['number', 'string', 'undefined']]; | |
| var rootCall = Symbol('root'); | |
| var childCall = Symbol('child'); | |
| /** | |
| * Detect selection schema structure. | |
| * | |
| * @param {*} selectionRanges The selected range or and array of selected ranges. This type of data is produced by | |
| * `hot.getSelected()`, `hot.getSelectedLast()`, `hot.getSelectedRange()` | |
| * and `hot.getSelectedRangeLast()` methods. | |
| * @param {symbol} _callSymbol The symbol object which indicates source of the helper invocation. | |
| * @returns {number} Returns a number that specifies the type of detected selection schema. If selection schema type | |
| * is unrecognized than it returns `0`. | |
| */ | |
| function detectSelectionType(selectionRanges) { | |
| var _callSymbol = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : rootCall; | |
| if (_callSymbol !== rootCall && _callSymbol !== childCall) { | |
| throw new Error('The second argument is used internally only and cannot be overwritten.'); | |
| } | |
| var isArray = Array.isArray(selectionRanges); | |
| var isRootCall = _callSymbol === rootCall; | |
| var result = SELECTION_TYPE_UNRECOGNIZED; | |
| if (isArray) { | |
| var firstItem = selectionRanges[0]; | |
| if (selectionRanges.length === 0) { | |
| result = SELECTION_TYPE_EMPTY; | |
| } else if (isRootCall && firstItem instanceof _src.CellRange) { | |
| result = SELECTION_TYPE_OBJECT; | |
| } else if (isRootCall && Array.isArray(firstItem)) { | |
| result = detectSelectionType(firstItem, childCall); | |
| } else if (selectionRanges.length >= 2 && selectionRanges.length <= 4) { | |
| var isArrayType = !selectionRanges.some(function (value, index) { | |
| return !ARRAY_TYPE_PATTERN[index].includes((0, _typeof2.default)(value)); | |
| }); | |
| if (isArrayType) { | |
| result = SELECTION_TYPE_ARRAY; | |
| } | |
| } | |
| } | |
| return result; | |
| } | |
| /** | |
| * Factory function designed for normalization data schema from different data structures of the selection ranges. | |
| * | |
| * @param {string} type Selection type which will be processed. | |
| * @param {object} [options] The normalization options. | |
| * @param {boolean} [options.keepDirection=false] If `true`, the coordinates which contain the direction of the | |
| * selected cells won't be changed. Otherwise, the selection will be | |
| * normalized to values starting from top-left to bottom-right. | |
| * @param {Function} [options.propToCol] Pass the converting function (usually `datamap.propToCol`) if the column | |
| * defined as props should be normalized to the numeric values. | |
| * @returns {number[]} Returns normalized data about selected range as an array (`[rowStart, columnStart, rowEnd, columnEnd]`). | |
| */ | |
| function normalizeSelectionFactory(type) { | |
| var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | |
| _ref$keepDirection = _ref.keepDirection, | |
| keepDirection = _ref$keepDirection === void 0 ? false : _ref$keepDirection, | |
| propToCol = _ref.propToCol; | |
| if (!SELECTION_TYPES.includes(type)) { | |
| throw new Error('Unsupported selection ranges schema type was provided.'); | |
| } | |
| return function (selection) { | |
| var isObjectType = type === SELECTION_TYPE_OBJECT; | |
| var rowStart = isObjectType ? selection.from.row : selection[0]; | |
| var columnStart = isObjectType ? selection.from.col : selection[1]; | |
| var rowEnd = isObjectType ? selection.to.row : selection[2]; | |
| var columnEnd = isObjectType ? selection.to.col : selection[3]; | |
| if (typeof propToCol === 'function') { | |
| if (typeof columnStart === 'string') { | |
| columnStart = propToCol(columnStart); | |
| } | |
| if (typeof columnEnd === 'string') { | |
| columnEnd = propToCol(columnEnd); | |
| } | |
| } | |
| if ((0, _mixed.isUndefined)(rowEnd)) { | |
| rowEnd = rowStart; | |
| } | |
| if ((0, _mixed.isUndefined)(columnEnd)) { | |
| columnEnd = columnStart; | |
| } | |
| if (!keepDirection) { | |
| var origRowStart = rowStart; | |
| var origColumnStart = columnStart; | |
| var origRowEnd = rowEnd; | |
| var origColumnEnd = columnEnd; | |
| rowStart = Math.min(origRowStart, origRowEnd); | |
| columnStart = Math.min(origColumnStart, origColumnEnd); | |
| rowEnd = Math.max(origRowStart, origRowEnd); | |
| columnEnd = Math.max(origColumnStart, origColumnEnd); | |
| } | |
| return [rowStart, columnStart, rowEnd, columnEnd]; | |
| }; | |
| } | |
| /** | |
| * Function transform selection ranges (produced by `hot.getSelected()` and `hot.getSelectedRange()`) to normalized | |
| * data structure. It merges repeated ranges into consecutive coordinates. The returned structure | |
| * contains an array of arrays. The single item contains at index 0 visual column index from the selection was | |
| * started and at index 1 distance as a count of selected columns. | |
| * | |
| * @param {Array[]|CellRange[]} selectionRanges Selection ranges produced by Handsontable. | |
| * @returns {Array[]} Returns an array of arrays with ranges defines in that schema: | |
| * `[[visualColumnStart, distance], [visualColumnStart, distance], ...]`. | |
| * The column distances are always created starting from the left (zero index) to the | |
| * right (the latest column index). | |
| */ | |
| function transformSelectionToColumnDistance(selectionRanges) { | |
| var selectionType = detectSelectionType(selectionRanges); | |
| if (selectionType === SELECTION_TYPE_UNRECOGNIZED || selectionType === SELECTION_TYPE_EMPTY) { | |
| return []; | |
| } | |
| var selectionSchemaNormalizer = normalizeSelectionFactory(selectionType); | |
| var unorderedIndexes = new Set(); // Iterate through all ranges and collect all column indexes which are not saved yet. | |
| (0, _array.arrayEach)(selectionRanges, function (selection) { | |
| var _selectionSchemaNorma = selectionSchemaNormalizer(selection), | |
| _selectionSchemaNorma2 = (0, _slicedToArray2.default)(_selectionSchemaNorma, 4), | |
| columnStart = _selectionSchemaNorma2[1], | |
| columnEnd = _selectionSchemaNorma2[3]; | |
| var columnNonHeaderStart = Math.max(columnStart, 0); | |
| var amount = columnEnd - columnNonHeaderStart + 1; | |
| (0, _array.arrayEach)(Array.from(new Array(amount), function (_, i) { | |
| return columnNonHeaderStart + i; | |
| }), function (index) { | |
| if (!unorderedIndexes.has(index)) { | |
| unorderedIndexes.add(index); | |
| } | |
| }); | |
| }); // Sort indexes in ascending order to easily detecting non-consecutive columns. | |
| var orderedIndexes = Array.from(unorderedIndexes).sort(function (a, b) { | |
| return a - b; | |
| }); | |
| var normalizedColumnRanges = (0, _array.arrayReduce)(orderedIndexes, function (acc, visualColumnIndex, index, array) { | |
| if (index !== 0 && visualColumnIndex === array[index - 1] + 1) { | |
| acc[acc.length - 1][1] += 1; | |
| } else { | |
| acc.push([visualColumnIndex, 1]); | |
| } | |
| return acc; | |
| }, []); | |
| return normalizedColumnRanges; | |
| } | |
| /** | |
| * Function transform selection ranges (produced by `hot.getSelected()` and `hot.getSelectedRange()`) to normalized | |
| * data structure. It merges repeated ranges into consecutive coordinates. The returned structure | |
| * contains an array of arrays. The single item contains at index 0 visual column index from the selection was | |
| * started and at index 1 distance as a count of selected columns. | |
| * | |
| * @param {Array[]|CellRange[]} selectionRanges Selection ranges produced by Handsontable. | |
| * @returns {Array[]} Returns an array of arrays with ranges defines in that schema: | |
| * `[[visualColumnStart, distance], [visualColumnStart, distance], ...]`. | |
| * The column distances are always created starting from the left (zero index) to the | |
| * right (the latest column index). | |
| */ | |
| function transformSelectionToRowDistance(selectionRanges) { | |
| var selectionType = detectSelectionType(selectionRanges); | |
| if (selectionType === SELECTION_TYPE_UNRECOGNIZED || selectionType === SELECTION_TYPE_EMPTY) { | |
| return []; | |
| } | |
| var selectionSchemaNormalizer = normalizeSelectionFactory(selectionType); | |
| var unorderedIndexes = new Set(); // Iterate through all ranges and collect all column indexes which are not saved yet. | |
| (0, _array.arrayEach)(selectionRanges, function (selection) { | |
| var _selectionSchemaNorma3 = selectionSchemaNormalizer(selection), | |
| _selectionSchemaNorma4 = (0, _slicedToArray2.default)(_selectionSchemaNorma3, 3), | |
| rowStart = _selectionSchemaNorma4[0], | |
| rowEnd = _selectionSchemaNorma4[2]; | |
| var rowNonHeaderStart = Math.max(rowStart, 0); | |
| var amount = rowEnd - rowNonHeaderStart + 1; | |
| (0, _array.arrayEach)(Array.from(new Array(amount), function (_, i) { | |
| return rowNonHeaderStart + i; | |
| }), function (index) { | |
| if (!unorderedIndexes.has(index)) { | |
| unorderedIndexes.add(index); | |
| } | |
| }); | |
| }); // Sort indexes in ascending order to easily detecting non-consecutive columns. | |
| var orderedIndexes = Array.from(unorderedIndexes).sort(function (a, b) { | |
| return a - b; | |
| }); | |
| var normalizedRowRanges = (0, _array.arrayReduce)(orderedIndexes, function (acc, rowIndex, index, array) { | |
| if (index !== 0 && rowIndex === array[index - 1] + 1) { | |
| acc[acc.length - 1][1] += 1; | |
| } else { | |
| acc.push([rowIndex, 1]); | |
| } | |
| return acc; | |
| }, []); | |
| return normalizedRowRanges; | |
| } | |
| /** | |
| * Check if passed value can be treated as valid cell coordinate. The second argument is | |
| * used to check if the value doesn't exceed the defined max table rows/columns count. | |
| * | |
| * @param {number} coord The coordinate to validate (row index or column index). | |
| * @param {number} maxTableItemsCount The value that declares the maximum coordinate that is still validatable. | |
| * @returns {boolean} | |
| */ | |
| function isValidCoord(coord) { | |
| var maxTableItemsCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity; | |
| return typeof coord === 'number' && coord >= 0 && coord < maxTableItemsCount; | |
| } | |
| /***/ }), | |
| /* 168 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.baseRenderer = exports.RENDERER_TYPE = void 0; | |
| var _baseRenderer = __webpack_require__(582); | |
| exports.RENDERER_TYPE = _baseRenderer.RENDERER_TYPE; | |
| exports.baseRenderer = _baseRenderer.baseRenderer; | |
| /***/ }), | |
| /* 169 */ | |
| /***/ (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__(3); | |
| var _object = __webpack_require__(5); | |
| var _localHooks = _interopRequireDefault(__webpack_require__(55)); | |
| var _translations = __webpack_require__(54); | |
| /** | |
| * @plugin Filters | |
| * @class BaseComponent | |
| */ | |
| var BaseComponent = /*#__PURE__*/function () { | |
| function BaseComponent(hotInstance, _ref) { | |
| var id = _ref.id, | |
| _ref$stateless = _ref.stateless, | |
| stateless = _ref$stateless === void 0 ? true : _ref$stateless; | |
| (0, _classCallCheck2.default)(this, BaseComponent); | |
| /** | |
| * The Handsontable instance. | |
| * | |
| * @type {Core} | |
| */ | |
| this.hot = hotInstance; | |
| /** | |
| * The component uniq id. | |
| * | |
| * @type {string} | |
| */ | |
| this.id = id; | |
| /** | |
| * List of registered component UI elements. | |
| * | |
| * @type {Array} | |
| */ | |
| this.elements = []; | |
| /** | |
| * Flag which determines if element is hidden. | |
| * | |
| * @type {boolean} | |
| */ | |
| this.hidden = false; | |
| /** | |
| * The component states id. | |
| * | |
| * @type {string} | |
| */ | |
| this.stateId = "Filters.component.".concat(this.id); | |
| /** | |
| * Index map which stores component states for each column. | |
| * | |
| * @type {LinkedPhysicalIndexToValueMap|null} | |
| */ | |
| this.state = stateless ? null : this.hot.columnIndexMapper.registerMap(this.stateId, new _translations.LinkedPhysicalIndexToValueMap()); | |
| } | |
| /** | |
| * Reset elements to its initial state. | |
| */ | |
| (0, _createClass2.default)(BaseComponent, [{ | |
| key: "reset", | |
| value: function reset() { | |
| (0, _array.arrayEach)(this.elements, function (ui) { | |
| return ui.reset(); | |
| }); | |
| } | |
| /** | |
| * Hide component. | |
| */ | |
| }, { | |
| key: "hide", | |
| value: function hide() { | |
| this.hidden = true; | |
| } | |
| /** | |
| * Show component. | |
| */ | |
| }, { | |
| key: "show", | |
| value: function show() { | |
| this.hidden = false; | |
| } | |
| /** | |
| * Check if component is hidden. | |
| * | |
| * @returns {boolean} | |
| */ | |
| }, { | |
| key: "isHidden", | |
| value: function isHidden() { | |
| return this.hot === null || this.hidden; | |
| } | |
| /** | |
| * Restores the component state from the given physical column index. The method | |
| * internally calls the `setState` method. The state then is individually processed | |
| * by each component. | |
| * | |
| * @param {number} physicalColumn The physical column index. | |
| */ | |
| }, { | |
| key: "restoreState", | |
| value: function restoreState(physicalColumn) { | |
| if (this.state) { | |
| this.setState(this.state.getValueAtIndex(physicalColumn)); | |
| } | |
| } | |
| /** | |
| * The custom logic for component state restoring. | |
| */ | |
| }, { | |
| key: "setState", | |
| value: function setState() { | |
| throw new Error('The state setting logic is not implemented'); | |
| } | |
| /** | |
| * Saves the component state to the given physical column index. The method | |
| * internally calls the `getState` method, which returns the current state of | |
| * the component. | |
| * | |
| * @param {number} physicalColumn The physical column index. | |
| */ | |
| }, { | |
| key: "saveState", | |
| value: function saveState(physicalColumn) { | |
| if (this.state) { | |
| this.state.setValueAtIndex(physicalColumn, this.getState()); | |
| } | |
| } | |
| /** | |
| * The custom logic for component state gathering (for stateful components). | |
| */ | |
| }, { | |
| key: "getState", | |
| value: function getState() { | |
| throw new Error('The state gathering logic is not implemented'); | |
| } | |
| /** | |
| * Destroy element. | |
| */ | |
| }, { | |
| key: "destroy", | |
| value: function destroy() { | |
| this.hot.columnIndexMapper.unregisterMap(this.stateId); | |
| this.clearLocalHooks(); | |
| (0, _array.arrayEach)(this.elements, function (ui) { | |
| return ui.destroy(); | |
| }); | |
| this.state = null; | |
| this.elements = null; | |
| this.hot = null; | |
| } | |
| }]); | |
| return BaseComponent; | |
| }(); | |
| (0, _object.mixin)(BaseComponent, _localHooks.default); | |
| var _default = BaseComponent; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 170 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var utils = __webpack_require__(86); | |
| var error = __webpack_require__(80); | |
| var statistical = __webpack_require__(171); | |
| var information = __webpack_require__(225); | |
| var evalExpression = __webpack_require__(224); | |
| exports.ABS = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var result = Math.abs(number); | |
| return result; | |
| }; | |
| exports.ACOS = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var result = Math.acos(number); | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.ACOSH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var result = Math.log(number + Math.sqrt(number * number - 1)); | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.ACOT = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var result = Math.atan(1 / number); | |
| return result; | |
| }; | |
| exports.ACOTH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var result = 0.5 * Math.log((number + 1) / (number - 1)); | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| //TODO: use options | |
| exports.AGGREGATE = function(function_num, options, ref1, ref2) { | |
| function_num = utils.parseNumber(function_num); | |
| options = utils.parseNumber(function_num); | |
| if (utils.anyIsError(function_num, options)) { | |
| return error.value; | |
| } | |
| switch (function_num) { | |
| case 1: | |
| return statistical.AVERAGE(ref1); | |
| case 2: | |
| return statistical.COUNT(ref1); | |
| case 3: | |
| return statistical.COUNTA(ref1); | |
| case 4: | |
| return statistical.MAX(ref1); | |
| case 5: | |
| return statistical.MIN(ref1); | |
| case 6: | |
| return exports.PRODUCT(ref1); | |
| case 7: | |
| return statistical.STDEV.S(ref1); | |
| case 8: | |
| return statistical.STDEV.P(ref1); | |
| case 9: | |
| return exports.SUM(ref1); | |
| case 10: | |
| return statistical.VAR.S(ref1); | |
| case 11: | |
| return statistical.VAR.P(ref1); | |
| case 12: | |
| return statistical.MEDIAN(ref1); | |
| case 13: | |
| return statistical.MODE.SNGL(ref1); | |
| case 14: | |
| return statistical.LARGE(ref1, ref2); | |
| case 15: | |
| return statistical.SMALL(ref1, ref2); | |
| case 16: | |
| return statistical.PERCENTILE.INC(ref1, ref2); | |
| case 17: | |
| return statistical.QUARTILE.INC(ref1, ref2); | |
| case 18: | |
| return statistical.PERCENTILE.EXC(ref1, ref2); | |
| case 19: | |
| return statistical.QUARTILE.EXC(ref1, ref2); | |
| } | |
| }; | |
| exports.ARABIC = function(text) { | |
| // Credits: Rafa? Kukawski | |
| if (!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(text)) { | |
| return error.value; | |
| } | |
| var r = 0; | |
| text.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g, function(i) { | |
| r += { | |
| M: 1000, | |
| CM: 900, | |
| D: 500, | |
| CD: 400, | |
| C: 100, | |
| XC: 90, | |
| L: 50, | |
| XL: 40, | |
| X: 10, | |
| IX: 9, | |
| V: 5, | |
| IV: 4, | |
| I: 1 | |
| }[i]; | |
| }); | |
| return r; | |
| }; | |
| exports.ASIN = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var result = Math.asin(number); | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.ASINH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return Math.log(number + Math.sqrt(number * number + 1)); | |
| }; | |
| exports.ATAN = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return Math.atan(number); | |
| }; | |
| exports.ATAN2 = function(number_x, number_y) { | |
| number_x = utils.parseNumber(number_x); | |
| number_y = utils.parseNumber(number_y); | |
| if (utils.anyIsError(number_x, number_y)) { | |
| return error.value; | |
| } | |
| return Math.atan2(number_x, number_y); | |
| }; | |
| exports.ATANH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var result = Math.log((1 + number) / (1 - number)) / 2; | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.BASE = function(number, radix, min_length) { | |
| min_length = min_length || 0; | |
| number = utils.parseNumber(number); | |
| radix = utils.parseNumber(radix); | |
| min_length = utils.parseNumber(min_length); | |
| if (utils.anyIsError(number, radix, min_length)) { | |
| return error.value; | |
| } | |
| min_length = (min_length === undefined) ? 0 : min_length; | |
| var result = number.toString(radix); | |
| return new Array(Math.max(min_length + 1 - result.length, 0)).join('0') + result; | |
| }; | |
| exports.CEILING = function(number, significance, mode) { | |
| significance = (significance === undefined) ? 1 : Math.abs(significance); | |
| mode = mode || 0; | |
| number = utils.parseNumber(number); | |
| significance = utils.parseNumber(significance); | |
| mode = utils.parseNumber(mode); | |
| if (utils.anyIsError(number, significance, mode)) { | |
| return error.value; | |
| } | |
| if (significance === 0) { | |
| return 0; | |
| } | |
| var precision = -Math.floor(Math.log(significance) / Math.log(10)); | |
| if (number >= 0) { | |
| return exports.ROUND(Math.ceil(number / significance) * significance, precision); | |
| } else { | |
| if (mode === 0) { | |
| return -exports.ROUND(Math.floor(Math.abs(number) / significance) * significance, precision); | |
| } else { | |
| return -exports.ROUND(Math.ceil(Math.abs(number) / significance) * significance, precision); | |
| } | |
| } | |
| }; | |
| exports.CEILING.MATH = exports.CEILING; | |
| exports.CEILING.PRECISE = exports.CEILING; | |
| exports.COMBIN = function(number, number_chosen) { | |
| number = utils.parseNumber(number); | |
| number_chosen = utils.parseNumber(number_chosen); | |
| if (utils.anyIsError(number, number_chosen)) { | |
| return error.value; | |
| } | |
| return exports.FACT(number) / (exports.FACT(number_chosen) * exports.FACT(number - number_chosen)); | |
| }; | |
| exports.COMBINA = function(number, number_chosen) { | |
| number = utils.parseNumber(number); | |
| number_chosen = utils.parseNumber(number_chosen); | |
| if (utils.anyIsError(number, number_chosen)) { | |
| return error.value; | |
| } | |
| return (number === 0 && number_chosen === 0) ? 1 : exports.COMBIN(number + number_chosen - 1, number - 1); | |
| }; | |
| exports.COS = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return Math.cos(number); | |
| }; | |
| exports.COSH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return (Math.exp(number) + Math.exp(-number)) / 2; | |
| }; | |
| exports.COT = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return 1 / Math.tan(number); | |
| }; | |
| exports.COTH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var e2 = Math.exp(2 * number); | |
| return (e2 + 1) / (e2 - 1); | |
| }; | |
| exports.CSC = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return 1 / Math.sin(number); | |
| }; | |
| exports.CSCH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return 2 / (Math.exp(number) - Math.exp(-number)); | |
| }; | |
| exports.DECIMAL = function(number, radix) { | |
| if (arguments.length < 1) { | |
| return error.value; | |
| } | |
| return parseInt(number, radix); | |
| }; | |
| exports.DEGREES = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return number * 180 / Math.PI; | |
| }; | |
| exports.EVEN = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return exports.CEILING(number, -2, -1); | |
| }; | |
| exports.EXP = function(number) { | |
| if (arguments.length < 1) { | |
| return error.na; | |
| } | |
| if (typeof number !== 'number' || arguments.length > 1) { | |
| return error.error; | |
| } | |
| number = Math.exp(number); | |
| return number; | |
| }; | |
| var MEMOIZED_FACT = []; | |
| exports.FACT = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var n = Math.floor(number); | |
| if (n === 0 || n === 1) { | |
| return 1; | |
| } else if (MEMOIZED_FACT[n] > 0) { | |
| return MEMOIZED_FACT[n]; | |
| } else { | |
| MEMOIZED_FACT[n] = exports.FACT(n - 1) * n; | |
| return MEMOIZED_FACT[n]; | |
| } | |
| }; | |
| exports.FACTDOUBLE = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var n = Math.floor(number); | |
| if (n <= 0) { | |
| return 1; | |
| } else { | |
| return n * exports.FACTDOUBLE(n - 2); | |
| } | |
| }; | |
| exports.FLOOR = function(number, significance) { | |
| number = utils.parseNumber(number); | |
| significance = utils.parseNumber(significance); | |
| if (utils.anyIsError(number, significance)) { | |
| return error.value; | |
| } | |
| if (significance === 0) { | |
| return 0; | |
| } | |
| if (!(number > 0 && significance > 0) && !(number < 0 && significance < 0)) { | |
| return error.num; | |
| } | |
| significance = Math.abs(significance); | |
| var precision = -Math.floor(Math.log(significance) / Math.log(10)); | |
| if (number >= 0) { | |
| return exports.ROUND(Math.floor(number / significance) * significance, precision); | |
| } else { | |
| return -exports.ROUND(Math.ceil(Math.abs(number) / significance), precision); | |
| } | |
| }; | |
| //TODO: Verify | |
| exports.FLOOR.MATH = function(number, significance, mode) { | |
| significance = (significance === undefined) ? 1 : significance; | |
| mode = (mode === undefined) ? 0 : mode; | |
| number = utils.parseNumber(number); | |
| significance = utils.parseNumber(significance); | |
| mode = utils.parseNumber(mode); | |
| if (utils.anyIsError(number, significance, mode)) { | |
| return error.value; | |
| } | |
| if (significance === 0) { | |
| return 0; | |
| } | |
| significance = significance ? Math.abs(significance) : 1; | |
| var precision = -Math.floor(Math.log(significance) / Math.log(10)); | |
| if (number >= 0) { | |
| return exports.ROUND(Math.floor(number / significance) * significance, precision); | |
| } else if (mode === 0 || mode === undefined) { | |
| return -exports.ROUND(Math.ceil(Math.abs(number) / significance) * significance, precision); | |
| } | |
| return -exports.ROUND(Math.floor(Math.abs(number) / significance) * significance, precision); | |
| }; | |
| // Deprecated | |
| exports.FLOOR.PRECISE = exports.FLOOR.MATH; | |
| // adapted http://rosettacode.org/wiki/Greatest_common_divisor#JavaScript | |
| exports.GCD = function() { | |
| var range = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| var n = range.length; | |
| var r0 = range[0]; | |
| var x = r0 < 0 ? -r0 : r0; | |
| for (var i = 1; i < n; i++) { | |
| var ri = range[i]; | |
| var y = ri < 0 ? -ri : ri; | |
| while (x && y) { | |
| if (x > y) { | |
| x %= y; | |
| } else { | |
| y %= x; | |
| } | |
| } | |
| x += y; | |
| } | |
| return x; | |
| }; | |
| exports.INT = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return Math.floor(number); | |
| }; | |
| //TODO: verify | |
| exports.ISO = { | |
| CEILING: exports.CEILING | |
| }; | |
| exports.LCM = function() { | |
| // Credits: Jonas Raoni Soares Silva | |
| var o = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (o instanceof Error) { | |
| return o; | |
| } | |
| for (var i, j, n, d, r = 1; | |
| (n = o.pop()) !== undefined;) { | |
| while (n > 1) { | |
| if (n % 2) { | |
| for (i = 3, j = Math.floor(Math.sqrt(n)); i <= j && n % i; i += 2) { | |
| //empty | |
| } | |
| d = (i <= j) ? i : n; | |
| } else { | |
| d = 2; | |
| } | |
| for (n /= d, r *= d, i = o.length; i; | |
| (o[--i] % d) === 0 && (o[i] /= d) === 1 && o.splice(i, 1)) { | |
| //empty | |
| } | |
| } | |
| } | |
| return r; | |
| }; | |
| exports.LN = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return Math.log(number); | |
| }; | |
| exports.LN10 = function() { | |
| return Math.log(10); | |
| }; | |
| exports.LN2 = function() { | |
| return Math.log(2); | |
| }; | |
| exports.LOG10E = function() { | |
| return Math.LOG10E; | |
| }; | |
| exports.LOG2E = function() { | |
| return Math.LOG2E; | |
| }; | |
| exports.LOG = function(number, base) { | |
| number = utils.parseNumber(number); | |
| base = utils.parseNumber(base); | |
| if (utils.anyIsError(number, base)) { | |
| return error.value; | |
| } | |
| base = (base === undefined) ? 10 : base; | |
| return Math.log(number) / Math.log(base); | |
| }; | |
| exports.LOG10 = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return Math.log(number) / Math.log(10); | |
| }; | |
| exports.MOD = function(dividend, divisor) { | |
| dividend = utils.parseNumber(dividend); | |
| divisor = utils.parseNumber(divisor); | |
| if (utils.anyIsError(dividend, divisor)) { | |
| return error.value; | |
| } | |
| if (divisor === 0) { | |
| return error.div0; | |
| } | |
| var modulus = Math.abs(dividend % divisor); | |
| return (divisor > 0) ? modulus : -modulus; | |
| }; | |
| exports.MROUND = function(number, multiple) { | |
| number = utils.parseNumber(number); | |
| multiple = utils.parseNumber(multiple); | |
| if (utils.anyIsError(number, multiple)) { | |
| return error.value; | |
| } | |
| if (number * multiple < 0) { | |
| return error.num; | |
| } | |
| return Math.round(number / multiple) * multiple; | |
| }; | |
| exports.MULTINOMIAL = function() { | |
| var args = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (args instanceof Error) { | |
| return args; | |
| } | |
| var sum = 0; | |
| var divisor = 1; | |
| for (var i = 0; i < args.length; i++) { | |
| sum += args[i]; | |
| divisor *= exports.FACT(args[i]); | |
| } | |
| return exports.FACT(sum) / divisor; | |
| }; | |
| exports.ODD = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var temp = Math.ceil(Math.abs(number)); | |
| temp = (temp & 1) ? temp : temp + 1; | |
| return (number > 0) ? temp : -temp; | |
| }; | |
| exports.PI = function() { | |
| return Math.PI; | |
| }; | |
| exports.E = function() { | |
| return Math.E; | |
| }; | |
| exports.POWER = function(number, power) { | |
| number = utils.parseNumber(number); | |
| power = utils.parseNumber(power); | |
| if (utils.anyIsError(number, power)) { | |
| return error.value; | |
| } | |
| var result = Math.pow(number, power); | |
| if (isNaN(result)) { | |
| return error.num; | |
| } | |
| return result; | |
| }; | |
| exports.PRODUCT = function() { | |
| var args = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (args instanceof Error) { | |
| return args; | |
| } | |
| var result = 1; | |
| for (var i = 0; i < args.length; i++) { | |
| result *= args[i]; | |
| } | |
| return result; | |
| }; | |
| exports.QUOTIENT = function(numerator, denominator) { | |
| numerator = utils.parseNumber(numerator); | |
| denominator = utils.parseNumber(denominator); | |
| if (utils.anyIsError(numerator, denominator)) { | |
| return error.value; | |
| } | |
| return parseInt(numerator / denominator, 10); | |
| }; | |
| exports.RADIANS = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return number * Math.PI / 180; | |
| }; | |
| exports.RAND = function() { | |
| return Math.random(); | |
| }; | |
| exports.RANDBETWEEN = function(bottom, top) { | |
| bottom = utils.parseNumber(bottom); | |
| top = utils.parseNumber(top); | |
| if (utils.anyIsError(bottom, top)) { | |
| return error.value; | |
| } | |
| // Creative Commons Attribution 3.0 License | |
| // Copyright (c) 2012 eqcode | |
| return bottom + Math.ceil((top - bottom + 1) * Math.random()) - 1; | |
| }; | |
| // TODO | |
| exports.ROMAN = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| // The MIT License | |
| // Copyright (c) 2008 Steven Levithan | |
| var digits = String(number).split(''); | |
| var key = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']; | |
| var roman = ''; | |
| var i = 3; | |
| while (i--) { | |
| roman = (key[+digits.pop() + (i * 10)] || '') + roman; | |
| } | |
| return new Array(+digits.join('') + 1).join('M') + roman; | |
| }; | |
| exports.ROUND = function(number, digits) { | |
| number = utils.parseNumber(number); | |
| digits = utils.parseNumber(digits); | |
| if (utils.anyIsError(number, digits)) { | |
| return error.value; | |
| } | |
| return Math.round(number * Math.pow(10, digits)) / Math.pow(10, digits); | |
| }; | |
| exports.ROUNDDOWN = function(number, digits) { | |
| number = utils.parseNumber(number); | |
| digits = utils.parseNumber(digits); | |
| if (utils.anyIsError(number, digits)) { | |
| return error.value; | |
| } | |
| var sign = (number > 0) ? 1 : -1; | |
| return sign * (Math.floor(Math.abs(number) * Math.pow(10, digits))) / Math.pow(10, digits); | |
| }; | |
| exports.ROUNDUP = function(number, digits) { | |
| number = utils.parseNumber(number); | |
| digits = utils.parseNumber(digits); | |
| if (utils.anyIsError(number, digits)) { | |
| return error.value; | |
| } | |
| var sign = (number > 0) ? 1 : -1; | |
| return sign * (Math.ceil(Math.abs(number) * Math.pow(10, digits))) / Math.pow(10, digits); | |
| }; | |
| exports.SEC = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return 1 / Math.cos(number); | |
| }; | |
| exports.SECH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return 2 / (Math.exp(number) + Math.exp(-number)); | |
| }; | |
| exports.SERIESSUM = function(x, n, m, coefficients) { | |
| x = utils.parseNumber(x); | |
| n = utils.parseNumber(n); | |
| m = utils.parseNumber(m); | |
| coefficients = utils.parseNumberArray(coefficients); | |
| if (utils.anyIsError(x, n, m, coefficients)) { | |
| return error.value; | |
| } | |
| var result = coefficients[0] * Math.pow(x, n); | |
| for (var i = 1; i < coefficients.length; i++) { | |
| result += coefficients[i] * Math.pow(x, n + i * m); | |
| } | |
| return result; | |
| }; | |
| exports.SIGN = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| if (number < 0) { | |
| return -1; | |
| } else if (number === 0) { | |
| return 0; | |
| } else { | |
| return 1; | |
| } | |
| }; | |
| exports.SIN = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return Math.sin(number); | |
| }; | |
| exports.SINH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return (Math.exp(number) - Math.exp(-number)) / 2; | |
| }; | |
| exports.SQRT = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| if (number < 0) { | |
| return error.num; | |
| } | |
| return Math.sqrt(number); | |
| }; | |
| exports.SQRTPI = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return Math.sqrt(number * Math.PI); | |
| }; | |
| exports.SQRT1_2 = function() { | |
| return 1 / Math.sqrt(2); | |
| }; | |
| exports.SQRT2 = function() { | |
| return Math.sqrt(2); | |
| }; | |
| exports.SUBTOTAL = function(function_code, ref1) { | |
| function_code = utils.parseNumber(function_code); | |
| if (function_code instanceof Error) { | |
| return function_code; | |
| } | |
| switch (function_code) { | |
| case 1: | |
| return statistical.AVERAGE(ref1); | |
| case 2: | |
| return statistical.COUNT(ref1); | |
| case 3: | |
| return statistical.COUNTA(ref1); | |
| case 4: | |
| return statistical.MAX(ref1); | |
| case 5: | |
| return statistical.MIN(ref1); | |
| case 6: | |
| return exports.PRODUCT(ref1); | |
| case 7: | |
| return statistical.STDEV.S(ref1); | |
| case 8: | |
| return statistical.STDEV.P(ref1); | |
| case 9: | |
| return exports.SUM(ref1); | |
| case 10: | |
| return statistical.VAR.S(ref1); | |
| case 11: | |
| return statistical.VAR.P(ref1); | |
| // no hidden values for us | |
| case 101: | |
| return statistical.AVERAGE(ref1); | |
| case 102: | |
| return statistical.COUNT(ref1); | |
| case 103: | |
| return statistical.COUNTA(ref1); | |
| case 104: | |
| return statistical.MAX(ref1); | |
| case 105: | |
| return statistical.MIN(ref1); | |
| case 106: | |
| return exports.PRODUCT(ref1); | |
| case 107: | |
| return statistical.STDEV.S(ref1); | |
| case 108: | |
| return statistical.STDEV.P(ref1); | |
| case 109: | |
| return exports.SUM(ref1); | |
| case 110: | |
| return statistical.VAR.S(ref1); | |
| case 111: | |
| return statistical.VAR.P(ref1); | |
| } | |
| }; | |
| exports.ADD = function (num1, num2) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| num1 = utils.parseNumber(num1); | |
| num2 = utils.parseNumber(num2); | |
| if (utils.anyIsError(num1, num2)) { | |
| return error.value; | |
| } | |
| return num1 + num2; | |
| }; | |
| exports.MINUS = function (num1, num2) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| num1 = utils.parseNumber(num1); | |
| num2 = utils.parseNumber(num2); | |
| if (utils.anyIsError(num1, num2)) { | |
| return error.value; | |
| } | |
| return num1 - num2; | |
| }; | |
| exports.DIVIDE = function (dividend, divisor) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| dividend = utils.parseNumber(dividend); | |
| divisor = utils.parseNumber(divisor); | |
| if (utils.anyIsError(dividend, divisor)) { | |
| return error.value; | |
| } | |
| if (divisor === 0) { | |
| return error.div0; | |
| } | |
| return dividend / divisor; | |
| }; | |
| exports.MULTIPLY = function (factor1, factor2) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| factor1 = utils.parseNumber(factor1); | |
| factor2 = utils.parseNumber(factor2); | |
| if (utils.anyIsError(factor1, factor2)) { | |
| return error.value; | |
| } | |
| return factor1 * factor2; | |
| }; | |
| exports.GTE = function (num1, num2) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| num1 = utils.parseNumber(num1); | |
| num2 = utils.parseNumber(num2); | |
| if (utils.anyIsError(num1, num2)) { | |
| return error.error; | |
| } | |
| return num1 >= num2; | |
| }; | |
| exports.LT = function (num1, num2) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| num1 = utils.parseNumber(num1); | |
| num2 = utils.parseNumber(num2); | |
| if (utils.anyIsError(num1, num2)) { | |
| return error.error; | |
| } | |
| return num1 < num2; | |
| }; | |
| exports.LTE = function (num1, num2) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| num1 = utils.parseNumber(num1); | |
| num2 = utils.parseNumber(num2); | |
| if (utils.anyIsError(num1, num2)) { | |
| return error.error; | |
| } | |
| return num1 <= num2; | |
| }; | |
| exports.EQ = function (value1, value2) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| return value1 === value2; | |
| }; | |
| exports.NE = function (value1, value2) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| return value1 !== value2; | |
| }; | |
| exports.POW = function (base, exponent) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| base = utils.parseNumber(base); | |
| exponent = utils.parseNumber(exponent); | |
| if (utils.anyIsError(base, exponent)) { | |
| return error.error; | |
| } | |
| return exports.POWER(base, exponent); | |
| }; | |
| exports.SUM = function() { | |
| var result = 0; | |
| utils.arrayEach(utils.argsToArray(arguments), function(value) { | |
| if (typeof value === 'number') { | |
| result += value; | |
| } else if (typeof value === 'string') { | |
| var parsed = parseFloat(value); | |
| !isNaN(parsed) && (result += parsed); | |
| } else if (Array.isArray(value)) { | |
| result += exports.SUM.apply(null, value); | |
| } | |
| }); | |
| return result; | |
| }; | |
| exports.SUMIF = function(range, criteria) { | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| var result = 0; | |
| var isWildcard = criteria === void 0 || criteria === '*'; | |
| var tokenizedCriteria = isWildcard ? null : evalExpression.parse(criteria + ''); | |
| for (var i = 0; i < range.length; i++) { | |
| var value = range[i]; | |
| if (isWildcard) { | |
| result += value; | |
| } else { | |
| var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria); | |
| result += (evalExpression.compute(tokens) ? value : 0); | |
| } | |
| } | |
| return result; | |
| }; | |
| exports.SUMIFS = function() { | |
| var args = utils.argsToArray(arguments); | |
| var range = utils.parseNumberArray(utils.flatten(args.shift())); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| var criterias = args; | |
| var n_range_elements = range.length; | |
| var criteriaLength = criterias.length; | |
| var result = 0; | |
| for (var i = 0; i < n_range_elements; i++) { | |
| var value = range[i]; | |
| var isMeetCondition = false; | |
| for (var j = 0; j < criteriaLength; j++) { | |
| var criteria = criterias[j]; | |
| var isWildcard = criteria === void 0 || criteria === '*'; | |
| var computedResult = false; | |
| if (isWildcard) { | |
| computedResult = true; | |
| } else { | |
| var tokenizedCriteria = evalExpression.parse(criteria + ''); | |
| var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria); | |
| computedResult = evalExpression.compute(tokens); | |
| } | |
| // Criterias are calculated as AND so any `false` breakes the loop as unmeet condition | |
| if (!computedResult) { | |
| isMeetCondition = false; | |
| break; | |
| } | |
| isMeetCondition = true; | |
| } | |
| if (isMeetCondition) { | |
| result += value; | |
| } | |
| } | |
| return result; | |
| }; | |
| exports.SUMPRODUCT = function() { | |
| if (!arguments || arguments.length === 0) { | |
| return error.value; | |
| } | |
| var arrays = arguments.length + 1; | |
| var result = 0; | |
| var product; | |
| var k; | |
| var _i; | |
| var _ij; | |
| for (var i = 0; i < arguments[0].length; i++) { | |
| if (!(arguments[0][i] instanceof Array)) { | |
| product = 1; | |
| for (k = 1; k < arrays; k++) { | |
| _i = utils.parseNumber(arguments[k - 1][i]); | |
| if (_i instanceof Error) { | |
| return _i; | |
| } | |
| product *= _i; | |
| } | |
| result += product; | |
| } else { | |
| for (var j = 0; j < arguments[0][i].length; j++) { | |
| product = 1; | |
| for (k = 1; k < arrays; k++) { | |
| _ij = utils.parseNumber(arguments[k - 1][i][j]); | |
| if (_ij instanceof Error) { | |
| return _ij; | |
| } | |
| product *= _ij; | |
| } | |
| result += product; | |
| } | |
| } | |
| } | |
| return result; | |
| }; | |
| exports.SUMSQ = function() { | |
| var numbers = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (numbers instanceof Error) { | |
| return numbers; | |
| } | |
| var result = 0; | |
| var length = numbers.length; | |
| for (var i = 0; i < length; i++) { | |
| result += (information.ISNUMBER(numbers[i])) ? numbers[i] * numbers[i] : 0; | |
| } | |
| return result; | |
| }; | |
| exports.SUMX2MY2 = function(array_x, array_y) { | |
| array_x = utils.parseNumberArray(utils.flatten(array_x)); | |
| array_y = utils.parseNumberArray(utils.flatten(array_y)); | |
| if (utils.anyIsError(array_x, array_y)) { | |
| return error.value; | |
| } | |
| var result = 0; | |
| for (var i = 0; i < array_x.length; i++) { | |
| result += array_x[i] * array_x[i] - array_y[i] * array_y[i]; | |
| } | |
| return result; | |
| }; | |
| exports.SUMX2PY2 = function(array_x, array_y) { | |
| array_x = utils.parseNumberArray(utils.flatten(array_x)); | |
| array_y = utils.parseNumberArray(utils.flatten(array_y)); | |
| if (utils.anyIsError(array_x, array_y)) { | |
| return error.value; | |
| } | |
| var result = 0; | |
| array_x = utils.parseNumberArray(utils.flatten(array_x)); | |
| array_y = utils.parseNumberArray(utils.flatten(array_y)); | |
| for (var i = 0; i < array_x.length; i++) { | |
| result += array_x[i] * array_x[i] + array_y[i] * array_y[i]; | |
| } | |
| return result; | |
| }; | |
| exports.SUMXMY2 = function(array_x, array_y) { | |
| array_x = utils.parseNumberArray(utils.flatten(array_x)); | |
| array_y = utils.parseNumberArray(utils.flatten(array_y)); | |
| if (utils.anyIsError(array_x, array_y)) { | |
| return error.value; | |
| } | |
| var result = 0; | |
| array_x = utils.flatten(array_x); | |
| array_y = utils.flatten(array_y); | |
| for (var i = 0; i < array_x.length; i++) { | |
| result += Math.pow(array_x[i] - array_y[i], 2); | |
| } | |
| return result; | |
| }; | |
| exports.TAN = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return Math.tan(number); | |
| }; | |
| exports.TANH = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| var e2 = Math.exp(2 * number); | |
| return (e2 - 1) / (e2 + 1); | |
| }; | |
| exports.TRUNC = function(number, digits) { | |
| digits = (digits === undefined) ? 0 : digits; | |
| number = utils.parseNumber(number); | |
| digits = utils.parseNumber(digits); | |
| if (utils.anyIsError(number, digits)) { | |
| return error.value; | |
| } | |
| var sign = (number > 0) ? 1 : -1; | |
| return sign * (Math.floor(Math.abs(number) * Math.pow(10, digits))) / Math.pow(10, digits); | |
| }; | |
| /***/ }), | |
| /* 171 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var mathTrig = __webpack_require__(170); | |
| var text = __webpack_require__(223); | |
| var jStat = __webpack_require__(464); | |
| var utils = __webpack_require__(86); | |
| var evalExpression = __webpack_require__(224); | |
| var error = __webpack_require__(80); | |
| var misc = __webpack_require__(465); | |
| var SQRT2PI = 2.5066282746310002; | |
| exports.AVEDEV = function() { | |
| var range = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| return jStat.sum(jStat(range).subtract(jStat.mean(range)).abs()[0]) / range.length; | |
| }; | |
| exports.AVERAGE = function() { | |
| var range = utils.numbers(utils.flatten(arguments)); | |
| var n = range.length; | |
| var sum = 0; | |
| var count = 0; | |
| var result; | |
| for (var i = 0; i < n; i++) { | |
| sum += range[i]; | |
| count += 1; | |
| } | |
| result = sum / count; | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.AVERAGEA = function() { | |
| var range = utils.flatten(arguments); | |
| var n = range.length; | |
| var sum = 0; | |
| var count = 0; | |
| var result; | |
| for (var i = 0; i < n; i++) { | |
| var el = range[i]; | |
| if (typeof el === 'number') { | |
| sum += el; | |
| } | |
| if (el === true) { | |
| sum++; | |
| } | |
| if (el !== null) { | |
| count++; | |
| } | |
| } | |
| result = sum / count; | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.AVERAGEIF = function(range, criteria, average_range) { | |
| if (arguments.length <= 1) { | |
| return error.na; | |
| } | |
| average_range = average_range || range; | |
| range = utils.flatten(range); | |
| average_range = utils.parseNumberArray(utils.flatten(average_range)); | |
| if (average_range instanceof Error) { | |
| return average_range; | |
| } | |
| var average_count = 0; | |
| var result = 0; | |
| var isWildcard = criteria === void 0 || criteria === '*'; | |
| var tokenizedCriteria = isWildcard ? null : evalExpression.parse(criteria + ''); | |
| for (var i = 0; i < range.length; i++) { | |
| var value = range[i]; | |
| if (isWildcard) { | |
| result += average_range[i]; | |
| average_count++; | |
| } else { | |
| var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria); | |
| if (evalExpression.compute(tokens)) { | |
| result += average_range[i]; | |
| average_count++; | |
| } | |
| } | |
| } | |
| return result / average_count; | |
| }; | |
| exports.AVERAGEIFS = function() { | |
| // Does not work with multi dimensional ranges yet! | |
| //http://office.microsoft.com/en-001/excel-help/averageifs-function-HA010047493.aspx | |
| var args = utils.argsToArray(arguments); | |
| var criteriaLength = (args.length - 1) / 2; | |
| var range = utils.flatten(args[0]); | |
| var count = 0; | |
| var result = 0; | |
| for (var i = 0; i < range.length; i++) { | |
| var isMeetCondition = false; | |
| for (var j = 0; j < criteriaLength; j++) { | |
| var value = args[2 * j + 1][i]; | |
| var criteria = args[2 * j + 2]; | |
| var isWildcard = criteria === void 0 || criteria === '*'; | |
| var computedResult = false; | |
| if (isWildcard) { | |
| computedResult = true; | |
| } else { | |
| var tokenizedCriteria = evalExpression.parse(criteria + ''); | |
| var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria); | |
| computedResult = evalExpression.compute(tokens); | |
| } | |
| // Criterias are calculated as AND so any `false` breakes the loop as unmeet condition | |
| if (!computedResult) { | |
| isMeetCondition = false; | |
| break; | |
| } | |
| isMeetCondition = true; | |
| } | |
| if (isMeetCondition) { | |
| result += range[i]; | |
| count++; | |
| } | |
| } | |
| var average = result / count; | |
| if (isNaN(average)) { | |
| return 0; | |
| } else { | |
| return average; | |
| } | |
| }; | |
| exports.BETA = {}; | |
| exports.BETA.DIST = function(x, alpha, beta, cumulative, A, B) { | |
| if (arguments.length < 4) { | |
| return error.value; | |
| } | |
| A = (A === undefined) ? 0 : A; | |
| B = (B === undefined) ? 1 : B; | |
| x = utils.parseNumber(x); | |
| alpha = utils.parseNumber(alpha); | |
| beta = utils.parseNumber(beta); | |
| A = utils.parseNumber(A); | |
| B = utils.parseNumber(B); | |
| if (utils.anyIsError(x, alpha, beta, A, B)) { | |
| return error.value; | |
| } | |
| x = (x - A) / (B - A); | |
| return (cumulative) ? jStat.beta.cdf(x, alpha, beta) : jStat.beta.pdf(x, alpha, beta); | |
| }; | |
| exports.BETA.INV = function(probability, alpha, beta, A, B) { | |
| A = (A === undefined) ? 0 : A; | |
| B = (B === undefined) ? 1 : B; | |
| probability = utils.parseNumber(probability); | |
| alpha = utils.parseNumber(alpha); | |
| beta = utils.parseNumber(beta); | |
| A = utils.parseNumber(A); | |
| B = utils.parseNumber(B); | |
| if (utils.anyIsError(probability, alpha, beta, A, B)) { | |
| return error.value; | |
| } | |
| return jStat.beta.inv(probability, alpha, beta) * (B - A) + A; | |
| }; | |
| exports.BINOM = {}; | |
| exports.BINOM.DIST = function(successes, trials, probability, cumulative) { | |
| successes = utils.parseNumber(successes); | |
| trials = utils.parseNumber(trials); | |
| probability = utils.parseNumber(probability); | |
| cumulative = utils.parseNumber(cumulative); | |
| if (utils.anyIsError(successes, trials, probability, cumulative)) { | |
| return error.value; | |
| } | |
| return (cumulative) ? jStat.binomial.cdf(successes, trials, probability) : jStat.binomial.pdf(successes, trials, probability); | |
| }; | |
| exports.BINOM.DIST.RANGE = function(trials, probability, successes, successes2) { | |
| successes2 = (successes2 === undefined) ? successes : successes2; | |
| trials = utils.parseNumber(trials); | |
| probability = utils.parseNumber(probability); | |
| successes = utils.parseNumber(successes); | |
| successes2 = utils.parseNumber(successes2); | |
| if (utils.anyIsError(trials, probability, successes, successes2)) { | |
| return error.value; | |
| } | |
| var result = 0; | |
| for (var i = successes; i <= successes2; i++) { | |
| result += mathTrig.COMBIN(trials, i) * Math.pow(probability, i) * Math.pow(1 - probability, trials - i); | |
| } | |
| return result; | |
| }; | |
| exports.BINOM.INV = function(trials, probability, alpha) { | |
| trials = utils.parseNumber(trials); | |
| probability = utils.parseNumber(probability); | |
| alpha = utils.parseNumber(alpha); | |
| if (utils.anyIsError(trials, probability, alpha)) { | |
| return error.value; | |
| } | |
| var x = 0; | |
| while (x <= trials) { | |
| if (jStat.binomial.cdf(x, trials, probability) >= alpha) { | |
| return x; | |
| } | |
| x++; | |
| } | |
| }; | |
| exports.CHISQ = {}; | |
| exports.CHISQ.DIST = function(x, k, cumulative) { | |
| x = utils.parseNumber(x); | |
| k = utils.parseNumber(k); | |
| if (utils.anyIsError(x, k)) { | |
| return error.value; | |
| } | |
| return (cumulative) ? jStat.chisquare.cdf(x, k) : jStat.chisquare.pdf(x, k); | |
| }; | |
| exports.CHISQ.DIST.RT = function(x, k) { | |
| if (!x | !k) { | |
| return error.na; | |
| } | |
| if (x < 1 || k > Math.pow(10, 10)) { | |
| return error.num; | |
| } | |
| if ((typeof x !== 'number') || (typeof k !== 'number')) { | |
| return error.value; | |
| } | |
| return 1 - jStat.chisquare.cdf(x, k); | |
| }; | |
| exports.CHISQ.INV = function(probability, k) { | |
| probability = utils.parseNumber(probability); | |
| k = utils.parseNumber(k); | |
| if (utils.anyIsError(probability, k)) { | |
| return error.value; | |
| } | |
| return jStat.chisquare.inv(probability, k); | |
| }; | |
| exports.CHISQ.INV.RT = function(p, k) { | |
| if (!p | !k) { | |
| return error.na; | |
| } | |
| if (p < 0 || p > 1 || k < 1 || k > Math.pow(10, 10)) { | |
| return error.num; | |
| } | |
| if ((typeof p !== 'number') || (typeof k !== 'number')) { | |
| return error.value; | |
| } | |
| return jStat.chisquare.inv(1.0 - p, k); | |
| }; | |
| exports.CHISQ.TEST = function(observed, expected) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| if ((!(observed instanceof Array)) || (!(expected instanceof Array))) { | |
| return error.value; | |
| } | |
| if (observed.length !== expected.length) { | |
| return error.value; | |
| } | |
| if (observed[0] && expected[0] && | |
| observed[0].length !== expected[0].length) { | |
| return error.value; | |
| } | |
| var row = observed.length; | |
| var tmp, i, j; | |
| // Convert single-dimension array into two-dimension array | |
| for (i = 0; i < row; i ++) { | |
| if (!(observed[i] instanceof Array)) { | |
| tmp = observed[i]; | |
| observed[i] = []; | |
| observed[i].push(tmp); | |
| } | |
| if (!(expected[i] instanceof Array)) { | |
| tmp = expected[i]; | |
| expected[i] = []; | |
| expected[i].push(tmp); | |
| } | |
| } | |
| var col = observed[0].length; | |
| var dof = (col === 1) ? row-1 : (row-1)*(col-1); | |
| var xsqr = 0; | |
| var Pi =Math.PI; | |
| for (i = 0; i < row; i ++) { | |
| for (j = 0; j < col; j ++) { | |
| xsqr += Math.pow((observed[i][j] - expected[i][j]), 2) / expected[i][j]; | |
| } | |
| } | |
| // Get independency by X square and its degree of freedom | |
| function ChiSq(xsqr, dof) { | |
| var p = Math.exp(-0.5 * xsqr); | |
| if((dof%2) === 1) { | |
| p = p * Math.sqrt(2 * xsqr/Pi); | |
| } | |
| var k = dof; | |
| while(k >= 2) { | |
| p = p * xsqr/k; | |
| k = k - 2; | |
| } | |
| var t = p; | |
| var a = dof; | |
| while (t > 0.0000000001*p) { | |
| a = a + 2; | |
| t = t * xsqr/a; | |
| p = p + t; | |
| } | |
| return 1-p; | |
| } | |
| return Math.round(ChiSq(xsqr, dof) * 1000000) / 1000000; | |
| }; | |
| exports.COLUMN = function(matrix, index) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| if (index < 0) { | |
| return error.num; | |
| } | |
| if (!(matrix instanceof Array) || (typeof index !== 'number')) { | |
| return error.value; | |
| } | |
| if (matrix.length === 0) { | |
| return undefined; | |
| } | |
| return jStat.col(matrix, index); | |
| }; | |
| exports.COLUMNS = function(matrix) { | |
| if (arguments.length !== 1) { | |
| return error.na; | |
| } | |
| if (!(matrix instanceof Array)) { | |
| return error.value; | |
| } | |
| if (matrix.length === 0) { | |
| return 0; | |
| } | |
| return jStat.cols(matrix); | |
| }; | |
| exports.CONFIDENCE = {}; | |
| exports.CONFIDENCE.NORM = function(alpha, sd, n) { | |
| alpha = utils.parseNumber(alpha); | |
| sd = utils.parseNumber(sd); | |
| n = utils.parseNumber(n); | |
| if (utils.anyIsError(alpha, sd, n)) { | |
| return error.value; | |
| } | |
| return jStat.normalci(1, alpha, sd, n)[1] - 1; | |
| }; | |
| exports.CONFIDENCE.T = function(alpha, sd, n) { | |
| alpha = utils.parseNumber(alpha); | |
| sd = utils.parseNumber(sd); | |
| n = utils.parseNumber(n); | |
| if (utils.anyIsError(alpha, sd, n)) { | |
| return error.value; | |
| } | |
| return jStat.tci(1, alpha, sd, n)[1] - 1; | |
| }; | |
| exports.CORREL = function(array1, array2) { | |
| array1 = utils.parseNumberArray(utils.flatten(array1)); | |
| array2 = utils.parseNumberArray(utils.flatten(array2)); | |
| if (utils.anyIsError(array1, array2)) { | |
| return error.value; | |
| } | |
| return jStat.corrcoeff(array1, array2); | |
| }; | |
| exports.COUNT = function() { | |
| return utils.numbers(utils.flatten(arguments)).length; | |
| }; | |
| exports.COUNTA = function() { | |
| var range = utils.flatten(arguments); | |
| return range.length - exports.COUNTBLANK(range); | |
| }; | |
| exports.COUNTIN = function (range, value) { | |
| var result = 0; | |
| range = utils.flatten(range); | |
| for (var i = 0; i < range.length; i++) { | |
| if (range[i] === value) { | |
| result++; | |
| } | |
| } | |
| return result; | |
| }; | |
| exports.COUNTBLANK = function() { | |
| var range = utils.flatten(arguments); | |
| var blanks = 0; | |
| var element; | |
| for (var i = 0; i < range.length; i++) { | |
| element = range[i]; | |
| if (element === null || element === '') { | |
| blanks++; | |
| } | |
| } | |
| return blanks; | |
| }; | |
| exports.COUNTIF = function(range, criteria) { | |
| range = utils.flatten(range); | |
| var isWildcard = criteria === void 0 || criteria === '*'; | |
| if (isWildcard) { | |
| return range.length; | |
| } | |
| var matches = 0; | |
| var tokenizedCriteria = evalExpression.parse(criteria + ''); | |
| for (var i = 0; i < range.length; i++) { | |
| var value = range[i]; | |
| var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria); | |
| if (evalExpression.compute(tokens)) { | |
| matches++; | |
| } | |
| } | |
| return matches; | |
| }; | |
| exports.COUNTIFS = function() { | |
| var args = utils.argsToArray(arguments); | |
| var results = new Array(utils.flatten(args[0]).length); | |
| for (var i = 0; i < results.length; i++) { | |
| results[i] = true; | |
| } | |
| for (i = 0; i < args.length; i += 2) { | |
| var range = utils.flatten(args[i]); | |
| var criteria = args[i + 1]; | |
| var isWildcard = criteria === void 0 || criteria === '*'; | |
| if (!isWildcard) { | |
| var tokenizedCriteria = evalExpression.parse(criteria + ''); | |
| for (var j = 0; j < range.length; j++) { | |
| var value = range[j]; | |
| var tokens = [evalExpression.createToken(value, evalExpression.TOKEN_TYPE_LITERAL)].concat(tokenizedCriteria); | |
| results[j] = results[j] && evalExpression.compute(tokens); | |
| } | |
| } | |
| } | |
| var result = 0; | |
| for (i = 0; i < results.length; i++) { | |
| if (results[i]) { | |
| result++; | |
| } | |
| } | |
| return result; | |
| }; | |
| exports.COUNTUNIQUE = function () { | |
| return misc.UNIQUE.apply(null, utils.flatten(arguments)).length; | |
| }; | |
| exports.COVARIANCE = {}; | |
| exports.COVARIANCE.P = function(array1, array2) { | |
| array1 = utils.parseNumberArray(utils.flatten(array1)); | |
| array2 = utils.parseNumberArray(utils.flatten(array2)); | |
| if (utils.anyIsError(array1, array2)) { | |
| return error.value; | |
| } | |
| var mean1 = jStat.mean(array1); | |
| var mean2 = jStat.mean(array2); | |
| var result = 0; | |
| var n = array1.length; | |
| for (var i = 0; i < n; i++) { | |
| result += (array1[i] - mean1) * (array2[i] - mean2); | |
| } | |
| return result / n; | |
| }; | |
| exports.COVARIANCE.S = function(array1, array2) { | |
| array1 = utils.parseNumberArray(utils.flatten(array1)); | |
| array2 = utils.parseNumberArray(utils.flatten(array2)); | |
| if (utils.anyIsError(array1, array2)) { | |
| return error.value; | |
| } | |
| return jStat.covariance(array1, array2); | |
| }; | |
| exports.DEVSQ = function() { | |
| var range = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| var mean = jStat.mean(range); | |
| var result = 0; | |
| for (var i = 0; i < range.length; i++) { | |
| result += Math.pow((range[i] - mean), 2); | |
| } | |
| return result; | |
| }; | |
| exports.EXPON = {}; | |
| exports.EXPON.DIST = function(x, lambda, cumulative) { | |
| x = utils.parseNumber(x); | |
| lambda = utils.parseNumber(lambda); | |
| if (utils.anyIsError(x, lambda)) { | |
| return error.value; | |
| } | |
| return (cumulative) ? jStat.exponential.cdf(x, lambda) : jStat.exponential.pdf(x, lambda); | |
| }; | |
| exports.F = {}; | |
| exports.F.DIST = function(x, d1, d2, cumulative) { | |
| x = utils.parseNumber(x); | |
| d1 = utils.parseNumber(d1); | |
| d2 = utils.parseNumber(d2); | |
| if (utils.anyIsError(x, d1, d2)) { | |
| return error.value; | |
| } | |
| return (cumulative) ? jStat.centralF.cdf(x, d1, d2) : jStat.centralF.pdf(x, d1, d2); | |
| }; | |
| exports.F.DIST.RT = function(x, d1, d2) { | |
| if (arguments.length !== 3) { | |
| return error.na; | |
| } | |
| if (x < 0 || d1 < 1 || d2 < 1) { | |
| return error.num; | |
| } | |
| if ((typeof x !== 'number') || (typeof d1 !== 'number') || (typeof d2 !== 'number')) { | |
| return error.value; | |
| } | |
| return 1 - jStat.centralF.cdf(x, d1, d2); | |
| }; | |
| exports.F.INV = function(probability, d1, d2) { | |
| probability = utils.parseNumber(probability); | |
| d1 = utils.parseNumber(d1); | |
| d2 = utils.parseNumber(d2); | |
| if (utils.anyIsError(probability, d1, d2)) { | |
| return error.value; | |
| } | |
| if (probability <= 0.0 || probability > 1.0) { | |
| return error.num; | |
| } | |
| return jStat.centralF.inv(probability, d1, d2); | |
| }; | |
| exports.F.INV.RT = function(p, d1, d2) { | |
| if (arguments.length !== 3) { | |
| return error.na; | |
| } | |
| if (p < 0 || p > 1 || d1 < 1 || d1 > Math.pow(10, 10) || d2 < 1 || d2 > Math.pow(10, 10)) { | |
| return error.num; | |
| } | |
| if ((typeof p !== 'number') || (typeof d1 !== 'number') || (typeof d2 !== 'number')) { | |
| return error.value; | |
| } | |
| return jStat.centralF.inv(1.0 - p, d1, d2); | |
| }; | |
| exports.F.TEST = function(array1, array2) { | |
| if (!array1 || !array2) { | |
| return error.na; | |
| } | |
| if (!(array1 instanceof Array) || !(array2 instanceof Array)) { | |
| return error.na; | |
| } | |
| if (array1.length < 2 || array2.length < 2) { | |
| return error.div0; | |
| } | |
| var sumOfSquares = function(values, x1) { | |
| var sum = 0; | |
| for (var i = 0; i < values.length; i++) { | |
| sum +=Math.pow((values[i] - x1), 2); | |
| } | |
| return sum; | |
| }; | |
| var x1 = mathTrig.SUM(array1) / array1.length; | |
| var x2 = mathTrig.SUM(array2) / array2.length; | |
| var sum1 = sumOfSquares(array1, x1) / (array1.length - 1); | |
| var sum2 = sumOfSquares(array2, x2) / (array2.length - 1); | |
| return sum1 / sum2; | |
| }; | |
| exports.FISHER = function(x) { | |
| x = utils.parseNumber(x); | |
| if (x instanceof Error) { | |
| return x; | |
| } | |
| return Math.log((1 + x) / (1 - x)) / 2; | |
| }; | |
| exports.FISHERINV = function(y) { | |
| y = utils.parseNumber(y); | |
| if (y instanceof Error) { | |
| return y; | |
| } | |
| var e2y = Math.exp(2 * y); | |
| return (e2y - 1) / (e2y + 1); | |
| }; | |
| exports.FORECAST = function(x, data_y, data_x) { | |
| x = utils.parseNumber(x); | |
| data_y = utils.parseNumberArray(utils.flatten(data_y)); | |
| data_x = utils.parseNumberArray(utils.flatten(data_x)); | |
| if (utils.anyIsError(x, data_y, data_x)) { | |
| return error.value; | |
| } | |
| var xmean = jStat.mean(data_x); | |
| var ymean = jStat.mean(data_y); | |
| var n = data_x.length; | |
| var num = 0; | |
| var den = 0; | |
| for (var i = 0; i < n; i++) { | |
| num += (data_x[i] - xmean) * (data_y[i] - ymean); | |
| den += Math.pow(data_x[i] - xmean, 2); | |
| } | |
| var b = num / den; | |
| var a = ymean - b * xmean; | |
| return a + b * x; | |
| }; | |
| exports.FREQUENCY = function(data, bins) { | |
| data = utils.parseNumberArray(utils.flatten(data)); | |
| bins = utils.parseNumberArray(utils.flatten(bins)); | |
| if (utils.anyIsError(data, bins)) { | |
| return error.value; | |
| } | |
| var n = data.length; | |
| var b = bins.length; | |
| var r = []; | |
| for (var i = 0; i <= b; i++) { | |
| r[i] = 0; | |
| for (var j = 0; j < n; j++) { | |
| if (i === 0) { | |
| if (data[j] <= bins[0]) { | |
| r[0] += 1; | |
| } | |
| } else if (i < b) { | |
| if (data[j] > bins[i - 1] && data[j] <= bins[i]) { | |
| r[i] += 1; | |
| } | |
| } else if (i === b) { | |
| if (data[j] > bins[b - 1]) { | |
| r[b] += 1; | |
| } | |
| } | |
| } | |
| } | |
| return r; | |
| }; | |
| exports.GAMMA = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| if (number === 0) { | |
| return error.num; | |
| } | |
| if (parseInt(number, 10) === number && number < 0) { | |
| return error.num; | |
| } | |
| return jStat.gammafn(number); | |
| }; | |
| exports.GAMMA.DIST = function(value, alpha, beta, cumulative) { | |
| if (arguments.length !== 4) { | |
| return error.na; | |
| } | |
| if (value < 0 || alpha <= 0 || beta <= 0) { | |
| return error.value; | |
| } | |
| if ((typeof value !== 'number') || (typeof alpha !== 'number') || (typeof beta !== 'number')) { | |
| return error.value; | |
| } | |
| return cumulative ? jStat.gamma.cdf(value, alpha, beta, true) : jStat.gamma.pdf(value, alpha, beta, false); | |
| }; | |
| exports.GAMMA.INV = function(probability, alpha, beta) { | |
| if (arguments.length !== 3) { | |
| return error.na; | |
| } | |
| if (probability < 0 || probability > 1 || alpha <= 0 || beta <= 0) { | |
| return error.num; | |
| } | |
| if ((typeof probability !== 'number') || (typeof alpha !== 'number') || (typeof beta !== 'number')) { | |
| return error.value; | |
| } | |
| return jStat.gamma.inv(probability, alpha, beta); | |
| }; | |
| exports.GAMMALN = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return jStat.gammaln(number); | |
| }; | |
| exports.GAMMALN.PRECISE = function(x) { | |
| if (arguments.length !== 1) { | |
| return error.na; | |
| } | |
| if (x <= 0) { | |
| return error.num; | |
| } | |
| if (typeof x !== 'number') { | |
| return error.value; | |
| } | |
| return jStat.gammaln(x); | |
| }; | |
| exports.GAUSS = function(z) { | |
| z = utils.parseNumber(z); | |
| if (z instanceof Error) { | |
| return z; | |
| } | |
| return jStat.normal.cdf(z, 0, 1) - 0.5; | |
| }; | |
| exports.GEOMEAN = function() { | |
| var args = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (args instanceof Error) { | |
| return args; | |
| } | |
| return jStat.geomean(args); | |
| }; | |
| exports.GROWTH = function(known_y, known_x, new_x, use_const) { | |
| // Credits: Ilmari Karonen (http://stackoverflow.com/questions/14161990/how-to-implement-growth-function-in-javascript) | |
| known_y = utils.parseNumberArray(known_y); | |
| if (known_y instanceof Error) { | |
| return known_y; | |
| } | |
| // Default values for optional parameters: | |
| var i; | |
| if (known_x === undefined) { | |
| known_x = []; | |
| for (i = 1; i <= known_y.length; i++) { | |
| known_x.push(i); | |
| } | |
| } | |
| if (new_x === undefined) { | |
| new_x = []; | |
| for (i = 1; i <= known_y.length; i++) { | |
| new_x.push(i); | |
| } | |
| } | |
| known_x = utils.parseNumberArray(known_x); | |
| new_x = utils.parseNumberArray(new_x); | |
| if (utils.anyIsError(known_x, new_x)) { | |
| return error.value; | |
| } | |
| if (use_const === undefined) { | |
| use_const = true; | |
| } | |
| // Calculate sums over the data: | |
| var n = known_y.length; | |
| var avg_x = 0; | |
| var avg_y = 0; | |
| var avg_xy = 0; | |
| var avg_xx = 0; | |
| for (i = 0; i < n; i++) { | |
| var x = known_x[i]; | |
| var y = Math.log(known_y[i]); | |
| avg_x += x; | |
| avg_y += y; | |
| avg_xy += x * y; | |
| avg_xx += x * x; | |
| } | |
| avg_x /= n; | |
| avg_y /= n; | |
| avg_xy /= n; | |
| avg_xx /= n; | |
| // Compute linear regression coefficients: | |
| var beta; | |
| var alpha; | |
| if (use_const) { | |
| beta = (avg_xy - avg_x * avg_y) / (avg_xx - avg_x * avg_x); | |
| alpha = avg_y - beta * avg_x; | |
| } else { | |
| beta = avg_xy / avg_xx; | |
| alpha = 0; | |
| } | |
| // Compute and return result array: | |
| var new_y = []; | |
| for (i = 0; i < new_x.length; i++) { | |
| new_y.push(Math.exp(alpha + beta * new_x[i])); | |
| } | |
| return new_y; | |
| }; | |
| exports.HARMEAN = function() { | |
| var range = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| var n = range.length; | |
| var den = 0; | |
| for (var i = 0; i < n; i++) { | |
| den += 1 / range[i]; | |
| } | |
| return n / den; | |
| }; | |
| exports.HYPGEOM = {}; | |
| exports.HYPGEOM.DIST = function(x, n, M, N, cumulative) { | |
| x = utils.parseNumber(x); | |
| n = utils.parseNumber(n); | |
| M = utils.parseNumber(M); | |
| N = utils.parseNumber(N); | |
| if (utils.anyIsError(x, n, M, N)) { | |
| return error.value; | |
| } | |
| function pdf(x, n, M, N) { | |
| return mathTrig.COMBIN(M, x) * mathTrig.COMBIN(N - M, n - x) / mathTrig.COMBIN(N, n); | |
| } | |
| function cdf(x, n, M, N) { | |
| var result = 0; | |
| for (var i = 0; i <= x; i++) { | |
| result += pdf(i, n, M, N); | |
| } | |
| return result; | |
| } | |
| return (cumulative) ? cdf(x, n, M, N) : pdf(x, n, M, N); | |
| }; | |
| exports.INTERCEPT = function(known_y, known_x) { | |
| known_y = utils.parseNumberArray(known_y); | |
| known_x = utils.parseNumberArray(known_x); | |
| if (utils.anyIsError(known_y, known_x)) { | |
| return error.value; | |
| } | |
| if (known_y.length !== known_x.length) { | |
| return error.na; | |
| } | |
| return exports.FORECAST(0, known_y, known_x); | |
| }; | |
| exports.KURT = function() { | |
| var range = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| var mean = jStat.mean(range); | |
| var n = range.length; | |
| var sigma = 0; | |
| for (var i = 0; i < n; i++) { | |
| sigma += Math.pow(range[i] - mean, 4); | |
| } | |
| sigma = sigma / Math.pow(jStat.stdev(range, true), 4); | |
| return ((n * (n + 1)) / ((n - 1) * (n - 2) * (n - 3))) * sigma - 3 * (n - 1) * (n - 1) / ((n - 2) * (n - 3)); | |
| }; | |
| exports.LARGE = function(range, k) { | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| k = utils.parseNumber(k); | |
| if (utils.anyIsError(range, k)) { | |
| return range; | |
| } | |
| return range.sort(function(a, b) { | |
| return b - a; | |
| })[k - 1]; | |
| }; | |
| exports.LINEST = function(data_y, data_x) { | |
| data_y = utils.parseNumberArray(utils.flatten(data_y)); | |
| data_x = utils.parseNumberArray(utils.flatten(data_x)); | |
| if (utils.anyIsError(data_y, data_x)) { | |
| return error.value; | |
| } | |
| var ymean = jStat.mean(data_y); | |
| var xmean = jStat.mean(data_x); | |
| var n = data_x.length; | |
| var num = 0; | |
| var den = 0; | |
| for (var i = 0; i < n; i++) { | |
| num += (data_x[i] - xmean) * (data_y[i] - ymean); | |
| den += Math.pow(data_x[i] - xmean, 2); | |
| } | |
| var m = num / den; | |
| var b = ymean - m * xmean; | |
| return [m, b]; | |
| }; | |
| // According to Microsoft: | |
| // http://office.microsoft.com/en-us/starter-help/logest-function-HP010342665.aspx | |
| // LOGEST returns are based on the following linear model: | |
| // ln y = x1 ln m1 + ... + xn ln mn + ln b | |
| exports.LOGEST = function(data_y, data_x) { | |
| data_y = utils.parseNumberArray(utils.flatten(data_y)); | |
| data_x = utils.parseNumberArray(utils.flatten(data_x)); | |
| if (utils.anyIsError(data_y, data_x)) { | |
| return error.value; | |
| } | |
| for (var i = 0; i < data_y.length; i ++) { | |
| data_y[i] = Math.log(data_y[i]); | |
| } | |
| var result = exports.LINEST(data_y, data_x); | |
| result[0] = Math.round(Math.exp(result[0])*1000000)/1000000; | |
| result[1] = Math.round(Math.exp(result[1])*1000000)/1000000; | |
| return result; | |
| }; | |
| exports.LOGNORM = {}; | |
| exports.LOGNORM.DIST = function(x, mean, sd, cumulative) { | |
| x = utils.parseNumber(x); | |
| mean = utils.parseNumber(mean); | |
| sd = utils.parseNumber(sd); | |
| if (utils.anyIsError(x, mean, sd)) { | |
| return error.value; | |
| } | |
| return (cumulative) ? jStat.lognormal.cdf(x, mean, sd) : jStat.lognormal.pdf(x, mean, sd); | |
| }; | |
| exports.LOGNORM.INV = function(probability, mean, sd) { | |
| probability = utils.parseNumber(probability); | |
| mean = utils.parseNumber(mean); | |
| sd = utils.parseNumber(sd); | |
| if (utils.anyIsError(probability, mean, sd)) { | |
| return error.value; | |
| } | |
| return jStat.lognormal.inv(probability, mean, sd); | |
| }; | |
| exports.MAX = function() { | |
| var range = utils.numbers(utils.flatten(arguments)); | |
| return (range.length === 0) ? 0 : Math.max.apply(Math, range); | |
| }; | |
| exports.MAXA = function() { | |
| var range = utils.arrayValuesToNumbers(utils.flatten(arguments)); | |
| return (range.length === 0) ? 0 : Math.max.apply(Math, range); | |
| }; | |
| exports.MEDIAN = function() { | |
| var range = utils.arrayValuesToNumbers(utils.flatten(arguments)); | |
| var result = jStat.median(range); | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.MIN = function() { | |
| var range = utils.numbers(utils.flatten(arguments)); | |
| return (range.length === 0) ? 0 : Math.min.apply(Math, range); | |
| }; | |
| exports.MINA = function() { | |
| var range = utils.arrayValuesToNumbers(utils.flatten(arguments)); | |
| return (range.length === 0) ? 0 : Math.min.apply(Math, range); | |
| }; | |
| exports.MODE = {}; | |
| exports.MODE.MULT = function() { | |
| // Credits: Roönaän | |
| var range = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| var n = range.length; | |
| var count = {}; | |
| var maxItems = []; | |
| var max = 0; | |
| var currentItem; | |
| for (var i = 0; i < n; i++) { | |
| currentItem = range[i]; | |
| count[currentItem] = count[currentItem] ? count[currentItem] + 1 : 1; | |
| if (count[currentItem] > max) { | |
| max = count[currentItem]; | |
| maxItems = []; | |
| } | |
| if (count[currentItem] === max) { | |
| maxItems[maxItems.length] = currentItem; | |
| } | |
| } | |
| return maxItems; | |
| }; | |
| exports.MODE.SNGL = function() { | |
| var range = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| return exports.MODE.MULT(range).sort(function(a, b) { | |
| return a - b; | |
| })[0]; | |
| }; | |
| exports.NEGBINOM = {}; | |
| exports.NEGBINOM.DIST = function(k, r, p, cumulative) { | |
| k = utils.parseNumber(k); | |
| r = utils.parseNumber(r); | |
| p = utils.parseNumber(p); | |
| if (utils.anyIsError(k, r, p)) { | |
| return error.value; | |
| } | |
| return (cumulative) ? jStat.negbin.cdf(k, r, p) : jStat.negbin.pdf(k, r, p); | |
| }; | |
| exports.NORM = {}; | |
| exports.NORM.DIST = function(x, mean, sd, cumulative) { | |
| x = utils.parseNumber(x); | |
| mean = utils.parseNumber(mean); | |
| sd = utils.parseNumber(sd); | |
| if (utils.anyIsError(x, mean, sd)) { | |
| return error.value; | |
| } | |
| if (sd <= 0) { | |
| return error.num; | |
| } | |
| // Return normal distribution computed by jStat [http://jstat.org] | |
| return (cumulative) ? jStat.normal.cdf(x, mean, sd) : jStat.normal.pdf(x, mean, sd); | |
| }; | |
| exports.NORM.INV = function(probability, mean, sd) { | |
| probability = utils.parseNumber(probability); | |
| mean = utils.parseNumber(mean); | |
| sd = utils.parseNumber(sd); | |
| if (utils.anyIsError(probability, mean, sd)) { | |
| return error.value; | |
| } | |
| return jStat.normal.inv(probability, mean, sd); | |
| }; | |
| exports.NORM.S = {}; | |
| exports.NORM.S.DIST = function(z, cumulative) { | |
| z = utils.parseNumber(z); | |
| if (z instanceof Error) { | |
| return error.value; | |
| } | |
| return (cumulative) ? jStat.normal.cdf(z, 0, 1) : jStat.normal.pdf(z, 0, 1); | |
| }; | |
| exports.NORM.S.INV = function(probability) { | |
| probability = utils.parseNumber(probability); | |
| if (probability instanceof Error) { | |
| return error.value; | |
| } | |
| return jStat.normal.inv(probability, 0, 1); | |
| }; | |
| exports.PEARSON = function(data_x, data_y) { | |
| data_y = utils.parseNumberArray(utils.flatten(data_y)); | |
| data_x = utils.parseNumberArray(utils.flatten(data_x)); | |
| if (utils.anyIsError(data_y, data_x)) { | |
| return error.value; | |
| } | |
| var xmean = jStat.mean(data_x); | |
| var ymean = jStat.mean(data_y); | |
| var n = data_x.length; | |
| var num = 0; | |
| var den1 = 0; | |
| var den2 = 0; | |
| for (var i = 0; i < n; i++) { | |
| num += (data_x[i] - xmean) * (data_y[i] - ymean); | |
| den1 += Math.pow(data_x[i] - xmean, 2); | |
| den2 += Math.pow(data_y[i] - ymean, 2); | |
| } | |
| return num / Math.sqrt(den1 * den2); | |
| }; | |
| exports.PERCENTILE = {}; | |
| exports.PERCENTILE.EXC = function(array, k) { | |
| array = utils.parseNumberArray(utils.flatten(array)); | |
| k = utils.parseNumber(k); | |
| if (utils.anyIsError(array, k)) { | |
| return error.value; | |
| } | |
| array = array.sort(function(a, b) { | |
| { | |
| return a - b; | |
| } | |
| }); | |
| var n = array.length; | |
| if (k < 1 / (n + 1) || k > 1 - 1 / (n + 1)) { | |
| return error.num; | |
| } | |
| var l = k * (n + 1) - 1; | |
| var fl = Math.floor(l); | |
| return utils.cleanFloat((l === fl) ? array[l] : array[fl] + (l - fl) * (array[fl + 1] - array[fl])); | |
| }; | |
| exports.PERCENTILE.INC = function(array, k) { | |
| array = utils.parseNumberArray(utils.flatten(array)); | |
| k = utils.parseNumber(k); | |
| if (utils.anyIsError(array, k)) { | |
| return error.value; | |
| } | |
| array = array.sort(function(a, b) { | |
| return a - b; | |
| }); | |
| var n = array.length; | |
| var l = k * (n - 1); | |
| var fl = Math.floor(l); | |
| return utils.cleanFloat((l === fl) ? array[l] : array[fl] + (l - fl) * (array[fl + 1] - array[fl])); | |
| }; | |
| exports.PERCENTRANK = {}; | |
| exports.PERCENTRANK.EXC = function(array, x, significance) { | |
| significance = (significance === undefined) ? 3 : significance; | |
| array = utils.parseNumberArray(utils.flatten(array)); | |
| x = utils.parseNumber(x); | |
| significance = utils.parseNumber(significance); | |
| if (utils.anyIsError(array, x, significance)) { | |
| return error.value; | |
| } | |
| array = array.sort(function(a, b) { | |
| return a - b; | |
| }); | |
| var uniques = misc.UNIQUE.apply(null, array); | |
| var n = array.length; | |
| var m = uniques.length; | |
| var power = Math.pow(10, significance); | |
| var result = 0; | |
| var match = false; | |
| var i = 0; | |
| while (!match && i < m) { | |
| if (x === uniques[i]) { | |
| result = (array.indexOf(uniques[i]) + 1) / (n + 1); | |
| match = true; | |
| } else if (x >= uniques[i] && (x < uniques[i + 1] || i === m - 1)) { | |
| result = (array.indexOf(uniques[i]) + 1 + (x - uniques[i]) / (uniques[i + 1] - uniques[i])) / (n + 1); | |
| match = true; | |
| } | |
| i++; | |
| } | |
| return Math.floor(result * power) / power; | |
| }; | |
| exports.PERCENTRANK.INC = function(array, x, significance) { | |
| significance = (significance === undefined) ? 3 : significance; | |
| array = utils.parseNumberArray(utils.flatten(array)); | |
| x = utils.parseNumber(x); | |
| significance = utils.parseNumber(significance); | |
| if (utils.anyIsError(array, x, significance)) { | |
| return error.value; | |
| } | |
| array = array.sort(function(a, b) { | |
| return a - b; | |
| }); | |
| var uniques = misc.UNIQUE.apply(null, array); | |
| var n = array.length; | |
| var m = uniques.length; | |
| var power = Math.pow(10, significance); | |
| var result = 0; | |
| var match = false; | |
| var i = 0; | |
| while (!match && i < m) { | |
| if (x === uniques[i]) { | |
| result = array.indexOf(uniques[i]) / (n - 1); | |
| match = true; | |
| } else if (x >= uniques[i] && (x < uniques[i + 1] || i === m - 1)) { | |
| result = (array.indexOf(uniques[i]) + (x - uniques[i]) / (uniques[i + 1] - uniques[i])) / (n - 1); | |
| match = true; | |
| } | |
| i++; | |
| } | |
| return Math.floor(result * power) / power; | |
| }; | |
| exports.PERMUT = function(number, number_chosen) { | |
| number = utils.parseNumber(number); | |
| number_chosen = utils.parseNumber(number_chosen); | |
| if (utils.anyIsError(number, number_chosen)) { | |
| return error.value; | |
| } | |
| return mathTrig.FACT(number) / mathTrig.FACT(number - number_chosen); | |
| }; | |
| exports.PERMUTATIONA = function(number, number_chosen) { | |
| number = utils.parseNumber(number); | |
| number_chosen = utils.parseNumber(number_chosen); | |
| if (utils.anyIsError(number, number_chosen)) { | |
| return error.value; | |
| } | |
| return Math.pow(number, number_chosen); | |
| }; | |
| exports.PHI = function(x) { | |
| x = utils.parseNumber(x); | |
| if (x instanceof Error) { | |
| return error.value; | |
| } | |
| return Math.exp(-0.5 * x * x) / SQRT2PI; | |
| }; | |
| exports.POISSON = {}; | |
| exports.POISSON.DIST = function(x, mean, cumulative) { | |
| x = utils.parseNumber(x); | |
| mean = utils.parseNumber(mean); | |
| if (utils.anyIsError(x, mean)) { | |
| return error.value; | |
| } | |
| return (cumulative) ? jStat.poisson.cdf(x, mean) : jStat.poisson.pdf(x, mean); | |
| }; | |
| exports.PROB = function(range, probability, lower, upper) { | |
| if (lower === undefined) { | |
| return 0; | |
| } | |
| upper = (upper === undefined) ? lower : upper; | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| probability = utils.parseNumberArray(utils.flatten(probability)); | |
| lower = utils.parseNumber(lower); | |
| upper = utils.parseNumber(upper); | |
| if (utils.anyIsError(range, probability, lower, upper)) { | |
| return error.value; | |
| } | |
| if (lower === upper) { | |
| return (range.indexOf(lower) >= 0) ? probability[range.indexOf(lower)] : 0; | |
| } | |
| var sorted = range.sort(function(a, b) { | |
| return a - b; | |
| }); | |
| var n = sorted.length; | |
| var result = 0; | |
| for (var i = 0; i < n; i++) { | |
| if (sorted[i] >= lower && sorted[i] <= upper) { | |
| result += probability[range.indexOf(sorted[i])]; | |
| } | |
| } | |
| return result; | |
| }; | |
| exports.QUARTILE = {}; | |
| exports.QUARTILE.EXC = function(range, quart) { | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| quart = utils.parseNumber(quart); | |
| if (utils.anyIsError(range, quart)) { | |
| return error.value; | |
| } | |
| switch (quart) { | |
| case 1: | |
| return exports.PERCENTILE.EXC(range, 0.25); | |
| case 2: | |
| return exports.PERCENTILE.EXC(range, 0.5); | |
| case 3: | |
| return exports.PERCENTILE.EXC(range, 0.75); | |
| default: | |
| return error.num; | |
| } | |
| }; | |
| exports.QUARTILE.INC = function(range, quart) { | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| quart = utils.parseNumber(quart); | |
| if (utils.anyIsError(range, quart)) { | |
| return error.value; | |
| } | |
| switch (quart) { | |
| case 1: | |
| return exports.PERCENTILE.INC(range, 0.25); | |
| case 2: | |
| return exports.PERCENTILE.INC(range, 0.5); | |
| case 3: | |
| return exports.PERCENTILE.INC(range, 0.75); | |
| default: | |
| return error.num; | |
| } | |
| }; | |
| exports.RANK = {}; | |
| exports.RANK.AVG = function(number, range, order) { | |
| number = utils.parseNumber(number); | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| if (utils.anyIsError(number, range)) { | |
| return error.value; | |
| } | |
| range = utils.flatten(range); | |
| order = order || false; | |
| var sort = (order) ? function(a, b) { | |
| return a - b; | |
| } : function(a, b) { | |
| return b - a; | |
| }; | |
| range = range.sort(sort); | |
| var length = range.length; | |
| var count = 0; | |
| for (var i = 0; i < length; i++) { | |
| if (range[i] === number) { | |
| count++; | |
| } | |
| } | |
| return (count > 1) ? (2 * range.indexOf(number) + count + 1) / 2 : range.indexOf(number) + 1; | |
| }; | |
| exports.RANK.EQ = function(number, range, order) { | |
| number = utils.parseNumber(number); | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| if (utils.anyIsError(number, range)) { | |
| return error.value; | |
| } | |
| order = order || false; | |
| var sort = (order) ? function(a, b) { | |
| return a - b; | |
| } : function(a, b) { | |
| return b - a; | |
| }; | |
| range = range.sort(sort); | |
| return range.indexOf(number) + 1; | |
| }; | |
| exports.ROW = function(matrix, index) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| if (index < 0) { | |
| return error.num; | |
| } | |
| if (!(matrix instanceof Array) || (typeof index !== 'number')) { | |
| return error.value; | |
| } | |
| if (matrix.length === 0) { | |
| return undefined; | |
| } | |
| return jStat.row(matrix, index); | |
| }; | |
| exports.ROWS = function(matrix) { | |
| if (arguments.length !== 1) { | |
| return error.na; | |
| } | |
| if (!(matrix instanceof Array)) { | |
| return error.value; | |
| } | |
| if (matrix.length === 0) { | |
| return 0; | |
| } | |
| return jStat.rows(matrix); | |
| }; | |
| exports.RSQ = function(data_x, data_y) { // no need to flatten here, PEARSON will take care of that | |
| data_x = utils.parseNumberArray(utils.flatten(data_x)); | |
| data_y = utils.parseNumberArray(utils.flatten(data_y)); | |
| if (utils.anyIsError(data_x, data_y)) { | |
| return error.value; | |
| } | |
| return Math.pow(exports.PEARSON(data_x, data_y), 2); | |
| }; | |
| exports.SKEW = function() { | |
| var range = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| var mean = jStat.mean(range); | |
| var n = range.length; | |
| var sigma = 0; | |
| for (var i = 0; i < n; i++) { | |
| sigma += Math.pow(range[i] - mean, 3); | |
| } | |
| return n * sigma / ((n - 1) * (n - 2) * Math.pow(jStat.stdev(range, true), 3)); | |
| }; | |
| exports.SKEW.P = function() { | |
| var range = utils.parseNumberArray(utils.flatten(arguments)); | |
| if (range instanceof Error) { | |
| return range; | |
| } | |
| var mean = jStat.mean(range); | |
| var n = range.length; | |
| var m2 = 0; | |
| var m3 = 0; | |
| for (var i = 0; i < n; i++) { | |
| m3 += Math.pow(range[i] - mean, 3); | |
| m2 += Math.pow(range[i] - mean, 2); | |
| } | |
| m3 = m3 / n; | |
| m2 = m2 / n; | |
| return m3 / Math.pow(m2, 3 / 2); | |
| }; | |
| exports.SLOPE = function(data_y, data_x) { | |
| data_y = utils.parseNumberArray(utils.flatten(data_y)); | |
| data_x = utils.parseNumberArray(utils.flatten(data_x)); | |
| if (utils.anyIsError(data_y, data_x)) { | |
| return error.value; | |
| } | |
| var xmean = jStat.mean(data_x); | |
| var ymean = jStat.mean(data_y); | |
| var n = data_x.length; | |
| var num = 0; | |
| var den = 0; | |
| for (var i = 0; i < n; i++) { | |
| num += (data_x[i] - xmean) * (data_y[i] - ymean); | |
| den += Math.pow(data_x[i] - xmean, 2); | |
| } | |
| return num / den; | |
| }; | |
| exports.SMALL = function(range, k) { | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| k = utils.parseNumber(k); | |
| if (utils.anyIsError(range, k)) { | |
| return range; | |
| } | |
| return range.sort(function(a, b) { | |
| return a - b; | |
| })[k - 1]; | |
| }; | |
| exports.STANDARDIZE = function(x, mean, sd) { | |
| x = utils.parseNumber(x); | |
| mean = utils.parseNumber(mean); | |
| sd = utils.parseNumber(sd); | |
| if (utils.anyIsError(x, mean, sd)) { | |
| return error.value; | |
| } | |
| return (x - mean) / sd; | |
| }; | |
| exports.STDEV = {}; | |
| exports.STDEV.P = function() { | |
| var v = exports.VAR.P.apply(this, arguments); | |
| var result = Math.sqrt(v); | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.STDEV.S = function() { | |
| var v = exports.VAR.S.apply(this, arguments); | |
| var result = Math.sqrt(v); | |
| return result; | |
| }; | |
| exports.STDEVA = function() { | |
| var v = exports.VARA.apply(this, arguments); | |
| var result = Math.sqrt(v); | |
| return result; | |
| }; | |
| exports.STDEVPA = function() { | |
| var v = exports.VARPA.apply(this, arguments); | |
| var result = Math.sqrt(v); | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.STEYX = function(data_y, data_x) { | |
| data_y = utils.parseNumberArray(utils.flatten(data_y)); | |
| data_x = utils.parseNumberArray(utils.flatten(data_x)); | |
| if (utils.anyIsError(data_y, data_x)) { | |
| return error.value; | |
| } | |
| var xmean = jStat.mean(data_x); | |
| var ymean = jStat.mean(data_y); | |
| var n = data_x.length; | |
| var lft = 0; | |
| var num = 0; | |
| var den = 0; | |
| for (var i = 0; i < n; i++) { | |
| lft += Math.pow(data_y[i] - ymean, 2); | |
| num += (data_x[i] - xmean) * (data_y[i] - ymean); | |
| den += Math.pow(data_x[i] - xmean, 2); | |
| } | |
| return Math.sqrt((lft - num * num / den) / (n - 2)); | |
| }; | |
| exports.TRANSPOSE = function(matrix) { | |
| if (!matrix) { | |
| return error.na; | |
| } | |
| return jStat.transpose(matrix); | |
| }; | |
| exports.T = text.T; | |
| exports.T.DIST = function(x, df, cumulative) { | |
| x = utils.parseNumber(x); | |
| df = utils.parseNumber(df); | |
| if (utils.anyIsError(x, df)) { | |
| return error.value; | |
| } | |
| return (cumulative) ? jStat.studentt.cdf(x, df) : jStat.studentt.pdf(x, df); | |
| }; | |
| exports.T.DIST['2T'] = function(x, df) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| if (x < 0 || df < 1) { | |
| return error.num; | |
| } | |
| if ((typeof x !== 'number') || (typeof df !== 'number')) { | |
| return error.value; | |
| } | |
| return (1 - jStat.studentt.cdf(x , df)) * 2; | |
| }; | |
| exports.T.DIST.RT = function(x, df) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| if (x < 0 || df < 1) { | |
| return error.num; | |
| } | |
| if ((typeof x !== 'number') || (typeof df !== 'number')) { | |
| return error.value; | |
| } | |
| return 1 - jStat.studentt.cdf(x , df); | |
| }; | |
| exports.T.INV = function(probability, df) { | |
| probability = utils.parseNumber(probability); | |
| df = utils.parseNumber(df); | |
| if (utils.anyIsError(probability, df)) { | |
| return error.value; | |
| } | |
| return jStat.studentt.inv(probability, df); | |
| }; | |
| exports.T.INV['2T'] = function(probability, df) { | |
| probability = utils.parseNumber(probability); | |
| df = utils.parseNumber(df); | |
| if (probability <= 0 || probability > 1 || df < 1) { | |
| return error.num; | |
| } | |
| if (utils.anyIsError(probability, df)) { | |
| return error.value; | |
| } | |
| return Math.abs(jStat.studentt.inv(probability/2, df)); | |
| }; | |
| // The algorithm can be found here: | |
| // http://www.chem.uoa.gr/applets/AppletTtest/Appl_Ttest2.html | |
| exports.T.TEST = function(data_x, data_y) { | |
| data_x = utils.parseNumberArray(utils.flatten(data_x)); | |
| data_y = utils.parseNumberArray(utils.flatten(data_y)); | |
| if (utils.anyIsError(data_x, data_y)) { | |
| return error.value; | |
| } | |
| var mean_x = jStat.mean(data_x); | |
| var mean_y = jStat.mean(data_y); | |
| var s_x = 0; | |
| var s_y = 0; | |
| var i; | |
| for (i = 0; i < data_x.length; i++) { | |
| s_x += Math.pow(data_x[i] - mean_x, 2); | |
| } | |
| for (i = 0; i < data_y.length; i++) { | |
| s_y += Math.pow(data_y[i] - mean_y, 2); | |
| } | |
| s_x = s_x / (data_x.length-1); | |
| s_y = s_y / (data_y.length-1); | |
| var t = Math.abs(mean_x - mean_y) / Math.sqrt(s_x/data_x.length + s_y/data_y.length); | |
| return exports.T.DIST['2T'](t, data_x.length+data_y.length-2); | |
| }; | |
| exports.TREND = function(data_y, data_x, new_data_x) { | |
| data_y = utils.parseNumberArray(utils.flatten(data_y)); | |
| data_x = utils.parseNumberArray(utils.flatten(data_x)); | |
| new_data_x = utils.parseNumberArray(utils.flatten(new_data_x)); | |
| if (utils.anyIsError(data_y, data_x, new_data_x)) { | |
| return error.value; | |
| } | |
| var linest = exports.LINEST(data_y, data_x); | |
| var m = linest[0]; | |
| var b = linest[1]; | |
| var result = []; | |
| new_data_x.forEach(function(x) { | |
| result.push(m * x + b); | |
| }); | |
| return result; | |
| }; | |
| exports.TRIMMEAN = function(range, percent) { | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| percent = utils.parseNumber(percent); | |
| if (utils.anyIsError(range, percent)) { | |
| return error.value; | |
| } | |
| var trim = mathTrig.FLOOR(range.length * percent, 2) / 2; | |
| return jStat.mean(utils.initial(utils.rest(range.sort(function(a, b) { | |
| return a - b; | |
| }), trim), trim)); | |
| }; | |
| exports.VAR = {}; | |
| exports.VAR.P = function() { | |
| var range = utils.numbers(utils.flatten(arguments)); | |
| var n = range.length; | |
| var sigma = 0; | |
| var mean = exports.AVERAGE(range); | |
| var result; | |
| for (var i = 0; i < n; i++) { | |
| sigma += Math.pow(range[i] - mean, 2); | |
| } | |
| result = sigma / n; | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.VAR.S = function() { | |
| var range = utils.numbers(utils.flatten(arguments)); | |
| var n = range.length; | |
| var sigma = 0; | |
| var mean = exports.AVERAGE(range); | |
| for (var i = 0; i < n; i++) { | |
| sigma += Math.pow(range[i] - mean, 2); | |
| } | |
| return sigma / (n - 1); | |
| }; | |
| exports.VARA = function() { | |
| var range = utils.flatten(arguments); | |
| var n = range.length; | |
| var sigma = 0; | |
| var count = 0; | |
| var mean = exports.AVERAGEA(range); | |
| for (var i = 0; i < n; i++) { | |
| var el = range[i]; | |
| if (typeof el === 'number') { | |
| sigma += Math.pow(el - mean, 2); | |
| } else if (el === true) { | |
| sigma += Math.pow(1 - mean, 2); | |
| } else { | |
| sigma += Math.pow(0 - mean, 2); | |
| } | |
| if (el !== null) { | |
| count++; | |
| } | |
| } | |
| return sigma / (count - 1); | |
| }; | |
| exports.VARPA = function() { | |
| var range = utils.flatten(arguments); | |
| var n = range.length; | |
| var sigma = 0; | |
| var count = 0; | |
| var mean = exports.AVERAGEA(range); | |
| var result; | |
| for (var i = 0; i < n; i++) { | |
| var el = range[i]; | |
| if (typeof el === 'number') { | |
| sigma += Math.pow(el - mean, 2); | |
| } else if (el === true) { | |
| sigma += Math.pow(1 - mean, 2); | |
| } else { | |
| sigma += Math.pow(0 - mean, 2); | |
| } | |
| if (el !== null) { | |
| count++; | |
| } | |
| } | |
| result = sigma / count; | |
| if (isNaN(result)) { | |
| result = error.num; | |
| } | |
| return result; | |
| }; | |
| exports.WEIBULL = {}; | |
| exports.WEIBULL.DIST = function(x, alpha, beta, cumulative) { | |
| x = utils.parseNumber(x); | |
| alpha = utils.parseNumber(alpha); | |
| beta = utils.parseNumber(beta); | |
| if (utils.anyIsError(x, alpha, beta)) { | |
| return error.value; | |
| } | |
| return (cumulative) ? 1 - Math.exp(-Math.pow(x / beta, alpha)) : Math.pow(x, alpha - 1) * Math.exp(-Math.pow(x / beta, alpha)) * alpha / Math.pow(beta, alpha); | |
| }; | |
| exports.Z = {}; | |
| exports.Z.TEST = function(range, x, sd) { | |
| range = utils.parseNumberArray(utils.flatten(range)); | |
| x = utils.parseNumber(x); | |
| if (utils.anyIsError(range, x)) { | |
| return error.value; | |
| } | |
| sd = sd || exports.STDEV.S(range); | |
| var n = range.length; | |
| return 1 - exports.NORM.S.DIST((exports.AVERAGE(range) - x) / (sd / Math.sqrt(n)), true); | |
| }; | |
| /***/ }), | |
| /* 172 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var global = __webpack_require__(40); | |
| var isObject = __webpack_require__(46); | |
| var document = global.document; | |
| // typeof document.createElement is 'object' in old IE | |
| var EXISTS = isObject(document) && isObject(document.createElement); | |
| module.exports = function (it) { | |
| return EXISTS ? document.createElement(it) : {}; | |
| }; | |
| /***/ }), | |
| /* 173 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var global = __webpack_require__(40); | |
| var createNonEnumerableProperty = __webpack_require__(82); | |
| module.exports = function (key, value) { | |
| try { | |
| createNonEnumerableProperty(global, key, value); | |
| } catch (error) { | |
| global[key] = value; | |
| } return value; | |
| }; | |
| /***/ }), | |
| /* 174 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var global = __webpack_require__(40); | |
| var setGlobal = __webpack_require__(173); | |
| var SHARED = '__core-js_shared__'; | |
| var store = global[SHARED] || setGlobal(SHARED, {}); | |
| module.exports = store; | |
| /***/ }), | |
| /* 175 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var toIndexedObject = __webpack_require__(74); | |
| var toLength = __webpack_require__(58); | |
| var toAbsoluteIndex = __webpack_require__(151); | |
| // `Array.prototype.{ indexOf, includes }` methods implementation | |
| var createMethod = function (IS_INCLUDES) { | |
| return function ($this, el, fromIndex) { | |
| var O = toIndexedObject($this); | |
| var length = toLength(O.length); | |
| var index = toAbsoluteIndex(fromIndex, length); | |
| var value; | |
| // Array#includes uses SameValueZero equality algorithm | |
| // eslint-disable-next-line no-self-compare -- NaN check | |
| if (IS_INCLUDES && el != el) while (length > index) { | |
| value = O[index++]; | |
| // eslint-disable-next-line no-self-compare -- NaN check | |
| if (value != value) return true; | |
| // Array#indexOf ignores holes, Array#includes - not | |
| } else for (;length > index; index++) { | |
| if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; | |
| } return !IS_INCLUDES && -1; | |
| }; | |
| }; | |
| module.exports = { | |
| // `Array.prototype.includes` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.includes | |
| includes: createMethod(true), | |
| // `Array.prototype.indexOf` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.indexof | |
| indexOf: createMethod(false) | |
| }; | |
| /***/ }), | |
| /* 176 */ | |
| /***/ (function(module, exports) { | |
| // IE8- don't enum bug keys | |
| module.exports = [ | |
| 'constructor', | |
| 'hasOwnProperty', | |
| 'isPrototypeOf', | |
| 'propertyIsEnumerable', | |
| 'toLocaleString', | |
| 'toString', | |
| 'valueOf' | |
| ]; | |
| /***/ }), | |
| /* 177 */ | |
| /***/ (function(module, exports) { | |
| // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe | |
| exports.f = Object.getOwnPropertySymbols; | |
| /***/ }), | |
| /* 178 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var isObject = __webpack_require__(46); | |
| var isArray = __webpack_require__(121); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var SPECIES = wellKnownSymbol('species'); | |
| // `ArraySpeciesCreate` abstract operation | |
| // https://tc39.es/ecma262/#sec-arrayspeciescreate | |
| module.exports = function (originalArray, length) { | |
| var C; | |
| if (isArray(originalArray)) { | |
| C = originalArray.constructor; | |
| // cross-realm fallback | |
| if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; | |
| else if (isObject(C)) { | |
| C = C[SPECIES]; | |
| if (C === null) C = undefined; | |
| } | |
| } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); | |
| }; | |
| /***/ }), | |
| /* 179 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var IS_NODE = __webpack_require__(180); | |
| var V8_VERSION = __webpack_require__(153); | |
| var fails = __webpack_require__(32); | |
| // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing | |
| module.exports = !!Object.getOwnPropertySymbols && !fails(function () { | |
| // eslint-disable-next-line es/no-symbol -- required for testing | |
| return !Symbol.sham && | |
| // Chrome 38 Symbol has incorrect toString conversion | |
| // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances | |
| (IS_NODE ? V8_VERSION === 38 : V8_VERSION > 37 && V8_VERSION < 41); | |
| }); | |
| /***/ }), | |
| /* 180 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var classof = __webpack_require__(94); | |
| var global = __webpack_require__(40); | |
| module.exports = classof(global.process) == 'process'; | |
| /***/ }), | |
| /* 181 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var isObject = __webpack_require__(46); | |
| var setPrototypeOf = __webpack_require__(239); | |
| // makes subclassing work correct for wrapped built-ins | |
| module.exports = function ($this, dummy, Wrapper) { | |
| var NewTarget, NewTargetPrototype; | |
| if ( | |
| // it can work only with native `setPrototypeOf` | |
| setPrototypeOf && | |
| // we haven't completely correct pre-ES6 way for getting `new.target`, so use this | |
| typeof (NewTarget = dummy.constructor) == 'function' && | |
| NewTarget !== Wrapper && | |
| isObject(NewTargetPrototype = NewTarget.prototype) && | |
| NewTargetPrototype !== Wrapper.prototype | |
| ) setPrototypeOf($this, NewTargetPrototype); | |
| return $this; | |
| }; | |
| /***/ }), | |
| /* 182 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var regexpFlags = __webpack_require__(183); | |
| var stickyHelpers = __webpack_require__(184); | |
| var shared = __webpack_require__(149); | |
| var nativeExec = RegExp.prototype.exec; | |
| var nativeReplace = shared('native-string-replace', String.prototype.replace); | |
| var patchedExec = nativeExec; | |
| var UPDATES_LAST_INDEX_WRONG = (function () { | |
| var re1 = /a/; | |
| var re2 = /b*/g; | |
| nativeExec.call(re1, 'a'); | |
| nativeExec.call(re2, 'a'); | |
| return re1.lastIndex !== 0 || re2.lastIndex !== 0; | |
| })(); | |
| var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET; | |
| // nonparticipating capturing group, copied from es5-shim's String#split patch. | |
| // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing | |
| var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; | |
| var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y; | |
| if (PATCH) { | |
| patchedExec = function exec(str) { | |
| var re = this; | |
| var lastIndex, reCopy, match, i; | |
| var sticky = UNSUPPORTED_Y && re.sticky; | |
| var flags = regexpFlags.call(re); | |
| var source = re.source; | |
| var charsAdded = 0; | |
| var strCopy = str; | |
| if (sticky) { | |
| flags = flags.replace('y', ''); | |
| if (flags.indexOf('g') === -1) { | |
| flags += 'g'; | |
| } | |
| strCopy = String(str).slice(re.lastIndex); | |
| // Support anchored sticky behavior. | |
| if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) { | |
| source = '(?: ' + source + ')'; | |
| strCopy = ' ' + strCopy; | |
| charsAdded++; | |
| } | |
| // ^(? + rx + ) is needed, in combination with some str slicing, to | |
| // simulate the 'y' flag. | |
| reCopy = new RegExp('^(?:' + source + ')', flags); | |
| } | |
| if (NPCG_INCLUDED) { | |
| reCopy = new RegExp('^' + source + '$(?!\\s)', flags); | |
| } | |
| if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; | |
| match = nativeExec.call(sticky ? reCopy : re, strCopy); | |
| if (sticky) { | |
| if (match) { | |
| match.input = match.input.slice(charsAdded); | |
| match[0] = match[0].slice(charsAdded); | |
| match.index = re.lastIndex; | |
| re.lastIndex += match[0].length; | |
| } else re.lastIndex = 0; | |
| } else if (UPDATES_LAST_INDEX_WRONG && match) { | |
| re.lastIndex = re.global ? match.index + match[0].length : lastIndex; | |
| } | |
| if (NPCG_INCLUDED && match && match.length > 1) { | |
| // Fix browsers whose `exec` methods don't consistently return `undefined` | |
| // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ | |
| nativeReplace.call(match[0], reCopy, function () { | |
| for (i = 1; i < arguments.length - 2; i++) { | |
| if (arguments[i] === undefined) match[i] = undefined; | |
| } | |
| }); | |
| } | |
| return match; | |
| }; | |
| } | |
| module.exports = patchedExec; | |
| /***/ }), | |
| /* 183 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var anObject = __webpack_require__(47); | |
| // `RegExp.prototype.flags` getter implementation | |
| // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags | |
| module.exports = function () { | |
| var that = anObject(this); | |
| var result = ''; | |
| if (that.global) result += 'g'; | |
| if (that.ignoreCase) result += 'i'; | |
| if (that.multiline) result += 'm'; | |
| if (that.dotAll) result += 's'; | |
| if (that.unicode) result += 'u'; | |
| if (that.sticky) result += 'y'; | |
| return result; | |
| }; | |
| /***/ }), | |
| /* 184 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var fails = __webpack_require__(32); | |
| // 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; | |
| }); | |
| /***/ }), | |
| /* 185 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var charAt = __webpack_require__(186).charAt; | |
| // `AdvanceStringIndex` abstract operation | |
| // https://tc39.es/ecma262/#sec-advancestringindex | |
| module.exports = function (S, index, unicode) { | |
| return index + (unicode ? charAt(S, index).length : 1); | |
| }; | |
| /***/ }), | |
| /* 186 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var toInteger = __webpack_require__(96); | |
| var requireObjectCoercible = __webpack_require__(67); | |
| // `String.prototype.{ codePointAt, at }` methods implementation | |
| var createMethod = function (CONVERT_TO_STRING) { | |
| return function ($this, pos) { | |
| var S = String(requireObjectCoercible($this)); | |
| var position = toInteger(pos); | |
| var size = S.length; | |
| var first, second; | |
| if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; | |
| first = S.charCodeAt(position); | |
| return first < 0xD800 || first > 0xDBFF || position + 1 === size | |
| || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF | |
| ? CONVERT_TO_STRING ? S.charAt(position) : first | |
| : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; | |
| }; | |
| }; | |
| module.exports = { | |
| // `String.prototype.codePointAt` method | |
| // https://tc39.es/ecma262/#sec-string.prototype.codepointat | |
| codeAt: createMethod(false), | |
| // `String.prototype.at` method | |
| // https://github.com/mathiasbynens/String.prototype.at | |
| charAt: createMethod(true) | |
| }; | |
| /***/ }), | |
| /* 187 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var TO_STRING_TAG = wellKnownSymbol('toStringTag'); | |
| var test = {}; | |
| test[TO_STRING_TAG] = 'z'; | |
| module.exports = String(test) === '[object z]'; | |
| /***/ }), | |
| /* 188 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var createIteratorConstructor = __webpack_require__(486); | |
| var getPrototypeOf = __webpack_require__(189); | |
| var setPrototypeOf = __webpack_require__(239); | |
| var setToStringTag = __webpack_require__(157); | |
| var createNonEnumerableProperty = __webpack_require__(82); | |
| var redefine = __webpack_require__(83); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var IS_PURE = __webpack_require__(105); | |
| var Iterators = __webpack_require__(126); | |
| var IteratorsCore = __webpack_require__(248); | |
| var IteratorPrototype = IteratorsCore.IteratorPrototype; | |
| var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; | |
| var ITERATOR = wellKnownSymbol('iterator'); | |
| var KEYS = 'keys'; | |
| var VALUES = 'values'; | |
| var ENTRIES = 'entries'; | |
| var returnThis = function () { return this; }; | |
| module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { | |
| createIteratorConstructor(IteratorConstructor, NAME, next); | |
| var getIterationMethod = function (KIND) { | |
| if (KIND === DEFAULT && defaultIterator) return defaultIterator; | |
| if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; | |
| switch (KIND) { | |
| case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; | |
| case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; | |
| case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; | |
| } return function () { return new IteratorConstructor(this); }; | |
| }; | |
| var TO_STRING_TAG = NAME + ' Iterator'; | |
| var INCORRECT_VALUES_NAME = false; | |
| var IterablePrototype = Iterable.prototype; | |
| var nativeIterator = IterablePrototype[ITERATOR] | |
| || IterablePrototype['@@iterator'] | |
| || DEFAULT && IterablePrototype[DEFAULT]; | |
| var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); | |
| var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; | |
| var CurrentIteratorPrototype, methods, KEY; | |
| // fix native | |
| if (anyNativeIterator) { | |
| CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); | |
| if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { | |
| if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { | |
| if (setPrototypeOf) { | |
| setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); | |
| } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') { | |
| createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis); | |
| } | |
| } | |
| // Set @@toStringTag to native iterators | |
| setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); | |
| if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; | |
| } | |
| } | |
| // fix Array#{values, @@iterator}.name in V8 / FF | |
| if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { | |
| INCORRECT_VALUES_NAME = true; | |
| defaultIterator = function values() { return nativeIterator.call(this); }; | |
| } | |
| // define iterator | |
| if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { | |
| createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator); | |
| } | |
| Iterators[NAME] = defaultIterator; | |
| // export additional methods | |
| if (DEFAULT) { | |
| methods = { | |
| values: getIterationMethod(VALUES), | |
| keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), | |
| entries: getIterationMethod(ENTRIES) | |
| }; | |
| if (FORCED) for (KEY in methods) { | |
| if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { | |
| redefine(IterablePrototype, KEY, methods[KEY]); | |
| } | |
| } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); | |
| } | |
| return methods; | |
| }; | |
| /***/ }), | |
| /* 189 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var has = __webpack_require__(65); | |
| var toObject = __webpack_require__(68); | |
| var sharedKey = __webpack_require__(148); | |
| var CORRECT_PROTOTYPE_GETTER = __webpack_require__(249); | |
| var IE_PROTO = sharedKey('IE_PROTO'); | |
| var ObjectPrototype = Object.prototype; | |
| // `Object.getPrototypeOf` method | |
| // https://tc39.es/ecma262/#sec-object.getprototypeof | |
| // eslint-disable-next-line es/no-object-getprototypeof -- safe | |
| module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) { | |
| O = toObject(O); | |
| if (has(O, IE_PROTO)) return O[IE_PROTO]; | |
| if (typeof O.constructor == 'function' && O instanceof O.constructor) { | |
| return O.constructor.prototype; | |
| } return O instanceof Object ? ObjectPrototype : null; | |
| }; | |
| /***/ }), | |
| /* 190 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var isArray = __webpack_require__(121); | |
| var nativeReverse = [].reverse; | |
| var test = [1, 2]; | |
| // `Array.prototype.reverse` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.reverse | |
| // fix for Safari 12.0 bug | |
| // https://bugs.webkit.org/show_bug.cgi?id=188794 | |
| $({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, { | |
| reverse: function reverse() { | |
| // eslint-disable-next-line no-self-assign -- dirty hack | |
| if (isArray(this)) this.length = this.length; | |
| return nativeReverse.call(this); | |
| } | |
| }); | |
| /***/ }), | |
| /* 191 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var arrayLikeToArray = __webpack_require__(252); | |
| function _unsupportedIterableToArray(o, minLen) { | |
| if (!o) return; | |
| if (typeof o === "string") return arrayLikeToArray(o, minLen); | |
| var n = Object.prototype.toString.call(o).slice(8, -1); | |
| if (n === "Object" && o.constructor) n = o.constructor.name; | |
| if (n === "Map" || n === "Set") return Array.from(o); | |
| if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); | |
| } | |
| module.exports = _unsupportedIterableToArray; | |
| module.exports["default"] = module.exports, module.exports.__esModule = true; | |
| /***/ }), | |
| /* 192 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var fails = __webpack_require__(32); | |
| var toObject = __webpack_require__(68); | |
| var nativeGetPrototypeOf = __webpack_require__(189); | |
| var CORRECT_PROTOTYPE_GETTER = __webpack_require__(249); | |
| var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); }); | |
| // `Object.getPrototypeOf` method | |
| // https://tc39.es/ecma262/#sec-object.getprototypeof | |
| $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, { | |
| getPrototypeOf: function getPrototypeOf(it) { | |
| return nativeGetPrototypeOf(toObject(it)); | |
| } | |
| }); | |
| /***/ }), | |
| /* 193 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var isRegExp = __webpack_require__(194); | |
| module.exports = function (it) { | |
| if (isRegExp(it)) { | |
| throw TypeError("The method doesn't accept regular expressions"); | |
| } return it; | |
| }; | |
| /***/ }), | |
| /* 194 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var isObject = __webpack_require__(46); | |
| var classof = __webpack_require__(94); | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var MATCH = wellKnownSymbol('match'); | |
| // `IsRegExp` abstract operation | |
| // https://tc39.es/ecma262/#sec-isregexp | |
| module.exports = function (it) { | |
| var isRegExp; | |
| return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp'); | |
| }; | |
| /***/ }), | |
| /* 195 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var wellKnownSymbol = __webpack_require__(42); | |
| var MATCH = wellKnownSymbol('match'); | |
| module.exports = function (METHOD_NAME) { | |
| var regexp = /./; | |
| try { | |
| '/./'[METHOD_NAME](regexp); | |
| } catch (error1) { | |
| try { | |
| regexp[MATCH] = false; | |
| return '/./'[METHOD_NAME](regexp); | |
| } catch (error2) { /* empty */ } | |
| } return false; | |
| }; | |
| /***/ }), | |
| /* 196 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var anObject = __webpack_require__(47); | |
| var isArrayIteratorMethod = __webpack_require__(244); | |
| var toLength = __webpack_require__(58); | |
| var bind = __webpack_require__(125); | |
| var getIteratorMethod = __webpack_require__(245); | |
| var iteratorClose = __webpack_require__(243); | |
| var Result = function (stopped, result) { | |
| this.stopped = stopped; | |
| this.result = result; | |
| }; | |
| module.exports = function (iterable, unboundFunction, options) { | |
| var that = options && options.that; | |
| var AS_ENTRIES = !!(options && options.AS_ENTRIES); | |
| var IS_ITERATOR = !!(options && options.IS_ITERATOR); | |
| var INTERRUPTED = !!(options && options.INTERRUPTED); | |
| var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED); | |
| var iterator, iterFn, index, length, result, next, step; | |
| var stop = function (condition) { | |
| if (iterator) iteratorClose(iterator); | |
| return new Result(true, condition); | |
| }; | |
| var callFn = function (value) { | |
| if (AS_ENTRIES) { | |
| anObject(value); | |
| return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); | |
| } return INTERRUPTED ? fn(value, stop) : fn(value); | |
| }; | |
| if (IS_ITERATOR) { | |
| iterator = iterable; | |
| } else { | |
| iterFn = getIteratorMethod(iterable); | |
| if (typeof iterFn != 'function') throw TypeError('Target is not iterable'); | |
| // optimisation for array iterators | |
| if (isArrayIteratorMethod(iterFn)) { | |
| for (index = 0, length = toLength(iterable.length); length > index; index++) { | |
| result = callFn(iterable[index]); | |
| if (result && result instanceof Result) return result; | |
| } return new Result(false); | |
| } | |
| iterator = iterFn.call(iterable); | |
| } | |
| next = iterator.next; | |
| while (!(step = next.call(iterator)).done) { | |
| try { | |
| result = callFn(step.value); | |
| } catch (error) { | |
| iteratorClose(iterator); | |
| throw error; | |
| } | |
| if (typeof result == 'object' && result && result instanceof Result) return result; | |
| } return new Result(false); | |
| }; | |
| /***/ }), | |
| /* 197 */ | |
| /***/ (function(module, exports) { | |
| module.exports = function (it, Constructor, name) { | |
| if (!(it instanceof Constructor)) { | |
| throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); | |
| } return it; | |
| }; | |
| /***/ }), | |
| /* 198 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var redefine = __webpack_require__(83); | |
| module.exports = function (target, src, options) { | |
| for (var key in src) redefine(target, key, src[key], options); | |
| return target; | |
| }; | |
| /***/ }), | |
| /* 199 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.PARTIALLY_VISIBLE_TYPE = exports.FULLY_VISIBLE_TYPE = exports.RENDER_TYPE = void 0; | |
| /** | |
| * Render type calculation calculates how many DOM nodes should be created and where placed | |
| * based on `startRow` and `endRow` properties. | |
| * | |
| * @type {number} | |
| */ | |
| var RENDER_TYPE = 1; | |
| /** | |
| * Fully visible type calculation calculates rows that are fully visible in the viewport. | |
| * This type of calculation is used in scrolling by arrow keys navigation. | |
| * | |
| * @type {number} | |
| */ | |
| exports.RENDER_TYPE = RENDER_TYPE; | |
| var FULLY_VISIBLE_TYPE = 2; | |
| /** | |
| * Partially visible type calculation calculates rows that are fully and partially visible in | |
| * the viewport. This type of calculation is used to check `endRow` (or `startRow`) with properties | |
| * calculated in render calculator. If checking met the criteria slow render is | |
| * performed (which render calculator with new data). | |
| * | |
| * @type {number} | |
| */ | |
| exports.FULLY_VISIBLE_TYPE = FULLY_VISIBLE_TYPE; | |
| var PARTIALLY_VISIBLE_TYPE = 3; | |
| exports.PARTIALLY_VISIBLE_TYPE = PARTIALLY_VISIBLE_TYPE; | |
| /***/ }), | |
| /* 200 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| var _object = __webpack_require__(5); | |
| var MIXIN_NAME = 'calculatedColumns'; | |
| /** | |
| * Mixin for the subclasses of `Table` with implementations of | |
| * helper methods that are related to columns. | |
| * This mixin is meant to be applied in the subclasses of `Table` | |
| * that use virtual rendering in the horizontal axis. | |
| * | |
| * @type {object} | |
| */ | |
| var calculatedColumns = { | |
| /** | |
| * Get the source index of the first rendered column. If no columns are rendered, returns an error code: -1. | |
| * | |
| * @returns {number} | |
| */ | |
| getFirstRenderedColumn: function getFirstRenderedColumn() { | |
| var startColumn = this.wot.wtViewport.columnsRenderCalculator.startColumn; | |
| if (startColumn === null) { | |
| return -1; | |
| } | |
| return startColumn; | |
| }, | |
| /** | |
| * Get the source index of the first column fully visible in the viewport. If no columns are fully visible, returns an error code: -1. | |
| * | |
| * @returns {number} | |
| */ | |
| getFirstVisibleColumn: function getFirstVisibleColumn() { | |
| var startColumn = this.wot.wtViewport.columnsVisibleCalculator.startColumn; | |
| if (startColumn === null) { | |
| return -1; | |
| } | |
| return startColumn; | |
| }, | |
| /** | |
| * Get the source index of the last rendered column. If no columns are rendered, returns an error code: -1. | |
| * | |
| * @returns {number} | |
| */ | |
| getLastRenderedColumn: function getLastRenderedColumn() { | |
| var endColumn = this.wot.wtViewport.columnsRenderCalculator.endColumn; | |
| if (endColumn === null) { | |
| return -1; | |
| } | |
| return endColumn; | |
| }, | |
| /** | |
| * Get the source index of the last column fully visible in the viewport. If no columns are fully visible, returns an error code: -1. | |
| * | |
| * @returns {number} | |
| */ | |
| getLastVisibleColumn: function getLastVisibleColumn() { | |
| var endColumn = this.wot.wtViewport.columnsVisibleCalculator.endColumn; | |
| if (endColumn === null) { | |
| return -1; | |
| } | |
| return endColumn; | |
| }, | |
| /** | |
| * Get the number of rendered columns. | |
| * | |
| * @returns {number} | |
| */ | |
| getRenderedColumnsCount: function getRenderedColumnsCount() { | |
| return this.wot.wtViewport.columnsRenderCalculator.count; | |
| }, | |
| /** | |
| * Get the number of fully visible columns in the viewport. | |
| * | |
| * @returns {number} | |
| */ | |
| getVisibleColumnsCount: function getVisibleColumnsCount() { | |
| return this.wot.wtViewport.columnsVisibleCalculator.count; | |
| } | |
| }; | |
| (0, _object.defineGetter)(calculatedColumns, 'MIXIN_NAME', MIXIN_NAME, { | |
| writable: false, | |
| enumerable: false | |
| }); | |
| var _default = calculatedColumns; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 201 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| var _object = __webpack_require__(5); | |
| var MIXIN_NAME = 'stickyColumnsLeft'; | |
| /** | |
| * Mixin for the subclasses of `Table` with implementations of | |
| * helper methods that are related to columns. | |
| * This mixin is meant to be applied in the subclasses of `Table` | |
| * that use sticky rendering of the first columns in the horizontal axis. | |
| * | |
| * @type {object} | |
| */ | |
| var stickyColumnsLeft = { | |
| /** | |
| * Get the source index of the first rendered column. If no columns are rendered, returns an error code: -1. | |
| * | |
| * @returns {number} | |
| */ | |
| getFirstRenderedColumn: function getFirstRenderedColumn() { | |
| var totalColumns = this.wot.getSetting('totalColumns'); | |
| if (totalColumns === 0) { | |
| return -1; | |
| } | |
| return 0; | |
| }, | |
| /** | |
| * Get the source index of the first column fully visible in the viewport. If no columns are fully visible, returns an error code: -1. | |
| * Assumes that all rendered columns are fully visible. | |
| * | |
| * @returns {number} | |
| */ | |
| getFirstVisibleColumn: function getFirstVisibleColumn() { | |
| return this.getFirstRenderedColumn(); | |
| }, | |
| /** | |
| * Get the source index of the last rendered column. If no columns are rendered, returns an error code: -1. | |
| * | |
| * @returns {number} | |
| */ | |
| getLastRenderedColumn: function getLastRenderedColumn() { | |
| return this.getRenderedColumnsCount() - 1; | |
| }, | |
| /** | |
| * Get the source index of the last column fully visible in the viewport. If no columns are fully visible, returns an error code: -1. | |
| * Assumes that all rendered columns are fully visible. | |
| * | |
| * @returns {number} | |
| */ | |
| getLastVisibleColumn: function getLastVisibleColumn() { | |
| return this.getLastRenderedColumn(); | |
| }, | |
| /** | |
| * Get the number of rendered columns. | |
| * | |
| * @returns {number} | |
| */ | |
| getRenderedColumnsCount: function getRenderedColumnsCount() { | |
| var totalColumns = this.wot.getSetting('totalColumns'); | |
| return Math.min(this.wot.getSetting('fixedColumnsLeft'), totalColumns); | |
| }, | |
| /** | |
| * Get the number of fully visible columns in the viewport. | |
| * Assumes that all rendered columns are fully visible. | |
| * | |
| * @returns {number} | |
| */ | |
| getVisibleColumnsCount: function getVisibleColumnsCount() { | |
| return this.getRenderedColumnsCount(); | |
| } | |
| }; | |
| (0, _object.defineGetter)(stickyColumnsLeft, 'MIXIN_NAME', MIXIN_NAME, { | |
| writable: false, | |
| enumerable: false | |
| }); | |
| var _default = stickyColumnsLeft; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 202 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.instanceToHTML = instanceToHTML; | |
| exports._dataToHTML = _dataToHTML; | |
| exports.htmlToGridSettings = htmlToGridSettings; | |
| var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(25)); | |
| __webpack_require__(128); | |
| __webpack_require__(29); | |
| __webpack_require__(52); | |
| __webpack_require__(73); | |
| __webpack_require__(77); | |
| __webpack_require__(35); | |
| __webpack_require__(51); | |
| __webpack_require__(9); | |
| __webpack_require__(19); | |
| __webpack_require__(41); | |
| __webpack_require__(135); | |
| __webpack_require__(534); | |
| __webpack_require__(203); | |
| __webpack_require__(43); | |
| __webpack_require__(11); | |
| __webpack_require__(30); | |
| __webpack_require__(411); | |
| __webpack_require__(26); | |
| __webpack_require__(34); | |
| var _mixed = __webpack_require__(20); | |
| var ESCAPED_HTML_CHARS = { | |
| ' ': '\x20', | |
| '&': '&', | |
| '<': '<', | |
| '>': '>' | |
| }; | |
| var regEscapedChars = new RegExp(Object.keys(ESCAPED_HTML_CHARS).map(function (key) { | |
| return "(".concat(key, ")"); | |
| }).join('|'), 'gi'); | |
| /** | |
| * Verifies if node is an HTMLTable element. | |
| * | |
| * @param {Node} element Node to verify if it's an HTMLTable. | |
| * @returns {boolean} | |
| */ | |
| function isHTMLTable(element) { | |
| return (element && element.nodeName || '') === 'TABLE'; | |
| } | |
| /** | |
| * Converts Handsontable into HTMLTableElement. | |
| * | |
| * @param {Core} instance The Handsontable instance. | |
| * @returns {string} OuterHTML of the HTMLTableElement. | |
| */ | |
| function instanceToHTML(instance) { | |
| var hasColumnHeaders = instance.hasColHeaders(); | |
| var hasRowHeaders = instance.hasRowHeaders(); | |
| var coords = [hasColumnHeaders ? -1 : 0, hasRowHeaders ? -1 : 0, instance.countRows() - 1, instance.countCols() - 1]; | |
| var data = instance.getData.apply(instance, coords); | |
| var countRows = data.length; | |
| var countCols = countRows > 0 ? data[0].length : 0; | |
| var TABLE = ['<table>', '</table>']; | |
| var THEAD = hasColumnHeaders ? ['<thead>', '</thead>'] : []; | |
| var TBODY = ['<tbody>', '</tbody>']; | |
| var rowModifier = hasRowHeaders ? 1 : 0; | |
| var columnModifier = hasColumnHeaders ? 1 : 0; | |
| for (var row = 0; row < countRows; row += 1) { | |
| var isColumnHeadersRow = hasColumnHeaders && row === 0; | |
| var CELLS = []; | |
| for (var column = 0; column < countCols; column += 1) { | |
| var isRowHeadersColumn = !isColumnHeadersRow && hasRowHeaders && column === 0; | |
| var cell = ''; | |
| if (isColumnHeadersRow) { | |
| cell = "<th>".concat(instance.getColHeader(column - rowModifier), "</th>"); | |
| } else if (isRowHeadersColumn) { | |
| cell = "<th>".concat(instance.getRowHeader(row - columnModifier), "</th>"); | |
| } else { | |
| var cellData = data[row][column]; | |
| var _instance$getCellMeta = instance.getCellMeta(row - rowModifier, column - columnModifier), | |
| hidden = _instance$getCellMeta.hidden, | |
| rowspan = _instance$getCellMeta.rowspan, | |
| colspan = _instance$getCellMeta.colspan; | |
| if (!hidden) { | |
| var attrs = []; | |
| if (rowspan) { | |
| attrs.push("rowspan=\"".concat(rowspan, "\"")); | |
| } | |
| if (colspan) { | |
| attrs.push("colspan=\"".concat(colspan, "\"")); | |
| } | |
| if ((0, _mixed.isEmpty)(cellData)) { | |
| cell = "<td ".concat(attrs.join(' '), "></td>"); | |
| } else { | |
| var value = cellData.toString().replace('<', '<').replace('>', '>').replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, '<br>\r\n').replace(/\x20/gi, ' ').replace(/\t/gi, '	'); | |
| cell = "<td ".concat(attrs.join(' '), ">").concat(value, "</td>"); | |
| } | |
| } | |
| } | |
| CELLS.push(cell); | |
| } | |
| var TR = ['<tr>'].concat(CELLS, ['</tr>']).join(''); | |
| if (isColumnHeadersRow) { | |
| THEAD.splice(1, 0, TR); | |
| } else { | |
| TBODY.splice(-1, 0, TR); | |
| } | |
| } | |
| TABLE.splice(1, 0, THEAD.join(''), TBODY.join('')); | |
| return TABLE.join(''); | |
| } | |
| /** | |
| * Converts 2D array into HTMLTableElement. | |
| * | |
| * @param {Array} input Input array which will be converted to HTMLTable. | |
| * @returns {string} OuterHTML of the HTMLTableElement. | |
| */ | |
| // eslint-disable-next-line no-restricted-globals | |
| function _dataToHTML(input) { | |
| var inputLen = input.length; | |
| var result = ['<table>']; | |
| for (var row = 0; row < inputLen; row += 1) { | |
| var rowData = input[row]; | |
| var columnsLen = rowData.length; | |
| var columnsResult = []; | |
| if (row === 0) { | |
| result.push('<tbody>'); | |
| } | |
| for (var column = 0; column < columnsLen; column += 1) { | |
| var cellData = rowData[column]; | |
| var parsedCellData = (0, _mixed.isEmpty)(cellData) ? '' : cellData.toString().replace(/</g, '<').replace(/>/g, '>').replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, '<br>\r\n').replace(/\x20/gi, ' ').replace(/\t/gi, '	'); | |
| columnsResult.push("<td>".concat(parsedCellData, "</td>")); | |
| } | |
| result.push.apply(result, ['<tr>'].concat(columnsResult, ['</tr>'])); | |
| if (row + 1 === inputLen) { | |
| result.push('</tbody>'); | |
| } | |
| } | |
| result.push('</table>'); | |
| return result.join(''); | |
| } | |
| /** | |
| * Converts HTMLTable or string into Handsontable configuration object. | |
| * | |
| * @param {Element|string} element Node element which should contain `<table>...</table>`. | |
| * @param {Document} [rootDocument] The document window owner. | |
| * @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(/<td\b[^>]*?>([\s\S]*?)<\/\s*td>/g, function (cellFragment) { | |
| var openingTag = cellFragment.match(/<td\b[^>]*?>/g)[0]; | |
| var cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).replace(/(<(?!br)([^>]+)>)/gi, ''); | |
| var closingTag = '</td>'; | |
| return "".concat(openingTag).concat(cellValue).concat(closingTag); | |
| }); | |
| tempElem.insertAdjacentHTML('afterbegin', "".concat(escapedAdjacentHTML)); | |
| checkElement = tempElem.querySelector('table'); | |
| } | |
| if (!checkElement || !isHTMLTable(checkElement)) { | |
| return; | |
| } | |
| var generator = tempElem.querySelector('meta[name$="enerator"]'); | |
| var hasRowHeaders = checkElement.querySelector('tbody th') !== null; | |
| var trElement = checkElement.querySelector('tr'); | |
| var countCols = !trElement ? 0 : Array.from(trElement.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; | |
| for (var cellId = 0; cellId < cellsLen; 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 cellValue = ''; | |
| if (generator && /excel/gi.test(generator.content)) { | |
| cellValue = innerHTML.replace(/[\r\n][\x20]{0,2}/g, '\x20').replace(/<br(\s*|\/)>[\r\n]?[\x20]{0,3}/gim, '\r\n'); | |
| } else { | |
| cellValue = innerHTML.replace(/<br(\s*|\/)>[\r\n]?/gim, '\r\n'); | |
| } | |
| dataArr[row][col] = cellValue.replace(regEscapedChars, function (match) { | |
| return ESCAPED_HTML_CHARS[match]; | |
| }); | |
| } else { | |
| rowHeaders.push(innerHTML); | |
| } | |
| } | |
| } | |
| if (mergeCells.length) { | |
| settingsObj.mergeCells = mergeCells; | |
| } | |
| if (rowHeaders.length) { | |
| settingsObj.rowHeaders = rowHeaders; | |
| } | |
| if (dataArr.length) { | |
| settingsObj.data = dataArr; | |
| } | |
| return settingsObj; | |
| } | |
| /***/ }), | |
| /* 203 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var $ = __webpack_require__(21); | |
| var $reduce = __webpack_require__(536).left; | |
| var arrayMethodIsStrict = __webpack_require__(108); | |
| var CHROME_VERSION = __webpack_require__(153); | |
| var IS_NODE = __webpack_require__(180); | |
| var STRICT_METHOD = arrayMethodIsStrict('reduce'); | |
| // Chrome 80-82 has a critical bug | |
| // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 | |
| var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83; | |
| // `Array.prototype.reduce` method | |
| // https://tc39.es/ecma262/#sec-array.prototype.reduce | |
| $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, { | |
| reduce: function reduce(callbackfn /* , initialValue */) { | |
| return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); | |
| } | |
| }); | |
| /***/ }), | |
| /* 204 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.getPluginsNames = getPluginsNames; | |
| exports.getPlugin = getPlugin; | |
| exports.hasPlugin = hasPlugin; | |
| exports.registerPlugin = registerPlugin; | |
| __webpack_require__(19); | |
| var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18)); | |
| var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(25)); | |
| var _string = __webpack_require__(75); | |
| var _priorityMap = __webpack_require__(537); | |
| var _uniqueMap = __webpack_require__(412); | |
| var _uniqueSet = __webpack_require__(538); | |
| /** | |
| * Utility to register plugins and common namespace for keeping the reference to all plugins classes. | |
| */ | |
| var ERROR_PLUGIN_REGISTERED = function ERROR_PLUGIN_REGISTERED(pluginName) { | |
| return "There is already registered \"".concat(pluginName, "\" plugin."); | |
| }; | |
| var ERROR_PRIORITY_REGISTERED = function ERROR_PRIORITY_REGISTERED(priority) { | |
| return "There is already registered plugin on priority \"".concat(priority, "\"."); | |
| }; | |
| var ERROR_PRIORITY_NAN = function ERROR_PRIORITY_NAN(priority) { | |
| return "The priority \"".concat(priority, "\" is not a number."); | |
| }; | |
| /** | |
| * Stores plugins' names' queue with their priorities. | |
| */ | |
| var priorityPluginsQueue = (0, _priorityMap.createPriorityMap)({ | |
| errorPriorityExists: ERROR_PRIORITY_REGISTERED, | |
| errorPriorityNaN: ERROR_PRIORITY_NAN | |
| }); | |
| /** | |
| * Stores plugins names' queue by registration order. | |
| */ | |
| var uniquePluginsQueue = (0, _uniqueSet.createUniqueSet)({ | |
| errorItemExists: ERROR_PLUGIN_REGISTERED | |
| }); | |
| /** | |
| * Stores plugins references between their name and class. | |
| */ | |
| var uniquePluginsList = (0, _uniqueMap.createUniqueMap)({ | |
| errorIdExists: ERROR_PLUGIN_REGISTERED | |
| }); | |
| /** | |
| * Gets registered plugins' names in the following order: | |
| * 1) Plugins registered with a defined priority attribute, in the ascending order of priority. | |
| * 2) Plugins registered without a defined priority attribute, in the registration order. | |
| * | |
| * @returns {string[]} | |
| */ | |
| function getPluginsNames() { | |
| return [].concat((0, _toConsumableArray2.default)(priorityPluginsQueue.getItems()), (0, _toConsumableArray2.default)(uniquePluginsQueue.getItems())); | |
| } | |
| /** | |
| * Gets registered plugin's class based on the given name. | |
| * | |
| * @param {string} pluginName Plugin's name. | |
| * @returns {BasePlugin} | |
| */ | |
| function getPlugin(pluginName) { | |
| var unifiedPluginName = (0, _string.toUpperCaseFirst)(pluginName); | |
| return uniquePluginsList.getItem(unifiedPluginName); | |
| } | |
| /** | |
| * Checks if the plugin under the name is already registered. | |
| * | |
| * @param {string} pluginName Plugin's name. | |
| * @returns {boolean} | |
| */ | |
| function hasPlugin(pluginName) { | |
| /* eslint-disable no-unneeded-ternary */ | |
| return getPlugin(pluginName) ? true : false; | |
| } | |
| /** | |
| * Registers plugin under the given name only once. | |
| * | |
| * @param {string|Function} pluginName The plugin name or plugin class. | |
| * @param {Function} [pluginClass] The plugin class. | |
| * @param {number} [priority] The plugin priority. | |
| */ | |
| function registerPlugin(pluginName, pluginClass, priority) { | |
| var _unifyPluginArguments = unifyPluginArguments(pluginName, pluginClass, priority); | |
| var _unifyPluginArguments2 = (0, _slicedToArray2.default)(_unifyPluginArguments, 3); | |
| pluginName = _unifyPluginArguments2[0]; | |
| pluginClass = _unifyPluginArguments2[1]; | |
| priority = _unifyPluginArguments2[2]; | |
| if (getPlugin(pluginName) === void 0) { | |
| _registerPlugin(pluginName, pluginClass, priority); | |
| } | |
| } | |
| /** | |
| * Registers plugin under the given name. | |
| * | |
| * @param {string|Function} pluginName The plugin name or plugin class. | |
| * @param {Function} [pluginClass] The plugin class. | |
| * @param {number} [priority] The plugin priority. | |
| */ | |
| function _registerPlugin(pluginName, pluginClass, priority) { | |
| var unifiedPluginName = (0, _string.toUpperCaseFirst)(pluginName); | |
| if (uniquePluginsList.hasItem(unifiedPluginName)) { | |
| throw new Error(ERROR_PLUGIN_REGISTERED(unifiedPluginName)); | |
| } | |
| if (priority === void 0) { | |
| uniquePluginsQueue.addItem(unifiedPluginName); | |
| } else { | |
| priorityPluginsQueue.addItem(priority, unifiedPluginName); | |
| } | |
| uniquePluginsList.addItem(unifiedPluginName, pluginClass); | |
| } | |
| /** | |
| * Unifies arguments to register the plugin. | |
| * | |
| * @param {string|Function} pluginName The plugin name or plugin class. | |
| * @param {Function} [pluginClass] The plugin class. | |
| * @param {number} [priority] The plugin priority. | |
| * @returns {Array} | |
| */ | |
| function unifyPluginArguments(pluginName, pluginClass, priority) { | |
| if (typeof pluginName === 'function') { | |
| pluginClass = pluginName; | |
| pluginName = pluginClass.PLUGIN_KEY; | |
| priority = pluginClass.PLUGIN_PRIORITY; | |
| } | |
| return [pluginName, pluginClass, priority]; | |
| } | |
| /***/ }), | |
| /* 205 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__(6); | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.PhysicalIndexToValueMap = void 0; | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _get2 = _interopRequireDefault(__webpack_require__(16)); | |
| var _inherits2 = _interopRequireDefault(__webpack_require__(7)); | |
| var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(8)); | |
| var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(4)); | |
| var _indexMap = __webpack_require__(164); | |
| var _physicallyIndexed = __webpack_require__(206); | |
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | |
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | |
| /** | |
| * Map for storing mappings from an physical index to a value. | |
| * | |
| * Does not update stored values on remove/add row or column action. | |
| */ | |
| var PhysicalIndexToValueMap = /*#__PURE__*/function (_IndexMap) { | |
| (0, _inherits2.default)(PhysicalIndexToValueMap, _IndexMap); | |
| var _super = _createSuper(PhysicalIndexToValueMap); | |
| function PhysicalIndexToValueMap() { | |
| (0, _classCallCheck2.default)(this, PhysicalIndexToValueMap); | |
| return _super.apply(this, arguments); | |
| } | |
| (0, _createClass2.default)(PhysicalIndexToValueMap, [{ | |
| key: "insert", | |
| value: | |
| /** | |
| * Add values to list and reorganize. | |
| * | |
| * @private | |
| * @param {number} insertionIndex Position inside the list. | |
| * @param {Array} insertedIndexes List of inserted indexes. | |
| */ | |
| function insert(insertionIndex, insertedIndexes) { | |
| this.indexedValues = (0, _physicallyIndexed.getListWithInsertedItems)(this.indexedValues, insertionIndex, insertedIndexes, this.initValueOrFn); | |
| (0, _get2.default)((0, _getPrototypeOf2.default)(PhysicalIndexToValueMap.prototype), "insert", this).call(this, insertionIndex, insertedIndexes); | |
| } | |
| /** | |
| * Remove values from the list and reorganize. | |
| * | |
| * @private | |
| * @param {Array} removedIndexes List of removed indexes. | |
| */ | |
| }, { | |
| key: "remove", | |
| value: function remove(removedIndexes) { | |
| this.indexedValues = (0, _physicallyIndexed.getListWithRemovedItems)(this.indexedValues, removedIndexes); | |
| (0, _get2.default)((0, _getPrototypeOf2.default)(PhysicalIndexToValueMap.prototype), "remove", this).call(this, removedIndexes); | |
| } | |
| }]); | |
| return PhysicalIndexToValueMap; | |
| }(_indexMap.IndexMap); | |
| exports.PhysicalIndexToValueMap = PhysicalIndexToValueMap; | |
| /***/ }), | |
| /* 206 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.getListWithInsertedItems = getListWithInsertedItems; | |
| exports.getListWithRemovedItems = getListWithRemovedItems; | |
| __webpack_require__(19); | |
| __webpack_require__(33); | |
| __webpack_require__(77); | |
| __webpack_require__(26); | |
| __webpack_require__(34); | |
| var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(25)); | |
| var _function = __webpack_require__(53); | |
| var _array = __webpack_require__(3); | |
| /** | |
| * Insert new items to the list. | |
| * | |
| * @private | |
| * @param {Array} indexedValues List of values for particular indexes. | |
| * @param {number} insertionIndex Position inside the actual list. | |
| * @param {Array} insertedIndexes List of inserted indexes. | |
| * @param {*} insertedValuesMapping Mapping which may provide value or function returning value for the specific parameters. | |
| * @returns {Array} List with new mappings. | |
| */ | |
| function getListWithInsertedItems(indexedValues, insertionIndex, insertedIndexes, insertedValuesMapping) { | |
| var firstInsertedIndex = insertedIndexes.length ? insertedIndexes[0] : void 0; | |
| return [].concat((0, _toConsumableArray2.default)(indexedValues.slice(0, firstInsertedIndex)), (0, _toConsumableArray2.default)(insertedIndexes.map(function (insertedIndex, ordinalNumber) { | |
| if ((0, _function.isFunction)(insertedValuesMapping)) { | |
| return insertedValuesMapping(insertedIndex, ordinalNumber); | |
| } | |
| return insertedValuesMapping; | |
| })), (0, _toConsumableArray2.default)(firstInsertedIndex === void 0 ? [] : indexedValues.slice(firstInsertedIndex))); | |
| } | |
| /** | |
| * Filter items from the list. | |
| * | |
| * @private | |
| * @param {Array} indexedValues List of values for particular indexes. | |
| * @param {Array} removedIndexes List of removed indexes. | |
| * @returns {Array} Reduced list of mappings. | |
| */ | |
| function getListWithRemovedItems(indexedValues, removedIndexes) { | |
| return (0, _array.arrayFilter)(indexedValues, function (_, index) { | |
| return removedIndexes.includes(index) === false; | |
| }); | |
| } | |
| /***/ }), | |
| /* 207 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.getRegisteredMapsCounter = getRegisteredMapsCounter; | |
| exports.MapCollection = void 0; | |
| __webpack_require__(12); | |
| __webpack_require__(39); | |
| __webpack_require__(9); | |
| __webpack_require__(11); | |
| __webpack_require__(13); | |
| __webpack_require__(23); | |
| __webpack_require__(43); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _mixed = __webpack_require__(20); | |
| var _object = __webpack_require__(5); | |
| var _localHooks = _interopRequireDefault(__webpack_require__(55)); | |
| // Counter for checking if there is a memory leak. | |
| var registeredMaps = 0; | |
| /** | |
| * Collection of index maps having unique names. It allow us to perform bulk operations such as init, remove, insert on all index maps that have been registered in the collection. | |
| */ | |
| var MapCollection = /*#__PURE__*/function () { | |
| function MapCollection() { | |
| (0, _classCallCheck2.default)(this, MapCollection); | |
| /** | |
| * Collection of index maps. | |
| * | |
| * @type {Map<string, IndexMap>} | |
| */ | |
| this.collection = new Map(); | |
| } | |
| /** | |
| * Register custom index map. | |
| * | |
| * @param {string} uniqueName Unique name of the index map. | |
| * @param {IndexMap} indexMap Index map containing miscellaneous (i.e. Meta data, indexes sequence), updated after remove and insert data actions. | |
| */ | |
| (0, _createClass2.default)(MapCollection, [{ | |
| key: "register", | |
| value: function register(uniqueName, indexMap) { | |
| var _this = this; | |
| if (this.collection.has(uniqueName) === false) { | |
| this.collection.set(uniqueName, indexMap); | |
| indexMap.addLocalHook('change', function () { | |
| return _this.runLocalHooks('change', indexMap); | |
| }); | |
| registeredMaps += 1; | |
| } | |
| } | |
| /** | |
| * Unregister custom index map. | |
| * | |
| * @param {string} name Name of the index map. | |
| */ | |
| }, { | |
| key: "unregister", | |
| value: function unregister(name) { | |
| var indexMap = this.collection.get(name); | |
| if ((0, _mixed.isDefined)(indexMap)) { | |
| indexMap.destroy(); | |
| this.collection.delete(name); | |
| this.runLocalHooks('change', indexMap); | |
| registeredMaps -= 1; | |
| } | |
| } | |
| /** | |
| * Unregisters and destroys all collected index map instances. | |
| */ | |
| }, { | |
| key: "unregisterAll", | |
| value: function unregisterAll() { | |
| var _this2 = this; | |
| this.collection.forEach(function (indexMap, name) { | |
| return _this2.unregister(name); | |
| }); | |
| this.collection.clear(); | |
| } | |
| /** | |
| * Get index map for the provided name. | |
| * | |
| * @param {string} [name] Name of the index map. | |
| * @returns {Array|IndexMap} | |
| */ | |
| }, { | |
| key: "get", | |
| value: function get(name) { | |
| if ((0, _mixed.isUndefined)(name)) { | |
| return Array.from(this.collection.values()); | |
| } | |
| return this.collection.get(name); | |
| } | |
| /** | |
| * Get collection size. | |
| * | |
| * @returns {number} | |
| */ | |
| }, { | |
| key: "getLength", | |
| value: function getLength() { | |
| return this.collection.size; | |
| } | |
| /** | |
| * Remove some indexes and corresponding mappings and update values of the others within all collection's index maps. | |
| * | |
| * @private | |
| * @param {Array} removedIndexes List of removed indexes. | |
| */ | |
| }, { | |
| key: "removeFromEvery", | |
| value: function removeFromEvery(removedIndexes) { | |
| this.collection.forEach(function (indexMap) { | |
| indexMap.remove(removedIndexes); | |
| }); | |
| } | |
| /** | |
| * Insert new indexes and corresponding mapping and update values of the others all collection's index maps. | |
| * | |
| * @private | |
| * @param {number} insertionIndex Position inside the actual list. | |
| * @param {Array} insertedIndexes List of inserted indexes. | |
| */ | |
| }, { | |
| key: "insertToEvery", | |
| value: function insertToEvery(insertionIndex, insertedIndexes) { | |
| this.collection.forEach(function (indexMap) { | |
| indexMap.insert(insertionIndex, insertedIndexes); | |
| }); | |
| } | |
| /** | |
| * Set default values to index maps within collection. | |
| * | |
| * @param {number} length Destination length for all stored maps. | |
| */ | |
| }, { | |
| key: "initEvery", | |
| value: function initEvery(length) { | |
| this.collection.forEach(function (indexMap) { | |
| indexMap.init(length); | |
| }); | |
| } | |
| }]); | |
| return MapCollection; | |
| }(); | |
| exports.MapCollection = MapCollection; | |
| (0, _object.mixin)(MapCollection, _localHooks.default); | |
| /** | |
| * @returns {number} | |
| */ | |
| function getRegisteredMapsCounter() { | |
| return registeredMaps; | |
| } | |
| /***/ }), | |
| /* 208 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__(23); | |
| __webpack_require__(35); | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| var _exportNames = { | |
| Highlight: true, | |
| Selection: true, | |
| handleMouseEvent: true, | |
| detectSelectionType: true, | |
| normalizeSelectionFactory: true | |
| }; | |
| var _highlight = _interopRequireDefault(__webpack_require__(423)); | |
| exports.Highlight = _highlight.default; | |
| var _selection = _interopRequireDefault(__webpack_require__(567)); | |
| exports.Selection = _selection.default; | |
| var _mouseEventHandler = __webpack_require__(413); | |
| exports.handleMouseEvent = _mouseEventHandler.handleMouseEvent; | |
| var _utils = __webpack_require__(167); | |
| exports.detectSelectionType = _utils.detectSelectionType; | |
| exports.normalizeSelectionFactory = _utils.normalizeSelectionFactory; | |
| var _constants = __webpack_require__(85); | |
| Object.keys(_constants).forEach(function (key) { | |
| if (key === "default" || key === "__esModule") return; | |
| if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
| if (key in exports && exports[key] === _constants[key]) return; | |
| exports[key] = _constants[key]; | |
| }); | |
| /***/ }), | |
| /* 209 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var defineWellKnownSymbol = __webpack_require__(420); | |
| // `Symbol.iterator` well-known symbol | |
| // https://tc39.es/ecma262/#sec-symbol.iterator | |
| defineWellKnownSymbol('iterator'); | |
| /***/ }), | |
| /* 210 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var $ = __webpack_require__(21); | |
| var assign = __webpack_require__(565); | |
| // `Object.assign` method | |
| // https://tc39.es/ecma262/#sec-object.assign | |
| // eslint-disable-next-line es/no-object-assign -- required for testing | |
| $({ target: 'Object', stat: true, forced: Object.assign !== assign }, { | |
| assign: assign | |
| }); | |
| /***/ }), | |
| /* 211 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| __webpack_require__(23); | |
| __webpack_require__(129); | |
| var _slicedToArray2 = _interopRequireDefault(__webpack_require__(18)); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _element = __webpack_require__(10); | |
| var _array = __webpack_require__(3); | |
| /** | |
| * @class GhostTable | |
| * @util | |
| */ | |
| var GhostTable = /*#__PURE__*/function () { | |
| function GhostTable(hotInstance) { | |
| (0, _classCallCheck2.default)(this, GhostTable); | |
| /** | |
| * Handsontable instance. | |
| * | |
| * @type {Core} | |
| */ | |
| this.hot = hotInstance; | |
| /** | |
| * Container element where every table will be injected. | |
| * | |
| * @type {HTMLElement|null} | |
| */ | |
| this.container = null; | |
| /** | |
| * Flag which determine is table was injected to DOM. | |
| * | |
| * @type {boolean} | |
| */ | |
| this.injected = false; | |
| /** | |
| * Added rows collection. | |
| * | |
| * @type {Array} | |
| */ | |
| this.rows = []; | |
| /** | |
| * Added columns collection. | |
| * | |
| * @type {Array} | |
| */ | |
| this.columns = []; | |
| /** | |
| * Samples prepared for calculations. | |
| * | |
| * @type {Map} | |
| * @default {null} | |
| */ | |
| this.samples = null; | |
| /** | |
| * Ghost table settings. | |
| * | |
| * @type {object} | |
| * @default {Object} | |
| */ | |
| this.settings = { | |
| useHeaders: true | |
| }; | |
| } | |
| /** | |
| * Add row. | |
| * | |
| * @param {number} row Row index. | |
| * @param {Map} samples Samples Map object. | |
| */ | |
| (0, _createClass2.default)(GhostTable, [{ | |
| key: "addRow", | |
| value: function addRow(row, samples) { | |
| if (this.columns.length) { | |
| throw new Error('Doesn\'t support multi-dimensional table'); | |
| } | |
| if (!this.rows.length) { | |
| this.container = this.createContainer(this.hot.rootElement.className); | |
| } | |
| var rowObject = { | |
| row: row | |
| }; | |
| this.rows.push(rowObject); | |
| this.samples = samples; | |
| this.table = this.createTable(this.hot.table.className); | |
| this.table.colGroup.appendChild(this.createColGroupsCol()); | |
| this.table.tr.appendChild(this.createRow(row)); | |
| this.container.container.appendChild(this.table.fragment); | |
| rowObject.table = this.table.table; | |
| } | |
| /** | |
| * Add a row consisting of the column headers. | |
| * | |
| * @param {Map} samples A map with sampled table values. | |
| */ | |
| }, { | |
| 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.appendColumnHeadersRow(); | |
| this.container.container.appendChild(this.table.fragment); | |
| rowObject.table = this.table.table; | |
| } | |
| } | |
| /** | |
| * Add column. | |
| * | |
| * @param {number} column Column index. | |
| * @param {Map} samples A map with sampled table values. | |
| */ | |
| }, { | |
| 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) { | |
| // Please keep in mind that the renderable column index equal to the visual columns index for the GhostTable. | |
| // We render all columns. | |
| 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 The setting name to get. | |
| * @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; | |
| } | |
| /** | |
| * Creates DOM elements for headers and appends them to the THEAD element of the table. | |
| */ | |
| }, { | |
| key: "appendColumnHeadersRow", | |
| value: function appendColumnHeadersRow() { | |
| var _this3 = this; | |
| var rootDocument = this.hot.rootDocument; | |
| var domFragment = rootDocument.createDocumentFragment(); | |
| var columnHeaders = []; | |
| if (this.hot.hasRowHeaders()) { | |
| var th = rootDocument.createElement('th'); | |
| columnHeaders.push([-1, th]); | |
| domFragment.appendChild(th); | |
| } | |
| this.samples.forEach(function (sample) { | |
| (0, _array.arrayEach)(sample.strings, function (string) { | |
| var column = string.col; | |
| var th = rootDocument.createElement('th'); | |
| columnHeaders.push([column, th]); | |
| domFragment.appendChild(th); | |
| }); | |
| }); // Appending DOM elements for headers | |
| this.table.tHead.appendChild(domFragment); | |
| (0, _array.arrayEach)(columnHeaders, function (columnHeader) { | |
| var _columnHeader = (0, _slicedToArray2.default)(columnHeader, 2), | |
| column = _columnHeader[0], | |
| th = _columnHeader[1]; // Using source method for filling a header with value. | |
| _this3.hot.view.appendColHeader(column, th); | |
| }); | |
| } | |
| /** | |
| * 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] The element to which the ghost table is injected. | |
| */ | |
| }, { | |
| 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 The CSS classes to add. | |
| * @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 The CSS classes to add. | |
| * @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; | |
| /***/ }), | |
| /* 212 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.AutocompleteEditor = exports.EDITOR_TYPE = void 0; | |
| var _autocompleteEditor = __webpack_require__(585); | |
| exports.EDITOR_TYPE = _autocompleteEditor.EDITOR_TYPE; | |
| exports.AutocompleteEditor = _autocompleteEditor.AutocompleteEditor; | |
| /***/ }), | |
| /* 213 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.HandsontableEditor = exports.EDITOR_TYPE = void 0; | |
| var _handsontableEditor = __webpack_require__(586); | |
| exports.EDITOR_TYPE = _handsontableEditor.EDITOR_TYPE; | |
| exports.HandsontableEditor = _handsontableEditor.HandsontableEditor; | |
| /***/ }), | |
| /* 214 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.DateEditor = exports.EDITOR_TYPE = void 0; | |
| var _dateEditor = __webpack_require__(588); | |
| exports.EDITOR_TYPE = _dateEditor.EDITOR_TYPE; | |
| exports.DateEditor = _dateEditor.DateEditor; | |
| /***/ }), | |
| /* 215 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.autocompleteValidator = exports.VALIDATOR_TYPE = void 0; | |
| var _autocompleteValidator = __webpack_require__(605); | |
| exports.VALIDATOR_TYPE = _autocompleteValidator.VALIDATOR_TYPE; | |
| exports.autocompleteValidator = _autocompleteValidator.autocompleteValidator; | |
| /***/ }), | |
| /* 216 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| 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; | |
| __webpack_require__(59); | |
| __webpack_require__(60); | |
| __webpack_require__(26); | |
| __webpack_require__(77); | |
| __webpack_require__(12); | |
| __webpack_require__(9); | |
| __webpack_require__(62); | |
| __webpack_require__(11); | |
| __webpack_require__(13); | |
| __webpack_require__(17); | |
| __webpack_require__(43); | |
| var _object = __webpack_require__(5); | |
| var _event = __webpack_require__(45); | |
| 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, _object.isObject)(columnState) === false) { | |
| 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 The sort state collection. | |
| * @returns {boolean} | |
| */ | |
| function areValidSortStates(sortStates) { | |
| if (sortStates.some(function (columnState) { | |
| return isValidColumnState(columnState) === false; | |
| })) { | |
| return false; | |
| } | |
| var sortedColumns = sortStates.map(function (_ref) { | |
| var column = _ref.column; | |
| return column; | |
| }); // Indexes occurs only once. | |
| return new Set(sortedColumns).size === sortedColumns.length; | |
| } | |
| /** | |
| * 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; | |
| } | |
| /***/ }), | |
| /* 217 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| exports.__esModule = true; | |
| exports.default = separatorItem; | |
| exports.KEY = void 0; | |
| var KEY = '---------'; | |
| /** | |
| * @returns {object} | |
| */ | |
| exports.KEY = KEY; | |
| function separatorItem() { | |
| return { | |
| name: KEY | |
| }; | |
| } | |
| /***/ }), | |
| /* 218 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| __webpack_require__(79); | |
| __webpack_require__(35); | |
| __webpack_require__(128); | |
| __webpack_require__(29); | |
| __webpack_require__(52); | |
| __webpack_require__(9); | |
| __webpack_require__(51); | |
| __webpack_require__(19); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _cursor = _interopRequireDefault(__webpack_require__(670)); | |
| var _predefinedItems = __webpack_require__(91); | |
| var _utils = __webpack_require__(78); | |
| var _core = _interopRequireDefault(__webpack_require__(237)); | |
| var _eventManager = _interopRequireDefault(__webpack_require__(31)); | |
| var _array = __webpack_require__(3); | |
| var _browser = __webpack_require__(84); | |
| var _element = __webpack_require__(10); | |
| var _event = __webpack_require__(45); | |
| var _function = __webpack_require__(53); | |
| var _mixed = __webpack_require__(20); | |
| var _object = __webpack_require__(5); | |
| var _unicode = __webpack_require__(70); | |
| var _localHooks = _interopRequireDefault(__webpack_require__(55)); | |
| 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); | |
| }); | |
| this.eventManager.addEventListener(frame.document, 'contextmenu', function (event) { | |
| return _this.onDocumentContextMenu(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, | |
| maxCols: 1, | |
| 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(); | |
| } | |
| } | |
| }; | |
| 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] The mouse event object. | |
| */ | |
| }, { | |
| 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 + 1; | |
| 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 scrollbarWidth = (0, _element.getScrollbarWidth)(this.hot.rootDocument); | |
| var left = this.offset.left + cursor.left - this.container.offsetWidth + scrollbarWidth + 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 | |
| * @param {Core} hot The Handsontable instance. | |
| * @param {HTMLCellElement} TD The rendered cell element. | |
| * @param {number} row The visual index. | |
| * @param {number} col The visual index. | |
| * @param {string} prop The column property if used. | |
| * @param {string} value The cell value. | |
| */ | |
| }, { | |
| 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 The keyaboard event object. | |
| */ | |
| }, { | |
| 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); // Additional 3px to menu's size because of additional border around its `table.htCore`. | |
| holderStyle.width = "".concat(currentHiderWidth + 3, "px"); | |
| holderStyle.height = "".concat(realHeight + 3, "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. | |
| */ | |
| }, { | |
| 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 The mouse event object. | |
| */ | |
| }, { | |
| 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); | |
| } | |
| } | |
| /** | |
| * Document's contextmenu listener. | |
| * | |
| * @private | |
| * @param {MouseEvent} event The mouse event object. | |
| */ | |
| }, { | |
| key: "onDocumentContextMenu", | |
| value: function onDocumentContextMenu(event) { | |
| if (!this.isOpened()) { | |
| return; | |
| } | |
| if ((0, _element.hasClass)(event.target, 'htCore') && (0, _element.isChildOf)(event.target, this.hotMenu.rootElement)) { | |
| event.preventDefault(); | |
| } | |
| } | |
| }]); | |
| return Menu; | |
| }(); | |
| (0, _object.mixin)(Menu, _localHooks.default); | |
| var _default = Menu; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 219 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireDefault = __webpack_require__(0); | |
| exports.__esModule = true; | |
| exports.default = void 0; | |
| var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(63)); | |
| var _classCallCheck2 = _interopRequireDefault(__webpack_require__(1)); | |
| var _createClass2 = _interopRequireDefault(__webpack_require__(2)); | |
| var _index = __webpack_require__(38); | |
| var _templateLiteralTag = __webpack_require__(64); | |
| var _templateObject, _templateObject2, _templateObject3, _templateObject4; | |
| /** | |
| * 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. | |
| * @returns {string} | |
| */ | |
| (0, _createClass2.default)(MergedCellCoords, [{ | |
| key: "normalize", | |
| value: | |
| /** | |
| * Sanitize (prevent from going outside the boundaries) the merged cell. | |
| * | |
| * @param {Core} hotInstance The Handsontable instance. | |
| */ | |
| 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. | |
| * @returns {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. | |
| * @returns {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. | |
| * @returns {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. | |
| * @returns {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. | |
| * | |
| * @returns {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 || (_templateObject = (0, _taggedTemplateLiteral2.default)(["The merged cell declared with {row: ", ", col: ", ", \n rowspan: ", ", colspan: ", "} contains negative values, which is \n not supported. It will not be added to the collection."], ["The merged cell declared with {row: ", ", col: ", ",\\x20\n rowspan: ", ", colspan: ", "} contains negative values, which is\\x20\n not supported. It will not be added to the collection."])), 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. | |
| * @returns {string} | |
| */ | |
| }, { | |
| key: "IS_OUT_OF_BOUNDS_WARNING", | |
| value: function IS_OUT_OF_BOUNDS_WARNING(newMergedCell) { | |
| return (0, _templateLiteralTag.toSingleLine)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["The merged cell declared at [", ", ", "] is positioned \n (or positioned partially) outside of the table range. It was not added to the table, please fix your setup."], ["The merged cell declared at [", ", ", "] is positioned\\x20\n (or positioned partially) outside of the table range. It was not added to the table, please fix your setup."])), 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. | |
| * @returns {string} | |
| */ | |
| }, { | |
| key: "IS_SINGLE_CELL", | |
| value: function IS_SINGLE_CELL(newMergedCell) { | |
| return (0, _templateLiteralTag.toSingleLine)(_templateObject3 || (_templateObject3 = (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."], ["The merged cell declared at [", ", ", "] has both \"rowspan\"\\x20\n and \"colspan\" declared as \"1\", which makes it a single cell. It cannot be added to the collection."])), 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. | |
| * @returns {string} | |
| */ | |
| }, { | |
| key: "ZERO_SPAN_WARNING", | |
| value: function ZERO_SPAN_WARNING(newMergedCell) { | |
| return (0, _templateLiteralTag.toSingleLine)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["The merged cell declared at [", ", ", "] has \"rowspan\" \n or \"colspan\" declared as \"0\", which is not supported. It cannot be added to the collection."], ["The merged cell declared at [", ", ", "] has \"rowspan\"\\x20\n or \"colspan\" declared as \"0\", which is not supported. It cannot be added to the collection."])), 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. | |
| * @returns {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. | |
| * @returns {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. | |
| * @returns {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. | |
| * @returns {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; | |
| /***/ }), | |
| /* 220 */ | |
| /***/ (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__(37)); | |
| var _object = __webpack_require__(5); | |
| var _array = __webpack_require__(3); | |
| var _predefinedItems = __webpack_require__(91); | |
| var _conditionRegisterer = __webpack_require__(36); | |
| var _none = __webpack_require__(755); | |
| exports.CONDITION_NONE = _none.CONDITION_NAME; | |
| var _empty = __webpack_require__(453); | |
| exports.CONDITION_EMPTY = _empty.CONDITION_NAME; | |
| var _notEmpty = __webpack_require__(756); | |
| exports.CONDITION_NOT_EMPTY = _notEmpty.CONDITION_NAME; | |
| var _equal = __webpack_require__(454); | |
| exports.CONDITION_EQUAL = _equal.CONDITION_NAME; | |
| var _notEqual = __webpack_require__(757); | |
| exports.CONDITION_NOT_EQUAL = _notEqual.CONDITION_NAME; | |
| var _greaterThan = __webpack_require__(758); | |
| exports.CONDITION_GREATER_THAN = _greaterThan.CONDITION_NAME; | |
| var _greaterThanOrEqual = __webpack_require__(759); | |
| exports.CONDITION_GREATER_THAN_OR_EQUAL = _greaterThanOrEqual.CONDITION_NAME; | |
| var _lessThan = __webpack_require__(760); | |
| exports.CONDITION_LESS_THAN = _lessThan.CONDITION_NAME; | |
| var _lessThanOrEqual = __webpack_require__(761); | |
| exports.CONDITION_LESS_THAN_OR_EQUAL = _lessThanOrEqual.CONDITION_NAME; | |
| var _between = __webpack_require__(455); | |
| exports.CONDITION_BETWEEN = _between.CONDITION_NAME; | |
| var _notBetween = __webpack_require__(762); | |
| exports.CONDITION_NOT_BETWEEN = _notBetween.CONDITION_NAME; | |
| var _beginsWith = __webpack_require__(763); | |
| exports.CONDITION_BEGINS_WITH = _beginsWith.CONDITION_NAME; | |
| var _endsWith = __webpack_require__(764); | |
| exports.CONDITION_ENDS_WITH = _endsWith.CONDITION_NAME; | |
| var _contains = __webpack_require__(458); | |
| exports.CONDITION_CONTAINS = _contains.CONDITION_NAME; | |
| var _notContains = __webpack_require__(766); | |
| exports.CONDITION_NOT_CONTAINS = _notContains.CONDITION_NAME; | |
| var _before = __webpack_require__(457); | |
| exports.CONDITION_DATE_BEFORE = _before.CONDITION_NAME; | |
| var _after = __webpack_require__(456); | |
| exports.CONDITION_DATE_AFTER = _after.CONDITION_NAME; | |
| var _tomorrow = __webpack_require__(767); | |
| exports.CONDITION_TOMORROW = _tomorrow.CONDITION_NAME; | |
| var _today = __webpack_require__(768); | |
| exports.CONDITION_TODAY = _today.CONDITION_NAME; | |
| var _yesterday = __webpack_require__(769); | |
| exports.CONDITION_YESTERDAY = _yesterday.CONDITION_NAME; | |
| var _byValue = __webpack_require__(770); | |
| exports.CONDITION_BY_VALUE = _byValue.CONDITION_NAME; | |
| var _true = __webpack_require__(771); | |
| exports.CONDITION_TRUE = _true.CONDITION_NAME; | |
| var _false = __webpack_require__(772); | |
| exports.CONDITION_FALSE = _false.CONDITION_NAME; | |
| var _conjunction = __webpack_require__(221); | |
| exports.OPERATION_AND = _conjunction.OPERATION_ID; | |
| var _disjunction = __webpack_require__(459); | |
| exports.OPERATION_OR = _disjunction.OPERATION_ID; | |
| var _disjunctionWithExtraCondition = __webpack_require__(460); | |
| 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'`). | |
| * | |
| * @param {string} type The data type. | |
| * @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; | |
| } | |
| /***/ }), | |
| /* 221 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| var _interopRequireWildcard = __webpack_require__(14); | |
| exports.__esModule = true; | |
| exports.operationResult = operationResult; | |
| exports.SHORT_NAME_FOR_COMPONENT = exports.OPERATION_ID = void 0; | |
| var C = _interopRequireWildcard(__webpack_require__(15)); | |
| var _logicalOperationRegisterer = __webpack_require__(143); | |
| 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? | |
| /** | |
| * @param {Array} conditions An array with values to check. | |
| * @param {*} value The comparable value. | |
| * @returns {boolean} | |
| */ | |
| 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); | |
| /***/ }), | |
| /* 222 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| "use strict"; | |
| __webpack_require__(6); | |
| 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 _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(28)); | |
| var _get2 = _interopRequireDefault(__webpack_require__(16)); | |
| var _inherits2 = _interopRequireDefault(__webpack_require__(7)); | |
| var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(8)); | |
| var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(4)); | |
| __webpack_require__(12); | |
| __webpack_require__(9); | |
| __webpack_require__(11); | |
| __webpack_require__(22); | |
| __webpack_require__(13); | |
| var _element = __webpack_require__(10); | |
| var _object = __webpack_require__(5); | |
| var _base = _interopRequireDefault(__webpack_require__(144)); | |
| function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | |
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | |
| var privatePool = new WeakMap(); | |
| /** | |
| * @class InputUI | |
| * @util | |
| */ | |
| var InputUI = /*#__PURE__*/function (_BaseUI) { | |
| (0, _inherits2.default)(InputUI, _BaseUI); | |
| var _super = _createSuper(InputUI); | |
| function InputUI(hotInstance, options) { | |
| var _this; | |
| (0, _classCallCheck2.default)(this, InputUI); | |
| _this = _super.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 The mouse event object. | |
| */ | |
| }, { | |
| key: "onKeyup", | |
| value: function onKeyup(event) { | |
| this.options.value = event.target.value; | |
| } | |
| }], [{ | |
| key: "DEFAULTS", | |
| get: function get() { | |
| return (0, _object.clone)({ | |
| placeholder: '', | |
| type: 'text', | |
| tagName: 'input' | |
| }); | |
| } | |
| }]); | |
| return InputUI; | |
| }(_base.default); | |
| var _default = InputUI; | |
| exports.default = _default; | |
| /***/ }), | |
| /* 223 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var utils = __webpack_require__(86); | |
| var error = __webpack_require__(80); | |
| //TODO | |
| exports.ASC = function() { | |
| throw new Error('ASC is not implemented'); | |
| }; | |
| //TODO | |
| exports.BAHTTEXT = function() { | |
| throw new Error('BAHTTEXT is not implemented'); | |
| }; | |
| exports.CHAR = function(number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return String.fromCharCode(number); | |
| }; | |
| exports.CLEAN = function(text) { | |
| text = text || ''; | |
| var re = /[\0-\x1F]/g; | |
| return text.replace(re, ""); | |
| }; | |
| exports.CODE = function(text) { | |
| text = text || ''; | |
| var result = text.charCodeAt(0); | |
| if (isNaN(result)) { | |
| result = error.na; | |
| } | |
| return result; | |
| }; | |
| exports.CONCATENATE = function() { | |
| var args = utils.flatten(arguments); | |
| var trueFound = 0; | |
| while ((trueFound = args.indexOf(true)) > -1) { | |
| args[trueFound] = 'TRUE'; | |
| } | |
| var falseFound = 0; | |
| while ((falseFound = args.indexOf(false)) > -1) { | |
| args[falseFound] = 'FALSE'; | |
| } | |
| return args.join(''); | |
| }; | |
| //TODO | |
| exports.DBCS = function() { | |
| throw new Error('DBCS is not implemented'); | |
| }; | |
| //TODO | |
| exports.DOLLAR = function() { | |
| throw new Error('DOLLAR is not implemented'); | |
| }; | |
| exports.EXACT = function(text1, text2) { | |
| if (arguments.length !== 2) { | |
| return error.na; | |
| } | |
| return text1 === text2; | |
| }; | |
| exports.FIND = function(find_text, within_text, position) { | |
| if (arguments.length < 2) { | |
| return error.na; | |
| } | |
| position = (position === undefined) ? 0 : position; | |
| return within_text ? within_text.indexOf(find_text, position - 1) + 1 : null; | |
| }; | |
| //TODO | |
| exports.FIXED = function() { | |
| throw new Error('FIXED is not implemented'); | |
| }; | |
| exports.HTML2TEXT = function (value) { | |
| var result = ''; | |
| if (value) { | |
| if (value instanceof Array) { | |
| value.forEach(function (line) { | |
| if (result !== '') { | |
| result += '\n'; | |
| } | |
| result += (line.replace(/<(?:.|\n)*?>/gm, '')); | |
| }); | |
| } else { | |
| result = value.replace(/<(?:.|\n)*?>/gm, ''); | |
| } | |
| } | |
| return result; | |
| }; | |
| exports.LEFT = function(text, number) { | |
| number = (number === undefined) ? 1 : number; | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error || typeof text !== 'string') { | |
| return error.value; | |
| } | |
| return text ? text.substring(0, number) : null; | |
| }; | |
| exports.LEN = function(text) { | |
| if (arguments.length === 0) { | |
| return error.error; | |
| } | |
| if (typeof text === 'string') { | |
| return text ? text.length : 0; | |
| } | |
| if (text.length) { | |
| return text.length; | |
| } | |
| return error.value; | |
| }; | |
| exports.LOWER = function(text) { | |
| if (typeof text !== 'string') { | |
| return error.value; | |
| } | |
| return text ? text.toLowerCase() : text; | |
| }; | |
| exports.MID = function(text, start, number) { | |
| start = utils.parseNumber(start); | |
| number = utils.parseNumber(number); | |
| if (utils.anyIsError(start, number) || typeof text !== 'string') { | |
| return number; | |
| } | |
| var begin = start - 1; | |
| var end = begin + number; | |
| return text.substring(begin, end); | |
| }; | |
| // TODO | |
| exports.NUMBERVALUE = function (text, decimal_separator, group_separator) { | |
| decimal_separator = (typeof decimal_separator === 'undefined') ? '.' : decimal_separator; | |
| group_separator = (typeof group_separator === 'undefined') ? ',' : group_separator; | |
| return Number(text.replace(decimal_separator, '.').replace(group_separator, '')); | |
| }; | |
| // TODO | |
| exports.PRONETIC = function() { | |
| throw new Error('PRONETIC is not implemented'); | |
| }; | |
| exports.PROPER = function(text) { | |
| if (text === undefined || text.length === 0) { | |
| return error.value; | |
| } | |
| if (text === true) { | |
| text = 'TRUE'; | |
| } | |
| if (text === false) { | |
| text = 'FALSE'; | |
| } | |
| if (isNaN(text) && typeof text === 'number') { | |
| return error.value; | |
| } | |
| if (typeof text === 'number') { | |
| text = '' + text; | |
| } | |
| return text.replace(/\w\S*/g, function(txt) { | |
| return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); | |
| }); | |
| }; | |
| exports.REGEXEXTRACT = function (text, regular_expression) { | |
| if (arguments.length < 2) { | |
| return error.na; | |
| } | |
| var match = text.match(new RegExp(regular_expression)); | |
| return match ? (match[match.length > 1 ? match.length - 1 : 0]) : null; | |
| }; | |
| exports.REGEXMATCH = function (text, regular_expression, full) { | |
| if (arguments.length < 2) { | |
| return error.na; | |
| } | |
| var match = text.match(new RegExp(regular_expression)); | |
| return full ? match : !!match; | |
| }; | |
| exports.REGEXREPLACE = function (text, regular_expression, replacement) { | |
| if (arguments.length < 3) { | |
| return error.na; | |
| } | |
| return text.replace(new RegExp(regular_expression), replacement); | |
| }; | |
| exports.REPLACE = function(text, position, length, new_text) { | |
| position = utils.parseNumber(position); | |
| length = utils.parseNumber(length); | |
| if (utils.anyIsError(position, length) || | |
| typeof text !== 'string' || | |
| typeof new_text !== 'string') { | |
| return error.value; | |
| } | |
| return text.substr(0, position - 1) + new_text + text.substr(position - 1 + length); | |
| }; | |
| exports.REPT = function(text, number) { | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return new Array(number + 1).join(text); | |
| }; | |
| exports.RIGHT = function(text, number) { | |
| number = (number === undefined) ? 1 : number; | |
| number = utils.parseNumber(number); | |
| if (number instanceof Error) { | |
| return number; | |
| } | |
| return text ? text.substring(text.length - number) : error.na; | |
| }; | |
| exports.SEARCH = function(find_text, within_text, position) { | |
| var foundAt; | |
| if (typeof find_text !== 'string' || typeof within_text !== 'string') { | |
| return error.value; | |
| } | |
| position = (position === undefined) ? 0 : position; | |
| foundAt = within_text.toLowerCase().indexOf(find_text.toLowerCase(), position - 1)+1; | |
| return (foundAt === 0)?error.value:foundAt; | |
| }; | |
| exports.SPLIT = function (text, separator) { | |
| return text.split(separator); | |
| }; | |
| exports.SUBSTITUTE = function(text, old_text, new_text, occurrence) { | |
| if (arguments.length < 2) { | |
| return error.na; | |
| } | |
| if (!text || !old_text || !new_text) { | |
| return text; | |
| } else if (occurrence === undefined) { | |
| return text.replace(new RegExp(old_text, 'g'), new_text); | |
| } else { | |
| var index = 0; | |
| var i = 0; | |
| while (text.indexOf(old_text, index) > 0) { | |
| index = text.indexOf(old_text, index + 1); | |
| i++; | |
| if (i === occurrence) { | |
| return text.substring(0, index) + new_text + text.substring(index + old_text.length); | |
| } | |
| } | |
| } | |
| }; | |
| exports.T = function(value) { | |
| return (typeof value === "string") ? value : ''; | |
| }; | |
| // TODO incomplete implementation | |
| exports.TEXT = function() { | |
| throw new Error('TEXT is not implemented'); | |
| }; | |
| exports.TRIM = function(text) { | |
| if (typeof text !== 'string') { | |
| return error.value; | |
| } | |
| return text.replace(/ +/g, ' ').trim(); | |
| }; | |
| exports.UNICHAR = exports.CHAR; | |
| exports.UNICODE = exports.CODE; | |
| exports.UPPER = function(text) { | |
| if (typeof text !== 'string') { | |
| return error.value; | |
| } | |
| return text.toUpperCase(); | |
| }; | |
| //TODO | |
| exports.VALUE = function() { | |
| throw new Error('VALUE is not implemented'); | |
| }; | |
| /***/ }), | |
| /* 224 */ | |
| /***/ (function(module, exports) { | |
| var defaultOperator = '='; | |
| var validSymbols = ['>', '>=', '<', '<=', '=', '<>']; | |
| var TOKEN_TYPE_OPERATOR = 'operator'; | |
| var TOKEN_TYPE_LITERAL = 'literal'; | |
| var SUPPORTED_TOKENS = [TOKEN_TYPE_OPERATOR, TOKEN_TYPE_LITERAL]; | |
| exports.TOKEN_TYPE_OPERATOR = TOKEN_TYPE_OPERATOR; | |
| exports.TOKEN_TYPE_LITERAL = TOKEN_TYPE_LITERAL; | |
| /** | |
| * Create token which describe passed symbol/value. | |
| * | |
| * @param {String} value Value/Symbol to describe. | |
| * @param {String} type Type of the token 'operator' or 'literal'. | |
| * @return {Object} | |
| */ | |
| function createToken(value, type) { | |
| if (SUPPORTED_TOKENS.indexOf(type) === -1) { | |
| throw new Error('Unsupported token type: ' + type); | |
| } | |
| return { | |
| value: value, | |
| type: type, | |
| }; | |
| } | |
| /** | |
| * Tries to cast numeric values to their type passed as a string. | |
| * | |
| * @param {*} value | |
| * @return {*} | |
| */ | |
| function castValueToCorrectType(value) { | |
| if (typeof value !== 'string') { | |
| return value; | |
| } | |
| if (/^\d+(\.\d+)?$/.test(value)) { | |
| value = value.indexOf('.') === -1 ? parseInt(value, 10) : parseFloat(value); | |
| } | |
| return value; | |
| } | |
| /** | |
| * Generate stream of tokens from passed expression. | |
| * | |
| * @param {String} expression | |
| * @return {String[]} | |
| */ | |
| function tokenizeExpression(expression) { | |
| var expressionLength = expression.length; | |
| var tokens = []; | |
| var cursorIndex = 0; | |
| var processedValue = ''; | |
| var processedSymbol = ''; | |
| while (cursorIndex < expressionLength) { | |
| var char = expression.charAt(cursorIndex); | |
| switch (char) { | |
| case '>': | |
| case '<': | |
| case '=': | |
| processedSymbol = processedSymbol + char; | |
| if (processedValue.length > 0) { | |
| tokens.push(processedValue); | |
| processedValue = ''; | |
| } | |
| break; | |
| default: | |
| if (processedSymbol.length > 0) { | |
| tokens.push(processedSymbol); | |
| processedSymbol = ''; | |
| } | |
| processedValue = processedValue + char; | |
| break; | |
| } | |
| cursorIndex++; | |
| } | |
| if (processedValue.length > 0) { | |
| tokens.push(processedValue); | |
| } | |
| if (processedSymbol.length > 0) { | |
| tokens.push(processedSymbol); | |
| } | |
| return tokens; | |
| }; | |
| /** | |
| * Analyze and convert tokens to an object which describes their meaning. | |
| * | |
| * @param {String[]} tokens | |
| * @return {Object[]} | |
| */ | |
| function analyzeTokens(tokens) { | |
| var literalValue = ''; | |
| var analyzedTokens = []; | |
| for (var i = 0; i < tokens.length; i++) { | |
| var token = tokens[i]; | |
| if (i === 0 && validSymbols.indexOf(token) >= 0) { | |
| analyzedTokens.push(createToken(token, TOKEN_TYPE_OPERATOR)); | |
| } else { | |
| literalValue += token; | |
| } | |
| } | |
| if (literalValue.length > 0) { | |
| analyzedTokens.push(createToken(castValueToCorrectType(literalValue), TOKEN_TYPE_LITERAL)); | |
| } | |
| if (analyzedTokens.length > 0 && analyzedTokens[0].type !== TOKEN_TYPE_OPERATOR) { | |
| analyzedTokens.unshift(createToken(defaultOperator, TOKEN_TYPE_OPERATOR)); | |
| } | |
| return analyzedTokens; | |
| }; | |
| /** | |
| * Compute/Evaluate an expression passed as an array of tokens. | |
| * | |
| * @param {Object[]} tokens | |
| * @return {Boolean} | |
| */ | |
| function computeExpression(tokens) { | |
| var values = []; | |
| var operator; | |
| for (var i = 0; i < tokens.length; i++) { | |
| var token = tokens[i]; | |
| switch (token.type) { | |
| case TOKEN_TYPE_OPERATOR: | |
| operator = token.value; | |
| break; | |
| case TOKEN_TYPE_LITERAL: | |
| values.push(token.value); | |
| break; | |
| } | |
| } | |
| return evaluate(values, operator); | |
| }; | |
| /** | |
| * Evaluate values based on passed math operator. | |
| * | |
| * @param {*} values | |
| * @param {String} operator | |
| * @return {Boolean} | |
| */ | |
| function evaluate(values, operator) { | |
| var result = false; | |
| switch (operator) { | |
| case '>': | |
| result = values[0] > values[1]; | |
| break; | |
| case '>=': | |
| result = values[0] >= values[1]; | |
| break; | |
| case '<': | |
| result = values[0] < values[1]; | |
| break; | |
| case '<=': | |
| result = values[0] <= values[1]; | |
| break; | |
| case '=': | |
| result = values[0] == values[1]; | |
| break; | |
| case '<>': | |
| result = values[0] != values[1]; | |
| break; | |
| } | |
| return result; | |
| } | |
| exports.parse = function(expression) { | |
| return analyzeTokens(tokenizeExpression(expression)); | |
| }; | |
| exports.createToken = createToken; | |
| exports.compute = computeExpression; | |
| /***/ }), | |
| /* 225 */ | |
| /***/ (function(module, exports, __webpack_require__) { | |
| var error = __webpack_require__(80); | |
| // TODO | |
| exports.CELL = function() { | |
| throw new Error('CELL is not implemented'); | |
| }; | |
| exports.ERROR = {}; | |
| exports.ERROR.TYPE = function(error_val) { | |
| switch (error_val) { | |
| case error.nil: return 1; | |
| case error.div0: return 2; | |
| case error.value: return 3; | |
| case error.ref: return 4; | |
| case error.name: return 5; | |
| case error.num: return 6; | |
| case error.na: return 7; | |
| case error.data: return 8; | |
| } | |
| return error.na; | |
| }; | |
| // TODO | |
| exports.INFO = function() { | |
| throw new Error('INFO is not implemented'); | |
| }; | |
| exports.ISBLANK = function(value) { | |
| return value === null; | |
| }; | |
| exports.ISBINARY = function (number) { | |
| return (/^[01]{1,10}$/).test(number); | |
| }; | |
| exports.ISERR = function(value) { | |
| return ([error.value, error.ref, error.div0, error.num, error.name, error.nil]).indexOf(value) >= 0 || | |
| (typeof value === 'number' && (isNaN(value) || !isFinite(value))); | |
| }; | |
| exports.ISERROR = function(value) { | |
| return exports.ISERR(value) || value === error.na; | |
| }; | |
| exports.ISEVEN = function(number) { | |
| return (Math.floor(Math.abs(number)) & 1) ? false : true; | |
| }; | |
| // TODO | |
| exports.ISFORMULA = function() { | |
| throw new Error('ISFORMULA is not implemented'); | |
| }; | |
| exports.ISLOGICAL = function(value) { | |
| return value === true || value === false; | |
| }; | |
| exports.ISNA = function(value) { | |
| return value === error.na; | |
| }; | |
| exports.ISNONTEXT = function(value) { | |
| return typeof(value) !== 'string'; | |
| }; | |
| exports.ISNUMBER = function(value) { | |
| return typeof(value) === 'number' && !isNaN(value) && isFinite(value); | |
| }; | |
| exports.ISODD = function(number) { | |
| return (Math.floor(Math.abs(number)) & 1) ? true : false; | |
| }; | |
| // TODO | |
| exports.ISREF = function() { | |
| throw new Error('ISREF is not implemented'); | |
| }; | |
| exports.ISTEXT = function(value) { | |
| return typeof(value) === 'string'; | |
| }; | |
| exports.N = function(value) { | |
| if (this.ISNUMBER(value)) { | |
| return value; | |
| } | |
| if (value instanceof Date) { | |
| return value.getTime(); | |
| } | |
| if (value === true) { | |
| return 1; | |
| } | |
| if (value === false) { | |
| return 0; | |
| } | |
| if (this.ISERROR(value)) { | |
| return value; | |
| } | |
| return 0; | |
| }; | |
| exports.NA = function() { | |
| return error.na; | |
| }; | |
| // TO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment