diff --git a/muk_web_preview_msoffice/__manifest__.py b/muk_web_preview_msoffice/__manifest__.py index d1a248e..dba4c00 100644 --- a/muk_web_preview_msoffice/__manifest__.py +++ b/muk_web_preview_msoffice/__manifest__.py @@ -29,7 +29,7 @@ - Excel (*.xls | *.xlsx, application/msexcel) - PowerPoint (*.ppt | *.pptx, application/mspowerpoint) """, - "version": "10.0.1.0.2", + "version": "10.0.1.0.3", "category": "Extra Tools", "license": "AGPL-3", "website": "http://www.mukit.at", @@ -62,4 +62,4 @@ "application": False, "installable": True, -} +} \ No newline at end of file diff --git a/muk_web_preview_msoffice/controllers/main.py b/muk_web_preview_msoffice/controllers/main.py index 99fcc9b..f8ff0e3 100644 --- a/muk_web_preview_msoffice/controllers/main.py +++ b/muk_web_preview_msoffice/controllers/main.py @@ -120,4 +120,4 @@ class MSOfficeParserController(http.Controller): headers = [('Content-Type', 'application/pdf'), ('Content-Disposition', 'attachment;filename="{}";'.format(filename)), ('Content-Length', len(file))] - return request.make_response(file, headers) + return request.make_response(file, headers) \ No newline at end of file diff --git a/muk_web_preview_msoffice/static/lib/handsontable/handsontable.js b/muk_web_preview_msoffice/static/lib/handsontable/handsontable.js index 7ca294e..760d8fb 100644 --- a/muk_web_preview_msoffice/static/lib/handsontable/handsontable.js +++ b/muk_web_preview_msoffice/static/lib/handsontable/handsontable.js @@ -23,19 +23,19 @@ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Version: 0.33.0 - * Date: Mon Jul 10 2017 10:08:33 GMT+0200 (CEST) + * Version: 0.34.0 + * Date: Thu Jul 27 2017 13:34:25 GMT+0200 (CEST) */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); + module.exports = factory(require("moment"), require("numbro"), require("pikaday")); else if(typeof define === 'function' && define.amd) - define("Handsontable", [], factory); + define("Handsontable", ["moment", "numbro", "pikaday"], factory); else if(typeof exports === 'object') - exports["Handsontable"] = factory(); + exports["Handsontable"] = factory(require("moment"), require("numbro"), require("pikaday")); else - root["Handsontable"] = factory(); -})(this, function() { + root["Handsontable"] = factory(root["moment"], root["numbro"], root["Pikaday"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE_61__, __WEBPACK_EXTERNAL_MODULE_87__, __WEBPACK_EXTERNAL_MODULE_302__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -101,7 +101,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 323); +/******/ return __webpack_require__(__webpack_require__.s = 208); /******/ }) /************************************************************************/ /******/ ([ @@ -1755,7 +1755,7 @@ function arrayUnique(array) { /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(13) - , core = __webpack_require__(45) + , core = __webpack_require__(44) , hide = __webpack_require__(32) , redefine = __webpack_require__(33) , ctx = __webpack_require__(29) @@ -2893,6 +2893,18 @@ var REGISTERED_HOOKS = [ */ 'afterSetCellMeta', +/** + * Called after cell meta is removed. + * + * @event Hooks#afterRemoveCellMeta + * @since 0.33.1 + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @param {String} key The removed meta key. + * @param {*} value Value which was under removed key of cell meta. + */ +'afterRemoveCellMeta', + /** * Called after cell data was changed. * @@ -2919,6 +2931,7 @@ var REGISTERED_HOOKS = [ * Fired after calling the `updateSettings` method. * * @event Hooks#afterUpdateSettings + * @param {Object} settings New settings object. */ 'afterUpdateSettings', @@ -3045,6 +3058,18 @@ var REGISTERED_HOOKS = [ */ 'beforeGetCellMeta', +/** + * Called before cell meta is removed. + * + * @event Hooks#beforeRemoveCellMeta + * @since 0.33.1 + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @param {String} key The removed meta key. + * @param {*} value Value which is under removed key of cell meta. + */ +'beforeRemoveCellMeta', + /** * @description * Callback fired before Handsontable instance is initiated. @@ -3922,6 +3947,7 @@ var Hooks = function () { 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] = []; }); @@ -4203,6 +4229,7 @@ var Hooks = function () { 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; }); @@ -4315,35 +4342,35 @@ exports.default = Hooks; exports.__esModule = true; exports.getRegisteredRenderers = exports.getRegisteredRendererNames = exports.hasRenderer = exports.getRenderer = exports.registerRenderer = undefined; -var _staticRegister2 = __webpack_require__(52); +var _staticRegister2 = __webpack_require__(50); var _staticRegister3 = _interopRequireDefault(_staticRegister2); -var _cellDecorator = __webpack_require__(377); +var _cellDecorator = __webpack_require__(262); var _cellDecorator2 = _interopRequireDefault(_cellDecorator); -var _autocompleteRenderer = __webpack_require__(378); +var _autocompleteRenderer = __webpack_require__(263); var _autocompleteRenderer2 = _interopRequireDefault(_autocompleteRenderer); -var _checkboxRenderer = __webpack_require__(379); +var _checkboxRenderer = __webpack_require__(264); var _checkboxRenderer2 = _interopRequireDefault(_checkboxRenderer); -var _htmlRenderer = __webpack_require__(380); +var _htmlRenderer = __webpack_require__(265); var _htmlRenderer2 = _interopRequireDefault(_htmlRenderer); -var _numericRenderer = __webpack_require__(381); +var _numericRenderer = __webpack_require__(266); var _numericRenderer2 = _interopRequireDefault(_numericRenderer); -var _passwordRenderer = __webpack_require__(382); +var _passwordRenderer = __webpack_require__(267); var _passwordRenderer2 = _interopRequireDefault(_passwordRenderer); -var _textRenderer = __webpack_require__(383); +var _textRenderer = __webpack_require__(268); var _textRenderer2 = _interopRequireDefault(_textRenderer); @@ -4391,8 +4418,8 @@ exports.getRegisteredRenderers = getValues; /* 10 */ /***/ (function(module, exports, __webpack_require__) { -var store = __webpack_require__(84)('wks') - , uid = __webpack_require__(50) +var store = __webpack_require__(83)('wks') + , uid = __webpack_require__(49) , Symbol = __webpack_require__(13).Symbol , USE_SYMBOL = typeof Symbol == 'function'; @@ -4469,7 +4496,7 @@ __webpack_require__(92); __webpack_require__(91); -__webpack_require__(68); +__webpack_require__(67); __webpack_require__(99); @@ -4501,83 +4528,83 @@ __webpack_require__(132); __webpack_require__(131); -var _viewportColumns = __webpack_require__(251); +var _viewportColumns = __webpack_require__(136); var _viewportColumns2 = _interopRequireDefault(_viewportColumns); -var _viewportRows = __webpack_require__(252); +var _viewportRows = __webpack_require__(137); var _viewportRows2 = _interopRequireDefault(_viewportRows); -var _coords = __webpack_require__(43); +var _coords = __webpack_require__(42); var _coords2 = _interopRequireDefault(_coords); -var _range = __webpack_require__(69); +var _range = __webpack_require__(68); var _range2 = _interopRequireDefault(_range); -var _column = __webpack_require__(255); +var _column = __webpack_require__(140); var _column2 = _interopRequireDefault(_column); -var _row = __webpack_require__(256); +var _row = __webpack_require__(141); var _row2 = _interopRequireDefault(_row); -var _debug = __webpack_require__(299); +var _debug = __webpack_require__(184); var _debug2 = _interopRequireDefault(_debug); -var _left = __webpack_require__(300); +var _left = __webpack_require__(185); var _left2 = _interopRequireDefault(_left); -var _top = __webpack_require__(301); +var _top = __webpack_require__(186); var _top2 = _interopRequireDefault(_top); -var _topLeftCorner = __webpack_require__(302); +var _topLeftCorner = __webpack_require__(187); var _topLeftCorner2 = _interopRequireDefault(_topLeftCorner); -var _border = __webpack_require__(250); +var _border = __webpack_require__(135); var _border2 = _interopRequireDefault(_border); -var _core = __webpack_require__(253); +var _core = __webpack_require__(138); var _core2 = _interopRequireDefault(_core); -var _event = __webpack_require__(254); +var _event = __webpack_require__(139); var _event2 = _interopRequireDefault(_event); -var _overlays = __webpack_require__(257); +var _overlays = __webpack_require__(142); var _overlays2 = _interopRequireDefault(_overlays); -var _scroll = __webpack_require__(258); +var _scroll = __webpack_require__(143); var _scroll2 = _interopRequireDefault(_scroll); -var _selection = __webpack_require__(303); +var _selection = __webpack_require__(188); var _selection2 = _interopRequireDefault(_selection); -var _settings = __webpack_require__(259); +var _settings = __webpack_require__(144); var _settings2 = _interopRequireDefault(_settings); -var _table = __webpack_require__(260); +var _table = __webpack_require__(145); var _table2 = _interopRequireDefault(_table); -var _tableRenderer = __webpack_require__(261); +var _tableRenderer = __webpack_require__(146); var _tableRenderer2 = _interopRequireDefault(_tableRenderer); -var _viewport = __webpack_require__(262); +var _viewport = __webpack_require__(147); var _viewport2 = _interopRequireDefault(_viewport); @@ -4620,7 +4647,7 @@ var _object = __webpack_require__(1); var _array = __webpack_require__(2); -var _recordTranslator = __webpack_require__(268); +var _recordTranslator = __webpack_require__(153); var _plugins = __webpack_require__(5); @@ -4884,7 +4911,7 @@ exports.getRegisteredEditors = exports.getRegisteredEditorNames = exports.hasEdi exports.RegisteredEditor = RegisteredEditor; exports._getEditorInstance = _getEditorInstance; -var _staticRegister2 = __webpack_require__(52); +var _staticRegister2 = __webpack_require__(50); var _staticRegister3 = _interopRequireDefault(_staticRegister2); @@ -4892,47 +4919,47 @@ var _pluginHooks = __webpack_require__(8); var _pluginHooks2 = _interopRequireDefault(_pluginHooks); -var _baseEditor = __webpack_require__(37); +var _baseEditor = __webpack_require__(36); var _baseEditor2 = _interopRequireDefault(_baseEditor); -var _autocompleteEditor = __webpack_require__(263); +var _autocompleteEditor = __webpack_require__(148); var _autocompleteEditor2 = _interopRequireDefault(_autocompleteEditor); -var _checkboxEditor = __webpack_require__(316); +var _checkboxEditor = __webpack_require__(201); var _checkboxEditor2 = _interopRequireDefault(_checkboxEditor); -var _dateEditor = __webpack_require__(317); +var _dateEditor = __webpack_require__(202); var _dateEditor2 = _interopRequireDefault(_dateEditor); -var _dropdownEditor = __webpack_require__(318); +var _dropdownEditor = __webpack_require__(203); var _dropdownEditor2 = _interopRequireDefault(_dropdownEditor); -var _handsontableEditor = __webpack_require__(264); +var _handsontableEditor = __webpack_require__(149); var _handsontableEditor2 = _interopRequireDefault(_handsontableEditor); -var _mobileTextEditor = __webpack_require__(319); +var _mobileTextEditor = __webpack_require__(204); var _mobileTextEditor2 = _interopRequireDefault(_mobileTextEditor); -var _numericEditor = __webpack_require__(320); +var _numericEditor = __webpack_require__(205); var _numericEditor2 = _interopRequireDefault(_numericEditor); -var _passwordEditor = __webpack_require__(321); +var _passwordEditor = __webpack_require__(206); var _passwordEditor2 = _interopRequireDefault(_passwordEditor); -var _selectEditor = __webpack_require__(322); +var _selectEditor = __webpack_require__(207); var _selectEditor2 = _interopRequireDefault(_selectEditor); -var _textEditor = __webpack_require__(44); +var _textEditor = __webpack_require__(43); var _textEditor2 = _interopRequireDefault(_textEditor); @@ -5196,7 +5223,7 @@ var _array = __webpack_require__(2); var _element = __webpack_require__(0); -var _separator = __webpack_require__(72); +var _separator = __webpack_require__(71); function normalizeSelection(selRange) { return { @@ -5389,8 +5416,8 @@ module.exports = function(it){ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(18) - , IE8_DOM_DEFINE = __webpack_require__(275) - , toPrimitive = __webpack_require__(87) + , IE8_DOM_DEFINE = __webpack_require__(160) + , toPrimitive = __webpack_require__(86) , dP = Object.defineProperty; exports.f = __webpack_require__(21) ? Object.defineProperty : function defineProperty(O, P, Attributes){ @@ -5514,7 +5541,7 @@ module.exports = function(it, key){ /***/ (function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings -var IObject = __webpack_require__(78) +var IObject = __webpack_require__(77) , defined = __webpack_require__(30); module.exports = function(it){ return IObject(defined(it)); @@ -5525,7 +5552,7 @@ module.exports = function(it){ /***/ (function(module, exports, __webpack_require__) { // 7.1.15 ToLength -var toInteger = __webpack_require__(62) +var toInteger = __webpack_require__(60) , min = Math.min; module.exports = function(it){ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 @@ -5588,23 +5615,23 @@ function isMobileBrowser(userAgent) { exports.__esModule = true; exports.getRegisteredValidators = exports.getRegisteredValidatorNames = exports.hasValidator = exports.getValidator = exports.registerValidator = undefined; -var _staticRegister2 = __webpack_require__(52); +var _staticRegister2 = __webpack_require__(50); var _staticRegister3 = _interopRequireDefault(_staticRegister2); -var _autocompleteValidator = __webpack_require__(388); +var _autocompleteValidator = __webpack_require__(273); var _autocompleteValidator2 = _interopRequireDefault(_autocompleteValidator); -var _dateValidator = __webpack_require__(389); +var _dateValidator = __webpack_require__(274); var _dateValidator2 = _interopRequireDefault(_dateValidator); -var _numericValidator = __webpack_require__(390); +var _numericValidator = __webpack_require__(275); var _numericValidator2 = _interopRequireDefault(_numericValidator); -var _timeValidator = __webpack_require__(391); +var _timeValidator = __webpack_require__(276); var _timeValidator2 = _interopRequireDefault(_timeValidator); @@ -5779,7 +5806,7 @@ var _eventManager = __webpack_require__(4); var _eventManager2 = _interopRequireDefault(_eventManager); -var _core = __webpack_require__(253); +var _core = __webpack_require__(138); var _core2 = _interopRequireDefault(_core); @@ -6119,7 +6146,7 @@ exports.default = Overlay; /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding -var aFunction = __webpack_require__(73); +var aFunction = __webpack_require__(72); module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; @@ -6166,7 +6193,7 @@ module.exports = function(exec){ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(19) - , createDesc = __webpack_require__(41); + , createDesc = __webpack_require__(40); module.exports = __webpack_require__(21) ? function(object, key, value){ return dP.f(object, key, createDesc(1, value)); } : function(object, key, value){ @@ -6181,12 +6208,12 @@ module.exports = __webpack_require__(21) ? function(object, key, value){ var global = __webpack_require__(13) , hide = __webpack_require__(32) , has = __webpack_require__(22) - , SRC = __webpack_require__(50)('src') + , SRC = __webpack_require__(49)('src') , TO_STRING = 'toString' , $toString = Function[TO_STRING] , TPL = ('' + $toString).split(TO_STRING); -__webpack_require__(45).inspectSource = function(it){ +__webpack_require__(44).inspectSource = function(it){ return $toString.call(it); }; @@ -6647,16691 +6674,10241 @@ function curryRight(func) { /* 36 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(module) {//! moment.js -//! version : 2.18.1 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com +"use strict"; -;(function (global, factory) { - true ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.moment = factory() -}(this, (function () { 'use strict'; -var hookCallback; +exports.__esModule = true; +exports.EditorState = undefined; -function hooks () { - return hookCallback.apply(null, arguments); -} +var _src = __webpack_require__(11); -// This is done to register the method called with moment() -// without creating circular dependencies. -function setHookCallback (callback) { - hookCallback = callback; -} +var _mixed = __webpack_require__(20); -function isArray(input) { - return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; -} +var EditorState = exports.EditorState = { + VIRGIN: 'STATE_VIRGIN', // before editing + EDITING: 'STATE_EDITING', + WAITING: 'STATE_WAITING', // waiting for async validation + FINISHED: 'STATE_FINISHED' +}; -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 BaseEditor(instance) { + this.instance = instance; + this.state = EditorState.VIRGIN; -function isObjectEmpty(obj) { - var k; - for (k in obj) { - // even if its not own property I'd still call it non-empty - return false; - } - return true; -} + this._opened = false; + this._fullEditMode = false; + this._closeCallback = null; -function isUndefined(input) { - return input === void 0; + this.init(); } -function isNumber(input) { - return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; -} +BaseEditor.prototype._fireCallbacks = function (result) { + if (this._closeCallback) { + this._closeCallback(result); + this._closeCallback = null; + } +}; -function isDate(input) { - return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; -} +BaseEditor.prototype.init = function () {}; -function map(arr, fn) { - var res = [], i; - for (i = 0; i < arr.length; ++i) { - res.push(fn(arr[i], i)); - } - return res; -} +BaseEditor.prototype.getValue = function () { + throw Error('Editor getValue() method unimplemented'); +}; -function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); -} +BaseEditor.prototype.setValue = function (newValue) { + throw Error('Editor setValue() method unimplemented'); +}; -function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } +BaseEditor.prototype.open = function () { + throw Error('Editor open() method unimplemented'); +}; - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } +BaseEditor.prototype.close = function () { + throw Error('Editor close() method unimplemented'); +}; - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } +BaseEditor.prototype.prepare = function (row, col, prop, td, originalValue, cellProperties) { + this.TD = td; + this.row = row; + this.col = col; + this.prop = prop; + this.originalValue = originalValue; + this.cellProperties = cellProperties; + this.state = EditorState.VIRGIN; +}; - return a; -} +BaseEditor.prototype.extend = function () { + var baseClass = this.constructor; -function createUTC (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); -} + function Editor() { + baseClass.apply(this, arguments); + } -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 inherit(Child, Parent) { + function Bridge() {} + Bridge.prototype = Parent.prototype; + Child.prototype = new Bridge(); + Child.prototype.constructor = Child; -function getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); - } - return m._pf; -} + return Child; + } -var some; -if (Array.prototype.some) { - some = Array.prototype.some; -} else { - some = function (fun) { - var t = Object(this); - var len = t.length >>> 0; + return inherit(Editor, baseClass); +}; - for (var i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } +BaseEditor.prototype.saveValue = function (value, ctrlDown) { + var selection = void 0; + var tmp = void 0; - return false; - }; -} + // if ctrl+enter and multiple cells selected, behave like Excel (finish editing and apply to all cells) + if (ctrlDown) { + selection = this.instance.getSelected(); -var some$1 = some; + if (selection[0] > selection[2]) { + tmp = selection[0]; + selection[0] = selection[2]; + selection[2] = tmp; + } + if (selection[1] > selection[3]) { + tmp = selection[1]; + selection[1] = selection[3]; + selection[3] = tmp; + } + } else { + selection = [this.row, this.col, null, null]; + } -function isValid(m) { - if (m._isValid == null) { - var flags = getParsingFlags(m); - var parsedParts = some$1.call(flags.parsedDateParts, function (i) { - return i != null; - }); - var isNowValid = !isNaN(m._d.getTime()) && - flags.overflow < 0 && - !flags.empty && - !flags.invalidMonth && - !flags.invalidWeekday && - !flags.nullInput && - !flags.invalidFormat && - !flags.userInvalidated && - (!flags.meridiem || (flags.meridiem && parsedParts)); + this.instance.populateFromArray(selection[0], selection[1], value, selection[2], selection[3], 'edit'); +}; - if (m._strict) { - isNowValid = isNowValid && - flags.charsLeftOver === 0 && - flags.unusedTokens.length === 0 && - flags.bigHour === undefined; - } +BaseEditor.prototype.beginEditing = function (initialValue, event) { + if (this.state != EditorState.VIRGIN) { + return; + } + this.instance.view.scrollViewport(new _src.CellCoords(this.row, this.col)); + this.instance.view.render(); + this.state = EditorState.EDITING; - if (Object.isFrozen == null || !Object.isFrozen(m)) { - m._isValid = isNowValid; - } - else { - return isNowValid; - } - } - return m._isValid; -} + initialValue = typeof initialValue == 'string' ? initialValue : this.originalValue; + this.setValue((0, _mixed.stringify)(initialValue)); -function createInvalid (flags) { - var m = createUTC(NaN); - if (flags != null) { - extend(getParsingFlags(m), flags); - } - else { - getParsingFlags(m).userInvalidated = true; - } + this.open(event); + this._opened = true; + this.focus(); - return m; -} + // only rerender the selections (FillHandle should disappear when beginediting is triggered) + this.instance.view.render(); -// Plugins that add properties should also add the key here (null value), -// so we can properly clone ourselves. -var momentProperties = hooks.momentProperties = []; + this.instance.runHooks('afterBeginEditing', this.row, this.col); +}; -function copyConfig(to, from) { - var i, prop, val; +BaseEditor.prototype.finishEditing = function (restoreOriginalValue, ctrlDown, callback) { + var _this = this, + 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 (callback) { + var previousCloseCallback = this._closeCallback; - if (momentProperties.length > 0) { - for (i = 0; i < momentProperties.length; i++) { - prop = momentProperties[i]; - val = from[prop]; - if (!isUndefined(val)) { - to[prop] = val; - } - } - } + this._closeCallback = function (result) { + if (previousCloseCallback) { + previousCloseCallback(result); + } - return to; -} + callback(result); + _this.instance.view.render(); + }; + } -var updateInProgress = false; + if (this.isWaiting()) { + return; + } -// 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; - } -} + if (this.state == EditorState.VIRGIN) { + this.instance._registerTimeout(setTimeout(function () { + _this._fireCallbacks(true); + }, 0)); -function isMoment (obj) { - return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); -} + return; + } -function absFloor (number) { - if (number < 0) { - // -0 -> 0 - return Math.ceil(number) || 0; - } else { - return Math.floor(number); + if (this.state == EditorState.EDITING) { + if (restoreOriginalValue) { + this.cancelChanges(); + this.instance.view.render(); + + return; } -} -function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; + var value = this.getValue(); - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); + if (this.instance.getSettings().trimWhitespace) { + // We trim only string values + val = [[typeof value === 'string' ? String.prototype.trim.call(value || '') : value]]; + } else { + val = [[value]]; } - return value; -} + this.state = EditorState.WAITING; + this.saveValue(val, ctrlDown); -// 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++; - } + if (this.instance.getCellValidator(this.cellProperties)) { + this.instance.addHookOnce('postAfterValidate', function (result) { + _this.state = EditorState.FINISHED; + _this.discardEditor(result); + }); + } else { + this.state = EditorState.FINISHED; + this.discardEditor(true); } - return diffs + lengthDiff; -} + } +}; -function warn(msg) { - if (hooks.suppressDeprecationWarnings === false && - (typeof console !== 'undefined') && console.warn) { - console.warn('Deprecation warning: ' + msg); - } -} +BaseEditor.prototype.cancelChanges = function () { + this.state = EditorState.FINISHED; + this.discardEditor(); +}; -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); -} +BaseEditor.prototype.discardEditor = function (result) { + if (this.state !== EditorState.FINISHED) { + return; + } + // validator was defined and failed + if (result === false && this.cellProperties.allowInvalid !== true) { + this.instance.selectCell(this.row, this.col); + this.focus(); + this.state = EditorState.EDITING; + this._fireCallbacks(false); + } else { + this.close(); + this._opened = false; + this._fullEditMode = false; + this.state = EditorState.VIRGIN; + this._fireCallbacks(true); + } +}; -var deprecations = {}; +/** + * Switch editor into full edit mode. In this state navigation keys don't close editor. This mode is activated + * automatically after hit ENTER or F2 key on the cell or while editing cell press F2 key. + */ +BaseEditor.prototype.enableFullEditMode = function () { + this._fullEditMode = true; +}; -function deprecateSimple(name, msg) { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } -} +/** + * Checks if editor is in full edit mode. + * + * @returns {Boolean} + */ +BaseEditor.prototype.isInFullEditMode = function () { + return this._fullEditMode; +}; -hooks.suppressDeprecationWarnings = false; -hooks.deprecationHandler = null; +BaseEditor.prototype.isOpened = function () { + return this._opened; +}; -function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; -} +BaseEditor.prototype.isWaiting = function () { + return this.state === EditorState.WAITING; +}; -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); -} +BaseEditor.prototype.checkEditorSection = function () { + var totalRows = this.instance.countRows(); + var section = ''; -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]); - } + if (this.row < this.instance.getSettings().fixedRowsTop) { + if (this.col < this.instance.getSettings().fixedColumnsLeft) { + section = 'top-left-corner'; + } else { + section = 'top'; } - return res; -} - -function Locale(config) { - if (config != null) { - this.set(config); + } else if (this.instance.getSettings().fixedRowsBottom && this.row >= totalRows - this.instance.getSettings().fixedRowsBottom) { + if (this.col < this.instance.getSettings().fixedColumnsLeft) { + section = 'bottom-left-corner'; + } else { + section = 'bottom'; } -} + } else if (this.col < this.instance.getSettings().fixedColumnsLeft) { + section = 'left'; + } -var keys; + return section; +}; -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; - }; -} +exports.default = BaseEditor; -var keys$1 = keys; +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { -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' +// 22.1.3.31 Array.prototype[@@unscopables] +var UNSCOPABLES = __webpack_require__(10)('unscopables') + , ArrayProto = Array.prototype; +if(ArrayProto[UNSCOPABLES] == undefined)__webpack_require__(32)(ArrayProto, UNSCOPABLES, {}); +module.exports = function(key){ + ArrayProto[UNSCOPABLES][key] = true; }; -function calendar (key, mom, now) { - var output = this._calendar[key] || this._calendar['sameElse']; - return isFunction(output) ? output.call(mom, now) : output; -} +/***/ }), +/* 38 */ +/***/ (function(module, exports) { + +var toString = {}.toString; -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' +module.exports = function(it){ + return toString.call(it).slice(8, -1); }; -function longDateFormat (key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { - if (format || !formatUpper) { - return format; - } +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = __webpack_require__(169) + , enumBugKeys = __webpack_require__(75); - this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); +module.exports = Object.keys || function keys(O){ + return $keys(O, enumBugKeys); +}; - return this._longDateFormat[key]; -} +/***/ }), +/* 40 */ +/***/ (function(module, exports) { -var defaultInvalidDate = 'Invalid date'; +module.exports = function(bitmap, value){ + return { + enumerable : !(bitmap & 1), + configurable: !(bitmap & 2), + writable : !(bitmap & 4), + value : value + }; +}; -function invalidDate () { - return this._invalidDate; -} +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { -var defaultOrdinal = '%d'; -var defaultDayOfMonthOrdinalParse = /\d{1,2}/; +// 7.1.13 ToObject(argument) +var defined = __webpack_require__(30); +module.exports = function(it){ + return Object(defined(it)); +}; -function ordinal (number) { - return this._ordinal.replace('%d', number); -} +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { -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); -} +"use strict"; -function pastFuture (diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); -} -var aliases = {}; +exports.__esModule = true; -function addUnitAlias (unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; -} +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -function normalizeUnits(units) { - return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; -} +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; +/** + * CellCoords holds cell coordinates (row, column) and few method to validate them and + * retrieve as an array or an object + * + * @class CellCoords + */ +var CellCoords = function () { + /** + * @param {Number} row Row index + * @param {Number} col Column index + */ + function CellCoords(row, col) { + _classCallCheck(this, CellCoords); - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } + if (typeof row !== 'undefined' && typeof col !== 'undefined') { + this.row = row; + this.col = col; + } else { + this.row = null; + this.col = null; } + } - return normalizedInput; -} + /** + * Checks if given set of coordinates is valid in context of a given Walkontable instance + * + * @param {Walkontable} wotInstance + * @returns {Boolean} + */ -var priorities = {}; -function addUnitPriority(unit, priority) { - priorities[unit] = priority; -} + _createClass(CellCoords, [{ + key: 'isValid', + value: function isValid(wotInstance) { + // is it a valid cell index (0 or higher) + if (this.row < 0 || this.col < 0) { + return false; + } + // is selection within total rows and columns + if (this.row >= wotInstance.getSetting('totalRows') || this.col >= wotInstance.getSetting('totalColumns')) { + return false; + } -function getPrioritizedUnits(unitsObj) { - var units = []; - for (var u in unitsObj) { - units.push({unit: u, priority: priorities[u]}); + return true; } - units.sort(function (a, b) { - return a.priority - b.priority; - }); - return units; -} -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); - } - }; -} + /** + * Checks if this cell coords are the same as cell coords given as a parameter + * + * @param {CellCoords} cellCoords + * @returns {Boolean} + */ -function get (mom, unit) { - return mom.isValid() ? - mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; -} + }, { + key: 'isEqual', + value: function isEqual(cellCoords) { + if (cellCoords === this) { + return true; + } -function set$1 (mom, unit, value) { - if (mom.isValid()) { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + return this.row === cellCoords.row && this.col === cellCoords.col; } -} -// MOMENTS + /** + * Checks if tested coordinates are positioned in south-east from this cell coords + * + * @param {Object} testedCoords + * @returns {Boolean} + */ -function stringGet (units) { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](); + }, { + key: 'isSouthEastOf', + value: function isSouthEastOf(testedCoords) { + return this.row >= testedCoords.row && this.col >= testedCoords.col; } - return this; -} + /** + * Checks if tested coordinates are positioned in north-east from this cell coords + * + * @param {Object} testedCoords + * @returns {Boolean} + */ -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); - } + }, { + key: 'isNorthWestOf', + value: function isNorthWestOf(testedCoords) { + return this.row <= testedCoords.row && this.col <= testedCoords.col; } - return this; -} - -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; + /** + * Checks if tested coordinates are positioned in south-west from this cell coords + * + * @param {Object} testedCoords + * @returns {Boolean} + */ -var formatFunctions = {}; + }, { + key: 'isSouthWestOf', + value: function isSouthWestOf(testedCoords) { + return this.row >= testedCoords.row && this.col <= testedCoords.col; + } -var formatTokenFunctions = {}; + /** + * Checks if tested coordinates are positioned in north-east from this cell coords + * + * @param {Object} testedCoords + * @returns {Boolean} + */ -// 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); - }; + }, { + key: 'isNorthEastOf', + value: function isNorthEastOf(testedCoords) { + return this.row <= testedCoords.row && this.col >= testedCoords.col; } -} + }]); -function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); - } - return input.replace(/\\/g, ''); -} + return CellCoords; +}(); -function makeFormatFunction(format) { - var array = format.match(formattingTokens), i, length; +exports.default = CellCoords; - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); - } - } +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { - 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; - }; -} +"use strict"; -// 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); +exports.__esModule = true; - return formatFunctions[format](m); -} +var _element = __webpack_require__(0); -function expandFormat(format, locale) { - var i = 5; +var _autoResize = __webpack_require__(183); - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } +var _autoResize2 = _interopRequireDefault(_autoResize); - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); - localFormattingTokens.lastIndex = 0; - i -= 1; - } +var _baseEditor = __webpack_require__(36); - return format; -} +var _baseEditor2 = _interopRequireDefault(_baseEditor); -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 _eventManager = __webpack_require__(4); -var matchUnsigned = /\d+/; // 0 - inf -var matchSigned = /[+-]?\d+/; // -inf - inf +var _eventManager2 = _interopRequireDefault(_eventManager); -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 _unicode = __webpack_require__(16); -var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 +var _event = __webpack_require__(7); -// 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]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var TextEditor = _baseEditor2.default.prototype.extend(); -var regexes = {}; +/** + * @private + * @editor TextEditor + * @class TextEditor + * @dependencies autoResize + */ +TextEditor.prototype.init = function () { + var that = this; + this.createElements(); + this.eventManager = new _eventManager2.default(this); + this.bindEvents(); + this.autoResize = (0, _autoResize2.default)(); -function addRegexToken (token, regex, strictRegex) { - regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { - return (isStrict && strictRegex) ? strictRegex : regex; - }; -} + this.instance.addHook('afterDestroy', function () { + that.destroy(); + }); +}; -function getParseRegexForToken (token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); - } +TextEditor.prototype.getValue = function () { + return this.TEXTAREA.value; +}; - return regexes[token](config._strict, config._locale); -} +TextEditor.prototype.setValue = function (newValue) { + this.TEXTAREA.value = newValue; +}; -// 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; - })); -} +var onBeforeKeyDown = function onBeforeKeyDown(event) { + var instance = this, + that = instance.getActiveEditor(), + ctrlDown; -function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); -} + // catch CTRL but not right ALT (which in some systems triggers ALT+CTRL) + ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; -var tokens = {}; + // Process only events that have been fired in the editor + if (event.target !== that.TEXTAREA || (0, _event.isImmediatePropagationStopped)(event)) { + return; + } -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; - } -} + if (event.keyCode === 17 || event.keyCode === 224 || event.keyCode === 91 || event.keyCode === 93) { + // when CTRL or its equivalent is pressed and cell is edited, don't prepare selectable text in textarea + (0, _event.stopImmediatePropagation)(event); + return; + } -function addWeekParseToken (token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); -} + switch (event.keyCode) { + case _unicode.KEY_CODES.ARROW_RIGHT: + if (that.isInFullEditMode()) { + if (!that.isWaiting() && !that.allowKeyEventPropagation || !that.isWaiting() && that.allowKeyEventPropagation && !that.allowKeyEventPropagation(event.keyCode)) { + (0, _event.stopImmediatePropagation)(event); + } + } + break; + case _unicode.KEY_CODES.ARROW_LEFT: + if (that.isInFullEditMode()) { + if (!that.isWaiting() && !that.allowKeyEventPropagation || !that.isWaiting() && that.allowKeyEventPropagation && !that.allowKeyEventPropagation(event.keyCode)) { + (0, _event.stopImmediatePropagation)(event); + } + } + break; + case _unicode.KEY_CODES.ARROW_UP: + case _unicode.KEY_CODES.ARROW_DOWN: + if (that.isInFullEditMode()) { + if (!that.isWaiting() && !that.allowKeyEventPropagation || !that.isWaiting() && that.allowKeyEventPropagation && !that.allowKeyEventPropagation(event.keyCode)) { + (0, _event.stopImmediatePropagation)(event); + } + } + break; -function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); - } -} + case _unicode.KEY_CODES.ENTER: + var selected = that.instance.getSelected(); + var isMultipleSelection = !(selected[0] === selected[2] && selected[1] === selected[3]); + if (ctrlDown && !isMultipleSelection || event.altKey) { + // if ctrl+enter or alt+enter, add new line + if (that.isOpened()) { + var caretPosition = (0, _element.getCaretPosition)(that.TEXTAREA), + value = that.getValue(); -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; + var newValue = value.slice(0, caretPosition) + '\n' + value.slice(caretPosition); -var indexOf; + that.setValue(newValue); -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; - } + (0, _element.setCaretPosition)(that.TEXTAREA, caretPosition + 1); + } else { + that.beginEditing(that.originalValue + '\n'); } - return -1; - }; -} - -var indexOf$1 = indexOf; + (0, _event.stopImmediatePropagation)(event); + } + event.preventDefault(); // don't add newline to field + break; -function daysInMonth(year, month) { - return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); -} + case _unicode.KEY_CODES.A: + case _unicode.KEY_CODES.X: + case _unicode.KEY_CODES.C: + case _unicode.KEY_CODES.V: + if (ctrlDown) { + (0, _event.stopImmediatePropagation)(event); // CTRL+A, CTRL+C, CTRL+V, CTRL+X should only work locally when cell is edited (not in table context) + } + break; -// FORMATTING + case _unicode.KEY_CODES.BACKSPACE: + case _unicode.KEY_CODES.DELETE: + case _unicode.KEY_CODES.HOME: + case _unicode.KEY_CODES.END: + (0, _event.stopImmediatePropagation)(event); // backspace, delete, home, end should only work locally when cell is edited (not in table context) + break; + default: + break; + } -addFormatToken('M', ['MM', 2], 'Mo', function () { - return this.month() + 1; -}); + if ([_unicode.KEY_CODES.ARROW_UP, _unicode.KEY_CODES.ARROW_RIGHT, _unicode.KEY_CODES.ARROW_DOWN, _unicode.KEY_CODES.ARROW_LEFT].indexOf(event.keyCode) === -1) { + that.autoResize.resize(String.fromCharCode(event.keyCode)); + } +}; -addFormatToken('MMM', 0, 0, function (format) { - return this.localeData().monthsShort(this, format); -}); +TextEditor.prototype.open = function () { + this.refreshDimensions(); // need it instantly, to prevent https://github.com/handsontable/handsontable/issues/348 -addFormatToken('MMMM', 0, 0, function (format) { - return this.localeData().months(this, format); -}); + this.instance.addHook('beforeKeyDown', onBeforeKeyDown); +}; -// ALIASES +TextEditor.prototype.close = function (tdOutside) { + this.textareaParentStyle.display = 'none'; -addUnitAlias('month', 'M'); + this.autoResize.unObserve(); -// PRIORITY + if (document.activeElement === this.TEXTAREA) { + this.instance.listen(); // don't refocus the table if user focused some cell outside of HT on purpose + } + this.instance.removeHook('beforeKeyDown', onBeforeKeyDown); +}; -addUnitPriority('month', 8); +TextEditor.prototype.focus = function () { + this.TEXTAREA.focus(); + (0, _element.setCaretPosition)(this.TEXTAREA, this.TEXTAREA.value.length); +}; -// PARSING +TextEditor.prototype.createElements = function () { + // this.$body = $(document.body); -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); -}); + this.TEXTAREA = document.createElement('TEXTAREA'); -addParseToken(['M', 'MM'], function (input, array) { - array[MONTH] = toInt(input) - 1; -}); + (0, _element.addClass)(this.TEXTAREA, 'handsontableInput'); -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; - } -}); + this.textareaStyle = this.TEXTAREA.style; + this.textareaStyle.width = 0; + this.textareaStyle.height = 0; -// LOCALES + this.TEXTAREA_PARENT = document.createElement('DIV'); + (0, _element.addClass)(this.TEXTAREA_PARENT, 'handsontableInputHolder'); -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()]; -} + this.textareaParentStyle = this.TEXTAREA_PARENT.style; + this.textareaParentStyle.top = 0; + this.textareaParentStyle.left = 0; + this.textareaParentStyle.display = 'none'; -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()]; -} + this.TEXTAREA_PARENT.appendChild(this.TEXTAREA); -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(); - } - } + this.instance.rootElement.appendChild(this.TEXTAREA_PARENT); - if (strict) { - if (format === 'MMM') { - ii = indexOf$1.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf$1.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'MMM') { - ii = indexOf$1.call(this._shortMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf$1.call(this._longMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } -} + var that = this; + this.instance._registerTimeout(setTimeout(function () { + that.refreshDimensions(); + }, 0)); +}; -function localeMonthsParse (monthName, format, strict) { - var i, mom, regex; +TextEditor.prototype.getEditedCell = function () { + var editorSection = this.checkEditorSection(), + editedCell; - if (this._monthsParseExact) { - return handleStrictParse.call(this, monthName, format, strict); - } + switch (editorSection) { + case 'top': + editedCell = this.instance.view.wt.wtOverlays.topOverlay.clone.wtTable.getCell({ + row: this.row, + col: this.col + }); + this.textareaParentStyle.zIndex = 101; + break; + case 'top-left-corner': + editedCell = this.instance.view.wt.wtOverlays.topLeftCornerOverlay.clone.wtTable.getCell({ + row: this.row, + col: this.col + }); + this.textareaParentStyle.zIndex = 103; + break; + case 'bottom-left-corner': + editedCell = this.instance.view.wt.wtOverlays.bottomLeftCornerOverlay.clone.wtTable.getCell({ + row: this.row, + col: this.col + }); + this.textareaParentStyle.zIndex = 103; + break; + case 'left': + editedCell = this.instance.view.wt.wtOverlays.leftOverlay.clone.wtTable.getCell({ + row: this.row, + col: this.col + }); + this.textareaParentStyle.zIndex = 102; + break; + case 'bottom': + editedCell = this.instance.view.wt.wtOverlays.bottomOverlay.clone.wtTable.getCell({ + row: this.row, + col: this.col + }); + this.textareaParentStyle.zIndex = 102; + break; + default: + editedCell = this.instance.getCell(this.row, this.col); + this.textareaParentStyle.zIndex = ''; + break; + } - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - } + return editedCell != -1 && editedCell != -2 ? editedCell : void 0; +}; - // 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; - } - } -} +TextEditor.prototype.refreshValue = function () { + var sourceData = this.instance.getSourceDataAtCell(this.row, this.prop); + this.originalValue = sourceData; -// MOMENTS + this.setValue(sourceData); + this.refreshDimensions(); +}; -function setMonth (mom, value) { - var dayOfMonth; +TextEditor.prototype.refreshDimensions = function () { + if (this.state !== _baseEditor.EditorState.EDITING) { + return; + } + this.TD = this.getEditedCell(); - if (!mom.isValid()) { - // No op - return mom; - } + // TD is outside of the viewport. + if (!this.TD) { + this.close(true); - 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; - } - } - } + return; + } + var currentOffset = (0, _element.offset)(this.TD), + containerOffset = (0, _element.offset)(this.instance.rootElement), + scrollableContainer = (0, _element.getScrollableElement)(this.TD), + totalRowsCount = this.instance.countRows(), - 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'); - } -} + // If colHeaders is disabled, cells in the first row have border-top + editTopModifier = currentOffset.top === containerOffset.top ? 0 : 1, + editTop = currentOffset.top - containerOffset.top - editTopModifier - (scrollableContainer.scrollTop || 0), + editLeft = currentOffset.left - containerOffset.left - 1 - (scrollableContainer.scrollLeft || 0), + settings = this.instance.getSettings(), + rowHeadersCount = this.instance.hasRowHeaders(), + colHeadersCount = this.instance.hasColHeaders(), + editorSection = this.checkEditorSection(), + backgroundColor = this.TD.style.backgroundColor, + cssTransformOffset; -function getDaysInMonth () { - return daysInMonth(this.year(), this.month()); -} + // TODO: Refactor this to the new instance.getCell method (from #ply-59), after 0.12.1 is released + switch (editorSection) { + case 'top': + cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.topOverlay.clone.wtTable.holder.parentNode); + break; + case 'left': + cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.leftOverlay.clone.wtTable.holder.parentNode); + break; + case 'top-left-corner': + cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.topLeftCornerOverlay.clone.wtTable.holder.parentNode); + break; + case 'bottom-left-corner': + cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.bottomLeftCornerOverlay.clone.wtTable.holder.parentNode); + break; + case 'bottom': + cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.bottomOverlay.clone.wtTable.holder.parentNode); + break; + default: + break; + } -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; - } -} + if (colHeadersCount && this.instance.getSelected()[0] === 0 || settings.fixedRowsBottom && this.instance.getSelected()[0] === totalRowsCount - settings.fixedRowsBottom) { + editTop += 1; + } -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; - } -} + if (this.instance.getSelected()[1] === 0) { + editLeft += 1; + } -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'); -} + if (cssTransformOffset && cssTransformOffset != -1) { + this.textareaParentStyle[cssTransformOffset[0]] = cssTransformOffset[1]; + } else { + (0, _element.resetCssTransform)(this.TEXTAREA_PARENT); + } -// FORMATTING + this.textareaParentStyle.top = editTop + 'px'; + this.textareaParentStyle.left = editLeft + 'px'; -addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? '' + y : '+' + y; -}); + var firstRowOffset = this.instance.view.wt.wtViewport.rowsRenderCalculator.startPosition; + var firstColumnOffset = this.instance.view.wt.wtViewport.columnsRenderCalculator.startPosition; + var horizontalScrollPosition = this.instance.view.wt.wtOverlays.leftOverlay.getScrollPosition(); + var verticalScrollPosition = this.instance.view.wt.wtOverlays.topOverlay.getScrollPosition(); + var scrollbarWidth = (0, _element.getScrollbarWidth)(); -addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; -}); + var cellTopOffset = this.TD.offsetTop + firstRowOffset - verticalScrollPosition; + var cellLeftOffset = this.TD.offsetLeft + firstColumnOffset - horizontalScrollPosition; -addFormatToken(0, ['YYYY', 4], 0, 'year'); -addFormatToken(0, ['YYYYY', 5], 0, 'year'); -addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); + var width = (0, _element.innerWidth)(this.TD) - 8; + var actualVerticalScrollbarWidth = (0, _element.hasVerticalScrollbar)(scrollableContainer) ? scrollbarWidth : 0; + var actualHorizontalScrollbarWidth = (0, _element.hasHorizontalScrollbar)(scrollableContainer) ? scrollbarWidth : 0; + var maxWidth = this.instance.view.maximumVisibleElementWidth(cellLeftOffset) - 9 - actualVerticalScrollbarWidth; + var height = this.TD.scrollHeight + 1; + var maxHeight = Math.max(this.instance.view.maximumVisibleElementHeight(cellTopOffset) - actualHorizontalScrollbarWidth, 23); -// ALIASES + var cellComputedStyle = (0, _element.getComputedStyle)(this.TD); -addUnitAlias('year', 'y'); + this.TEXTAREA.style.fontSize = cellComputedStyle.fontSize; + this.TEXTAREA.style.fontFamily = cellComputedStyle.fontFamily; + this.TEXTAREA.style.backgroundColor = ''; // RESET STYLE + this.TEXTAREA.style.backgroundColor = backgroundColor ? backgroundColor : (0, _element.getComputedStyle)(this.TEXTAREA).backgroundColor; -// PRIORITIES + this.autoResize.init(this.TEXTAREA, { + minHeight: Math.min(height, maxHeight), + maxHeight: maxHeight, // TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar) + minWidth: Math.min(width, maxWidth), + maxWidth: maxWidth // TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar) + }, true); -addUnitPriority('year', 1); + this.textareaParentStyle.display = 'block'; +}; -// PARSING +TextEditor.prototype.bindEvents = function () { + var editor = this; -addRegexToken('Y', matchSigned); -addRegexToken('YY', match1to2, match2); -addRegexToken('YYYY', match1to4, match4); -addRegexToken('YYYYY', match1to6, match6); -addRegexToken('YYYYYY', match1to6, match6); + this.eventManager.addEventListener(this.TEXTAREA, 'cut', function (event) { + (0, _event.stopPropagation)(event); + }); -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); -}); + this.eventManager.addEventListener(this.TEXTAREA, 'paste', function (event) { + (0, _event.stopPropagation)(event); + }); -// HELPERS + this.instance.addHook('afterScrollHorizontally', function () { + editor.refreshDimensions(); + }); -function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; -} + this.instance.addHook('afterScrollVertically', function () { + editor.refreshDimensions(); + }); -function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; -} + this.instance.addHook('afterColumnResize', function () { + editor.refreshDimensions(); + editor.focus(); + }); -// HOOKS + this.instance.addHook('afterRowResize', function () { + editor.refreshDimensions(); + editor.focus(); + }); -hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + this.instance.addHook('afterDestroy', function () { + editor.eventManager.destroy(); + }); }; -// MOMENTS - -var getSetYear = makeGetSet('FullYear', true); - -function getIsLeapYear () { - return isLeapYear(this.year()); -} +TextEditor.prototype.destroy = function () { + this.eventManager.destroy(); +}; -function createDate (y, m, d, h, M, s, ms) { - // can't just apply() to create a date: - // https://stackoverflow.com/q/181348 - var date = new Date(y, m, d, h, M, s, ms); +exports.default = TextEditor; - // the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); - } - return date; -} +/***/ }), +/* 44 */ +/***/ (function(module, exports) { -function createUTCDate (y) { - var date = new Date(Date.UTC.apply(null, arguments)); +var core = module.exports = {version: '2.4.0'}; +if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef - // the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); - } - return date; -} +/***/ }), +/* 45 */ +/***/ (function(module, exports) { -// 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; +module.exports = {}; - return -fwdlw + fwd - 1; -} +/***/ }), +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { -// 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; - } +var META = __webpack_require__(49)('meta') + , isObject = __webpack_require__(15) + , has = __webpack_require__(22) + , setDesc = __webpack_require__(19).f + , id = 0; +var isExtensible = Object.isExtensible || function(){ + return true; +}; +var FREEZE = !__webpack_require__(31)(function(){ + return isExtensible(Object.preventExtensions({})); +}); +var setMeta = function(it){ + setDesc(it, META, {value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + }}); +}; +var fastKey = function(it, create){ + // return primitive with prefix + if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if(!has(it, META)){ + // can't set metadata to uncaught frozen object + if(!isExtensible(it))return 'F'; + // not necessary to add metadata + if(!create)return 'E'; + // add missing metadata + setMeta(it); + // return object ID + } return it[META].i; +}; +var getWeak = function(it, create){ + if(!has(it, META)){ + // can't set metadata to uncaught frozen object + if(!isExtensible(it))return true; + // not necessary to add metadata + if(!create)return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + } return it[META].w; +}; +// add metadata on freeze-family methods calling +var onFreeze = function(it){ + if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); + return it; +}; +var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze +}; - return { - year: resYear, - dayOfYear: resDayOfYear - }; -} +/***/ }), +/* 47 */ +/***/ (function(module, exports) { -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; - } +exports.f = {}.propertyIsEnumerable; - return { - week: resWeek, - year: resYear - }; -} +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { -function weeksInYear(year, dow, doy) { - var weekOffset = firstWeekOffset(year, dow, doy), - weekOffsetNext = firstWeekOffset(year + 1, dow, doy); - return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; -} +var def = __webpack_require__(19).f + , has = __webpack_require__(22) + , TAG = __webpack_require__(10)('toStringTag'); -// FORMATTING +module.exports = function(it, tag, stat){ + if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); +}; -addFormatToken('w', ['ww', 2], 'wo', 'week'); -addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); +/***/ }), +/* 49 */ +/***/ (function(module, exports) { -// ALIASES +var id = 0 + , px = Math.random(); +module.exports = function(key){ + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; -addUnitAlias('week', 'w'); -addUnitAlias('isoWeek', 'W'); +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { -// PRIORITIES +"use strict"; -addUnitPriority('week', 5); -addUnitPriority('isoWeek', 5); -// PARSING +exports.__esModule = true; +exports.default = staticRegister; -addRegexToken('w', match1to2); -addRegexToken('ww', match1to2, match2); -addRegexToken('W', match1to2); -addRegexToken('WW', match1to2, match2); +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } -addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); -}); +var collection = exports.collection = new Map(); -// HELPERS +function staticRegister() { + var namespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'common'; -// LOCALES + if (!collection.has(namespace)) { + collection.set(namespace, new Map()); + } + var subCollection = collection.get(namespace); -function localeWeek (mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; -} + /** + * 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); + } -var defaultLocaleWeek = { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. -}; + /** + * 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); + } -function localeFirstDayOfWeek () { - return this._week.dow; -} + /** + * Check if item under specyfied name is exists. + * + * @param {String} name Identification of the item. + * @returns {Boolean} Returns `true` or `false` depends on if element exists in the collection. + */ + function hasItem(name) { + return subCollection.has(name); + } -function localeFirstDayOfYear () { - return this._week.doy; -} + /** + * 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 [].concat(_toConsumableArray(subCollection.keys())); + } -// MOMENTS + /** + * Retrieve all registered values from the collection. + * + * @returns {Array} Returns an array with all values stored in the collection. + */ + function getValues() { + return [].concat(_toConsumableArray(subCollection.values())); + } -function getSetWeek (input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); + return { + register: register, + getItem: getItem, + hasItem: hasItem, + getNames: getNames, + getValues: getValues + }; } -function getSetISOWeek (input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); -} +/***/ }), +/* 51 */ +/***/ (function(module, exports) { -// FORMATTING +module.exports = function(it, Constructor, name, forbiddenField){ + if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){ + throw TypeError(name + ': incorrect invocation!'); + } return it; +}; -addFormatToken('d', 0, 'do', 'day'); +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { -addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); -}); +// 0 -> Array#forEach +// 1 -> Array#map +// 2 -> Array#filter +// 3 -> Array#some +// 4 -> Array#every +// 5 -> Array#find +// 6 -> Array#findIndex +var ctx = __webpack_require__(29) + , IObject = __webpack_require__(77) + , toObject = __webpack_require__(41) + , toLength = __webpack_require__(24) + , asc = __webpack_require__(280); +module.exports = function(TYPE, $create){ + var IS_MAP = TYPE == 1 + , IS_FILTER = TYPE == 2 + , IS_SOME = TYPE == 3 + , IS_EVERY = TYPE == 4 + , IS_FIND_INDEX = TYPE == 6 + , NO_HOLES = TYPE == 5 || IS_FIND_INDEX + , create = $create || asc; + return function($this, callbackfn, that){ + var O = toObject($this) + , self = IObject(O) + , f = ctx(callbackfn, that, 3) + , length = toLength(self.length) + , index = 0 + , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined + , val, res; + for(;length > index; index++)if(NO_HOLES || index in self){ + val = self[index]; + res = f(val, index, O); + if(TYPE){ + if(IS_MAP)result[index] = res; // map + else if(res)switch(TYPE){ + case 3: return true; // some + case 5: return val; // find + case 6: return index; // findIndex + case 2: result.push(val); // filter + } else if(IS_EVERY)return false; // every + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + }; +}; -addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); -}); +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { -addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); -}); +"use strict"; -addFormatToken('e', 0, 0, 'weekday'); -addFormatToken('E', 0, 0, 'isoWeekday'); +var global = __webpack_require__(13) + , $export = __webpack_require__(3) + , redefine = __webpack_require__(33) + , redefineAll = __webpack_require__(58) + , meta = __webpack_require__(46) + , forOf = __webpack_require__(55) + , anInstance = __webpack_require__(51) + , isObject = __webpack_require__(15) + , fails = __webpack_require__(31) + , $iterDetect = __webpack_require__(78) + , setToStringTag = __webpack_require__(48) + , inheritIfRequired = __webpack_require__(283); -// ALIASES +module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ + var Base = global[NAME] + , C = Base + , ADDER = IS_MAP ? 'set' : 'add' + , proto = C && C.prototype + , O = {}; + var fixMethod = function(KEY){ + var fn = proto[KEY]; + redefine(proto, KEY, + KEY == 'delete' ? function(a){ + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'has' ? function has(a){ + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'get' ? function get(a){ + return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; } + : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; } + ); + }; + if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){ + new C().entries().next(); + }))){ + // create collection constructor + C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); + redefineAll(C.prototype, methods); + meta.NEED = true; + } else { + var instance = new C + // early implementations not supports chaining + , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance + // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false + , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); }) + // most early implementations doesn't supports iterables, most modern - not close it correctly + , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new + // for early implementations -0 and +0 not the same + , BUGGY_ZERO = !IS_WEAK && fails(function(){ + // V8 ~ Chromium 42- fails only with 5+ elements + var $instance = new C() + , index = 5; + while(index--)$instance[ADDER](index, index); + return !$instance.has(-0); + }); + if(!ACCEPT_ITERABLES){ + C = wrapper(function(target, iterable){ + anInstance(target, C, NAME); + var that = inheritIfRequired(new Base, target, C); + if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); + return that; + }); + C.prototype = proto; + proto.constructor = C; + } + if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){ + fixMethod('delete'); + fixMethod('has'); + IS_MAP && fixMethod('get'); + } + if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER); + // weak collections should not contains .clear method + if(IS_WEAK && proto.clear)delete proto.clear; + } -addUnitAlias('day', 'd'); -addUnitAlias('weekday', 'e'); -addUnitAlias('isoWeekday', 'E'); + setToStringTag(C, NAME); -// PRIORITY -addUnitPriority('day', 11); -addUnitPriority('weekday', 11); -addUnitPriority('isoWeekday', 11); + O[NAME] = C; + $export($export.G + $export.W + $export.F * (C != Base), O); -// PARSING + if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP); -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); -}); + return C; +}; -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; - } -}); +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { -addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); -}); +"use strict"; -// HELPERS +var hide = __webpack_require__(32) + , redefine = __webpack_require__(33) + , fails = __webpack_require__(31) + , defined = __webpack_require__(30) + , wks = __webpack_require__(10); -function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } +module.exports = function(KEY, length, exec){ + var SYMBOL = wks(KEY) + , fns = exec(defined, SYMBOL, ''[KEY]) + , strfn = fns[0] + , rxfn = fns[1]; + if(fails(function(){ + var O = {}; + O[SYMBOL] = function(){ return 7; }; + return ''[KEY](O) != 7; + })){ + redefine(String.prototype, KEY, strfn); + hide(RegExp.prototype, SYMBOL, length == 2 + // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) + // 21.2.5.11 RegExp.prototype[@@split](string, limit) + ? function(string, arg){ return rxfn.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function(string){ return rxfn.call(string, this); } + ); + } +}; - if (!isNaN(input)) { - return parseInt(input, 10); - } +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; - } +var ctx = __webpack_require__(29) + , call = __webpack_require__(165) + , isArrayIter = __webpack_require__(161) + , anObject = __webpack_require__(18) + , toLength = __webpack_require__(24) + , getIterFn = __webpack_require__(176) + , BREAK = {} + , RETURN = {}; +var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){ + var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable) + , f = ctx(fn, that, entries ? 2 : 1) + , index = 0 + , length, step, iterator, result; + if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ + result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); + if(result === BREAK || result === RETURN)return result; + } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ + result = call(iterator, f, step.value, entries); + if(result === BREAK || result === RETURN)return result; + } +}; +exports.BREAK = BREAK; +exports.RETURN = RETURN; - return null; -} +/***/ }), +/* 56 */ +/***/ (function(module, exports) { -function parseIsoWeekday(input, locale) { - if (typeof input === 'string') { - return locale.weekdaysParse(input) % 7 || 7; - } - return isNaN(input) ? null : input; -} +module.exports = false; -// LOCALES +/***/ }), +/* 57 */ +/***/ (function(module, exports) { -var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); -function localeWeekdays (m, format) { - if (!m) { - return isArray(this._weekdays) ? this._weekdays : - this._weekdays['standalone']; - } - return isArray(this._weekdays) ? this._weekdays[m.day()] : - this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; -} +exports.f = Object.getOwnPropertySymbols; -var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); -function localeWeekdaysShort (m) { - return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; -} +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { -var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); -function localeWeekdaysMin (m) { - return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; -} +var redefine = __webpack_require__(33); +module.exports = function(target, src, safe){ + for(var key in src)redefine(target, key, src[key], safe); + return target; +}; -function handleStrictParse$1(weekdayName, format, strict) { - var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._shortWeekdaysParse = []; - this._minWeekdaysParse = []; +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { - 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(); - } - } +var toInteger = __webpack_require__(60) + , max = Math.max + , min = Math.min; +module.exports = function(index, length){ + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); +}; - if (strict) { - if (format === 'dddd') { - ii = indexOf$1.call(this._weekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf$1.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf$1.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'dddd') { - ii = indexOf$1.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf$1.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf$1.call(this._minWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } -} +/***/ }), +/* 60 */ +/***/ (function(module, exports) { -function localeWeekdaysParse (weekdayName, format, strict) { - var i, mom, regex; +// 7.1.4 ToInteger +var ceil = Math.ceil + , floor = Math.floor; +module.exports = function(it){ + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; - if (this._weekdaysParseExact) { - return handleStrictParse$1.call(this, weekdayName, format, strict); - } +/***/ }), +/* 61 */ +/***/ (function(module, exports) { - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } +module.exports = __WEBPACK_EXTERNAL_MODULE_61__; - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { - 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; - } - } -} +"use strict"; -// 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; - } -} +exports.__esModule = true; +exports.getRegisteredCellTypes = exports.getRegisteredCellTypeNames = exports.hasCellType = exports.getCellType = exports.registerCellType = undefined; -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'); -} +var _staticRegister2 = __webpack_require__(50); -function getSetISODayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } +var _staticRegister3 = _interopRequireDefault(_staticRegister2); - // 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. +var _editors = __webpack_require__(14); - if (input != null) { - var weekday = parseIsoWeekday(input, this.localeData()); - return this.day(this.day() % 7 ? weekday : weekday - 7); - } else { - return this.day() || 7; - } -} +var _renderers = __webpack_require__(9); -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 _validators = __webpack_require__(26); -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 _autocompleteType = __webpack_require__(189); -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; - } -} +var _autocompleteType2 = _interopRequireDefault(_autocompleteType); +var _checkboxType = __webpack_require__(190); -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'); -} +var _checkboxType2 = _interopRequireDefault(_checkboxType); -// FORMATTING +var _dateType = __webpack_require__(191); -function hFormat() { - return this.hours() % 12 || 12; -} +var _dateType2 = _interopRequireDefault(_dateType); -function kFormat() { - return this.hours() || 24; -} +var _dropdownType = __webpack_require__(192); -addFormatToken('H', ['HH', 2], 0, 'hour'); -addFormatToken('h', ['hh', 2], 0, hFormat); -addFormatToken('k', ['kk', 2], 0, kFormat); +var _dropdownType2 = _interopRequireDefault(_dropdownType); -addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); -}); +var _handsontableType = __webpack_require__(193); -addFormatToken('hmmss', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); -}); +var _handsontableType2 = _interopRequireDefault(_handsontableType); -addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); -}); +var _numericType = __webpack_require__(194); -addFormatToken('Hmmss', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); -}); +var _numericType2 = _interopRequireDefault(_numericType); -function meridiem (token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); - }); -} +var _passwordType = __webpack_require__(195); -meridiem('a', true); -meridiem('A', false); +var _passwordType2 = _interopRequireDefault(_passwordType); -// ALIASES +var _textType = __webpack_require__(196); -addUnitAlias('hour', 'h'); +var _textType2 = _interopRequireDefault(_textType); -// PRIORITY -addUnitPriority('hour', 13); +var _timeType = __webpack_require__(197); -// PARSING +var _timeType2 = _interopRequireDefault(_timeType); -function matchMeridiem (isStrict, locale) { - return locale._meridiemParse; -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -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)); -}); +var _staticRegister = (0, _staticRegister3.default)('cellTypes'), + register = _staticRegister.register, + getItem = _staticRegister.getItem, + hasItem = _staticRegister.hasItem, + getNames = _staticRegister.getNames, + getValues = _staticRegister.getValues; -// LOCALES +_register('autocomplete', _autocompleteType2.default); +_register('checkbox', _checkboxType2.default); +_register('date', _dateType2.default); +_register('dropdown', _dropdownType2.default); +_register('handsontable', _handsontableType2.default); +_register('numeric', _numericType2.default); +_register('password', _passwordType2.default); +_register('text', _textType2.default); +_register('time', _timeType2.default); -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'); -} +/** + * Retrieve cell type object. + * + * @param {String} name Cell type identification. + * @returns {Object} Returns cell type object. + */ +function _getItem(name) { + if (!hasItem(name)) { + throw Error('You declared cell type "' + 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 "Handsontable.cellTypes.registerCellType" method'); + } -var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; -function localeMeridiem (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; - } + 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) { + var editor = type.editor, + renderer = type.renderer, + validator = type.validator; -// MOMENTS -// Setting the hour should keep the time, because the user explicitly -// specified which hour he wants. So trying to maintain the same hour (in -// a new timezone) makes sense. Adding/subtracting hours does not follow -// this rule. -var getSetHour = makeGetSet('Hours', true); + if (editor) { + (0, _editors.registerEditor)(name, editor); + } + if (renderer) { + (0, _renderers.registerRenderer)(name, renderer); + } + if (validator) { + (0, _validators.registerValidator)(name, validator); + } -// months -// week -// weekdays -// meridiem -var baseConfig = { - calendar: defaultCalendar, - longDateFormat: defaultLongDateFormat, - invalidDate: defaultInvalidDate, - ordinal: defaultOrdinal, - dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, - relativeTime: defaultRelativeTime, + register(name, type); +} - months: defaultLocaleMonths, - monthsShort: defaultLocaleMonthsShort, +exports.registerCellType = _register; +exports.getCellType = _getItem; +exports.hasCellType = hasItem; +exports.getRegisteredCellTypeNames = getNames; +exports.getRegisteredCellTypes = getValues; - week: defaultLocaleWeek, +/***/ }), +/* 63 */ +/***/ (function(module, exports, __webpack_require__) { - weekdays: defaultLocaleWeekdays, - weekdaysMin: defaultLocaleWeekdaysMin, - weekdaysShort: defaultLocaleWeekdaysShort, +"use strict"; - meridiemParse: defaultLocaleMeridiemParse -}; -// internal storage for locale config files -var locales = {}; -var localeFamilies = {}; -var globalLocale; +exports.__esModule = true; -function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; -} +var _slicedToArray = function () { function sliceIterator(arr, i) { 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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); -// pick the locale from the array -// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each -// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root -function chooseLocale(names) { - var i = 0, j, next, locale, split; - - while (i < names.length) { - split = normalizeLocale(names[i]).split('-'); - j = split.length; - next = normalizeLocale(names[i + 1]); - next = next ? next.split('-') : null; - while (j > 0) { - locale = loadLocale(split.slice(0, j).join('-')); - if (locale) { - return locale; - } - if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { - //the next array item is better than a shallower substring of this one - break; - } - j--; - } - i++; - } - return null; -} +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -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; - __webpack_require__(418)("./" + name); - // because defineLocale currently also sets the global locale, we - // want to undo that for lazy loaded locales - getSetGlobalLocale(oldLocale); - } catch (e) { } - } - return locales[name]; -} +exports.default = Core; -// 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); - } +var _numbro = __webpack_require__(87); - if (data) { - // moment.duration._locale = moment._locale = data; - globalLocale = data; - } - } +var _numbro2 = _interopRequireDefault(_numbro); - return globalLocale._abbr; -} +var _element = __webpack_require__(0); -function defineLocale (name, config) { - if (config !== null) { - var parentConfig = baseConfig; - config.abbr = name; - if (locales[name] != null) { - deprecateSimple('defineLocaleOverride', - 'use moment.updateLocale(localeName, config) to change ' + - 'an existing locale. moment.defineLocale(localeName, ' + - 'config) should only be used for creating a new locale ' + - 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); - parentConfig = locales[name]._config; - } else if (config.parentLocale != null) { - if (locales[config.parentLocale] != null) { - parentConfig = locales[config.parentLocale]._config; - } else { - if (!localeFamilies[config.parentLocale]) { - localeFamilies[config.parentLocale] = []; - } - localeFamilies[config.parentLocale].push({ - name: name, - config: config - }); - return null; - } - } - locales[name] = new Locale(mergeConfigs(parentConfig, config)); +var _setting = __webpack_require__(65); - if (localeFamilies[name]) { - localeFamilies[name].forEach(function (x) { - defineLocale(x.name, x.config); - }); - } +var _function = __webpack_require__(35); - // 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); +var _mixed = __webpack_require__(20); +var _browser = __webpack_require__(25); - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; - } -} +var _dataMap = __webpack_require__(198); -function updateLocale(name, config) { - if (config != null) { - var locale, parentConfig = baseConfig; - // MERGE - if (locales[name] != null) { - parentConfig = locales[name]._config; - } - config = mergeConfigs(parentConfig, config); - locale = new Locale(config); - locale.parentLocale = locales[name]; - locales[name] = locale; +var _dataMap2 = _interopRequireDefault(_dataMap); - // 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]; -} +var _editorManager = __webpack_require__(200); -// returns locale data -function getLocale (key) { - var locale; +var _editorManager2 = _interopRequireDefault(_editorManager); - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; - } +var _eventManager = __webpack_require__(4); - if (!key) { - return globalLocale; - } +var _eventManager2 = _interopRequireDefault(_eventManager); - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - if (locale) { - return locale; - } - key = [key]; - } +var _object = __webpack_require__(1); - return chooseLocale(key); -} +var _array = __webpack_require__(2); -function listLocales() { - return keys$1(locales); -} +var _plugins = __webpack_require__(5); -function checkOverflow (m) { - var overflow; - var a = m._a; +var _renderers = __webpack_require__(9); - 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; +var _validators = __webpack_require__(26); - 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; - } +var _string = __webpack_require__(27); - getParsingFlags(m).overflow = overflow; - } +var _number = __webpack_require__(6); - return m; -} +var _tableView = __webpack_require__(269); -// 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}/] -]; +var _tableView2 = _interopRequireDefault(_tableView); -// 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 _dataSource = __webpack_require__(199); -var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; +var _dataSource2 = _interopRequireDefault(_dataSource); -// date from iso format -function configFromISO(config) { - var i, l, - string = config._i, - match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), - allowTime, dateFormat, timeFormat, tzFormat; +var _data = __webpack_require__(64); - if (match) { - getParsingFlags(config).iso = true; +var _recordTranslator = __webpack_require__(153); - 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; - } -} +var _src = __webpack_require__(11); -// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 -var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/; - -// date and time from ref 2822 format -function configFromRFC2822(config) { - var string, match, dayFormat, - dateFormat, timeFormat, tzFormat; - var timezones = { - ' GMT': ' +0000', - ' EDT': ' -0400', - ' EST': ' -0500', - ' CDT': ' -0500', - ' CST': ' -0600', - ' MDT': ' -0600', - ' MST': ' -0700', - ' PDT': ' -0700', - ' PST': ' -0800' - }; - var military = 'YXWVUTSRQPONZABCDEFGHIKLM'; - var timezone, timezoneIndex; - - string = config._i - .replace(/\([^\)]*\)|[\n\t]/g, ' ') // Remove comments and folding whitespace - .replace(/(\s\s+)/g, ' ') // Replace multiple-spaces with a single space - .replace(/^\s|\s$/g, ''); // Remove leading and trailing spaces - match = basicRfcRegex.exec(string); - - if (match) { - dayFormat = match[1] ? 'ddd' + ((match[1].length === 5) ? ', ' : ' ') : ''; - dateFormat = 'D MMM ' + ((match[2].length > 10) ? 'YYYY ' : 'YY '); - timeFormat = 'HH:mm' + (match[4] ? ':ss' : ''); - - // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. - if (match[1]) { // day of week given - var momentDate = new Date(match[2]); - var momentDay = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()]; - - if (match[1].substr(0,3) !== momentDay) { - getParsingFlags(config).weekdayMismatch = true; - config._isValid = false; - return; - } - } +var _pluginHooks = __webpack_require__(8); - switch (match[5].length) { - case 2: // military - if (timezoneIndex === 0) { - timezone = ' +0000'; - } else { - timezoneIndex = military.indexOf(match[5][1].toUpperCase()) - 12; - timezone = ((timezoneIndex < 0) ? ' -' : ' +') + - (('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00'; - } - break; - case 4: // Zone - timezone = timezones[match[5]]; - break; - default: // UT or +/-9999 - timezone = timezones[' GMT']; - } - match[5] = timezone; - config._i = match.splice(1).join(''); - tzFormat = ' ZZ'; - config._f = dayFormat + dateFormat + timeFormat + tzFormat; - configFromStringAndFormat(config); - getParsingFlags(config).rfc2822 = true; - } else { - config._isValid = false; - } -} +var _pluginHooks2 = _interopRequireDefault(_pluginHooks); -// date from iso format or fallback -function configFromString(config) { - var matched = aspNetJsonRegex.exec(config._i); +var _defaultSettings = __webpack_require__(88); - if (matched !== null) { - config._d = new Date(+matched[1]); - return; - } +var _defaultSettings2 = _interopRequireDefault(_defaultSettings); - configFromISO(config); - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } +var _cellTypes = __webpack_require__(62); - configFromRFC2822(config); - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - // Final attempt, use Input Fallback - hooks.createFromInputFallback(config); -} +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } -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' : '')); - } -); +var activeGuid = null; -// 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; -} +/** + * Handsontable constructor + * + * @core + * @dependencies numbro + * @constructor Core + * @description + * + * After Handsontable is constructed, you can modify the grid behavior using the available public methods. + * + * --- + * ## How to call methods + * + * These are 2 equal ways to call a Handsontable method: + * + * ```js + * // all following examples assume that you constructed Handsontable like this + * var ht = new Handsontable(document.getElementById('example1'), options); + * + * // now, to use setDataAtCell method, you can either: + * ht.setDataAtCell(0, 0, 'new value'); + * ``` + * + * Alternatively, you can call the method using jQuery wrapper (__obsolete__, requires initialization using our jQuery guide + * ```js + * $('#example1').handsontable('setDataAtCell', 0, 0, 'new value'); + * ``` + * --- + */ +function Core(rootElement, userSettings) { + var priv, + datamap, + dataSource, + grid, + selection, + editorManager, + instance = this, + GridSettings = function GridSettings() {}, + eventManager = new _eventManager2.default(instance); -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()]; -} + (0, _object.extend)(GridSettings.prototype, _defaultSettings2.default.prototype); // create grid settings as a copy of default settings + (0, _object.extend)(GridSettings.prototype, userSettings); // overwrite defaults with user settings + (0, _object.extend)(GridSettings.prototype, expandType(userSettings)); -// 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, yearToUse; + this.rootElement = rootElement; + this.isHotTableEnv = (0, _element.isChildOfWebComponentTable)(this.rootElement); + _eventManager2.default.isHotTableEnv = this.isHotTableEnv; - if (config._d) { - return; - } + this.container = document.createElement('DIV'); + this.renderCall = false; - currentDate = currentDateArray(config); + rootElement.insertBefore(this.container, rootElement.firstChild); - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } + this.guid = 'ht_' + (0, _string.randomString)(); // this is the namespace for global events - //if the day of the year is set, figure out what it is - if (config._dayOfYear != null) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + var recordTranslator = (0, _recordTranslator.getTranslator)(instance); - if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { - getParsingFlags(config)._overflowDayOfYear = true; - } + dataSource = new _dataSource2.default(instance); - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } + if (!this.rootElement.id || this.rootElement.id.substring(0, 3) === 'ht_') { + this.rootElement.id = this.guid; // if root element does not have an id, assign a random id + } + priv = { + cellSettings: [], + columnSettings: [], + columnsSettingConflicts: ['data', 'width'], + settings: new GridSettings(), // current settings instance + selRange: null, // exposed by public method `getSelectedRange` + isPopulated: null, + scrollable: null, + firstRun: true + }; - // 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]; - } + grid = { + /** + * Inserts or removes rows and columns + * + * @memberof Core# + * @function alter + * @private + * @param {String} action Possible values: "insert_row", "insert_col", "remove_row", "remove_col" + * @param {Number} index + * @param {Number} amount + * @param {String} [source] Optional. Source of hook runner. + * @param {Boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows. + */ + alter: function alter(action, index, amount, source, keepEmptyRows) { + var delta; - // 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]; - } + amount = amount || 1; - // 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; - } + function spliceWith(data, index, count, toInject) { + var valueFactory = function valueFactory() { + var result = void 0; - config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); - // 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 (toInject === 'array') { + result = []; + } else if (toInject === 'object') { + result = {}; + } - if (config._nextDay) { - config._a[HOUR] = 24; - } -} + return result; + }; + var spliceArgs = (0, _array.arrayMap)(new Array(count), function () { + return valueFactory(); + }); -function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; + spliceArgs.unshift(index, 0); + data.splice.apply(data, _toConsumableArray(spliceArgs)); + } - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; + /* eslint-disable no-case-declarations */ + switch (action) { + case 'insert_row': - // 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 numberOfSourceRows = instance.countSourceRows(); - var curWeek = weekOfYear(createLocal(), dow, doy); + if (instance.getSettings().maxRows === numberOfSourceRows) { + return; + } - weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); + index = (0, _mixed.isDefined)(index) ? index : numberOfSourceRows; - // Default to current week. - week = defaults(w.w, curWeek.week); + delta = datamap.createRow(index, amount, source); + spliceWith(priv.cellSettings, index, amount, 'array'); - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; + if (delta) { + if (selection.isSelected() && priv.selRange.from.row >= index) { + priv.selRange.from.row += delta; + selection.transformEnd(delta, 0); // will call render() internally + } else { + selection.refreshBorders(); // it will call render and prepare methods } - } else { - // default to begining of week - weekday = dow; - } - } - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } -} - -// constant that refers to the ISO standard -hooks.ISO_8601 = function () {}; + } + break; -// constant that refers to the RFC 2822 form -hooks.RFC_2822 = function () {}; + case 'insert_col': + delta = datamap.createCol(index, amount, source); -// 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; + for (var row = 0, len = instance.countSourceRows(); row < len; row++) { + if (priv.cellSettings[row]) { + spliceWith(priv.cellSettings[row], index, amount); } - else { - getParsingFlags(config).unusedTokens.push(token); + } + + if (delta) { + if (Array.isArray(instance.getSettings().colHeaders)) { + var spliceArray = [index, 0]; + spliceArray.length += delta; // inserts empty (undefined) elements at the end of an array + Array.prototype.splice.apply(instance.getSettings().colHeaders, spliceArray); // inserts empty (undefined) elements into the colHeader array } - 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); - } + if (selection.isSelected() && priv.selRange.from.col >= index) { + priv.selRange.from.col += delta; + selection.transformEnd(0, delta); // will call render() internally + } else { + selection.refreshBorders(); // it will call render and prepare methods + } + } + break; - // clear _12h flag if hour is <= 12 - if (config._a[HOUR] <= 12 && - getParsingFlags(config).bigHour === true && - config._a[HOUR] > 0) { - getParsingFlags(config).bigHour = undefined; - } + case 'remove_row': + datamap.removeRow(index, amount, source); + priv.cellSettings.splice(index, amount); - 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); + var totalRows = instance.countRows(); + var fixedRowsTop = instance.getSettings().fixedRowsTop; + if (fixedRowsTop >= index + 1) { + instance.getSettings().fixedRowsTop -= Math.min(amount, fixedRowsTop - index); + } - configFromArray(config); - checkOverflow(config); -} + var fixedRowsBottom = instance.getSettings().fixedRowsBottom; + if (fixedRowsBottom && index >= totalRows - fixedRowsBottom) { + instance.getSettings().fixedRowsBottom -= Math.min(amount, fixedRowsBottom); + } + grid.adjustRowsAndCols(); + selection.refreshBorders(); // it will call render and prepare methods + break; -function meridiemFixWrap (locale, hour, meridiem) { - var isPm; + case 'remove_col': + var visualColumnIndex = recordTranslator.toPhysicalColumn(index); - 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; - } -} + datamap.removeCol(index, amount, source); -// date from string and array of format strings -function configFromStringAndArray(config) { - var tempConfig, - bestMoment, + for (var _row = 0, _len = instance.countSourceRows(); _row < _len; _row++) { + if (priv.cellSettings[_row]) { + // if row hasn't been rendered it wouldn't have cellSettings + priv.cellSettings[_row].splice(visualColumnIndex, amount); + } + } + var fixedColumnsLeft = instance.getSettings().fixedColumnsLeft; - scoreToBeat, - i, - currentScore; + if (fixedColumnsLeft >= index + 1) { + instance.getSettings().fixedColumnsLeft -= Math.min(amount, fixedColumnsLeft - index); + } - if (config._f.length === 0) { - getParsingFlags(config).invalidFormat = true; - config._d = new Date(NaN); - return; - } + if (Array.isArray(instance.getSettings().colHeaders)) { + if (typeof visualColumnIndex === 'undefined') { + visualColumnIndex = -1; + } + instance.getSettings().colHeaders.splice(visualColumnIndex, amount); + } - 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); + grid.adjustRowsAndCols(); + selection.refreshBorders(); // it will call render and prepare methods - if (!isValid(tempConfig)) { - continue; - } + break; + default: + throw new Error('There is no such action "' + action + '"'); + } - // if there is any input that was not parsed add a penalty for that format - currentScore += getParsingFlags(tempConfig).charsLeftOver; + if (!keepEmptyRows) { + grid.adjustRowsAndCols(); // makes sure that we did not add rows that will be removed in next refresh + } + }, - //or tokens - currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; - getParsingFlags(tempConfig).score = currentScore; + /** + * Makes sure there are empty rows at the bottom of the table + */ + adjustRowsAndCols: function adjustRowsAndCols() { + if (priv.settings.minRows) { + // should I add empty rows to data source to meet minRows? + var rows = instance.countRows(); - if (scoreToBeat == null || currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; + if (rows < priv.settings.minRows) { + for (var r = 0, minRows = priv.settings.minRows; r < minRows - rows; r++) { + datamap.createRow(instance.countRows(), 1, 'auto'); + } } - } - - 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); - }); + } + if (priv.settings.minSpareRows) { + var emptyRows = instance.countEmptyRows(true); - configFromArray(config); -} + // should I add empty rows to meet minSpareRows? + if (emptyRows < priv.settings.minSpareRows) { + for (; emptyRows < priv.settings.minSpareRows && instance.countSourceRows() < priv.settings.maxRows; emptyRows++) { + datamap.createRow(instance.countRows(), 1, 'auto'); + } + } + } + { + var emptyCols = void 0; -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; - } + // count currently empty cols + if (priv.settings.minCols || priv.settings.minSpareCols) { + emptyCols = instance.countEmptyCols(true); + } - return res; -} + // should I add empty cols to meet minCols? + if (priv.settings.minCols && !priv.settings.columns && instance.countCols() < priv.settings.minCols) { + for (; instance.countCols() < priv.settings.minCols; emptyCols++) { + datamap.createCol(instance.countCols(), 1, 'auto'); + } + } + // should I add empty cols to meet minSpareCols? + if (priv.settings.minSpareCols && !priv.settings.columns && instance.dataType === 'array' && emptyCols < priv.settings.minSpareCols) { + for (; emptyCols < priv.settings.minSpareCols && instance.countCols() < priv.settings.maxCols; emptyCols++) { + datamap.createCol(instance.countCols(), 1, 'auto'); + } + } + } + var rowCount = instance.countRows(); + var colCount = instance.countCols(); -function prepareConfig (config) { - var input = config._i, - format = config._f; + if (rowCount === 0 || colCount === 0) { + selection.deselect(); + } - config._locale = config._locale || getLocale(config._l); + if (selection.isSelected()) { + var selectionChanged = false; + var fromRow = priv.selRange.from.row; + var fromCol = priv.selRange.from.col; + var toRow = priv.selRange.to.row; + var toCol = priv.selRange.to.col; - if (input === null || (format === undefined && input === '')) { - return createInvalid({nullInput: true}); - } + // if selection is outside, move selection to last row + if (fromRow > rowCount - 1) { + fromRow = rowCount - 1; + selectionChanged = true; - if (typeof input === 'string') { - config._i = input = config._locale.preparse(input); - } + if (toRow > fromRow) { + toRow = fromRow; + } + } else if (toRow > rowCount - 1) { + toRow = rowCount - 1; + selectionChanged = true; - 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 (fromRow > toRow) { + fromRow = toRow; + } + } + // if selection is outside, move selection to last row + if (fromCol > colCount - 1) { + fromCol = colCount - 1; + selectionChanged = true; - if (!isValid(config)) { - config._d = null; - } + if (toCol > fromCol) { + toCol = fromCol; + } + } else if (toCol > colCount - 1) { + toCol = colCount - 1; + selectionChanged = true; - return config; -} + if (fromCol > toCol) { + fromCol = toCol; + } + } -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); - } -} + if (selectionChanged) { + instance.selectCell(fromRow, fromCol, toRow, toCol); + } + } + if (instance.view) { + instance.view.wt.wtOverlays.adjustElementsSize(); + } + }, -function createLocalOrUTC (input, format, locale, strict, isUTC) { - var c = {}; - if (locale === true || locale === false) { - strict = locale; - locale = undefined; - } + /** + * Populate the data from the provided 2d array from the given cell coordinates. + * + * @private + * @param {Object} start Start selection position. Visual indexes. + * @param {Array} input 2d data array. + * @param {Object} [end] End selection position (only for drag-down mode). Visual indexes. + * @param {String} [source="populateFromArray"] Source information string. + * @param {String} [method="overwrite"] Populate method. Possible options: `shift_down`, `shift_right`, `overwrite`. + * @param {String} direction (left|right|up|down) String specifying the direction. + * @param {Array} deltas The deltas array. A difference between values of adjacent cells. + * Useful **only** when the type of handled cells is `numeric`. + * @returns {Object|undefined} ending td in pasted area (only if any cell was changed). + */ + populateFromArray: function populateFromArray(start, input, end, source, method, direction, deltas) { + // TODO: either remove or implement the `direction` argument. Currently it's not working at all. + var r, + rlen, + c, + clen, + setData = [], + current = {}; - 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; + rlen = input.length; - return createFromConfig(c); -} + if (rlen === 0) { + return false; + } -function createLocal (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); -} + var repeatCol, + repeatRow, + cmax, + rmax, + baseEnd = { + row: end === null ? null : end.row, + col: end === null ? null : end.col + }; -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(); - } - } -); + /* eslint-disable no-case-declarations */ + // insert data with specified pasteMode method + switch (method) { + case 'shift_down': + repeatCol = end ? end.col - start.col + 1 : 0; + repeatRow = end ? end.row - start.row + 1 : 0; + input = (0, _data.translateRowsToColumns)(input); + for (c = 0, clen = input.length, cmax = Math.max(clen, repeatCol); c < cmax; c++) { + if (c < clen) { + var _instance; -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(); - } - } -); + for (r = 0, rlen = input[c].length; r < repeatRow - rlen; r++) { + input[c].push(input[c][r % rlen]); + } + input[c].unshift(start.col + c, start.row, 0); + (_instance = instance).spliceCol.apply(_instance, _toConsumableArray(input[c])); + } else { + var _instance2; -// 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; -} + input[c % clen][0] = start.col + c; + (_instance2 = instance).spliceCol.apply(_instance2, _toConsumableArray(input[c % clen])); + } + } + break; -// TODO: Use [].sort instead? -function min () { - var args = [].slice.call(arguments, 0); + case 'shift_right': + repeatCol = end ? end.col - start.col + 1 : 0; + repeatRow = end ? end.row - start.row + 1 : 0; + for (r = 0, rlen = input.length, rmax = Math.max(rlen, repeatRow); r < rmax; r++) { + if (r < rlen) { + var _instance3; - return pickBy('isBefore', args); -} + for (c = 0, clen = input[r].length; c < repeatCol - clen; c++) { + input[r].push(input[r][c % clen]); + } + input[r].unshift(start.row + r, start.col, 0); + (_instance3 = instance).spliceRow.apply(_instance3, _toConsumableArray(input[r])); + } else { + var _instance4; -function max () { - var args = [].slice.call(arguments, 0); + input[r % rlen][0] = start.row + r; + (_instance4 = instance).spliceRow.apply(_instance4, _toConsumableArray(input[r % rlen])); + } + } + break; - return pickBy('isAfter', args); -} + case 'overwrite': + default: + // overwrite and other not specified options + current.row = start.row; + current.col = start.col; -var now = function () { - return Date.now ? Date.now() : +(new Date()); -}; + var selected = { // selected range + row: end && start ? end.row - start.row + 1 : 1, + col: end && start ? end.col - start.col + 1 : 1 + }; + var skippedRow = 0; + var skippedColumn = 0; + var pushData = true; + var cellMeta = void 0; -var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; + var getInputValue = function getInputValue(row) { + var col = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; -function isDurationValid(m) { - for (var key in m) { - if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) { - return false; - } - } + var rowValue = input[row % input.length]; - 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; + if (col !== null) { + return rowValue[col % rowValue.length]; } - } - } - return true; -} - -function isValid$1() { - return this._isValid; -} + return rowValue; + }; + var rowInputLength = input.length; + var rowSelectionLength = end ? end.row - start.row + 1 : 0; -function createInvalid$1() { - return createDuration(NaN); -} - -function Duration (duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; - - this._isValid = isDurationValid(normalizedInput); - - // representation for dateAddRemove - this._milliseconds = +milliseconds + - seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - this._days = +days + - weeks * 7; - // It is impossible 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(); -} + if (end) { + rlen = rowSelectionLength; + } else { + rlen = Math.max(rowInputLength, rowSelectionLength); + } + for (r = 0; r < rlen; r++) { + if (end && current.row > end.row && rowSelectionLength > rowInputLength || !priv.settings.allowInsertRow && current.row > instance.countRows() - 1 || current.row >= priv.settings.maxRows) { + break; + } + var visualRow = r - skippedRow; + var colInputLength = getInputValue(visualRow).length; + var colSelectionLength = end ? end.col - start.col + 1 : 0; -function isDuration (obj) { - return obj instanceof Duration; -} + if (end) { + clen = colSelectionLength; + } else { + clen = Math.max(colInputLength, colSelectionLength); + } + current.col = start.col; + cellMeta = instance.getCellMeta(current.row, current.col); -function absRound (number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } -} + if ((source === 'CopyPaste.paste' || source === 'Autofill.autofill') && cellMeta.skipRowOnPaste) { + skippedRow++; + current.row++; + rlen++; + /* eslint-disable no-continue */ + continue; + } + skippedColumn = 0; -// FORMATTING + for (c = 0; c < clen; c++) { + if (end && current.col > end.col && colSelectionLength > colInputLength || !priv.settings.allowInsertColumn && current.col > instance.countCols() - 1 || current.col >= priv.settings.maxCols) { + break; + } + cellMeta = instance.getCellMeta(current.row, current.col); -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); - }); -} + if ((source === 'CopyPaste.paste' || source === 'Autofill.fill') && cellMeta.skipColumnOnPaste) { + skippedColumn++; + current.col++; + clen++; + continue; + } + if (cellMeta.readOnly) { + current.col++; + /* eslint-disable no-continue */ + continue; + } + var visualColumn = c - skippedColumn; + var value = getInputValue(visualRow, visualColumn); + var orgValue = instance.getDataAtCell(current.row, current.col); + var index = { + row: visualRow, + col: visualColumn + }; -offset('Z', ':'); -offset('ZZ', ''); + if (source === 'Autofill.fill') { + var result = instance.runHooks('beforeAutofillInsidePopulate', index, direction, input, deltas, {}, selected); -// PARSING + if (result) { + value = (0, _mixed.isUndefined)(result.value) ? value : result.value; + } + } + if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') { + if (orgValue === null || (typeof orgValue === 'undefined' ? 'undefined' : _typeof(orgValue)) !== 'object') { + pushData = false; + } else { + var orgValueSchema = (0, _object.duckSchema)(orgValue[0] || orgValue); + var valueSchema = (0, _object.duckSchema)(value[0] || value); -addRegexToken('Z', matchShortOffset); -addRegexToken('ZZ', matchShortOffset); -addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); -}); + /* eslint-disable max-depth */ + if ((0, _object.isObjectEquals)(orgValueSchema, valueSchema)) { + value = (0, _object.deepClone)(value); + } else { + pushData = false; + } + } + } else if (orgValue !== null && (typeof orgValue === 'undefined' ? 'undefined' : _typeof(orgValue)) === 'object') { + pushData = false; + } + if (pushData) { + setData.push([current.row, current.col, value]); + } + pushData = true; + current.col++; + } + current.row++; + } + instance.setDataAtCell(setData, null, null, source || 'populateFromArray'); + break; + } + } + }; -// HELPERS + /* eslint-disable no-multi-assign */ + this.selection = selection = { // this public assignment is only temporary + inProgress: false, -// timezone chunker -// '+10:00' > ['10', '00'] -// '-1530' > ['-15', '30'] -var chunkOffset = /([\+\-]|\d\d)/gi; + selectedHeader: { + cols: false, + rows: false + }, -function offsetFromString(matcher, string) { - var matches = (string || '').match(matcher); + /** + * @param {Boolean} [rows=false] + * @param {Boolean} [cols=false] + * @param {Boolean} [corner=false] + */ + setSelectedHeaders: function setSelectedHeaders() { + var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var cols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var corner = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - if (matches === null) { - return null; - } + instance.selection.selectedHeader.rows = rows; + instance.selection.selectedHeader.cols = cols; + instance.selection.selectedHeader.corner = corner; + }, - 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; -} + /** + * Sets inProgress to `true`. This enables onSelectionEnd and onSelectionEndByProp to function as desired. + */ + begin: function begin() { + instance.selection.inProgress = true; + }, -// 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; -} + /** + * Sets inProgress to `false`. Triggers onSelectionEnd and onSelectionEndByProp. + */ + finish: function finish() { + var sel = instance.getSelected(); + instance.runHooks('afterSelectionEnd', sel[0], sel[1], sel[2], sel[3]); + instance.runHooks('afterSelectionEndByProp', sel[0], instance.colToProp(sel[1]), sel[2], instance.colToProp(sel[3])); + instance.selection.inProgress = false; + }, -// 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 () {}; + /** + * @returns {Boolean} + */ + isInProgress: function isInProgress() { + return instance.selection.inProgress; + }, -// 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); - } -} + /** + * Starts selection range on given td object. + * + * @param {CellCoords} coords Visual coords. + * @param keepEditorOpened + */ + setRangeStart: function setRangeStart(coords, keepEditorOpened) { + instance.runHooks('beforeSetRangeStart', coords); + priv.selRange = new _src.CellRange(coords, coords, coords); + selection.setRangeEnd(coords, null, keepEditorOpened); + }, -function getSetZone (input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; - } - this.utcOffset(input, keepLocalTime); + /** + * Starts selection range on given td object. + * + * @param {CellCoords} coords Visual coords. + * @param keepEditorOpened + */ + setRangeStartOnly: function setRangeStartOnly(coords) { + instance.runHooks('beforeSetRangeStartOnly', coords); + priv.selRange = new _src.CellRange(coords, coords, coords); + }, - return this; - } else { - return -this.utcOffset(); - } -} -function setOffsetToUTC (keepLocalTime) { - return this.utcOffset(0, keepLocalTime); -} + /** + * Ends selection range on given td object. + * + * @param {CellCoords} coords Visual coords. + * @param {Boolean} [scrollToCell=true] If `true`, viewport will be scrolled to range end + * @param {Boolean} [keepEditorOpened] If `true`, cell editor will be still opened after changing selection range + */ + setRangeEnd: function setRangeEnd(coords, scrollToCell, keepEditorOpened) { + if (priv.selRange === null) { + return; + } + var disableVisualSelection, + isHeaderSelected = false, + areCoordsPositive = true; -function setOffsetToLocal (keepLocalTime) { - if (this._isUTC) { - this.utcOffset(0, keepLocalTime); - this._isUTC = false; + var firstVisibleRow = instance.view.wt.wtTable.getFirstVisibleRow(); + var firstVisibleColumn = instance.view.wt.wtTable.getFirstVisibleColumn(); + var newRangeCoords = { + row: null, + col: null + }; - if (keepLocalTime) { - this.subtract(getDateOffset(this), 'm'); - } - } - return this; -} + // trigger handlers + instance.runHooks('beforeSetRangeEnd', coords); + instance.selection.begin(); -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; -} + newRangeCoords.row = coords.row < 0 ? firstVisibleRow : coords.row; + newRangeCoords.col = coords.col < 0 ? firstVisibleColumn : coords.col; -function hasAlignedHourOffset (input) { - if (!this.isValid()) { - return false; - } - input = input ? createLocal(input).utcOffset() : 0; + priv.selRange.to = new _src.CellCoords(newRangeCoords.row, newRangeCoords.col); - return (this.utcOffset() - input) % 60 === 0; -} + if (!priv.settings.multiSelect) { + priv.selRange.from = coords; + } + // set up current selection + instance.view.wt.selections.current.clear(); -function isDaylightSavingTime () { - return ( - this.utcOffset() > this.clone().month(0).utcOffset() || - this.utcOffset() > this.clone().month(5).utcOffset() - ); -} + disableVisualSelection = instance.getCellMeta(priv.selRange.highlight.row, priv.selRange.highlight.col).disableVisualSelection; -function isDaylightSavingTimeShifted () { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } + if (typeof disableVisualSelection === 'string') { + disableVisualSelection = [disableVisualSelection]; + } - var c = {}; + if (disableVisualSelection === false || Array.isArray(disableVisualSelection) && disableVisualSelection.indexOf('current') === -1) { + instance.view.wt.selections.current.add(priv.selRange.highlight); + } + // set up area selection + instance.view.wt.selections.area.clear(); - copyConfig(c, this); - c = prepareConfig(c); + if ((disableVisualSelection === false || Array.isArray(disableVisualSelection) && disableVisualSelection.indexOf('area') === -1) && selection.isMultiple()) { + instance.view.wt.selections.area.add(priv.selRange.from); + instance.view.wt.selections.area.add(priv.selRange.to); + } + // set up highlight + if (priv.settings.currentHeaderClassName || priv.settings.currentRowClassName || priv.settings.currentColClassName) { + instance.view.wt.selections.highlight.clear(); + instance.view.wt.selections.highlight.add(priv.selRange.from); + instance.view.wt.selections.highlight.add(priv.selRange.to); + } - 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; - } + var preventScrolling = (0, _object.createObjectPropListener)('value'); - return this._isDSTShifted; -} + // trigger handlers + instance.runHooks('afterSelection', priv.selRange.from.row, priv.selRange.from.col, priv.selRange.to.row, priv.selRange.to.col, preventScrolling); + instance.runHooks('afterSelectionByProp', priv.selRange.from.row, datamap.colToProp(priv.selRange.from.col), priv.selRange.to.row, datamap.colToProp(priv.selRange.to.col), preventScrolling); -function isLocal () { - return this.isValid() ? !this._isUTC : false; -} + if (priv.selRange.from.row === 0 && priv.selRange.to.row === instance.countRows() - 1 && instance.countRows() > 1 || priv.selRange.from.col === 0 && priv.selRange.to.col === instance.countCols() - 1 && instance.countCols() > 1) { + isHeaderSelected = true; + } -function isUtcOffset () { - return this.isValid() ? this._isUTC : false; -} + if (coords.row < 0 || coords.col < 0) { + areCoordsPositive = false; + } -function isUtc () { - return this.isValid() ? this._isUTC && this._offset === 0 : false; -} + if (preventScrolling.isTouched()) { + scrollToCell = !preventScrolling.value; + } -// 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; + if (scrollToCell !== false && !isHeaderSelected && areCoordsPositive) { + if (priv.selRange.from && !selection.isMultiple()) { + instance.view.scrollViewport(priv.selRange.from); } 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; - } + instance.view.scrollViewport(coords); + } + } - ret = new Duration(duration); + if (selection.selectedHeader.rows && selection.selectedHeader.cols) { + (0, _element.addClass)(instance.rootElement, ['ht__selection--rows', 'ht__selection--columns']); + } else if (selection.selectedHeader.rows) { + (0, _element.removeClass)(instance.rootElement, 'ht__selection--columns'); + (0, _element.addClass)(instance.rootElement, 'ht__selection--rows'); + } else if (selection.selectedHeader.cols) { + (0, _element.removeClass)(instance.rootElement, 'ht__selection--rows'); + (0, _element.addClass)(instance.rootElement, 'ht__selection--columns'); + } else { + (0, _element.removeClass)(instance.rootElement, ['ht__selection--rows', 'ht__selection--columns']); + } - if (isDuration(input) && hasOwnProp(input, '_locale')) { - ret._locale = input._locale; - } + selection.refreshBorders(null, keepEditorOpened); + }, - return ret; -} -createDuration.fn = Duration.prototype; -createDuration.invalid = createInvalid$1; + /** + * Destroys editor, redraws borders around cells, prepares editor. + * + * @param {Boolean} [revertOriginal] + * @param {Boolean} [keepEditor] + */ + refreshBorders: function refreshBorders(revertOriginal, keepEditor) { + if (!keepEditor) { + editorManager.destroyEditor(revertOriginal); + } + instance.view.render(); -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; -} + if (selection.isSelected() && !keepEditor) { + editorManager.prepareEditor(); + } + }, -function positiveMomentsDifference(base, other) { - var res = {milliseconds: 0, months: 0}; - res.months = other.month() - base.month() + - (other.year() - base.year()) * 12; - if (base.clone().add(res.months, 'M').isAfter(other)) { - --res.months; - } + /** + * Returns information if we have a multiselection. + * + * @returns {Boolean} + */ + isMultiple: function isMultiple() { + var isMultiple = !(priv.selRange.to.col === priv.selRange.from.col && priv.selRange.to.row === priv.selRange.from.row), + modifier = instance.runHooks('afterIsMultipleSelection', isMultiple); - res.milliseconds = +other - +(base.clone().add(res.months, 'M')); + if (isMultiple) { + return modifier; + } + }, - return res; -} -function momentsDifference(base, other) { - var res; - if (!(base.isValid() && other.isValid())) { - return {milliseconds: 0, months: 0}; - } + /** + * Selects cell relative to current cell (if possible). + */ + transformStart: function transformStart(rowDelta, colDelta, force, keepEditorOpened) { + var delta = new _src.CellCoords(rowDelta, colDelta), + rowTransformDir = 0, + colTransformDir = 0, + totalRows, + totalCols, + coords, + fixedRowsBottom; - 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; - } + instance.runHooks('modifyTransformStart', delta); + totalRows = instance.countRows(); + totalCols = instance.countCols(); + fixedRowsBottom = instance.getSettings().fixedRowsBottom; - return res; -} + if (priv.selRange.highlight.row + rowDelta > totalRows - 1) { + if (force && priv.settings.minSpareRows > 0 && !(fixedRowsBottom && priv.selRange.highlight.row >= totalRows - fixedRowsBottom - 1)) { + instance.alter('insert_row', totalRows); + totalRows = instance.countRows(); + } else if (priv.settings.autoWrapCol) { + delta.row = 1 - totalRows; + delta.col = priv.selRange.highlight.col + delta.col == totalCols - 1 ? 1 - totalCols : 1; + } + } else if (priv.settings.autoWrapCol && priv.selRange.highlight.row + delta.row < 0 && priv.selRange.highlight.col + delta.col >= 0) { + delta.row = totalRows - 1; + delta.col = priv.selRange.highlight.col + delta.col == 0 ? totalCols - 1 : -1; + } -// 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; - }; -} + if (priv.selRange.highlight.col + delta.col > totalCols - 1) { + if (force && priv.settings.minSpareCols > 0) { + instance.alter('insert_col', totalCols); + totalCols = instance.countCols(); + } else if (priv.settings.autoWrapRow) { + delta.row = priv.selRange.highlight.row + delta.row == totalRows - 1 ? 1 - totalRows : 1; + delta.col = 1 - totalCols; + } + } else if (priv.settings.autoWrapRow && priv.selRange.highlight.col + delta.col < 0 && priv.selRange.highlight.row + delta.row >= 0) { + delta.row = priv.selRange.highlight.row + delta.row == 0 ? totalRows - 1 : -1; + delta.col = totalCols - 1; + } -function addSubtract (mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); + coords = new _src.CellCoords(priv.selRange.highlight.row + delta.row, priv.selRange.highlight.col + delta.col); - if (!mom.isValid()) { - // No op - return; - } + if (coords.row < 0) { + rowTransformDir = -1; + coords.row = 0; + } else if (coords.row > 0 && coords.row >= totalRows) { + rowTransformDir = 1; + coords.row = totalRows - 1; + } - updateOffset = updateOffset == null ? true : updateOffset; + if (coords.col < 0) { + colTransformDir = -1; + coords.col = 0; + } else if (coords.col > 0 && coords.col >= totalCols) { + colTransformDir = 1; + coords.col = totalCols - 1; + } + instance.runHooks('afterModifyTransformStart', coords, rowTransformDir, colTransformDir); + selection.setRangeStart(coords, keepEditorOpened); + }, - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); - } - if (days) { - set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); - } - if (months) { - setMonth(mom, get(mom, 'Month') + months * 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'; -} + /** + * Sets selection end cell relative to current selection end cell (if possible). + */ + transformEnd: function transformEnd(rowDelta, colDelta) { + var delta = new _src.CellCoords(rowDelta, colDelta), + rowTransformDir = 0, + colTransformDir = 0, + totalRows, + totalCols, + coords; -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'; + instance.runHooks('modifyTransformEnd', delta); - var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); + totalRows = instance.countRows(); + totalCols = instance.countCols(); + coords = new _src.CellCoords(priv.selRange.to.row + delta.row, priv.selRange.to.col + delta.col); - return this.format(output || this.localeData().calendar(format, this, createLocal(now))); -} + if (coords.row < 0) { + rowTransformDir = -1; + coords.row = 0; + } else if (coords.row > 0 && coords.row >= totalRows) { + rowTransformDir = 1; + coords.row = totalRows - 1; + } -function clone () { - return new Moment(this); -} + if (coords.col < 0) { + colTransformDir = -1; + coords.col = 0; + } else if (coords.col > 0 && coords.col >= totalCols) { + colTransformDir = 1; + coords.col = totalCols - 1; + } + instance.runHooks('afterModifyTransformEnd', coords, rowTransformDir, colTransformDir); + selection.setRangeEnd(coords, true); + }, -function isAfter (input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() > localInput.valueOf(); - } else { - return localInput.valueOf() < this.clone().startOf(units).valueOf(); - } -} -function isBefore (input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() < localInput.valueOf(); - } else { - return this.clone().endOf(units).valueOf() < localInput.valueOf(); - } -} + /** + * Returns `true` if currently there is a selection on screen, `false` otherwise. + * + * @returns {Boolean} + */ + isSelected: function isSelected() { + return priv.selRange !== null; + }, -function isBetween (from, to, units, inclusivity) { - inclusivity = inclusivity || '()'; - return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && - (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); -} -function isSame (input, units) { - var localInput = isMoment(input) ? input : createLocal(input), - inputMs; - if (!(this.isValid() && localInput.isValid())) { + /** + * Returns `true` if coords is within current selection coords. + * + * @param {CellCoords} coords + * @returns {Boolean} + */ + inInSelection: function inInSelection(coords) { + if (!selection.isSelected()) { 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); -} + return priv.selRange.includes(coords); + }, -function diff (input, units, asFloat) { - var that, - zoneDelta, - delta, output; - if (!this.isValid()) { - return NaN; - } + /** + * Deselects all selected cells + */ + deselect: function deselect() { + if (!selection.isSelected()) { + return; + } + instance.selection.inProgress = false; // needed by HT inception + priv.selRange = null; + instance.view.wt.selections.current.clear(); + instance.view.wt.selections.area.clear(); + if (priv.settings.currentHeaderClassName || priv.settings.currentRowClassName || priv.settings.currentColClassName) { + instance.view.wt.selections.highlight.clear(); + } + editorManager.destroyEditor(); + selection.refreshBorders(); + (0, _element.removeClass)(instance.rootElement, ['ht__selection--rows', 'ht__selection--columns']); + instance.runHooks('afterDeselect'); + }, - that = cloneWithOffset(input, this); - if (!that.isValid()) { - return NaN; - } + /** + * Select all cells + */ + selectAll: function selectAll() { + if (!priv.settings.multiSelect) { + return; + } + selection.setSelectedHeaders(true, true, true); + selection.setRangeStart(new _src.CellCoords(0, 0)); + selection.setRangeEnd(new _src.CellCoords(instance.countRows() - 1, instance.countCols() - 1), false); + }, - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - units = normalizeUnits(units); + /** + * Deletes data from selected cells + */ + empty: function empty() { + if (!selection.isSelected()) { + return; + } + var topLeft = priv.selRange.getTopLeftCorner(); + var bottomRight = priv.selRange.getBottomRightCorner(); + var r, + c, + changes = []; - if (units === 'year' || units === 'month' || units === 'quarter') { - output = monthDiff(this, that); - if (units === 'quarter') { - output = output / 3; - } else if (units === 'year') { - output = output / 12; + for (r = topLeft.row; r <= bottomRight.row; r++) { + for (c = topLeft.col; c <= bottomRight.col; c++) { + if (!instance.getCellMeta(r, c).readOnly) { + changes.push([r, c, '']); + } } - } else { - delta = this - that; - output = units === 'second' ? delta / 1e3 : // 1000 - units === 'minute' ? delta / 6e4 : // 1000 * 60 - units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 - units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst - units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst - delta; - } - 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); + } + instance.setDataAtCell(changes); } + }; - //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() { - if (!this.isValid()) { - return null; - } - var m = this.clone().utc(); - if (m.year() < 0 || m.year() > 9999) { - return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - if (isFunction(Date.prototype.toISOString)) { - // native implementation is ~50x faster, use it when we can - return this.toDate().toISOString(); - } - return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); -} - -/** - * 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; + this.init = function () { + dataSource.setData(priv.settings.data); + instance.runHooks('beforeInit'); - if (key === undefined) { - return this._locale._abbr; - } else { - newLocaleData = getLocale(key); - if (newLocaleData != null) { - this._locale = newLocaleData; - } - return this; + if ((0, _browser.isMobileBrowser)()) { + (0, _element.addClass)(instance.rootElement, 'mobile'); } -} -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); - } - } -); + this.updateSettings(priv.settings, true); -function localeData () { - return this._locale; -} + this.view = new _tableView2.default(this); + editorManager = new _editorManager2.default(instance, priv, selection, datamap); -function startOf (units) { - units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. - switch (units) { - case 'year': - this.month(0); - /* falls through */ - case 'quarter': - case 'month': - this.date(1); - /* falls through */ - case 'week': - case 'isoWeek': - case 'day': - case 'date': - this.hours(0); - /* falls through */ - case 'hour': - this.minutes(0); - /* falls through */ - case 'minute': - this.seconds(0); - /* falls through */ - case 'second': - this.milliseconds(0); - } - - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } - if (units === 'isoWeek') { - this.isoWeekday(1); - } - - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); - } - - return this; -} + this.forceFullRender = true; // used when data was changed -function endOf (units) { - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond') { - return this; - } + instance.runHooks('init'); + this.view.render(); - // 'date' is an alias for 'day', so it should be considered as such. - if (units === 'date') { - units = 'day'; + if (_typeof(priv.firstRun) === 'object') { + instance.runHooks('afterChange', priv.firstRun[0], priv.firstRun[1]); + priv.firstRun = false; } + instance.runHooks('afterInit'); + }; - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); -} - -function valueOf () { - return this._d.valueOf() - ((this._offset || 0) * 60000); -} - -function unix () { - return Math.floor(this.valueOf() / 1000); -} - -function toDate () { - return new Date(this.valueOf()); -} - -function toArray () { - var m = this; - return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; -} - -function toObject () { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds() - }; -} - -function toJSON () { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; -} - -function isValid$2 () { - return isValid(this); -} - -function parsingFlags () { - return extend({}, getParsingFlags(this)); -} - -function invalidAt () { - return getParsingFlags(this).overflow; -} + function ValidatorsQueue() { + // moved this one level up so it can be used in any function here. Probably this should be moved to a separate file + var resolved = false; -function creationData() { return { - input: this._i, - format: this._f, - locale: this._locale, - isUTC: this._isUTC, - strict: this._strict + validatorsInQueue: 0, + valid: true, + addValidatorToQueue: function addValidatorToQueue() { + this.validatorsInQueue++; + resolved = false; + }, + removeValidatorFormQueue: function removeValidatorFormQueue() { + this.validatorsInQueue = this.validatorsInQueue - 1 < 0 ? 0 : this.validatorsInQueue - 1; + this.checkIfQueueIsEmpty(); + }, + onQueueEmpty: function onQueueEmpty(valid) {}, + checkIfQueueIsEmpty: function checkIfQueueIsEmpty() { + if (this.validatorsInQueue == 0 && resolved == false) { + resolved = true; + this.onQueueEmpty(this.valid); + } + } }; -} - -// 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); + } + function validateChanges(changes, source, callback) { + var waitingForValidator = new ValidatorsQueue(); + waitingForValidator.onQueueEmpty = resolve; -// PARSING + for (var i = changes.length - 1; i >= 0; i--) { + if (changes[i] === null) { + changes.splice(i, 1); + } else { + var row = changes[i][0]; + var col = datamap.propToCol(changes[i][1]); -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); + var cellProperties = instance.getCellMeta(row, col); -addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { - week[token.substr(0, 2)] = toInt(input); -}); + if (cellProperties.type === 'numeric' && typeof changes[i][3] === 'string') { + if (changes[i][3].length > 0 && (/^-?[\d\s]*(\.|,)?\d*$/.test(changes[i][3]) || cellProperties.format)) { + var len = changes[i][3].length; -addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { - week[token] = hooks.parseTwoDigitYear(input); -}); + if ((0, _mixed.isUndefined)(cellProperties.language)) { + _numbro2.default.culture('en-US'); + } else if (changes[i][3].indexOf('.') === len - 3 && changes[i][3].indexOf(',') === -1) { + // this input in format XXXX.XX is likely to come from paste. Let's parse it using international rules + _numbro2.default.culture('en-US'); + } else { -// MOMENTS + _numbro2.default.culture(cellProperties.language); + } -function getSetWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, - this.week(), - this.weekday(), - this.localeData()._week.dow, - this.localeData()._week.doy); -} + var _numbro$cultureData = _numbro2.default.cultureData(_numbro2.default.culture()), + delimiters = _numbro$cultureData.delimiters; -function getSetISOWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, this.isoWeek(), this.isoWeekday(), 1, 4); -} + // try to parse to float - https://github.com/foretagsplatsen/numbro/pull/183 -function getISOWeeksInYear () { - return weeksInYear(this.year(), 1, 4); -} -function getWeeksInYear () { - var weekInfo = this.localeData()._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); -} + if (_numbro2.default.validate(changes[i][3]) && !isNaN(changes[i][3])) { + changes[i][3] = parseFloat(changes[i][3]); + } else { + changes[i][3] = (0, _numbro2.default)().unformat(changes[i][3]) || changes[i][3]; + } + } + } -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; + /* eslint-disable no-loop-func */ + if (instance.getCellValidator(cellProperties)) { + waitingForValidator.addValidatorToQueue(); + instance.validateCell(changes[i][3], cellProperties, function (i, cellProperties) { + return function (result) { + if (typeof result !== 'boolean') { + throw new Error('Validation error: result is not boolean'); + } + if (result === false && cellProperties.allowInvalid === false) { + changes.splice(i, 1); // cancel the change + cellProperties.valid = true; // we cancelled the change, so cell value is still valid + var cell = instance.getCell(cellProperties.row, cellProperties.col); + (0, _element.removeClass)(cell, instance.getSettings().invalidCellClassName); + --i; + } + waitingForValidator.removeValidatorFormQueue(); + }; + }(i, cellProperties), source); } - 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; -} + waitingForValidator.checkIfQueueIsEmpty(); -// FORMATTING + function resolve() { + var beforeChangeResult; -addFormatToken('Q', 0, 'Qo', 'quarter'); + if (changes.length) { + beforeChangeResult = instance.runHooks('beforeChange', changes, source); + if ((0, _function.isFunction)(beforeChangeResult)) { + console.warn('Your beforeChange callback returns a function. It\'s not supported since Handsontable 0.12.1 (and the returned function will not be executed).'); + } else if (beforeChangeResult === false) { + changes.splice(0, changes.length); // invalidate all changes (remove everything from array) + } + } + callback(); // called when async validators are resolved and beforeChange was not async + } + } -// ALIASES + /** + * Internal function to apply changes. Called after validateChanges + * + * @private + * @param {Array} changes Array in form of [row, prop, oldValue, newValue] + * @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback) + * @fires Hooks#beforeChangeRender + * @fires Hooks#afterChange + */ + function applyChanges(changes, source) { + var i = changes.length - 1; -addUnitAlias('quarter', 'Q'); + if (i < 0) { + return; + } -// PRIORITY + for (; i >= 0; i--) { + var skipThisChange = false; -addUnitPriority('quarter', 7); + if (changes[i] === null) { + changes.splice(i, 1); + /* eslint-disable no-continue */ + continue; + } -// PARSING + if (changes[i][2] == null && changes[i][3] == null) { + /* eslint-disable no-continue */ + continue; + } -addRegexToken('Q', match1); -addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; -}); + if (priv.settings.allowInsertRow) { + while (changes[i][0] > instance.countRows() - 1) { + var numberOfCreatedRows = datamap.createRow(void 0, void 0, source); -// MOMENTS + if (numberOfCreatedRows === 0) { + skipThisChange = true; + break; + } + } + } -function getSetQuarter (input) { - return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); -} + if (skipThisChange) { + /* eslint-disable no-continue */ + continue; + } -// FORMATTING + if (instance.dataType === 'array' && (!priv.settings.columns || priv.settings.columns.length === 0) && priv.settings.allowInsertColumn) { + while (datamap.propToCol(changes[i][1]) > instance.countCols() - 1) { + datamap.createCol(void 0, void 0, source); + } + } -addFormatToken('D', ['DD', 2], 'Do', 'date'); + datamap.set(changes[i][0], changes[i][1], changes[i][3]); + } -// ALIASES + instance.forceFullRender = true; // used when data was changed + grid.adjustRowsAndCols(); + instance.runHooks('beforeChangeRender', changes, source); + selection.refreshBorders(null, true); + instance.view.wt.wtOverlays.adjustElementsSize(); + instance.runHooks('afterChange', changes, source || 'edit'); -addUnitAlias('date', 'D'); + var activeEditor = instance.getActiveEditor(); -// PRIOROITY -addUnitPriority('date', 9); + if (activeEditor && (0, _mixed.isDefined)(activeEditor.refreshValue)) { + activeEditor.refreshValue(); + } + } -// PARSING + this.validateCell = function (value, cellProperties, callback, source) { + var validator = instance.getCellValidator(cellProperties); -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; -}); + function done(valid) { + var col = cellProperties.visualCol, + row = cellProperties.visualRow, + td = instance.getCell(row, col, true); -addParseToken(['D', 'DD'], DATE); -addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0], 10); -}); + if (td && td.nodeName != 'TH') { + instance.view.wt.wtSettings.settings.cellRenderer(row, col, td); + } + callback(valid); + } -// MOMENTS + if ((0, _mixed.isRegExp)(validator)) { + validator = function (validator) { + return function (value, callback) { + callback(validator.test(value)); + }; + }(validator); + } -var getSetDayOfMonth = makeGetSet('Date', true); + if ((0, _function.isFunction)(validator)) { -// FORMATTING + value = instance.runHooks('beforeValidate', value, cellProperties.visualRow, cellProperties.prop, source); -addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); + // To provide consistent behaviour, validation should be always asynchronous + instance._registerTimeout(setTimeout(function () { + validator.call(cellProperties, value, function (valid) { + valid = instance.runHooks('afterValidate', valid, value, cellProperties.visualRow, cellProperties.prop, source); + cellProperties.valid = valid; -// ALIASES + done(valid); + instance.runHooks('postAfterValidate', valid, value, cellProperties.visualRow, cellProperties.prop, source); + }); + }, 0)); + } else { + // resolve callback even if validator function was not found + instance._registerTimeout(setTimeout(function () { + cellProperties.valid = true; + done(cellProperties.valid); + }, 0)); + } + }; -addUnitAlias('dayOfYear', 'DDD'); + function setDataInputToArray(row, propOrCol, value) { + if ((typeof row === 'undefined' ? 'undefined' : _typeof(row)) === 'object') { + // is it an array of changes + return row; + } + return [[row, propOrCol, value]]; + } -// PRIORITY -addUnitPriority('dayOfYear', 4); + /** + * @description + * Set new value to a cell. To change many cells at once, pass an array of `changes` in format `[[row, col, value], ...]` as + * the only parameter. `col` is the index of a __visible__ column (note that if columns were reordered, + * the current visible order will be used). `source` is a flag for before/afterChange events. If you pass only array of + * changes then `source` could be set as second parameter. + * + * @memberof Core# + * @function setDataAtCell + * @param {Number|Array} row Visual row index or array of changes in format `[[row, col, value], ...]`. + * @param {Number} col Visual column index. + * @param {String} value New value. + * @param {String} [source] String that identifies how this change will be described in the changes array (useful in onAfterChange or onBeforeChange callback). + */ + this.setDataAtCell = function (row, col, value, source) { + var input = setDataInputToArray(row, col, value), + i, + ilen, + changes = [], + prop; -// PARSING + for (i = 0, ilen = input.length; i < ilen; i++) { + if (_typeof(input[i]) !== 'object') { + throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter'); + } + if (typeof input[i][1] !== 'number') { + throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`'); + } + prop = datamap.colToProp(input[i][1]); + changes.push([input[i][0], prop, dataSource.getAtCell(recordTranslator.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]); + } -addRegexToken('DDD', match1to3); -addRegexToken('DDDD', match3); -addParseToken(['DDD', 'DDDD'], function (input, array, config) { - config._dayOfYear = toInt(input); -}); + if (!source && (typeof row === 'undefined' ? 'undefined' : _typeof(row)) === 'object') { + source = col; + } -// HELPERS + instance.runHooks('afterSetDataAtCell', changes, source); -// MOMENTS + validateChanges(changes, source, function () { + applyChanges(changes, source); + }); + }; -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'); -} + /** + * @description + * Set new value to a cell. To change many cells at once, pass an array of `changes` in format `[[row, prop, value], ...]` as + * the only parameter. `prop` is the name of the object property (e.g. `first.name`). `source` is a flag for before/afterChange events. + * If you pass only array of changes then `source` could be set as second parameter. + * + * @memberof Core# + * @function setDataAtRowProp + * @param {Number|Array} row Visual row index or array of changes in format `[[row, prop, value], ...]`. + * @param {String} prop Property name or the source string. + * @param {String} value Value to be set. + * @param {String} [source] String that identifies how this change will be described in changes array (useful in onChange callback). + */ + this.setDataAtRowProp = function (row, prop, value, source) { + var input = setDataInputToArray(row, prop, value), + i, + ilen, + changes = []; -// FORMATTING + for (i = 0, ilen = input.length; i < ilen; i++) { + changes.push([input[i][0], input[i][1], dataSource.getAtCell(recordTranslator.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]); + } -addFormatToken('m', ['mm', 2], 0, 'minute'); + if (!source && (typeof row === 'undefined' ? 'undefined' : _typeof(row)) === 'object') { + source = prop; + } -// ALIASES + instance.runHooks('afterSetDataAtRowProp', changes, source); -addUnitAlias('minute', 'm'); + validateChanges(changes, source, function () { + applyChanges(changes, source); + }); + }; -// PRIORITY + /** + * Listen to the keyboard input on document body. + * + * @memberof Core# + * @function listen + * @since 0.11 + */ + this.listen = function () { + var invalidActiveElement = !document.activeElement || document.activeElement && document.activeElement.nodeName === void 0; -addUnitPriority('minute', 14); + if (document.activeElement && document.activeElement !== document.body && !invalidActiveElement) { + document.activeElement.blur(); + } else if (invalidActiveElement) { + // IE + document.body.focus(); + } -// PARSING + activeGuid = instance.guid; + }; -addRegexToken('m', match1to2); -addRegexToken('mm', match1to2, match2); -addParseToken(['m', 'mm'], MINUTE); + /** + * Stop listening to keyboard input on the document body. + * + * @memberof Core# + * @function unlisten + * @since 0.11 + */ + this.unlisten = function () { + if (this.isListening()) { + activeGuid = null; + } + }; -// MOMENTS + /** + * Returns `true` if the current Handsontable instance is listening to keyboard input on document body. + * + * @memberof Core# + * @function isListening + * @since 0.11 + * @returns {Boolean} `true` if the instance is listening, `false` otherwise. + */ + this.isListening = function () { + return activeGuid === instance.guid; + }; -var getSetMinute = makeGetSet('Minutes', false); + /** + * Destroys the current editor, renders and selects the current cell. + * + * @memberof Core# + * @function destroyEditor + * @param {Boolean} [revertOriginal] If != `true`, edited data is saved. Otherwise the previous value is restored. + */ + this.destroyEditor = function (revertOriginal) { + selection.refreshBorders(revertOriginal); + }; -// FORMATTING + /** + * Populate cells at position with 2D input array (e.g. `[[1, 2], [3, 4]]`). + * Use `endRow`, `endCol` when you want to cut input when a certain row is reached. + * Optional `source` parameter (default value "populateFromArray") is used to identify this call in the resulting events (beforeChange, afterChange). + * Optional `populateMethod` parameter (default value "overwrite", possible values "shift_down" and "shift_right") + * has the same effect as pasteMode option {@link Options#pasteMode} + * + * @memberof Core# + * @function populateFromArray + * @since 0.9.0 + * @param {Number} row Start visual row index. + * @param {Number} col Start visual column index. + * @param {Array} input 2d array + * @param {Number} [endRow] End visual row index (use when you want to cut input when certain row is reached). + * @param {Number} [endCol] End visual column index (use when you want to cut input when certain column is reached). + * @param {String} [source="populateFromArray"] Source string. + * @param {String} [method="overwrite"] Populate method. Possible options: `shift_down`, `shift_right`, `overwrite`. + * @param {String} direction Populate direction. (left|right|up|down) + * @param {Array} deltas Deltas array. + * @returns {Object|undefined} The ending TD element in pasted area (only if any cells were changed). + */ + this.populateFromArray = function (row, col, input, endRow, endCol, source, method, direction, deltas) { + var c; -addFormatToken('s', ['ss', 2], 0, 'second'); + if (!((typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object' && _typeof(input[0]) === 'object')) { + throw new Error('populateFromArray parameter `input` must be an array of arrays'); // API changed in 0.9-beta2, let's check if you use it correctly + } + c = typeof endRow === 'number' ? new _src.CellCoords(endRow, endCol) : null; -// ALIASES + return grid.populateFromArray(new _src.CellCoords(row, col), input, c, source, method, direction, deltas); + }; -addUnitAlias('second', 's'); + /** + * Adds/removes data from the column. This function is modelled after Array.splice. + * Parameter `col` is the index of the column in which do you want to do splice. + * Parameter `index` is the row index at which to start changing the array. + * If negative, will begin that many elements from the end. Parameter `amount`, is the number of the old array elements to remove. + * If the amount is 0, no elements are removed. Fourth and further parameters are the `elements` to add to the array. + * If you don't specify any elements, spliceCol simply removes elements from the array. + * {@link DataMap#spliceCol} + * + * @memberof Core# + * @function spliceCol + * @since 0.9-beta2 + * @param {Number} col Index of the column in which do you want to do splice. + * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end. + * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed. + * @param {*} [elements] The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array. + */ + this.spliceCol = function (col, index, amount /* , elements... */) { + var _datamap; -// PRIORITY + return (_datamap = datamap).spliceCol.apply(_datamap, arguments); + }; -addUnitPriority('second', 15); + /** + * Adds/removes data from the row. This function works is modelled after Array.splice. + * Parameter `row` is the index of row in which do you want to do splice. + * Parameter `index` is the column index at which to start changing the array. + * If negative, will begin that many elements from the end. Parameter `amount`, is the number of old array elements to remove. + * If the amount is 0, no elements are removed. Fourth and further parameters are the `elements` to add to the array. + * If you don't specify any elements, spliceCol simply removes elements from the array. + * {@link DataMap#spliceRow} + * + * @memberof Core# + * @function spliceRow + * @since 0.11 + * @param {Number} row Index of column in which do you want to do splice. + * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end. + * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed. + * @param {*} [elements] The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array. + */ + this.spliceRow = function (row, index, amount /* , elements... */) { + var _datamap2; -// PARSING + return (_datamap2 = datamap).spliceRow.apply(_datamap2, arguments); + }; -addRegexToken('s', match1to2); -addRegexToken('ss', match1to2, match2); -addParseToken(['s', 'ss'], SECOND); + /** + * Returns indexes of the currently selected cells as an array `[startRow, startCol, endRow, endCol]`. + * + * Start row and start col are the coordinates of the active cell (where the selection was started). + * + * @memberof Core# + * @function getSelected + * @returns {Array} Array of the selection's indexes. + */ + this.getSelected = function () { + // https://github.com/handsontable/handsontable/issues/44 //cjl + if (selection.isSelected()) { + return [priv.selRange.from.row, priv.selRange.from.col, priv.selRange.to.row, priv.selRange.to.col]; + } + }; -// MOMENTS + /** + * Returns the current selection as a CellRange object. + * + * @memberof Core# + * @function getSelectedRange + * @since 0.11 + * @returns {CellRange} Selected range object or undefined` if there is no selection. + */ + this.getSelectedRange = function () { + // https://github.com/handsontable/handsontable/issues/44 //cjl + if (selection.isSelected()) { + return priv.selRange; + } + }; -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' : ''; -} + /** + * Rerender the table. + * + * @memberof Core# + * @function render + */ + this.render = function () { + if (instance.view) { + instance.renderCall = true; + instance.forceFullRender = true; // used when data was changed + selection.refreshBorders(null, true); + } + }; -function getZoneName () { - return this._isUTC ? 'Coordinated Universal Time' : ''; -} + /** + * Reset all cells in the grid to contain data from the data array. + * + * @memberof Core# + * @function loadData + * @param {Array} data Array of arrays or array of objects containing data. + * @fires Hooks#afterLoadData + * @fires Hooks#afterChange + */ + this.loadData = function (data) { + if (Array.isArray(priv.settings.dataSchema)) { + instance.dataType = 'array'; + } else if ((0, _function.isFunction)(priv.settings.dataSchema)) { + instance.dataType = 'function'; + } else { + instance.dataType = 'object'; + } -var proto = Moment.prototype; - -proto.add = add; -proto.calendar = calendar$1; -proto.clone = clone; -proto.diff = diff; -proto.endOf = endOf; -proto.format = format; -proto.from = from; -proto.fromNow = fromNow; -proto.to = to; -proto.toNow = toNow; -proto.get = stringGet; -proto.invalidAt = invalidAt; -proto.isAfter = isAfter; -proto.isBefore = isBefore; -proto.isBetween = isBetween; -proto.isSame = isSame; -proto.isSameOrAfter = isSameOrAfter; -proto.isSameOrBefore = isSameOrBefore; -proto.isValid = isValid$2; -proto.lang = lang; -proto.locale = locale; -proto.localeData = localeData; -proto.max = prototypeMax; -proto.min = prototypeMin; -proto.parsingFlags = parsingFlags; -proto.set = stringSet; -proto.startOf = startOf; -proto.subtract = subtract; -proto.toArray = toArray; -proto.toObject = toObject; -proto.toDate = toDate; -proto.toISOString = toISOString; -proto.inspect = inspect; -proto.toJSON = toJSON; -proto.toString = toString; -proto.unix = unix; -proto.valueOf = valueOf; -proto.creationData = creationData; - -// Year -proto.year = getSetYear; -proto.isLeapYear = getIsLeapYear; - -// Week Year -proto.weekYear = getSetWeekYear; -proto.isoWeekYear = getSetISOWeekYear; - -// Quarter -proto.quarter = proto.quarters = getSetQuarter; - -// Month -proto.month = getSetMonth; -proto.daysInMonth = getDaysInMonth; - -// Week -proto.week = proto.weeks = getSetWeek; -proto.isoWeek = proto.isoWeeks = getSetISOWeek; -proto.weeksInYear = getWeeksInYear; -proto.isoWeeksInYear = getISOWeeksInYear; - -// Day -proto.date = getSetDayOfMonth; -proto.day = proto.days = getSetDayOfWeek; -proto.weekday = getSetLocaleDayOfWeek; -proto.isoWeekday = getSetISODayOfWeek; -proto.dayOfYear = getSetDayOfYear; - -// Hour -proto.hour = proto.hours = getSetHour; - -// Minute -proto.minute = proto.minutes = getSetMinute; - -// Second -proto.second = proto.seconds = getSetSecond; - -// Millisecond -proto.millisecond = proto.milliseconds = getSetMillisecond; - -// Offset -proto.utcOffset = getSetOffset; -proto.utc = setOffsetToUTC; -proto.local = setOffsetToLocal; -proto.parseZone = setOffsetToParsedOffset; -proto.hasAlignedHourOffset = hasAlignedHourOffset; -proto.isDST = isDaylightSavingTime; -proto.isLocal = isLocal; -proto.isUtcOffset = isUtcOffset; -proto.isUtc = isUtc; -proto.isUTC = isUtc; - -// Timezone -proto.zoneAbbr = getZoneAbbr; -proto.zoneName = getZoneName; - -// Deprecations -proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); -proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); -proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); -proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); -proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); - -function createUnix (input) { - return createLocal(input * 1000); -} + if (datamap) { + datamap.destroy(); + } + datamap = new _dataMap2.default(instance, priv, GridSettings); -function createInZone () { - return createLocal.apply(null, arguments).parseZone(); -} + if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && data !== null) { + if (!(data.push && data.splice)) { + // check if data is array. Must use duck-type check so Backbone Collections also pass it + // when data is not an array, attempt to make a single-row array of it + data = [data]; + } + } else if (data === null) { + data = []; + var row; + var r = 0; + var rlen = 0; + var dataSchema = datamap.getSchema(); -function preParsePostFormat (string) { - return string; -} + for (r = 0, rlen = priv.settings.startRows; r < rlen; r++) { + if ((instance.dataType === 'object' || instance.dataType === 'function') && priv.settings.dataSchema) { + row = (0, _object.deepClone)(dataSchema); + data.push(row); + } else if (instance.dataType === 'array') { + row = (0, _object.deepClone)(dataSchema[0]); + data.push(row); + } else { + row = []; -var proto$1 = Locale.prototype; - -proto$1.calendar = calendar; -proto$1.longDateFormat = longDateFormat; -proto$1.invalidDate = invalidDate; -proto$1.ordinal = ordinal; -proto$1.preparse = preParsePostFormat; -proto$1.postformat = preParsePostFormat; -proto$1.relativeTime = relativeTime; -proto$1.pastFuture = pastFuture; -proto$1.set = set; - -// Month -proto$1.months = localeMonths; -proto$1.monthsShort = localeMonthsShort; -proto$1.monthsParse = localeMonthsParse; -proto$1.monthsRegex = monthsRegex; -proto$1.monthsShortRegex = monthsShortRegex; - -// Week -proto$1.week = localeWeek; -proto$1.firstDayOfYear = localeFirstDayOfYear; -proto$1.firstDayOfWeek = localeFirstDayOfWeek; - -// Day of Week -proto$1.weekdays = localeWeekdays; -proto$1.weekdaysMin = localeWeekdaysMin; -proto$1.weekdaysShort = localeWeekdaysShort; -proto$1.weekdaysParse = localeWeekdaysParse; - -proto$1.weekdaysRegex = weekdaysRegex; -proto$1.weekdaysShortRegex = weekdaysShortRegex; -proto$1.weekdaysMinRegex = weekdaysMinRegex; - -// Hours -proto$1.isPM = localeIsPM; -proto$1.meridiem = localeMeridiem; - -function get$1 (format, index, field, setter) { - var locale = getLocale(); - var utc = createUTC().set(setter, index); - return locale[field](utc, format); -} + for (var c = 0, clen = priv.settings.startCols; c < clen; c++) { + row.push(null); + } -function listMonthsImpl (format, index, field) { - if (isNumber(format)) { - index = format; - format = undefined; + data.push(row); + } + } + } else { + throw new Error('loadData only accepts array of objects or array of arrays (' + (typeof data === 'undefined' ? 'undefined' : _typeof(data)) + ' given)'); } - format = format || ''; + priv.isPopulated = false; + GridSettings.prototype.data = data; - if (index != null) { - return get$1(format, index, field, 'month'); + if (Array.isArray(data[0])) { + instance.dataType = 'array'; } - var i; - var out = []; - for (i = 0; i < 12; i++) { - out[i] = get$1(format, i, field, 'month'); - } - return out; -} + datamap.dataSource = data; + dataSource.data = data; + dataSource.dataType = instance.dataType; + dataSource.colToProp = datamap.colToProp.bind(datamap); + dataSource.propToCol = datamap.propToCol.bind(datamap); -// () -// (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; + clearCellSettingCache(); - if (isNumber(format)) { - index = format; - format = undefined; - } + grid.adjustRowsAndCols(); + instance.runHooks('afterLoadData', priv.firstRun); - format = format || ''; + if (priv.firstRun) { + priv.firstRun = [null, 'loadData']; + } else { + instance.runHooks('afterChange', null, 'loadData'); + instance.render(); } + priv.isPopulated = true; - var locale = getLocale(), - shift = localeSorted ? locale._week.dow : 0; - - if (index != null) { - return get$1(format, (index + shift) % 7, field, 'day'); + function clearCellSettingCache() { + priv.cellSettings.length = 0; } + }; - var i; - var out = []; - for (i = 0; i < 7; i++) { - out[i] = get$1(format, (i + shift) % 7, field, 'day'); + /** + * Returns the current data object (the same one that was passed by `data` configuration option or `loadData` method, + * unless the `modifyRow` hook was used to trim some of the rows. If that's the case - use the {@link Core#getSourceData} method.). + * Optionally you can provide cell range by defining `row`, `col`, `row2`, `col2` to get only a fragment of grid data. + * + * Note: getData functionality changed with the release of version 0.20. If you're looking for the previous functionality, + * you should use the {@link Core#getSourceData} method. + * + * @memberof Core# + * @function getData + * @param {Number} [r] From visual row index. + * @param {Number} [c] From visual column index. + * @param {Number} [r2] To visual row index. + * @param {Number} [c2] To visual column index. + * @returns {Array} Array with the data. + */ + this.getData = function (r, c, r2, c2) { + if ((0, _mixed.isUndefined)(r)) { + return datamap.getAll(); } - return out; -} - -function listMonths (format, index) { - return listMonthsImpl(format, index, 'months'); -} + return datamap.getRange(new _src.CellCoords(r, c), new _src.CellCoords(r2, c2), datamap.DESTINATION_RENDERER); + }; -function listMonthsShort (format, index) { - return listMonthsImpl(format, index, 'monthsShort'); -} + /** + * Returns a string value of the selected range. Each column is separated by tab, each row is separated by a new line character. + * {@link DataMap#getCopyableText} + * + * @memberof Core# + * @function getCopyableText + * @since 0.11 + * @param {Number} startRow From visual row index. + * @param {Number} startCol From visual column index. + * @param {Number} endRow To visual row index. + * @param {Number} endCol To visual column index. + * @returns {String} + */ + this.getCopyableText = function (startRow, startCol, endRow, endCol) { + return datamap.getCopyableText(new _src.CellCoords(startRow, startCol), new _src.CellCoords(endRow, endCol)); + }; -function listWeekdays (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); -} + /** + * Returns the data's copyable value at specified row and column index ({@link DataMap#getCopyable}). + * + * @memberof Core# + * @function getCopyableData + * @since 0.19.0 + * @param {Number} row Visual row index. + * @param {Number} column Visual column index. + * @returns {String} + */ + this.getCopyableData = function (row, column) { + return datamap.getCopyable(row, datamap.colToProp(column)); + }; -function listWeekdaysShort (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); -} + /** + * Returns schema provided by constructor settings. If it doesn't exist then it returns the schema based on the data + * structure in the first row. + * + * @memberof Core# + * @function getSchema + * @since 0.13.2 + * @returns {Object} Schema object. + */ + this.getSchema = function () { + return datamap.getSchema(); + }; -function listWeekdaysMin (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); -} + /** + * Use it if you need to change configuration after initialization. The `settings` parameter is an object containing the new + * settings, declared the same way as in the initial settings object. + * Note, that although the `updateSettings` method doesn't overwrite the previously declared settings, it might reset + * the settings made post-initialization. (for example - ignore changes made using the columnResize feature). + * + * @memberof Core# + * @function updateSettings + * @param {Object} settings New settings object. + * @param {Boolean} init Calls this method in the initialization mode. Internal use only. + * Used by API could be cause of the unexpected behaviour of the Handsontable. + * @example + * ```js + * hot.updateSettings({ + * contextMenu: true, + * colHeaders: true, + * fixedRowsTop: 2 + * }); + * ``` + * @fires Hooks#afterCellMetaReset + * @fires Hooks#afterUpdateSettings + */ + this.updateSettings = function (settings, init) { + var columnsAsFunc = false; + var i = void 0; + var j = void 0; + var clen = void 0; -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; + if ((0, _mixed.isDefined)(settings.rows)) { + throw new Error('"rows" setting is no longer supported. do you mean startRows, minRows or maxRows?'); } -}); - -// 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); + if ((0, _mixed.isDefined)(settings.cols)) { + throw new Error('"cols" setting is no longer supported. do you mean startCols, minCols or maxCols?'); } -} -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; + for (i in settings) { + if (i === 'data') { + /* eslint-disable no-continue */ + continue; // loadData will be triggered later + } else if (_pluginHooks2.default.getSingleton().getRegistered().indexOf(i) > -1) { + if ((0, _function.isFunction)(settings[i]) || Array.isArray(settings[i])) { + settings[i].initialHook = true; + instance.addHook(i, settings[i]); + } + } else if (!init && (0, _object.hasOwnProperty)(settings, i)) { + // Update settings + GridSettings.prototype[i] = settings[i]; + } } - // 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; + // Load data or create data map + if (settings.data === void 0 && priv.settings.data === void 0) { + instance.loadData(null); // data source created just now + } else if (settings.data !== void 0) { + instance.loadData(settings.data); // data source given as option + } else if (settings.columns !== void 0) { + datamap.createMap(); + } - minutes = absFloor(seconds / 60); - data.minutes = minutes % 60; + clen = instance.countCols(); - hours = absFloor(minutes / 60); - data.hours = hours % 24; + var columnSetting = settings.columns || GridSettings.prototype.columns; - days += absFloor(hours / 24); + // Init columns constructors configuration + if (columnSetting && (0, _function.isFunction)(columnSetting)) { + clen = instance.countSourceCols(); + columnsAsFunc = true; + } - // convert days to months - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); + // Clear cellSettings cache + if (settings.cell !== void 0 || settings.cells !== void 0 || settings.columns !== void 0) { + priv.cellSettings.length = 0; + } - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; + if (clen > 0) { + var proto = void 0; + var column = void 0; - data.days = days; - data.months = months; - data.years = years; + for (i = 0, j = 0; i < clen; i++) { + if (columnsAsFunc && !columnSetting(i)) { + /* eslint-disable no-continue */ + continue; + } + priv.columnSettings[j] = (0, _setting.columnFactory)(GridSettings, priv.columnsSettingConflicts); - return this; -} + // shortcut for prototype + proto = priv.columnSettings[j].prototype; -function daysToMonths (days) { - // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return days * 4800 / 146097; -} + // Use settings provided by user + if (columnSetting) { + if (columnsAsFunc) { + column = columnSetting(i); + } else { + column = columnSetting[j]; + } -function monthsToDays (months) { - // the reverse of daysToMonths - return months * 146097 / 4800; -} + if (column) { + (0, _object.extend)(proto, column); + (0, _object.extend)(proto, expandType(column)); + } + } -function as (units) { - if (!this.isValid()) { - return NaN; + j++; + } } - var days; - var months; - var milliseconds = this._milliseconds; - units = normalizeUnits(units); + if ((0, _mixed.isDefined)(settings.cell)) { + for (var key in settings.cell) { + if ((0, _object.hasOwnProperty)(settings.cell, key)) { + var cell = settings.cell[key]; - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; - } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - switch (units) { - case 'week' : return days / 7 + milliseconds / 6048e5; - case 'day' : return days + milliseconds / 864e5; - case 'hour' : return days * 24 + milliseconds / 36e5; - case 'minute' : return days * 1440 + milliseconds / 6e4; - case 'second' : return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - case 'millisecond': return Math.floor(days * 864e5) + milliseconds; - default: throw new Error('Unknown unit ' + units); + instance.setCellMetaObject(cell.row, cell.col, cell); } + } } -} - -// TODO: Use this.as('ms')? -function valueOf$1 () { - if (!this.isValid()) { - return NaN; - } - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); -} -function makeAs (alias) { - return function () { - return this.as(alias); - }; -} - -var asMilliseconds = makeAs('ms'); -var asSeconds = makeAs('s'); -var asMinutes = makeAs('m'); -var asHours = makeAs('h'); -var asDays = makeAs('d'); -var asWeeks = makeAs('w'); -var asMonths = makeAs('M'); -var asYears = makeAs('y'); - -function 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); -} + instance.runHooks('afterCellMetaReset'); -// 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; + if ((0, _mixed.isDefined)(settings.className)) { + if (GridSettings.prototype.className) { + (0, _element.removeClass)(instance.rootElement, GridSettings.prototype.className); + } + if (settings.className) { + (0, _element.addClass)(instance.rootElement, settings.className); + } } - 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; + var currentHeight = instance.rootElement.style.height; + if (currentHeight !== '') { + currentHeight = parseInt(instance.rootElement.style.height, 10); } - return true; -} -function humanize (withSuffix) { - if (!this.isValid()) { - return this.localeData().invalidDate(); + var height = settings.height; + if ((0, _function.isFunction)(height)) { + height = height(); } - var locale = this.localeData(); - var output = relativeTime$1(this, !withSuffix, locale); + if (init) { + var initialStyle = instance.rootElement.getAttribute('style'); - if (withSuffix) { - output = locale.pastFuture(+this, output); + if (initialStyle) { + instance.rootElement.setAttribute('data-initialstyle', instance.rootElement.getAttribute('style')); + } } - return locale.postformat(output); -} - -var abs$1 = Math.abs; - -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; - 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'; - } - - return (total < 0 ? '-' : '') + - 'P' + - (Y ? Y + 'Y' : '') + - (M ? M + 'M' : '') + - (D ? D + 'D' : '') + - ((h || m || s) ? 'T' : '') + - (h ? h + 'H' : '') + - (m ? m + 'M' : '') + - (s ? s + 'S' : ''); -} - -var proto$2 = Duration.prototype; - -proto$2.isValid = isValid$1; -proto$2.abs = abs; -proto$2.add = add$1; -proto$2.subtract = subtract$1; -proto$2.as = as; -proto$2.asMilliseconds = asMilliseconds; -proto$2.asSeconds = asSeconds; -proto$2.asMinutes = asMinutes; -proto$2.asHours = asHours; -proto$2.asDays = asDays; -proto$2.asWeeks = asWeeks; -proto$2.asMonths = asMonths; -proto$2.asYears = asYears; -proto$2.valueOf = valueOf$1; -proto$2._bubble = bubble; -proto$2.get = get$2; -proto$2.milliseconds = milliseconds; -proto$2.seconds = seconds; -proto$2.minutes = minutes; -proto$2.hours = hours; -proto$2.days = days; -proto$2.weeks = weeks; -proto$2.months = months; -proto$2.years = years; -proto$2.humanize = humanize; -proto$2.toISOString = toISOString$1; -proto$2.toString = toISOString$1; -proto$2.toJSON = toISOString$1; -proto$2.locale = locale; -proto$2.localeData = localeData; - -// Deprecations -proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); -proto$2.lang = lang; - -// Side effect imports - -// FORMATTING - -addFormatToken('X', 0, 0, 'unix'); -addFormatToken('x', 0, 0, 'valueOf'); - -// PARSING - -addRegexToken('x', matchSigned); -addRegexToken('X', matchTimestamp); -addParseToken('X', function (input, array, config) { - config._d = new Date(parseFloat(input, 10) * 1000); -}); -addParseToken('x', function (input, array, config) { - config._d = new Date(toInt(input)); -}); - -// Side effect imports - - -hooks.version = '2.18.1'; - -setHookCallback(createLocal); - -hooks.fn = proto; -hooks.min = min; -hooks.max = max; -hooks.now = now; -hooks.utc = createUTC; -hooks.unix = createUnix; -hooks.months = listMonths; -hooks.isDate = isDate; -hooks.locale = getSetGlobalLocale; -hooks.invalid = createInvalid; -hooks.duration = createDuration; -hooks.isMoment = isMoment; -hooks.weekdays = listWeekdays; -hooks.parseZone = createInZone; -hooks.localeData = getLocale; -hooks.isDuration = isDuration; -hooks.monthsShort = listMonthsShort; -hooks.weekdaysMin = listWeekdaysMin; -hooks.defineLocale = defineLocale; -hooks.updateLocale = updateLocale; -hooks.locales = listLocales; -hooks.weekdaysShort = listWeekdaysShort; -hooks.normalizeUnits = normalizeUnits; -hooks.relativeTimeRounding = getSetRelativeTimeRounding; -hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; -hooks.calendarFormat = getCalendarFormat; -hooks.prototype = proto; + if (height === null) { + var _initialStyle = instance.rootElement.getAttribute('data-initialstyle'); -return hooks; + if (_initialStyle && (_initialStyle.indexOf('height') > -1 || _initialStyle.indexOf('overflow') > -1)) { + instance.rootElement.setAttribute('style', _initialStyle); + } else { + instance.rootElement.style.height = ''; + instance.rootElement.style.overflow = ''; + } + } else if (height !== void 0) { + instance.rootElement.style.height = height + 'px'; + instance.rootElement.style.overflow = 'hidden'; + } -}))); + if (typeof settings.width !== 'undefined') { + var width = settings.width; + if ((0, _function.isFunction)(width)) { + width = width(); + } -/*** EXPORTS FROM exports-to-window-loader ***/ -window['moment'] = __webpack_require__(36); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(420)(module))) + instance.rootElement.style.width = width + 'px'; + } -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { + if (!init) { + datamap.clearLengthCache(); // force clear cache length on updateSettings() #3416 -"use strict"; + if (instance.view) { + instance.view.wt.wtViewport.resetHasOversizedColumnHeadersMarked(); + } + instance.runHooks('afterUpdateSettings', settings); + } -exports.__esModule = true; -exports.EditorState = undefined; + grid.adjustRowsAndCols(); + if (instance.view && !priv.firstRun) { + instance.forceFullRender = true; // used when data was changed + selection.refreshBorders(null, true); + } -var _src = __webpack_require__(11); + if (!init && instance.view && (currentHeight === '' || height === '' || height === void 0) && currentHeight !== height) { + instance.view.wt.wtOverlays.updateMainScrollableElements(); + } + }; -var _mixed = __webpack_require__(20); + /** + * Get value from the selected cell. + * + * @memberof Core# + * @function getValue + * @since 0.11 + * @returns {*} Value of selected cell. + */ + this.getValue = function () { + var sel = instance.getSelected(); + if (GridSettings.prototype.getValue) { + if ((0, _function.isFunction)(GridSettings.prototype.getValue)) { + return GridSettings.prototype.getValue.call(instance); + } else if (sel) { + return instance.getData()[sel[0]][GridSettings.prototype.getValue]; + } + } else if (sel) { + return instance.getDataAtCell(sel[0], sel[1]); + } + }; -var EditorState = exports.EditorState = { - VIRGIN: 'STATE_VIRGIN', // before editing - EDITING: 'STATE_EDITING', - WAITING: 'STATE_WAITING', // waiting for async validation - FINISHED: 'STATE_FINISHED' -}; + function expandType(obj) { + if (!(0, _object.hasOwnProperty)(obj, 'type')) { + // ignore obj.prototype.type + return; + } -function BaseEditor(instance) { - this.instance = instance; - this.state = EditorState.VIRGIN; + var type, + expandedType = {}; - this._opened = false; - this._fullEditMode = false; - this._closeCallback = null; + if (_typeof(obj.type) === 'object') { + type = obj.type; + } else if (typeof obj.type === 'string') { + type = (0, _cellTypes.getCellType)(obj.type); + } - this.init(); -} + for (var i in type) { + if ((0, _object.hasOwnProperty)(type, i) && !(0, _object.hasOwnProperty)(obj, i)) { + expandedType[i] = type[i]; + } + } -BaseEditor.prototype._fireCallbacks = function (result) { - if (this._closeCallback) { - this._closeCallback(result); - this._closeCallback = null; + return expandedType; } -}; - -BaseEditor.prototype.init = function () {}; - -BaseEditor.prototype.getValue = function () { - throw Error('Editor getValue() method unimplemented'); -}; -BaseEditor.prototype.setValue = function (newValue) { - throw Error('Editor setValue() method unimplemented'); -}; - -BaseEditor.prototype.open = function () { - throw Error('Editor open() method unimplemented'); -}; + /** + * Returns the object settings. + * + * @memberof Core# + * @function getSettings + * @returns {Object} Object containing the current grid settings. + */ + this.getSettings = function () { + return priv.settings; + }; -BaseEditor.prototype.close = function () { - throw Error('Editor close() method unimplemented'); -}; + /** + * Clears the data from the grid. (The table settings remain intact.) + * + * @memberof Core# + * @function clear + * @since 0.11 + */ + this.clear = function () { + selection.selectAll(); + selection.empty(); + }; -BaseEditor.prototype.prepare = function (row, col, prop, td, originalValue, cellProperties) { - this.TD = td; - this.row = row; - this.col = col; - this.prop = prop; - this.originalValue = originalValue; - this.cellProperties = cellProperties; - this.state = EditorState.VIRGIN; -}; + /** + * @memberof Core# + * @function alter + * @param {String} action See grid.alter for possible values: `"insert_row"`, `"insert_col"`, `"remove_row"`, `"remove_col"` + * @param {Number} index Visual index of the row/column before which the new row/column will be inserted/removed. + * @param {Number} [amount = 1] Amound of rows/columns to be inserted/removed. + * @param {String} [source] Source indicator. + * @param {Boolean} [keepEmptyRows] Flag for preventing deletion of empty rows. + * @description + * + * Allows altering the table structure by either inserting/removing rows or inserting/removing columns: + * + * Insert new row(s) above the row with a given `index`. If index is `null` or `undefined`, the new row will be + * added after the last row. + * ```js + * var hot = new Handsontable(document.getElementById('example')); + * hot.alter('insert_row', 10); + * ``` + * + * Insert new column(s) before the column with a given `index`. If index is `null` or `undefined`, the new column + * will be added after the last column. + * ```js + * var hot = new Handsontable(document.getElementById('example')); + * hot.alter('insert_col', 10); + * ``` + * + * Remove the row(s) at the given `index`. + * ```js + * var hot = new Handsontable(document.getElementById('example')); + * hot.alter('remove_row', 10); + * ``` + * + * Remove the column(s) at the given `index`. + * ```js + * var hot = new Handsontable(document.getElementById('example')); + * hot.alter('remove_col', 10); + * ``` + */ + this.alter = function (action, index, amount, source, keepEmptyRows) { + grid.alter(action, index, amount, source, keepEmptyRows); + }; -BaseEditor.prototype.extend = function () { - var baseClass = this.constructor; + /** + * Returns a TD element for the given `row` and `col` arguments, if it is rendered on screen. + * Returns `null` if the TD is not rendered on screen (probably because that part of the table is not visible). + * + * @memberof Core# + * @function getCell + * @param {Number} row Visual row index. + * @param {Number} col 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. + * @returns {Element} The cell's TD element. + */ + this.getCell = function (row, col, topmost) { + return instance.view.getCellAtCoords(new _src.CellCoords(row, col), topmost); + }; - function Editor() { - baseClass.apply(this, arguments); - } + /** + * Returns the coordinates of the cell, provided as a HTML Element. + * + * @memberof Core# + * @function getCoords + * @param {Element} elem The HTML Element representing the cell. + * @returns {CellCoords} Visual coordinates object. + */ + this.getCoords = function (elem) { + return this.view.wt.wtTable.getCoords.call(this.view.wt.wtTable, elem); + }; - function inherit(Child, Parent) { - function Bridge() {} - Bridge.prototype = Parent.prototype; - Child.prototype = new Bridge(); - Child.prototype.constructor = Child; + /** + * Returns the property name that corresponds with the given column index. {@link DataMap#colToProp} + * If the data source is an array of arrays, it returns the columns index. + * + * @memberof Core# + * @function colToProp + * @param {Number} col Visual column index. + * @returns {String|Number} Column property or physical column index. + */ + this.colToProp = function (col) { + return datamap.colToProp(col); + }; - return Child; - } + /** + * Returns column index that corresponds with the given property. {@link DataMap#propToCol} + * + * @memberof Core# + * @function propToCol + * @param {String|Number} prop Property name or physical column index. + * @returns {Number} Visual column index. + */ + this.propToCol = function (prop) { + return datamap.propToCol(prop); + }; - return inherit(Editor, baseClass); -}; + /** + * Translate physical row index into visual. + * + * @since 0.29.0 + * @memberof Core# + * @function toVisualRow + * @param {Number} row Physical row index. + * @returns {Number} Returns visual row index. + */ + this.toVisualRow = function (row) { + return recordTranslator.toVisualRow(row); + }; -BaseEditor.prototype.saveValue = function (value, ctrlDown) { - var selection = void 0; - var tmp = void 0; + /** + * Translate physical column index into visual. + * + * @since 0.29.0 + * @memberof Core# + * @function toVisualColumn + * @param {Number} column Physical column index. + * @returns {Number} Returns visual column index. + */ + this.toVisualColumn = function (column) { + return recordTranslator.toVisualColumn(column); + }; - // if ctrl+enter and multiple cells selected, behave like Excel (finish editing and apply to all cells) - if (ctrlDown) { - selection = this.instance.getSelected(); + /** + * Translate visual row index into physical. + * If displayed rows order is different than the order of rows stored in memory (i.e. sorting is applied) + * to retrieve valid physical row index you can use this method. + * + * @since 0.29.0 + * @memberof Core# + * @function toPhysicalRow + * @param {Number} row Visual row index. + * @returns {Number} Returns physical row index. + */ + this.toPhysicalRow = function (row) { + return recordTranslator.toPhysicalRow(row); + }; - if (selection[0] > selection[2]) { - tmp = selection[0]; - selection[0] = selection[2]; - selection[2] = tmp; - } - if (selection[1] > selection[3]) { - tmp = selection[1]; - selection[1] = selection[3]; - selection[3] = tmp; - } - } else { - selection = [this.row, this.col, null, null]; - } + /** + * Translate visual column index into physical. + * If displayed columns order is different than the order of columns stored in memory (i.e. manual column move is applied) + * to retrieve valid physical column index you can use this method. + * + * @since 0.29.0 + * @memberof Core# + * @function toPhysicalColumn + * @param {Number} column Visual column index. + * @returns {Number} Returns physical column index. + */ + this.toPhysicalColumn = function (column) { + return recordTranslator.toPhysicalColumn(column); + }; - this.instance.populateFromArray(selection[0], selection[1], value, selection[2], selection[3], 'edit'); -}; + /** + * @description + * Returns the cell value at `row`, `col`. `row` and `col` are the __visible__ indexes (note, that if columns were reordered or sorted, + * the currently visible order will be used). + * + * @memberof Core# + * @function getDataAtCell + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @returns {String|Boolean|null} Data at cell. + */ + this.getDataAtCell = function (row, col) { + return datamap.get(row, datamap.colToProp(col)); + }; -BaseEditor.prototype.beginEditing = function (initialValue, event) { - if (this.state != EditorState.VIRGIN) { - return; - } - this.instance.view.scrollViewport(new _src.CellCoords(this.row, this.col)); - this.instance.view.render(); - this.state = EditorState.EDITING; + /** + * Return value at `row`, `prop`. (Uses {@link DataMap#get}) + * + * @memberof Core# + * @function getDataAtRowProp + * @param {Number} row Visual row index. + * @param {String} prop Property name. + * @returns {*} Cell value. + */ + this.getDataAtRowProp = function (row, prop) { + return datamap.get(row, prop); + }; - initialValue = typeof initialValue == 'string' ? initialValue : this.originalValue; - this.setValue((0, _mixed.stringify)(initialValue)); + /** + * @description + * Returns array of column values from the data source. `col` is the __visible__ index of the column. + * Note, that if columns were reordered or sorted, the currently visible order will be used. + * + * @memberof Core# + * @function getDataAtCol + * @since 0.9-beta2 + * @param {Number} col Visual column index. + * @returns {Array} Array of cell values. + */ + this.getDataAtCol = function (col) { + var out = []; + return out.concat.apply(out, _toConsumableArray(datamap.getRange(new _src.CellCoords(0, col), new _src.CellCoords(priv.settings.data.length - 1, col), datamap.DESTINATION_RENDERER))); + }; - this.open(event); - this._opened = true; - this.focus(); + /** + * Given the object property name (e.g. `'first.name'`), returns an array of column's values from the data source. + * You can also provide a column index as the first argument. + * + * @memberof Core# + * @function getDataAtProp + * @since 0.9-beta2 + * @param {String|Number} prop Property name / physical column index. + * @returns {Array} Array of cell values. + */ + // TODO: Getting data from `datamap` should work on visual indexes. + this.getDataAtProp = function (prop) { + var out = [], + range; - // only rerender the selections (FillHandle should disappear when beginediting is triggered) - this.instance.view.render(); + range = datamap.getRange(new _src.CellCoords(0, datamap.propToCol(prop)), new _src.CellCoords(priv.settings.data.length - 1, datamap.propToCol(prop)), datamap.DESTINATION_RENDERER); - this.instance.runHooks('afterBeginEditing', this.row, this.col); -}; + return out.concat.apply(out, _toConsumableArray(range)); + }; -BaseEditor.prototype.finishEditing = function (restoreOriginalValue, ctrlDown, callback) { - var _this = this, - val; + /** + * Returns the source data object (the same that was passed by `data` configuration option or `loadData` method). + * Optionally you can provide a cell range by using the `row`, `col`, `row2`, `col2` arguments, to get only a fragment of grid data. + * + * @memberof Core# + * @function getSourceData + * @since 0.20.0 + * @param {Number} [r] From physical row index. + * @param {Number} [c] From physical column index (or visual index, if data type is an array of objects). + * @param {Number} [r2] To physical row index. + * @param {Number} [c2] To physical column index (or visual index, if data type is an array of objects). + * @returns {Array} Array of grid data. + */ + this.getSourceData = function (r, c, r2, c2) { + var data = void 0; - if (callback) { - var previousCloseCallback = this._closeCallback; + if (r === void 0) { + data = dataSource.getData(); + } else { + data = dataSource.getByRange(new _src.CellCoords(r, c), new _src.CellCoords(r2, c2)); + } - this._closeCallback = function (result) { - if (previousCloseCallback) { - previousCloseCallback(result); - } + return data; + }; - callback(result); - _this.instance.view.render(); - }; - } + /** + * Returns the source data object as an arrays of arrays format even when source data was provided in another format. + * Optionally you can provide a cell range by using the `row`, `col`, `row2`, `col2` arguments, to get only a fragment of grid data. + * + * @memberof Core# + * @function getSourceDataArray + * @since 0.28.0 + * @param {Number} [r] From physical row index. + * @param {Number} [c] From physical column index (or visual index, if data type is an array of objects). + * @param {Number} [r2] To physical row index. + * @param {Number} [c2] To physical column index (or visual index, if data type is an array of objects). + * @returns {Array} An array of arrays. + */ + this.getSourceDataArray = function (r, c, r2, c2) { + var data = void 0; - if (this.isWaiting()) { - return; - } + if (r === void 0) { + data = dataSource.getData(true); + } else { + data = dataSource.getByRange(new _src.CellCoords(r, c), new _src.CellCoords(r2, c2), true); + } - if (this.state == EditorState.VIRGIN) { - this.instance._registerTimeout(setTimeout(function () { - _this._fireCallbacks(true); - }, 0)); + return data; + }; - return; - } + /** + * Returns an array of column values from the data source. `col` is the index of the row in the data source. + * + * @memberof Core# + * @function getSourceDataAtCol + * @since 0.11.0-beta3 + * @param {Number} column Visual column index. + * @returns {Array} Array of the column's cell values. + */ + // TODO: Getting data from `sourceData` should work always on physical indexes. + this.getSourceDataAtCol = function (column) { + return dataSource.getAtColumn(column); + }; - if (this.state == EditorState.EDITING) { - if (restoreOriginalValue) { - this.cancelChanges(); - this.instance.view.render(); + /** + * Returns a single row of the data (array or object, depending on what you have). `row` is the index of the row in the data source. + * + * @memberof Core# + * @function getSourceDataAtRow + * @since 0.11.0-beta3 + * @param {Number} row Physical row index. + * @returns {Array|Object} Single row of data. + */ + this.getSourceDataAtRow = function (row) { + return dataSource.getAtRow(row); + }; - return; - } + /** + * Returns a single value from the data source. + * + * @memberof Core# + * @function getSourceDataAtCell + * @param {Number} row Physical row index. + * @param {Number} column Visual column index. + * @returns {*} Cell data. + * @since 0.20.0 + */ + // TODO: Getting data from `sourceData` should work always on physical indexes. + this.getSourceDataAtCell = function (row, column) { + return dataSource.getAtCell(row, column); + }; - var value = this.getValue(); + /** + * @description + * Returns a single row of the data. The `row` argument is the __visible__ index of the row. + * + * @memberof Core# + * @function getDataAtRow + * @param {Number} row Visual row index. + * @returns {Array} Array of row's cell data. + * @since 0.9-beta2 + */ + this.getDataAtRow = function (row) { + var data = datamap.getRange(new _src.CellCoords(row, 0), new _src.CellCoords(row, this.countCols() - 1), datamap.DESTINATION_RENDERER); - if (this.instance.getSettings().trimWhitespace) { - // We trim only string values - val = [[typeof value === 'string' ? String.prototype.trim.call(value || '') : value]]; - } else { - val = [[value]]; + return data[0] || []; + }; + + /** + * @description + * Returns a data type defined in the Handsontable settings under the `type` key ([Options#type](http://docs.handsontable.com/Options.html#type)). + * If there are cells with different types in the selected range, it returns `'mixed'`. + * + * @since 0.18.1 + * @memberof Core# + * @function getDataType + * @param {Number} rowFrom From visual row index. + * @param {Number} columnFrom From visual column index. + * @param {Number} rowTo To visual row index. + * @param {Number} columnTo To visual column index. + * @returns {String} Cell type (e.q: `'mixed'`, `'text'`, `'numeric'`, `'autocomplete'`). + */ + this.getDataType = function (rowFrom, columnFrom, rowTo, columnTo) { + var _this = this; + + var previousType = null; + var currentType = null; + + if (rowFrom === void 0) { + rowFrom = 0; + rowTo = this.countRows(); + columnFrom = 0; + columnTo = this.countCols(); } + if (rowTo === void 0) { + rowTo = rowFrom; + } + if (columnTo === void 0) { + columnTo = columnFrom; + } + var type = 'mixed'; - this.state = EditorState.WAITING; - this.saveValue(val, ctrlDown); + (0, _number.rangeEach)(Math.min(rowFrom, rowTo), Math.max(rowFrom, rowTo), function (row) { + var isTypeEqual = true; - if (this.instance.getCellValidator(this.cellProperties)) { - this.instance.addHookOnce('postAfterValidate', function (result) { - _this.state = EditorState.FINISHED; - _this.discardEditor(result); + (0, _number.rangeEach)(Math.min(columnFrom, columnTo), Math.max(columnFrom, columnTo), function (column) { + var cellType = _this.getCellMeta(row, column); + + currentType = cellType.type; + + if (previousType) { + isTypeEqual = previousType === currentType; + } else { + previousType = currentType; + } + + return isTypeEqual; }); - } else { - this.state = EditorState.FINISHED; - this.discardEditor(true); - } - } -}; + type = isTypeEqual ? currentType : 'mixed'; -BaseEditor.prototype.cancelChanges = function () { - this.state = EditorState.FINISHED; - this.discardEditor(); -}; + return isTypeEqual; + }); -BaseEditor.prototype.discardEditor = function (result) { - if (this.state !== EditorState.FINISHED) { - return; - } - // validator was defined and failed - if (result === false && this.cellProperties.allowInvalid !== true) { - this.instance.selectCell(this.row, this.col); - this.focus(); - this.state = EditorState.EDITING; - this._fireCallbacks(false); - } else { - this.close(); - this._opened = false; - this._fullEditMode = false; - this.state = EditorState.VIRGIN; - this._fireCallbacks(true); - } -}; + return type; + }; -/** - * Switch editor into full edit mode. In this state navigation keys don't close editor. This mode is activated - * automatically after hit ENTER or F2 key on the cell or while editing cell press F2 key. - */ -BaseEditor.prototype.enableFullEditMode = function () { - this._fullEditMode = true; -}; + /** + * Remove a property defined by the `key` argument from the cell meta object for the provided `row` and `col` coordinates. + * + * @memberof Core# + * @function removeCellMeta + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @param {String} key Property name. + * @fires Hooks#beforeRemoveCellMeta + * @fires Hooks#afterRemoveCellMeta + */ + this.removeCellMeta = function (row, col, key) { + var _recordTranslator$toP = recordTranslator.toPhysical(row, col), + _recordTranslator$toP2 = _slicedToArray(_recordTranslator$toP, 2), + physicalRow = _recordTranslator$toP2[0], + physicalColumn = _recordTranslator$toP2[1]; -/** - * Checks if editor is in full edit mode. - * - * @returns {Boolean} - */ -BaseEditor.prototype.isInFullEditMode = function () { - return this._fullEditMode; -}; + var cachedValue = priv.cellSettings[physicalRow][physicalColumn][key]; -BaseEditor.prototype.isOpened = function () { - return this._opened; -}; + var hookResult = instance.runHooks('beforeRemoveCellMeta', row, col, key, cachedValue); -BaseEditor.prototype.isWaiting = function () { - return this.state === EditorState.WAITING; -}; + if (hookResult !== false) { + delete priv.cellSettings[physicalRow][physicalColumn][key]; -BaseEditor.prototype.checkEditorSection = function () { - var totalRows = this.instance.countRows(); - var section = ''; + instance.runHooks('afterRemoveCellMeta', row, col, key, cachedValue); + } - if (this.row < this.instance.getSettings().fixedRowsTop) { - if (this.col < this.instance.getSettings().fixedColumnsLeft) { - section = 'top-left-corner'; - } else { - section = 'top'; - } - } else if (this.instance.getSettings().fixedRowsBottom && this.row >= totalRows - this.instance.getSettings().fixedRowsBottom) { - if (this.col < this.instance.getSettings().fixedColumnsLeft) { - section = 'bottom-left-corner'; - } else { - section = 'bottom'; - } - } else if (this.col < this.instance.getSettings().fixedColumnsLeft) { - section = 'left'; - } + cachedValue = null; + }; - return section; -}; + /** + * Remove one or more rows from the cell meta object. + * + * @since 0.30.0 + * @param {Number} index An integer that specifies at what position to add/remove items, Use negative values to specify the position from the end of the array. + * @param {Number} deleteAmount The number of items to be removed. If set to 0, no items will be removed. + * @param {Array} items The new items to be added to the array. + */ + this.spliceCellsMeta = function (index, deleteAmount) { + var _priv$cellSettings; -exports.default = BaseEditor; + for (var _len2 = arguments.length, items = Array(_len2 > 2 ? _len2 - 2 : 0), _key = 2; _key < _len2; _key++) { + items[_key - 2] = arguments[_key]; + } -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { + (_priv$cellSettings = priv.cellSettings).splice.apply(_priv$cellSettings, [index, deleteAmount].concat(items)); + }; -// 22.1.3.31 Array.prototype[@@unscopables] -var UNSCOPABLES = __webpack_require__(10)('unscopables') - , ArrayProto = Array.prototype; -if(ArrayProto[UNSCOPABLES] == undefined)__webpack_require__(32)(ArrayProto, UNSCOPABLES, {}); -module.exports = function(key){ - ArrayProto[UNSCOPABLES][key] = true; -}; + /** + * Set cell meta data object defined by `prop` to the corresponding params `row` and `col`. + * + * @memberof Core# + * @function setCellMetaObject + * @since 0.11 + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @param {Object} prop Meta object. + */ + this.setCellMetaObject = function (row, col, prop) { + if ((typeof prop === 'undefined' ? 'undefined' : _typeof(prop)) === 'object') { + for (var key in prop) { + if ((0, _object.hasOwnProperty)(prop, key)) { + var value = prop[key]; + this.setCellMeta(row, col, key, value); + } + } + } + }; -/***/ }), -/* 39 */ -/***/ (function(module, exports) { + /** + * Sets a property defined by the `key` object to the meta object of a cell corresponding to params `row` and `col`. + * + * @memberof Core# + * @function setCellMeta + * @since 0.11 + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @param {String} key Property name. + * @param {String} val Property value. + * @fires Hooks#afterSetCellMeta + */ + this.setCellMeta = function (row, col, key, val) { + var _recordTranslator$toP3 = recordTranslator.toPhysical(row, col), + _recordTranslator$toP4 = _slicedToArray(_recordTranslator$toP3, 2), + physicalRow = _recordTranslator$toP4[0], + physicalColumn = _recordTranslator$toP4[1]; -var toString = {}.toString; + if (!priv.columnSettings[physicalColumn]) { + priv.columnSettings[physicalColumn] = (0, _setting.columnFactory)(GridSettings, priv.columnsSettingConflicts); + } -module.exports = function(it){ - return toString.call(it).slice(8, -1); -}; + if (!priv.cellSettings[physicalRow]) { + priv.cellSettings[physicalRow] = []; + } + if (!priv.cellSettings[physicalRow][physicalColumn]) { + priv.cellSettings[physicalRow][physicalColumn] = new priv.columnSettings[physicalColumn](); + } + priv.cellSettings[physicalRow][physicalColumn][key] = val; + instance.runHooks('afterSetCellMeta', row, col, key, val); + }; -/***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Get all the cells meta settings at least once generated in the table (in order of cell initialization). + * + * @since 0.19.0 + * @returns {Array} Returns Array of ColumnSettings object. + */ + this.getCellsMeta = function () { + return (0, _array.arrayFlatten)(priv.cellSettings); + }; -// 19.1.2.14 / 15.2.3.14 Object.keys(O) -var $keys = __webpack_require__(284) - , enumBugKeys = __webpack_require__(76); + /** + * Returns the cell properties object for the given `row` and `col` coordinates. + * + * @memberof Core# + * @function getCellMeta + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @returns {Object} The cell properties object. + * @fires Hooks#beforeGetCellMeta + * @fires Hooks#afterGetCellMeta + */ + this.getCellMeta = function (row, col) { + var prop = datamap.colToProp(col); + var cellProperties = void 0; -module.exports = Object.keys || function keys(O){ - return $keys(O, enumBugKeys); -}; + var _recordTranslator$toP5 = recordTranslator.toPhysical(row, col), + _recordTranslator$toP6 = _slicedToArray(_recordTranslator$toP5, 2), + physicalRow = _recordTranslator$toP6[0], + physicalColumn = _recordTranslator$toP6[1]; -/***/ }), -/* 41 */ -/***/ (function(module, exports) { + if (!priv.columnSettings[physicalColumn]) { + priv.columnSettings[physicalColumn] = (0, _setting.columnFactory)(GridSettings, priv.columnsSettingConflicts); + } -module.exports = function(bitmap, value){ - return { - enumerable : !(bitmap & 1), - configurable: !(bitmap & 2), - writable : !(bitmap & 4), - value : value - }; -}; + if (!priv.cellSettings[physicalRow]) { + priv.cellSettings[physicalRow] = []; + } + if (!priv.cellSettings[physicalRow][physicalColumn]) { + priv.cellSettings[physicalRow][physicalColumn] = new priv.columnSettings[physicalColumn](); + } -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { + cellProperties = priv.cellSettings[physicalRow][physicalColumn]; // retrieve cellProperties from cache -// 7.1.13 ToObject(argument) -var defined = __webpack_require__(30); -module.exports = function(it){ - return Object(defined(it)); -}; + cellProperties.row = physicalRow; + cellProperties.col = physicalColumn; + cellProperties.visualRow = row; + cellProperties.visualCol = col; + cellProperties.prop = prop; + cellProperties.instance = instance; -/***/ }), -/* 43 */ -/***/ (function(module, exports, __webpack_require__) { + instance.runHooks('beforeGetCellMeta', row, col, cellProperties); + (0, _object.extend)(cellProperties, expandType(cellProperties)); // for `type` added in beforeGetCellMeta -"use strict"; + if (cellProperties.cells) { + var settings = cellProperties.cells.call(cellProperties, physicalRow, physicalColumn, prop); + if (settings) { + (0, _object.extend)(cellProperties, settings); + (0, _object.extend)(cellProperties, expandType(settings)); // for `type` added in cells + } + } -exports.__esModule = true; + instance.runHooks('afterGetCellMeta', row, col, cellProperties); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + return cellProperties; + }; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + /** + * Returns a row off the cell meta array. + * + * @memberof Core# + * @function getCellMetaAtRow + * @since 0.30.0 + * @param {Number} row Physical index of the row to return cell meta for. + * @returns {Array} + */ + this.getCellMetaAtRow = function (row) { + return priv.cellSettings[row]; + }; -/** - * CellCoords holds cell coordinates (row, column) and few method to validate them and - * retrieve as an array or an object - * - * @class CellCoords - */ -var CellCoords = function () { /** - * @param {Number} row Row index - * @param {Number} col Column index + * Checks if the data format and config allows user to modify the column structure. + * @returns {boolean} */ - function CellCoords(row, col) { - _classCallCheck(this, CellCoords); + this.isColumnModificationAllowed = function () { + return !(instance.dataType === 'object' || instance.getSettings().columns); + }; - if (typeof row !== 'undefined' && typeof col !== 'undefined') { - this.row = row; - this.col = col; - } else { - this.row = null; - this.col = null; - } - } + var rendererLookup = (0, _data.cellMethodLookupFactory)('renderer'); /** - * Checks if given set of coordinates is valid in context of a given Walkontable instance + * Returns the cell renderer function by given `row` and `col` arguments. * - * @param {Walkontable} wotInstance - * @returns {Boolean} + * @memberof Core# + * @function getCellRenderer + * @since 0.11 + * @param {Number|Object} row Visual row index or cell meta object. + * @param {Number} [col] Visual column index. + * @returns {Function} The renderer function. */ + this.getCellRenderer = function (row, col) { + return (0, _renderers.getRenderer)(rendererLookup.call(this, row, col)); + }; + /** + * Returns the cell editor by the provided `row` and `col` arguments. + * + * @memberof Core# + * @function getCellEditor + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @returns {Object} The Editor object. + */ + this.getCellEditor = (0, _data.cellMethodLookupFactory)('editor'); - _createClass(CellCoords, [{ - key: 'isValid', - value: function isValid(wotInstance) { - // is it a valid cell index (0 or higher) - if (this.row < 0 || this.col < 0) { - return false; - } - // is selection within total rows and columns - if (this.row >= wotInstance.getSetting('totalRows') || this.col >= wotInstance.getSetting('totalColumns')) { - return false; - } + var validatorLookup = (0, _data.cellMethodLookupFactory)('validator'); - return true; + /** + * Returns the cell validator by `row` and `col`, provided a validator is defined. If not - it doesn't return anything. + * + * @memberof Core# + * @function getCellValidator + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @returns {Function|RegExp|undefined} The validator function. + */ + this.getCellValidator = function (row, col) { + var validator = validatorLookup.call(this, row, col); + + if (typeof validator === 'string') { + validator = (0, _validators.getValidator)(validator); } - /** - * Checks if this cell coords are the same as cell coords given as a parameter - * - * @param {CellCoords} cellCoords - * @returns {Boolean} - */ + return validator; + }; - }, { - key: 'isEqual', - value: function isEqual(cellCoords) { - if (cellCoords === this) { - return true; - } + /** + * Validates all cells using their validator functions and calls callback when finished. + * + * If one of the cells is invalid, the callback will be fired with `'valid'` arguments as `false` - otherwise it would equal `true`. + * + * @memberof Core# + * @function validateCells + * @param {Function} [callback] The callback function. + */ + this.validateCells = function (callback) { + var waitingForValidator = new ValidatorsQueue(); - return this.row === cellCoords.row && this.col === cellCoords.col; + if (callback) { + waitingForValidator.onQueueEmpty = callback; } - /** - * Checks if tested coordinates are positioned in south-east from this cell coords - * - * @param {Object} testedCoords - * @returns {Boolean} - */ + var i = instance.countRows() - 1; - }, { - key: 'isSouthEastOf', - value: function isSouthEastOf(testedCoords) { - return this.row >= testedCoords.row && this.col >= testedCoords.col; - } + while (i >= 0) { + var j = instance.countCols() - 1; - /** - * Checks if tested coordinates are positioned in north-east from this cell coords - * - * @param {Object} testedCoords - * @returns {Boolean} - */ + while (j >= 0) { + waitingForValidator.addValidatorToQueue(); - }, { - key: 'isNorthWestOf', - value: function isNorthWestOf(testedCoords) { - return this.row <= testedCoords.row && this.col <= testedCoords.col; + instance.validateCell(instance.getDataAtCell(i, j), instance.getCellMeta(i, j), function (result) { + if (typeof result !== 'boolean') { + throw new Error('Validation error: result is not boolean'); + } + if (result === false) { + waitingForValidator.valid = false; + } + waitingForValidator.removeValidatorFormQueue(); + }, 'validateCells'); + j--; + } + i--; } + waitingForValidator.checkIfQueueIsEmpty(); + }; - /** - * Checks if tested coordinates are positioned in south-west from this cell coords - * - * @param {Object} testedCoords - * @returns {Boolean} - */ + /** + * Returns an array of row headers' values (if they are enabled). If param `row` was given, it returns the header of the given row as a string. + * + * @memberof Core# + * @function getRowHeader + * @param {Number} [row] Visual row index. + * @fires Hooks#modifyRowHeader + * @returns {Array|String} Array of header values / single header value. + */ + this.getRowHeader = function (row) { + var rowHeader = priv.settings.rowHeaders; - }, { - key: 'isSouthWestOf', - value: function isSouthWestOf(testedCoords) { - return this.row >= testedCoords.row && this.col <= testedCoords.col; + if (row !== void 0) { + row = instance.runHooks('modifyRowHeader', row); + } + if (row === void 0) { + rowHeader = []; + (0, _number.rangeEach)(instance.countRows() - 1, function (i) { + rowHeader.push(instance.getRowHeader(i)); + }); + } else if (Array.isArray(rowHeader) && rowHeader[row] !== void 0) { + rowHeader = rowHeader[row]; + } else if ((0, _function.isFunction)(rowHeader)) { + rowHeader = rowHeader(row); + } else if (rowHeader && typeof rowHeader !== 'string' && typeof rowHeader !== 'number') { + rowHeader = row + 1; } - /** - * Checks if tested coordinates are positioned in north-east from this cell coords - * - * @param {Object} testedCoords - * @returns {Boolean} - */ + return rowHeader; + }; - }, { - key: 'isNorthEastOf', - value: function isNorthEastOf(testedCoords) { - return this.row <= testedCoords.row && this.col >= testedCoords.col; + /** + * Returns information about if this table is configured to display row headers. + * + * @memberof Core# + * @function hasRowHeaders + * @returns {Boolean} `true` if the instance has the row headers enabled, `false` otherwise. + * @since 0.11 + */ + this.hasRowHeaders = function () { + return !!priv.settings.rowHeaders; + }; + + /** + * Returns information about if this table is configured to display column headers. + * + * @memberof Core# + * @function hasColHeaders + * @since 0.11 + * @returns {Boolean} `True` if the instance has the column headers enabled, `false` otherwise. + */ + this.hasColHeaders = function () { + if (priv.settings.colHeaders !== void 0 && priv.settings.colHeaders !== null) { + // Polymer has empty value = null + return !!priv.settings.colHeaders; + } + for (var i = 0, ilen = instance.countCols(); i < ilen; i++) { + if (instance.getColHeader(i)) { + return true; + } } - }]); - return CellCoords; -}(); + return false; + }; -exports.default = CellCoords; + /** + * Returns an array of column headers (in string format, if they are enabled). If param `col` is given, it returns the header at the given column as a string. + * + * @memberof Core# + * @function getColHeader + * @param {Number} [col] Visual column index. + * @fires Hooks#modifyColHeader + * @returns {Array|String} The column header(s). + */ + this.getColHeader = function (col) { + var columnsAsFunc = priv.settings.columns && (0, _function.isFunction)(priv.settings.columns); + var result = priv.settings.colHeaders; -/***/ }), -/* 44 */ -/***/ (function(module, exports, __webpack_require__) { + col = instance.runHooks('modifyColHeader', col); -"use strict"; + if (col === void 0) { + var out = []; + var ilen = columnsAsFunc ? instance.countSourceCols() : instance.countCols(); + for (var i = 0; i < ilen; i++) { + out.push(instance.getColHeader(i)); + } -exports.__esModule = true; + result = out; + } else { + var translateVisualIndexToColumns = function translateVisualIndexToColumns(col) { + var arr = []; + var columnsLen = instance.countSourceCols(); + var index = 0; -var _element = __webpack_require__(0); + for (; index < columnsLen; index++) { + if ((0, _function.isFunction)(instance.getSettings().columns) && instance.getSettings().columns(index)) { + arr.push(index); + } + } -var _autoResize = __webpack_require__(298); + return arr[col]; + }; + var baseCol = col; + col = instance.runHooks('modifyCol', col); -var _autoResize2 = _interopRequireDefault(_autoResize); + var prop = translateVisualIndexToColumns(col); -var _baseEditor = __webpack_require__(37); + if (priv.settings.columns && (0, _function.isFunction)(priv.settings.columns) && priv.settings.columns(prop) && priv.settings.columns(prop).title) { + result = priv.settings.columns(prop).title; + } else if (priv.settings.columns && priv.settings.columns[col] && priv.settings.columns[col].title) { + result = priv.settings.columns[col].title; + } else if (Array.isArray(priv.settings.colHeaders) && priv.settings.colHeaders[col] !== void 0) { + result = priv.settings.colHeaders[col]; + } else if ((0, _function.isFunction)(priv.settings.colHeaders)) { + result = priv.settings.colHeaders(col); + } else if (priv.settings.colHeaders && typeof priv.settings.colHeaders !== 'string' && typeof priv.settings.colHeaders !== 'number') { + result = (0, _data.spreadsheetColumnLabel)(baseCol); // see #1458 + } + } -var _baseEditor2 = _interopRequireDefault(_baseEditor); + return result; + }; -var _eventManager = __webpack_require__(4); + /** + * Return column width from settings (no guessing). Private use intended. + * + * @private + * @memberof Core# + * @function _getColWidthFromSettings + * @param {Number} col Visual col index. + * @returns {Number} + */ + this._getColWidthFromSettings = function (col) { + var cellProperties = instance.getCellMeta(0, col); + var width = cellProperties.width; -var _eventManager2 = _interopRequireDefault(_eventManager); + if (width === void 0 || width === priv.settings.width) { + width = cellProperties.colWidths; + } + if (width !== void 0 && width !== null) { + switch (typeof width === 'undefined' ? 'undefined' : _typeof(width)) { + case 'object': + // array + width = width[col]; + break; -var _unicode = __webpack_require__(16); + case 'function': + width = width(col); + break; + default: + break; + } + if (typeof width === 'string') { + width = parseInt(width, 10); + } + } -var _event = __webpack_require__(7); + return width; + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * Returns the width of the requested column. + * + * @memberof Core# + * @function getColWidth + * @since 0.11 + * @param {Number} col Visual column index. + * @returns {Number} Column width. + * @fires Hooks#modifyColWidth + */ + this.getColWidth = function (col) { + var width = instance._getColWidthFromSettings(col); -var TextEditor = _baseEditor2.default.prototype.extend(); + width = instance.runHooks('modifyColWidth', width, col); -/** - * @private - * @editor TextEditor - * @class TextEditor - * @dependencies autoResize - */ -TextEditor.prototype.init = function () { - var that = this; - this.createElements(); - this.eventManager = new _eventManager2.default(this); - this.bindEvents(); - this.autoResize = (0, _autoResize2.default)(); - - this.instance.addHook('afterDestroy', function () { - that.destroy(); - }); -}; - -TextEditor.prototype.getValue = function () { - return this.TEXTAREA.value; -}; - -TextEditor.prototype.setValue = function (newValue) { - this.TEXTAREA.value = newValue; -}; - -var onBeforeKeyDown = function onBeforeKeyDown(event) { - var instance = this, - that = instance.getActiveEditor(), - ctrlDown; + if (width === void 0) { + width = _src.ViewportColumnsCalculator.DEFAULT_WIDTH; + } - // catch CTRL but not right ALT (which in some systems triggers ALT+CTRL) - ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; + return width; + }; - // Process only events that have been fired in the editor - if (event.target !== that.TEXTAREA || (0, _event.isImmediatePropagationStopped)(event)) { - return; - } + /** + * Return row height from settings (no guessing). Private use intended. + * + * @private + * @memberof Core# + * @function _getRowHeightFromSettings + * @param {Number} row Visual row index. + * @returns {Number} + */ + this._getRowHeightFromSettings = function (row) { + // let cellProperties = instance.getCellMeta(row, 0); + // let height = cellProperties.height; + // + // if (height === void 0 || height === priv.settings.height) { + // height = cellProperties.rowHeights; + // } + var height = priv.settings.rowHeights; - if (event.keyCode === 17 || event.keyCode === 224 || event.keyCode === 91 || event.keyCode === 93) { - // when CTRL or its equivalent is pressed and cell is edited, don't prepare selectable text in textarea - (0, _event.stopImmediatePropagation)(event); - return; - } + if (height !== void 0 && height !== null) { + switch (typeof height === 'undefined' ? 'undefined' : _typeof(height)) { + case 'object': + // array + height = height[row]; + break; - switch (event.keyCode) { - case _unicode.KEY_CODES.ARROW_RIGHT: - if (that.isInFullEditMode()) { - if (!that.isWaiting() && !that.allowKeyEventPropagation || !that.isWaiting() && that.allowKeyEventPropagation && !that.allowKeyEventPropagation(event.keyCode)) { - (0, _event.stopImmediatePropagation)(event); - } - } - break; - case _unicode.KEY_CODES.ARROW_LEFT: - if (that.isInFullEditMode()) { - if (!that.isWaiting() && !that.allowKeyEventPropagation || !that.isWaiting() && that.allowKeyEventPropagation && !that.allowKeyEventPropagation(event.keyCode)) { - (0, _event.stopImmediatePropagation)(event); - } + case 'function': + height = height(row); + break; + default: + break; } - break; - case _unicode.KEY_CODES.ARROW_UP: - case _unicode.KEY_CODES.ARROW_DOWN: - if (that.isInFullEditMode()) { - if (!that.isWaiting() && !that.allowKeyEventPropagation || !that.isWaiting() && that.allowKeyEventPropagation && !that.allowKeyEventPropagation(event.keyCode)) { - (0, _event.stopImmediatePropagation)(event); - } + if (typeof height === 'string') { + height = parseInt(height, 10); } - break; + } - case _unicode.KEY_CODES.ENTER: - var selected = that.instance.getSelected(); - var isMultipleSelection = !(selected[0] === selected[2] && selected[1] === selected[3]); - if (ctrlDown && !isMultipleSelection || event.altKey) { - // if ctrl+enter or alt+enter, add new line - if (that.isOpened()) { - var caretPosition = (0, _element.getCaretPosition)(that.TEXTAREA), - value = that.getValue(); + return height; + }; - var newValue = value.slice(0, caretPosition) + '\n' + value.slice(caretPosition); + /** + * Returns the row height. + * + * @memberof Core# + * @function getRowHeight + * @since 0.11 + * @param {Number} row Visual row index. + * @returns {Number} The given row's height. + * @fires Hooks#modifyRowHeight + */ + this.getRowHeight = function (row) { + var height = instance._getRowHeightFromSettings(row); - that.setValue(newValue); + height = instance.runHooks('modifyRowHeight', height, row); - (0, _element.setCaretPosition)(that.TEXTAREA, caretPosition + 1); - } else { - that.beginEditing(that.originalValue + '\n'); - } - (0, _event.stopImmediatePropagation)(event); - } - event.preventDefault(); // don't add newline to field - break; + return height; + }; - case _unicode.KEY_CODES.A: - case _unicode.KEY_CODES.X: - case _unicode.KEY_CODES.C: - case _unicode.KEY_CODES.V: - if (ctrlDown) { - (0, _event.stopImmediatePropagation)(event); // CTRL+A, CTRL+C, CTRL+V, CTRL+X should only work locally when cell is edited (not in table context) - } - break; + /** + * Returns the total number of rows in the data source. + * + * @memberof Core# + * @function countSourceRows + * @since 0.20.0 + * @returns {Number} Total number in rows in data source. + */ + this.countSourceRows = function () { + var sourceLength = instance.runHooks('modifySourceLength'); + return sourceLength || (instance.getSourceData() ? instance.getSourceData().length : 0); + }; - case _unicode.KEY_CODES.BACKSPACE: - case _unicode.KEY_CODES.DELETE: - case _unicode.KEY_CODES.HOME: - case _unicode.KEY_CODES.END: - (0, _event.stopImmediatePropagation)(event); // backspace, delete, home, end should only work locally when cell is edited (not in table context) - break; - default: - break; - } + /** + * Returns the total number of columns in the data source. + * + * @memberof Core# + * @function countSourceCols + * @since 0.26.1 + * @returns {Number} Total number in columns in data source. + */ + this.countSourceCols = function () { + var len = 0; + var obj = instance.getSourceData() && instance.getSourceData()[0] ? instance.getSourceData()[0] : []; - if ([_unicode.KEY_CODES.ARROW_UP, _unicode.KEY_CODES.ARROW_RIGHT, _unicode.KEY_CODES.ARROW_DOWN, _unicode.KEY_CODES.ARROW_LEFT].indexOf(event.keyCode) === -1) { - that.autoResize.resize(String.fromCharCode(event.keyCode)); - } -}; + if ((0, _object.isObject)(obj)) { + len = (0, _object.deepObjectSize)(obj); + } else { + len = obj.length || 0; + } -TextEditor.prototype.open = function () { - this.refreshDimensions(); // need it instantly, to prevent https://github.com/handsontable/handsontable/issues/348 + return len; + }; - this.instance.addHook('beforeKeyDown', onBeforeKeyDown); -}; + /** + * Returns the total number of rows in the grid. + * + * @memberof Core# + * @function countRows + * @returns {Number} Total number in rows the grid. + */ + this.countRows = function () { + return datamap.getLength(); + }; -TextEditor.prototype.close = function (tdOutside) { - this.textareaParentStyle.display = 'none'; + /** + * Returns the total number of columns in the grid. + * + * @memberof Core# + * @function countCols + * @returns {Number} Total number of columns. + */ + this.countCols = function () { + var maxCols = this.getSettings().maxCols; + var dataHasLength = false; + var dataLen = 0; - this.autoResize.unObserve(); + if (instance.dataType === 'array') { + dataHasLength = priv.settings.data && priv.settings.data[0] && priv.settings.data[0].length; + } - if (document.activeElement === this.TEXTAREA) { - this.instance.listen(); // don't refocus the table if user focused some cell outside of HT on purpose - } - this.instance.removeHook('beforeKeyDown', onBeforeKeyDown); -}; + if (dataHasLength) { + dataLen = priv.settings.data[0].length; + } -TextEditor.prototype.focus = function () { - this.TEXTAREA.focus(); - (0, _element.setCaretPosition)(this.TEXTAREA, this.TEXTAREA.value.length); -}; + if (priv.settings.columns) { + var columnsIsFunction = (0, _function.isFunction)(priv.settings.columns); -TextEditor.prototype.createElements = function () { - // this.$body = $(document.body); + if (columnsIsFunction) { + if (instance.dataType === 'array') { + var columnLen = 0; - this.TEXTAREA = document.createElement('TEXTAREA'); + for (var i = 0; i < dataLen; i++) { + if (priv.settings.columns(i)) { + columnLen++; + } + } - (0, _element.addClass)(this.TEXTAREA, 'handsontableInput'); + dataLen = columnLen; + } else if (instance.dataType === 'object' || instance.dataType === 'function') { + dataLen = datamap.colToPropCache.length; + } + } else { + dataLen = priv.settings.columns.length; + } + } else if (instance.dataType === 'object' || instance.dataType === 'function') { + dataLen = datamap.colToPropCache.length; + } - this.textareaStyle = this.TEXTAREA.style; - this.textareaStyle.width = 0; - this.textareaStyle.height = 0; + return Math.min(maxCols, dataLen); + }; - this.TEXTAREA_PARENT = document.createElement('DIV'); - (0, _element.addClass)(this.TEXTAREA_PARENT, 'handsontableInputHolder'); + /** + * Returns an visual index of the first rendered row. + * + * @memberof Core# + * @function rowOffset + * @returns {Number} Visual index of first rendered row. + */ + this.rowOffset = function () { + return instance.view.wt.wtTable.getFirstRenderedRow(); + }; - this.textareaParentStyle = this.TEXTAREA_PARENT.style; - this.textareaParentStyle.top = 0; - this.textareaParentStyle.left = 0; - this.textareaParentStyle.display = 'none'; + /** + * Returns the visual index of the first rendered column. + * + * @memberof Core# + * @function colOffset + * @returns {Number} Visual index of the first visible column. + */ + this.colOffset = function () { + return instance.view.wt.wtTable.getFirstRenderedColumn(); + }; - this.TEXTAREA_PARENT.appendChild(this.TEXTAREA); + /** + * Returns the number of rendered rows (including rows partially or fully rendered outside viewport). + * + * @memberof Core# + * @function countRenderedRows + * @returns {Number} Returns -1 if table is not visible. + */ + this.countRenderedRows = function () { + return instance.view.wt.drawn ? instance.view.wt.wtTable.getRenderedRowsCount() : -1; + }; - this.instance.rootElement.appendChild(this.TEXTAREA_PARENT); + /** + * Returns the number of visible rows (rendered rows that fully fit inside viewport). + * + * @memberof Core# + * @function countVisibleRows + * @returns {Number} Number of visible rows or -1. + */ + this.countVisibleRows = function () { + return instance.view.wt.drawn ? instance.view.wt.wtTable.getVisibleRowsCount() : -1; + }; - var that = this; - this.instance._registerTimeout(setTimeout(function () { - that.refreshDimensions(); - }, 0)); -}; + /** + * Returns the number of rendered columns (including columns partially or fully rendered outside viewport). + * + * @memberof Core# + * @function countRenderedCols + * @returns {Number} Returns -1 if table is not visible. + */ + this.countRenderedCols = function () { + return instance.view.wt.drawn ? instance.view.wt.wtTable.getRenderedColumnsCount() : -1; + }; -TextEditor.prototype.getEditedCell = function () { - var editorSection = this.checkEditorSection(), - editedCell; + /** + * Returns the number of visible columns. Returns -1 if table is not visible + * + * @memberof Core# + * @function countVisibleCols + * @return {Number} Number of visible columns or -1. + */ + this.countVisibleCols = function () { + return instance.view.wt.drawn ? instance.view.wt.wtTable.getVisibleColumnsCount() : -1; + }; - switch (editorSection) { - case 'top': - editedCell = this.instance.view.wt.wtOverlays.topOverlay.clone.wtTable.getCell({ - row: this.row, - col: this.col - }); - this.textareaParentStyle.zIndex = 101; - break; - case 'top-left-corner': - editedCell = this.instance.view.wt.wtOverlays.topLeftCornerOverlay.clone.wtTable.getCell({ - row: this.row, - col: this.col - }); - this.textareaParentStyle.zIndex = 103; - break; - case 'bottom-left-corner': - editedCell = this.instance.view.wt.wtOverlays.bottomLeftCornerOverlay.clone.wtTable.getCell({ - row: this.row, - col: this.col - }); - this.textareaParentStyle.zIndex = 103; - break; - case 'left': - editedCell = this.instance.view.wt.wtOverlays.leftOverlay.clone.wtTable.getCell({ - row: this.row, - col: this.col - }); - this.textareaParentStyle.zIndex = 102; - break; - case 'bottom': - editedCell = this.instance.view.wt.wtOverlays.bottomOverlay.clone.wtTable.getCell({ - row: this.row, - col: this.col - }); - this.textareaParentStyle.zIndex = 102; - break; - default: - editedCell = this.instance.getCell(this.row, this.col); - this.textareaParentStyle.zIndex = ''; - break; - } + /** + * Returns the number of empty rows. If the optional ending parameter is `true`, returns the + * number of empty rows at the bottom of the table. + * + * @memberof Core# + * @function countEmptyRows + * @param {Boolean} [ending] If `true`, will only count empty rows at the end of the data source. + * @returns {Number} Count empty rows + * @fires Hooks#modifyRow + */ + this.countEmptyRows = function (ending) { + var i = instance.countRows() - 1, + empty = 0, + row; - return editedCell != -1 && editedCell != -2 ? editedCell : void 0; -}; + while (i >= 0) { + row = instance.runHooks('modifyRow', i); -TextEditor.prototype.refreshValue = function () { - var sourceData = this.instance.getSourceDataAtCell(this.row, this.prop); - this.originalValue = sourceData; + if (instance.isEmptyRow(row)) { + empty++; + } else if (ending) { + break; + } + i--; + } - this.setValue(sourceData); - this.refreshDimensions(); -}; + return empty; + }; -TextEditor.prototype.refreshDimensions = function () { - if (this.state !== _baseEditor.EditorState.EDITING) { - return; - } - this.TD = this.getEditedCell(); + /** + * Returns the number of empty columns. If the optional ending parameter is `true`, returns the number of empty + * columns at right hand edge of the table. + * + * @memberof Core# + * @function countEmptyCols + * @param {Boolean} [ending] If `true`, will only count empty columns at the end of the data source row. + * @returns {Number} Count empty cols + */ + this.countEmptyCols = function (ending) { + if (instance.countRows() < 1) { + return 0; + } + var i = instance.countCols() - 1, + empty = 0; - // TD is outside of the viewport. - if (!this.TD) { - this.close(true); + while (i >= 0) { + if (instance.isEmptyCol(i)) { + empty++; + } else if (ending) { + break; + } + i--; + } - return; - } - var currentOffset = (0, _element.offset)(this.TD), - containerOffset = (0, _element.offset)(this.instance.rootElement), - scrollableContainer = (0, _element.getScrollableElement)(this.TD), - totalRowsCount = this.instance.countRows(), + return empty; + }; + /** + * Check if all cells in the row declared by the `row` argument are empty. + * + * @memberof Core# + * @function isEmptyRow + * @param {Number} row Row index. + * @returns {Boolean} `true` if the row at the given `row` is empty, `false` otherwise. + */ + this.isEmptyRow = function (row) { + return priv.settings.isEmptyRow.call(instance, row); + }; - // If colHeaders is disabled, cells in the first row have border-top - editTopModifier = currentOffset.top === containerOffset.top ? 0 : 1, - editTop = currentOffset.top - containerOffset.top - editTopModifier - (scrollableContainer.scrollTop || 0), - editLeft = currentOffset.left - containerOffset.left - 1 - (scrollableContainer.scrollLeft || 0), - settings = this.instance.getSettings(), - rowHeadersCount = this.instance.hasRowHeaders(), - colHeadersCount = this.instance.hasColHeaders(), - editorSection = this.checkEditorSection(), - backgroundColor = this.TD.style.backgroundColor, - cssTransformOffset; + /** + * Check if all cells in the the column declared by the `col` argument are empty. + * + * @memberof Core# + * @function isEmptyCol + * @param {Number} col Column index. + * @returns {Boolean} `true` if the column at the given `col` is empty, `false` otherwise. + */ + this.isEmptyCol = function (col) { + return priv.settings.isEmptyCol.call(instance, col); + }; - // TODO: Refactor this to the new instance.getCell method (from #ply-59), after 0.12.1 is released - switch (editorSection) { - case 'top': - cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.topOverlay.clone.wtTable.holder.parentNode); - break; - case 'left': - cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.leftOverlay.clone.wtTable.holder.parentNode); - break; - case 'top-left-corner': - cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.topLeftCornerOverlay.clone.wtTable.holder.parentNode); - break; - case 'bottom-left-corner': - cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.bottomLeftCornerOverlay.clone.wtTable.holder.parentNode); - break; - case 'bottom': - cssTransformOffset = (0, _element.getCssTransform)(this.instance.view.wt.wtOverlays.bottomOverlay.clone.wtTable.holder.parentNode); - break; - default: - break; - } + /** + * Select cell specified by `row` and `col` values or a range of cells finishing at `endRow`, `endCol`. + * By default, viewport will be scrolled to selection. + * After the `selectCell` method had finished, the instance will be listening to keyboard input on the document. + * + * @memberof Core# + * @function selectCell + * @param {Number} row Visual row index. + * @param {Number} col Visual column index. + * @param {Number} [endRow] Visual end row index (if selecting a range). + * @param {Number} [endCol] Visual end column index (if selecting a range). + * @param {Boolean} [scrollToCell=true] If `true`, the viewport will be scrolled to the selection. + * @param {Boolean} [changeListener=true] If `false`, Handsontable will not change keyboard events listener to himself. + * @returns {Boolean} `true` if selection was successful, `false` otherwise. + */ + this.selectCell = function (row, col, endRow, endCol, scrollToCell, changeListener) { + var coords; - if (colHeadersCount && this.instance.getSelected()[0] === 0 || settings.fixedRowsBottom && this.instance.getSelected()[0] === totalRowsCount - settings.fixedRowsBottom) { - editTop += 1; - } + changeListener = (0, _mixed.isUndefined)(changeListener) || changeListener === true; - if (this.instance.getSelected()[1] === 0) { - editLeft += 1; - } + if (typeof row !== 'number' || row < 0 || row >= instance.countRows()) { + return false; + } + if (typeof col !== 'number' || col < 0 || col >= instance.countCols()) { + return false; + } + if ((0, _mixed.isDefined)(endRow)) { + if (typeof endRow !== 'number' || endRow < 0 || endRow >= instance.countRows()) { + return false; + } + if (typeof endCol !== 'number' || endCol < 0 || endCol >= instance.countCols()) { + return false; + } + } + coords = new _src.CellCoords(row, col); + priv.selRange = new _src.CellRange(coords, coords, coords); - if (cssTransformOffset && cssTransformOffset != -1) { - this.textareaParentStyle[cssTransformOffset[0]] = cssTransformOffset[1]; - } else { - (0, _element.resetCssTransform)(this.TEXTAREA_PARENT); - } + if (changeListener) { + instance.listen(); + } - this.textareaParentStyle.top = editTop + 'px'; - this.textareaParentStyle.left = editLeft + 'px'; + if ((0, _mixed.isUndefined)(endRow)) { + selection.setRangeEnd(priv.selRange.from, scrollToCell); + } else { + selection.setRangeEnd(new _src.CellCoords(endRow, endCol), scrollToCell); + } + instance.selection.finish(); - var firstRowOffset = this.instance.view.wt.wtViewport.rowsRenderCalculator.startPosition; - var firstColumnOffset = this.instance.view.wt.wtViewport.columnsRenderCalculator.startPosition; - var horizontalScrollPosition = this.instance.view.wt.wtOverlays.leftOverlay.getScrollPosition(); - var verticalScrollPosition = this.instance.view.wt.wtOverlays.topOverlay.getScrollPosition(); - var scrollbarWidth = (0, _element.getScrollbarWidth)(); + return true; + }; - var cellTopOffset = this.TD.offsetTop + firstRowOffset - verticalScrollPosition; - var cellLeftOffset = this.TD.offsetLeft + firstColumnOffset - horizontalScrollPosition; + /** + * Select the cell specified by the `row` and `prop` arguments, or a range finishing at `endRow`, `endProp`. + * By default, viewport will be scrolled to selection. + * + * @memberof Core# + * @function selectCellByProp + * @param {Number} row Visual row index. + * @param {String} prop Property name. + * @param {Number} [endRow] visual end row index (if selecting a range). + * @param {String} [endProp] End property name (if selecting a range). + * @param {Boolean} [scrollToCell=true] If `true`, viewport will be scrolled to the selection. + * @returns {Boolean} `true` if selection was successful, `false` otherwise. + */ + this.selectCellByProp = function (row, prop, endRow, endProp, scrollToCell) { + var _instance5; - var width = (0, _element.innerWidth)(this.TD) - 8; - var actualVerticalScrollbarWidth = (0, _element.hasVerticalScrollbar)(scrollableContainer) ? scrollbarWidth : 0; - var actualHorizontalScrollbarWidth = (0, _element.hasHorizontalScrollbar)(scrollableContainer) ? scrollbarWidth : 0; - var maxWidth = this.instance.view.maximumVisibleElementWidth(cellLeftOffset) - 9 - actualVerticalScrollbarWidth; - var height = this.TD.scrollHeight + 1; - var maxHeight = Math.max(this.instance.view.maximumVisibleElementHeight(cellTopOffset) - actualHorizontalScrollbarWidth, 23); + arguments[1] = datamap.propToCol(arguments[1]); - var cellComputedStyle = (0, _element.getComputedStyle)(this.TD); + if ((0, _mixed.isDefined)(arguments[3])) { + arguments[3] = datamap.propToCol(arguments[3]); + } - this.TEXTAREA.style.fontSize = cellComputedStyle.fontSize; - this.TEXTAREA.style.fontFamily = cellComputedStyle.fontFamily; - this.TEXTAREA.style.backgroundColor = ''; // RESET STYLE - this.TEXTAREA.style.backgroundColor = backgroundColor ? backgroundColor : (0, _element.getComputedStyle)(this.TEXTAREA).backgroundColor; + return (_instance5 = instance).selectCell.apply(_instance5, arguments); + }; - this.autoResize.init(this.TEXTAREA, { - minHeight: Math.min(height, maxHeight), - maxHeight: maxHeight, // TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar) - minWidth: Math.min(width, maxWidth), - maxWidth: maxWidth // TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar) - }, true); + /** + * Deselects the current cell selection on grid. + * + * @memberof Core# + * @function deselectCell + */ + this.deselectCell = function () { + selection.deselect(); + }; - this.textareaParentStyle.display = 'block'; -}; + /** + * Scroll viewport to coords specified by the `row` and `column` arguments. + * + * @since 0.24.3 + * @memberof Core# + * @function scrollViewportTo + * @param {Number} [row] Visual row index. + * @param {Number} [column] Visual column index. + * @param {Boolean} [snapToBottom = false] If `true`, viewport is scrolled to show the cell on the bottom of the table. + * @param {Boolean} [snapToRight = false] If `true`, viewport is scrolled to show the cell on the right side of the table. + * @returns {Boolean} `true` if scroll was successful, `false` otherwise. + */ + this.scrollViewportTo = function (row, column) { + var snapToBottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var snapToRight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; -TextEditor.prototype.bindEvents = function () { - var editor = this; + if (row !== void 0 && (row < 0 || row >= instance.countRows())) { + return false; + } + if (column !== void 0 && (column < 0 || column >= instance.countCols())) { + return false; + } - this.eventManager.addEventListener(this.TEXTAREA, 'cut', function (event) { - (0, _event.stopPropagation)(event); - }); + var result = false; - this.eventManager.addEventListener(this.TEXTAREA, 'paste', function (event) { - (0, _event.stopPropagation)(event); - }); + if (row !== void 0 && column !== void 0) { + instance.view.wt.wtOverlays.topOverlay.scrollTo(row, snapToBottom); + instance.view.wt.wtOverlays.leftOverlay.scrollTo(column, snapToRight); - this.instance.addHook('afterScrollHorizontally', function () { - editor.refreshDimensions(); - }); + result = true; + } + if (typeof row === 'number' && typeof column !== 'number') { + instance.view.wt.wtOverlays.topOverlay.scrollTo(row, snapToBottom); - this.instance.addHook('afterScrollVertically', function () { - editor.refreshDimensions(); - }); + result = true; + } + if (typeof column === 'number' && typeof row !== 'number') { + instance.view.wt.wtOverlays.leftOverlay.scrollTo(column, snapToRight); - this.instance.addHook('afterColumnResize', function () { - editor.refreshDimensions(); - editor.focus(); - }); + result = true; + } - this.instance.addHook('afterRowResize', function () { - editor.refreshDimensions(); - editor.focus(); - }); + return result; + }; - this.instance.addHook('afterDestroy', function () { - editor.eventManager.destroy(); - }); -}; + /** + * Removes grid from the DOM. + * + * @memberof Core# + * @function destroy + * @fires Hooks#afterDestroy + */ + this.destroy = function () { -TextEditor.prototype.destroy = function () { - this.eventManager.destroy(); -}; + instance._clearTimeouts(); + if (instance.view) { + // in case HT is destroyed before initialization has finished + instance.view.destroy(); + } + if (dataSource) { + dataSource.destroy(); + } + dataSource = null; -exports.default = TextEditor; + (0, _element.empty)(instance.rootElement); + eventManager.destroy(); -/***/ }), -/* 45 */ -/***/ (function(module, exports) { + instance.runHooks('afterDestroy'); + _pluginHooks2.default.getSingleton().destroy(instance); -var core = module.exports = {version: '2.4.0'}; -if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + for (var i in instance) { + if ((0, _object.hasOwnProperty)(instance, i)) { + // replace instance methods with post mortem + if ((0, _function.isFunction)(instance[i])) { + instance[i] = postMortem; + } else if (i !== 'guid') { + // replace instance properties with null (restores memory) + // it should not be necessary but this prevents a memory leak side effects that show itself in Jasmine tests + instance[i] = null; + } + } + } -/***/ }), -/* 46 */ -/***/ (function(module, exports) { + // replace private properties with null (restores memory) + // it should not be necessary but this prevents a memory leak side effects that show itself in Jasmine tests + if (datamap) { + datamap.destroy(); + } + datamap = null; + priv = null; + grid = null; + selection = null; + editorManager = null; + instance = null; + GridSettings = null; + }; -module.exports = {}; + /** + * Replacement for all methods after Handsotnable was destroyed. + * + * @private + */ + function postMortem() { + throw new Error('This method cannot be called because this Handsontable instance has been destroyed'); + } -/***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Returns the active editor object. + * + * @memberof Core# + * @function getActiveEditor + * @returns {Object} The active editor object. + */ + this.getActiveEditor = function () { + return editorManager.getActiveEditor(); + }; -var META = __webpack_require__(50)('meta') - , isObject = __webpack_require__(15) - , has = __webpack_require__(22) - , setDesc = __webpack_require__(19).f - , id = 0; -var isExtensible = Object.isExtensible || function(){ - return true; -}; -var FREEZE = !__webpack_require__(31)(function(){ - return isExtensible(Object.preventExtensions({})); -}); -var setMeta = function(it){ - setDesc(it, META, {value: { - i: 'O' + ++id, // object ID - w: {} // weak collections IDs - }}); -}; -var fastKey = function(it, create){ - // return primitive with prefix - if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if(!has(it, META)){ - // can't set metadata to uncaught frozen object - if(!isExtensible(it))return 'F'; - // not necessary to add metadata - if(!create)return 'E'; - // add missing metadata - setMeta(it); - // return object ID - } return it[META].i; -}; -var getWeak = function(it, create){ - if(!has(it, META)){ - // can't set metadata to uncaught frozen object - if(!isExtensible(it))return true; - // not necessary to add metadata - if(!create)return false; - // add missing metadata - setMeta(it); - // return hash weak collections IDs - } return it[META].w; -}; -// add metadata on freeze-family methods calling -var onFreeze = function(it){ - if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); - return it; -}; -var meta = module.exports = { - KEY: META, - NEED: false, - fastKey: fastKey, - getWeak: getWeak, - onFreeze: onFreeze -}; + /** + * Returns plugin instance using the plugin name provided. + * + * @memberof Core# + * @function getPlugin + * @param {String} pluginName The plugin name. + * @returns {*} The plugin instance. + * @since 0.15.0 + */ + this.getPlugin = function (pluginName) { + return (0, _plugins.getPlugin)(this, pluginName); + }; -/***/ }), -/* 48 */ -/***/ (function(module, exports) { + /** + * Returns the Handsontable instance. + * + * @memberof Core# + * @function getInstance + * @returns {Handsontable} The Handsontable instance. + */ + this.getInstance = function () { + return instance; + }; -exports.f = {}.propertyIsEnumerable; + /** + * Adds listener to the specified hook name (only for this Handsontable instance). + * + * @memberof Core# + * @function addHook + * @see Hooks#add + * @param {String} key Hook name. + * @param {Function|Array} callback Function or array of Functions. + * + * @example + * ```js + * hot.addHook('beforeInit', myCallback); + * ``` + */ + this.addHook = function (key, callback) { + _pluginHooks2.default.getSingleton().add(key, callback, instance); + }; -/***/ }), -/* 49 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Check if for a specified hook name there are added listeners (only for this Handsontable instance). + * + * @memberof Core# + * @function hasHook + * @see Hooks#has + * @param {String} key Hook name + * @return {Boolean} + * + * @example + * ```js + * var hasBeforeInitListeners = hot.hasHook('beforeInit'); + * ``` + */ + this.hasHook = function (key) { + return _pluginHooks2.default.getSingleton().has(key, instance); + }; -var def = __webpack_require__(19).f - , has = __webpack_require__(22) - , TAG = __webpack_require__(10)('toStringTag'); + /** + * Adds listener to specified hook name (only for this Handsontable instance). + * After the listener is triggered, it will be automatically removed. + * + * @memberof Core# + * @function addHookOnce + * @see Hooks#once + * @param {String} key Hook name. + * @param {Function|Array} callback Function or array of Functions. + * + * @example + * ```js + * hot.addHookOnce('beforeInit', myCallback); + * ``` + */ + this.addHookOnce = function (key, callback) { + _pluginHooks2.default.getSingleton().once(key, callback, instance); + }; -module.exports = function(it, tag, stat){ - if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); -}; + /** + * Removes the hook listener previously registered with {@link Core#addHook}. + * + * @memberof Core# + * @function removeHook + * @see Hooks#remove + * @param {String} key Hook name. + * @param {Function} callback Function which have been registered via {@link Core#addHook}. + * + * @example + * ```js + * hot.removeHook('beforeInit', myCallback); + * ``` + */ + this.removeHook = function (key, callback) { + _pluginHooks2.default.getSingleton().remove(key, callback, instance); + }; -/***/ }), -/* 50 */ -/***/ (function(module, exports) { + /** + * Run the callbacks for the hook provided in the `key` argument using the parameters given in the other arguments. + * + * @memberof Core# + * @function runHooks + * @see Hooks#run + * @param {String} key Hook name. + * @param {*} [p1] Argument passed to the callback. + * @param {*} [p2] Argument passed to the callback. + * @param {*} [p3] Argument passed to the callback. + * @param {*} [p4] Argument passed to the callback. + * @param {*} [p5] Argument passed to the callback. + * @param {*} [p6] Argument passed to the callback. + * @returns {*} + * + * @example + * ```js + * hot.runHooks('beforeInit'); + * ``` + */ + this.runHooks = function (key, p1, p2, p3, p4, p5, p6) { + return _pluginHooks2.default.getSingleton().run(instance, key, p1, p2, p3, p4, p5, p6); + }; -var id = 0 - , px = Math.random(); -module.exports = function(key){ - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); -}; + this.timeouts = []; -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called. + * + * @param {*} handle + * @private + */ + this._registerTimeout = function (handle) { + this.timeouts.push(handle); + }; -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - * numbro.js - * version : 1.11.0 - * author : Företagsplatsen AB - * license : MIT - * http://www.foretagsplatsen.se - */ + /** + * Clears all known timeouts. + * + * @private + */ + this._clearTimeouts = function () { + for (var i = 0, ilen = this.timeouts.length; i < ilen; i++) { + clearTimeout(this.timeouts[i]); + } + }; -(function () { - 'use strict'; + /** + * Handsontable version + * + * @type {String} + */ + // this.version = Handsontable.version; - /************************************ - Constants - ************************************/ - - var numbro, - VERSION = '1.11.0', - binarySuffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], - decimalSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], - bytes = { - general: { scale: 1024, suffixes: decimalSuffixes, marker: 'bd' }, - binary: { scale: 1024, suffixes: binarySuffixes, marker: 'b' }, - decimal: { scale: 1000, suffixes: decimalSuffixes, marker: 'd' } - }, - // general must be before the others because it reuses their characters! - byteFormatOrder = [ bytes.general, bytes.binary, bytes.decimal ], - // internal storage for culture config files - cultures = {}, - // Todo: Remove in 2.0.0 - languages = cultures, - currentCulture = 'en-US', - zeroFormat = null, - defaultFormat = '0,0', - defaultCurrencyFormat = '0$', - // check for nodeJS - hasModule = (typeof module !== 'undefined' && module.exports), - // default culture - enUS = { - delimiters: { - thousands: ',', - decimal: '.' - }, - abbreviations: { - thousand: 'k', - million: 'm', - billion: 'b', - trillion: 't' - }, - ordinal: function(number) { - var b = number % 10; - return (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - }, - currency: { - symbol: '$', - position: 'prefix' - }, - defaults: { - currencyFormat: ',0000 a' - }, - formats: { - fourDigits: '0000 a', - fullWithTwoDecimals: '$ ,0.00', - fullWithTwoDecimalsNoCurrency: ',0.00' - } - }; + _pluginHooks2.default.getSingleton().run(instance, 'construct'); +}; - /************************************ - Constructors - ************************************/ +/***/ }), +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; - // Numbro prototype object - function Numbro(number) { - this._value = number; - } - function numberLength(number) { - if (number === 0) { return 1; } - return Math.floor(Math.log(Math.abs(number)) / Math.LN10) + 1; - } +exports.__esModule = true; +exports.spreadsheetColumnLabel = spreadsheetColumnLabel; +exports.spreadsheetColumnIndex = spreadsheetColumnIndex; +exports.createSpreadsheetData = createSpreadsheetData; +exports.createSpreadsheetObjectData = createSpreadsheetObjectData; +exports.createEmptySpreadsheetData = createEmptySpreadsheetData; +exports.translateRowsToColumns = translateRowsToColumns; +exports.cellMethodLookupFactory = cellMethodLookupFactory; - function zeroes(count) { - var i, ret = ''; +var _cellTypes = __webpack_require__(62); - for (i = 0; i < count; i++) { - ret += '0'; - } +var _object = __webpack_require__(1); - return ret; - } - /** - * Implementation of toFixed() for numbers with exponents - * This function may return negative representations for zero values e.g. "-0.0" - */ - function toFixedLargeSmall(value, precision) { - var mantissa, - beforeDec, - afterDec, - exponent, - prefix, - endStr, - zerosStr, - str; +var COLUMN_LABEL_BASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; +var COLUMN_LABEL_BASE_LENGTH = COLUMN_LABEL_BASE.length; - str = value.toString(); +/** + * 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 = void 0; - mantissa = str.split('e')[0]; - exponent = str.split('e')[1]; + 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); + } - beforeDec = mantissa.split('.')[0]; - afterDec = mantissa.split('.')[1] || ''; + return columnLabel; +} - if (+exponent > 0) { - // exponent is positive - add zeros after the numbers - str = beforeDec + afterDec + zeroes(exponent - afterDec.length); - } else { - // exponent is negative +/** + * 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 (+beforeDec < 0) { - prefix = '-0'; - } else { - prefix = '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; - // tack on the decimal point if needed - if (precision > 0) { - prefix += '.'; - } - - zerosStr = zeroes((-1 * exponent) - 1); - // substring off the end to satisfy the precision - endStr = (zerosStr + Math.abs(beforeDec) + afterDec).substr(0, precision); - str = prefix + endStr; - } - - // only add percision 0's if the exponent is positive - if (+exponent > 0 && precision > 0) { - str += '.' + zeroes(precision); - } - - return str; - } + return result; +} - /** - * Implementation of toFixed() that treats floats more like decimals - * - * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present - * problems for accounting- and finance-related software. - * - * Also removes negative signs for zero-formatted numbers. e.g. -0.01 w/ precision 1 -> 0.0 - */ - function toFixed(value, precision, roundingFunction, optionals) { - var power = Math.pow(10, precision), - optionalsRegExp, - output; +/** + * 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; - if (value.toString().indexOf('e') > -1) { - // toFixed returns scientific notation for numbers above 1e21 and below 1e-7 - output = toFixedLargeSmall(value, precision); - // remove the leading negative sign if it exists and should not be present (e.g. -0.00) - if (output.charAt(0) === '-' && +output >= 0) { - output = output.substr(1); // chop off the '-' - } - } - else { - // Multiply up by precision, round accurately, then divide and use native toFixed(): - output = (roundingFunction(value + 'e+' + precision) / power).toFixed(precision); - } + var _rows = [], + i, + j; - if (optionals) { - optionalsRegExp = new RegExp('0{1,' + optionals + '}$'); - output = output.replace(optionalsRegExp, ''); - } + for (i = 0; i < rows; i++) { + var row = []; - return output; + for (j = 0; j < columns; j++) { + row.push(spreadsheetColumnLabel(j) + (i + 1)); } + _rows.push(row); + } - /************************************ - Formatting - ************************************/ - - // determine what type of formatting we need to do - function formatNumbro(n, format, roundingFunction) { - var output, - escapedFormat = format.replace(/\{[^\{\}]*\}/g, ''); + return _rows; +} - // figure out what kind of format we are dealing with - if (escapedFormat.indexOf('$') > -1) { // currency!!!!! - output = formatCurrency(n, cultures[currentCulture].currency.symbol, format, roundingFunction); - } else if (escapedFormat.indexOf('%') > -1) { // percentage - output = formatPercentage(n, format, roundingFunction); - } else if (escapedFormat.indexOf(':') > -1) { // time - output = formatTime(n, format); - } else { // plain ol' numbers or bytes - output = formatNumber(n._value, format, roundingFunction); - } +/** + * 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; - // return string - return output; - } + var _rows = [], + i, + j; - // revert to number - function unformatNumbro(n, string) { - var stringOriginal = string, - thousandRegExp, - millionRegExp, - billionRegExp, - trillionRegExp, - bytesMultiplier = false, - power; + for (i = 0; i < rows; i++) { + var row = {}; - if (string.indexOf(':') > -1) { - n._value = unformatTime(string); - } else { - if (string === zeroFormat) { - n._value = 0; - } else { - if (cultures[currentCulture].delimiters.decimal !== '.') { - string = string.replace(/\./g, '').replace(cultures[currentCulture].delimiters.decimal, '.'); - } + for (j = 0; j < colCount; j++) { + row['prop' + j] = spreadsheetColumnLabel(j) + (i + 1); + } + _rows.push(row); + } - // see if abbreviations are there so that we can multiply to the correct number - thousandRegExp = new RegExp('[^a-zA-Z]' + cultures[currentCulture].abbreviations.thousand + - '(?:\\)|(\\' + cultures[currentCulture].currency.symbol + ')?(?:\\))?)?$'); - millionRegExp = new RegExp('[^a-zA-Z]' + cultures[currentCulture].abbreviations.million + - '(?:\\)|(\\' + cultures[currentCulture].currency.symbol + ')?(?:\\))?)?$'); - billionRegExp = new RegExp('[^a-zA-Z]' + cultures[currentCulture].abbreviations.billion + - '(?:\\)|(\\' + cultures[currentCulture].currency.symbol + ')?(?:\\))?)?$'); - trillionRegExp = new RegExp('[^a-zA-Z]' + cultures[currentCulture].abbreviations.trillion + - '(?:\\)|(\\' + cultures[currentCulture].currency.symbol + ')?(?:\\))?)?$'); - - // see if bytes are there so that we can multiply to the correct number - for (power = 1; power < binarySuffixes.length && !bytesMultiplier; ++power) { - if (string.indexOf(binarySuffixes[power]) > -1) { - bytesMultiplier = Math.pow(1024, power); - } else if (string.indexOf(decimalSuffixes[power]) > -1) { - bytesMultiplier = Math.pow(1000, power); - } - } + return _rows; +} - var str = string.replace(/[^0-9\.]+/g, ''); - if (str === '') { - // An empty string is not a number. - n._value = NaN; +/** + * 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 = void 0; - } else { - // do some math to create our number - n._value = ((bytesMultiplier) ? bytesMultiplier : 1) * - ((stringOriginal.match(thousandRegExp)) ? Math.pow(10, 3) : 1) * - ((stringOriginal.match(millionRegExp)) ? Math.pow(10, 6) : 1) * - ((stringOriginal.match(billionRegExp)) ? Math.pow(10, 9) : 1) * - ((stringOriginal.match(trillionRegExp)) ? Math.pow(10, 12) : 1) * - ((string.indexOf('%') > -1) ? 0.01 : 1) * - (((string.split('-').length + - Math.min(string.split('(').length - 1, string.split(')').length - 1)) % 2) ? 1 : -1) * - Number(str); - - // round if we are talking about bytes - n._value = (bytesMultiplier) ? Math.ceil(n._value) : n._value; - } - } - } - return n._value; - } - - function formatCurrency(n, currencySymbol, originalFormat, roundingFunction) { - var format = originalFormat, - symbolIndex = format.indexOf('$'), - openParenIndex = format.indexOf('('), - plusSignIndex = format.indexOf('+'), - minusSignIndex = format.indexOf('-'), - space = '', - decimalSeparator = '', - spliceIndex, - output; - - if(format.indexOf('$') === -1){ - // Use defaults instead of the format provided - if (cultures[currentCulture].currency.position === 'infix') { - decimalSeparator = currencySymbol; - if (cultures[currentCulture].currency.spaceSeparated) { - decimalSeparator = ' ' + decimalSeparator + ' '; - } - } else if (cultures[currentCulture].currency.spaceSeparated) { - space = ' '; - } - } else { - // check for space before or after currency - if (format.indexOf(' $') > -1) { - space = ' '; - format = format.replace(' $', ''); - } else if (format.indexOf('$ ') > -1) { - space = ' '; - format = format.replace('$ ', ''); - } else { - format = format.replace('$', ''); - } - } + for (var i = 0; i < rows; i++) { + row = []; + for (var j = 0; j < columns; j++) { + row.push(''); + } + data.push(row); + } - // Format The Number - output = formatNumber(n._value, format, roundingFunction, decimalSeparator); + return data; +} - if (originalFormat.indexOf('$') === -1) { - // Use defaults instead of the format provided - switch (cultures[currentCulture].currency.position) { - case 'postfix': - if (output.indexOf(')') > -1) { - output = output.split(''); - output.splice(-1, 0, space + currencySymbol); - output = output.join(''); - } else { - output = output + space + currencySymbol; - } - break; - case 'infix': - break; - case 'prefix': - if (output.indexOf('(') > -1 || output.indexOf('-') > -1) { - output = output.split(''); - spliceIndex = Math.max(openParenIndex, minusSignIndex) + 1; - - output.splice(spliceIndex, 0, currencySymbol + space); - output = output.join(''); - } else { - output = currencySymbol + space + output; - } - break; - default: - throw Error('Currency position should be among ["prefix", "infix", "postfix"]'); - } - } else { - // position the symbol - if (symbolIndex <= 1) { - if (output.indexOf('(') > -1 || output.indexOf('+') > -1 || output.indexOf('-') > -1) { - output = output.split(''); - spliceIndex = 1; - if (symbolIndex < openParenIndex || symbolIndex < plusSignIndex || symbolIndex < minusSignIndex) { - // the symbol appears before the "(", "+" or "-" - spliceIndex = 0; - } - output.splice(spliceIndex, 0, currencySymbol + space); - output = output.join(''); - } else { - output = currencySymbol + space + output; - } - } else { - if (output.indexOf(')') > -1) { - output = output.split(''); - output.splice(-1, 0, space + currencySymbol); - output = output.join(''); - } else { - output = output + space + currencySymbol; - } - } - } +function translateRowsToColumns(input) { + var i, + ilen, + j, + jlen, + output = [], + olen = 0; - return output; + 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++; + } + output[j].push(input[i][j]); } + } - function formatForeignCurrency(n, foreignCurrencySymbol, originalFormat, roundingFunction) { - return formatCurrency(n, foreignCurrencySymbol, originalFormat, roundingFunction); - } + return output; +} - function formatPercentage(n, format, roundingFunction) { - var space = '', - output, - value = n._value * 100; +/** + * 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 methodName {String} name of the method/property to search (i.e. 'renderer', 'validator', 'copyable') + * @param allowUndefined {Boolean} [optional] if false, the search is continued if methodName has not been found in cell "type" + * @returns {Function} + */ +function cellMethodLookupFactory(methodName, allowUndefined) { - // check for space before % - if (format.indexOf(' %') > -1) { - space = ' '; - format = format.replace(' %', ''); - } else { - format = format.replace('%', ''); - } + allowUndefined = typeof allowUndefined == 'undefined' ? true : allowUndefined; - output = formatNumber(value, format, roundingFunction); + return function cellMethodLookup(row, col) { + return function getMethodFromProperties(properties) { - if (output.indexOf(')') > -1) { - output = output.split(''); - output.splice(-1, 0, space + '%'); - output = output.join(''); - } else { - output = output + space + '%'; - } - - return output; - } - - function formatTime(n) { - var hours = Math.floor(n._value / 60 / 60), - minutes = Math.floor((n._value - (hours * 60 * 60)) / 60), - seconds = Math.round(n._value - (hours * 60 * 60) - (minutes * 60)); - return hours + ':' + - ((minutes < 10) ? '0' + minutes : minutes) + ':' + - ((seconds < 10) ? '0' + seconds : seconds); - } - - function unformatTime(string) { - var timeArray = string.split(':'), - seconds = 0; - // turn hours and minutes into seconds and add them all up - if (timeArray.length === 3) { - // hours - seconds = seconds + (Number(timeArray[0]) * 60 * 60); - // minutes - seconds = seconds + (Number(timeArray[1]) * 60); - // seconds - seconds = seconds + Number(timeArray[2]); - } else if (timeArray.length === 2) { - // minutes - seconds = seconds + (Number(timeArray[0]) * 60); - // seconds - seconds = seconds + Number(timeArray[1]); - } - return Number(seconds); - } - - function formatByteUnits (value, suffixes, scale) { - var suffix = suffixes[0], - power, - min, - max, - abs = Math.abs(value); - - if (abs >= scale) { - for (power = 1; power < suffixes.length; ++power) { - min = Math.pow(scale, power); - max = Math.pow(scale, power + 1); - - if (abs >= min && abs < max) { - suffix = suffixes[power]; - value = value / min; - break; - } - } + if (!properties) { + return; // method not found + } else 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 + var type; - // values greater than or equal to [scale] YB never set the suffix - if (suffix === suffixes[0]) { - value = value / Math.pow(scale, suffixes.length - 1); - suffix = suffixes[suffixes.length - 1]; - } + if (typeof properties.type != 'string') { + throw new Error('Cell type must be a string '); } + type = (0, _cellTypes.getCellType)(properties.type); - return { value: value, suffix: suffix }; - } - - function formatNumber (value, format, roundingFunction, sep) { - var negP = false, - signed = false, - optDec = false, - abbr = '', - abbrK = false, // force abbreviation to thousands - abbrM = false, // force abbreviation to millions - abbrB = false, // force abbreviation to billions - abbrT = false, // force abbreviation to trillions - abbrForce = false, // force abbreviation - bytes = '', - byteFormat, - units, - ord = '', - abs = Math.abs(value), - totalLength, - length, - minimumPrecision, - pow, - w, - intPrecision, - precision, - prefix, - postfix, - thousands, - d = '', - forcedNeg = false, - neg = false, - indexOpenP, - indexMinus, - paren = '', - minlen, - i; - - // check if number is zero and a custom zero format has been set - if (value === 0 && zeroFormat !== null) { - return zeroFormat; - } - - if (!isFinite(value)) { - return '' + value; - } - - if (format.indexOf('{') === 0) { - var end = format.indexOf('}'); - if (end === -1) { - throw Error('Format should also contain a "}"'); - } - prefix = format.slice(1, end); - format = format.slice(end + 1); - } else { - prefix = ''; + if ((0, _object.hasOwnProperty)(type, methodName)) { + return type[methodName]; // method defined in type. + } else if (allowUndefined) { + return; // method does not defined in type (eg. validator), returns undefined } + } - if (format.indexOf('}') === format.length - 1 && format.length) { - var start = format.indexOf('{'); - if (start === -1) { - throw Error('Format should also contain a "{"'); - } - postfix = format.slice(start + 1, -1); - format = format.slice(0, start + 1); - } else { - postfix = ''; - } + return getMethodFromProperties(Object.getPrototypeOf(properties)); + }(typeof row == 'number' ? this.getCellMeta(row, col) : row); + }; +} - // check for min length - var info; - if (format.indexOf('.') === -1) { - info = format.match(/([0-9]+).*/); - } else { - info = format.match(/([0-9]+)\..*/); - } - minlen = info === null ? -1 : info[1].length; - - // see if we should use parentheses for negative number or if we should prefix with a sign - // if both are present we default to parentheses - if (format.indexOf('-') !== -1) { - forcedNeg = true; - } - if (format.indexOf('(') > -1) { - negP = true; - format = format.slice(1, -1); - } else if (format.indexOf('+') > -1) { - signed = true; - format = format.replace(/\+/g, ''); - } - - // see if abbreviation is wanted - if (format.indexOf('a') > -1) { - intPrecision = format.split('.')[0].match(/[0-9]+/g) || ['0']; - intPrecision = parseInt(intPrecision[0], 10); - - // check if abbreviation is specified - abbrK = format.indexOf('aK') >= 0; - abbrM = format.indexOf('aM') >= 0; - abbrB = format.indexOf('aB') >= 0; - abbrT = format.indexOf('aT') >= 0; - abbrForce = abbrK || abbrM || abbrB || abbrT; - - // check for space before abbreviation - if (format.indexOf(' a') > -1) { - abbr = ' '; - format = format.replace(' a', ''); - } else { - format = format.replace('a', ''); - } +/***/ }), +/* 65 */ +/***/ (function(module, exports, __webpack_require__) { - totalLength = numberLength(value); - minimumPrecision = totalLength % 3; - minimumPrecision = minimumPrecision === 0 ? 3 : minimumPrecision; +"use strict"; - if (intPrecision && abs !== 0) { - pow = 3 * ~~((Math.min(intPrecision, totalLength) - minimumPrecision) / 3); - abs = abs / Math.pow(10, pow); - } - if (totalLength !== intPrecision) { - if (abs >= Math.pow(10, 12) && !abbrForce || abbrT) { - // trillion - abbr = abbr + cultures[currentCulture].abbreviations.trillion; - value = value / Math.pow(10, 12); - } else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !abbrForce || abbrB) { - // billion - abbr = abbr + cultures[currentCulture].abbreviations.billion; - value = value / Math.pow(10, 9); - } else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !abbrForce || abbrM) { - // million - abbr = abbr + cultures[currentCulture].abbreviations.million; - value = value / Math.pow(10, 6); - } else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !abbrForce || abbrK) { - // thousand - abbr = abbr + cultures[currentCulture].abbreviations.thousand; - value = value / Math.pow(10, 3); - } - } +exports.__esModule = true; +exports.columnFactory = columnFactory; - length = numberLength(value); - if (intPrecision && length < intPrecision && format.indexOf('.') === -1) { - format += '[.]'; - format += zeroes(intPrecision - length); - } - } +var _object = __webpack_require__(1); - // see if we are formatting - // binary-decimal bytes (1024 MB), binary bytes (1024 MiB), or decimal bytes (1000 MB) - for (i = 0; i < byteFormatOrder.length; ++i) { - byteFormat = byteFormatOrder[i]; +/* eslint-disable import/prefer-default-export */ +/** + * Factory for columns constructors. + * + * @param {Object} GridSettings + * @param {Array} conflictList + * @return {Object} ColumnSettings + */ +function columnFactory(GridSettings, conflictList) { + function ColumnSettings() {}; - if (format.indexOf(byteFormat.marker) > -1) { - // check for space before - if (format.indexOf(' ' + byteFormat.marker) >-1) { - bytes = ' '; - } + (0, _object.inherit)(ColumnSettings, GridSettings); - // remove the marker (with the space if it had one) - format = format.replace(bytes + byteFormat.marker, ''); + // Clear conflict settings + for (var i = 0, len = conflictList.length; i < len; i++) { + ColumnSettings.prototype[conflictList[i]] = void 0; + } - units = formatByteUnits(value, byteFormat.suffixes, byteFormat.scale); + return ColumnSettings; +} - value = units.value; - bytes = bytes + units.suffix; +/***/ }), +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { - break; - } - } +"use strict"; - // see if ordinal is wanted - if (format.indexOf('o') > -1) { - // check for space before - if (format.indexOf(' o') > -1) { - ord = ' '; - format = format.replace(' o', ''); - } else { - format = format.replace('o', ''); - } - if (cultures[currentCulture].ordinal) { - ord = ord + cultures[currentCulture].ordinal(value); - } - } +exports.__esModule = true; - if (format.indexOf('[.]') > -1) { - optDec = true; - format = format.replace('[.]', '.'); - } +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - precision = format.split('.')[1]; - thousands = format.indexOf(','); +var _element = __webpack_require__(0); - if (precision) { - var dSplit = []; +var _array = __webpack_require__(2); - if (precision.indexOf('*') !== -1) { - d = value.toString(); - dSplit = d.split('.'); - if (dSplit.length > 1) { - d = toFixed(value, dSplit[1].length, roundingFunction); - } - } else { - if (precision.indexOf('[') > -1) { - precision = precision.replace(']', ''); - precision = precision.split('['); - d = toFixed(value, (precision[0].length + precision[1].length), roundingFunction, - precision[1].length); - } else { - d = toFixed(value, precision.length, roundingFunction); - } - } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - dSplit = d.split('.'); - w = dSplit[0]; +/** + * @class GhostTable + * @util + */ +var GhostTable = function () { + function GhostTable(hotInstance) { + _classCallCheck(this, GhostTable); - if (dSplit.length > 1 && dSplit[1].length) { - var p = sep ? abbr + sep : cultures[currentCulture].delimiters.decimal; - d = p + dSplit[1]; - } else { - d = ''; - } + /** + * 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 + }; + } - if (optDec && Number(d.slice(1)) === 0) { - d = ''; - } - } else { - w = toFixed(value, 0, roundingFunction); - } + /** + * Add row. + * + * @param {Number} row Row index. + * @param {Map} samples Samples Map object. + */ - // format number - if (w.indexOf('-') > -1) { - w = w.slice(1); - neg = true; - } - if (w.length < minlen) { - w = zeroes(minlen - w.length) + w; - } + _createClass(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); - if (thousands > -1) { - w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + - cultures[currentCulture].delimiters.thousands); - } + 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); - if (format.indexOf('.') === 0) { - w = ''; - } + rowObject.table = this.table.table; + } - indexOpenP = format.indexOf('('); - indexMinus = format.indexOf('-'); + /** + * Add a row consisting of the column headers. + */ - if (indexOpenP < indexMinus) { - paren = ((negP && neg) ? '(' : '') + (((forcedNeg && neg) || (!negP && neg)) ? '-' : ''); - } else { - paren = (((forcedNeg && neg) || (!negP && neg)) ? '-' : '') + ((negP && neg) ? '(' : ''); - } + }, { + key: 'addColumnHeadersRow', + value: function addColumnHeadersRow(samples) { + if (this.hot.getColHeader(0) != null) { + var rowObject = { row: -1 }; + this.rows.push(rowObject); + + this.container = this.createContainer(this.hot.rootElement.className); - return prefix + - paren + ((!neg && signed && value !== 0) ? '+' : '') + - w + d + - ((ord) ? ord : '') + - ((abbr && !sep) ? abbr : '') + - ((bytes) ? bytes : '') + - ((negP && neg) ? ')' : '') + - postfix; + this.samples = samples; + this.table = this.createTable(this.hot.table.className); + this.table.colGroup.appendChild(this.createColGroupsCol()); + this.table.tHead.appendChild(this.createColumnHeadersRow()); + this.container.container.appendChild(this.table.fragment); + + rowObject.table = this.table.table; + } } - /************************************ - Top Level Functions - ************************************/ + /** + * Add column. + * + * @param {Number} column Column index. + * @param {Map} samples Samples Map object. + */ - numbro = function(input) { - if (numbro.isNumbro(input)) { - input = input.value(); - } else if (typeof input === 'string' || typeof input === 'number') { - input = numbro.fn.unformat(input); - } else { - input = NaN; - } + }, { + 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); - return new Numbro(Number(input)); - }; + this.samples = samples; + this.table = this.createTable(this.hot.table.className); - // version number - numbro.version = VERSION; + if (this.getSetting('useHeaders') && this.hot.getColHeader(column) !== null) { + this.hot.view.appendColHeader(column, this.table.th); + } + this.table.tBody.appendChild(this.createCol(column)); + this.container.container.appendChild(this.table.fragment); - // compare numbro object - numbro.isNumbro = function(obj) { - return obj instanceof Numbro; - }; + columnObject.table = this.table.table; + } /** - * This function allow the user to set a new language with a fallback if - * the language does not exist. If no fallback language is provided, - * it fallbacks to english. + * Get calculated heights. * - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `setCulture` should be used instead. + * @param {Function} callback Callback which will be fired for each calculated row. */ - numbro.setLanguage = function(newLanguage, fallbackLanguage) { - console.warn('`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead'); - var key = newLanguage, - prefix = newLanguage.split('-')[0], - matchingLanguage = null; - if (!languages[key]) { - Object.keys(languages).forEach(function(language) { - if (!matchingLanguage && language.split('-')[0] === prefix) { - matchingLanguage = language; - } - }); - key = matchingLanguage || fallbackLanguage || 'en-US'; - } - chooseCulture(key); - }; + + }, { + 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); + }); + } /** - * This function allow the user to set a new culture with a fallback if - * the culture does not exist. If no fallback culture is provided, - * it falls back to "en-US". + * Get calculated widths. + * + * @param {Function} callback Callback which will be fired for each calculated column. */ - numbro.setCulture = function(newCulture, fallbackCulture) { - var key = newCulture, - suffix = newCulture.split('-')[1], - matchingCulture = null; - if (!cultures[key]) { - if (suffix) { - Object.keys(cultures).forEach(function(language) { - if (!matchingCulture && language.split('-')[1] === suffix) { - matchingCulture = language; - } - }); - } - key = matchingCulture || fallbackCulture || 'en-US'; - } - chooseCulture(key); - }; + }, { + 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)); + }); + } /** - * This function will load languages and then set the global language. If - * no arguments are passed in, it will simply return the current global - * language key. + * Set the Ghost Table settings to the provided object. * - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `culture` should be used instead. + * @param {Object} settings New Ghost Table Settings */ - numbro.language = function(key, values) { - console.warn('`language` is deprecated since version 1.6.0. Use `culture` instead'); - - if (!key) { - return currentCulture; - } - - if (key && !values) { - if (!languages[key]) { - throw new Error('Unknown language : ' + key); - } - chooseCulture(key); - } - if (values || !languages[key]) { - setCulture(key, values); - } - - return numbro; - }; + }, { + key: 'setSettings', + value: function setSettings(settings) { + this.settings = settings; + } /** - * This function will load cultures and then set the global culture. If - * no arguments are passed in, it will simply return the current global - * culture code. + * Set a single setting of the Ghost Table. + * + * @param {String} name Setting name. + * @param {*} value Setting value. */ - numbro.culture = function(code, values) { - if (!code) { - return currentCulture; - } - - if (code && !values) { - if (!cultures[code]) { - throw new Error('Unknown culture : ' + code); - } - chooseCulture(code); - } - if (values || !cultures[code]) { - setCulture(code, values); - } + }, { + key: 'setSetting', + value: function setSetting(name, value) { + if (!this.settings) { + this.settings = {}; + } - return numbro; - }; + this.settings[name] = value; + } /** - * This function provides access to the loaded language data. If - * no arguments are passed in, it will simply return the current - * global language object. + * Get the Ghost Table settings. * - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `culture` should be used instead. + * @returns {Object|null} */ - numbro.languageData = function(key) { - console.warn('`languageData` is deprecated since version 1.6.0. Use `cultureData` instead'); - - if (!key) { - return languages[currentCulture]; - } - - if (!languages[key]) { - throw new Error('Unknown language : ' + key); - } - return languages[key]; - }; + }, { + key: 'getSettings', + value: function getSettings() { + return this.settings; + } /** - * This function provides access to the loaded culture data. If - * no arguments are passed in, it will simply return the current - * global culture object. + * Get a single Ghost Table setting. + * + * @param {String} name + * @returns {Boolean|null} */ - numbro.cultureData = function(code) { - if (!code) { - return cultures[currentCulture]; - } - - if (!cultures[code]) { - throw new Error('Unknown culture : ' + code); - } - - return cultures[code]; - }; - numbro.culture('en-US', enUS); + }, { + key: 'getSetting', + value: function getSetting(name) { + if (this.settings) { + return this.settings[name]; + } + return null; + } /** - * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `cultures` should be used instead. + * Create colgroup col elements. + * + * @returns {DocumentFragment} */ - numbro.languages = function() { - console.warn('`languages` is deprecated since version 1.6.0. Use `cultures` instead'); - return languages; - }; + }, { + key: 'createColGroupsCol', + value: function createColGroupsCol() { + var _this = this; - numbro.cultures = function() { - return cultures; - }; + var d = document; + var fragment = d.createDocumentFragment(); - numbro.zeroFormat = function(format) { - zeroFormat = typeof(format) === 'string' ? format : null; - }; + if (this.hot.hasRowHeaders()) { + fragment.appendChild(this.createColElement(-1)); + } - numbro.defaultFormat = function(format) { - defaultFormat = typeof(format) === 'string' ? format : '0.0'; - }; + this.samples.forEach(function (sample) { + (0, _array.arrayEach)(sample.strings, function (string) { + fragment.appendChild(_this.createColElement(string.col)); + }); + }); - numbro.defaultCurrencyFormat = function (format) { - defaultCurrencyFormat = typeof(format) === 'string' ? format : '0$'; - }; + return fragment; + } - numbro.validate = function(val, culture) { - - var _decimalSep, - _thousandSep, - _currSymbol, - _valArray, - _abbrObj, - _thousandRegEx, - cultureData, - temp; - - //coerce val to string - if (typeof val !== 'string') { - val += ''; - if (console.warn) { - console.warn('Numbro.js: Value is not string. It has been co-erced to: ', val); - } - } + /** + * Create table row element. + * + * @param {Number} row Row index. + * @returns {DocumentFragment} Returns created table row elements. + */ - //trim whitespaces from either sides - val = val.trim(); + }, { + key: 'createRow', + value: function createRow(row) { + var _this2 = this; - //replace the initial '+' or '-' sign if present - val = val.replace(/^[+-]?/, ''); + var d = document; + var fragment = d.createDocumentFragment(); + var th = d.createElement('th'); - //if val is just digits return true - if ( !! val.match(/^\d+$/)) { - return true; - } - - //if val is empty return false - if (val === '') { - return false; - } - - //get the decimal and thousands separator from numbro.cultureData - try { - //check if the culture is understood by numbro. if not, default it to current culture - cultureData = numbro.cultureData(culture); - } catch (e) { - cultureData = numbro.cultureData(numbro.culture()); - } - - //setup the delimiters and currency symbol based on culture - _currSymbol = cultureData.currency.symbol; - _abbrObj = cultureData.abbreviations; - _decimalSep = cultureData.delimiters.decimal; - if (cultureData.delimiters.thousands === '.') { - _thousandSep = '\\.'; - } else { - _thousandSep = cultureData.delimiters.thousands; - } - - // validating currency symbol - temp = val.match(/^[^\d\.\,]+/); - if (temp !== null) { - val = val.substr(1); - if (temp[0] !== _currSymbol) { - return false; - } - } + if (this.hot.hasRowHeaders()) { + this.hot.view.appendRowHeader(row, th); - //validating abbreviation symbol - temp = val.match(/[^\d]+$/); - if (temp !== null) { - val = val.slice(0, -1); - if (temp[0] !== _abbrObj.thousand && temp[0] !== _abbrObj.million && - temp[0] !== _abbrObj.billion && temp[0] !== _abbrObj.trillion) { - return false; - } - } + fragment.appendChild(th); + } - _thousandRegEx = new RegExp(_thousandSep + '{2}'); + this.samples.forEach(function (sample) { + (0, _array.arrayEach)(sample.strings, function (string) { + var column = string.col; + var cellProperties = _this2.hot.getCellMeta(row, column); - if (!val.match(/[^\d.,]/g)) { - _valArray = val.split(_decimalSep); - if (_valArray.length > 2) { - return false; - } else { - if (_valArray.length < 2) { - return ( !! _valArray[0].match(/^\d+.*\d$/) && !_valArray[0].match(_thousandRegEx)); - } else { - if (_valArray[0] === '') { - // for values without leading zero eg. .984 - return (!_valArray[0].match(_thousandRegEx) && - !!_valArray[1].match(/^\d+$/)); - - } else if (_valArray[0].length === 1) { - return ( !! _valArray[0].match(/^\d+$/) && - !_valArray[0].match(_thousandRegEx) && - !! _valArray[1].match(/^\d+$/)); - } else { - return ( !! _valArray[0].match(/^\d+.*\d$/) && - !_valArray[0].match(_thousandRegEx) && - !! _valArray[1].match(/^\d+$/)); - } - } - } - } + cellProperties.col = column; + cellProperties.row = row; - return false; - }; + var renderer = _this2.hot.getCellRenderer(cellProperties); + var td = d.createElement('td'); - /** - * * @deprecated Since in version 1.6.0. It will be deleted in version 2.0 - * `loadCulturesInNode` should be used instead. - */ - numbro.loadLanguagesInNode = function() { - console.warn('`loadLanguagesInNode` is deprecated since version 1.6.0. Use `loadCulturesInNode` instead'); + renderer(_this2.hot, td, row, column, _this2.hot.colToProp(column), string.value, cellProperties); + fragment.appendChild(td); + }); + }); - numbro.loadCulturesInNode(); - }; + return fragment; + } + }, { + key: 'createColumnHeadersRow', + value: function createColumnHeadersRow() { + var _this3 = this; - numbro.loadCulturesInNode = function() { - // TODO: Rename the folder in 2.0.0 - var cultures = __webpack_require__(297); + var d = document; + var fragment = d.createDocumentFragment(); - for(var langLocaleCode in cultures) { - if(langLocaleCode) { - numbro.culture(langLocaleCode, cultures[langLocaleCode]); - } - } - }; + if (this.hot.hasRowHeaders()) { + var th = d.createElement('th'); + this.hot.view.appendColHeader(-1, th); + fragment.appendChild(th); + } - /************************************ - Helpers - ************************************/ + this.samples.forEach(function (sample) { + (0, _array.arrayEach)(sample.strings, function (string) { + var column = string.col; - function setCulture(code, values) { - cultures[code] = values; - } + var th = d.createElement('th'); - function chooseCulture(code) { - currentCulture = code; - var defaults = cultures[code].defaults; - if (defaults && defaults.format) { - numbro.defaultFormat(defaults.format); - } - if (defaults && defaults.currencyFormat) { - numbro.defaultCurrencyFormat(defaults.currencyFormat); - } - } + _this3.hot.view.appendColHeader(column, th); + fragment.appendChild(th); + }); + }); - function inNodejsRuntime() { - return (typeof process !== 'undefined') && - (process.browser === undefined) && - process.title && - ( - process.title.indexOf('node') !== -1 || - process.title.indexOf('meteor-tool') > 0 || - process.title === 'grunt' || - process.title === 'gulp' - ) && - ("function" !== 'undefined'); + return fragment; } - /************************************ - Floating-point helpers - ************************************/ - - // The floating-point helper functions and implementation - // borrows heavily from sinful.js: http://guipn.github.io/sinful.js/ - /** - * Array.prototype.reduce for browsers that don't support it - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce#Compatibility + * Create table column elements. + * + * @param {Number} column Column index. + * @returns {DocumentFragment} Returns created column table column elements. */ - if ('function' !== typeof Array.prototype.reduce) { - Array.prototype.reduce = function(callback, optInitialValue) { - if (null === this || 'undefined' === typeof this) { - // At the moment all modern browsers, that support strict mode, have - // native implementation of Array.prototype.reduce. For instance, IE8 - // does not support strict mode, so this check is actually useless. - throw new TypeError('Array.prototype.reduce called on null or undefined'); - } + }, { + key: 'createCol', + value: function createCol(column) { + var _this4 = this; - if ('function' !== typeof callback) { - throw new TypeError(callback + ' is not a function'); - } + var d = document; + var fragment = d.createDocumentFragment(); - var index, - value, - length = this.length >>> 0, - isValueSet = false; + this.samples.forEach(function (sample) { + (0, _array.arrayEach)(sample.strings, function (string) { + var row = string.row; + var cellProperties = _this4.hot.getCellMeta(row, column); - if (1 < arguments.length) { - value = optInitialValue; - isValueSet = true; - } + cellProperties.col = column; + cellProperties.row = row; - for (index = 0; length > index; ++index) { - if (this.hasOwnProperty(index)) { - if (isValueSet) { - value = callback(value, this[index], index, this); - } else { - value = this[index]; - isValueSet = true; - } - } - } + var renderer = _this4.hot.getCellRenderer(cellProperties); + var td = d.createElement('td'); + var tr = d.createElement('tr'); - if (!isValueSet) { - throw new TypeError('Reduce of empty array with no initial value'); - } + renderer(_this4.hot, td, row, column, _this4.hot.colToProp(column), string.value, cellProperties); + tr.appendChild(td); + fragment.appendChild(tr); + }); + }); - return value; - }; + return fragment; } - /** - * Computes the multiplier necessary to make x >= 1, - * effectively eliminating miscalculations caused by - * finite precision. + * Remove table from document and reset internal state. */ - function multiplier(x) { - var parts = x.toString().split('.'); - if (parts.length < 2) { - return 1; - } - return Math.pow(10, parts[1].length); + + }, { + 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(); } /** - * Given a variable number of arguments, returns the maximum - * multiplier that must be used to normalize an operation involving - * all of them. + * Inject generated table into document. + * + * @param {HTMLElement} [parent=null] */ - function correctionFactor() { - var args = Array.prototype.slice.call(arguments); - return args.reduce(function(prev, next) { - var mp = multiplier(prev), - mn = multiplier(next); - return mp > mn ? mp : mn; - }, -Infinity); - } - /************************************ - Numbro Prototype - ************************************/ + }, { + 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; + } + } - numbro.fn = Numbro.prototype = { + /** + * Remove table from document. + */ - clone: function() { - return numbro(this); - }, + }, { + 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; + } + } - format: function(inputString, roundingFunction) { - return formatNumbro(this, - inputString ? inputString : defaultFormat, - (roundingFunction !== undefined) ? roundingFunction : Math.round - ); - }, + /** + * Create col element. + * + * @param {Number} column Column index. + * @returns {HTMLElement} + */ - formatCurrency: function(inputString, roundingFunction) { - return formatCurrency(this, - cultures[currentCulture].currency.symbol, - inputString ? inputString : defaultCurrencyFormat, - (roundingFunction !== undefined) ? roundingFunction : Math.round - ); - }, + }, { + key: 'createColElement', + value: function createColElement(column) { + var d = document; + var col = d.createElement('col'); - formatForeignCurrency: function(currencySymbol, inputString, roundingFunction) { - return formatForeignCurrency(this, - currencySymbol, - inputString ? inputString : defaultCurrencyFormat, - (roundingFunction !== undefined) ? roundingFunction : Math.round - ); - }, + col.style.width = this.hot.view.wt.wtTable.getStretchedColumnWidth(column) + 'px'; - unformat: function(inputString) { - if (typeof inputString === 'number') { - return inputString; - } else if (typeof inputString === 'string') { - var result = unformatNumbro(this, inputString); + return col; + } - // Any unparseable string (represented as NaN in the result) is - // converted into undefined. - return isNaN(result) ? undefined : result; - } else { - return undefined; - } - }, + /** + * Create table element. + * + * @param {String} className + * @returns {Object} + */ - binaryByteUnits: function() { - return formatByteUnits(this._value, bytes.binary.suffixes, bytes.binary.scale).suffix; - }, + }, { + key: 'createTable', + value: function createTable() { + var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - byteUnits: function() { - return formatByteUnits(this._value, bytes.general.suffixes, bytes.general.scale).suffix; - }, + var d = document; + var fragment = d.createDocumentFragment(); + var table = d.createElement('table'); + var tHead = d.createElement('thead'); + var tBody = d.createElement('tbody'); + var colGroup = d.createElement('colgroup'); + var tr = d.createElement('tr'); + var th = d.createElement('th'); - decimalByteUnits: function() { - return formatByteUnits(this._value, bytes.decimal.suffixes, bytes.decimal.scale).suffix; - }, + 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); - value: function() { - return this._value; - }, + if (this.isVertical()) { + tBody.appendChild(tr); + } + table.appendChild(tBody); + (0, _element.addClass)(table, className); + fragment.appendChild(table); - valueOf: function() { - return this._value; - }, + return { fragment: fragment, table: table, tHead: tHead, tBody: tBody, colGroup: colGroup, tr: tr, th: th }; + } - set: function(value) { - this._value = Number(value); - return this; - }, + /** + * Create container for tables. + * + * @param {String} className + * @returns {Object} + */ - add: function(value) { - var corrFactor = correctionFactor.call(null, this._value, value); + }, { + key: 'createContainer', + value: function createContainer() { + var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - function cback(accum, curr) { - return accum + corrFactor * curr; - } - this._value = [this._value, value].reduce(cback, 0) / corrFactor; - return this; - }, + var d = document; + var fragment = d.createDocumentFragment(); + var container = d.createElement('div'); - subtract: function(value) { - var corrFactor = correctionFactor.call(null, this._value, value); + className = 'htGhostTable htAutoSize ' + className.trim(); + (0, _element.addClass)(container, className); + fragment.appendChild(container); - function cback(accum, curr) { - return accum - corrFactor * curr; - } - this._value = [value].reduce(cback, this._value * corrFactor) / corrFactor; - return this; - }, + return { fragment: fragment, container: container }; + } - multiply: function(value) { - function cback(accum, curr) { - var corrFactor = correctionFactor(accum, curr), - result = accum * corrFactor; - result *= curr * corrFactor; - result /= corrFactor * corrFactor; - return result; - } - this._value = [this._value, value].reduce(cback, 1); - return this; - }, + /** + * Checks if table is raised vertically (checking rows). + * + * @returns {Boolean} + */ - divide: function(value) { - function cback(accum, curr) { - var corrFactor = correctionFactor(accum, curr); - return (accum * corrFactor) / (curr * corrFactor); - } - this._value = [this._value, value].reduce(cback); - return this; - }, + }, { + key: 'isVertical', + value: function isVertical() { + return !!(this.rows.length && !this.columns.length); + } - difference: function(value) { - return Math.abs(numbro(this._value).subtract(value).value()); - } + /** + * Checks if table is raised horizontally (checking columns). + * + * @returns {Boolean} + */ - }; + }, { + key: 'isHorizontal', + value: function isHorizontal() { + return !!(this.columns.length && !this.rows.length); + } + }]); - /************************************ - Exposing Numbro - ************************************/ + return GhostTable; +}(); - if (inNodejsRuntime()) { - //Todo: Rename the folder in 2.0.0 - numbro.loadCulturesInNode(); - } +exports.default = GhostTable; - // CommonJS module is defined - if (hasModule) { - module.exports = numbro; - } else { - /*global ender:false */ - if (typeof ender === 'undefined') { - // here, `this` means `window` in the browser, or `global` on the server - // add `numbro` as a global object via a string identifier, - // for Closure Compiler 'advanced' mode - this.numbro = numbro; - } +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { - /*global define:false */ - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { - return numbro; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } - } +"use strict"; + +var addToUnscopables = __webpack_require__(37) + , step = __webpack_require__(167) + , Iterators = __webpack_require__(45) + , toIObject = __webpack_require__(23); -}.call(typeof window === 'undefined' ? this : window)); +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +module.exports = __webpack_require__(166)(Array, 'Array', function(iterated, kind){ + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function(){ + var O = this._t + , kind = this._k + , index = this._i++; + if(!O || index >= O.length){ + this._t = undefined; + return step(1); + } + if(kind == 'keys' )return step(0, index); + if(kind == 'values')return step(0, O[index]); + return step(0, [index, O[index]]); +}, 'values'); +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +Iterators.Arguments = Iterators.Array; -/*** EXPORTS FROM exports-to-window-loader ***/ -window['numbro'] = __webpack_require__(51); +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); /***/ }), -/* 52 */ +/* 68 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; -exports.default = staticRegister; -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var collection = exports.collection = new Map(); +var _coords = __webpack_require__(42); -function staticRegister() { - var namespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'common'; +var _coords2 = _interopRequireDefault(_coords); - if (!collection.has(namespace)) { - collection.set(namespace, new Map()); - } - var subCollection = collection.get(namespace); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - /** - * 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); - } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +/** + * A cell range is a set of exactly two CellCoords (that can be the same or different) + * + * @class CellRange + */ +var CellRange = function () { /** - * Retrieve the item from the collection. - * - * @param {String} name Identification of the item. - * @returns {*} Returns item which was saved in the collection. + * @param {CellCoords} highlight Used to draw bold border around a cell where selection was + * started and to edit the cell when you press Enter + * @param {CellCoords} from Usually the same as highlight, but in Excel there is distinction - one can change + * highlight within a selection + * @param {CellCoords} to End selection */ - function getItem(name) { - return subCollection.get(name); - } + function CellRange(highlight, from, to) { + _classCallCheck(this, CellRange); - /** - * Check if item under specyfied name is exists. - * - * @param {String} name Identification of the item. - * @returns {Boolean} Returns `true` or `false` depends on if element exists in the collection. - */ - function hasItem(name) { - return subCollection.has(name); + this.highlight = highlight; + this.from = from; + this.to = to; } /** - * Retrieve list of names registered from the collection. + * Checks if given coords are valid in context of a given Walkontable instance * - * @returns {Array} Returns an array of strings with all names under which objects are stored. + * @param {Walkontable} wotInstance + * @returns {Boolean} */ - function getNames() { - return [].concat(_toConsumableArray(subCollection.keys())); - } - /** - * Retrieve all registered values from the collection. - * - * @returns {Array} Returns an array with all values stored in the collection. - */ - function getValues() { - return [].concat(_toConsumableArray(subCollection.values())); - } - return { - register: register, - getItem: getItem, - hasItem: hasItem, - getNames: getNames, - getValues: getValues - }; -} + _createClass(CellRange, [{ + key: 'isValid', + value: function isValid(wotInstance) { + return this.from.isValid(wotInstance) && this.to.isValid(wotInstance); + } -/***/ }), -/* 53 */ -/***/ (function(module, exports) { + /** + * Checks if this cell range is restricted to one cell + * + * @returns {Boolean} + */ -module.exports = function(it, Constructor, name, forbiddenField){ - if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){ - throw TypeError(name + ': incorrect invocation!'); - } return it; -}; + }, { + key: 'isSingle', + value: function isSingle() { + return this.from.row === this.to.row && this.from.col === this.to.col; + } -/***/ }), -/* 54 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Returns selected range height (in number of rows) + * + * @returns {Number} + */ -// 0 -> Array#forEach -// 1 -> Array#map -// 2 -> Array#filter -// 3 -> Array#some -// 4 -> Array#every -// 5 -> Array#find -// 6 -> Array#findIndex -var ctx = __webpack_require__(29) - , IObject = __webpack_require__(78) - , toObject = __webpack_require__(42) - , toLength = __webpack_require__(24) - , asc = __webpack_require__(395); -module.exports = function(TYPE, $create){ - var IS_MAP = TYPE == 1 - , IS_FILTER = TYPE == 2 - , IS_SOME = TYPE == 3 - , IS_EVERY = TYPE == 4 - , IS_FIND_INDEX = TYPE == 6 - , NO_HOLES = TYPE == 5 || IS_FIND_INDEX - , create = $create || asc; - return function($this, callbackfn, that){ - var O = toObject($this) - , self = IObject(O) - , f = ctx(callbackfn, that, 3) - , length = toLength(self.length) - , index = 0 - , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined - , val, res; - for(;length > index; index++)if(NO_HOLES || index in self){ - val = self[index]; - res = f(val, index, O); - if(TYPE){ - if(IS_MAP)result[index] = res; // map - else if(res)switch(TYPE){ - case 3: return true; // some - case 5: return val; // find - case 6: return index; // findIndex - case 2: result.push(val); // filter - } else if(IS_EVERY)return false; // every - } + }, { + key: 'getHeight', + value: function getHeight() { + return Math.max(this.from.row, this.to.row) - Math.min(this.from.row, this.to.row) + 1; } - return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; - }; -}; -/***/ }), -/* 55 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Returns selected range width (in number of columns) + * + * @returns {Number} + */ -"use strict"; + }, { + key: 'getWidth', + value: function getWidth() { + return Math.max(this.from.col, this.to.col) - Math.min(this.from.col, this.to.col) + 1; + } -var global = __webpack_require__(13) - , $export = __webpack_require__(3) - , redefine = __webpack_require__(33) - , redefineAll = __webpack_require__(60) - , meta = __webpack_require__(47) - , forOf = __webpack_require__(57) - , anInstance = __webpack_require__(53) - , isObject = __webpack_require__(15) - , fails = __webpack_require__(31) - , $iterDetect = __webpack_require__(79) - , setToStringTag = __webpack_require__(49) - , inheritIfRequired = __webpack_require__(398); + /** + * Checks if given cell coords is within `from` and `to` cell coords of this range + * + * @param {CellCoords} cellCoords + * @returns {Boolean} + */ -module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ - var Base = global[NAME] - , C = Base - , ADDER = IS_MAP ? 'set' : 'add' - , proto = C && C.prototype - , O = {}; - var fixMethod = function(KEY){ - var fn = proto[KEY]; - redefine(proto, KEY, - KEY == 'delete' ? function(a){ - return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'has' ? function has(a){ - return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'get' ? function get(a){ - return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; } - : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; } - ); - }; - if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){ - new C().entries().next(); - }))){ - // create collection constructor - C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); - redefineAll(C.prototype, methods); - meta.NEED = true; - } else { - var instance = new C - // early implementations not supports chaining - , HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance - // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false - , THROWS_ON_PRIMITIVES = fails(function(){ instance.has(1); }) - // most early implementations doesn't supports iterables, most modern - not close it correctly - , ACCEPT_ITERABLES = $iterDetect(function(iter){ new C(iter); }) // eslint-disable-line no-new - // for early implementations -0 and +0 not the same - , BUGGY_ZERO = !IS_WEAK && fails(function(){ - // V8 ~ Chromium 42- fails only with 5+ elements - var $instance = new C() - , index = 5; - while(index--)$instance[ADDER](index, index); - return !$instance.has(-0); - }); - if(!ACCEPT_ITERABLES){ - C = wrapper(function(target, iterable){ - anInstance(target, C, NAME); - var that = inheritIfRequired(new Base, target, C); - if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); - return that; - }); - C.prototype = proto; - proto.constructor = C; - } - if(THROWS_ON_PRIMITIVES || BUGGY_ZERO){ - fixMethod('delete'); - fixMethod('has'); - IS_MAP && fixMethod('get'); - } - if(BUGGY_ZERO || HASNT_CHAINING)fixMethod(ADDER); - // weak collections should not contains .clear method - if(IS_WEAK && proto.clear)delete proto.clear; - } - - setToStringTag(C, NAME); + }, { + key: 'includes', + value: function includes(cellCoords) { + var row = cellCoords.row, + col = cellCoords.col; - O[NAME] = C; - $export($export.G + $export.W + $export.F * (C != Base), O); + var topLeft = this.getTopLeftCorner(); + var bottomRight = this.getBottomRightCorner(); - if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP); + return topLeft.row <= row && bottomRight.row >= row && topLeft.col <= col && bottomRight.col >= col; + } - return C; -}; + /** + * Checks if given range is within of this range + * + * @param {CellRange} testedRange + * @returns {Boolean} + */ -/***/ }), -/* 56 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: 'includesRange', + value: function includesRange(testedRange) { + return this.includes(testedRange.getTopLeftCorner()) && this.includes(testedRange.getBottomRightCorner()); + } -"use strict"; + /** + * Checks if given range is equal to this range + * + * @param {CellRange} testedRange + * @returns {Boolean} + */ -var hide = __webpack_require__(32) - , redefine = __webpack_require__(33) - , fails = __webpack_require__(31) - , defined = __webpack_require__(30) - , wks = __webpack_require__(10); + }, { + key: 'isEqual', + value: function isEqual(testedRange) { + return Math.min(this.from.row, this.to.row) == Math.min(testedRange.from.row, testedRange.to.row) && Math.max(this.from.row, this.to.row) == Math.max(testedRange.from.row, testedRange.to.row) && Math.min(this.from.col, this.to.col) == Math.min(testedRange.from.col, testedRange.to.col) && Math.max(this.from.col, this.to.col) == Math.max(testedRange.from.col, testedRange.to.col); + } -module.exports = function(KEY, length, exec){ - var SYMBOL = wks(KEY) - , fns = exec(defined, SYMBOL, ''[KEY]) - , strfn = fns[0] - , rxfn = fns[1]; - if(fails(function(){ - var O = {}; - O[SYMBOL] = function(){ return 7; }; - return ''[KEY](O) != 7; - })){ - redefine(String.prototype, KEY, strfn); - hide(RegExp.prototype, SYMBOL, length == 2 - // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) - // 21.2.5.11 RegExp.prototype[@@split](string, limit) - ? function(string, arg){ return rxfn.call(string, this, arg); } - // 21.2.5.6 RegExp.prototype[@@match](string) - // 21.2.5.9 RegExp.prototype[@@search](string) - : function(string){ return rxfn.call(string, this); } - ); - } -}; + /** + * Checks if tested range overlaps with the range. + * Range A is considered to to be overlapping with range B if intersection of A and B or B and A is not empty. + * + * @param {CellRange} testedRange + * @returns {Boolean} + */ -/***/ }), -/* 57 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: 'overlaps', + value: function overlaps(testedRange) { + return testedRange.isSouthEastOf(this.getTopLeftCorner()) && testedRange.isNorthWestOf(this.getBottomRightCorner()); + } -var ctx = __webpack_require__(29) - , call = __webpack_require__(280) - , isArrayIter = __webpack_require__(276) - , anObject = __webpack_require__(18) - , toLength = __webpack_require__(24) - , getIterFn = __webpack_require__(291) - , BREAK = {} - , RETURN = {}; -var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){ - var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable) - , f = ctx(fn, that, entries ? 2 : 1) - , index = 0 - , length, step, iterator, result; - if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); - // fast case for arrays with default iterator - if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ - result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); - if(result === BREAK || result === RETURN)return result; - } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ - result = call(iterator, f, step.value, entries); - if(result === BREAK || result === RETURN)return result; - } -}; -exports.BREAK = BREAK; -exports.RETURN = RETURN; + /** + * @param {CellRange} testedCoords + * @returns {Boolean} + */ -/***/ }), -/* 58 */ -/***/ (function(module, exports) { + }, { + key: 'isSouthEastOf', + value: function isSouthEastOf(testedCoords) { + return this.getTopLeftCorner().isSouthEastOf(testedCoords) || this.getBottomRightCorner().isSouthEastOf(testedCoords); + } -module.exports = false; + /** + * @param {CellRange} testedCoords + * @returns {Boolean} + */ -/***/ }), -/* 59 */ -/***/ (function(module, exports) { + }, { + key: 'isNorthWestOf', + value: function isNorthWestOf(testedCoords) { + return this.getTopLeftCorner().isNorthWestOf(testedCoords) || this.getBottomRightCorner().isNorthWestOf(testedCoords); + } -exports.f = Object.getOwnPropertySymbols; + /** + * Adds a cell to a range (only if exceeds corners of the range). Returns information if range was expanded + * + * @param {CellCoords} cellCoords + * @returns {Boolean} + */ -/***/ }), -/* 60 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: 'expand', + value: function expand(cellCoords) { + var topLeft = this.getTopLeftCorner(); + var bottomRight = this.getBottomRightCorner(); -var redefine = __webpack_require__(33); -module.exports = function(target, src, safe){ - for(var key in src)redefine(target, key, src[key], safe); - return target; -}; + if (cellCoords.row < topLeft.row || cellCoords.col < topLeft.col || cellCoords.row > bottomRight.row || cellCoords.col > bottomRight.col) { + this.from = new _coords2.default(Math.min(topLeft.row, cellCoords.row), Math.min(topLeft.col, cellCoords.col)); + this.to = new _coords2.default(Math.max(bottomRight.row, cellCoords.row), Math.max(bottomRight.col, cellCoords.col)); -/***/ }), -/* 61 */ -/***/ (function(module, exports, __webpack_require__) { + return true; + } -var toInteger = __webpack_require__(62) - , max = Math.max - , min = Math.min; -module.exports = function(index, length){ - index = toInteger(index); - return index < 0 ? max(index + length, 0) : min(index, length); -}; + return false; + } -/***/ }), -/* 62 */ -/***/ (function(module, exports) { + /** + * @param {CellRange} expandingRange + * @returns {Boolean} + */ -// 7.1.4 ToInteger -var ceil = Math.ceil - , floor = Math.floor; -module.exports = function(it){ - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); -}; + }, { + key: 'expandByRange', + value: function expandByRange(expandingRange) { + if (this.includesRange(expandingRange) || !this.overlaps(expandingRange)) { + return false; + } -/***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { + var topLeft = this.getTopLeftCorner(); + var bottomRight = this.getBottomRightCorner(); + var topRight = this.getTopRightCorner(); + var bottomLeft = this.getBottomLeftCorner(); -"use strict"; + var expandingTopLeft = expandingRange.getTopLeftCorner(); + var expandingBottomRight = expandingRange.getBottomRightCorner(); + var resultTopRow = Math.min(topLeft.row, expandingTopLeft.row); + var resultTopCol = Math.min(topLeft.col, expandingTopLeft.col); + var resultBottomRow = Math.max(bottomRight.row, expandingBottomRight.row); + var resultBottomCol = Math.max(bottomRight.col, expandingBottomRight.col); -exports.__esModule = true; -exports.getRegisteredCellTypes = exports.getRegisteredCellTypeNames = exports.hasCellType = exports.getCellType = exports.registerCellType = undefined; + var finalFrom = new _coords2.default(resultTopRow, resultTopCol), + finalTo = new _coords2.default(resultBottomRow, resultBottomCol); + var isCorner = new CellRange(finalFrom, finalFrom, finalTo).isCorner(this.from, expandingRange), + onlyMerge = expandingRange.isEqual(new CellRange(finalFrom, finalFrom, finalTo)); -var _staticRegister2 = __webpack_require__(52); + if (isCorner && !onlyMerge) { + if (this.from.col > finalFrom.col) { + finalFrom.col = resultBottomCol; + finalTo.col = resultTopCol; + } + if (this.from.row > finalFrom.row) { + finalFrom.row = resultBottomRow; + finalTo.row = resultTopRow; + } + } + this.from = finalFrom; + this.to = finalTo; -var _staticRegister3 = _interopRequireDefault(_staticRegister2); + return true; + } -var _editors = __webpack_require__(14); + /** + * @returns {String} + */ -var _renderers = __webpack_require__(9); + }, { + key: 'getDirection', + value: function getDirection() { + if (this.from.isNorthWestOf(this.to)) { + // NorthWest - SouthEast + return 'NW-SE'; + } else if (this.from.isNorthEastOf(this.to)) { + // NorthEast - SouthWest + return 'NE-SW'; + } else if (this.from.isSouthEastOf(this.to)) { + // SouthEast - NorthWest + return 'SE-NW'; + } else if (this.from.isSouthWestOf(this.to)) { + // SouthWest - NorthEast + return 'SW-NE'; + } + } -var _validators = __webpack_require__(26); + /** + * @param {String} direction + */ -var _autocompleteType = __webpack_require__(304); + }, { + key: 'setDirection', + value: function setDirection(direction) { + switch (direction) { + case 'NW-SE': + var _ref = [this.getTopLeftCorner(), this.getBottomRightCorner()]; + this.from = _ref[0]; + this.to = _ref[1]; -var _autocompleteType2 = _interopRequireDefault(_autocompleteType); + break; + case 'NE-SW': + var _ref2 = [this.getTopRightCorner(), this.getBottomLeftCorner()]; + this.from = _ref2[0]; + this.to = _ref2[1]; -var _checkboxType = __webpack_require__(305); + break; + case 'SE-NW': + var _ref3 = [this.getBottomRightCorner(), this.getTopLeftCorner()]; + this.from = _ref3[0]; + this.to = _ref3[1]; -var _checkboxType2 = _interopRequireDefault(_checkboxType); + break; + case 'SW-NE': + var _ref4 = [this.getBottomLeftCorner(), this.getTopRightCorner()]; + this.from = _ref4[0]; + this.to = _ref4[1]; -var _dateType = __webpack_require__(306); + break; + default: + break; + } + } -var _dateType2 = _interopRequireDefault(_dateType); + /** + * Get top left corner of this range + * + * @returns {CellCoords} + */ -var _dropdownType = __webpack_require__(307); + }, { + key: 'getTopLeftCorner', + value: function getTopLeftCorner() { + return new _coords2.default(Math.min(this.from.row, this.to.row), Math.min(this.from.col, this.to.col)); + } -var _dropdownType2 = _interopRequireDefault(_dropdownType); + /** + * Get bottom right corner of this range + * + * @returns {CellCoords} + */ -var _handsontableType = __webpack_require__(308); + }, { + key: 'getBottomRightCorner', + value: function getBottomRightCorner() { + return new _coords2.default(Math.max(this.from.row, this.to.row), Math.max(this.from.col, this.to.col)); + } -var _handsontableType2 = _interopRequireDefault(_handsontableType); + /** + * Get top right corner of this range + * + * @returns {CellCoords} + */ -var _numericType = __webpack_require__(309); + }, { + key: 'getTopRightCorner', + value: function getTopRightCorner() { + return new _coords2.default(Math.min(this.from.row, this.to.row), Math.max(this.from.col, this.to.col)); + } -var _numericType2 = _interopRequireDefault(_numericType); + /** + * Get bottom left corner of this range + * + * @returns {CellCoords} + */ -var _passwordType = __webpack_require__(310); + }, { + key: 'getBottomLeftCorner', + value: function getBottomLeftCorner() { + return new _coords2.default(Math.max(this.from.row, this.to.row), Math.min(this.from.col, this.to.col)); + } -var _passwordType2 = _interopRequireDefault(_passwordType); + /** + * @param {CellCoords} coords + * @param {CellRange} expandedRange + * @returns {*} + */ -var _textType = __webpack_require__(311); + }, { + key: 'isCorner', + value: function isCorner(coords, expandedRange) { + if (expandedRange) { + if (expandedRange.includes(coords)) { + if (this.getTopLeftCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.from.col)) || this.getTopRightCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.to.col)) || this.getBottomLeftCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.from.col)) || this.getBottomRightCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.to.col))) { + return true; + } + } + } -var _textType2 = _interopRequireDefault(_textType); + return coords.isEqual(this.getTopLeftCorner()) || coords.isEqual(this.getTopRightCorner()) || coords.isEqual(this.getBottomLeftCorner()) || coords.isEqual(this.getBottomRightCorner()); + } -var _timeType = __webpack_require__(312); + /** + * @param {CellCoords} coords + * @param {CellRange} expandedRange + * @returns {CellCoords} + */ -var _timeType2 = _interopRequireDefault(_timeType); + }, { + key: 'getOppositeCorner', + value: function getOppositeCorner(coords, expandedRange) { + if (!(coords instanceof _coords2.default)) { + return false; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (expandedRange) { + if (expandedRange.includes(coords)) { + if (this.getTopLeftCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.from.col))) { + return this.getBottomRightCorner(); + } + if (this.getTopRightCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.to.col))) { + return this.getBottomLeftCorner(); + } + if (this.getBottomLeftCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.from.col))) { + return this.getTopRightCorner(); + } + if (this.getBottomRightCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.to.col))) { + return this.getTopLeftCorner(); + } + } + } -var _staticRegister = (0, _staticRegister3.default)('cellTypes'), - register = _staticRegister.register, - getItem = _staticRegister.getItem, - hasItem = _staticRegister.hasItem, - getNames = _staticRegister.getNames, - getValues = _staticRegister.getValues; + if (coords.isEqual(this.getBottomRightCorner())) { + return this.getTopLeftCorner(); + } else if (coords.isEqual(this.getTopLeftCorner())) { + return this.getBottomRightCorner(); + } else if (coords.isEqual(this.getTopRightCorner())) { + return this.getBottomLeftCorner(); + } else if (coords.isEqual(this.getBottomLeftCorner())) { + return this.getTopRightCorner(); + } + } -_register('autocomplete', _autocompleteType2.default); -_register('checkbox', _checkboxType2.default); -_register('date', _dateType2.default); -_register('dropdown', _dropdownType2.default); -_register('handsontable', _handsontableType2.default); -_register('numeric', _numericType2.default); -_register('password', _passwordType2.default); -_register('text', _textType2.default); -_register('time', _timeType2.default); + /** + * @param {CellRange} range + * @returns {Array} + */ -/** - * Retrieve cell type object. - * - * @param {String} name Cell type identification. - * @returns {Object} Returns cell type object. - */ -function _getItem(name) { - if (!hasItem(name)) { - throw Error('You declared cell type "' + 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 "Handsontable.cellTypes.registerCellType" method'); - } + }, { + key: 'getBordersSharedWith', + value: function getBordersSharedWith(range) { + if (!this.includesRange(range)) { + return []; + } - return getItem(name); -} + var thisBorders = { + top: Math.min(this.from.row, this.to.row), + bottom: Math.max(this.from.row, this.to.row), + left: Math.min(this.from.col, this.to.col), + right: Math.max(this.from.col, this.to.col) + }; + var rangeBorders = { + top: Math.min(range.from.row, range.to.row), + bottom: Math.max(range.from.row, range.to.row), + left: Math.min(range.from.col, range.to.col), + right: Math.max(range.from.col, range.to.col) + }; + var result = []; -/** - * 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) { - var editor = type.editor, - renderer = type.renderer, - validator = type.validator; + if (thisBorders.top == rangeBorders.top) { + result.push('top'); + } + if (thisBorders.right == rangeBorders.right) { + result.push('right'); + } + if (thisBorders.bottom == rangeBorders.bottom) { + result.push('bottom'); + } + if (thisBorders.left == rangeBorders.left) { + result.push('left'); + } + return result; + } - if (editor) { - (0, _editors.registerEditor)(name, editor); - } - if (renderer) { - (0, _renderers.registerRenderer)(name, renderer); - } - if (validator) { - (0, _validators.registerValidator)(name, validator); - } + /** + * Get inner selected cell coords defined by this range + * + * @returns {Array} + */ - register(name, type); -} + }, { + key: 'getInner', + value: function getInner() { + var topLeft = this.getTopLeftCorner(); + var bottomRight = this.getBottomRightCorner(); + var out = []; -exports.registerCellType = _register; -exports.getCellType = _getItem; -exports.hasCellType = hasItem; -exports.getRegisteredCellTypeNames = getNames; -exports.getRegisteredCellTypes = getValues; - -/***/ }), -/* 64 */ -/***/ (function(module, exports, __webpack_require__) { + for (var r = topLeft.row; r <= bottomRight.row; r++) { + for (var c = topLeft.col; c <= bottomRight.col; c++) { + if (!(this.from.row === r && this.from.col === c) && !(this.to.row === r && this.to.col === c)) { + out.push(new _coords2.default(r, c)); + } + } + } + return out; + } -"use strict"; + /** + * Get all selected cell coords defined by this range + * + * @returns {Array} + */ + }, { + key: 'getAll', + value: function getAll() { + var topLeft = this.getTopLeftCorner(); + var bottomRight = this.getBottomRightCorner(); + var out = []; -exports.__esModule = true; + for (var r = topLeft.row; r <= bottomRight.row; r++) { + for (var c = topLeft.col; c <= bottomRight.col; c++) { + if (topLeft.row === r && topLeft.col === c) { + out.push(topLeft); + } else if (bottomRight.row === r && bottomRight.col === c) { + out.push(bottomRight); + } else { + out.push(new _coords2.default(r, c)); + } + } + } -var _slicedToArray = function () { function sliceIterator(arr, i) { 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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + return out; + } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + /** + * Runs a callback function against all cells in the range. You can break the iteration by returning + * `false` in the callback function + * + * @param callback {Function} + */ -exports.default = Core; + }, { + key: 'forAll', + value: function forAll(callback) { + var topLeft = this.getTopLeftCorner(); + var bottomRight = this.getBottomRightCorner(); -var _numbro = __webpack_require__(51); + for (var r = topLeft.row; r <= bottomRight.row; r++) { + for (var c = topLeft.col; c <= bottomRight.col; c++) { + var breakIteration = callback(r, c); -var _numbro2 = _interopRequireDefault(_numbro); + if (breakIteration === false) { + return; + } + } + } + } + }]); -var _element = __webpack_require__(0); + return CellRange; +}(); -var _setting = __webpack_require__(66); +exports.default = CellRange; -var _function = __webpack_require__(35); +/***/ }), +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { -var _mixed = __webpack_require__(20); +"use strict"; -var _browser = __webpack_require__(25); -var _dataMap = __webpack_require__(313); +exports.__esModule = true; -var _dataMap2 = _interopRequireDefault(_dataMap); +var _array = __webpack_require__(2); -var _editorManager = __webpack_require__(315); +var _object = __webpack_require__(1); -var _editorManager2 = _interopRequireDefault(_editorManager); +var MIXIN_NAME = 'localHooks'; -var _eventManager = __webpack_require__(4); +/** + * Mixin object to extend objects functionality for local hooks. + * + * @type {Object} + */ +var localHooks = { + /** + * Internal hooks storage. + */ + _localHooks: Object.create(null), -var _eventManager2 = _interopRequireDefault(_eventManager); + /** + * Add hook to the collection. + * + * @param {String} key Hook name. + * @param {Function} callback Hook callback + */ + addLocalHook: function addLocalHook(key, callback) { + if (!this._localHooks[key]) { + this._localHooks[key] = []; + } + this._localHooks[key].push(callback); + }, -var _object = __webpack_require__(1); -var _array = __webpack_require__(2); + /** + * Run hooks. + * + * @param {String} key Hook name. + * @param {*} params + */ + runLocalHooks: function runLocalHooks(key) { + var _this = this; -var _plugins = __webpack_require__(5); + for (var _len = arguments.length, params = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + params[_key - 1] = arguments[_key]; + } -var _renderers = __webpack_require__(9); + if (this._localHooks[key]) { + (0, _array.arrayEach)(this._localHooks[key], function (callback) { + return callback.apply(_this, params); + }); + } + }, -var _validators = __webpack_require__(26); -var _string = __webpack_require__(27); + /** + * Clear all added hooks. + */ + clearLocalHooks: function clearLocalHooks() { + this._localHooks = {}; + } +}; -var _number = __webpack_require__(6); +(0, _object.defineGetter)(localHooks, 'MIXIN_NAME', MIXIN_NAME, { + writable: false, + enumerable: false +}); -var _tableView = __webpack_require__(384); +exports.default = localHooks; -var _tableView2 = _interopRequireDefault(_tableView); +/***/ }), +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { -var _dataSource = __webpack_require__(314); +"use strict"; -var _dataSource2 = _interopRequireDefault(_dataSource); -var _data = __webpack_require__(65); +exports.__esModule = true; +exports.ITEMS = exports.UNDO = 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 = undefined; -var _recordTranslator = __webpack_require__(268); +var _predefinedItems2; -var _src = __webpack_require__(11); +var _alignment = __webpack_require__(223); -var _pluginHooks = __webpack_require__(8); +Object.defineProperty(exports, 'ALIGNMENT', { + enumerable: true, + get: function get() { + return _alignment.KEY; + } +}); -var _pluginHooks2 = _interopRequireDefault(_pluginHooks); +var _clearColumn = __webpack_require__(224); -var _defaultSettings = __webpack_require__(88); +Object.defineProperty(exports, 'CLEAR_COLUMN', { + enumerable: true, + get: function get() { + return _clearColumn.KEY; + } +}); -var _defaultSettings2 = _interopRequireDefault(_defaultSettings); +var _columnLeft = __webpack_require__(225); -var _cellTypes = __webpack_require__(63); +Object.defineProperty(exports, 'COLUMN_LEFT', { + enumerable: true, + get: function get() { + return _columnLeft.KEY; + } +}); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _columnRight = __webpack_require__(226); -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } +Object.defineProperty(exports, 'COLUMN_RIGHT', { + enumerable: true, + get: function get() { + return _columnRight.KEY; + } +}); -var activeGuid = null; +var _readOnly = __webpack_require__(227); -/** - * Handsontable constructor - * - * @core - * @dependencies numbro - * @constructor Core - * @description - * - * After Handsontable is constructed, you can modify the grid behavior using the available public methods. - * - * --- - * ## How to call methods - * - * These are 2 equal ways to call a Handsontable method: - * - * ```js - * // all following examples assume that you constructed Handsontable like this - * var ht = new Handsontable(document.getElementById('example1'), options); - * - * // now, to use setDataAtCell method, you can either: - * ht.setDataAtCell(0, 0, 'new value'); - * ``` - * - * Alternatively, you can call the method using jQuery wrapper (__obsolete__, requires initialization using our jQuery guide - * ```js - * $('#example1').handsontable('setDataAtCell', 0, 0, 'new value'); - * ``` - * --- - */ -function Core(rootElement, userSettings) { - var priv, - datamap, - dataSource, - grid, - selection, - editorManager, - instance = this, - GridSettings = function GridSettings() {}, - eventManager = new _eventManager2.default(instance); +Object.defineProperty(exports, 'READ_ONLY', { + enumerable: true, + get: function get() { + return _readOnly.KEY; + } +}); - (0, _object.extend)(GridSettings.prototype, _defaultSettings2.default.prototype); // create grid settings as a copy of default settings - (0, _object.extend)(GridSettings.prototype, userSettings); // overwrite defaults with user settings - (0, _object.extend)(GridSettings.prototype, expandType(userSettings)); +var _redo = __webpack_require__(228); - this.rootElement = rootElement; - this.isHotTableEnv = (0, _element.isChildOfWebComponentTable)(this.rootElement); - _eventManager2.default.isHotTableEnv = this.isHotTableEnv; +Object.defineProperty(exports, 'REDO', { + enumerable: true, + get: function get() { + return _redo.KEY; + } +}); - this.container = document.createElement('DIV'); - this.renderCall = false; +var _removeColumn = __webpack_require__(229); - rootElement.insertBefore(this.container, rootElement.firstChild); +Object.defineProperty(exports, 'REMOVE_COLUMN', { + enumerable: true, + get: function get() { + return _removeColumn.KEY; + } +}); - this.guid = 'ht_' + (0, _string.randomString)(); // this is the namespace for global events +var _removeRow = __webpack_require__(230); - var recordTranslator = (0, _recordTranslator.getTranslator)(instance); +Object.defineProperty(exports, 'REMOVE_ROW', { + enumerable: true, + get: function get() { + return _removeRow.KEY; + } +}); - dataSource = new _dataSource2.default(instance); +var _rowAbove = __webpack_require__(231); - if (!this.rootElement.id || this.rootElement.id.substring(0, 3) === 'ht_') { - this.rootElement.id = this.guid; // if root element does not have an id, assign a random id +Object.defineProperty(exports, 'ROW_ABOVE', { + enumerable: true, + get: function get() { + return _rowAbove.KEY; } - priv = { - cellSettings: [], - columnSettings: [], - columnsSettingConflicts: ['data', 'width'], - settings: new GridSettings(), // current settings instance - selRange: null, // exposed by public method `getSelectedRange` - isPopulated: null, - scrollable: null, - firstRun: true - }; +}); - grid = { - /** - * Inserts or removes rows and columns - * - * @memberof Core# - * @function alter - * @private - * @param {String} action Possible values: "insert_row", "insert_col", "remove_row", "remove_col" - * @param {Number} index - * @param {Number} amount - * @param {String} [source] Optional. Source of hook runner. - * @param {Boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows. - */ - alter: function alter(action, index, amount, source, keepEmptyRows) { - var delta; +var _rowBelow = __webpack_require__(232); - amount = amount || 1; +Object.defineProperty(exports, 'ROW_BELOW', { + enumerable: true, + get: function get() { + return _rowBelow.KEY; + } +}); - function spliceWith(data, index, count, toInject) { - var valueFactory = function valueFactory() { - var result = void 0; +var _separator = __webpack_require__(71); - if (toInject === 'array') { - result = []; - } else if (toInject === 'object') { - result = {}; - } +Object.defineProperty(exports, 'SEPARATOR', { + enumerable: true, + get: function get() { + return _separator.KEY; + } +}); - return result; - }; - var spliceArgs = (0, _array.arrayMap)(new Array(count), function () { - return valueFactory(); - }); +var _undo = __webpack_require__(233); - spliceArgs.unshift(index, 0); - data.splice.apply(data, _toConsumableArray(spliceArgs)); - } +Object.defineProperty(exports, 'UNDO', { + enumerable: true, + get: function get() { + return _undo.KEY; + } +}); +exports.predefinedItems = predefinedItems; +exports.addItem = addItem; - /* eslint-disable no-case-declarations */ - switch (action) { - case 'insert_row': +var _object = __webpack_require__(1); - var numberOfSourceRows = instance.countSourceRows(); +var _alignment2 = _interopRequireDefault(_alignment); - if (instance.getSettings().maxRows === numberOfSourceRows) { - return; - } +var _clearColumn2 = _interopRequireDefault(_clearColumn); - index = (0, _mixed.isDefined)(index) ? index : numberOfSourceRows; +var _columnLeft2 = _interopRequireDefault(_columnLeft); - delta = datamap.createRow(index, amount, source); - spliceWith(priv.cellSettings, index, amount, 'array'); +var _columnRight2 = _interopRequireDefault(_columnRight); - if (delta) { - if (selection.isSelected() && priv.selRange.from.row >= index) { - priv.selRange.from.row += delta; - selection.transformEnd(delta, 0); // will call render() internally - } else { - selection.refreshBorders(); // it will call render and prepare methods - } - } - break; +var _readOnly2 = _interopRequireDefault(_readOnly); - case 'insert_col': - delta = datamap.createCol(index, amount, source); +var _redo2 = _interopRequireDefault(_redo); - for (var row = 0, len = instance.countSourceRows(); row < len; row++) { - if (priv.cellSettings[row]) { - spliceWith(priv.cellSettings[row], index, amount); - } - } +var _removeColumn2 = _interopRequireDefault(_removeColumn); - if (delta) { - if (Array.isArray(instance.getSettings().colHeaders)) { - var spliceArray = [index, 0]; - spliceArray.length += delta; // inserts empty (undefined) elements at the end of an array - Array.prototype.splice.apply(instance.getSettings().colHeaders, spliceArray); // inserts empty (undefined) elements into the colHeader array - } +var _removeRow2 = _interopRequireDefault(_removeRow); - if (selection.isSelected() && priv.selRange.from.col >= index) { - priv.selRange.from.col += delta; - selection.transformEnd(0, delta); // will call render() internally - } else { - selection.refreshBorders(); // it will call render and prepare methods - } - } - break; +var _rowAbove2 = _interopRequireDefault(_rowAbove); - case 'remove_row': - datamap.removeRow(index, amount, source); - priv.cellSettings.splice(index, amount); +var _rowBelow2 = _interopRequireDefault(_rowBelow); - var totalRows = instance.countRows(); - var fixedRowsTop = instance.getSettings().fixedRowsTop; - if (fixedRowsTop >= index + 1) { - instance.getSettings().fixedRowsTop -= Math.min(amount, fixedRowsTop - index); - } +var _separator2 = _interopRequireDefault(_separator); - var fixedRowsBottom = instance.getSettings().fixedRowsBottom; - if (fixedRowsBottom && index >= totalRows - fixedRowsBottom) { - instance.getSettings().fixedRowsBottom -= Math.min(amount, fixedRowsBottom); - } +var _undo2 = _interopRequireDefault(_undo); - grid.adjustRowsAndCols(); - selection.refreshBorders(); // it will call render and prepare methods - break; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - case 'remove_col': - var visualColumnIndex = recordTranslator.toPhysicalColumn(index); +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; } - datamap.removeCol(index, amount, source); +var ITEMS = exports.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]; - for (var _row = 0, _len = instance.countSourceRows(); _row < _len; _row++) { - if (priv.cellSettings[_row]) { - // if row hasn't been rendered it wouldn't have cellSettings - priv.cellSettings[_row].splice(visualColumnIndex, amount); - } - } - var fixedColumnsLeft = instance.getSettings().fixedColumnsLeft; +var _predefinedItems = (_predefinedItems2 = {}, _defineProperty(_predefinedItems2, _separator.KEY, _separator2.default), _defineProperty(_predefinedItems2, _rowAbove.KEY, _rowAbove2.default), _defineProperty(_predefinedItems2, _rowBelow.KEY, _rowBelow2.default), _defineProperty(_predefinedItems2, _columnLeft.KEY, _columnLeft2.default), _defineProperty(_predefinedItems2, _columnRight.KEY, _columnRight2.default), _defineProperty(_predefinedItems2, _clearColumn.KEY, _clearColumn2.default), _defineProperty(_predefinedItems2, _removeRow.KEY, _removeRow2.default), _defineProperty(_predefinedItems2, _removeColumn.KEY, _removeColumn2.default), _defineProperty(_predefinedItems2, _undo.KEY, _undo2.default), _defineProperty(_predefinedItems2, _redo.KEY, _redo2.default), _defineProperty(_predefinedItems2, _readOnly.KEY, _readOnly2.default), _defineProperty(_predefinedItems2, _alignment.KEY, _alignment2.default), _predefinedItems2); - if (fixedColumnsLeft >= index + 1) { - instance.getSettings().fixedColumnsLeft -= Math.min(amount, fixedColumnsLeft - index); - } +/** + * Gets new object with all predefined menu items. + * + * @returns {Object} + */ +function predefinedItems() { + var items = {}; - if (Array.isArray(instance.getSettings().colHeaders)) { - if (typeof visualColumnIndex === 'undefined') { - visualColumnIndex = -1; - } - instance.getSettings().colHeaders.splice(visualColumnIndex, amount); - } + (0, _object.objectEach)(_predefinedItems, function (itemFactory, key) { + items[key] = itemFactory(); + }); - grid.adjustRowsAndCols(); - selection.refreshBorders(); // it will call render and prepare methods + return items; +} - break; - default: - throw new Error('There is no such action "' + action + '"'); - } +/** + * 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; + } +} - if (!keepEmptyRows) { - grid.adjustRowsAndCols(); // makes sure that we did not add rows that will be removed in next refresh - } - }, +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; - /** - * Makes sure there are empty rows at the bottom of the table - */ - adjustRowsAndCols: function adjustRowsAndCols() { - if (priv.settings.minRows) { - // should I add empty rows to data source to meet minRows? - var rows = instance.countRows(); - if (rows < priv.settings.minRows) { - for (var r = 0, minRows = priv.settings.minRows; r < minRows - rows; r++) { - datamap.createRow(instance.countRows(), 1, 'auto'); - } - } - } - if (priv.settings.minSpareRows) { - var emptyRows = instance.countEmptyRows(true); +exports.__esModule = true; +exports.default = separatorItem; +var KEY = exports.KEY = '---------'; - // should I add empty rows to meet minSpareRows? - if (emptyRows < priv.settings.minSpareRows) { - for (; emptyRows < priv.settings.minSpareRows && instance.countSourceRows() < priv.settings.maxRows; emptyRows++) { - datamap.createRow(instance.countRows(), 1, 'auto'); - } - } - } - { - var emptyCols = void 0; +function separatorItem() { + return { + name: KEY + }; +} - // count currently empty cols - if (priv.settings.minCols || priv.settings.minSpareCols) { - emptyCols = instance.countEmptyCols(true); - } +/***/ }), +/* 72 */ +/***/ (function(module, exports) { - // should I add empty cols to meet minCols? - if (priv.settings.minCols && !priv.settings.columns && instance.countCols() < priv.settings.minCols) { - for (; instance.countCols() < priv.settings.minCols; emptyCols++) { - datamap.createCol(instance.countCols(), 1, 'auto'); - } - } - // should I add empty cols to meet minSpareCols? - if (priv.settings.minSpareCols && !priv.settings.columns && instance.dataType === 'array' && emptyCols < priv.settings.minSpareCols) { - for (; emptyCols < priv.settings.minSpareCols && instance.countCols() < priv.settings.maxCols; emptyCols++) { - datamap.createCol(instance.countCols(), 1, 'auto'); - } - } - } - var rowCount = instance.countRows(); - var colCount = instance.countCols(); +module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; +}; - if (rowCount === 0 || colCount === 0) { - selection.deselect(); - } +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { - if (selection.isSelected()) { - var selectionChanged = false; - var fromRow = priv.selRange.from.row; - var fromCol = priv.selRange.from.col; - var toRow = priv.selRange.to.row; - var toCol = priv.selRange.to.col; +"use strict"; - // if selection is outside, move selection to last row - if (fromRow > rowCount - 1) { - fromRow = rowCount - 1; - selectionChanged = true; +var $defineProperty = __webpack_require__(19) + , createDesc = __webpack_require__(40); - if (toRow > fromRow) { - toRow = fromRow; - } - } else if (toRow > rowCount - 1) { - toRow = rowCount - 1; - selectionChanged = true; +module.exports = function(object, index, value){ + if(index in object)$defineProperty.f(object, index, createDesc(0, value)); + else object[index] = value; +}; - if (fromRow > toRow) { - fromRow = toRow; - } - } - // if selection is outside, move selection to last row - if (fromCol > colCount - 1) { - fromCol = colCount - 1; - selectionChanged = true; +/***/ }), +/* 74 */ +/***/ (function(module, exports, __webpack_require__) { - if (toCol > fromCol) { - toCol = fromCol; - } - } else if (toCol > colCount - 1) { - toCol = colCount - 1; - selectionChanged = true; +var isObject = __webpack_require__(15) + , document = __webpack_require__(13).document + // in old IE typeof document.createElement is 'object' + , is = isObject(document) && isObject(document.createElement); +module.exports = function(it){ + return is ? document.createElement(it) : {}; +}; - if (fromCol > toCol) { - fromCol = toCol; - } - } +/***/ }), +/* 75 */ +/***/ (function(module, exports) { - if (selectionChanged) { - instance.selectCell(fromRow, fromCol, toRow, toCol); - } - } - if (instance.view) { - instance.view.wt.wtOverlays.adjustElementsSize(); - } - }, +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Populate the data from the provided 2d array from the given cell coordinates. - * - * @private - * @param {Object} start Start selection position. Visual indexes. - * @param {Array} input 2d data array. - * @param {Object} [end] End selection position (only for drag-down mode). Visual indexes. - * @param {String} [source="populateFromArray"] Source information string. - * @param {String} [method="overwrite"] Populate method. Possible options: `shift_down`, `shift_right`, `overwrite`. - * @param {String} direction (left|right|up|down) String specifying the direction. - * @param {Array} deltas The deltas array. A difference between values of adjacent cells. - * Useful **only** when the type of handled cells is `numeric`. - * @returns {Object|undefined} ending td in pasted area (only if any cell was changed). - */ - populateFromArray: function populateFromArray(start, input, end, source, method, direction, deltas) { - // TODO: either remove or implement the `direction` argument. Currently it's not working at all. - var r, - rlen, - c, - clen, - setData = [], - current = {}; +var MATCH = __webpack_require__(10)('match'); +module.exports = function(KEY){ + var re = /./; + try { + '/./'[KEY](re); + } catch(e){ + try { + re[MATCH] = false; + return !'/./'[KEY](re); + } catch(f){ /* empty */ } + } return true; +}; - rlen = input.length; +/***/ }), +/* 77 */ +/***/ (function(module, exports, __webpack_require__) { - if (rlen === 0) { - return false; - } +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = __webpack_require__(38); +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ + return cof(it) == 'String' ? it.split('') : Object(it); +}; - var repeatCol, - repeatRow, - cmax, - rmax, - baseEnd = { - row: end === null ? null : end.row, - col: end === null ? null : end.col - }; +/***/ }), +/* 78 */ +/***/ (function(module, exports, __webpack_require__) { - /* eslint-disable no-case-declarations */ - // insert data with specified pasteMode method - switch (method) { - case 'shift_down': - repeatCol = end ? end.col - start.col + 1 : 0; - repeatRow = end ? end.row - start.row + 1 : 0; - input = (0, _data.translateRowsToColumns)(input); - for (c = 0, clen = input.length, cmax = Math.max(clen, repeatCol); c < cmax; c++) { - if (c < clen) { - var _instance; +var ITERATOR = __webpack_require__(10)('iterator') + , SAFE_CLOSING = false; - for (r = 0, rlen = input[c].length; r < repeatRow - rlen; r++) { - input[c].push(input[c][r % rlen]); - } - input[c].unshift(start.col + c, start.row, 0); - (_instance = instance).spliceCol.apply(_instance, _toConsumableArray(input[c])); - } else { - var _instance2; +try { + var riter = [7][ITERATOR](); + riter['return'] = function(){ SAFE_CLOSING = true; }; + Array.from(riter, function(){ throw 2; }); +} catch(e){ /* empty */ } - input[c % clen][0] = start.col + c; - (_instance2 = instance).spliceCol.apply(_instance2, _toConsumableArray(input[c % clen])); - } - } - break; +module.exports = function(exec, skipClosing){ + if(!skipClosing && !SAFE_CLOSING)return false; + var safe = false; + try { + var arr = [7] + , iter = arr[ITERATOR](); + iter.next = function(){ return {done: safe = true}; }; + arr[ITERATOR] = function(){ return iter; }; + exec(arr); + } catch(e){ /* empty */ } + return safe; +}; - case 'shift_right': - repeatCol = end ? end.col - start.col + 1 : 0; - repeatRow = end ? end.row - start.row + 1 : 0; - for (r = 0, rlen = input.length, rmax = Math.max(rlen, repeatRow); r < rmax; r++) { - if (r < rlen) { - var _instance3; +/***/ }), +/* 79 */ +/***/ (function(module, exports, __webpack_require__) { - for (c = 0, clen = input[r].length; c < repeatCol - clen; c++) { - input[r].push(input[r][c % clen]); - } - input[r].unshift(start.row + r, start.col, 0); - (_instance3 = instance).spliceRow.apply(_instance3, _toConsumableArray(input[r])); - } else { - var _instance4; +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = __webpack_require__(18) + , dPs = __webpack_require__(288) + , enumBugKeys = __webpack_require__(75) + , IE_PROTO = __webpack_require__(82)('IE_PROTO') + , Empty = function(){ /* empty */ } + , PROTOTYPE = 'prototype'; - input[r % rlen][0] = start.row + r; - (_instance4 = instance).spliceRow.apply(_instance4, _toConsumableArray(input[r % rlen])); - } - } - break; +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function(){ + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(74)('iframe') + , i = enumBugKeys.length + , lt = '<' + , gt = '>' + , iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(159).appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; - case 'overwrite': - default: - // overwrite and other not specified options - current.row = start.row; - current.col = start.col; +module.exports = Object.create || function create(O, Properties){ + var result; + if(O !== null){ + Empty[PROTOTYPE] = anObject(O); + result = new Empty; + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; - var selected = { // selected range - row: end && start ? end.row - start.row + 1 : 1, - col: end && start ? end.col - start.col + 1 : 1 - }; - var skippedRow = 0; - var skippedColumn = 0; - var pushData = true; - var cellMeta = void 0; - var getInputValue = function getInputValue(row) { - var col = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; +/***/ }), +/* 80 */ +/***/ (function(module, exports, __webpack_require__) { - var rowValue = input[row % input.length]; +var pIE = __webpack_require__(47) + , createDesc = __webpack_require__(40) + , toIObject = __webpack_require__(23) + , toPrimitive = __webpack_require__(86) + , has = __webpack_require__(22) + , IE8_DOM_DEFINE = __webpack_require__(160) + , gOPD = Object.getOwnPropertyDescriptor; - if (col !== null) { - return rowValue[col % rowValue.length]; - } +exports.f = __webpack_require__(21) ? gOPD : function getOwnPropertyDescriptor(O, P){ + O = toIObject(O); + P = toPrimitive(P, true); + if(IE8_DOM_DEFINE)try { + return gOPD(O, P); + } catch(e){ /* empty */ } + if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); +}; - return rowValue; - }; - var rowInputLength = input.length; - var rowSelectionLength = end ? end.row - start.row + 1 : 0; +/***/ }), +/* 81 */ +/***/ (function(module, exports, __webpack_require__) { - if (end) { - rlen = rowSelectionLength; - } else { - rlen = Math.max(rowInputLength, rowSelectionLength); - } - for (r = 0; r < rlen; r++) { - if (end && current.row > end.row && rowSelectionLength > rowInputLength || !priv.settings.allowInsertRow && current.row > instance.countRows() - 1 || current.row >= priv.settings.maxRows) { - break; - } - var visualRow = r - skippedRow; - var colInputLength = getInputValue(visualRow).length; - var colSelectionLength = end ? end.col - start.col + 1 : 0; +// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) +var $keys = __webpack_require__(169) + , hiddenKeys = __webpack_require__(75).concat('length', 'prototype'); - if (end) { - clen = colSelectionLength; - } else { - clen = Math.max(colInputLength, colSelectionLength); - } - current.col = start.col; - cellMeta = instance.getCellMeta(current.row, current.col); +exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ + return $keys(O, hiddenKeys); +}; - if ((source === 'CopyPaste.paste' || source === 'Autofill.autofill') && cellMeta.skipRowOnPaste) { - skippedRow++; - current.row++; - rlen++; - /* eslint-disable no-continue */ - continue; - } - skippedColumn = 0; +/***/ }), +/* 82 */ +/***/ (function(module, exports, __webpack_require__) { - for (c = 0; c < clen; c++) { - if (end && current.col > end.col && colSelectionLength > colInputLength || !priv.settings.allowInsertColumn && current.col > instance.countCols() - 1 || current.col >= priv.settings.maxCols) { - break; - } - cellMeta = instance.getCellMeta(current.row, current.col); +var shared = __webpack_require__(83)('keys') + , uid = __webpack_require__(49); +module.exports = function(key){ + return shared[key] || (shared[key] = uid(key)); +}; - if ((source === 'CopyPaste.paste' || source === 'Autofill.fill') && cellMeta.skipColumnOnPaste) { - skippedColumn++; - current.col++; - clen++; - continue; - } - if (cellMeta.readOnly) { - current.col++; - /* eslint-disable no-continue */ - continue; - } - var visualColumn = c - skippedColumn; - var value = getInputValue(visualRow, visualColumn); - var orgValue = instance.getDataAtCell(current.row, current.col); - var index = { - row: visualRow, - col: visualColumn - }; +/***/ }), +/* 83 */ +/***/ (function(module, exports, __webpack_require__) { - if (source === 'Autofill.fill') { - var result = instance.runHooks('beforeAutofillInsidePopulate', index, direction, input, deltas, {}, selected); +var global = __webpack_require__(13) + , SHARED = '__core-js_shared__' + , store = global[SHARED] || (global[SHARED] = {}); +module.exports = function(key){ + return store[key] || (store[key] = {}); +}; - if (result) { - value = (0, _mixed.isUndefined)(result.value) ? value : result.value; - } - } - if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') { - if (orgValue === null || (typeof orgValue === 'undefined' ? 'undefined' : _typeof(orgValue)) !== 'object') { - pushData = false; - } else { - var orgValueSchema = (0, _object.duckSchema)(orgValue[0] || orgValue); - var valueSchema = (0, _object.duckSchema)(value[0] || value); +/***/ }), +/* 84 */ +/***/ (function(module, exports, __webpack_require__) { - /* eslint-disable max-depth */ - if ((0, _object.isObjectEquals)(orgValueSchema, valueSchema)) { - value = (0, _object.deepClone)(value); - } else { - pushData = false; - } - } - } else if (orgValue !== null && (typeof orgValue === 'undefined' ? 'undefined' : _typeof(orgValue)) === 'object') { - pushData = false; - } - if (pushData) { - setData.push([current.row, current.col, value]); - } - pushData = true; - current.col++; - } - current.row++; - } - instance.setDataAtCell(setData, null, null, source || 'populateFromArray'); - break; - } - } - }; +// helper for String#{startsWith, endsWith, includes} +var isRegExp = __webpack_require__(164) + , defined = __webpack_require__(30); - /* eslint-disable no-multi-assign */ - this.selection = selection = { // this public assignment is only temporary - inProgress: false, +module.exports = function(that, searchString, NAME){ + if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!"); + return String(defined(that)); +}; - selectedHeader: { - cols: false, - rows: false - }, +/***/ }), +/* 85 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * @param {Boolean} [rows=false] - * @param {Boolean} [cols=false] - * @param {Boolean} [corner=false] - */ - setSelectedHeaders: function setSelectedHeaders() { - var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var cols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var corner = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; +var ctx = __webpack_require__(29) + , invoke = __webpack_require__(284) + , html = __webpack_require__(159) + , cel = __webpack_require__(74) + , global = __webpack_require__(13) + , process = global.process + , setTask = global.setImmediate + , clearTask = global.clearImmediate + , MessageChannel = global.MessageChannel + , counter = 0 + , queue = {} + , ONREADYSTATECHANGE = 'onreadystatechange' + , defer, channel, port; +var run = function(){ + var id = +this; + if(queue.hasOwnProperty(id)){ + var fn = queue[id]; + delete queue[id]; + fn(); + } +}; +var listener = function(event){ + run.call(event.data); +}; +// Node.js 0.9+ & IE10+ has setImmediate, otherwise: +if(!setTask || !clearTask){ + setTask = function setImmediate(fn){ + var args = [], i = 1; + while(arguments.length > i)args.push(arguments[i++]); + queue[++counter] = function(){ + invoke(typeof fn == 'function' ? fn : Function(fn), args); + }; + defer(counter); + return counter; + }; + clearTask = function clearImmediate(id){ + delete queue[id]; + }; + // Node.js 0.8- + if(__webpack_require__(38)(process) == 'process'){ + defer = function(id){ + process.nextTick(ctx(run, id, 1)); + }; + // Browsers with MessageChannel, includes WebWorkers + } else if(MessageChannel){ + channel = new MessageChannel; + port = channel.port2; + channel.port1.onmessage = listener; + defer = ctx(port.postMessage, port, 1); + // Browsers with postMessage, skip WebWorkers + // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' + } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){ + defer = function(id){ + global.postMessage(id + '', '*'); + }; + global.addEventListener('message', listener, false); + // IE8- + } else if(ONREADYSTATECHANGE in cel('script')){ + defer = function(id){ + html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){ + html.removeChild(this); + run.call(id); + }; + }; + // Rest old browsers + } else { + defer = function(id){ + setTimeout(ctx(run, id, 1), 0); + }; + } +} +module.exports = { + set: setTask, + clear: clearTask +}; - instance.selection.selectedHeader.rows = rows; - instance.selection.selectedHeader.cols = cols; - instance.selection.selectedHeader.corner = corner; - }, +/***/ }), +/* 86 */ +/***/ (function(module, exports, __webpack_require__) { +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = __webpack_require__(15); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function(it, S){ + if(!isObject(it))return it; + var fn, val; + if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; + if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; + if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; + throw TypeError("Can't convert object to primitive value"); +}; - /** - * Sets inProgress to `true`. This enables onSelectionEnd and onSelectionEndByProp to function as desired. - */ - begin: function begin() { - instance.selection.inProgress = true; - }, +/***/ }), +/* 87 */ +/***/ (function(module, exports) { +module.exports = __WEBPACK_EXTERNAL_MODULE_87__; - /** - * Sets inProgress to `false`. Triggers onSelectionEnd and onSelectionEndByProp. - */ - finish: function finish() { - var sel = instance.getSelected(); - instance.runHooks('afterSelectionEnd', sel[0], sel[1], sel[2], sel[3]); - instance.runHooks('afterSelectionEndByProp', sel[0], instance.colToProp(sel[1]), sel[2], instance.colToProp(sel[3])); - instance.selection.inProgress = false; - }, - - - /** - * @returns {Boolean} - */ - isInProgress: function isInProgress() { - return instance.selection.inProgress; - }, - - - /** - * Starts selection range on given td object. - * - * @param {CellCoords} coords Visual coords. - * @param keepEditorOpened - */ - setRangeStart: function setRangeStart(coords, keepEditorOpened) { - instance.runHooks('beforeSetRangeStart', coords); - priv.selRange = new _src.CellRange(coords, coords, coords); - selection.setRangeEnd(coords, null, keepEditorOpened); - }, - - - /** - * Starts selection range on given td object. - * - * @param {CellCoords} coords Visual coords. - * @param keepEditorOpened - */ - setRangeStartOnly: function setRangeStartOnly(coords) { - instance.runHooks('beforeSetRangeStartOnly', coords); - priv.selRange = new _src.CellRange(coords, coords, coords); - }, - - - /** - * Ends selection range on given td object. - * - * @param {CellCoords} coords Visual coords. - * @param {Boolean} [scrollToCell=true] If `true`, viewport will be scrolled to range end - * @param {Boolean} [keepEditorOpened] If `true`, cell editor will be still opened after changing selection range - */ - setRangeEnd: function setRangeEnd(coords, scrollToCell, keepEditorOpened) { - if (priv.selRange === null) { - return; - } - var disableVisualSelection, - isHeaderSelected = false, - areCoordsPositive = true; - - var firstVisibleRow = instance.view.wt.wtTable.getFirstVisibleRow(); - var firstVisibleColumn = instance.view.wt.wtTable.getFirstVisibleColumn(); - var newRangeCoords = { - row: null, - col: null - }; - - // trigger handlers - instance.runHooks('beforeSetRangeEnd', coords); - instance.selection.begin(); - - newRangeCoords.row = coords.row < 0 ? firstVisibleRow : coords.row; - newRangeCoords.col = coords.col < 0 ? firstVisibleColumn : coords.col; - - priv.selRange.to = new _src.CellCoords(newRangeCoords.row, newRangeCoords.col); - - if (!priv.settings.multiSelect) { - priv.selRange.from = coords; - } - // set up current selection - instance.view.wt.selections.current.clear(); - - disableVisualSelection = instance.getCellMeta(priv.selRange.highlight.row, priv.selRange.highlight.col).disableVisualSelection; - - if (typeof disableVisualSelection === 'string') { - disableVisualSelection = [disableVisualSelection]; - } - - if (disableVisualSelection === false || Array.isArray(disableVisualSelection) && disableVisualSelection.indexOf('current') === -1) { - instance.view.wt.selections.current.add(priv.selRange.highlight); - } - // set up area selection - instance.view.wt.selections.area.clear(); - - if ((disableVisualSelection === false || Array.isArray(disableVisualSelection) && disableVisualSelection.indexOf('area') === -1) && selection.isMultiple()) { - instance.view.wt.selections.area.add(priv.selRange.from); - instance.view.wt.selections.area.add(priv.selRange.to); - } - // set up highlight - if (priv.settings.currentHeaderClassName || priv.settings.currentRowClassName || priv.settings.currentColClassName) { - instance.view.wt.selections.highlight.clear(); - instance.view.wt.selections.highlight.add(priv.selRange.from); - instance.view.wt.selections.highlight.add(priv.selRange.to); - } - - var preventScrolling = (0, _object.createObjectPropListener)('value'); - - // trigger handlers - instance.runHooks('afterSelection', priv.selRange.from.row, priv.selRange.from.col, priv.selRange.to.row, priv.selRange.to.col, preventScrolling); - instance.runHooks('afterSelectionByProp', priv.selRange.from.row, datamap.colToProp(priv.selRange.from.col), priv.selRange.to.row, datamap.colToProp(priv.selRange.to.col), preventScrolling); - - if (priv.selRange.from.row === 0 && priv.selRange.to.row === instance.countRows() - 1 && instance.countRows() > 1 || priv.selRange.from.col === 0 && priv.selRange.to.col === instance.countCols() - 1 && instance.countCols() > 1) { - isHeaderSelected = true; - } - - if (coords.row < 0 || coords.col < 0) { - areCoordsPositive = false; - } - - if (preventScrolling.isTouched()) { - scrollToCell = !preventScrolling.value; - } - - if (scrollToCell !== false && !isHeaderSelected && areCoordsPositive) { - if (priv.selRange.from && !selection.isMultiple()) { - instance.view.scrollViewport(priv.selRange.from); - } else { - instance.view.scrollViewport(coords); - } - } - - if (selection.selectedHeader.rows && selection.selectedHeader.cols) { - (0, _element.addClass)(instance.rootElement, ['ht__selection--rows', 'ht__selection--columns']); - } else if (selection.selectedHeader.rows) { - (0, _element.removeClass)(instance.rootElement, 'ht__selection--columns'); - (0, _element.addClass)(instance.rootElement, 'ht__selection--rows'); - } else if (selection.selectedHeader.cols) { - (0, _element.removeClass)(instance.rootElement, 'ht__selection--rows'); - (0, _element.addClass)(instance.rootElement, 'ht__selection--columns'); - } else { - (0, _element.removeClass)(instance.rootElement, ['ht__selection--rows', 'ht__selection--columns']); - } - - selection.refreshBorders(null, keepEditorOpened); - }, - - - /** - * Destroys editor, redraws borders around cells, prepares editor. - * - * @param {Boolean} [revertOriginal] - * @param {Boolean} [keepEditor] - */ - refreshBorders: function refreshBorders(revertOriginal, keepEditor) { - if (!keepEditor) { - editorManager.destroyEditor(revertOriginal); - } - instance.view.render(); - - if (selection.isSelected() && !keepEditor) { - editorManager.prepareEditor(); - } - }, - - - /** - * Returns information if we have a multiselection. - * - * @returns {Boolean} - */ - isMultiple: function isMultiple() { - var isMultiple = !(priv.selRange.to.col === priv.selRange.from.col && priv.selRange.to.row === priv.selRange.from.row), - modifier = instance.runHooks('afterIsMultipleSelection', isMultiple); - - if (isMultiple) { - return modifier; - } - }, - - - /** - * Selects cell relative to current cell (if possible). - */ - transformStart: function transformStart(rowDelta, colDelta, force, keepEditorOpened) { - var delta = new _src.CellCoords(rowDelta, colDelta), - rowTransformDir = 0, - colTransformDir = 0, - totalRows, - totalCols, - coords, - fixedRowsBottom; - - instance.runHooks('modifyTransformStart', delta); - totalRows = instance.countRows(); - totalCols = instance.countCols(); - fixedRowsBottom = instance.getSettings().fixedRowsBottom; - - if (priv.selRange.highlight.row + rowDelta > totalRows - 1) { - if (force && priv.settings.minSpareRows > 0 && !(fixedRowsBottom && priv.selRange.highlight.row >= totalRows - fixedRowsBottom - 1)) { - instance.alter('insert_row', totalRows); - totalRows = instance.countRows(); - } else if (priv.settings.autoWrapCol) { - delta.row = 1 - totalRows; - delta.col = priv.selRange.highlight.col + delta.col == totalCols - 1 ? 1 - totalCols : 1; - } - } else if (priv.settings.autoWrapCol && priv.selRange.highlight.row + delta.row < 0 && priv.selRange.highlight.col + delta.col >= 0) { - delta.row = totalRows - 1; - delta.col = priv.selRange.highlight.col + delta.col == 0 ? totalCols - 1 : -1; - } - - if (priv.selRange.highlight.col + delta.col > totalCols - 1) { - if (force && priv.settings.minSpareCols > 0) { - instance.alter('insert_col', totalCols); - totalCols = instance.countCols(); - } else if (priv.settings.autoWrapRow) { - delta.row = priv.selRange.highlight.row + delta.row == totalRows - 1 ? 1 - totalRows : 1; - delta.col = 1 - totalCols; - } - } else if (priv.settings.autoWrapRow && priv.selRange.highlight.col + delta.col < 0 && priv.selRange.highlight.row + delta.row >= 0) { - delta.row = priv.selRange.highlight.row + delta.row == 0 ? totalRows - 1 : -1; - delta.col = totalCols - 1; - } - - coords = new _src.CellCoords(priv.selRange.highlight.row + delta.row, priv.selRange.highlight.col + delta.col); - - if (coords.row < 0) { - rowTransformDir = -1; - coords.row = 0; - } else if (coords.row > 0 && coords.row >= totalRows) { - rowTransformDir = 1; - coords.row = totalRows - 1; - } - - if (coords.col < 0) { - colTransformDir = -1; - coords.col = 0; - } else if (coords.col > 0 && coords.col >= totalCols) { - colTransformDir = 1; - coords.col = totalCols - 1; - } - instance.runHooks('afterModifyTransformStart', coords, rowTransformDir, colTransformDir); - selection.setRangeStart(coords, keepEditorOpened); - }, - - - /** - * Sets selection end cell relative to current selection end cell (if possible). - */ - transformEnd: function transformEnd(rowDelta, colDelta) { - var delta = new _src.CellCoords(rowDelta, colDelta), - rowTransformDir = 0, - colTransformDir = 0, - totalRows, - totalCols, - coords; - - instance.runHooks('modifyTransformEnd', delta); - - totalRows = instance.countRows(); - totalCols = instance.countCols(); - coords = new _src.CellCoords(priv.selRange.to.row + delta.row, priv.selRange.to.col + delta.col); - - if (coords.row < 0) { - rowTransformDir = -1; - coords.row = 0; - } else if (coords.row > 0 && coords.row >= totalRows) { - rowTransformDir = 1; - coords.row = totalRows - 1; - } - - if (coords.col < 0) { - colTransformDir = -1; - coords.col = 0; - } else if (coords.col > 0 && coords.col >= totalCols) { - colTransformDir = 1; - coords.col = totalCols - 1; - } - instance.runHooks('afterModifyTransformEnd', coords, rowTransformDir, colTransformDir); - selection.setRangeEnd(coords, true); - }, - - - /** - * Returns `true` if currently there is a selection on screen, `false` otherwise. - * - * @returns {Boolean} - */ - isSelected: function isSelected() { - return priv.selRange !== null; - }, - - - /** - * Returns `true` if coords is within current selection coords. - * - * @param {CellCoords} coords - * @returns {Boolean} - */ - inInSelection: function inInSelection(coords) { - if (!selection.isSelected()) { - return false; - } - - return priv.selRange.includes(coords); - }, - - - /** - * Deselects all selected cells - */ - deselect: function deselect() { - if (!selection.isSelected()) { - return; - } - instance.selection.inProgress = false; // needed by HT inception - priv.selRange = null; - instance.view.wt.selections.current.clear(); - instance.view.wt.selections.area.clear(); - if (priv.settings.currentHeaderClassName || priv.settings.currentRowClassName || priv.settings.currentColClassName) { - instance.view.wt.selections.highlight.clear(); - } - editorManager.destroyEditor(); - selection.refreshBorders(); - (0, _element.removeClass)(instance.rootElement, ['ht__selection--rows', 'ht__selection--columns']); - instance.runHooks('afterDeselect'); - }, - - - /** - * Select all cells - */ - selectAll: function selectAll() { - if (!priv.settings.multiSelect) { - return; - } - selection.setSelectedHeaders(true, true, true); - selection.setRangeStart(new _src.CellCoords(0, 0)); - selection.setRangeEnd(new _src.CellCoords(instance.countRows() - 1, instance.countCols() - 1), false); - }, - - - /** - * Deletes data from selected cells - */ - empty: function empty() { - if (!selection.isSelected()) { - return; - } - var topLeft = priv.selRange.getTopLeftCorner(); - var bottomRight = priv.selRange.getBottomRightCorner(); - var r, - c, - changes = []; - - for (r = topLeft.row; r <= bottomRight.row; r++) { - for (c = topLeft.col; c <= bottomRight.col; c++) { - if (!instance.getCellMeta(r, c).readOnly) { - changes.push([r, c, '']); - } - } - } - instance.setDataAtCell(changes); - } - }; - - this.init = function () { - dataSource.setData(priv.settings.data); - instance.runHooks('beforeInit'); - - if ((0, _browser.isMobileBrowser)()) { - (0, _element.addClass)(instance.rootElement, 'mobile'); - } - - this.updateSettings(priv.settings, true); - - this.view = new _tableView2.default(this); - editorManager = new _editorManager2.default(instance, priv, selection, datamap); - - this.forceFullRender = true; // used when data was changed - - instance.runHooks('init'); - this.view.render(); - - if (_typeof(priv.firstRun) === 'object') { - instance.runHooks('afterChange', priv.firstRun[0], priv.firstRun[1]); - priv.firstRun = false; - } - instance.runHooks('afterInit'); - }; - - function ValidatorsQueue() { - // moved this one level up so it can be used in any function here. Probably this should be moved to a separate file - var resolved = false; - - return { - validatorsInQueue: 0, - valid: true, - addValidatorToQueue: function addValidatorToQueue() { - this.validatorsInQueue++; - resolved = false; - }, - removeValidatorFormQueue: function removeValidatorFormQueue() { - this.validatorsInQueue = this.validatorsInQueue - 1 < 0 ? 0 : this.validatorsInQueue - 1; - this.checkIfQueueIsEmpty(); - }, - onQueueEmpty: function onQueueEmpty(valid) {}, - checkIfQueueIsEmpty: function checkIfQueueIsEmpty() { - if (this.validatorsInQueue == 0 && resolved == false) { - resolved = true; - this.onQueueEmpty(this.valid); - } - } - }; - } - - function validateChanges(changes, source, callback) { - var waitingForValidator = new ValidatorsQueue(); - waitingForValidator.onQueueEmpty = resolve; - - for (var i = changes.length - 1; i >= 0; i--) { - if (changes[i] === null) { - changes.splice(i, 1); - } else { - var row = changes[i][0]; - var col = datamap.propToCol(changes[i][1]); - - var cellProperties = instance.getCellMeta(row, col); - - if (cellProperties.type === 'numeric' && typeof changes[i][3] === 'string') { - if (changes[i][3].length > 0 && (/^-?[\d\s]*(\.|,)?\d*$/.test(changes[i][3]) || cellProperties.format)) { - var len = changes[i][3].length; - - if ((0, _mixed.isUndefined)(cellProperties.language)) { - _numbro2.default.culture('en-US'); - } else if (changes[i][3].indexOf('.') === len - 3 && changes[i][3].indexOf(',') === -1) { - // this input in format XXXX.XX is likely to come from paste. Let's parse it using international rules - _numbro2.default.culture('en-US'); - } else { - - _numbro2.default.culture(cellProperties.language); - } - - var _numbro$cultureData = _numbro2.default.cultureData(_numbro2.default.culture()), - delimiters = _numbro$cultureData.delimiters; - - // try to parse to float - https://github.com/foretagsplatsen/numbro/pull/183 - - - if (_numbro2.default.validate(changes[i][3]) && !isNaN(changes[i][3])) { - changes[i][3] = parseFloat(changes[i][3]); - } else { - changes[i][3] = (0, _numbro2.default)().unformat(changes[i][3]) || changes[i][3]; - } - } - } - - /* eslint-disable no-loop-func */ - if (instance.getCellValidator(cellProperties)) { - waitingForValidator.addValidatorToQueue(); - instance.validateCell(changes[i][3], cellProperties, function (i, cellProperties) { - return function (result) { - if (typeof result !== 'boolean') { - throw new Error('Validation error: result is not boolean'); - } - if (result === false && cellProperties.allowInvalid === false) { - changes.splice(i, 1); // cancel the change - cellProperties.valid = true; // we cancelled the change, so cell value is still valid - var cell = instance.getCell(cellProperties.row, cellProperties.col); - (0, _element.removeClass)(cell, instance.getSettings().invalidCellClassName); - --i; - } - waitingForValidator.removeValidatorFormQueue(); - }; - }(i, cellProperties), source); - } - } - } - waitingForValidator.checkIfQueueIsEmpty(); - - function resolve() { - var beforeChangeResult; - - if (changes.length) { - beforeChangeResult = instance.runHooks('beforeChange', changes, source); - if ((0, _function.isFunction)(beforeChangeResult)) { - console.warn('Your beforeChange callback returns a function. It\'s not supported since Handsontable 0.12.1 (and the returned function will not be executed).'); - } else if (beforeChangeResult === false) { - changes.splice(0, changes.length); // invalidate all changes (remove everything from array) - } - } - callback(); // called when async validators are resolved and beforeChange was not async - } - } - - /** - * Internal function to apply changes. Called after validateChanges - * - * @private - * @param {Array} changes Array in form of [row, prop, oldValue, newValue] - * @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback) - * @fires Hooks#beforeChangeRender - * @fires Hooks#afterChange - */ - function applyChanges(changes, source) { - var i = changes.length - 1; - - if (i < 0) { - return; - } - - for (; i >= 0; i--) { - var skipThisChange = false; - - if (changes[i] === null) { - changes.splice(i, 1); - /* eslint-disable no-continue */ - continue; - } - - if (changes[i][2] == null && changes[i][3] == null) { - /* eslint-disable no-continue */ - continue; - } - - if (priv.settings.allowInsertRow) { - while (changes[i][0] > instance.countRows() - 1) { - var numberOfCreatedRows = datamap.createRow(void 0, void 0, source); - - if (numberOfCreatedRows === 0) { - skipThisChange = true; - break; - } - } - } - - if (skipThisChange) { - /* eslint-disable no-continue */ - continue; - } - - if (instance.dataType === 'array' && (!priv.settings.columns || priv.settings.columns.length === 0) && priv.settings.allowInsertColumn) { - while (datamap.propToCol(changes[i][1]) > instance.countCols() - 1) { - datamap.createCol(void 0, void 0, source); - } - } - - datamap.set(changes[i][0], changes[i][1], changes[i][3]); - } - - instance.forceFullRender = true; // used when data was changed - grid.adjustRowsAndCols(); - instance.runHooks('beforeChangeRender', changes, source); - selection.refreshBorders(null, true); - instance.view.wt.wtOverlays.adjustElementsSize(); - instance.runHooks('afterChange', changes, source || 'edit'); - - var activeEditor = instance.getActiveEditor(); - - if (activeEditor && (0, _mixed.isDefined)(activeEditor.refreshValue)) { - activeEditor.refreshValue(); - } - } - - this.validateCell = function (value, cellProperties, callback, source) { - var validator = instance.getCellValidator(cellProperties); - - function done(valid) { - var col = cellProperties.visualCol, - row = cellProperties.visualRow, - td = instance.getCell(row, col, true); - - if (td && td.nodeName != 'TH') { - instance.view.wt.wtSettings.settings.cellRenderer(row, col, td); - } - callback(valid); - } - - if ((0, _mixed.isRegExp)(validator)) { - validator = function (validator) { - return function (value, callback) { - callback(validator.test(value)); - }; - }(validator); - } - - if ((0, _function.isFunction)(validator)) { - - value = instance.runHooks('beforeValidate', value, cellProperties.visualRow, cellProperties.prop, source); - - // To provide consistent behaviour, validation should be always asynchronous - instance._registerTimeout(setTimeout(function () { - validator.call(cellProperties, value, function (valid) { - valid = instance.runHooks('afterValidate', valid, value, cellProperties.visualRow, cellProperties.prop, source); - cellProperties.valid = valid; - - done(valid); - instance.runHooks('postAfterValidate', valid, value, cellProperties.visualRow, cellProperties.prop, source); - }); - }, 0)); - } else { - // resolve callback even if validator function was not found - instance._registerTimeout(setTimeout(function () { - cellProperties.valid = true; - done(cellProperties.valid); - }, 0)); - } - }; - - function setDataInputToArray(row, propOrCol, value) { - if ((typeof row === 'undefined' ? 'undefined' : _typeof(row)) === 'object') { - // is it an array of changes - return row; - } - return [[row, propOrCol, value]]; - } - - /** - * @description - * Set new value to a cell. To change many cells at once, pass an array of `changes` in format `[[row, col, value], ...]` as - * the only parameter. `col` is the index of a __visible__ column (note that if columns were reordered, - * the current visible order will be used). `source` is a flag for before/afterChange events. If you pass only array of - * changes then `source` could be set as second parameter. - * - * @memberof Core# - * @function setDataAtCell - * @param {Number|Array} row Visual row index or array of changes in format `[[row, col, value], ...]`. - * @param {Number} col Visual column index. - * @param {String} value New value. - * @param {String} [source] String that identifies how this change will be described in the changes array (useful in onAfterChange or onBeforeChange callback). - */ - this.setDataAtCell = function (row, col, value, source) { - var input = setDataInputToArray(row, col, value), - i, - ilen, - changes = [], - prop; - - for (i = 0, ilen = input.length; i < ilen; i++) { - if (_typeof(input[i]) !== 'object') { - throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter'); - } - if (typeof input[i][1] !== 'number') { - throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`'); - } - prop = datamap.colToProp(input[i][1]); - changes.push([input[i][0], prop, dataSource.getAtCell(recordTranslator.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]); - } - - if (!source && (typeof row === 'undefined' ? 'undefined' : _typeof(row)) === 'object') { - source = col; - } - - instance.runHooks('afterSetDataAtCell', changes, source); - - validateChanges(changes, source, function () { - applyChanges(changes, source); - }); - }; - - /** - * @description - * Set new value to a cell. To change many cells at once, pass an array of `changes` in format `[[row, prop, value], ...]` as - * the only parameter. `prop` is the name of the object property (e.g. `first.name`). `source` is a flag for before/afterChange events. - * If you pass only array of changes then `source` could be set as second parameter. - * - * @memberof Core# - * @function setDataAtRowProp - * @param {Number|Array} row Visual row index or array of changes in format `[[row, prop, value], ...]`. - * @param {String} prop Property name or the source string. - * @param {String} value Value to be set. - * @param {String} [source] String that identifies how this change will be described in changes array (useful in onChange callback). - */ - this.setDataAtRowProp = function (row, prop, value, source) { - var input = setDataInputToArray(row, prop, value), - i, - ilen, - changes = []; - - for (i = 0, ilen = input.length; i < ilen; i++) { - changes.push([input[i][0], input[i][1], dataSource.getAtCell(recordTranslator.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]); - } - - if (!source && (typeof row === 'undefined' ? 'undefined' : _typeof(row)) === 'object') { - source = prop; - } - - instance.runHooks('afterSetDataAtRowProp', changes, source); - - validateChanges(changes, source, function () { - applyChanges(changes, source); - }); - }; - - /** - * Listen to the keyboard input on document body. - * - * @memberof Core# - * @function listen - * @since 0.11 - */ - this.listen = function () { - var invalidActiveElement = !document.activeElement || document.activeElement && document.activeElement.nodeName === void 0; - - if (document.activeElement && document.activeElement !== document.body && !invalidActiveElement) { - document.activeElement.blur(); - } else if (invalidActiveElement) { - // IE - document.body.focus(); - } - - activeGuid = instance.guid; - }; - - /** - * Stop listening to keyboard input on the document body. - * - * @memberof Core# - * @function unlisten - * @since 0.11 - */ - this.unlisten = function () { - if (this.isListening()) { - activeGuid = null; - } - }; - - /** - * Returns `true` if the current Handsontable instance is listening to keyboard input on document body. - * - * @memberof Core# - * @function isListening - * @since 0.11 - * @returns {Boolean} `true` if the instance is listening, `false` otherwise. - */ - this.isListening = function () { - return activeGuid === instance.guid; - }; - - /** - * Destroys the current editor, renders and selects the current cell. - * - * @memberof Core# - * @function destroyEditor - * @param {Boolean} [revertOriginal] If != `true`, edited data is saved. Otherwise the previous value is restored. - */ - this.destroyEditor = function (revertOriginal) { - selection.refreshBorders(revertOriginal); - }; - - /** - * Populate cells at position with 2D input array (e.g. `[[1, 2], [3, 4]]`). - * Use `endRow`, `endCol` when you want to cut input when a certain row is reached. - * Optional `source` parameter (default value "populateFromArray") is used to identify this call in the resulting events (beforeChange, afterChange). - * Optional `populateMethod` parameter (default value "overwrite", possible values "shift_down" and "shift_right") - * has the same effect as pasteMode option {@link Options#pasteMode} - * - * @memberof Core# - * @function populateFromArray - * @since 0.9.0 - * @param {Number} row Start visual row index. - * @param {Number} col Start visual column index. - * @param {Array} input 2d array - * @param {Number} [endRow] End visual row index (use when you want to cut input when certain row is reached). - * @param {Number} [endCol] End visual column index (use when you want to cut input when certain column is reached). - * @param {String} [source="populateFromArray"] Source string. - * @param {String} [method="overwrite"] Populate method. Possible options: `shift_down`, `shift_right`, `overwrite`. - * @param {String} direction Populate direction. (left|right|up|down) - * @param {Array} deltas Deltas array. - * @returns {Object|undefined} The ending TD element in pasted area (only if any cells were changed). - */ - this.populateFromArray = function (row, col, input, endRow, endCol, source, method, direction, deltas) { - var c; - - if (!((typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object' && _typeof(input[0]) === 'object')) { - throw new Error('populateFromArray parameter `input` must be an array of arrays'); // API changed in 0.9-beta2, let's check if you use it correctly - } - c = typeof endRow === 'number' ? new _src.CellCoords(endRow, endCol) : null; - - return grid.populateFromArray(new _src.CellCoords(row, col), input, c, source, method, direction, deltas); - }; - - /** - * Adds/removes data from the column. This function is modelled after Array.splice. - * Parameter `col` is the index of the column in which do you want to do splice. - * Parameter `index` is the row index at which to start changing the array. - * If negative, will begin that many elements from the end. Parameter `amount`, is the number of the old array elements to remove. - * If the amount is 0, no elements are removed. Fourth and further parameters are the `elements` to add to the array. - * If you don't specify any elements, spliceCol simply removes elements from the array. - * {@link DataMap#spliceCol} - * - * @memberof Core# - * @function spliceCol - * @since 0.9-beta2 - * @param {Number} col Index of the column in which do you want to do splice. - * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end. - * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed. - * @param {*} [elements] The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array. - */ - this.spliceCol = function (col, index, amount /* , elements... */) { - var _datamap; - - return (_datamap = datamap).spliceCol.apply(_datamap, arguments); - }; - - /** - * Adds/removes data from the row. This function works is modelled after Array.splice. - * Parameter `row` is the index of row in which do you want to do splice. - * Parameter `index` is the column index at which to start changing the array. - * If negative, will begin that many elements from the end. Parameter `amount`, is the number of old array elements to remove. - * If the amount is 0, no elements are removed. Fourth and further parameters are the `elements` to add to the array. - * If you don't specify any elements, spliceCol simply removes elements from the array. - * {@link DataMap#spliceRow} - * - * @memberof Core# - * @function spliceRow - * @since 0.11 - * @param {Number} row Index of column in which do you want to do splice. - * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end. - * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed. - * @param {*} [elements] The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array. - */ - this.spliceRow = function (row, index, amount /* , elements... */) { - var _datamap2; - - return (_datamap2 = datamap).spliceRow.apply(_datamap2, arguments); - }; - - /** - * Returns indexes of the currently selected cells as an array `[startRow, startCol, endRow, endCol]`. - * - * Start row and start col are the coordinates of the active cell (where the selection was started). - * - * @memberof Core# - * @function getSelected - * @returns {Array} Array of the selection's indexes. - */ - this.getSelected = function () { - // https://github.com/handsontable/handsontable/issues/44 //cjl - if (selection.isSelected()) { - return [priv.selRange.from.row, priv.selRange.from.col, priv.selRange.to.row, priv.selRange.to.col]; - } - }; - - /** - * Returns the current selection as a CellRange object. - * - * @memberof Core# - * @function getSelectedRange - * @since 0.11 - * @returns {CellRange} Selected range object or undefined` if there is no selection. - */ - this.getSelectedRange = function () { - // https://github.com/handsontable/handsontable/issues/44 //cjl - if (selection.isSelected()) { - return priv.selRange; - } - }; - - /** - * Rerender the table. - * - * @memberof Core# - * @function render - */ - this.render = function () { - if (instance.view) { - instance.renderCall = true; - instance.forceFullRender = true; // used when data was changed - selection.refreshBorders(null, true); - } - }; - - /** - * Reset all cells in the grid to contain data from the data array. - * - * @memberof Core# - * @function loadData - * @param {Array} data Array of arrays or array of objects containing data. - * @fires Hooks#afterLoadData - * @fires Hooks#afterChange - */ - this.loadData = function (data) { - if (Array.isArray(priv.settings.dataSchema)) { - instance.dataType = 'array'; - } else if ((0, _function.isFunction)(priv.settings.dataSchema)) { - instance.dataType = 'function'; - } else { - instance.dataType = 'object'; - } - - if (datamap) { - datamap.destroy(); - } - datamap = new _dataMap2.default(instance, priv, GridSettings); - - if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && data !== null) { - if (!(data.push && data.splice)) { - // check if data is array. Must use duck-type check so Backbone Collections also pass it - // when data is not an array, attempt to make a single-row array of it - data = [data]; - } - } else if (data === null) { - data = []; - var row; - var r = 0; - var rlen = 0; - var dataSchema = datamap.getSchema(); - - for (r = 0, rlen = priv.settings.startRows; r < rlen; r++) { - if ((instance.dataType === 'object' || instance.dataType === 'function') && priv.settings.dataSchema) { - row = (0, _object.deepClone)(dataSchema); - data.push(row); - } else if (instance.dataType === 'array') { - row = (0, _object.deepClone)(dataSchema[0]); - data.push(row); - } else { - row = []; - - for (var c = 0, clen = priv.settings.startCols; c < clen; c++) { - row.push(null); - } - - data.push(row); - } - } - } else { - throw new Error('loadData only accepts array of objects or array of arrays (' + (typeof data === 'undefined' ? 'undefined' : _typeof(data)) + ' given)'); - } - - priv.isPopulated = false; - GridSettings.prototype.data = data; - - if (Array.isArray(data[0])) { - instance.dataType = 'array'; - } - - datamap.dataSource = data; - dataSource.data = data; - dataSource.dataType = instance.dataType; - dataSource.colToProp = datamap.colToProp.bind(datamap); - dataSource.propToCol = datamap.propToCol.bind(datamap); - - clearCellSettingCache(); - - grid.adjustRowsAndCols(); - instance.runHooks('afterLoadData', priv.firstRun); - - if (priv.firstRun) { - priv.firstRun = [null, 'loadData']; - } else { - instance.runHooks('afterChange', null, 'loadData'); - instance.render(); - } - priv.isPopulated = true; - - function clearCellSettingCache() { - priv.cellSettings.length = 0; - } - }; - - /** - * Returns the current data object (the same one that was passed by `data` configuration option or `loadData` method, - * unless the `modifyRow` hook was used to trim some of the rows. If that's the case - use the {@link Core#getSourceData} method.). - * Optionally you can provide cell range by defining `row`, `col`, `row2`, `col2` to get only a fragment of grid data. - * - * Note: getData functionality changed with the release of version 0.20. If you're looking for the previous functionality, - * you should use the {@link Core#getSourceData} method. - * - * @memberof Core# - * @function getData - * @param {Number} [r] From visual row index. - * @param {Number} [c] From visual column index. - * @param {Number} [r2] To visual row index. - * @param {Number} [c2] To visual column index. - * @returns {Array} Array with the data. - */ - this.getData = function (r, c, r2, c2) { - if ((0, _mixed.isUndefined)(r)) { - return datamap.getAll(); - } - return datamap.getRange(new _src.CellCoords(r, c), new _src.CellCoords(r2, c2), datamap.DESTINATION_RENDERER); - }; - - /** - * Returns a string value of the selected range. Each column is separated by tab, each row is separated by a new line character. - * {@link DataMap#getCopyableText} - * - * @memberof Core# - * @function getCopyableText - * @since 0.11 - * @param {Number} startRow From visual row index. - * @param {Number} startCol From visual column index. - * @param {Number} endRow To visual row index. - * @param {Number} endCol To visual column index. - * @returns {String} - */ - this.getCopyableText = function (startRow, startCol, endRow, endCol) { - return datamap.getCopyableText(new _src.CellCoords(startRow, startCol), new _src.CellCoords(endRow, endCol)); - }; - - /** - * Returns the data's copyable value at specified row and column index ({@link DataMap#getCopyable}). - * - * @memberof Core# - * @function getCopyableData - * @since 0.19.0 - * @param {Number} row Visual row index. - * @param {Number} column Visual column index. - * @returns {String} - */ - this.getCopyableData = function (row, column) { - return datamap.getCopyable(row, datamap.colToProp(column)); - }; - - /** - * Returns schema provided by constructor settings. If it doesn't exist then it returns the schema based on the data - * structure in the first row. - * - * @memberof Core# - * @function getSchema - * @since 0.13.2 - * @returns {Object} Schema object. - */ - this.getSchema = function () { - return datamap.getSchema(); - }; - - /** - * Use it if you need to change configuration after initialization. The `settings` parameter is an object containing the new - * settings, declared the same way as in the initial settings object. - * Note, that although the `updateSettings` method doesn't overwrite the previously declared settings, it might reset - * the settings made post-initialization. (for example - ignore changes made using the columnResize feature). - * - * @memberof Core# - * @function updateSettings - * @param {Object} settings New settings object. - * @param {Boolean} init Calls this method in the initialization mode. Internal use only. - * Used by API could be cause of the unexpected behaviour of the Handsontable. - * @example - * ```js - * hot.updateSettings({ - * contextMenu: true, - * colHeaders: true, - * fixedRowsTop: 2 - * }); - * ``` - * @fires Hooks#afterCellMetaReset - * @fires Hooks#afterUpdateSettings - */ - this.updateSettings = function (settings, init) { - var columnsAsFunc = false; - var i = void 0; - var j = void 0; - var clen = void 0; - - if ((0, _mixed.isDefined)(settings.rows)) { - throw new Error('"rows" setting is no longer supported. do you mean startRows, minRows or maxRows?'); - } - if ((0, _mixed.isDefined)(settings.cols)) { - throw new Error('"cols" setting is no longer supported. do you mean startCols, minCols or maxCols?'); - } - - for (i in settings) { - if (i === 'data') { - /* eslint-disable no-continue */ - continue; // loadData will be triggered later - } else if (_pluginHooks2.default.getSingleton().getRegistered().indexOf(i) > -1) { - if ((0, _function.isFunction)(settings[i]) || Array.isArray(settings[i])) { - settings[i].initialHook = true; - instance.addHook(i, settings[i]); - } - } else if (!init && (0, _object.hasOwnProperty)(settings, i)) { - // Update settings - GridSettings.prototype[i] = settings[i]; - } - } - - // Load data or create data map - if (settings.data === void 0 && priv.settings.data === void 0) { - instance.loadData(null); // data source created just now - } else if (settings.data !== void 0) { - instance.loadData(settings.data); // data source given as option - } else if (settings.columns !== void 0) { - datamap.createMap(); - } - - clen = instance.countCols(); - - var columnSetting = settings.columns || GridSettings.prototype.columns; - - // Init columns constructors configuration - if (columnSetting && (0, _function.isFunction)(columnSetting)) { - clen = instance.countSourceCols(); - columnsAsFunc = true; - } - - // Clear cellSettings cache - if (settings.cell !== void 0 || settings.cells !== void 0 || settings.columns !== void 0) { - priv.cellSettings.length = 0; - } - - if (clen > 0) { - var proto = void 0; - var column = void 0; - - for (i = 0, j = 0; i < clen; i++) { - if (columnsAsFunc && !columnSetting(i)) { - /* eslint-disable no-continue */ - continue; - } - priv.columnSettings[j] = (0, _setting.columnFactory)(GridSettings, priv.columnsSettingConflicts); - - // shortcut for prototype - proto = priv.columnSettings[j].prototype; - - // Use settings provided by user - if (columnSetting) { - if (columnsAsFunc) { - column = columnSetting(i); - } else { - column = columnSetting[j]; - } - - if (column) { - (0, _object.extend)(proto, column); - (0, _object.extend)(proto, expandType(column)); - } - } - - j++; - } - } - - if ((0, _mixed.isDefined)(settings.cell)) { - for (var key in settings.cell) { - if ((0, _object.hasOwnProperty)(settings.cell, key)) { - var cell = settings.cell[key]; - - instance.setCellMetaObject(cell.row, cell.col, cell); - } - } - } - - instance.runHooks('afterCellMetaReset'); - - if ((0, _mixed.isDefined)(settings.className)) { - if (GridSettings.prototype.className) { - (0, _element.removeClass)(instance.rootElement, GridSettings.prototype.className); - } - if (settings.className) { - (0, _element.addClass)(instance.rootElement, settings.className); - } - } - - var currentHeight = instance.rootElement.style.height; - if (currentHeight !== '') { - currentHeight = parseInt(instance.rootElement.style.height, 10); - } - - var height = settings.height; - if ((0, _function.isFunction)(height)) { - height = height(); - } - - if (init) { - var initialStyle = instance.rootElement.getAttribute('style'); - - if (initialStyle) { - instance.rootElement.setAttribute('data-initialstyle', instance.rootElement.getAttribute('style')); - } - } - - if (height === null) { - var _initialStyle = instance.rootElement.getAttribute('data-initialstyle'); - - if (_initialStyle && (_initialStyle.indexOf('height') > -1 || _initialStyle.indexOf('overflow') > -1)) { - instance.rootElement.setAttribute('style', _initialStyle); - } else { - instance.rootElement.style.height = ''; - instance.rootElement.style.overflow = ''; - } - } else if (height !== void 0) { - instance.rootElement.style.height = height + 'px'; - instance.rootElement.style.overflow = 'hidden'; - } - - if (typeof settings.width !== 'undefined') { - var width = settings.width; - - if ((0, _function.isFunction)(width)) { - width = width(); - } - - instance.rootElement.style.width = width + 'px'; - } - - if (!init) { - datamap.clearLengthCache(); // force clear cache length on updateSettings() #3416 - - if (instance.view) { - instance.view.wt.wtViewport.resetHasOversizedColumnHeadersMarked(); - } - - instance.runHooks('afterUpdateSettings'); - } - - grid.adjustRowsAndCols(); - if (instance.view && !priv.firstRun) { - instance.forceFullRender = true; // used when data was changed - selection.refreshBorders(null, true); - } - - if (!init && instance.view && (currentHeight === '' || height === '' || height === void 0) && currentHeight !== height) { - instance.view.wt.wtOverlays.updateMainScrollableElements(); - } - }; - - /** - * Get value from the selected cell. - * - * @memberof Core# - * @function getValue - * @since 0.11 - * @returns {*} Value of selected cell. - */ - this.getValue = function () { - var sel = instance.getSelected(); - if (GridSettings.prototype.getValue) { - if ((0, _function.isFunction)(GridSettings.prototype.getValue)) { - return GridSettings.prototype.getValue.call(instance); - } else if (sel) { - return instance.getData()[sel[0]][GridSettings.prototype.getValue]; - } - } else if (sel) { - return instance.getDataAtCell(sel[0], sel[1]); - } - }; - - function expandType(obj) { - if (!(0, _object.hasOwnProperty)(obj, 'type')) { - // ignore obj.prototype.type - return; - } - - var type, - expandedType = {}; - - if (_typeof(obj.type) === 'object') { - type = obj.type; - } else if (typeof obj.type === 'string') { - type = (0, _cellTypes.getCellType)(obj.type); - } - - for (var i in type) { - if ((0, _object.hasOwnProperty)(type, i) && !(0, _object.hasOwnProperty)(obj, i)) { - expandedType[i] = type[i]; - } - } - - return expandedType; - } - - /** - * Returns the object settings. - * - * @memberof Core# - * @function getSettings - * @returns {Object} Object containing the current grid settings. - */ - this.getSettings = function () { - return priv.settings; - }; - - /** - * Clears the data from the grid. (The table settings remain intact.) - * - * @memberof Core# - * @function clear - * @since 0.11 - */ - this.clear = function () { - selection.selectAll(); - selection.empty(); - }; - - /** - * @memberof Core# - * @function alter - * @param {String} action See grid.alter for possible values: `"insert_row"`, `"insert_col"`, `"remove_row"`, `"remove_col"` - * @param {Number} index Visual index of the row/column before which the new row/column will be inserted/removed. - * @param {Number} [amount = 1] Amound of rows/columns to be inserted/removed. - * @param {String} [source] Source indicator. - * @param {Boolean} [keepEmptyRows] Flag for preventing deletion of empty rows. - * @description - * - * Allows altering the table structure by either inserting/removing rows or inserting/removing columns: - * - * Insert new row(s) above the row with a given `index`. If index is `null` or `undefined`, the new row will be - * added after the last row. - * ```js - * var hot = new Handsontable(document.getElementById('example')); - * hot.alter('insert_row', 10); - * ``` - * - * Insert new column(s) before the column with a given `index`. If index is `null` or `undefined`, the new column - * will be added after the last column. - * ```js - * var hot = new Handsontable(document.getElementById('example')); - * hot.alter('insert_col', 10); - * ``` - * - * Remove the row(s) at the given `index`. - * ```js - * var hot = new Handsontable(document.getElementById('example')); - * hot.alter('remove_row', 10); - * ``` - * - * Remove the column(s) at the given `index`. - * ```js - * var hot = new Handsontable(document.getElementById('example')); - * hot.alter('remove_col', 10); - * ``` - */ - this.alter = function (action, index, amount, source, keepEmptyRows) { - grid.alter(action, index, amount, source, keepEmptyRows); - }; - - /** - * Returns a TD element for the given `row` and `col` arguments, if it is rendered on screen. - * Returns `null` if the TD is not rendered on screen (probably because that part of the table is not visible). - * - * @memberof Core# - * @function getCell - * @param {Number} row Visual row index. - * @param {Number} col 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. - * @returns {Element} The cell's TD element. - */ - this.getCell = function (row, col, topmost) { - return instance.view.getCellAtCoords(new _src.CellCoords(row, col), topmost); - }; - - /** - * Returns the coordinates of the cell, provided as a HTML Element. - * - * @memberof Core# - * @function getCoords - * @param {Element} elem The HTML Element representing the cell. - * @returns {CellCoords} Visual coordinates object. - */ - this.getCoords = function (elem) { - return this.view.wt.wtTable.getCoords.call(this.view.wt.wtTable, elem); - }; - - /** - * Returns the property name that corresponds with the given column index. {@link DataMap#colToProp} - * If the data source is an array of arrays, it returns the columns index. - * - * @memberof Core# - * @function colToProp - * @param {Number} col Visual column index. - * @returns {String|Number} Column property or physical column index. - */ - this.colToProp = function (col) { - return datamap.colToProp(col); - }; - - /** - * Returns column index that corresponds with the given property. {@link DataMap#propToCol} - * - * @memberof Core# - * @function propToCol - * @param {String|Number} prop Property name or physical column index. - * @returns {Number} Visual column index. - */ - this.propToCol = function (prop) { - return datamap.propToCol(prop); - }; - - /** - * Translate physical row index into visual. - * - * @since 0.29.0 - * @memberof Core# - * @function toVisualRow - * @param {Number} row Physical row index. - * @returns {Number} Returns visual row index. - */ - this.toVisualRow = function (row) { - return recordTranslator.toVisualRow(row); - }; - - /** - * Translate physical column index into visual. - * - * @since 0.29.0 - * @memberof Core# - * @function toVisualColumn - * @param {Number} column Physical column index. - * @returns {Number} Returns visual column index. - */ - this.toVisualColumn = function (column) { - return recordTranslator.toVisualColumn(column); - }; - - /** - * Translate visual row index into physical. - * If displayed rows order is different than the order of rows stored in memory (i.e. sorting is applied) - * to retrieve valid physical row index you can use this method. - * - * @since 0.29.0 - * @memberof Core# - * @function toPhysicalRow - * @param {Number} row Visual row index. - * @returns {Number} Returns physical row index. - */ - this.toPhysicalRow = function (row) { - return recordTranslator.toPhysicalRow(row); - }; - - /** - * Translate visual column index into physical. - * If displayed columns order is different than the order of columns stored in memory (i.e. manual column move is applied) - * to retrieve valid physical column index you can use this method. - * - * @since 0.29.0 - * @memberof Core# - * @function toPhysicalColumn - * @param {Number} column Visual column index. - * @returns {Number} Returns physical column index. - */ - this.toPhysicalColumn = function (column) { - return recordTranslator.toPhysicalColumn(column); - }; - - /** - * @description - * Returns the cell value at `row`, `col`. `row` and `col` are the __visible__ indexes (note, that if columns were reordered or sorted, - * the currently visible order will be used). - * - * @memberof Core# - * @function getDataAtCell - * @param {Number} row Visual row index. - * @param {Number} col Visual column index. - * @returns {String|Boolean|null} Data at cell. - */ - this.getDataAtCell = function (row, col) { - return datamap.get(row, datamap.colToProp(col)); - }; - - /** - * Return value at `row`, `prop`. (Uses {@link DataMap#get}) - * - * @memberof Core# - * @function getDataAtRowProp - * @param {Number} row Visual row index. - * @param {String} prop Property name. - * @returns {*} Cell value. - */ - this.getDataAtRowProp = function (row, prop) { - return datamap.get(row, prop); - }; - - /** - * @description - * Returns array of column values from the data source. `col` is the __visible__ index of the column. - * Note, that if columns were reordered or sorted, the currently visible order will be used. - * - * @memberof Core# - * @function getDataAtCol - * @since 0.9-beta2 - * @param {Number} col Visual column index. - * @returns {Array} Array of cell values. - */ - this.getDataAtCol = function (col) { - var out = []; - return out.concat.apply(out, _toConsumableArray(datamap.getRange(new _src.CellCoords(0, col), new _src.CellCoords(priv.settings.data.length - 1, col), datamap.DESTINATION_RENDERER))); - }; - - /** - * Given the object property name (e.g. `'first.name'`), returns an array of column's values from the data source. - * You can also provide a column index as the first argument. - * - * @memberof Core# - * @function getDataAtProp - * @since 0.9-beta2 - * @param {String|Number} prop Property name / physical column index. - * @returns {Array} Array of cell values. - */ - // TODO: Getting data from `datamap` should work on visual indexes. - this.getDataAtProp = function (prop) { - var out = [], - range; - - range = datamap.getRange(new _src.CellCoords(0, datamap.propToCol(prop)), new _src.CellCoords(priv.settings.data.length - 1, datamap.propToCol(prop)), datamap.DESTINATION_RENDERER); - - return out.concat.apply(out, _toConsumableArray(range)); - }; - - /** - * Returns the source data object (the same that was passed by `data` configuration option or `loadData` method). - * Optionally you can provide a cell range by using the `row`, `col`, `row2`, `col2` arguments, to get only a fragment of grid data. - * - * @memberof Core# - * @function getSourceData - * @since 0.20.0 - * @param {Number} [r] From physical row index. - * @param {Number} [c] From physical column index (or visual index, if data type is an array of objects). - * @param {Number} [r2] To physical row index. - * @param {Number} [c2] To physical column index (or visual index, if data type is an array of objects). - * @returns {Array} Array of grid data. - */ - this.getSourceData = function (r, c, r2, c2) { - var data = void 0; - - if (r === void 0) { - data = dataSource.getData(); - } else { - data = dataSource.getByRange(new _src.CellCoords(r, c), new _src.CellCoords(r2, c2)); - } - - return data; - }; - - /** - * Returns the source data object as an arrays of arrays format even when source data was provided in another format. - * Optionally you can provide a cell range by using the `row`, `col`, `row2`, `col2` arguments, to get only a fragment of grid data. - * - * @memberof Core# - * @function getSourceDataArray - * @since 0.28.0 - * @param {Number} [r] From physical row index. - * @param {Number} [c] From physical column index (or visual index, if data type is an array of objects). - * @param {Number} [r2] To physical row index. - * @param {Number} [c2] To physical column index (or visual index, if data type is an array of objects). - * @returns {Array} An array of arrays. - */ - this.getSourceDataArray = function (r, c, r2, c2) { - var data = void 0; - - if (r === void 0) { - data = dataSource.getData(true); - } else { - data = dataSource.getByRange(new _src.CellCoords(r, c), new _src.CellCoords(r2, c2), true); - } - - return data; - }; - - /** - * Returns an array of column values from the data source. `col` is the index of the row in the data source. - * - * @memberof Core# - * @function getSourceDataAtCol - * @since 0.11.0-beta3 - * @param {Number} column Visual column index. - * @returns {Array} Array of the column's cell values. - */ - // TODO: Getting data from `sourceData` should work always on physical indexes. - this.getSourceDataAtCol = function (column) { - return dataSource.getAtColumn(column); - }; - - /** - * Returns a single row of the data (array or object, depending on what you have). `row` is the index of the row in the data source. - * - * @memberof Core# - * @function getSourceDataAtRow - * @since 0.11.0-beta3 - * @param {Number} row Physical row index. - * @returns {Array|Object} Single row of data. - */ - this.getSourceDataAtRow = function (row) { - return dataSource.getAtRow(row); - }; - - /** - * Returns a single value from the data source. - * - * @memberof Core# - * @function getSourceDataAtCell - * @param {Number} row Physical row index. - * @param {Number} column Visual column index. - * @returns {*} Cell data. - * @since 0.20.0 - */ - // TODO: Getting data from `sourceData` should work always on physical indexes. - this.getSourceDataAtCell = function (row, column) { - return dataSource.getAtCell(row, column); - }; - - /** - * @description - * Returns a single row of the data. The `row` argument is the __visible__ index of the row. - * - * @memberof Core# - * @function getDataAtRow - * @param {Number} row Visual row index. - * @returns {Array} Array of row's cell data. - * @since 0.9-beta2 - */ - this.getDataAtRow = function (row) { - var data = datamap.getRange(new _src.CellCoords(row, 0), new _src.CellCoords(row, this.countCols() - 1), datamap.DESTINATION_RENDERER); - - return data[0] || []; - }; - - /** - * @description - * Returns a data type defined in the Handsontable settings under the `type` key ([Options#type](http://docs.handsontable.com/Options.html#type)). - * If there are cells with different types in the selected range, it returns `'mixed'`. - * - * @since 0.18.1 - * @memberof Core# - * @function getDataType - * @param {Number} rowFrom From visual row index. - * @param {Number} columnFrom From visual column index. - * @param {Number} rowTo To visual row index. - * @param {Number} columnTo To visual column index. - * @returns {String} Cell type (e.q: `'mixed'`, `'text'`, `'numeric'`, `'autocomplete'`). - */ - this.getDataType = function (rowFrom, columnFrom, rowTo, columnTo) { - var _this = this; - - var previousType = null; - var currentType = null; - - if (rowFrom === void 0) { - rowFrom = 0; - rowTo = this.countRows(); - columnFrom = 0; - columnTo = this.countCols(); - } - if (rowTo === void 0) { - rowTo = rowFrom; - } - if (columnTo === void 0) { - columnTo = columnFrom; - } - var type = 'mixed'; - - (0, _number.rangeEach)(Math.min(rowFrom, rowTo), Math.max(rowFrom, rowTo), function (row) { - var isTypeEqual = true; - - (0, _number.rangeEach)(Math.min(columnFrom, columnTo), Math.max(columnFrom, columnTo), function (column) { - var cellType = _this.getCellMeta(row, column); - - currentType = cellType.type; - - if (previousType) { - isTypeEqual = previousType === currentType; - } else { - previousType = currentType; - } - - return isTypeEqual; - }); - type = isTypeEqual ? currentType : 'mixed'; - - return isTypeEqual; - }); - - return type; - }; - - /** - * Remove a property defined by the `key` argument from the cell meta object for the provided `row` and `col` coordinates. - * - * @memberof Core# - * @function removeCellMeta - * @param {Number} row Visual/physical row index. - * @param {Number} col Visual/physical column index. - * @param {String} key Property name. - */ - this.removeCellMeta = function (row, col, key) { - // TODO: First we use indexes as visual, after that, the same indexes are used as physical. This MUST be improved. - var cellMeta = instance.getCellMeta(row, col); - if (cellMeta[key] != undefined) { - delete priv.cellSettings[row][col][key]; - } - }; - - /** - * Remove one or more rows from the cell meta object. - * - * @since 0.30.0 - * @param {Number} index An integer that specifies at what position to add/remove items, Use negative values to specify the position from the end of the array. - * @param {Number} deleteAmount The number of items to be removed. If set to 0, no items will be removed. - * @param {Array} items The new items to be added to the array. - */ - this.spliceCellsMeta = function (index, deleteAmount) { - var _priv$cellSettings; - - for (var _len2 = arguments.length, items = Array(_len2 > 2 ? _len2 - 2 : 0), _key = 2; _key < _len2; _key++) { - items[_key - 2] = arguments[_key]; - } - - (_priv$cellSettings = priv.cellSettings).splice.apply(_priv$cellSettings, [index, deleteAmount].concat(items)); - }; - - /** - * Set cell meta data object defined by `prop` to the corresponding params `row` and `col`. - * - * @memberof Core# - * @function setCellMetaObject - * @since 0.11 - * @param {Number} row Visual row index. - * @param {Number} col Visual column index. - * @param {Object} prop Meta object. - */ - this.setCellMetaObject = function (row, col, prop) { - if ((typeof prop === 'undefined' ? 'undefined' : _typeof(prop)) === 'object') { - for (var key in prop) { - if ((0, _object.hasOwnProperty)(prop, key)) { - var value = prop[key]; - this.setCellMeta(row, col, key, value); - } - } - } - }; - - /** - * Sets a property defined by the `key` object to the meta object of a cell corresponding to params `row` and `col`. - * - * @memberof Core# - * @function setCellMeta - * @since 0.11 - * @param {Number} row Visual row index. - * @param {Number} col Visual column index. - * @param {String} key Property name. - * @param {String} val Property value. - * @fires Hooks#afterSetCellMeta - */ - this.setCellMeta = function (row, col, key, val) { - var _recordTranslator$toP = recordTranslator.toPhysical(row, col); - - var _recordTranslator$toP2 = _slicedToArray(_recordTranslator$toP, 2); - - row = _recordTranslator$toP2[0]; - col = _recordTranslator$toP2[1]; - - - if (!priv.columnSettings[col]) { - priv.columnSettings[col] = (0, _setting.columnFactory)(GridSettings, priv.columnsSettingConflicts); - } - - if (!priv.cellSettings[row]) { - priv.cellSettings[row] = []; - } - if (!priv.cellSettings[row][col]) { - priv.cellSettings[row][col] = new priv.columnSettings[col](); - } - priv.cellSettings[row][col][key] = val; - instance.runHooks('afterSetCellMeta', row, col, key, val); - }; - - /** - * Get all the cells meta settings at least once generated in the table (in order of cell initialization). - * - * @since 0.19.0 - * @returns {Array} Returns Array of ColumnSettings object. - */ - this.getCellsMeta = function () { - return (0, _array.arrayFlatten)(priv.cellSettings); - }; - - /** - * Returns the cell properties object for the given `row` and `col` coordinates. - * - * @memberof Core# - * @function getCellMeta - * @param {Number} row Visual row index. - * @param {Number} col Visual column index. - * @returns {Object} The cell properties object. - * @fires Hooks#beforeGetCellMeta - * @fires Hooks#afterGetCellMeta - */ - this.getCellMeta = function (row, col) { - var prop = datamap.colToProp(col), - cellProperties; - - var visualRow = row; - var visualCol = col; - - var _recordTranslator$toP3 = recordTranslator.toPhysical(row, col); - - var _recordTranslator$toP4 = _slicedToArray(_recordTranslator$toP3, 2); - - row = _recordTranslator$toP4[0]; - col = _recordTranslator$toP4[1]; - - - if (!priv.columnSettings[col]) { - priv.columnSettings[col] = (0, _setting.columnFactory)(GridSettings, priv.columnsSettingConflicts); - } - - if (!priv.cellSettings[row]) { - priv.cellSettings[row] = []; - } - if (!priv.cellSettings[row][col]) { - priv.cellSettings[row][col] = new priv.columnSettings[col](); - } - - cellProperties = priv.cellSettings[row][col]; // retrieve cellProperties from cache - - cellProperties.row = row; - cellProperties.col = col; - cellProperties.visualRow = visualRow; - cellProperties.visualCol = visualCol; - cellProperties.prop = prop; - cellProperties.instance = instance; - - instance.runHooks('beforeGetCellMeta', row, col, cellProperties); - (0, _object.extend)(cellProperties, expandType(cellProperties)); // for `type` added in beforeGetCellMeta - - if (cellProperties.cells) { - var settings = cellProperties.cells.call(cellProperties, row, col, prop); - - if (settings) { - (0, _object.extend)(cellProperties, settings); - (0, _object.extend)(cellProperties, expandType(settings)); // for `type` added in cells - } - } - - instance.runHooks('afterGetCellMeta', row, col, cellProperties); - - return cellProperties; - }; - - /** - * Returns a row off the cell meta array. - * - * @memberof Core# - * @function getCellMetaAtRow - * @since 0.30.0 - * @param {Number} row Physical index of the row to return cell meta for. - * @returns {Array} - */ - this.getCellMetaAtRow = function (row) { - return priv.cellSettings[row]; - }; - - /** - * Checks if the data format and config allows user to modify the column structure. - * @returns {boolean} - */ - this.isColumnModificationAllowed = function () { - return !(instance.dataType === 'object' || instance.getSettings().columns); - }; - - var rendererLookup = (0, _data.cellMethodLookupFactory)('renderer'); - - /** - * Returns the cell renderer function by given `row` and `col` arguments. - * - * @memberof Core# - * @function getCellRenderer - * @since 0.11 - * @param {Number|Object} row Visual row index or cell meta object. - * @param {Number} [col] Visual column index. - * @returns {Function} The renderer function. - */ - this.getCellRenderer = function (row, col) { - return (0, _renderers.getRenderer)(rendererLookup.call(this, row, col)); - }; - - /** - * Returns the cell editor by the provided `row` and `col` arguments. - * - * @memberof Core# - * @function getCellEditor - * @param {Number} row Visual row index. - * @param {Number} col Visual column index. - * @returns {Object} The Editor object. - */ - this.getCellEditor = (0, _data.cellMethodLookupFactory)('editor'); - - var validatorLookup = (0, _data.cellMethodLookupFactory)('validator'); - - /** - * Returns the cell validator by `row` and `col`, provided a validator is defined. If not - it doesn't return anything. - * - * @memberof Core# - * @function getCellValidator - * @param {Number} row Visual row index. - * @param {Number} col Visual column index. - * @returns {Function|RegExp|undefined} The validator function. - */ - this.getCellValidator = function (row, col) { - var validator = validatorLookup.call(this, row, col); - - if (typeof validator === 'string') { - validator = (0, _validators.getValidator)(validator); - } - - return validator; - }; - - /** - * Validates all cells using their validator functions and calls callback when finished. - * - * If one of the cells is invalid, the callback will be fired with `'valid'` arguments as `false` - otherwise it would equal `true`. - * - * @memberof Core# - * @function validateCells - * @param {Function} [callback] The callback function. - */ - this.validateCells = function (callback) { - var waitingForValidator = new ValidatorsQueue(); - - if (callback) { - waitingForValidator.onQueueEmpty = callback; - } - - var i = instance.countRows() - 1; - - while (i >= 0) { - var j = instance.countCols() - 1; - - while (j >= 0) { - waitingForValidator.addValidatorToQueue(); - - instance.validateCell(instance.getDataAtCell(i, j), instance.getCellMeta(i, j), function (result) { - if (typeof result !== 'boolean') { - throw new Error('Validation error: result is not boolean'); - } - if (result === false) { - waitingForValidator.valid = false; - } - waitingForValidator.removeValidatorFormQueue(); - }, 'validateCells'); - j--; - } - i--; - } - waitingForValidator.checkIfQueueIsEmpty(); - }; - - /** - * Returns an array of row headers' values (if they are enabled). If param `row` was given, it returns the header of the given row as a string. - * - * @memberof Core# - * @function getRowHeader - * @param {Number} [row] Visual row index. - * @fires Hooks#modifyRowHeader - * @returns {Array|String} Array of header values / single header value. - */ - this.getRowHeader = function (row) { - var rowHeader = priv.settings.rowHeaders; - - if (row !== void 0) { - row = instance.runHooks('modifyRowHeader', row); - } - if (row === void 0) { - rowHeader = []; - (0, _number.rangeEach)(instance.countRows() - 1, function (i) { - rowHeader.push(instance.getRowHeader(i)); - }); - } else if (Array.isArray(rowHeader) && rowHeader[row] !== void 0) { - rowHeader = rowHeader[row]; - } else if ((0, _function.isFunction)(rowHeader)) { - rowHeader = rowHeader(row); - } else if (rowHeader && typeof rowHeader !== 'string' && typeof rowHeader !== 'number') { - rowHeader = row + 1; - } - - return rowHeader; - }; - - /** - * Returns information about if this table is configured to display row headers. - * - * @memberof Core# - * @function hasRowHeaders - * @returns {Boolean} `true` if the instance has the row headers enabled, `false` otherwise. - * @since 0.11 - */ - this.hasRowHeaders = function () { - return !!priv.settings.rowHeaders; - }; - - /** - * Returns information about if this table is configured to display column headers. - * - * @memberof Core# - * @function hasColHeaders - * @since 0.11 - * @returns {Boolean} `True` if the instance has the column headers enabled, `false` otherwise. - */ - this.hasColHeaders = function () { - if (priv.settings.colHeaders !== void 0 && priv.settings.colHeaders !== null) { - // Polymer has empty value = null - return !!priv.settings.colHeaders; - } - for (var i = 0, ilen = instance.countCols(); i < ilen; i++) { - if (instance.getColHeader(i)) { - return true; - } - } - - return false; - }; - - /** - * Returns an array of column headers (in string format, if they are enabled). If param `col` is given, it returns the header at the given column as a string. - * - * @memberof Core# - * @function getColHeader - * @param {Number} [col] Visual column index. - * @fires Hooks#modifyColHeader - * @returns {Array|String} The column header(s). - */ - this.getColHeader = function (col) { - var columnsAsFunc = priv.settings.columns && (0, _function.isFunction)(priv.settings.columns); - var result = priv.settings.colHeaders; - - col = instance.runHooks('modifyColHeader', col); - - if (col === void 0) { - var out = []; - var ilen = columnsAsFunc ? instance.countSourceCols() : instance.countCols(); - - for (var i = 0; i < ilen; i++) { - out.push(instance.getColHeader(i)); - } - - result = out; - } else { - var translateVisualIndexToColumns = function translateVisualIndexToColumns(col) { - var arr = []; - var columnsLen = instance.countSourceCols(); - var index = 0; - - for (; index < columnsLen; index++) { - if ((0, _function.isFunction)(instance.getSettings().columns) && instance.getSettings().columns(index)) { - arr.push(index); - } - } - - return arr[col]; - }; - var baseCol = col; - col = instance.runHooks('modifyCol', col); - - var prop = translateVisualIndexToColumns(col); - - if (priv.settings.columns && (0, _function.isFunction)(priv.settings.columns) && priv.settings.columns(prop) && priv.settings.columns(prop).title) { - result = priv.settings.columns(prop).title; - } else if (priv.settings.columns && priv.settings.columns[col] && priv.settings.columns[col].title) { - result = priv.settings.columns[col].title; - } else if (Array.isArray(priv.settings.colHeaders) && priv.settings.colHeaders[col] !== void 0) { - result = priv.settings.colHeaders[col]; - } else if ((0, _function.isFunction)(priv.settings.colHeaders)) { - result = priv.settings.colHeaders(col); - } else if (priv.settings.colHeaders && typeof priv.settings.colHeaders !== 'string' && typeof priv.settings.colHeaders !== 'number') { - result = (0, _data.spreadsheetColumnLabel)(baseCol); // see #1458 - } - } - - return result; - }; - - /** - * Return column width from settings (no guessing). Private use intended. - * - * @private - * @memberof Core# - * @function _getColWidthFromSettings - * @param {Number} col Visual col index. - * @returns {Number} - */ - this._getColWidthFromSettings = function (col) { - var cellProperties = instance.getCellMeta(0, col); - var width = cellProperties.width; - - if (width === void 0 || width === priv.settings.width) { - width = cellProperties.colWidths; - } - if (width !== void 0 && width !== null) { - switch (typeof width === 'undefined' ? 'undefined' : _typeof(width)) { - case 'object': - // array - width = width[col]; - break; - - case 'function': - width = width(col); - break; - default: - break; - } - if (typeof width === 'string') { - width = parseInt(width, 10); - } - } - - return width; - }; - - /** - * Returns the width of the requested column. - * - * @memberof Core# - * @function getColWidth - * @since 0.11 - * @param {Number} col Visual column index. - * @returns {Number} Column width. - * @fires Hooks#modifyColWidth - */ - this.getColWidth = function (col) { - var width = instance._getColWidthFromSettings(col); - - width = instance.runHooks('modifyColWidth', width, col); - - if (width === void 0) { - width = _src.ViewportColumnsCalculator.DEFAULT_WIDTH; - } - - return width; - }; - - /** - * Return row height from settings (no guessing). Private use intended. - * - * @private - * @memberof Core# - * @function _getRowHeightFromSettings - * @param {Number} row Visual row index. - * @returns {Number} - */ - this._getRowHeightFromSettings = function (row) { - // let cellProperties = instance.getCellMeta(row, 0); - // let height = cellProperties.height; - // - // if (height === void 0 || height === priv.settings.height) { - // height = cellProperties.rowHeights; - // } - var height = priv.settings.rowHeights; - - if (height !== void 0 && height !== null) { - switch (typeof height === 'undefined' ? 'undefined' : _typeof(height)) { - case 'object': - // array - height = height[row]; - break; - - case 'function': - height = height(row); - break; - default: - break; - } - if (typeof height === 'string') { - height = parseInt(height, 10); - } - } - - return height; - }; - - /** - * Returns the row height. - * - * @memberof Core# - * @function getRowHeight - * @since 0.11 - * @param {Number} row Visual row index. - * @returns {Number} The given row's height. - * @fires Hooks#modifyRowHeight - */ - this.getRowHeight = function (row) { - var height = instance._getRowHeightFromSettings(row); - - height = instance.runHooks('modifyRowHeight', height, row); - - return height; - }; - - /** - * Returns the total number of rows in the data source. - * - * @memberof Core# - * @function countSourceRows - * @since 0.20.0 - * @returns {Number} Total number in rows in data source. - */ - this.countSourceRows = function () { - var sourceLength = instance.runHooks('modifySourceLength'); - return sourceLength || (instance.getSourceData() ? instance.getSourceData().length : 0); - }; - - /** - * Returns the total number of columns in the data source. - * - * @memberof Core# - * @function countSourceCols - * @since 0.26.1 - * @returns {Number} Total number in columns in data source. - */ - this.countSourceCols = function () { - var len = 0; - var obj = instance.getSourceData() && instance.getSourceData()[0] ? instance.getSourceData()[0] : []; - - if ((0, _object.isObject)(obj)) { - len = (0, _object.deepObjectSize)(obj); - } else { - len = obj.length || 0; - } - - return len; - }; - - /** - * Returns the total number of rows in the grid. - * - * @memberof Core# - * @function countRows - * @returns {Number} Total number in rows the grid. - */ - this.countRows = function () { - return datamap.getLength(); - }; - - /** - * Returns the total number of columns in the grid. - * - * @memberof Core# - * @function countCols - * @returns {Number} Total number of columns. - */ - this.countCols = function () { - var maxCols = this.getSettings().maxCols; - var dataHasLength = false; - var dataLen = 0; - - if (instance.dataType === 'array') { - dataHasLength = priv.settings.data && priv.settings.data[0] && priv.settings.data[0].length; - } - - if (dataHasLength) { - dataLen = priv.settings.data[0].length; - } - - if (priv.settings.columns) { - var columnsIsFunction = (0, _function.isFunction)(priv.settings.columns); - - if (columnsIsFunction) { - if (instance.dataType === 'array') { - var columnLen = 0; - - for (var i = 0; i < dataLen; i++) { - if (priv.settings.columns(i)) { - columnLen++; - } - } - - dataLen = columnLen; - } else if (instance.dataType === 'object' || instance.dataType === 'function') { - dataLen = datamap.colToPropCache.length; - } - } else { - dataLen = priv.settings.columns.length; - } - } else if (instance.dataType === 'object' || instance.dataType === 'function') { - dataLen = datamap.colToPropCache.length; - } - - return Math.min(maxCols, dataLen); - }; - - /** - * Returns an visual index of the first rendered row. - * - * @memberof Core# - * @function rowOffset - * @returns {Number} Visual index of first rendered row. - */ - this.rowOffset = function () { - return instance.view.wt.wtTable.getFirstRenderedRow(); - }; - - /** - * Returns the visual index of the first rendered column. - * - * @memberof Core# - * @function colOffset - * @returns {Number} Visual index of the first visible column. - */ - this.colOffset = function () { - return instance.view.wt.wtTable.getFirstRenderedColumn(); - }; - - /** - * Returns the number of rendered rows (including rows partially or fully rendered outside viewport). - * - * @memberof Core# - * @function countRenderedRows - * @returns {Number} Returns -1 if table is not visible. - */ - this.countRenderedRows = function () { - return instance.view.wt.drawn ? instance.view.wt.wtTable.getRenderedRowsCount() : -1; - }; - - /** - * Returns the number of visible rows (rendered rows that fully fit inside viewport). - * - * @memberof Core# - * @function countVisibleRows - * @returns {Number} Number of visible rows or -1. - */ - this.countVisibleRows = function () { - return instance.view.wt.drawn ? instance.view.wt.wtTable.getVisibleRowsCount() : -1; - }; - - /** - * Returns the number of rendered columns (including columns partially or fully rendered outside viewport). - * - * @memberof Core# - * @function countRenderedCols - * @returns {Number} Returns -1 if table is not visible. - */ - this.countRenderedCols = function () { - return instance.view.wt.drawn ? instance.view.wt.wtTable.getRenderedColumnsCount() : -1; - }; - - /** - * Returns the number of visible columns. Returns -1 if table is not visible - * - * @memberof Core# - * @function countVisibleCols - * @return {Number} Number of visible columns or -1. - */ - this.countVisibleCols = function () { - return instance.view.wt.drawn ? instance.view.wt.wtTable.getVisibleColumnsCount() : -1; - }; - - /** - * Returns the number of empty rows. If the optional ending parameter is `true`, returns the - * number of empty rows at the bottom of the table. - * - * @memberof Core# - * @function countEmptyRows - * @param {Boolean} [ending] If `true`, will only count empty rows at the end of the data source. - * @returns {Number} Count empty rows - * @fires Hooks#modifyRow - */ - this.countEmptyRows = function (ending) { - var i = instance.countRows() - 1, - empty = 0, - row; - - while (i >= 0) { - row = instance.runHooks('modifyRow', i); - - if (instance.isEmptyRow(row)) { - empty++; - } else if (ending) { - break; - } - i--; - } - - return empty; - }; - - /** - * Returns the number of empty columns. If the optional ending parameter is `true`, returns the number of empty - * columns at right hand edge of the table. - * - * @memberof Core# - * @function countEmptyCols - * @param {Boolean} [ending] If `true`, will only count empty columns at the end of the data source row. - * @returns {Number} Count empty cols - */ - this.countEmptyCols = function (ending) { - if (instance.countRows() < 1) { - return 0; - } - var i = instance.countCols() - 1, - empty = 0; - - while (i >= 0) { - if (instance.isEmptyCol(i)) { - empty++; - } else if (ending) { - break; - } - i--; - } - - return empty; - }; - - /** - * Check if all cells in the row declared by the `row` argument are empty. - * - * @memberof Core# - * @function isEmptyRow - * @param {Number} row Row index. - * @returns {Boolean} `true` if the row at the given `row` is empty, `false` otherwise. - */ - this.isEmptyRow = function (row) { - return priv.settings.isEmptyRow.call(instance, row); - }; - - /** - * Check if all cells in the the column declared by the `col` argument are empty. - * - * @memberof Core# - * @function isEmptyCol - * @param {Number} col Column index. - * @returns {Boolean} `true` if the column at the given `col` is empty, `false` otherwise. - */ - this.isEmptyCol = function (col) { - return priv.settings.isEmptyCol.call(instance, col); - }; - - /** - * Select cell specified by `row` and `col` values or a range of cells finishing at `endRow`, `endCol`. - * By default, viewport will be scrolled to selection. - * After the `selectCell` method had finished, the instance will be listening to keyboard input on the document. - * - * @memberof Core# - * @function selectCell - * @param {Number} row Visual row index. - * @param {Number} col Visual column index. - * @param {Number} [endRow] Visual end row index (if selecting a range). - * @param {Number} [endCol] Visual end column index (if selecting a range). - * @param {Boolean} [scrollToCell=true] If `true`, the viewport will be scrolled to the selection. - * @param {Boolean} [changeListener=true] If `false`, Handsontable will not change keyboard events listener to himself. - * @returns {Boolean} `true` if selection was successful, `false` otherwise. - */ - this.selectCell = function (row, col, endRow, endCol, scrollToCell, changeListener) { - var coords; - - changeListener = (0, _mixed.isUndefined)(changeListener) || changeListener === true; - - if (typeof row !== 'number' || row < 0 || row >= instance.countRows()) { - return false; - } - if (typeof col !== 'number' || col < 0 || col >= instance.countCols()) { - return false; - } - if ((0, _mixed.isDefined)(endRow)) { - if (typeof endRow !== 'number' || endRow < 0 || endRow >= instance.countRows()) { - return false; - } - if (typeof endCol !== 'number' || endCol < 0 || endCol >= instance.countCols()) { - return false; - } - } - coords = new _src.CellCoords(row, col); - priv.selRange = new _src.CellRange(coords, coords, coords); - - if (changeListener) { - instance.listen(); - } - - if ((0, _mixed.isUndefined)(endRow)) { - selection.setRangeEnd(priv.selRange.from, scrollToCell); - } else { - selection.setRangeEnd(new _src.CellCoords(endRow, endCol), scrollToCell); - } - instance.selection.finish(); - - return true; - }; - - /** - * Select the cell specified by the `row` and `prop` arguments, or a range finishing at `endRow`, `endProp`. - * By default, viewport will be scrolled to selection. - * - * @memberof Core# - * @function selectCellByProp - * @param {Number} row Visual row index. - * @param {String} prop Property name. - * @param {Number} [endRow] visual end row index (if selecting a range). - * @param {String} [endProp] End property name (if selecting a range). - * @param {Boolean} [scrollToCell=true] If `true`, viewport will be scrolled to the selection. - * @returns {Boolean} `true` if selection was successful, `false` otherwise. - */ - this.selectCellByProp = function (row, prop, endRow, endProp, scrollToCell) { - var _instance5; - - arguments[1] = datamap.propToCol(arguments[1]); - - if ((0, _mixed.isDefined)(arguments[3])) { - arguments[3] = datamap.propToCol(arguments[3]); - } - - return (_instance5 = instance).selectCell.apply(_instance5, arguments); - }; - - /** - * Deselects the current cell selection on grid. - * - * @memberof Core# - * @function deselectCell - */ - this.deselectCell = function () { - selection.deselect(); - }; - - /** - * Scroll viewport to coords specified by the `row` and `column` arguments. - * - * @since 0.24.3 - * @memberof Core# - * @function scrollViewportTo - * @param {Number} [row] Visual row index. - * @param {Number} [column] Visual column index. - * @param {Boolean} [snapToBottom = false] If `true`, viewport is scrolled to show the cell on the bottom of the table. - * @param {Boolean} [snapToRight = false] If `true`, viewport is scrolled to show the cell on the right side of the table. - * @returns {Boolean} `true` if scroll was successful, `false` otherwise. - */ - this.scrollViewportTo = function (row, column) { - var snapToBottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var snapToRight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - - if (row !== void 0 && (row < 0 || row >= instance.countRows())) { - return false; - } - if (column !== void 0 && (column < 0 || column >= instance.countCols())) { - return false; - } - - var result = false; - - if (row !== void 0 && column !== void 0) { - instance.view.wt.wtOverlays.topOverlay.scrollTo(row, snapToBottom); - instance.view.wt.wtOverlays.leftOverlay.scrollTo(column, snapToRight); - - result = true; - } - if (typeof row === 'number' && typeof column !== 'number') { - instance.view.wt.wtOverlays.topOverlay.scrollTo(row, snapToBottom); - - result = true; - } - if (typeof column === 'number' && typeof row !== 'number') { - instance.view.wt.wtOverlays.leftOverlay.scrollTo(column, snapToRight); - - result = true; - } - - return result; - }; - - /** - * Removes grid from the DOM. - * - * @memberof Core# - * @function destroy - * @fires Hooks#afterDestroy - */ - this.destroy = function () { - - instance._clearTimeouts(); - if (instance.view) { - // in case HT is destroyed before initialization has finished - instance.view.destroy(); - } - if (dataSource) { - dataSource.destroy(); - } - dataSource = null; - - (0, _element.empty)(instance.rootElement); - eventManager.destroy(); - - instance.runHooks('afterDestroy'); - _pluginHooks2.default.getSingleton().destroy(instance); - - for (var i in instance) { - if ((0, _object.hasOwnProperty)(instance, i)) { - // replace instance methods with post mortem - if ((0, _function.isFunction)(instance[i])) { - instance[i] = postMortem; - } else if (i !== 'guid') { - // replace instance properties with null (restores memory) - // it should not be necessary but this prevents a memory leak side effects that show itself in Jasmine tests - instance[i] = null; - } - } - } - - // replace private properties with null (restores memory) - // it should not be necessary but this prevents a memory leak side effects that show itself in Jasmine tests - if (datamap) { - datamap.destroy(); - } - datamap = null; - priv = null; - grid = null; - selection = null; - editorManager = null; - instance = null; - GridSettings = null; - }; - - /** - * Replacement for all methods after Handsotnable was destroyed. - * - * @private - */ - function postMortem() { - throw new Error('This method cannot be called because this Handsontable instance has been destroyed'); - } - - /** - * Returns the active editor object. - * - * @memberof Core# - * @function getActiveEditor - * @returns {Object} The active editor object. - */ - this.getActiveEditor = function () { - return editorManager.getActiveEditor(); - }; - - /** - * Returns plugin instance using the plugin name provided. - * - * @memberof Core# - * @function getPlugin - * @param {String} pluginName The plugin name. - * @returns {*} The plugin instance. - * @since 0.15.0 - */ - this.getPlugin = function (pluginName) { - return (0, _plugins.getPlugin)(this, pluginName); - }; - - /** - * Returns the Handsontable instance. - * - * @memberof Core# - * @function getInstance - * @returns {Handsontable} The Handsontable instance. - */ - this.getInstance = function () { - return instance; - }; - - /** - * Adds listener to the specified hook name (only for this Handsontable instance). - * - * @memberof Core# - * @function addHook - * @see Hooks#add - * @param {String} key Hook name. - * @param {Function|Array} callback Function or array of Functions. - * - * @example - * ```js - * hot.addHook('beforeInit', myCallback); - * ``` - */ - this.addHook = function (key, callback) { - _pluginHooks2.default.getSingleton().add(key, callback, instance); - }; - - /** - * Check if for a specified hook name there are added listeners (only for this Handsontable instance). - * - * @memberof Core# - * @function hasHook - * @see Hooks#has - * @param {String} key Hook name - * @return {Boolean} - * - * @example - * ```js - * var hasBeforeInitListeners = hot.hasHook('beforeInit'); - * ``` - */ - this.hasHook = function (key) { - return _pluginHooks2.default.getSingleton().has(key, instance); - }; - - /** - * Adds listener to specified hook name (only for this Handsontable instance). - * After the listener is triggered, it will be automatically removed. - * - * @memberof Core# - * @function addHookOnce - * @see Hooks#once - * @param {String} key Hook name. - * @param {Function|Array} callback Function or array of Functions. - * - * @example - * ```js - * hot.addHookOnce('beforeInit', myCallback); - * ``` - */ - this.addHookOnce = function (key, callback) { - _pluginHooks2.default.getSingleton().once(key, callback, instance); - }; - - /** - * Removes the hook listener previously registered with {@link Core#addHook}. - * - * @memberof Core# - * @function removeHook - * @see Hooks#remove - * @param {String} key Hook name. - * @param {Function} callback Function which have been registered via {@link Core#addHook}. - * - * @example - * ```js - * hot.removeHook('beforeInit', myCallback); - * ``` - */ - this.removeHook = function (key, callback) { - _pluginHooks2.default.getSingleton().remove(key, callback, instance); - }; - - /** - * Run the callbacks for the hook provided in the `key` argument using the parameters given in the other arguments. - * - * @memberof Core# - * @function runHooks - * @see Hooks#run - * @param {String} key Hook name. - * @param {*} [p1] Argument passed to the callback. - * @param {*} [p2] Argument passed to the callback. - * @param {*} [p3] Argument passed to the callback. - * @param {*} [p4] Argument passed to the callback. - * @param {*} [p5] Argument passed to the callback. - * @param {*} [p6] Argument passed to the callback. - * @returns {*} - * - * @example - * ```js - * hot.runHooks('beforeInit'); - * ``` - */ - this.runHooks = function (key, p1, p2, p3, p4, p5, p6) { - return _pluginHooks2.default.getSingleton().run(instance, key, p1, p2, p3, p4, p5, p6); - }; - - this.timeouts = []; - - /** - * Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called. - * - * @param {*} handle - * @private - */ - this._registerTimeout = function (handle) { - this.timeouts.push(handle); - }; - - /** - * Clears all known timeouts. - * - * @private - */ - this._clearTimeouts = function () { - for (var i = 0, ilen = this.timeouts.length; i < ilen; i++) { - clearTimeout(this.timeouts[i]); - } - }; - - /** - * Handsontable version - * - * @type {String} - */ - // this.version = Handsontable.version; - - _pluginHooks2.default.getSingleton().run(instance, 'construct'); -}; - -/***/ }), -/* 65 */ -/***/ (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; - -var _cellTypes = __webpack_require__(63); - -var _object = __webpack_require__(1); - -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 = void 0; - - 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; - - 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 = [], - i, - 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 = [], - i, - j; - - for (i = 0; i < rows; i++) { - var row = {}; - - for (j = 0; j < colCount; j++) { - row['prop' + 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 = void 0; - - for (var i = 0; i < rows; i++) { - row = []; - for (var j = 0; j < columns; j++) { - row.push(''); - } - data.push(row); - } - - return data; -} - -function translateRowsToColumns(input) { - var i, - ilen, - j, - jlen, - output = [], - 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++; - } - 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 methodName {String} name of the method/property to search (i.e. 'renderer', 'validator', 'copyable') - * @param allowUndefined {Boolean} [optional] if false, the search is continued if methodName has not been found in cell "type" - * @returns {Function} - */ -function cellMethodLookupFactory(methodName, allowUndefined) { - - allowUndefined = typeof allowUndefined == 'undefined' ? true : allowUndefined; - - return function cellMethodLookup(row, col) { - return function getMethodFromProperties(properties) { - - if (!properties) { - return; // method not found - } else 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 - var type; - - if (typeof properties.type != 'string') { - throw new Error('Cell type must be a string '); - } - type = (0, _cellTypes.getCellType)(properties.type); - - if ((0, _object.hasOwnProperty)(type, methodName)) { - return type[methodName]; // method defined in type. - } else if (allowUndefined) { - return; // method does not defined in type (eg. validator), returns undefined - } - } - - return getMethodFromProperties(Object.getPrototypeOf(properties)); - }(typeof row == 'number' ? this.getCellMeta(row, col) : row); - }; -} - -/***/ }), -/* 66 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; -exports.columnFactory = columnFactory; - -var _object = __webpack_require__(1); - -/* eslint-disable import/prefer-default-export */ -/** - * Factory for columns constructors. - * - * @param {Object} GridSettings - * @param {Array} conflictList - * @return {Object} ColumnSettings - */ -function columnFactory(GridSettings, conflictList) { - function ColumnSettings() {}; - - (0, _object.inherit)(ColumnSettings, GridSettings); - - // Clear conflict settings - for (var i = 0, len = conflictList.length; i < len; i++) { - ColumnSettings.prototype[conflictList[i]] = void 0; - } - - return ColumnSettings; -} - -/***/ }), -/* 67 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _element = __webpack_require__(0); - -var _array = __webpack_require__(2); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/** - * @class GhostTable - * @util - */ -var GhostTable = function () { - function GhostTable(hotInstance) { - _classCallCheck(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. - */ - - - _createClass(GhostTable, [{ - key: 'addRow', - value: function addRow(row, samples) { - if (this.columns.length) { - throw new Error('Doesn\'t support multi-dimensional table'); - } - if (!this.rows.length) { - this.container = this.createContainer(this.hot.rootElement.className); - } - var rowObject = { row: row }; - this.rows.push(rowObject); - - this.samples = samples; - this.table = this.createTable(this.hot.table.className); - this.table.colGroup.appendChild(this.createColGroupsCol()); - this.table.tr.appendChild(this.createRow(row)); - this.container.container.appendChild(this.table.fragment); - - rowObject.table = this.table.table; - } - - /** - * Add a row consisting of the column headers. - */ - - }, { - key: 'addColumnHeadersRow', - value: function addColumnHeadersRow(samples) { - if (this.hot.getColHeader(0) != null) { - var rowObject = { row: -1 }; - this.rows.push(rowObject); - - this.container = this.createContainer(this.hot.rootElement.className); - - this.samples = samples; - this.table = this.createTable(this.hot.table.className); - this.table.colGroup.appendChild(this.createColGroupsCol()); - this.table.tHead.appendChild(this.createColumnHeadersRow()); - this.container.container.appendChild(this.table.fragment); - - rowObject.table = this.table.table; - } - } - - /** - * Add column. - * - * @param {Number} column Column index. - * @param {Map} samples Samples Map object. - */ - - }, { - key: 'addColumn', - value: function addColumn(column, samples) { - if (this.rows.length) { - throw new Error('Doesn\'t support multi-dimensional table'); - } - if (!this.columns.length) { - this.container = this.createContainer(this.hot.rootElement.className); - } - var columnObject = { col: column }; - this.columns.push(columnObject); - - this.samples = samples; - this.table = this.createTable(this.hot.table.className); - - if (this.getSetting('useHeaders') && this.hot.getColHeader(column) !== null) { - this.hot.view.appendColHeader(column, this.table.th); - } - this.table.tBody.appendChild(this.createCol(column)); - this.container.container.appendChild(this.table.fragment); - - columnObject.table = this.table.table; - } - - /** - * Get calculated heights. - * - * @param {Function} callback Callback which will be fired for each calculated row. - */ - - }, { - key: 'getHeights', - value: function getHeights(callback) { - if (!this.injected) { - this.injectTable(); - } - (0, _array.arrayEach)(this.rows, function (row) { - // -1 <- reduce border-top from table - callback(row.row, (0, _element.outerHeight)(row.table) - 1); - }); - } - - /** - * Get calculated widths. - * - * @param {Function} callback Callback which will be fired for each calculated column. - */ - - }, { - key: 'getWidths', - value: function getWidths(callback) { - if (!this.injected) { - this.injectTable(); - } - (0, _array.arrayEach)(this.columns, function (column) { - callback(column.col, (0, _element.outerWidth)(column.table)); - }); - } - - /** - * Set the Ghost Table settings to the provided object. - * - * @param {Object} settings New Ghost Table Settings - */ - - }, { - key: 'setSettings', - value: function setSettings(settings) { - this.settings = settings; - } - - /** - * Set a single setting of the Ghost Table. - * - * @param {String} name Setting name. - * @param {*} value Setting value. - */ - - }, { - key: 'setSetting', - value: function setSetting(name, value) { - if (!this.settings) { - this.settings = {}; - } - - this.settings[name] = value; - } - - /** - * Get the Ghost Table settings. - * - * @returns {Object|null} - */ - - }, { - key: 'getSettings', - value: function getSettings() { - return this.settings; - } - - /** - * Get a single Ghost Table setting. - * - * @param {String} name - * @returns {Boolean|null} - */ - - }, { - key: 'getSetting', - value: function getSetting(name) { - if (this.settings) { - return this.settings[name]; - } - return null; - } - - /** - * Create colgroup col elements. - * - * @returns {DocumentFragment} - */ - - }, { - key: 'createColGroupsCol', - value: function createColGroupsCol() { - var _this = this; - - var d = document; - var fragment = d.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 d = document; - var fragment = d.createDocumentFragment(); - var th = d.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 = d.createElement('td'); - - renderer(_this2.hot, td, row, column, _this2.hot.colToProp(column), string.value, cellProperties); - fragment.appendChild(td); - }); - }); - - return fragment; - } - }, { - key: 'createColumnHeadersRow', - value: function createColumnHeadersRow() { - var _this3 = this; - - var d = document; - var fragment = d.createDocumentFragment(); - - if (this.hot.hasRowHeaders()) { - var th = d.createElement('th'); - this.hot.view.appendColHeader(-1, th); - fragment.appendChild(th); - } - - this.samples.forEach(function (sample) { - (0, _array.arrayEach)(sample.strings, function (string) { - var column = string.col; - - var th = d.createElement('th'); - - _this3.hot.view.appendColHeader(column, th); - fragment.appendChild(th); - }); - }); - - return fragment; - } - - /** - * Create table column elements. - * - * @param {Number} column Column index. - * @returns {DocumentFragment} Returns created column table column elements. - */ - - }, { - key: 'createCol', - value: function createCol(column) { - var _this4 = this; - - var d = document; - var fragment = d.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 = d.createElement('td'); - var tr = d.createElement('tr'); - - renderer(_this4.hot, td, row, column, _this4.hot.colToProp(column), string.value, cellProperties); - tr.appendChild(td); - fragment.appendChild(tr); - }); - }); - - return fragment; - } - - /** - * Remove table from document and reset internal state. - */ - - }, { - key: 'clean', - value: function clean() { - this.rows.length = 0; - this.rows[-1] = void 0; - this.columns.length = 0; - - if (this.samples) { - this.samples.clear(); - } - this.samples = null; - this.removeTable(); - } - - /** - * Inject generated table into document. - * - * @param {HTMLElement} [parent=null] - */ - - }, { - key: 'injectTable', - value: function injectTable() { - var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - - if (!this.injected) { - (parent || this.hot.rootElement).appendChild(this.container.fragment); - this.injected = true; - } - } - - /** - * Remove table from document. - */ - - }, { - key: 'removeTable', - value: function removeTable() { - if (this.injected && this.container.container.parentNode) { - this.container.container.parentNode.removeChild(this.container.container); - this.container = null; - this.injected = false; - } - } - - /** - * Create col element. - * - * @param {Number} column Column index. - * @returns {HTMLElement} - */ - - }, { - key: 'createColElement', - value: function createColElement(column) { - var d = document; - var col = d.createElement('col'); - - col.style.width = this.hot.view.wt.wtTable.getStretchedColumnWidth(column) + 'px'; - - return col; - } - - /** - * Create table element. - * - * @param {String} className - * @returns {Object} - */ - - }, { - key: 'createTable', - value: function createTable() { - var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - - var d = document; - var fragment = d.createDocumentFragment(); - var table = d.createElement('table'); - var tHead = d.createElement('thead'); - var tBody = d.createElement('tbody'); - var colGroup = d.createElement('colgroup'); - var tr = d.createElement('tr'); - var th = d.createElement('th'); - - if (this.isVertical()) { - table.appendChild(colGroup); - } - if (this.isHorizontal()) { - tr.appendChild(th); - tHead.appendChild(tr); - table.style.tableLayout = 'auto'; - table.style.width = 'auto'; - } - table.appendChild(tHead); - - if (this.isVertical()) { - tBody.appendChild(tr); - } - table.appendChild(tBody); - (0, _element.addClass)(table, className); - fragment.appendChild(table); - - return { fragment: fragment, table: table, tHead: tHead, tBody: tBody, colGroup: colGroup, tr: tr, th: th }; - } - - /** - * Create container for tables. - * - * @param {String} className - * @returns {Object} - */ - - }, { - key: 'createContainer', - value: function createContainer() { - var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - - var d = document; - var fragment = d.createDocumentFragment(); - var container = d.createElement('div'); - - className = 'htGhostTable htAutoSize ' + className.trim(); - (0, _element.addClass)(container, className); - 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; -}(); - -exports.default = GhostTable; - -/***/ }), -/* 68 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var addToUnscopables = __webpack_require__(38) - , step = __webpack_require__(282) - , Iterators = __webpack_require__(46) - , toIObject = __webpack_require__(23); - -// 22.1.3.4 Array.prototype.entries() -// 22.1.3.13 Array.prototype.keys() -// 22.1.3.29 Array.prototype.values() -// 22.1.3.30 Array.prototype[@@iterator]() -module.exports = __webpack_require__(281)(Array, 'Array', function(iterated, kind){ - this._t = toIObject(iterated); // target - this._i = 0; // next index - this._k = kind; // kind -// 22.1.5.2.1 %ArrayIteratorPrototype%.next() -}, function(){ - var O = this._t - , kind = this._k - , index = this._i++; - if(!O || index >= O.length){ - this._t = undefined; - return step(1); - } - if(kind == 'keys' )return step(0, index); - if(kind == 'values')return step(0, O[index]); - return step(0, [index, O[index]]); -}, 'values'); - -// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) -Iterators.Arguments = Iterators.Array; - -addToUnscopables('keys'); -addToUnscopables('values'); -addToUnscopables('entries'); - -/***/ }), -/* 69 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _coords = __webpack_require__(43); - -var _coords2 = _interopRequireDefault(_coords); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/** - * A cell range is a set of exactly two CellCoords (that can be the same or different) - * - * @class CellRange - */ -var CellRange = function () { - /** - * @param {CellCoords} highlight Used to draw bold border around a cell where selection was - * started and to edit the cell when you press Enter - * @param {CellCoords} from Usually the same as highlight, but in Excel there is distinction - one can change - * highlight within a selection - * @param {CellCoords} to End selection - */ - function CellRange(highlight, from, to) { - _classCallCheck(this, CellRange); - - this.highlight = highlight; - this.from = from; - this.to = to; - } - - /** - * Checks if given coords are valid in context of a given Walkontable instance - * - * @param {Walkontable} wotInstance - * @returns {Boolean} - */ - - - _createClass(CellRange, [{ - key: 'isValid', - value: function isValid(wotInstance) { - return this.from.isValid(wotInstance) && this.to.isValid(wotInstance); - } - - /** - * Checks if this cell range is restricted to one cell - * - * @returns {Boolean} - */ - - }, { - key: 'isSingle', - value: function isSingle() { - return this.from.row === this.to.row && this.from.col === this.to.col; - } - - /** - * Returns selected range height (in number of rows) - * - * @returns {Number} - */ - - }, { - key: 'getHeight', - value: function getHeight() { - return Math.max(this.from.row, this.to.row) - Math.min(this.from.row, this.to.row) + 1; - } - - /** - * Returns selected range width (in number of columns) - * - * @returns {Number} - */ - - }, { - key: 'getWidth', - value: function getWidth() { - return Math.max(this.from.col, this.to.col) - Math.min(this.from.col, this.to.col) + 1; - } - - /** - * Checks if given cell coords is within `from` and `to` cell coords of this range - * - * @param {CellCoords} cellCoords - * @returns {Boolean} - */ - - }, { - key: 'includes', - value: function includes(cellCoords) { - var row = cellCoords.row, - col = cellCoords.col; - - var topLeft = this.getTopLeftCorner(); - var bottomRight = this.getBottomRightCorner(); - - return topLeft.row <= row && bottomRight.row >= row && topLeft.col <= col && bottomRight.col >= col; - } - - /** - * Checks if given range is within of this range - * - * @param {CellRange} testedRange - * @returns {Boolean} - */ - - }, { - key: 'includesRange', - value: function includesRange(testedRange) { - return this.includes(testedRange.getTopLeftCorner()) && this.includes(testedRange.getBottomRightCorner()); - } - - /** - * Checks if given range is equal to this range - * - * @param {CellRange} testedRange - * @returns {Boolean} - */ - - }, { - key: 'isEqual', - value: function isEqual(testedRange) { - return Math.min(this.from.row, this.to.row) == Math.min(testedRange.from.row, testedRange.to.row) && Math.max(this.from.row, this.to.row) == Math.max(testedRange.from.row, testedRange.to.row) && Math.min(this.from.col, this.to.col) == Math.min(testedRange.from.col, testedRange.to.col) && Math.max(this.from.col, this.to.col) == Math.max(testedRange.from.col, testedRange.to.col); - } - - /** - * Checks if tested range overlaps with the range. - * Range A is considered to to be overlapping with range B if intersection of A and B or B and A is not empty. - * - * @param {CellRange} testedRange - * @returns {Boolean} - */ - - }, { - key: 'overlaps', - value: function overlaps(testedRange) { - return testedRange.isSouthEastOf(this.getTopLeftCorner()) && testedRange.isNorthWestOf(this.getBottomRightCorner()); - } - - /** - * @param {CellRange} testedCoords - * @returns {Boolean} - */ - - }, { - key: 'isSouthEastOf', - value: function isSouthEastOf(testedCoords) { - return this.getTopLeftCorner().isSouthEastOf(testedCoords) || this.getBottomRightCorner().isSouthEastOf(testedCoords); - } - - /** - * @param {CellRange} testedCoords - * @returns {Boolean} - */ - - }, { - key: 'isNorthWestOf', - value: function isNorthWestOf(testedCoords) { - return this.getTopLeftCorner().isNorthWestOf(testedCoords) || this.getBottomRightCorner().isNorthWestOf(testedCoords); - } - - /** - * Adds a cell to a range (only if exceeds corners of the range). Returns information if range was expanded - * - * @param {CellCoords} cellCoords - * @returns {Boolean} - */ - - }, { - key: 'expand', - value: function expand(cellCoords) { - var topLeft = this.getTopLeftCorner(); - var bottomRight = this.getBottomRightCorner(); - - if (cellCoords.row < topLeft.row || cellCoords.col < topLeft.col || cellCoords.row > bottomRight.row || cellCoords.col > bottomRight.col) { - this.from = new _coords2.default(Math.min(topLeft.row, cellCoords.row), Math.min(topLeft.col, cellCoords.col)); - this.to = new _coords2.default(Math.max(bottomRight.row, cellCoords.row), Math.max(bottomRight.col, cellCoords.col)); - - return true; - } - - return false; - } - - /** - * @param {CellRange} expandingRange - * @returns {Boolean} - */ - - }, { - key: 'expandByRange', - value: function expandByRange(expandingRange) { - if (this.includesRange(expandingRange) || !this.overlaps(expandingRange)) { - return false; - } - - var topLeft = this.getTopLeftCorner(); - var bottomRight = this.getBottomRightCorner(); - var topRight = this.getTopRightCorner(); - var bottomLeft = this.getBottomLeftCorner(); - - var expandingTopLeft = expandingRange.getTopLeftCorner(); - var expandingBottomRight = expandingRange.getBottomRightCorner(); - - var resultTopRow = Math.min(topLeft.row, expandingTopLeft.row); - var resultTopCol = Math.min(topLeft.col, expandingTopLeft.col); - var resultBottomRow = Math.max(bottomRight.row, expandingBottomRight.row); - var resultBottomCol = Math.max(bottomRight.col, expandingBottomRight.col); - - var finalFrom = new _coords2.default(resultTopRow, resultTopCol), - finalTo = new _coords2.default(resultBottomRow, resultBottomCol); - var isCorner = new CellRange(finalFrom, finalFrom, finalTo).isCorner(this.from, expandingRange), - onlyMerge = expandingRange.isEqual(new CellRange(finalFrom, finalFrom, finalTo)); - - if (isCorner && !onlyMerge) { - if (this.from.col > finalFrom.col) { - finalFrom.col = resultBottomCol; - finalTo.col = resultTopCol; - } - if (this.from.row > finalFrom.row) { - finalFrom.row = resultBottomRow; - finalTo.row = resultTopRow; - } - } - this.from = finalFrom; - this.to = finalTo; - - return true; - } - - /** - * @returns {String} - */ - - }, { - key: 'getDirection', - value: function getDirection() { - if (this.from.isNorthWestOf(this.to)) { - // NorthWest - SouthEast - return 'NW-SE'; - } else if (this.from.isNorthEastOf(this.to)) { - // NorthEast - SouthWest - return 'NE-SW'; - } else if (this.from.isSouthEastOf(this.to)) { - // SouthEast - NorthWest - return 'SE-NW'; - } else if (this.from.isSouthWestOf(this.to)) { - // SouthWest - NorthEast - return 'SW-NE'; - } - } - - /** - * @param {String} direction - */ - - }, { - key: 'setDirection', - value: function setDirection(direction) { - switch (direction) { - case 'NW-SE': - var _ref = [this.getTopLeftCorner(), this.getBottomRightCorner()]; - this.from = _ref[0]; - this.to = _ref[1]; - - break; - case 'NE-SW': - var _ref2 = [this.getTopRightCorner(), this.getBottomLeftCorner()]; - this.from = _ref2[0]; - this.to = _ref2[1]; - - break; - case 'SE-NW': - var _ref3 = [this.getBottomRightCorner(), this.getTopLeftCorner()]; - this.from = _ref3[0]; - this.to = _ref3[1]; - - break; - case 'SW-NE': - var _ref4 = [this.getBottomLeftCorner(), this.getTopRightCorner()]; - this.from = _ref4[0]; - this.to = _ref4[1]; - - break; - default: - break; - } - } - - /** - * Get top left corner of this range - * - * @returns {CellCoords} - */ - - }, { - key: 'getTopLeftCorner', - value: function getTopLeftCorner() { - return new _coords2.default(Math.min(this.from.row, this.to.row), Math.min(this.from.col, this.to.col)); - } - - /** - * Get bottom right corner of this range - * - * @returns {CellCoords} - */ - - }, { - key: 'getBottomRightCorner', - value: function getBottomRightCorner() { - return new _coords2.default(Math.max(this.from.row, this.to.row), Math.max(this.from.col, this.to.col)); - } - - /** - * Get top right corner of this range - * - * @returns {CellCoords} - */ - - }, { - key: 'getTopRightCorner', - value: function getTopRightCorner() { - return new _coords2.default(Math.min(this.from.row, this.to.row), Math.max(this.from.col, this.to.col)); - } - - /** - * Get bottom left corner of this range - * - * @returns {CellCoords} - */ - - }, { - key: 'getBottomLeftCorner', - value: function getBottomLeftCorner() { - return new _coords2.default(Math.max(this.from.row, this.to.row), Math.min(this.from.col, this.to.col)); - } - - /** - * @param {CellCoords} coords - * @param {CellRange} expandedRange - * @returns {*} - */ - - }, { - key: 'isCorner', - value: function isCorner(coords, expandedRange) { - if (expandedRange) { - if (expandedRange.includes(coords)) { - if (this.getTopLeftCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.from.col)) || this.getTopRightCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.to.col)) || this.getBottomLeftCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.from.col)) || this.getBottomRightCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.to.col))) { - return true; - } - } - } - - return coords.isEqual(this.getTopLeftCorner()) || coords.isEqual(this.getTopRightCorner()) || coords.isEqual(this.getBottomLeftCorner()) || coords.isEqual(this.getBottomRightCorner()); - } - - /** - * @param {CellCoords} coords - * @param {CellRange} expandedRange - * @returns {CellCoords} - */ - - }, { - key: 'getOppositeCorner', - value: function getOppositeCorner(coords, expandedRange) { - if (!(coords instanceof _coords2.default)) { - return false; - } - - if (expandedRange) { - if (expandedRange.includes(coords)) { - if (this.getTopLeftCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.from.col))) { - return this.getBottomRightCorner(); - } - if (this.getTopRightCorner().isEqual(new _coords2.default(expandedRange.from.row, expandedRange.to.col))) { - return this.getBottomLeftCorner(); - } - if (this.getBottomLeftCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.from.col))) { - return this.getTopRightCorner(); - } - if (this.getBottomRightCorner().isEqual(new _coords2.default(expandedRange.to.row, expandedRange.to.col))) { - return this.getTopLeftCorner(); - } - } - } - - if (coords.isEqual(this.getBottomRightCorner())) { - return this.getTopLeftCorner(); - } else if (coords.isEqual(this.getTopLeftCorner())) { - return this.getBottomRightCorner(); - } else if (coords.isEqual(this.getTopRightCorner())) { - return this.getBottomLeftCorner(); - } else if (coords.isEqual(this.getBottomLeftCorner())) { - return this.getTopRightCorner(); - } - } - - /** - * @param {CellRange} range - * @returns {Array} - */ - - }, { - key: 'getBordersSharedWith', - value: function getBordersSharedWith(range) { - if (!this.includesRange(range)) { - return []; - } - - var thisBorders = { - top: Math.min(this.from.row, this.to.row), - bottom: Math.max(this.from.row, this.to.row), - left: Math.min(this.from.col, this.to.col), - right: Math.max(this.from.col, this.to.col) - }; - var rangeBorders = { - top: Math.min(range.from.row, range.to.row), - bottom: Math.max(range.from.row, range.to.row), - left: Math.min(range.from.col, range.to.col), - right: Math.max(range.from.col, range.to.col) - }; - var result = []; - - if (thisBorders.top == rangeBorders.top) { - result.push('top'); - } - if (thisBorders.right == rangeBorders.right) { - result.push('right'); - } - if (thisBorders.bottom == rangeBorders.bottom) { - result.push('bottom'); - } - if (thisBorders.left == rangeBorders.left) { - result.push('left'); - } - - return result; - } - - /** - * Get inner selected cell coords defined by this range - * - * @returns {Array} - */ - - }, { - key: 'getInner', - value: function getInner() { - var topLeft = this.getTopLeftCorner(); - var bottomRight = this.getBottomRightCorner(); - var out = []; - - for (var r = topLeft.row; r <= bottomRight.row; r++) { - for (var c = topLeft.col; c <= bottomRight.col; c++) { - if (!(this.from.row === r && this.from.col === c) && !(this.to.row === r && this.to.col === c)) { - out.push(new _coords2.default(r, c)); - } - } - } - return out; - } - - /** - * Get all selected cell coords defined by this range - * - * @returns {Array} - */ - - }, { - key: 'getAll', - value: function getAll() { - var topLeft = this.getTopLeftCorner(); - var bottomRight = this.getBottomRightCorner(); - var out = []; - - for (var r = topLeft.row; r <= bottomRight.row; r++) { - for (var c = topLeft.col; c <= bottomRight.col; c++) { - if (topLeft.row === r && topLeft.col === c) { - out.push(topLeft); - } else if (bottomRight.row === r && bottomRight.col === c) { - out.push(bottomRight); - } else { - out.push(new _coords2.default(r, c)); - } - } - } - - return out; - } - - /** - * Runs a callback function against all cells in the range. You can break the iteration by returning - * `false` in the callback function - * - * @param callback {Function} - */ - - }, { - key: 'forAll', - value: function forAll(callback) { - var topLeft = this.getTopLeftCorner(); - var bottomRight = this.getBottomRightCorner(); - - for (var r = topLeft.row; r <= bottomRight.row; r++) { - for (var c = topLeft.col; c <= bottomRight.col; c++) { - var breakIteration = callback(r, c); - - if (breakIteration === false) { - return; - } - } - } - } - }]); - - return CellRange; -}(); - -exports.default = CellRange; - -/***/ }), -/* 70 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _array = __webpack_require__(2); - -var _object = __webpack_require__(1); - -var MIXIN_NAME = 'localHooks'; - -/** - * Mixin object to extend objects functionality for local hooks. - * - * @type {Object} - */ -var localHooks = { - /** - * Internal hooks storage. - */ - _localHooks: Object.create(null), - - /** - * Add hook to the collection. - * - * @param {String} key Hook name. - * @param {Function} callback Hook callback - */ - addLocalHook: function addLocalHook(key, callback) { - if (!this._localHooks[key]) { - this._localHooks[key] = []; - } - this._localHooks[key].push(callback); - }, - - - /** - * Run hooks. - * - * @param {String} key Hook name. - * @param {*} params - */ - runLocalHooks: function runLocalHooks(key) { - var _this = this; - - for (var _len = arguments.length, params = 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. - */ - clearLocalHooks: function clearLocalHooks() { - this._localHooks = {}; - } -}; - -(0, _object.defineGetter)(localHooks, 'MIXIN_NAME', MIXIN_NAME, { - writable: false, - enumerable: false -}); - -exports.default = localHooks; - -/***/ }), -/* 71 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; -exports.ITEMS = exports.UNDO = 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 = undefined; - -var _predefinedItems2; - -var _alignment = __webpack_require__(338); - -Object.defineProperty(exports, 'ALIGNMENT', { - enumerable: true, - get: function get() { - return _alignment.KEY; - } -}); - -var _clearColumn = __webpack_require__(339); - -Object.defineProperty(exports, 'CLEAR_COLUMN', { - enumerable: true, - get: function get() { - return _clearColumn.KEY; - } -}); - -var _columnLeft = __webpack_require__(340); - -Object.defineProperty(exports, 'COLUMN_LEFT', { - enumerable: true, - get: function get() { - return _columnLeft.KEY; - } -}); - -var _columnRight = __webpack_require__(341); - -Object.defineProperty(exports, 'COLUMN_RIGHT', { - enumerable: true, - get: function get() { - return _columnRight.KEY; - } -}); - -var _readOnly = __webpack_require__(342); - -Object.defineProperty(exports, 'READ_ONLY', { - enumerable: true, - get: function get() { - return _readOnly.KEY; - } -}); - -var _redo = __webpack_require__(343); - -Object.defineProperty(exports, 'REDO', { - enumerable: true, - get: function get() { - return _redo.KEY; - } -}); - -var _removeColumn = __webpack_require__(344); - -Object.defineProperty(exports, 'REMOVE_COLUMN', { - enumerable: true, - get: function get() { - return _removeColumn.KEY; - } -}); - -var _removeRow = __webpack_require__(345); - -Object.defineProperty(exports, 'REMOVE_ROW', { - enumerable: true, - get: function get() { - return _removeRow.KEY; - } -}); - -var _rowAbove = __webpack_require__(346); - -Object.defineProperty(exports, 'ROW_ABOVE', { - enumerable: true, - get: function get() { - return _rowAbove.KEY; - } -}); - -var _rowBelow = __webpack_require__(347); - -Object.defineProperty(exports, 'ROW_BELOW', { - enumerable: true, - get: function get() { - return _rowBelow.KEY; - } -}); - -var _separator = __webpack_require__(72); - -Object.defineProperty(exports, 'SEPARATOR', { - enumerable: true, - get: function get() { - return _separator.KEY; - } -}); - -var _undo = __webpack_require__(348); - -Object.defineProperty(exports, 'UNDO', { - enumerable: true, - get: function get() { - return _undo.KEY; - } -}); -exports.predefinedItems = predefinedItems; -exports.addItem = addItem; - -var _object = __webpack_require__(1); - -var _alignment2 = _interopRequireDefault(_alignment); - -var _clearColumn2 = _interopRequireDefault(_clearColumn); - -var _columnLeft2 = _interopRequireDefault(_columnLeft); - -var _columnRight2 = _interopRequireDefault(_columnRight); - -var _readOnly2 = _interopRequireDefault(_readOnly); - -var _redo2 = _interopRequireDefault(_redo); - -var _removeColumn2 = _interopRequireDefault(_removeColumn); - -var _removeRow2 = _interopRequireDefault(_removeRow); - -var _rowAbove2 = _interopRequireDefault(_rowAbove); - -var _rowBelow2 = _interopRequireDefault(_rowBelow); - -var _separator2 = _interopRequireDefault(_separator); - -var _undo2 = _interopRequireDefault(_undo); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -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 ITEMS = exports.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]; - -var _predefinedItems = (_predefinedItems2 = {}, _defineProperty(_predefinedItems2, _separator.KEY, _separator2.default), _defineProperty(_predefinedItems2, _rowAbove.KEY, _rowAbove2.default), _defineProperty(_predefinedItems2, _rowBelow.KEY, _rowBelow2.default), _defineProperty(_predefinedItems2, _columnLeft.KEY, _columnLeft2.default), _defineProperty(_predefinedItems2, _columnRight.KEY, _columnRight2.default), _defineProperty(_predefinedItems2, _clearColumn.KEY, _clearColumn2.default), _defineProperty(_predefinedItems2, _removeRow.KEY, _removeRow2.default), _defineProperty(_predefinedItems2, _removeColumn.KEY, _removeColumn2.default), _defineProperty(_predefinedItems2, _undo.KEY, _undo2.default), _defineProperty(_predefinedItems2, _redo.KEY, _redo2.default), _defineProperty(_predefinedItems2, _readOnly.KEY, _readOnly2.default), _defineProperty(_predefinedItems2, _alignment.KEY, _alignment2.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; - } -} - -/***/ }), -/* 72 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; -exports.default = separatorItem; -var KEY = exports.KEY = '---------'; - -function separatorItem() { - return { - name: KEY - }; -} - -/***/ }), -/* 73 */ -/***/ (function(module, exports) { - -module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); - return it; -}; - -/***/ }), -/* 74 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var $defineProperty = __webpack_require__(19) - , createDesc = __webpack_require__(41); - -module.exports = function(object, index, value){ - if(index in object)$defineProperty.f(object, index, createDesc(0, value)); - else object[index] = value; -}; - -/***/ }), -/* 75 */ -/***/ (function(module, exports, __webpack_require__) { - -var isObject = __webpack_require__(15) - , document = __webpack_require__(13).document - // in old IE typeof document.createElement is 'object' - , is = isObject(document) && isObject(document.createElement); -module.exports = function(it){ - return is ? document.createElement(it) : {}; -}; - -/***/ }), -/* 76 */ -/***/ (function(module, exports) { - -// IE 8- don't enum bug keys -module.exports = ( - 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' -).split(','); - -/***/ }), -/* 77 */ -/***/ (function(module, exports, __webpack_require__) { - -var MATCH = __webpack_require__(10)('match'); -module.exports = function(KEY){ - var re = /./; - try { - '/./'[KEY](re); - } catch(e){ - try { - re[MATCH] = false; - return !'/./'[KEY](re); - } catch(f){ /* empty */ } - } return true; -}; - -/***/ }), -/* 78 */ -/***/ (function(module, exports, __webpack_require__) { - -// fallback for non-array-like ES3 and non-enumerable old V8 strings -var cof = __webpack_require__(39); -module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ - return cof(it) == 'String' ? it.split('') : Object(it); -}; - -/***/ }), -/* 79 */ -/***/ (function(module, exports, __webpack_require__) { - -var ITERATOR = __webpack_require__(10)('iterator') - , SAFE_CLOSING = false; - -try { - var riter = [7][ITERATOR](); - riter['return'] = function(){ SAFE_CLOSING = true; }; - Array.from(riter, function(){ throw 2; }); -} catch(e){ /* empty */ } - -module.exports = function(exec, skipClosing){ - if(!skipClosing && !SAFE_CLOSING)return false; - var safe = false; - try { - var arr = [7] - , iter = arr[ITERATOR](); - iter.next = function(){ return {done: safe = true}; }; - arr[ITERATOR] = function(){ return iter; }; - exec(arr); - } catch(e){ /* empty */ } - return safe; -}; - -/***/ }), -/* 80 */ -/***/ (function(module, exports, __webpack_require__) { - -// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) -var anObject = __webpack_require__(18) - , dPs = __webpack_require__(403) - , enumBugKeys = __webpack_require__(76) - , IE_PROTO = __webpack_require__(83)('IE_PROTO') - , Empty = function(){ /* empty */ } - , PROTOTYPE = 'prototype'; - -// Create object with fake `null` prototype: use iframe Object with cleared prototype -var createDict = function(){ - // Thrash, waste and sodomy: IE GC bug - var iframe = __webpack_require__(75)('iframe') - , i = enumBugKeys.length - , lt = '<' - , gt = '>' - , iframeDocument; - iframe.style.display = 'none'; - __webpack_require__(274).appendChild(iframe); - iframe.src = 'javascript:'; // eslint-disable-line no-script-url - // createDict = iframe.contentWindow.Object; - // html.removeChild(iframe); - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); - iframeDocument.close(); - createDict = iframeDocument.F; - while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; - return createDict(); -}; - -module.exports = Object.create || function create(O, Properties){ - var result; - if(O !== null){ - Empty[PROTOTYPE] = anObject(O); - result = new Empty; - Empty[PROTOTYPE] = null; - // add "__proto__" for Object.getPrototypeOf polyfill - result[IE_PROTO] = O; - } else result = createDict(); - return Properties === undefined ? result : dPs(result, Properties); -}; - - -/***/ }), -/* 81 */ -/***/ (function(module, exports, __webpack_require__) { - -var pIE = __webpack_require__(48) - , createDesc = __webpack_require__(41) - , toIObject = __webpack_require__(23) - , toPrimitive = __webpack_require__(87) - , has = __webpack_require__(22) - , IE8_DOM_DEFINE = __webpack_require__(275) - , gOPD = Object.getOwnPropertyDescriptor; - -exports.f = __webpack_require__(21) ? gOPD : function getOwnPropertyDescriptor(O, P){ - O = toIObject(O); - P = toPrimitive(P, true); - if(IE8_DOM_DEFINE)try { - return gOPD(O, P); - } catch(e){ /* empty */ } - if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); -}; - -/***/ }), -/* 82 */ -/***/ (function(module, exports, __webpack_require__) { - -// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) -var $keys = __webpack_require__(284) - , hiddenKeys = __webpack_require__(76).concat('length', 'prototype'); - -exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ - return $keys(O, hiddenKeys); -}; - -/***/ }), -/* 83 */ -/***/ (function(module, exports, __webpack_require__) { - -var shared = __webpack_require__(84)('keys') - , uid = __webpack_require__(50); -module.exports = function(key){ - return shared[key] || (shared[key] = uid(key)); -}; - -/***/ }), -/* 84 */ -/***/ (function(module, exports, __webpack_require__) { - -var global = __webpack_require__(13) - , SHARED = '__core-js_shared__' - , store = global[SHARED] || (global[SHARED] = {}); -module.exports = function(key){ - return store[key] || (store[key] = {}); -}; - -/***/ }), -/* 85 */ -/***/ (function(module, exports, __webpack_require__) { - -// helper for String#{startsWith, endsWith, includes} -var isRegExp = __webpack_require__(279) - , defined = __webpack_require__(30); - -module.exports = function(that, searchString, NAME){ - if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!"); - return String(defined(that)); -}; - -/***/ }), -/* 86 */ -/***/ (function(module, exports, __webpack_require__) { - -var ctx = __webpack_require__(29) - , invoke = __webpack_require__(399) - , html = __webpack_require__(274) - , cel = __webpack_require__(75) - , global = __webpack_require__(13) - , process = global.process - , setTask = global.setImmediate - , clearTask = global.clearImmediate - , MessageChannel = global.MessageChannel - , counter = 0 - , queue = {} - , ONREADYSTATECHANGE = 'onreadystatechange' - , defer, channel, port; -var run = function(){ - var id = +this; - if(queue.hasOwnProperty(id)){ - var fn = queue[id]; - delete queue[id]; - fn(); - } -}; -var listener = function(event){ - run.call(event.data); -}; -// Node.js 0.9+ & IE10+ has setImmediate, otherwise: -if(!setTask || !clearTask){ - setTask = function setImmediate(fn){ - var args = [], i = 1; - while(arguments.length > i)args.push(arguments[i++]); - queue[++counter] = function(){ - invoke(typeof fn == 'function' ? fn : Function(fn), args); - }; - defer(counter); - return counter; - }; - clearTask = function clearImmediate(id){ - delete queue[id]; - }; - // Node.js 0.8- - if(__webpack_require__(39)(process) == 'process'){ - defer = function(id){ - process.nextTick(ctx(run, id, 1)); - }; - // Browsers with MessageChannel, includes WebWorkers - } else if(MessageChannel){ - channel = new MessageChannel; - port = channel.port2; - channel.port1.onmessage = listener; - defer = ctx(port.postMessage, port, 1); - // Browsers with postMessage, skip WebWorkers - // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' - } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){ - defer = function(id){ - global.postMessage(id + '', '*'); - }; - global.addEventListener('message', listener, false); - // IE8- - } else if(ONREADYSTATECHANGE in cel('script')){ - defer = function(id){ - html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){ - html.removeChild(this); - run.call(id); - }; - }; - // Rest old browsers - } else { - defer = function(id){ - setTimeout(ctx(run, id, 1), 0); - }; - } -} -module.exports = { - set: setTask, - clear: clearTask -}; - -/***/ }), -/* 87 */ -/***/ (function(module, exports, __webpack_require__) { - -// 7.1.1 ToPrimitive(input [, PreferredType]) -var isObject = __webpack_require__(15); -// instead of the ES6 spec version, we didn't implement @@toPrimitive case -// and the second argument - flag - preferred type is a string -module.exports = function(it, S){ - if(!isObject(it))return it; - var fn, val; - if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; - if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; - if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; - throw TypeError("Can't convert object to primitive value"); -}; - -/***/ }), -/* 88 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var _mixed = __webpack_require__(20); - -var _object = __webpack_require__(1); - -/** - * @alias Options - * @constructor - * @description - - * ## Constructor options - * - * Constructor options are applied using an object literal passed as a second argument to the Handsontable constructor. - * - * ```js - * var hot = new Handsontable(document.getElementById('example1'), { - * data: myArray, - * width: 400, - * height: 300 - * }); - * ``` - * - * --- - * ## Cascading configuration - * - * Handsontable 0.9 and newer is using *Cascading Configuration*, which is a fast way to provide configuration options - * for the entire table, including its columns and particular cells. - * - * Consider the following example: - * ```js - * var hot = new Handsontable(document.getElementById('example'), { - * readOnly: true, - * columns: [ - * {readOnly: false}, - * {}, - * {} - * ], - * cells: function (row, col, prop) { - * var cellProperties = {}; - * - * if (row === 0 && col === 0) { - * cellProperties.readOnly = true; - * } - * - * return cellProperties; - * } - * }); - * ``` - * - * The above notation will result in all TDs being *read only*, except for first column TDs which will be *editable*, except for the TD in top left corner which will still be *read only*. - * - * ### The Cascading Configuration model - * - * ##### 1. Constructor - * - * Configuration options that are provided using first-level `handsontable(container, {option: "value"})` and `updateSettings` method. - * - * ##### 2. Columns - * - * Configuration options that are provided using second-level object `handsontable(container, {columns: {option: "value"}]})` - * - * ##### 3. Cells - * - * Configuration options that are provided using second-level function `handsontable(container, {cells: function: (row, col, prop){ }})` - * - * --- - * ## Architecture performance - * - * The Cascading Configuration model is based on prototypical inheritance. It is much faster and memory efficient compared - * to the previous model that used jQuery extend. See: [http://jsperf.com/extending-settings](http://jsperf.com/extending-settings). - * - * --- - * __Important notice:__ In order for the data separation to work properly, make sure that each instance of Handsontable has a unique `id`. - */ -function DefaultSettings() {}; - -DefaultSettings.prototype = { - /** - * @description - * Initial data source that will be bound to the data grid __by reference__ (editing data grid alters the data source). - * Can be declared as an Array of Arrays, Array of Objects or a Function. - * - * See [Understanding binding as reference](http://docs.handsontable.com/tutorial-data-binding.html#page-reference). - * - * @type {Array|Function} - * @default undefined - */ - data: void 0, - - /** - * @description - * Defines the structure of a new row when data source is an array of objects. - * - * See [data-schema](http://docs.handsontable.com/tutorial-data-sources.html#page-data-schema) for examples. - * - * @type {Object} - * @default undefined - */ - dataSchema: void 0, - - /** - * Width of the grid. Can be a value or a function that returns a value. - * - * @type {Number|Function} - * @default undefined - */ - width: void 0, - - /** - * Height of the grid. Can be a number or a function that returns a number. - * - * @type {Number|Function} - * @default undefined - */ - height: void 0, - - /** - * @description - * Initial number of rows. - * - * __Notice:__ This option only has effect in Handsontable constructor and only if `data` option is not provided - * - * @type {Number} - * @default 5 - */ - startRows: 5, - - /** - * @description - * Initial number of columns. - * - * __Notice:__ This option only has effect in Handsontable constructor and only if `data` option is not provided - * - * @type {Number} - * @default 5 - */ - startCols: 5, - - /** - * Setting `true` or `false` will enable or disable the default row headers (1, 2, 3). - * You can also define an array `['One', 'Two', 'Three', ...]` or a function to define the headers. - * If a function is set the index of the row is passed as a parameter. - * - * @type {Boolean|Array|Function} - * @default null - * @example - * ```js - * ... - * // as boolean - * rowHeaders: true, - * ... - * - * ... - * // as array - * rowHeaders: [1, 2, 3], - * ... - * - * ... - * // as function - * rowHeaders: function(index) { - * return index + ': AB'; - * }, - * ... - * ``` - */ - rowHeaders: void 0, - - /** - * Setting `true` or `false` will enable or disable the default column headers (A, B, C). - * You can also define an array `['One', 'Two', 'Three', ...]` or a function to define the headers. - * If a function is set, then the index of the column is passed as a parameter. - * - * @type {Boolean|Array|Function} - * @default null - * @example - * ```js - * ... - * // as boolean - * colHeaders: true, - * ... - * - * ... - * // as array - * colHeaders: ['A', 'B', 'C'], - * ... - * - * ... - * // as function - * colHeaders: function(index) { - * return index + ': AB'; - * }, - * ... - * ``` - */ - colHeaders: null, - - /** - * Defines column widths in pixels. Accepts number, string (that will be converted to a number), - * array of numbers (if you want to define column width separately for each column) or a - * function (if you want to set column width dynamically on each render). - * - * @type {Array|Function|Number|String} - * @default undefined - * @example - * ```js - * ... - * // as numeric, for each column. - * colWidths: 100, - * ... - * - * * ... - * // as string, for each column. - * colWidths: '100px', - * ... - * - * ... - * // as array, based on visual indexes. The rest of the columns have a default width. - * colWidths: [100, 120, 90], - * ... - * - * ... - * // as function, based on visual indexes. - * colWidths: function(index) { - * return index * 10; - * }, - * ... - * ``` - */ - colWidths: void 0, - - /** - * Defines row heights in pixels. Accepts numbers, strings (that will be converted into a number), - * array of numbers (if you want to define row height separately for each row) or a - * function (if you want to set row height dynamically on each render). - * If the ManualRowResize or AutoRowSize plugins are enabled, this is also the minimum height that can be set - * via either of those two plugins. - * Height should be equal or greater than 23px. Table is rendered incorrectly if height is less than 23px. - * - * @type {Array|Function|Number|String} - * @default undefined - * @example - * ```js - * ... - * // as numeric, for each row. - * rowHeights: 100, - * ... - * - * * ... - * // as string, for each row. - * rowHeights: '100px', - * ... - * - * ... - * // as array, based on visual indexes. The rest of the rows have a default height. - * rowHeights: [100, 120, 90], - * ... - * - * ... - * // as function, based on visual indexes. - * rowHeights: function(index) { - * return index * 10; - * }, - * ... - * ``` - */ - rowHeights: void 0, - - /** - * @description - * Defines the cell properties and data binding for certain columns. - * - * __Notice:__ Using this option sets a fixed number of columns (options `startCols`, `minCols`, `maxCols` will be ignored). - * - * See [documentation -> datasources.html](http://docs.handsontable.com/tutorial-data-sources.html#page-nested) for examples. - * - * @type {Array|Function} - * @default undefined - * @example - * ```js - * ... - * // as an array of objects. Order of the objects in array is representation of physical indexes. - * columns: [ - * { - * // column options for the first column - * type: 'numeric', - * format: '0,0.00 $' - * }, - * { - * // column options for the second column - * type: 'text', - * readOnly: true - * } - * ], - * ... - * - * // or as function, based on physical indexes - * ... - * columns: function(index) { - * return { - * type: index > 0 ? 'numeric' : 'text', - * readOnly: index < 1 - * } - * } - * ... - * ``` - */ - columns: void 0, - - /** - * @description - * Defines the cell properties for given `row`, `col`, `prop` coordinates. - * Any constructor or column option may be overwritten for a particular cell (row/column combination) - * using the `cells` property in the Handsontable constructor. - * - * __Note:__ Parameters `row` and `col` always represent __physical indexes__. Example below show how to execute - * operations based on the __visual__ representation of Handsontable. - * - * Possible values of `prop`: - * - property name for column's data source object, when dataset is an [array of objects](/tutorial-data-sources.html#page-object) - * - the same number as `col`, when dataset is an [array of arrays](/tutorial-data-sources.html#page-array) - * - * @type {Function} - * @default undefined - * @example - * ```js - * ... - * cells: function (row, col, prop) { - * var cellProperties = {}; - * var visualRowIndex = this.instance.toVisualRow(row); - * var visualColIndex = this.instance.toVisualColumn(col); - * - * if (visualRowIndex === 0 && visualColIndex === 0) { - * cellProperties.readOnly = true; - * } - * - * return cellProperties; - * }, - * ... - * ``` - */ - cells: void 0, - - /** - * Any constructor or column option may be overwritten for a particular cell (row/column combination), using `cell` - * array passed to the Handsontable constructor. - * - * @type {Array} - * @default [] - * @example - * ```js - * ... - * cell: [ - * {row: 0, col: 0, readOnly: true} - * ], - * ... - * ``` - */ - cell: [], - - /** - * @description - * If `true`, enables the {@link Comments} plugin, which enables an option to apply cell comments through the context menu - * (configurable with context menu keys `commentsAddEdit`, `commentsRemove`). - * - * To initialize Handsontable with predefined comments, provide cell coordinates and comment text values in a form of an array. - * - * See [Comments](http://docs.handsontable.com/demo-comments_.html) demo for examples. - * - * @since 0.11.0 - * @type {Boolean|Array} - * @default false - * @example - * ```js - * ... - * comments: [{row: 1, col: 1, comment: {value: "Test comment"}}], - * ... - * ``` - */ - comments: false, - - /** - * @description - * If `true`, enables the Custom Borders plugin, which enables an option to apply custom borders through the context menu (configurable with context menu key `borders`). - * - * To initialize Handsontable with predefined custom borders, provide cell coordinates and border styles in a form of an array. - * - * See [Custom Borders](http://docs.handsontable.com/demo-custom-borders.html) demo for examples. - * - * @since 0.11.0 - * @type {Boolean|Array} - * @default false - * @example - * ```js - * ... - * customBorders: [ - * {range: { - * from: {row: 1, col: 1}, - * to: {row: 3, col: 4}}, - * left: {}, - * right: {}, - * top: {}, - * bottom: {} - * } - * ], - * ... - * - * // or - * ... - * customBorders: [ - * {row: 2, col: 2, left: {width: 2, color: 'red'}, - * right: {width: 1, color: 'green'}, top: '', bottom: ''} - * ], - * ... - * ``` - */ - customBorders: false, - - /** - * Minimum number of rows. At least that number of rows will be created during initialization. - * - * @type {Number} - * @default 0 - */ - minRows: 0, - - /** - * Minimum number of columns. At least that number of columns will be created during initialization. - * - * @type {Number} - * @default 0 - */ - minCols: 0, - - /** - * Maximum number of rows. If set to a value lower than the initial row count, the data will be trimmed to the provided value as the number of rows. - * - * @type {Number} - * @default Infinity - */ - maxRows: Infinity, - - /** - * Maximum number of cols. If set to a value lower than the initial col count, the data will be trimmed to the provided value as the number of cols. - * - * @type {Number} - * @default Infinity - */ - maxCols: Infinity, - - /** - * When set to 1 (or more), Handsontable will add a new row at the end of grid if there are no more empty rows. - * (unless the number of rows exceeds the one set in the `maxRows` property) - * - * @type {Number} - * @default 0 - */ - minSpareRows: 0, - - /** - * When set to 1 (or more), Handsontable will add a new column at the end of grid if there are no more empty columns. - * (unless the number of rows exceeds the one set in the `maxCols` property) - * - * @type {Number} - * @default 0 - */ - minSpareCols: 0, - - /** - * If set to `false`, there won't be an option to insert new rows in the Context Menu. - * - * @type {Boolean} - * @default true - */ - allowInsertRow: true, - - /** - * If set to `false`, there won't be an option to insert new columns in the Context Menu. - * - * @type {Boolean} - * @default true - */ - allowInsertColumn: true, - - /** - * If set to `false`, there won't be an option to remove rows in the Context Menu. - * - * @type {Boolean} - * @default true - */ - allowRemoveRow: true, - - /** - * If set to `false`, there won't be an option to remove columns in the Context Menu. - * - * @type {Boolean} - * @default true - */ - allowRemoveColumn: true, - - /** - * If true, selection of multiple cells using keyboard or mouse is allowed. - * - * @type {Boolean} - * @default true - */ - multiSelect: true, - - /** - * Enables the fill handle (drag-down and copy-down) functionality, which shows a small rectangle in bottom - * right corner of the selected area, that let's you expand values to the adjacent cells. - * - * Possible values: `true` (to enable in all directions), `'vertical'` or `'horizontal'` (to enable in one direction), - * `false` (to disable completely). Setting to `true` enables the fillHandle plugin. - * - * Since 0.23.0 you can pass object to plugin which allows you to add more options for this functionality. If `autoInsertRow` - * option is `true`, fill-handler will create new rows till it reaches the last row. It is enabled by default. - * - * @example - * ```js - * ... - * fillHandle: true // enable plugin in all directions and with autoInsertRow as true - * ... - * // or - * ... - * fillHandle: 'vertical' // enable plugin in vertical direction and with autoInsertRow as true - * ... - * // or - * ... - * fillHandle: { // enable plugin in both directions and with autoInsertRow as false - * autoInsertRow: false, - * } - * // or - * ... - * fillHandle: { // enable plugin in vertical direction and with autoInsertRow as false - * autoInsertRow: false, - * direction: 'vertical' // 'vertical' or 'horizontal' - * } - * ``` - * - * @type {Boolean|String|Object} - * @default true - */ - fillHandle: true, - - /** - * Allows to specify the number of fixed (or *frozen*) rows at the top of the table. - * - * @type {Number} - * @default 0 - * @example - * ```js - * fixedRowsTop: 3 // This would freeze the top 3 rows of the table. - * ``` - */ - fixedRowsTop: 0, - - /** - * Allows to specify the number of fixed (or *frozen*) rows at the bottom of the table. - * - * @pro - * @type {Number} - * @default 0 - * @example - * ```js - * fixedRowsBottom: 3 // This would freeze the top 3 rows of the table. - * ``` - */ - fixedRowsBottom: 0, - - /** - * Allows to specify the number of fixed (or *frozen*) columns on the left of the table. - * - * @type {Number} - * @default 0 - * @example - * ```js - * fixedColumnsLeft: 3 // This would freeze the top 3 rows of the table. - * ``` - */ - fixedColumnsLeft: 0, - - /** - * If `true`, mouse click outside the grid will deselect the current selection. - * Can be a function that takes the click event target and returns a boolean. - * - * @type {Boolean|Function} - * @default true - */ - outsideClickDeselects: true, - - /** - * If `true`, ENTER begins editing mode (like in Google Docs). If `false`, ENTER moves to next - * row (like Excel) and adds a new row if necessary. TAB adds new column if necessary. - * - * @type {Boolean} - * @default true - */ - enterBeginsEditing: true, - - /** - * Defines the cursor movement after ENTER was pressed (SHIFT + ENTER uses a negative vector). - * Can be an object or a function that returns an object. The event argument passed to the function - * is a DOM Event object received after the ENTER key has been pressed. This event object can be used to check - * whether user pressed ENTER or SHIFT + ENTER. - * - * @type {Object|Function} - * @default {row: 1, col: 0} - */ - enterMoves: { row: 1, col: 0 }, - - /** - * Defines the cursor movement after TAB is pressed (SHIFT + TAB uses a negative vector). - * Can be an object or a function that returns an object. The event argument passed to the function - * is a DOM Event object received after the TAB key has been pressed. This event object can be used to check - * whether user pressed TAB or SHIFT + TAB. - * - * @type {Object} - * @default {row: 0, col: 1} - */ - tabMoves: { row: 0, col: 1 }, - - /** - * If `true`, pressing TAB or right arrow in the last column will move to first column in next row. - * - * @type {Boolean} - * @default false - */ - autoWrapRow: false, - - /** - * If `true`, pressing ENTER or down arrow in the last row will move to the first row in the next column. - * - * @type {Boolean} - * @default false - */ - autoWrapCol: false, - - /** - * @description - * Turns on saving the state of column sorting, column positions and column sizes in local storage. - * - * You can save any sort of data in local storage to preserve table state between page reloads. - * In order to enable data storage mechanism, `persistentState` option must be set to `true` (you can set it - * either during Handsontable initialization or using the `updateSettings` method). When `persistentState` is enabled it exposes 3 hooks: - * - * __persistentStateSave__ (key: String, value: Mixed) - * - * * Saves value under given key in browser local storage. - * - * __persistentStateLoad__ (key: String, valuePlaceholder: Object) - * - * * Loads `value`, saved under given key, form browser local storage. The loaded `value` will be saved in `valuePlaceholder.value` - * (this is due to specific behaviour of `Hooks.run()` method). If no value have been saved under key `valuePlaceholder.value` - * will be `undefined`. - * - * __persistentStateReset__ (key: String) - * - * * Clears the value saved under `key`. If no `key` is given, all values associated with table will be cleared. - * - * __Note:__ The main reason behind using `persistentState` hooks rather than regular LocalStorage API is that it - * ensures separation of data stored by multiple Handsontable instances. In other words, if you have two (or more) - * instances of Handsontable on one page, data saved by one instance won't be accessible by the second instance. - * Those two instances can store data under the same key and no data would be overwritten. - * - * __Important:__ In order for the data separation to work properly, make sure that each instance of Handsontable has a unique `id`. - * - * @type {Boolean} - * @default false - */ - persistentState: void 0, - - /** - * Class name for all visible rows in the current selection. - * - * @type {String} - * @default undefined - * @example - * ```js - * currentRowClassName: 'currentRow' // This will add a 'currentRow' class name to appropriate table cells. - * ``` - */ - currentRowClassName: void 0, - - /** - * Class name for all visible columns in the current selection. - * - * @type {String} - * @default undefined - * @example - * ```js - * currentColClassName: 'currentColumn' // This will add a 'currentColumn' class name to appropriate table cells. - * ``` - */ - currentColClassName: void 0, - - /** - * Class name for all visible headers in current selection. - * - * @type {String} - * @since 0.27.0 - * @default 'ht__highlight' - * @example - * ```js - * currentHeaderClassName: 'ht__highlight' // This will add a 'ht__highlight' class name to appropriate table headers. - * ``` - */ - currentHeaderClassName: 'ht__highlight', - /** - * Class name for the Handsontable container element. - * - * @type {String|Array} - * @default undefined - */ - className: void 0, - - /** - * Class name for all tables inside container element. - * - * @since 0.17.0 - * @type {String|Array} - * @default undefined - */ - tableClassName: void 0, - - /** - * @description - * Defines how the columns react, when the declared table width is different than the calculated sum of all column widths. - * [See more](http://docs.handsontable.com/demo-stretching.html) mode. Possible values: - * * `'none'` Disable stretching - * * `'last'` Stretch only the last column - * * `'all'` Stretch all the columns evenly - * - * @type {String} - * @default 'none' - */ - stretchH: 'none', - - /** - * Lets you overwrite the default `isEmptyRow` method, which checks if row at the provided index is empty. - * - * @type {Function} - * @param {Number} row Visual row index. - * @returns {Boolean} - */ - isEmptyRow: function isEmptyRow(row) { - var col, colLen, value, meta; - - for (col = 0, colLen = this.countCols(); col < colLen; col++) { - value = this.getDataAtCell(row, col); - - if (value !== '' && value !== null && (0, _mixed.isDefined)(value)) { - if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') { - meta = this.getCellMeta(row, col); - - return (0, _object.isObjectEquals)(this.getSchema()[meta.prop], value); - } - return false; - } - } - - return true; - }, - - - /** - * Lets you overwrite the default `isEmptyCol` method, which checks if column at the provided index is empty. - * - * @type {Function} - * @param {Number} col Visual column index - * @returns {Boolean} - */ - isEmptyCol: function isEmptyCol(col) { - var row, rowLen, value; - - for (row = 0, rowLen = this.countRows(); row < rowLen; row++) { - value = this.getDataAtCell(row, col); - - if (value !== '' && value !== null && (0, _mixed.isDefined)(value)) { - return false; - } - } - - return true; - }, - - - /** - * When set to `true`, the table is re-rendered when it is detected that it was made visible in DOM. - * - * @type {Boolean} - * @default true - */ - observeDOMVisibility: true, - - /** - * If set to `true`, Handsontable will accept values that were marked as invalid by the cell `validator`. - * It will result with *invalid* cells being treated as *valid* (will save the *invalid* value into the Handsontable data source). - * If set to `false`, Handsontable will *not* accept the invalid values and won't allow the user to close the editor. - * This option will be particularly useful when used with the Autocomplete's `strict` mode. - * - * @type {Boolean} - * @default true - * @since 0.9.5 - */ - allowInvalid: true, - - /** - * If set to `true`, Handsontable will accept values that are empty (`null`, `undefined` or `''`). - * If set to `false`, Handsontable will *not* accept the empty values and mark cell as invalid. - * - * @example - * ```js - * ... - * allowEmpty: true // allow empty values for all cells (whole table) - * ... - * // or - * ... - * columns: [ - * // allow empty values only for 'date' column - * {data: 'date', dateFormat: 'DD/MM/YYYY', allowEmpty: true} - * ] - * ... - * ``` - * - * @type {Boolean} - * @default true - * @since 0.23.0 - */ - allowEmpty: true, - - /** - * CSS class name for cells that did not pass validation. - * - * @type {String} - * @default 'htInvalid' - */ - invalidCellClassName: 'htInvalid', - - /** - * When set to an non-empty string, displayed as the cell content for empty cells. If a value of a different type is provided, - * it will be stringified and applied as a string. - * - * @type {Mixed} - * @default false - */ - placeholder: false, - - /** - * CSS class name for cells that have a placeholder in use. - * - * @type {String} - * @default 'htPlaceholder' - */ - placeholderCellClassName: 'htPlaceholder', - - /** - * CSS class name for read-only cells. - * - * @type {String} - * @default 'htDimmed' - */ - readOnlyCellClassName: 'htDimmed', - - /** - * @description - * If a string is provided, it may be one of the following predefined values: - * * `autocomplete`, - * * `checkbox`, - * * `html`, - * * `numeric`, - * * `password`. - * * `text`. - * - * Or you can [register](http://docs.handsontable.com/demo-custom-renderers.html) the custom renderer under specified name and use - * its name as an alias in your configuration. - * - * If a function is provided, it will receive the following arguments: - * ```js - * function(instance, TD, row, col, prop, value, cellProperties) {} - * ``` - * - * You can read more about custom renderes [in the documentation](http://docs.handsontable.com/demo-custom-renderers.html). - * - * @example - * ```js - * ... - * Handsontable.renderers.registerRenderer('my.renderer', function(instance, TD, row, col, prop, value, cellProperties) { - * TD.innerHTML = value; - * }); - * ... - * columns: [ - * { - * editor: 'select', - * renderer: 'autocomplete' // as string - * }, - * { - * renderer: 'my.renderer' // custom renderer as an alias - * }, - * { - * // renderer as custom function - * renderer: function(hotInstance, TD, row, col, prop, value, cellProperties) { - * TD.style.color = 'blue'; - * TD.innerHTML = value; - * } - * } - * ] - * ... - * ``` - * - * @type {String|Function} - * @default undefined - */ - renderer: void 0, - - /** - * CSS class name added to the commented cells. - * - * @type {String} - * @default 'htCommentCell' - */ - commentedCellClassName: 'htCommentCell', - - /** - * If set to `true`, it enables the browser's native selection of a fragment of the text within a single cell, between adjacent cells or in a whole table. - * If set to `'cell'`, it enables the possibility of selecting a fragment of the text within a single cell's body. - * - * @type {Boolean|String} - * @default false - */ - fragmentSelection: false, - - /** - * @description - * Make cell [read only](http://docs.handsontable.com/demo-read-only.html). - * - * @type {Boolean} - * @default false - */ - readOnly: false, - - /** - * @description - * When added to a `column` property, it skips the column on paste and pastes the data on the next column to the right. - * - * @type {Boolean} - * @default false - */ - skipColumnOnPaste: false, - - /** - * @description - * Setting to true enables the search plugin (see [demo](http://docs.handsontable.com/demo-search-for-values.html)). - * - * @type {Boolean} - * @default false - */ - search: false, - - /** - * @description - * Shortcut to define the combination of the cell renderer, editor and validator for the column, cell or whole table. - * - * Possible values: - * * [autocomplete](http://docs.handsontable.com/demo-autocomplete.html) - * * [checkbox](http://docs.handsontable.com/demo-checkbox.html) - * * [date](http://docs.handsontable.com/demo-date.html) - * * [dropdown](http://docs.handsontable.com/demo-dropdown.html) - * * [handsontable](http://docs.handsontable.com/demo-handsontable.html) - * * [numeric](http://docs.handsontable.com/demo-numeric.html) - * * [password](http://docs.handsontable.com/demo-password.html) - * * text - * * [time](http://docs.handsontable.com/demo-time.html) - * - * Or you can register the custom cell type under specified name and use - * its name as an alias in your configuration. - * - * @example - * ```js - * ... - * Handsontable.cellTypes.registerCellType('my.type', { - * editor: MyEditorClass, - * renderer: function(hot, td, row, col, prop, value, cellProperties) { - * td.innerHTML = value; - * }, - * validator: function(value, callback) { - * callback(value === 'foo' ? true : false); - * } - * }); - * ... - * columns: [ - * { - * type: 'text' - * }, - * { - * type: 'my.type' // an alias to custom type - * }, - * { - * type: 'checkbox' - * } - * ] - * ... - * ``` - * - * @type {String} - * @default 'text' - */ - type: 'text', - - /** - * @description - * Make cell copyable (pressing CTRL + C on your keyboard moves its value to system clipboard). - * - * __Note:__ this setting is `false` by default for cells with type `password`. - * - * @type {Boolean} - * @default true - * @since 0.10.2 - */ - copyable: true, - - /** - * Defines the editor for the table/column/cell. - * - * If a string is provided, it may be one of the following predefined values: - * * [autocomplete](http://docs.handsontable.com/demo-autocomplete.html) - * * [checkbox](http://docs.handsontable.com/demo-checkbox.html) - * * [date](http://docs.handsontable.com/demo-date.html) - * * [dropdown](http://docs.handsontable.com/demo-dropdown.html) - * * [handsontable](http://docs.handsontable.com/demo-handsontable.html) - * * [mobile](http://docs.handsontable.com/demo-mobiles-and-tablets.html) - * * [password](http://docs.handsontable.com/demo-password.html) - * * [select](http://docs.handsontable.com/demo-select.html) - * * text - * - * Or you can [register](http://docs.handsontable.com/tutorial-cell-editor.html#registering-an-editor) the custom editor under specified name and use - * its name as an alias in your configuration. - * - * To disable cell editing completely set `editor` property to `false`. - * - * @example - * ```js - * ... - * columns: [ - * { - * editor: 'select' - * }, - * { - * editor: false - * } - * ] - * ... - * ``` - * - * @type {String|Function|Boolean} - * @default 'text' - */ - editor: void 0, - - /** - * @description - * Autocomplete definitions. See [autocomplete demo](http://docs.handsontable.com/demo-autocomplete.html) for examples and definitions. - * - * @type {Array} - * @default undefined - */ - autoComplete: void 0, - - /** - * Control number of choices for the autocomplete (or dropdown) typed cells. After exceeding it, a scrollbar for the dropdown list of choices will appear. - * - * @since 0.18.0 - * @type {Number} - * @default 10 - */ - visibleRows: 10, - - /** - * Makes autocomplete or dropdown width the same as the edited cell width. If `false` then editor will be scaled - * according to its content. - * - * @since 0.17.0 - * @type {Boolean} - * @default true - */ - trimDropdown: true, - - /** - * Setting to true enables the debug mode, currently used to test the correctness of the row and column - * header fixed positioning on a layer above the master table. - * - * @type {Boolean} - * @default false - */ - debug: false, - - /** - * When set to `true`, the text of the cell content is wrapped if it does not fit in the fixed column width. - * - * @type {Boolean} - * @default true - * @since 0.11.0 - */ - wordWrap: true, - - /** - * CSS class name added to cells with cell meta `wordWrap: false`. - * - * @type {String} - * @default 'htNoWrap' - * @since 0.11.0 - */ - noWordWrapClassName: 'htNoWrap', - - /** - * @description - * Defines if the right-click context menu should be enabled. Context menu allows to create new row or - * column at any place in the grid among [other features](http://docs.handsontable.com/demo-context-menu.html). - * Possible values: - * * `true` (to enable default options), - * * `false` (to disable completely) - * * an array of [predefined options](https://docs.handsontable.com/demo-context-menu.html#page-specific), - * * an object [with defined structure](http://docs.handsontable.com/demo-context-menu.html#page-custom) - * - * See [the context menu demo](http://docs.handsontable.com/demo-context-menu.html) for examples. - * - * @example - * ```js - * ... - * // as a boolean - * contextMenu: true - * ... - * // as an array - * contextMenu: ['row_above', 'row_below', '--------', 'undo', 'redo'] - * ... - * ``` - * ... - * // as an object (`name` attribute is required in the custom keys) - * contextMenu: { - * items: { - * "option1": { - * name: "option1" - * }, - * "option2": { - * name: "option2", - * submenu: { - * items: [ - * { - * key: "option2:suboption1", - * name: "option2:suboption1", - * callback: function(key, options) { - * ... - * } - * }, - * ... - * ] - * } - * } - * } - * } - * ... - * ``` - * @type {Boolean|Array|Object} - * @default undefined - */ - contextMenu: void 0, - - /** - * @description - * Disable or enable the copy/paste functionality. - * - * @example - * ```js - * ... - * copyPaste: false, - * ... - * ``` - * - * @type {Boolean} - * @default true - */ - copyPaste: true, - - /** - * If `true`, undo/redo functionality is enabled. - * - * @type {Boolean} - * @default undefined - */ - undo: void 0, - - /** - * @description - * Turns on [Column sorting](http://docs.handsontable.com/demo-sorting-data.html). - * Can be either a boolean (true/false) or an object with a declared sorting options. See the below example: - * - * @example - * ```js - * ... - * // as boolean - * columnSorting: true - * ... - * // as a object with initial order (sort ascending column at index 2) - * columnSorting: { - * column: 2, - * sortOrder: true, // true = ascending, false = descending, undefined = original order - * sortEmptyCells: true // true = the table sorts empty cells, false = the table moves all empty cells to the end of the table - * } - * ... - * ``` - * - * @type {Boolean|Object} - * @default undefined - */ - columnSorting: void 0, - - /** - * @description - * Turns on [Manual column move](http://docs.handsontable.com/demo-moving-rows-and-columns.html), if set to a boolean or define initial - * column order, if set to an array of column indexes. - * - * @example - * ```js - * ... - * // as boolean - * manualColumnMove: true - * ... - * // as a array with initial order (move column index at 0 to 1 and move column index at 1 to 4) - * manualColumnMove: [1, 4] - * ... - * ``` - * - * @type {Boolean|Array} - * @default undefined - */ - manualColumnMove: void 0, - - /** - * @description - * Turns on [Manual column resize](http://docs.handsontable.com/demo-resizing.html), if set to a boolean or define initial - * column resized widths, if set to an array of numbers. - * - * @example - * ```js - * ... - * // as boolean - * manualColumnResize: true - * ... - * // as a array with initial widths (column at 0 index has 40px and column at 1 index has 50px) - * manualColumnResize: [40, 50] - * ... - * ``` - * - * @type {Boolean|Array} - * @default undefined - */ - manualColumnResize: void 0, - - /** - * @description - * Turns on [Manual row move](http://docs.handsontable.com/demo-moving-rows-and-columns.html), if set to a boolean or define initial - * row order, if set to an array of row indexes. - * - * @example - * ```js - * ... - * // as boolean - * manualRowMove: true - * ... - * // as a array with initial order (move row index at 0 to 1 and move row index at 1 to 4) - * manualRowMove: [1, 4] - * ... - * ``` - * - * @type {Boolean|Array} - * @default undefined - * @since 0.11.0 - */ - manualRowMove: void 0, - - /** - * @description - * Turns on [Manual row resize](http://docs.handsontable.com/demo-resizing.html), if set to a boolean or define initial - * row resized heights, if set to an array of numbers. - * - * @example - * ```js - * ... - * // as boolean - * manualRowResize: true - * ... - * // as a array with initial heights (row at 0 index has 40px and row at 1 index has 50px) - * manualRowResize: [40, 50] - * ... - * ``` - * - * @type {Boolean|Array} - * @default undefined - * @since 0.11.0 - */ - manualRowResize: void 0, - - /** - * @description - * If set to `true`, it enables a possibility to merge cells. If set to an array of objects, it merges the cells provided in the objects (see the example below). - * [More information on the demo page.](http://docs.handsontable.com/demo-merge-cells.html) - * - * @example - * ```js - * // enables the mergeCells plugin: - * margeCells: true - * ... - * // declares a list of merged sections: - * mergeCells: [ - * {row: 1, col: 1, rowspan: 3, colspan: 3}, // rowspan and colspan properties declare the width and height of a merged section in cells - * {row: 3, col: 4, rowspan: 2, colspan: 2}, - * {row: 5, col: 6, rowspan: 3, colspan: 3} - * ] - * ``` - * @type {Boolean|Array} - * @default false - */ - mergeCells: false, - - /** - * Number of rows to be rendered outside of the visible part of the table. - * By default, it's set to `'auto'`, which makes Handsontable to attempt to calculate the best offset performance-wise. - * - * You may test out different values to find the best one that works for your specific implementation. - * - * @type {Number|String} - * @default 'auto' - */ - viewportRowRenderingOffset: 'auto', - - /** - * Number of columns to be rendered outside of the visible part of the table. - * By default, it's set to `'auto'`, which makes Handsontable try calculating the best offset performance-wise. - * - * You may experiment with the value to find the one that works best for your specific implementation. - * - * @type {Number|String} - * @default 'auto' - */ - viewportColumnRenderingOffset: 'auto', - - /** - * A function, regular expression or a string, which will be used in the process of cell validation. - * If a function is used, be sure to execute the callback argument with either `true` (`callback(true)`) if the validation passed - * or with `false` (`callback(false)`), if the validation failed. - * Note, that `this` in the function points to the `cellProperties` object. - * - * If a string is provided, it may be one of the following predefined values: - * * `autocomplete`, - * * `date`, - * * `numeric`, - * * `time`. - * - * Or you can [register](http://docs.handsontable.com/demo-data-validation.html) the validator function under specified name and use - * its name as an alias in your configuration. - * - * See more [in the demo](http://docs.handsontable.com/demo-data-validation.html). - * - * @example - * ```js - * // as a function - * columns: [ - * { - * validator: function(value, callback) { // validation rules } - * } - * ] - * ... - * // as a regexp - * columns: [ - * { - * validator: /^[0-9]$/ // regular expression - * } - * ] - * // as a string - * columns: [ - * { - * validator: 'numeric' - * } - * ] - * ``` - * @type {Function|RegExp|String} - * @default undefined - * @since 0.9.5 - */ - validator: void 0, - - /** - * @description - * Disable visual cells selection. - * - * Possible values: - * * `true` - Disables any type of visual selection (current and area selection), - * * `false` - Enables any type of visual selection. This is default value. - * * `current` - Disables the selection of a currently selected cell, the area selection is still present. - * * `area` - Disables the area selection, the currently selected cell selection is still present. - * - * @type {Boolean|String|Array} - * @default false - * @since 0.13.2 - * @example - * ```js - * ... - * // as boolean - * disableVisualSelection: true, - * ... - * - * ... - * // as string ('current' or 'area') - * disableVisualSelection: 'current', - * ... - * - * ... - * // as array - * disableVisualSelection: ['current', 'area'], - * ... - * ``` - */ - disableVisualSelection: false, - - /** - * @description - * Set whether to display the current sorting order indicator (a triangle icon in the column header, specifying the sorting order). - * - * @type {Boolean} - * @default false - * @since 0.15.0-beta3 - */ - sortIndicator: void 0, - - /** - * Disable or enable ManualColumnFreeze plugin. - * - * @type {Boolean} - * @default false - */ - manualColumnFreeze: void 0, - - /** - * @description - * Defines whether Handsontable should trim the whitespace at the beginning and the end of the cell contents. - * - * @type {Boolean} - * @default true - */ - trimWhitespace: true, - - settings: void 0, - - /** - * @description - * Defines data source for Autocomplete or Dropdown cell types. - * - * @example - * ```js - * ... - * // source as a array - * columns: [{ - * type: 'autocomplete', - * source: ['A', 'B', 'C', 'D'] - * }] - * ... - * // source as a function - * columns: [{ - * type: 'autocomplete', - * source: function(query, callback) { - * fetch('http://example.com/query?q=' + query, function(response) { - * callback(response.items); - * }) - * } - * }] - * ... - * ``` - * - * @type {Array|Function} - * @default undefined - */ - source: void 0, - - /** - * @description - * Defines the column header name. - * - * @example - * ```js - * ... - * columns: [{ - * title: 'First name', - * type: 'text', - * }, - * { - * title: 'Last name', - * type: 'text', - * }] - * ... - * ``` - * - * @type {String} - * @default undefined - */ - title: void 0, - - /** - * Data template for `'checkbox'` type when checkbox is checked. - * - * @example - * ```js - * checkedTemplate: 'good' - * - * // if a checkbox-typed cell is checked, then getDataAtCell(x,y), where x and y are the coordinates of the cell - * // will return 'good'. - * ``` - * @type {Boolean|String} - * @default true - */ - checkedTemplate: void 0, - - /** - * Data template for `'checkbox'` type when checkbox is unchecked. - * - * @example - * ```js - * uncheckedTemplate: 'bad' - * - * // if a checkbox-typed cell is not checked, then getDataAtCell(x,y), where x and y are the coordinates of the cell - * // will return 'bad'. - * ``` - * @type {Boolean|String} - * @default false - */ - uncheckedTemplate: void 0, - - /** - * @description - * Object which describes if renderer should create checkbox element with label element as a parent. Option desired for - * [checkbox](http://docs.handsontable.com/demo-checkbox.html)-typed cells. - * - * By default the [checkbox](http://docs.handsontable.com/demo-checkbox.html) renderer renders the checkbox without a label. - * - * Possible object properties: - * * `property` - Defines the property name of the data object, which will to be used as a label. - * (eg. `label: {property: 'name.last'}`). This option works only if data was passed as an array of objects. - * * `position` - String which describes where to place the label text (before or after checkbox element). - * Valid values are `'before'` and '`after`' (defaults to `'after'`). - * * `value` - String or a Function which will be used as label text. - * - * @example - * ```js - * ... - * columns: [{ - * type: 'checkbox', - * label: {position: 'after', value: 'My label: '} - * }] - * ... - * ``` - * - * @since 0.19.0 - * @type {Object} - * @default undefined - */ - label: void 0, - - /** - * Display format. See [numbrojs](http://numbrojs.com). This option is desired for - * [numeric](http://docs.handsontable.com/demo-numeric.html)-typed cells. - * - * Since 0.26.0 Handsontable uses [numbro](http://numbrojs.com/) as a main library for numbers formatting. - * - * @example - * ```js - * ... - * columns: [{ - * type: 'numeric', - * format: '0,00' - * }] - * ... - * ``` - * - * @type {String} - * @default '0' - */ - format: void 0, - - /** - * Language display format. See [numbrojs](http://numbrojs.com/languages.html#supported-languages). This option is desired for - * [numeric](http://docs.handsontable.com/demo-numeric.html)-typed cells. - * - * Since 0.26.0 Handsontable uses [numbro](http://numbrojs.com/) as a main library for numbers formatting. - * - * @example - * ```js - * ... - * columns: [{ - * type: 'numeric', - * language: 'en-US' - * }] - * ... - * ``` - * - * @type {String} - * @default 'en-US' - */ - language: void 0, - - /** - * @description - * Data source for [select](http://docs.handsontable.com/demo-select.html)-typed cells. - * - * @example - * ```js - * ... - * columns: [{ - * editor: 'select', - * selectOptions: ['A', 'B', 'C'], - * }] - * ... - * ``` - * - * @type {Array} - */ - selectOptions: void 0, - - /** - * Enables or disables the autoColumnSize plugin. Default value is `undefined`, which has the same effect as `true`. - * Disabling this plugin can increase performance, as no size-related calculations would be done. - * - * Column width calculations are divided into sync and async part. Each of this parts has their own advantages and - * disadvantages. Synchronous calculations are faster but they block the browser UI, while the slower asynchronous operations don't - * block the browser UI. - * - * To configure the sync/async distribution, you can pass an absolute value (number of columns) or a percentage value. - * `syncLimit` option is available since 0.16.0. - * - * You can also use the `useHeaders` option to take the column headers with into calculation. - * - * @example - * ```js - * ... - * // as a number (300 columns in sync, rest async) - * autoColumnSize: {syncLimit: 300}, - * ... - * - * ... - * // as a string (percent) - * autoColumnSize: {syncLimit: '40%'}, - * ... - * - * ... - * // use headers width while calculation the column width - * autoColumnSize: {useHeaders: true}, - * ... - * - * ``` - * - * @type {Object|Boolean} - * @default {syncLimit: 50} - */ - autoColumnSize: void 0, - - /** - * Enables or disables autoRowSize plugin. Default value is `undefined`, which has the same effect as `false` (disabled). - * Enabling this plugin can decrease performance, as size-related calculations would be performed. - * - * Row height calculations are divided into sync and async stages. Each of these stages has their own advantages and - * disadvantages. Synchronous calculations are faster but they block the browser UI, while the slower asynchronous operations don't - * block the browser UI. - * - * To configure the sync/async distribution, you can pass an absolute value (number of columns) or a percentage value. - * `syncLimit` options is available since 0.16.0. - * - * @example - * ```js - * ... - * // as number (300 columns in sync, rest async) - * autoRowSize: {syncLimit: 300}, - * ... - * - * ... - * // as string (percent) - * autoRowSize: {syncLimit: '40%'}, - * ... - * ``` - * @type {Object|Boolean} - * @default {syncLimit: 1000} - */ - autoRowSize: void 0, - - /** - * Date validation format. - * - * Option desired for `'date'` - typed cells. - * - * @example - * ```js - * ... - * columns: [{ - * type: 'date', - * dateFormat: 'MM/DD/YYYY' - * }] - * ... - * ``` - * - * @type {String} - * @default 'DD/MM/YYYY' - */ - dateFormat: void 0, - - /** - * If `true` then dates will be automatically formatted to match the desired format. - * - * Option desired for `'date'`-typed typed cells. - * - * @example - * ```js - * ... - * columns: [{ - * type: 'date', - * dateFormat: 'YYYY-MM-DD', - * correctFormat: true - * }] - * ... - * ``` - * - * @type {Boolean} - * @default false - */ - correctFormat: false, - - /** - * Definition of default value which will fill the empty cells. - * - * Option desired for `'date'`-typed cells. - * - * @example - * ```js - * ... - * columns: [{ - * type: 'date', - * defaultData: '2015-02-02' - * }] - * ... - * ``` - * - * @type {String} - */ - defaultDate: void 0, - - /** - * If set to `true`, the value entered into the cell must match (case-sensitive) the autocomplete source. Otherwise, cell won't pass the validation. - * When filtering the autocomplete source list, the editor will be working in case-insensitive mode. - * - * Option desired for `autocomplete`-typed cells. - * - * @example - * ```js - * ... - * columns: [{ - * type: 'autocomplete', - * source: ['A', 'B', 'C'], - * strict: true - * }] - * ... - * ``` - * - * @type {Boolean} - */ - strict: void 0, - - /** - * @description - * If typed `true`, data defined in `source` of the autocomplete or dropdown cell will be treated as HTML. - * - * __Warning:__ Enabling this option can cause serious XSS vulnerabilities. - * - * Option desired for `'autocomplete'`-typed cells. - * @example - * ```js - * ... - * columns: [{ - * type: 'autocomplete', - * allowHtml: true, - * source: ['foo', 'bar'] - * }] - * ... - * ``` - * @type {Boolean} - * @default false - */ - allowHtml: false, - - /** - * If typed `true` then virtual rendering mechanism for handsontable will be disabled. - * - * @type {Boolean} - */ - renderAllRows: void 0, - - /** - * Prevents table to overlap outside the parent element. If `'horizontal'` option is chosen then table will appear horizontal - * scrollbar in case where parent's width is narrower then table's width. - * - * Possible values: - * * `false` - Disables functionality (Default option). - * * `horizontal` - Prevents horizontal overflow table. - * * `vertical` - Prevents vertical overflow table (Not implemented yet). - * - * @since 0.20.3 - * @example - * ```js - * ... - * preventOverflow: 'horizontal' - * ... - * ``` - * - * @type {String|Boolean} - */ - preventOverflow: false, - - /** - * @description - * Plugin allowing binding the table rows with their headers. - * If the plugin is enabled, the table row headers will "stick" to the rows, when they are hidden/moved. Basically, if at the initialization - * row 0 has a header titled "A", it will have it no matter what you do with the table. - * - * @pro - * @since 1.0.0-beta1 - * @type {Boolean|String} - * @example - * - * ```js - * ... - * var hot = new Handsontable(document.getElementById('example'), { - * date: getData(), - * bindRowsWithHeaders: true - * }); - * ... - * ``` - * - */ - bindRowsWithHeaders: void 0, - - /** - * @description - * The CollapsibleColumns plugin allows collapsing of columns, covered by a header with the `colspan` property defined. - * - * Clicking the "collapse/expand" button collapses (or expands) all "child" headers except the first one. - * - * Setting the `collapsibleColumns` property to `true` will display a "collapse/expand" button in every header with a defined - * `colspan` property. - * - * To limit this functionality to a smaller group of headers, define the `collapsibleColumns` property as an array of objects, as in - * the example below. - * - * @pro - * @since 1.0.0-beta1 - * @type {Boolean|Array} - * @example - * ```js - * ... - * collapsibleColumns: [ - * {row: -4, col: 1, collapsible: true}, - * {row: -3, col: 5, collapsible: true} - * ] - * ... - * // or - * ... - * collapsibleColumns: true - * ... - * ``` - */ - collapsibleColumns: void 0, - - /** - * @description - * Allows making pre-defined calculations on the cell values and display the results within Handsontable. - * See the demo for more information. - * - * @pro - * @since 1.0.0-beta1 - * @type {Object} - */ - columnSummary: void 0, - - /** - * This plugin allows adding a configurable dropdown menu to the table's column headers. - * The dropdown menu acts like the Context Menu, but is triggered by clicking the button in the header. - * - * @pro - * @since 1.0.0-beta1 - * @type {Boolean|Object|Array} - */ - dropdownMenu: void 0, - - /** - * The filters plugin. - * It allows filtering the table data either by the built-in component or with the API. - * - * @pro - * @since 1.0.0-beta1 - * @type {Boolean} - */ - filters: void 0, - - /** - * It allows Handsontable to process formula expressions defined in the provided data. - * - * @pro - * @since 1.7.0 - * @type {Boolean} - */ - formulas: void 0, - - /** - * @description - * GanttChart plugin enables a possibility to create a Gantt chart using a Handsontable instance. - * In this case, the whole table becomes read-only. - * - * @pro - * @since 1.0.0-beta1 - * @type {Object} - */ - ganttChart: void 0, - - /** - * @description - * Allows adding a tooltip to the table headers. - * - * Available options: - * * the `rows` property defines if tooltips should be added to row headers, - * * the `columns` property defines if tooltips should be added to column headers, - * * the `onlyTrimmed` property defines if tooltips should be added only to headers, which content is trimmed by the header itself (the content being wider then the header). - * - * @pro - * @since 1.0.0-beta1 - * @type {Boolean|Object} - */ - headerTooltips: void 0, - - /** - * Plugin allowing hiding of certain columns. - * - * @pro - * @since 1.0.0-beta1 - * @type {Boolean|Object} - */ - hiddenColumns: void 0, - - /** - * @description - * Plugin allowing hiding of certain rows. - * - * @pro - * @since 1.0.0-beta1 - * @type {Boolean|Object} - */ - hiddenRows: void 0, - - /** - * @description - * Allows creating a nested header structure, using the HTML's colspan attribute. - * - * @pro - * @since 1.0.0-beta1 - * @type {Array} - */ - nestedHeaders: void 0, - - /** - * @description - * Plugin allowing hiding of certain rows. - * - * @pro - * @since 1.0.0-beta1 - * @type {Boolean|Array} - */ - trimRows: void 0, - - /** - * @description - * Allows setting a custom width of the row headers. You can provide a number or an array of widths, if many row header levels are defined. - * - * @since 0.22.0 - * @type {Number|Array} - */ - rowHeaderWidth: void 0, - - /** - * @description - * Allows setting a custom height of the column headers. You can provide a number or an array of heights, if many column header levels are defined. - * - * @since 0.22.0 - * @type {Number|Array} - */ - columnHeaderHeight: void 0, - - /** - * @description - * Enabling this plugin switches table into one-way data binding where changes are applied into data source (from outside table) - * will be automatically reflected in the table. - * - * For every data change [afterChangesObserved](Hooks.html#event:afterChangesObserved) hook will be fired. - * - * @type {Boolean} - * @default false - */ - observeChanges: void 0, - - /** - * @description - * When passed to the `column` property, allows specifying a custom sorting function for the desired column. - * - * @since 0.24.0 - * @type {Function} - * @example - * ```js - * columns: [ - * { - * sortFunction: function(sortOrder) { - * return function(a, b) { - * // sorting function body. - * // - * // Function parameters: - * // sortOrder: If true, the order is ascending, if false - descending. undefined = original order - * // a, b: Two compared elements. These are 2-element arrays, with the first element being the row index, the second - cell value. - * } - * } - * } - * ] - * ``` - */ - sortFunction: void 0, - - /** - * If defined as 'true', the Autocomplete's suggestion list would be sorted by relevance (the closer to the left the match is, the higher the suggestion). - * - * Option desired for cells of the `'autocomplete'` type. - * - * @type {Boolean} - * @default true - */ - sortByRelevance: true, - - /** - * If defined as 'true', when the user types into the input area the Autocomplete's suggestion list is updated to only - * include those choices starting with what has been typed; if defined as 'false' all suggestions remain shown, with - * those matching what has been typed marked in bold. - * - * @type {Boolean} - * @default true - */ - filter: true, - - /** - * If defined as 'true', filtering in the Autocomplete Editor will be case-sensitive. - * - * @type {Boolean} - * @default: false - */ - filteringCaseSensitive: false -}; - -exports.default = DefaultSettings; - -/***/ }), -/* 89 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; -exports.getNormalizedDate = getNormalizedDate; -/* eslint-disable import/prefer-default-export */ - -/** - * Get normalized Date object for the ISO formatted date strings. - * Natively, the date object parsed from a ISO 8601 string will be offsetted by the timezone difference, which may result in returning a wrong date. - * See: Github issue #3338. - * - * @param {String} dateString String representing the date. - * @returns {Date} The proper Date object. - */ -function getNormalizedDate(dateString) { - var nativeDate = new Date(dateString); - - // NaN if dateString is not in ISO format - if (!isNaN(new Date(dateString + "T00:00").getDate())) { - - // Compensate timezone offset - return new Date(nativeDate.getTime() + nativeDate.getTimezoneOffset() * 60000); - } - - return nativeDate; -} - -/***/ }), -/* 90 */ -/***/ (function(module, exports, __webpack_require__) { - -// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) -var $export = __webpack_require__(3); - -$export($export.P, 'Array', {copyWithin: __webpack_require__(392)}); - -__webpack_require__(38)('copyWithin'); - -/***/ }), -/* 91 */ -/***/ (function(module, exports, __webpack_require__) { - -// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) -var $export = __webpack_require__(3); - -$export($export.P, 'Array', {fill: __webpack_require__(393)}); - -__webpack_require__(38)('fill'); - -/***/ }), -/* 92 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) -var $export = __webpack_require__(3) - , $find = __webpack_require__(54)(6) - , KEY = 'findIndex' - , forced = true; -// Shouldn't skip holes -if(KEY in [])Array(1)[KEY](function(){ forced = false; }); -$export($export.P + $export.F * forced, 'Array', { - findIndex: function findIndex(callbackfn/*, that = undefined */){ - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); -__webpack_require__(38)(KEY); - -/***/ }), -/* 93 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) -var $export = __webpack_require__(3) - , $find = __webpack_require__(54)(5) - , KEY = 'find' - , forced = true; -// Shouldn't skip holes -if(KEY in [])Array(1)[KEY](function(){ forced = false; }); -$export($export.P + $export.F * forced, 'Array', { - find: function find(callbackfn/*, that = undefined */){ - return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } -}); -__webpack_require__(38)(KEY); - -/***/ }), -/* 94 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var ctx = __webpack_require__(29) - , $export = __webpack_require__(3) - , toObject = __webpack_require__(42) - , call = __webpack_require__(280) - , isArrayIter = __webpack_require__(276) - , toLength = __webpack_require__(24) - , createProperty = __webpack_require__(74) - , getIterFn = __webpack_require__(291); - -$export($export.S + $export.F * !__webpack_require__(79)(function(iter){ Array.from(iter); }), 'Array', { - // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) - from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ - var O = toObject(arrayLike) - , C = typeof this == 'function' ? this : Array - , aLen = arguments.length - , mapfn = aLen > 1 ? arguments[1] : undefined - , mapping = mapfn !== undefined - , index = 0 - , iterFn = getIterFn(O) - , length, result, step, iterator; - if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); - // if object isn't iterable or it's array with default iterator - use simple case - if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ - for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ - createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); - } - } else { - length = toLength(O.length); - for(result = new C(length); length > index; index++){ - createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); - } - } - result.length = index; - return result; - } -}); - - -/***/ }), -/* 95 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var $export = __webpack_require__(3) - , createProperty = __webpack_require__(74); - -// WebKit Array.of isn't generic -$export($export.S + $export.F * __webpack_require__(31)(function(){ - function F(){} - return !(Array.of.call(F) instanceof F); -}), 'Array', { - // 22.1.2.3 Array.of( ...items) - of: function of(/* ...args */){ - var index = 0 - , aLen = arguments.length - , result = new (typeof this == 'function' ? this : Array)(aLen); - while(aLen > index)createProperty(result, index, arguments[index++]); - result.length = aLen; - return result; - } -}); - -/***/ }), -/* 96 */ -/***/ (function(module, exports, __webpack_require__) { - -var dP = __webpack_require__(19).f - , createDesc = __webpack_require__(41) - , has = __webpack_require__(22) - , FProto = Function.prototype - , nameRE = /^\s*function ([^ (]*)/ - , NAME = 'name'; - -var isExtensible = Object.isExtensible || function(){ - return true; -}; - -// 19.2.4.2 name -NAME in FProto || __webpack_require__(21) && dP(FProto, NAME, { - configurable: true, - get: function(){ - try { - var that = this - , name = ('' + that).match(nameRE)[1]; - has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name)); - return name; - } catch(e){ - return ''; - } - } -}); - -/***/ }), -/* 97 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var strong = __webpack_require__(272); - -// 23.1 Map Objects -module.exports = __webpack_require__(55)('Map', function(get){ - return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; -}, { - // 23.1.3.6 Map.prototype.get(key) - get: function get(key){ - var entry = strong.getEntry(this, key); - return entry && entry.v; - }, - // 23.1.3.9 Map.prototype.set(key, value) - set: function set(key, value){ - return strong.def(this, key === 0 ? 0 : key, value); - } -}, strong, true); - -/***/ }), -/* 98 */ -/***/ (function(module, exports, __webpack_require__) { - -// 20.1.2.1 Number.EPSILON -var $export = __webpack_require__(3); - -$export($export.S, 'Number', {EPSILON: Math.pow(2, -52)}); - -/***/ }), -/* 99 */ -/***/ (function(module, exports, __webpack_require__) { - -// 20.1.2.2 Number.isFinite(number) -var $export = __webpack_require__(3) - , _isFinite = __webpack_require__(13).isFinite; - -$export($export.S, 'Number', { - isFinite: function isFinite(it){ - return typeof it == 'number' && _isFinite(it); - } -}); - -/***/ }), -/* 100 */ -/***/ (function(module, exports, __webpack_require__) { - -// 20.1.2.3 Number.isInteger(number) -var $export = __webpack_require__(3); - -$export($export.S, 'Number', {isInteger: __webpack_require__(278)}); - -/***/ }), -/* 101 */ -/***/ (function(module, exports, __webpack_require__) { - -// 20.1.2.4 Number.isNaN(number) -var $export = __webpack_require__(3); - -$export($export.S, 'Number', { - isNaN: function isNaN(number){ - return number != number; - } -}); - -/***/ }), -/* 102 */ -/***/ (function(module, exports, __webpack_require__) { - -// 20.1.2.5 Number.isSafeInteger(number) -var $export = __webpack_require__(3) - , isInteger = __webpack_require__(278) - , abs = Math.abs; - -$export($export.S, 'Number', { - isSafeInteger: function isSafeInteger(number){ - return isInteger(number) && abs(number) <= 0x1fffffffffffff; - } -}); - -/***/ }), -/* 103 */ -/***/ (function(module, exports, __webpack_require__) { - -// 20.1.2.6 Number.MAX_SAFE_INTEGER -var $export = __webpack_require__(3); - -$export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff}); - -/***/ }), -/* 104 */ -/***/ (function(module, exports, __webpack_require__) { - -// 20.1.2.10 Number.MIN_SAFE_INTEGER -var $export = __webpack_require__(3); - -$export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff}); - -/***/ }), -/* 105 */ -/***/ (function(module, exports, __webpack_require__) { - -// 19.1.3.1 Object.assign(target, source) -var $export = __webpack_require__(3); - -$export($export.S + $export.F, 'Object', {assign: __webpack_require__(283)}); - -/***/ }), -/* 106 */ -/***/ (function(module, exports, __webpack_require__) { - -// 19.1.3.10 Object.is(value1, value2) -var $export = __webpack_require__(3); -$export($export.S, 'Object', {is: __webpack_require__(407)}); - -/***/ }), -/* 107 */ -/***/ (function(module, exports, __webpack_require__) { - -// 19.1.3.19 Object.setPrototypeOf(O, proto) -var $export = __webpack_require__(3); -$export($export.S, 'Object', {setPrototypeOf: __webpack_require__(286).set}); - -/***/ }), -/* 108 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var LIBRARY = __webpack_require__(58) - , global = __webpack_require__(13) - , ctx = __webpack_require__(29) - , classof = __webpack_require__(271) - , $export = __webpack_require__(3) - , isObject = __webpack_require__(15) - , aFunction = __webpack_require__(73) - , anInstance = __webpack_require__(53) - , forOf = __webpack_require__(57) - , speciesConstructor = __webpack_require__(408) - , task = __webpack_require__(86).set - , microtask = __webpack_require__(402)() - , PROMISE = 'Promise' - , TypeError = global.TypeError - , process = global.process - , $Promise = global[PROMISE] - , process = global.process - , isNode = classof(process) == 'process' - , empty = function(){ /* empty */ } - , Internal, GenericPromiseCapability, Wrapper; - -var USE_NATIVE = !!function(){ - try { - // correct subclassing with @@species support - var promise = $Promise.resolve(1) - , FakePromise = (promise.constructor = {})[__webpack_require__(10)('species')] = function(exec){ exec(empty, empty); }; - // unhandled rejections tracking support, NodeJS Promise without it fails @@species test - return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; - } catch(e){ /* empty */ } -}(); - -// helpers -var sameConstructor = function(a, b){ - // with library wrapper special case - return a === b || a === $Promise && b === Wrapper; -}; -var isThenable = function(it){ - var then; - return isObject(it) && typeof (then = it.then) == 'function' ? then : false; -}; -var newPromiseCapability = function(C){ - return sameConstructor($Promise, C) - ? new PromiseCapability(C) - : new GenericPromiseCapability(C); -}; -var PromiseCapability = GenericPromiseCapability = function(C){ - var resolve, reject; - this.promise = new C(function($$resolve, $$reject){ - if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor'); - resolve = $$resolve; - reject = $$reject; - }); - this.resolve = aFunction(resolve); - this.reject = aFunction(reject); -}; -var perform = function(exec){ - try { - exec(); - } catch(e){ - return {error: e}; - } -}; -var notify = function(promise, isReject){ - if(promise._n)return; - promise._n = true; - var chain = promise._c; - microtask(function(){ - var value = promise._v - , ok = promise._s == 1 - , i = 0; - var run = function(reaction){ - var handler = ok ? reaction.ok : reaction.fail - , resolve = reaction.resolve - , reject = reaction.reject - , domain = reaction.domain - , result, then; - try { - if(handler){ - if(!ok){ - if(promise._h == 2)onHandleUnhandled(promise); - promise._h = 1; - } - if(handler === true)result = value; - else { - if(domain)domain.enter(); - result = handler(value); - if(domain)domain.exit(); - } - if(result === reaction.promise){ - reject(TypeError('Promise-chain cycle')); - } else if(then = isThenable(result)){ - then.call(result, resolve, reject); - } else resolve(result); - } else reject(value); - } catch(e){ - reject(e); - } - }; - while(chain.length > i)run(chain[i++]); // variable length - can't use forEach - promise._c = []; - promise._n = false; - if(isReject && !promise._h)onUnhandled(promise); - }); -}; -var onUnhandled = function(promise){ - task.call(global, function(){ - var value = promise._v - , abrupt, handler, console; - if(isUnhandled(promise)){ - abrupt = perform(function(){ - if(isNode){ - process.emit('unhandledRejection', value, promise); - } else if(handler = global.onunhandledrejection){ - handler({promise: promise, reason: value}); - } else if((console = global.console) && console.error){ - console.error('Unhandled promise rejection', value); - } - }); - // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should - promise._h = isNode || isUnhandled(promise) ? 2 : 1; - } promise._a = undefined; - if(abrupt)throw abrupt.error; - }); -}; -var isUnhandled = function(promise){ - if(promise._h == 1)return false; - var chain = promise._a || promise._c - , i = 0 - , reaction; - while(chain.length > i){ - reaction = chain[i++]; - if(reaction.fail || !isUnhandled(reaction.promise))return false; - } return true; -}; -var onHandleUnhandled = function(promise){ - task.call(global, function(){ - var handler; - if(isNode){ - process.emit('rejectionHandled', promise); - } else if(handler = global.onrejectionhandled){ - handler({promise: promise, reason: promise._v}); - } - }); -}; -var $reject = function(value){ - var promise = this; - if(promise._d)return; - promise._d = true; - promise = promise._w || promise; // unwrap - promise._v = value; - promise._s = 2; - if(!promise._a)promise._a = promise._c.slice(); - notify(promise, true); -}; -var $resolve = function(value){ - var promise = this - , then; - if(promise._d)return; - promise._d = true; - promise = promise._w || promise; // unwrap - try { - if(promise === value)throw TypeError("Promise can't be resolved itself"); - if(then = isThenable(value)){ - microtask(function(){ - var wrapper = {_w: promise, _d: false}; // wrap - try { - then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); - } catch(e){ - $reject.call(wrapper, e); - } - }); - } else { - promise._v = value; - promise._s = 1; - notify(promise, false); - } - } catch(e){ - $reject.call({_w: promise, _d: false}, e); // wrap - } -}; - -// constructor polyfill -if(!USE_NATIVE){ - // 25.4.3.1 Promise(executor) - $Promise = function Promise(executor){ - anInstance(this, $Promise, PROMISE, '_h'); - aFunction(executor); - Internal.call(this); - try { - executor(ctx($resolve, this, 1), ctx($reject, this, 1)); - } catch(err){ - $reject.call(this, err); - } - }; - Internal = function Promise(executor){ - this._c = []; // <- awaiting reactions - this._a = undefined; // <- checked in isUnhandled reactions - this._s = 0; // <- state - this._d = false; // <- done - this._v = undefined; // <- value - this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled - this._n = false; // <- notify - }; - Internal.prototype = __webpack_require__(60)($Promise.prototype, { - // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) - then: function then(onFulfilled, onRejected){ - var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); - reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; - reaction.fail = typeof onRejected == 'function' && onRejected; - reaction.domain = isNode ? process.domain : undefined; - this._c.push(reaction); - if(this._a)this._a.push(reaction); - if(this._s)notify(this, false); - return reaction.promise; - }, - // 25.4.5.1 Promise.prototype.catch(onRejected) - 'catch': function(onRejected){ - return this.then(undefined, onRejected); - } - }); - PromiseCapability = function(){ - var promise = new Internal; - this.promise = promise; - this.resolve = ctx($resolve, promise, 1); - this.reject = ctx($reject, promise, 1); - }; -} - -$export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise}); -__webpack_require__(49)($Promise, PROMISE); -__webpack_require__(287)(PROMISE); -Wrapper = __webpack_require__(45)[PROMISE]; - -// statics -$export($export.S + $export.F * !USE_NATIVE, PROMISE, { - // 25.4.4.5 Promise.reject(r) - reject: function reject(r){ - var capability = newPromiseCapability(this) - , $$reject = capability.reject; - $$reject(r); - return capability.promise; - } -}); -$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { - // 25.4.4.6 Promise.resolve(x) - resolve: function resolve(x){ - // instanceof instead of internal slot check because we should fix it without replacement native Promise core - if(x instanceof $Promise && sameConstructor(x.constructor, this))return x; - var capability = newPromiseCapability(this) - , $$resolve = capability.resolve; - $$resolve(x); - return capability.promise; - } -}); -$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(79)(function(iter){ - $Promise.all(iter)['catch'](empty); -})), PROMISE, { - // 25.4.4.1 Promise.all(iterable) - all: function all(iterable){ - var C = this - , capability = newPromiseCapability(C) - , resolve = capability.resolve - , reject = capability.reject; - var abrupt = perform(function(){ - var values = [] - , index = 0 - , remaining = 1; - forOf(iterable, false, function(promise){ - var $index = index++ - , alreadyCalled = false; - values.push(undefined); - remaining++; - C.resolve(promise).then(function(value){ - if(alreadyCalled)return; - alreadyCalled = true; - values[$index] = value; - --remaining || resolve(values); - }, reject); - }); - --remaining || resolve(values); - }); - if(abrupt)reject(abrupt.error); - return capability.promise; - }, - // 25.4.4.4 Promise.race(iterable) - race: function race(iterable){ - var C = this - , capability = newPromiseCapability(C) - , reject = capability.reject; - var abrupt = perform(function(){ - forOf(iterable, false, function(promise){ - C.resolve(promise).then(capability.resolve, reject); - }); - }); - if(abrupt)reject(abrupt.error); - return capability.promise; - } -}); - -/***/ }), -/* 109 */ -/***/ (function(module, exports, __webpack_require__) { - -// 21.2.5.3 get RegExp.prototype.flags() -if(__webpack_require__(21) && /./g.flags != 'g')__webpack_require__(19).f(RegExp.prototype, 'flags', { - configurable: true, - get: __webpack_require__(397) -}); - -/***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { - -// @@match logic -__webpack_require__(56)('match', 1, function(defined, MATCH, $match){ - // 21.1.3.11 String.prototype.match(regexp) - return [function match(regexp){ - 'use strict'; - var O = defined(this) - , fn = regexp == undefined ? undefined : regexp[MATCH]; - return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); - }, $match]; -}); - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -// @@replace logic -__webpack_require__(56)('replace', 2, function(defined, REPLACE, $replace){ - // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) - return [function replace(searchValue, replaceValue){ - 'use strict'; - var O = defined(this) - , fn = searchValue == undefined ? undefined : searchValue[REPLACE]; - return fn !== undefined - ? fn.call(searchValue, O, replaceValue) - : $replace.call(String(O), searchValue, replaceValue); - }, $replace]; -}); - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -// @@search logic -__webpack_require__(56)('search', 1, function(defined, SEARCH, $search){ - // 21.1.3.15 String.prototype.search(regexp) - return [function search(regexp){ - 'use strict'; - var O = defined(this) - , fn = regexp == undefined ? undefined : regexp[SEARCH]; - return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); - }, $search]; -}); - -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { - -// @@split logic -__webpack_require__(56)('split', 2, function(defined, SPLIT, $split){ - 'use strict'; - var isRegExp = __webpack_require__(279) - , _split = $split - , $push = [].push - , $SPLIT = 'split' - , LENGTH = 'length' - , LAST_INDEX = 'lastIndex'; - if( - 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || - 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || - 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || - '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || - '.'[$SPLIT](/()()/)[LENGTH] > 1 || - ''[$SPLIT](/.?/)[LENGTH] - ){ - var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group - // based on es5-shim implementation, need to rework it - $split = function(separator, limit){ - var string = String(this); - if(separator === undefined && limit === 0)return []; - // If `separator` is not a regex, use native split - if(!isRegExp(separator))return _split.call(string, separator, limit); - var output = []; - var flags = (separator.ignoreCase ? 'i' : '') + - (separator.multiline ? 'm' : '') + - (separator.unicode ? 'u' : '') + - (separator.sticky ? 'y' : ''); - var lastLastIndex = 0; - var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; - // Make `global` and avoid `lastIndex` issues by working with a copy - var separatorCopy = new RegExp(separator.source, flags + 'g'); - var separator2, match, lastIndex, lastLength, i; - // Doesn't need flags gy, but they don't hurt - if(!NPCG)separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); - while(match = separatorCopy.exec(string)){ - // `separatorCopy.lastIndex` is not reliable cross-browser - lastIndex = match.index + match[0][LENGTH]; - if(lastIndex > lastLastIndex){ - output.push(string.slice(lastLastIndex, match.index)); - // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG - if(!NPCG && match[LENGTH] > 1)match[0].replace(separator2, function(){ - for(i = 1; i < arguments[LENGTH] - 2; i++)if(arguments[i] === undefined)match[i] = undefined; - }); - if(match[LENGTH] > 1 && match.index < string[LENGTH])$push.apply(output, match.slice(1)); - lastLength = match[0][LENGTH]; - lastLastIndex = lastIndex; - if(output[LENGTH] >= splitLimit)break; - } - if(separatorCopy[LAST_INDEX] === match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop - } - if(lastLastIndex === string[LENGTH]){ - if(lastLength || !separatorCopy.test(''))output.push(''); - } else output.push(string.slice(lastLastIndex)); - return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; - }; - // Chakra, V8 - } else if('0'[$SPLIT](undefined, 0)[LENGTH]){ - $split = function(separator, limit){ - return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); - }; - } - // 21.1.3.17 String.prototype.split(separator, limit) - return [function split(separator, limit){ - var O = defined(this) - , fn = separator == undefined ? undefined : separator[SPLIT]; - return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); - }, $split]; -}); - -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var strong = __webpack_require__(272); - -// 23.2 Set Objects -module.exports = __webpack_require__(55)('Set', function(get){ - return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; -}, { - // 23.2.3.1 Set.prototype.add(value) - add: function add(value){ - return strong.def(this, value = value === 0 ? 0 : value, value); - } -}, strong); - -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var $export = __webpack_require__(3) - , $at = __webpack_require__(409)(false); -$export($export.P, 'String', { - // 21.1.3.3 String.prototype.codePointAt(pos) - codePointAt: function codePointAt(pos){ - return $at(this, pos); - } -}); - -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) - -var $export = __webpack_require__(3) - , toLength = __webpack_require__(24) - , context = __webpack_require__(85) - , ENDS_WITH = 'endsWith' - , $endsWith = ''[ENDS_WITH]; - -$export($export.P + $export.F * __webpack_require__(77)(ENDS_WITH), 'String', { - endsWith: function endsWith(searchString /*, endPosition = @length */){ - var that = context(this, searchString, ENDS_WITH) - , endPosition = arguments.length > 1 ? arguments[1] : undefined - , len = toLength(that.length) - , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len) - , search = String(searchString); - return $endsWith - ? $endsWith.call(that, search, end) - : that.slice(end - search.length, end) === search; - } -}); - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -var $export = __webpack_require__(3) - , toIndex = __webpack_require__(61) - , fromCharCode = String.fromCharCode - , $fromCodePoint = String.fromCodePoint; - -// length should be 1, old FF problem -$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { - // 21.1.2.2 String.fromCodePoint(...codePoints) - fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars - var res = [] - , aLen = arguments.length - , i = 0 - , code; - while(aLen > i){ - code = +arguments[i++]; - if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); - res.push(code < 0x10000 - ? fromCharCode(code) - : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) - ); - } return res.join(''); - } -}); - -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -// 21.1.3.7 String.prototype.includes(searchString, position = 0) - -var $export = __webpack_require__(3) - , context = __webpack_require__(85) - , INCLUDES = 'includes'; - -$export($export.P + $export.F * __webpack_require__(77)(INCLUDES), 'String', { - includes: function includes(searchString /*, position = 0 */){ - return !!~context(this, searchString, INCLUDES) - .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { - -var $export = __webpack_require__(3) - , toIObject = __webpack_require__(23) - , toLength = __webpack_require__(24); - -$export($export.S, 'String', { - // 21.1.2.4 String.raw(callSite, ...substitutions) - raw: function raw(callSite){ - var tpl = toIObject(callSite.raw) - , len = toLength(tpl.length) - , aLen = arguments.length - , res = [] - , i = 0; - while(len > i){ - res.push(String(tpl[i++])); - if(i < aLen)res.push(String(arguments[i])); - } return res.join(''); - } -}); - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -var $export = __webpack_require__(3); - -$export($export.P, 'String', { - // 21.1.3.13 String.prototype.repeat(count) - repeat: __webpack_require__(289) -}); - -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -// 21.1.3.18 String.prototype.startsWith(searchString [, position ]) - -var $export = __webpack_require__(3) - , toLength = __webpack_require__(24) - , context = __webpack_require__(85) - , STARTS_WITH = 'startsWith' - , $startsWith = ''[STARTS_WITH]; - -$export($export.P + $export.F * __webpack_require__(77)(STARTS_WITH), 'String', { - startsWith: function startsWith(searchString /*, position = 0 */){ - var that = context(this, searchString, STARTS_WITH) - , index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)) - , search = String(searchString); - return $startsWith - ? $startsWith.call(that, search, index) - : that.slice(index, index + search.length) === search; - } -}); - -/***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -// ECMAScript 6 symbols shim -var global = __webpack_require__(13) - , has = __webpack_require__(22) - , DESCRIPTORS = __webpack_require__(21) - , $export = __webpack_require__(3) - , redefine = __webpack_require__(33) - , META = __webpack_require__(47).KEY - , $fails = __webpack_require__(31) - , shared = __webpack_require__(84) - , setToStringTag = __webpack_require__(49) - , uid = __webpack_require__(50) - , wks = __webpack_require__(10) - , wksExt = __webpack_require__(290) - , wksDefine = __webpack_require__(410) - , keyOf = __webpack_require__(401) - , enumKeys = __webpack_require__(396) - , isArray = __webpack_require__(277) - , anObject = __webpack_require__(18) - , toIObject = __webpack_require__(23) - , toPrimitive = __webpack_require__(87) - , createDesc = __webpack_require__(41) - , _create = __webpack_require__(80) - , gOPNExt = __webpack_require__(404) - , $GOPD = __webpack_require__(81) - , $DP = __webpack_require__(19) - , $keys = __webpack_require__(40) - , gOPD = $GOPD.f - , dP = $DP.f - , gOPN = gOPNExt.f - , $Symbol = global.Symbol - , $JSON = global.JSON - , _stringify = $JSON && $JSON.stringify - , PROTOTYPE = 'prototype' - , HIDDEN = wks('_hidden') - , TO_PRIMITIVE = wks('toPrimitive') - , isEnum = {}.propertyIsEnumerable - , SymbolRegistry = shared('symbol-registry') - , AllSymbols = shared('symbols') - , OPSymbols = shared('op-symbols') - , ObjectProto = Object[PROTOTYPE] - , USE_NATIVE = typeof $Symbol == 'function' - , QObject = global.QObject; -// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 -var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; - -// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 -var setSymbolDesc = DESCRIPTORS && $fails(function(){ - return _create(dP({}, 'a', { - get: function(){ return dP(this, 'a', {value: 7}).a; } - })).a != 7; -}) ? function(it, key, D){ - var protoDesc = gOPD(ObjectProto, key); - if(protoDesc)delete ObjectProto[key]; - dP(it, key, D); - if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); -} : dP; - -var wrap = function(tag){ - var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); - sym._k = tag; - return sym; -}; - -var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ - return typeof it == 'symbol'; -} : function(it){ - return it instanceof $Symbol; -}; - -var $defineProperty = function defineProperty(it, key, D){ - if(it === ObjectProto)$defineProperty(OPSymbols, key, D); - anObject(it); - key = toPrimitive(key, true); - anObject(D); - if(has(AllSymbols, key)){ - if(!D.enumerable){ - if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); - it[HIDDEN][key] = true; - } else { - if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; - D = _create(D, {enumerable: createDesc(0, false)}); - } return setSymbolDesc(it, key, D); - } return dP(it, key, D); -}; -var $defineProperties = function defineProperties(it, P){ - anObject(it); - var keys = enumKeys(P = toIObject(P)) - , i = 0 - , l = keys.length - , key; - while(l > i)$defineProperty(it, key = keys[i++], P[key]); - return it; -}; -var $create = function create(it, P){ - return P === undefined ? _create(it) : $defineProperties(_create(it), P); -}; -var $propertyIsEnumerable = function propertyIsEnumerable(key){ - var E = isEnum.call(this, key = toPrimitive(key, true)); - if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; - return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; -}; -var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ - it = toIObject(it); - key = toPrimitive(key, true); - if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; - var D = gOPD(it, key); - if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; - return D; -}; -var $getOwnPropertyNames = function getOwnPropertyNames(it){ - var names = gOPN(toIObject(it)) - , result = [] - , i = 0 - , key; - while(names.length > i){ - if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); - } return result; -}; -var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ - var IS_OP = it === ObjectProto - , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) - , result = [] - , i = 0 - , key; - while(names.length > i){ - if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); - } return result; -}; - -// 19.4.1.1 Symbol([description]) -if(!USE_NATIVE){ - $Symbol = function Symbol(){ - if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); - var tag = uid(arguments.length > 0 ? arguments[0] : undefined); - var $set = function(value){ - if(this === ObjectProto)$set.call(OPSymbols, value); - if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; - setSymbolDesc(this, tag, createDesc(1, value)); - }; - if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); - return wrap(tag); - }; - redefine($Symbol[PROTOTYPE], 'toString', function toString(){ - return this._k; - }); - - $GOPD.f = $getOwnPropertyDescriptor; - $DP.f = $defineProperty; - __webpack_require__(82).f = gOPNExt.f = $getOwnPropertyNames; - __webpack_require__(48).f = $propertyIsEnumerable; - __webpack_require__(59).f = $getOwnPropertySymbols; - - if(DESCRIPTORS && !__webpack_require__(58)){ - redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); - } - - wksExt.f = function(name){ - return wrap(wks(name)); - } -} - -$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); - -for(var symbols = ( - // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 - 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' -).split(','), i = 0; symbols.length > i; )wks(symbols[i++]); - -for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]); - -$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { - // 19.4.2.1 Symbol.for(key) - 'for': function(key){ - return has(SymbolRegistry, key += '') - ? SymbolRegistry[key] - : SymbolRegistry[key] = $Symbol(key); - }, - // 19.4.2.5 Symbol.keyFor(sym) - keyFor: function keyFor(key){ - if(isSymbol(key))return keyOf(SymbolRegistry, key); - throw TypeError(key + ' is not a symbol!'); - }, - useSetter: function(){ setter = true; }, - useSimple: function(){ setter = false; } -}); - -$export($export.S + $export.F * !USE_NATIVE, 'Object', { - // 19.1.2.2 Object.create(O [, Properties]) - create: $create, - // 19.1.2.4 Object.defineProperty(O, P, Attributes) - defineProperty: $defineProperty, - // 19.1.2.3 Object.defineProperties(O, Properties) - defineProperties: $defineProperties, - // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) - getOwnPropertyDescriptor: $getOwnPropertyDescriptor, - // 19.1.2.7 Object.getOwnPropertyNames(O) - getOwnPropertyNames: $getOwnPropertyNames, - // 19.1.2.8 Object.getOwnPropertySymbols(O) - getOwnPropertySymbols: $getOwnPropertySymbols -}); - -// 24.3.2 JSON.stringify(value [, replacer [, space]]) -$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){ - var S = $Symbol(); - // MS Edge converts symbol values to JSON as {} - // WebKit converts symbol values to JSON as null - // V8 throws on boxed symbols - return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; -})), 'JSON', { - stringify: function stringify(it){ - if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined - var args = [it] - , i = 1 - , replacer, $replacer; - while(arguments.length > i)args.push(arguments[i++]); - replacer = args[1]; - if(typeof replacer == 'function')$replacer = replacer; - if($replacer || !isArray(replacer))replacer = function(key, value){ - if($replacer)value = $replacer.call(this, key, value); - if(!isSymbol(value))return value; - }; - args[1] = replacer; - return _stringify.apply($JSON, args); - } -}); - -// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) -$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(32)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); -// 19.4.3.5 Symbol.prototype[@@toStringTag] -setToStringTag($Symbol, 'Symbol'); -// 20.2.1.9 Math[@@toStringTag] -setToStringTag(Math, 'Math', true); -// 24.3.3 JSON[@@toStringTag] -setToStringTag(global.JSON, 'JSON', true); - -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var each = __webpack_require__(54)(0) - , redefine = __webpack_require__(33) - , meta = __webpack_require__(47) - , assign = __webpack_require__(283) - , weak = __webpack_require__(273) - , isObject = __webpack_require__(15) - , getWeak = meta.getWeak - , isExtensible = Object.isExtensible - , uncaughtFrozenStore = weak.ufstore - , tmp = {} - , InternalMap; - -var wrapper = function(get){ - return function WeakMap(){ - return get(this, arguments.length > 0 ? arguments[0] : undefined); - }; -}; - -var methods = { - // 23.3.3.3 WeakMap.prototype.get(key) - get: function get(key){ - if(isObject(key)){ - var data = getWeak(key); - if(data === true)return uncaughtFrozenStore(this).get(key); - return data ? data[this._i] : undefined; - } - }, - // 23.3.3.5 WeakMap.prototype.set(key, value) - set: function set(key, value){ - return weak.def(this, key, value); - } -}; - -// 23.3 WeakMap Objects -var $WeakMap = module.exports = __webpack_require__(55)('WeakMap', wrapper, methods, weak, true, true); - -// IE11 WeakMap frozen keys fix -if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){ - InternalMap = weak.getConstructor(wrapper); - assign(InternalMap.prototype, methods); - meta.NEED = true; - each(['delete', 'has', 'get', 'set'], function(key){ - var proto = $WeakMap.prototype - , method = proto[key]; - redefine(proto, key, function(a, b){ - // store frozen objects on internal weakmap shim - if(isObject(a) && !isExtensible(a)){ - if(!this._f)this._f = new InternalMap; - var result = this._f[key](a, b); - return key == 'set' ? this : result; - // store all the rest on native weakmap - } return method.call(this, a, b); - }); - }); -} - -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var weak = __webpack_require__(273); - -// 23.4 WeakSet Objects -__webpack_require__(55)('WeakSet', function(get){ - return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; -}, { - // 23.4.3.1 WeakSet.prototype.add(value) - add: function add(value){ - return weak.def(this, value, true); - } -}, weak, false, true); - -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -// https://github.com/tc39/Array.prototype.includes -var $export = __webpack_require__(3) - , $includes = __webpack_require__(270)(true); - -$export($export.P, 'Array', { - includes: function includes(el /*, fromIndex = 0 */){ - return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); - } -}); - -__webpack_require__(38)('includes'); - -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -// https://github.com/tc39/proposal-object-values-entries -var $export = __webpack_require__(3) - , $entries = __webpack_require__(285)(true); - -$export($export.S, 'Object', { - entries: function entries(it){ - return $entries(it); - } -}); - -/***/ }), -/* 127 */ -/***/ (function(module, exports, __webpack_require__) { - -// https://github.com/tc39/proposal-object-getownpropertydescriptors -var $export = __webpack_require__(3) - , ownKeys = __webpack_require__(406) - , toIObject = __webpack_require__(23) - , gOPD = __webpack_require__(81) - , createProperty = __webpack_require__(74); - -$export($export.S, 'Object', { - getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){ - var O = toIObject(object) - , getDesc = gOPD.f - , keys = ownKeys(O) - , result = {} - , i = 0 - , key; - while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key)); - return result; - } -}); - -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { - -// https://github.com/tc39/proposal-object-values-entries -var $export = __webpack_require__(3) - , $values = __webpack_require__(285)(false); - -$export($export.S, 'Object', { - values: function values(it){ - return $values(it); - } -}); - -/***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -// https://github.com/tc39/proposal-string-pad-start-end -var $export = __webpack_require__(3) - , $pad = __webpack_require__(288); - -$export($export.P, 'String', { - padEnd: function padEnd(maxLength /*, fillString = ' ' */){ - return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); - } -}); - -/***/ }), -/* 130 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -// https://github.com/tc39/proposal-string-pad-start-end -var $export = __webpack_require__(3) - , $pad = __webpack_require__(288); - -$export($export.P, 'String', { - padStart: function padStart(maxLength /*, fillString = ' ' */){ - return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); - } -}); - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { - -var $iterators = __webpack_require__(68) - , redefine = __webpack_require__(33) - , global = __webpack_require__(13) - , hide = __webpack_require__(32) - , Iterators = __webpack_require__(46) - , wks = __webpack_require__(10) - , ITERATOR = wks('iterator') - , TO_STRING_TAG = wks('toStringTag') - , ArrayValues = Iterators.Array; - -for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ - var NAME = collections[i] - , Collection = global[NAME] - , proto = Collection && Collection.prototype - , key; - if(proto){ - if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues); - if(!proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); - Iterators[NAME] = ArrayValues; - for(key in $iterators)if(!proto[key])redefine(proto, key, $iterators[key], true); - } -} - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - -var $export = __webpack_require__(3) - , $task = __webpack_require__(86); -$export($export.G + $export.B, { - setImmediate: $task.set, - clearImmediate: $task.clear -}); - -/***/ }), -/* 133 */ -/***/ (function(module, exports) { - - - -/***/ }), -/* 134 */ -/***/ (function(module, exports) { +/***/ }), +/* 88 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -/***/ }), -/* 135 */ -/***/ (function(module, exports) { +exports.__esModule = true; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +var _mixed = __webpack_require__(20); -/***/ }), -/* 136 */ -/***/ (function(module, exports) { +var _object = __webpack_require__(1); +/** + * @alias Options + * @constructor + * @description + * ## Constructor options + * + * Constructor options are applied using an object literal passed as a second argument to the Handsontable constructor. + * + * ```js + * var hot = new Handsontable(document.getElementById('example1'), { + * data: myArray, + * width: 400, + * height: 300 + * }); + * ``` + * + * --- + * ## Cascading configuration + * + * Handsontable 0.9 and newer is using *Cascading Configuration*, which is a fast way to provide configuration options + * for the entire table, including its columns and particular cells. + * + * Consider the following example: + * ```js + * var hot = new Handsontable(document.getElementById('example'), { + * readOnly: true, + * columns: [ + * {readOnly: false}, + * {}, + * {} + * ], + * cells: function (row, col, prop) { + * var cellProperties = {}; + * + * if (row === 0 && col === 0) { + * cellProperties.readOnly = true; + * } + * + * return cellProperties; + * } + * }); + * ``` + * + * The above notation will result in all TDs being *read only*, except for first column TDs which will be *editable*, except for the TD in top left corner which will still be *read only*. + * + * ### The Cascading Configuration model + * + * ##### 1. Constructor + * + * Configuration options that are provided using first-level `handsontable(container, {option: "value"})` and `updateSettings` method. + * + * ##### 2. Columns + * + * Configuration options that are provided using second-level object `handsontable(container, {columns: {option: "value"}]})` + * + * ##### 3. Cells + * + * Configuration options that are provided using second-level function `handsontable(container, {cells: function: (row, col, prop){ }})` + * + * --- + * ## Architecture performance + * + * The Cascading Configuration model is based on prototypical inheritance. It is much faster and memory efficient compared + * to the previous model that used jQuery extend. See: [http://jsperf.com/extending-settings](http://jsperf.com/extending-settings). + * + * --- + * __Important notice:__ In order for the data separation to work properly, make sure that each instance of Handsontable has a unique `id`. + */ +function DefaultSettings() {}; -/***/ }), -/* 137 */ -/***/ (function(module, exports) { +DefaultSettings.prototype = { + /** + * @description + * Initial data source that will be bound to the data grid __by reference__ (editing data grid alters the data source). + * Can be declared as an Array of Arrays, Array of Objects or a Function. + * + * See [Understanding binding as reference](http://docs.handsontable.com/tutorial-data-binding.html#page-reference). + * + * @type {Array|Function} + * @default undefined + */ + data: void 0, + /** + * @description + * Defines the structure of a new row when data source is an array of objects. + * + * See [data-schema](http://docs.handsontable.com/tutorial-data-sources.html#page-data-schema) for examples. + * + * @type {Object} + * @default undefined + */ + dataSchema: void 0, + /** + * Width of the grid. Can be a value or a function that returns a value. + * + * @type {Number|Function} + * @default undefined + */ + width: void 0, -/***/ }), -/* 138 */ -/***/ (function(module, exports) { + /** + * Height of the grid. Can be a number or a function that returns a number. + * + * @type {Number|Function} + * @default undefined + */ + height: void 0, + /** + * @description + * Initial number of rows. + * + * __Notice:__ This option only has effect in Handsontable constructor and only if `data` option is not provided + * + * @type {Number} + * @default 5 + */ + startRows: 5, + /** + * @description + * Initial number of columns. + * + * __Notice:__ This option only has effect in Handsontable constructor and only if `data` option is not provided + * + * @type {Number} + * @default 5 + */ + startCols: 5, -/***/ }), -/* 139 */ -/***/ (function(module, exports) { + /** + * Setting `true` or `false` will enable or disable the default row headers (1, 2, 3). + * You can also define an array `['One', 'Two', 'Three', ...]` or a function to define the headers. + * If a function is set the index of the row is passed as a parameter. + * + * @type {Boolean|Array|Function} + * @default null + * @example + * ```js + * ... + * // as boolean + * rowHeaders: true, + * ... + * + * ... + * // as array + * rowHeaders: [1, 2, 3], + * ... + * + * ... + * // as function + * rowHeaders: function(index) { + * return index + ': AB'; + * }, + * ... + * ``` + */ + rowHeaders: void 0, + /** + * Setting `true` or `false` will enable or disable the default column headers (A, B, C). + * You can also define an array `['One', 'Two', 'Three', ...]` or a function to define the headers. + * If a function is set, then the index of the column is passed as a parameter. + * + * @type {Boolean|Array|Function} + * @default null + * @example + * ```js + * ... + * // as boolean + * colHeaders: true, + * ... + * + * ... + * // as array + * colHeaders: ['A', 'B', 'C'], + * ... + * + * ... + * // as function + * colHeaders: function(index) { + * return index + ': AB'; + * }, + * ... + * ``` + */ + colHeaders: null, + /** + * Defines column widths in pixels. Accepts number, string (that will be converted to a number), + * array of numbers (if you want to define column width separately for each column) or a + * function (if you want to set column width dynamically on each render). + * + * @type {Array|Function|Number|String} + * @default undefined + * @example + * ```js + * ... + * // as numeric, for each column. + * colWidths: 100, + * ... + * + * * ... + * // as string, for each column. + * colWidths: '100px', + * ... + * + * ... + * // as array, based on visual indexes. The rest of the columns have a default width. + * colWidths: [100, 120, 90], + * ... + * + * ... + * // as function, based on visual indexes. + * colWidths: function(index) { + * return index * 10; + * }, + * ... + * ``` + */ + colWidths: void 0, -/***/ }), -/* 140 */ -/***/ (function(module, exports) { + /** + * Defines row heights in pixels. Accepts numbers, strings (that will be converted into a number), + * array of numbers (if you want to define row height separately for each row) or a + * function (if you want to set row height dynamically on each render). + * If the ManualRowResize or AutoRowSize plugins are enabled, this is also the minimum height that can be set + * via either of those two plugins. + * Height should be equal or greater than 23px. Table is rendered incorrectly if height is less than 23px. + * + * @type {Array|Function|Number|String} + * @default undefined + * @example + * ```js + * ... + * // as numeric, for each row. + * rowHeights: 100, + * ... + * + * * ... + * // as string, for each row. + * rowHeights: '100px', + * ... + * + * ... + * // as array, based on visual indexes. The rest of the rows have a default height. + * rowHeights: [100, 120, 90], + * ... + * + * ... + * // as function, based on visual indexes. + * rowHeights: function(index) { + * return index * 10; + * }, + * ... + * ``` + */ + rowHeights: void 0, + /** + * @description + * Defines the cell properties and data binding for certain columns. + * + * __Notice:__ Using this option sets a fixed number of columns (options `startCols`, `minCols`, `maxCols` will be ignored). + * + * See [documentation -> datasources.html](http://docs.handsontable.com/tutorial-data-sources.html#page-nested) for examples. + * + * @type {Array|Function} + * @default undefined + * @example + * ```js + * ... + * // as an array of objects. Order of the objects in array is representation of physical indexes. + * columns: [ + * { + * // column options for the first column + * type: 'numeric', + * format: '0,0.00 $' + * }, + * { + * // column options for the second column + * type: 'text', + * readOnly: true + * } + * ], + * ... + * + * // or as function, based on physical indexes + * ... + * columns: function(index) { + * return { + * type: index > 0 ? 'numeric' : 'text', + * readOnly: index < 1 + * } + * } + * ... + * ``` + */ + columns: void 0, + /** + * @description + * Defines the cell properties for given `row`, `col`, `prop` coordinates. + * Any constructor or column option may be overwritten for a particular cell (row/column combination) + * using the `cells` property in the Handsontable constructor. + * + * __Note:__ Parameters `row` and `col` always represent __physical indexes__. Example below show how to execute + * operations based on the __visual__ representation of Handsontable. + * + * Possible values of `prop`: + * - property name for column's data source object, when dataset is an [array of objects](/tutorial-data-sources.html#page-object) + * - the same number as `col`, when dataset is an [array of arrays](/tutorial-data-sources.html#page-array) + * + * @type {Function} + * @default undefined + * @example + * ```js + * ... + * cells: function (row, col, prop) { + * var cellProperties = {}; + * var visualRowIndex = this.instance.toVisualRow(row); + * var visualColIndex = this.instance.toVisualColumn(col); + * + * if (visualRowIndex === 0 && visualColIndex === 0) { + * cellProperties.readOnly = true; + * } + * + * return cellProperties; + * }, + * ... + * ``` + */ + cells: void 0, -/***/ }), -/* 141 */ -/***/ (function(module, exports) { + /** + * Any constructor or column option may be overwritten for a particular cell (row/column combination), using `cell` + * array passed to the Handsontable constructor. + * + * @type {Array} + * @default [] + * @example + * ```js + * ... + * cell: [ + * {row: 0, col: 0, readOnly: true} + * ], + * ... + * ``` + */ + cell: [], + /** + * @description + * If `true`, enables the {@link Comments} plugin, which enables an option to apply cell comments through the context menu + * (configurable with context menu keys `commentsAddEdit`, `commentsRemove`). + * + * To initialize Handsontable with predefined comments, provide cell coordinates and comment text values in a form of an array. + * + * See [Comments](http://docs.handsontable.com/demo-comments_.html) demo for examples. + * + * @since 0.11.0 + * @type {Boolean|Array} + * @default false + * @example + * ```js + * ... + * comments: [{row: 1, col: 1, comment: {value: "Test comment"}}], + * ... + * ``` + */ + comments: false, + /** + * @description + * If `true`, enables the Custom Borders plugin, which enables an option to apply custom borders through the context menu (configurable with context menu key `borders`). + * + * To initialize Handsontable with predefined custom borders, provide cell coordinates and border styles in a form of an array. + * + * See [Custom Borders](http://docs.handsontable.com/demo-custom-borders.html) demo for examples. + * + * @since 0.11.0 + * @type {Boolean|Array} + * @default false + * @example + * ```js + * ... + * customBorders: [ + * {range: { + * from: {row: 1, col: 1}, + * to: {row: 3, col: 4}}, + * left: {}, + * right: {}, + * top: {}, + * bottom: {} + * } + * ], + * ... + * + * // or + * ... + * customBorders: [ + * {row: 2, col: 2, left: {width: 2, color: 'red'}, + * right: {width: 1, color: 'green'}, top: '', bottom: ''} + * ], + * ... + * ``` + */ + customBorders: false, -/***/ }), -/* 142 */ -/***/ (function(module, exports) { + /** + * Minimum number of rows. At least that number of rows will be created during initialization. + * + * @type {Number} + * @default 0 + */ + minRows: 0, + /** + * Minimum number of columns. At least that number of columns will be created during initialization. + * + * @type {Number} + * @default 0 + */ + minCols: 0, + /** + * Maximum number of rows. If set to a value lower than the initial row count, the data will be trimmed to the provided value as the number of rows. + * + * @type {Number} + * @default Infinity + */ + maxRows: Infinity, -/***/ }), -/* 143 */ -/***/ (function(module, exports) { + /** + * Maximum number of cols. If set to a value lower than the initial col count, the data will be trimmed to the provided value as the number of cols. + * + * @type {Number} + * @default Infinity + */ + maxCols: Infinity, + /** + * When set to 1 (or more), Handsontable will add a new row at the end of grid if there are no more empty rows. + * (unless the number of rows exceeds the one set in the `maxRows` property) + * + * @type {Number} + * @default 0 + */ + minSpareRows: 0, + /** + * When set to 1 (or more), Handsontable will add a new column at the end of grid if there are no more empty columns. + * (unless the number of rows exceeds the one set in the `maxCols` property) + * + * @type {Number} + * @default 0 + */ + minSpareCols: 0, -/***/ }), -/* 144 */ -/***/ (function(module, exports) { + /** + * If set to `false`, there won't be an option to insert new rows in the Context Menu. + * + * @type {Boolean} + * @default true + */ + allowInsertRow: true, + /** + * If set to `false`, there won't be an option to insert new columns in the Context Menu. + * + * @type {Boolean} + * @default true + */ + allowInsertColumn: true, + /** + * If set to `false`, there won't be an option to remove rows in the Context Menu. + * + * @type {Boolean} + * @default true + */ + allowRemoveRow: true, -/***/ }), -/* 145 */ -/***/ (function(module, exports) { + /** + * If set to `false`, there won't be an option to remove columns in the Context Menu. + * + * @type {Boolean} + * @default true + */ + allowRemoveColumn: true, + /** + * If true, selection of multiple cells using keyboard or mouse is allowed. + * + * @type {Boolean} + * @default true + */ + multiSelect: true, + /** + * Enables the fill handle (drag-down and copy-down) functionality, which shows a small rectangle in bottom + * right corner of the selected area, that let's you expand values to the adjacent cells. + * + * Possible values: `true` (to enable in all directions), `'vertical'` or `'horizontal'` (to enable in one direction), + * `false` (to disable completely). Setting to `true` enables the fillHandle plugin. + * + * Since 0.23.0 you can pass object to plugin which allows you to add more options for this functionality. If `autoInsertRow` + * option is `true`, fill-handler will create new rows till it reaches the last row. It is enabled by default. + * + * @example + * ```js + * ... + * fillHandle: true // enable plugin in all directions and with autoInsertRow as true + * ... + * // or + * ... + * fillHandle: 'vertical' // enable plugin in vertical direction and with autoInsertRow as true + * ... + * // or + * ... + * fillHandle: { // enable plugin in both directions and with autoInsertRow as false + * autoInsertRow: false, + * } + * // or + * ... + * fillHandle: { // enable plugin in vertical direction and with autoInsertRow as false + * autoInsertRow: false, + * direction: 'vertical' // 'vertical' or 'horizontal' + * } + * ``` + * + * @type {Boolean|String|Object} + * @default true + */ + fillHandle: true, -/***/ }), -/* 146 */ -/***/ (function(module, exports) { + /** + * Allows to specify the number of fixed (or *frozen*) rows at the top of the table. + * + * @type {Number} + * @default 0 + * @example + * ```js + * fixedRowsTop: 3 // This would freeze the top 3 rows of the table. + * ``` + */ + fixedRowsTop: 0, + /** + * Allows to specify the number of fixed (or *frozen*) rows at the bottom of the table. + * + * @pro + * @type {Number} + * @default 0 + * @example + * ```js + * fixedRowsBottom: 3 // This would freeze the top 3 rows of the table. + * ``` + */ + fixedRowsBottom: 0, + /** + * Allows to specify the number of fixed (or *frozen*) columns on the left of the table. + * + * @type {Number} + * @default 0 + * @example + * ```js + * fixedColumnsLeft: 3 // This would freeze the top 3 rows of the table. + * ``` + */ + fixedColumnsLeft: 0, -/***/ }), -/* 147 */ -/***/ (function(module, exports) { + /** + * If `true`, mouse click outside the grid will deselect the current selection. + * Can be a function that takes the click event target and returns a boolean. + * + * @type {Boolean|Function} + * @default true + */ + outsideClickDeselects: true, + /** + * If `true`, ENTER begins editing mode (like in Google Docs). If `false`, ENTER moves to next + * row (like Excel) and adds a new row if necessary. TAB adds new column if necessary. + * + * @type {Boolean} + * @default true + */ + enterBeginsEditing: true, + /** + * Defines the cursor movement after ENTER was pressed (SHIFT + ENTER uses a negative vector). + * Can be an object or a function that returns an object. The event argument passed to the function + * is a DOM Event object received after the ENTER key has been pressed. This event object can be used to check + * whether user pressed ENTER or SHIFT + ENTER. + * + * @type {Object|Function} + * @default {row: 1, col: 0} + */ + enterMoves: { row: 1, col: 0 }, -/***/ }), -/* 148 */ -/***/ (function(module, exports) { + /** + * Defines the cursor movement after TAB is pressed (SHIFT + TAB uses a negative vector). + * Can be an object or a function that returns an object. The event argument passed to the function + * is a DOM Event object received after the TAB key has been pressed. This event object can be used to check + * whether user pressed TAB or SHIFT + TAB. + * + * @type {Object} + * @default {row: 0, col: 1} + */ + tabMoves: { row: 0, col: 1 }, + /** + * If `true`, pressing TAB or right arrow in the last column will move to first column in next row. + * + * @type {Boolean} + * @default false + */ + autoWrapRow: false, + /** + * If `true`, pressing ENTER or down arrow in the last row will move to the first row in the next column. + * + * @type {Boolean} + * @default false + */ + autoWrapCol: false, -/***/ }), -/* 149 */ -/***/ (function(module, exports) { + /** + * @description + * Turns on saving the state of column sorting, column positions and column sizes in local storage. + * + * You can save any sort of data in local storage to preserve table state between page reloads. + * In order to enable data storage mechanism, `persistentState` option must be set to `true` (you can set it + * either during Handsontable initialization or using the `updateSettings` method). When `persistentState` is enabled it exposes 3 hooks: + * + * __persistentStateSave__ (key: String, value: Mixed) + * + * * Saves value under given key in browser local storage. + * + * __persistentStateLoad__ (key: String, valuePlaceholder: Object) + * + * * Loads `value`, saved under given key, form browser local storage. The loaded `value` will be saved in `valuePlaceholder.value` + * (this is due to specific behaviour of `Hooks.run()` method). If no value have been saved under key `valuePlaceholder.value` + * will be `undefined`. + * + * __persistentStateReset__ (key: String) + * + * * Clears the value saved under `key`. If no `key` is given, all values associated with table will be cleared. + * + * __Note:__ The main reason behind using `persistentState` hooks rather than regular LocalStorage API is that it + * ensures separation of data stored by multiple Handsontable instances. In other words, if you have two (or more) + * instances of Handsontable on one page, data saved by one instance won't be accessible by the second instance. + * Those two instances can store data under the same key and no data would be overwritten. + * + * __Important:__ In order for the data separation to work properly, make sure that each instance of Handsontable has a unique `id`. + * + * @type {Boolean} + * @default false + */ + persistentState: void 0, + /** + * Class name for all visible rows in the current selection. + * + * @type {String} + * @default undefined + * @example + * ```js + * currentRowClassName: 'currentRow' // This will add a 'currentRow' class name to appropriate table cells. + * ``` + */ + currentRowClassName: void 0, + /** + * Class name for all visible columns in the current selection. + * + * @type {String} + * @default undefined + * @example + * ```js + * currentColClassName: 'currentColumn' // This will add a 'currentColumn' class name to appropriate table cells. + * ``` + */ + currentColClassName: void 0, -/***/ }), -/* 150 */ -/***/ (function(module, exports) { + /** + * Class name for all visible headers in current selection. + * + * @type {String} + * @since 0.27.0 + * @default 'ht__highlight' + * @example + * ```js + * currentHeaderClassName: 'ht__highlight' // This will add a 'ht__highlight' class name to appropriate table headers. + * ``` + */ + currentHeaderClassName: 'ht__highlight', + /** + * Class name for the Handsontable container element. + * + * @type {String|Array} + * @default undefined + */ + className: void 0, + /** + * Class name for all tables inside container element. + * + * @since 0.17.0 + * @type {String|Array} + * @default undefined + */ + tableClassName: void 0, + /** + * @description + * Defines how the columns react, when the declared table width is different than the calculated sum of all column widths. + * [See more](http://docs.handsontable.com/demo-stretching.html) mode. Possible values: + * * `'none'` Disable stretching + * * `'last'` Stretch only the last column + * * `'all'` Stretch all the columns evenly + * + * @type {String} + * @default 'none' + */ + stretchH: 'none', -/***/ }), -/* 151 */ -/***/ (function(module, exports) { + /** + * Lets you overwrite the default `isEmptyRow` method, which checks if row at the provided index is empty. + * + * @type {Function} + * @param {Number} row Visual row index. + * @returns {Boolean} + */ + isEmptyRow: function isEmptyRow(row) { + var col, colLen, value, meta; + for (col = 0, colLen = this.countCols(); col < colLen; col++) { + value = this.getDataAtCell(row, col); + if (value !== '' && value !== null && (0, _mixed.isDefined)(value)) { + if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') { + meta = this.getCellMeta(row, col); -/***/ }), -/* 152 */ -/***/ (function(module, exports) { + return (0, _object.isObjectEquals)(this.getSchema()[meta.prop], value); + } + return false; + } + } + return true; + }, -/***/ }), -/* 153 */ -/***/ (function(module, exports) { + /** + * Lets you overwrite the default `isEmptyCol` method, which checks if column at the provided index is empty. + * + * @type {Function} + * @param {Number} col Visual column index + * @returns {Boolean} + */ + isEmptyCol: function isEmptyCol(col) { + var row, rowLen, value; + for (row = 0, rowLen = this.countRows(); row < rowLen; row++) { + value = this.getDataAtCell(row, col); + if (value !== '' && value !== null && (0, _mixed.isDefined)(value)) { + return false; + } + } -/***/ }), -/* 154 */ -/***/ (function(module, exports) { + return true; + }, + /** + * When set to `true`, the table is re-rendered when it is detected that it was made visible in DOM. + * + * @type {Boolean} + * @default true + */ + observeDOMVisibility: true, -/***/ }), -/* 155 */ -/***/ (function(module, exports) { + /** + * If set to `true`, Handsontable will accept values that were marked as invalid by the cell `validator`. + * It will result with *invalid* cells being treated as *valid* (will save the *invalid* value into the Handsontable data source). + * If set to `false`, Handsontable will *not* accept the invalid values and won't allow the user to close the editor. + * This option will be particularly useful when used with the Autocomplete's `strict` mode. + * + * @type {Boolean} + * @default true + * @since 0.9.5 + */ + allowInvalid: true, + /** + * If set to `true`, Handsontable will accept values that are empty (`null`, `undefined` or `''`). + * If set to `false`, Handsontable will *not* accept the empty values and mark cell as invalid. + * + * @example + * ```js + * ... + * allowEmpty: true // allow empty values for all cells (whole table) + * ... + * // or + * ... + * columns: [ + * // allow empty values only for 'date' column + * {data: 'date', dateFormat: 'DD/MM/YYYY', allowEmpty: true} + * ] + * ... + * ``` + * + * @type {Boolean} + * @default true + * @since 0.23.0 + */ + allowEmpty: true, + /** + * CSS class name for cells that did not pass validation. + * + * @type {String} + * @default 'htInvalid' + */ + invalidCellClassName: 'htInvalid', -/***/ }), -/* 156 */ -/***/ (function(module, exports) { + /** + * When set to an non-empty string, displayed as the cell content for empty cells. If a value of a different type is provided, + * it will be stringified and applied as a string. + * + * @type {Mixed} + * @default false + */ + placeholder: false, + /** + * CSS class name for cells that have a placeholder in use. + * + * @type {String} + * @default 'htPlaceholder' + */ + placeholderCellClassName: 'htPlaceholder', + /** + * CSS class name for read-only cells. + * + * @type {String} + * @default 'htDimmed' + */ + readOnlyCellClassName: 'htDimmed', -/***/ }), -/* 157 */ -/***/ (function(module, exports) { + /** + * @description + * If a string is provided, it may be one of the following predefined values: + * * `autocomplete`, + * * `checkbox`, + * * `html`, + * * `numeric`, + * * `password`. + * * `text`. + * + * Or you can [register](http://docs.handsontable.com/demo-custom-renderers.html) the custom renderer under specified name and use + * its name as an alias in your configuration. + * + * If a function is provided, it will receive the following arguments: + * ```js + * function(instance, TD, row, col, prop, value, cellProperties) {} + * ``` + * + * You can read more about custom renderes [in the documentation](http://docs.handsontable.com/demo-custom-renderers.html). + * + * @example + * ```js + * ... + * Handsontable.renderers.registerRenderer('my.renderer', function(instance, TD, row, col, prop, value, cellProperties) { + * TD.innerHTML = value; + * }); + * ... + * columns: [ + * { + * editor: 'select', + * renderer: 'autocomplete' // as string + * }, + * { + * renderer: 'my.renderer' // custom renderer as an alias + * }, + * { + * // renderer as custom function + * renderer: function(hotInstance, TD, row, col, prop, value, cellProperties) { + * TD.style.color = 'blue'; + * TD.innerHTML = value; + * } + * } + * ] + * ... + * ``` + * + * @type {String|Function} + * @default undefined + */ + renderer: void 0, + /** + * CSS class name added to the commented cells. + * + * @type {String} + * @default 'htCommentCell' + */ + commentedCellClassName: 'htCommentCell', + /** + * If set to `true`, it enables the browser's native selection of a fragment of the text within a single cell, between adjacent cells or in a whole table. + * If set to `'cell'`, it enables the possibility of selecting a fragment of the text within a single cell's body. + * + * @type {Boolean|String} + * @default false + */ + fragmentSelection: false, -/***/ }), -/* 158 */ -/***/ (function(module, exports) { + /** + * @description + * Make cell [read only](http://docs.handsontable.com/demo-read-only.html). + * + * @type {Boolean} + * @default false + */ + readOnly: false, + /** + * @description + * When added to a `column` property, it skips the column on paste and pastes the data on the next column to the right. + * + * @type {Boolean} + * @default false + */ + skipColumnOnPaste: false, + /** + * @description + * Setting to true enables the search plugin (see [demo](http://docs.handsontable.com/demo-search-for-values.html)). + * + * @type {Boolean} + * @default false + */ + search: false, -/***/ }), -/* 159 */ -/***/ (function(module, exports) { + /** + * @description + * Shortcut to define the combination of the cell renderer, editor and validator for the column, cell or whole table. + * + * Possible values: + * * [autocomplete](http://docs.handsontable.com/demo-autocomplete.html) + * * [checkbox](http://docs.handsontable.com/demo-checkbox.html) + * * [date](http://docs.handsontable.com/demo-date.html) + * * [dropdown](http://docs.handsontable.com/demo-dropdown.html) + * * [handsontable](http://docs.handsontable.com/demo-handsontable.html) + * * [numeric](http://docs.handsontable.com/demo-numeric.html) + * * [password](http://docs.handsontable.com/demo-password.html) + * * text + * * [time](http://docs.handsontable.com/demo-time.html) + * + * Or you can register the custom cell type under specified name and use + * its name as an alias in your configuration. + * + * @example + * ```js + * ... + * Handsontable.cellTypes.registerCellType('my.type', { + * editor: MyEditorClass, + * renderer: function(hot, td, row, col, prop, value, cellProperties) { + * td.innerHTML = value; + * }, + * validator: function(value, callback) { + * callback(value === 'foo' ? true : false); + * } + * }); + * ... + * columns: [ + * { + * type: 'text' + * }, + * { + * type: 'my.type' // an alias to custom type + * }, + * { + * type: 'checkbox' + * } + * ] + * ... + * ``` + * + * @type {String} + * @default 'text' + */ + type: 'text', + /** + * @description + * Make cell copyable (pressing CTRL + C on your keyboard moves its value to system clipboard). + * + * __Note:__ this setting is `false` by default for cells with type `password`. + * + * @type {Boolean} + * @default true + * @since 0.10.2 + */ + copyable: true, + /** + * Defines the editor for the table/column/cell. + * + * If a string is provided, it may be one of the following predefined values: + * * [autocomplete](http://docs.handsontable.com/demo-autocomplete.html) + * * [checkbox](http://docs.handsontable.com/demo-checkbox.html) + * * [date](http://docs.handsontable.com/demo-date.html) + * * [dropdown](http://docs.handsontable.com/demo-dropdown.html) + * * [handsontable](http://docs.handsontable.com/demo-handsontable.html) + * * [mobile](http://docs.handsontable.com/demo-mobiles-and-tablets.html) + * * [password](http://docs.handsontable.com/demo-password.html) + * * [select](http://docs.handsontable.com/demo-select.html) + * * text + * + * Or you can [register](http://docs.handsontable.com/tutorial-cell-editor.html#registering-an-editor) the custom editor under specified name and use + * its name as an alias in your configuration. + * + * To disable cell editing completely set `editor` property to `false`. + * + * @example + * ```js + * ... + * columns: [ + * { + * editor: 'select' + * }, + * { + * editor: false + * } + * ] + * ... + * ``` + * + * @type {String|Function|Boolean} + * @default 'text' + */ + editor: void 0, -/***/ }), -/* 160 */ -/***/ (function(module, exports) { + /** + * @description + * Autocomplete definitions. See [autocomplete demo](http://docs.handsontable.com/demo-autocomplete.html) for examples and definitions. + * + * @type {Array} + * @default undefined + */ + autoComplete: void 0, + /** + * Control number of choices for the autocomplete (or dropdown) typed cells. After exceeding it, a scrollbar for the dropdown list of choices will appear. + * + * @since 0.18.0 + * @type {Number} + * @default 10 + */ + visibleRows: 10, + /** + * Makes autocomplete or dropdown width the same as the edited cell width. If `false` then editor will be scaled + * according to its content. + * + * @since 0.17.0 + * @type {Boolean} + * @default true + */ + trimDropdown: true, -/***/ }), -/* 161 */ -/***/ (function(module, exports) { + /** + * Setting to true enables the debug mode, currently used to test the correctness of the row and column + * header fixed positioning on a layer above the master table. + * + * @type {Boolean} + * @default false + */ + debug: false, + /** + * When set to `true`, the text of the cell content is wrapped if it does not fit in the fixed column width. + * + * @type {Boolean} + * @default true + * @since 0.11.0 + */ + wordWrap: true, + /** + * CSS class name added to cells with cell meta `wordWrap: false`. + * + * @type {String} + * @default 'htNoWrap' + * @since 0.11.0 + */ + noWordWrapClassName: 'htNoWrap', -/***/ }), -/* 162 */ -/***/ (function(module, exports) { + /** + * @description + * Defines if the right-click context menu should be enabled. Context menu allows to create new row or + * column at any place in the grid among [other features](http://docs.handsontable.com/demo-context-menu.html). + * Possible values: + * * `true` (to enable default options), + * * `false` (to disable completely) + * * an array of [predefined options](https://docs.handsontable.com/demo-context-menu.html#page-specific), + * * an object [with defined structure](http://docs.handsontable.com/demo-context-menu.html#page-custom) + * + * See [the context menu demo](http://docs.handsontable.com/demo-context-menu.html) for examples. + * + * @example + * ```js + * ... + * // as a boolean + * contextMenu: true + * ... + * // as an array + * contextMenu: ['row_above', 'row_below', '--------', 'undo', 'redo'] + * ... + * ``` + * ... + * // as an object (`name` attribute is required in the custom keys) + * contextMenu: { + * items: { + * "option1": { + * name: "option1" + * }, + * "option2": { + * name: "option2", + * submenu: { + * items: [ + * { + * key: "option2:suboption1", + * name: "option2:suboption1", + * callback: function(key, options) { + * ... + * } + * }, + * ... + * ] + * } + * } + * } + * } + * ... + * ``` + * @type {Boolean|Array|Object} + * @default undefined + */ + contextMenu: void 0, + /** + * @description + * Disable or enable the copy/paste functionality. + * + * @example + * ```js + * ... + * copyPaste: false, + * ... + * ``` + * + * @type {Boolean} + * @default true + */ + copyPaste: true, + /** + * If `true`, undo/redo functionality is enabled. + * + * @type {Boolean} + * @default undefined + */ + undo: void 0, -/***/ }), -/* 163 */ -/***/ (function(module, exports) { + /** + * @description + * Turns on [Column sorting](http://docs.handsontable.com/demo-sorting-data.html). + * Can be either a boolean (true/false) or an object with a declared sorting options. See the below example: + * + * @example + * ```js + * ... + * // as boolean + * columnSorting: true + * ... + * // as a object with initial order (sort ascending column at index 2) + * columnSorting: { + * column: 2, + * sortOrder: true, // true = ascending, false = descending, undefined = original order + * sortEmptyCells: true // true = the table sorts empty cells, false = the table moves all empty cells to the end of the table + * } + * ... + * ``` + * + * @type {Boolean|Object} + * @default undefined + */ + columnSorting: void 0, + /** + * @description + * Turns on [Manual column move](http://docs.handsontable.com/demo-moving-rows-and-columns.html), if set to a boolean or define initial + * column order, if set to an array of column indexes. + * + * @example + * ```js + * ... + * // as boolean + * manualColumnMove: true + * ... + * // as a array with initial order (move column index at 0 to 1 and move column index at 1 to 4) + * manualColumnMove: [1, 4] + * ... + * ``` + * + * @type {Boolean|Array} + * @default undefined + */ + manualColumnMove: void 0, + /** + * @description + * Turns on [Manual column resize](http://docs.handsontable.com/demo-resizing.html), if set to a boolean or define initial + * column resized widths, if set to an array of numbers. + * + * @example + * ```js + * ... + * // as boolean + * manualColumnResize: true + * ... + * // as a array with initial widths (column at 0 index has 40px and column at 1 index has 50px) + * manualColumnResize: [40, 50] + * ... + * ``` + * + * @type {Boolean|Array} + * @default undefined + */ + manualColumnResize: void 0, -/***/ }), -/* 164 */ -/***/ (function(module, exports) { + /** + * @description + * Turns on [Manual row move](http://docs.handsontable.com/demo-moving-rows-and-columns.html), if set to a boolean or define initial + * row order, if set to an array of row indexes. + * + * @example + * ```js + * ... + * // as boolean + * manualRowMove: true + * ... + * // as a array with initial order (move row index at 0 to 1 and move row index at 1 to 4) + * manualRowMove: [1, 4] + * ... + * ``` + * + * @type {Boolean|Array} + * @default undefined + * @since 0.11.0 + */ + manualRowMove: void 0, + /** + * @description + * Turns on [Manual row resize](http://docs.handsontable.com/demo-resizing.html), if set to a boolean or define initial + * row resized heights, if set to an array of numbers. + * + * @example + * ```js + * ... + * // as boolean + * manualRowResize: true + * ... + * // as a array with initial heights (row at 0 index has 40px and row at 1 index has 50px) + * manualRowResize: [40, 50] + * ... + * ``` + * + * @type {Boolean|Array} + * @default undefined + * @since 0.11.0 + */ + manualRowResize: void 0, + /** + * @description + * If set to `true`, it enables a possibility to merge cells. If set to an array of objects, it merges the cells provided in the objects (see the example below). + * [More information on the demo page.](http://docs.handsontable.com/demo-merge-cells.html) + * + * @example + * ```js + * // enables the mergeCells plugin: + * margeCells: true + * ... + * // declares a list of merged sections: + * mergeCells: [ + * {row: 1, col: 1, rowspan: 3, colspan: 3}, // rowspan and colspan properties declare the width and height of a merged section in cells + * {row: 3, col: 4, rowspan: 2, colspan: 2}, + * {row: 5, col: 6, rowspan: 3, colspan: 3} + * ] + * ``` + * @type {Boolean|Array} + * @default false + */ + mergeCells: false, -/***/ }), -/* 165 */ -/***/ (function(module, exports) { + /** + * Number of rows to be rendered outside of the visible part of the table. + * By default, it's set to `'auto'`, which makes Handsontable to attempt to calculate the best offset performance-wise. + * + * You may test out different values to find the best one that works for your specific implementation. + * + * @type {Number|String} + * @default 'auto' + */ + viewportRowRenderingOffset: 'auto', + /** + * Number of columns to be rendered outside of the visible part of the table. + * By default, it's set to `'auto'`, which makes Handsontable try calculating the best offset performance-wise. + * + * You may experiment with the value to find the one that works best for your specific implementation. + * + * @type {Number|String} + * @default 'auto' + */ + viewportColumnRenderingOffset: 'auto', + /** + * A function, regular expression or a string, which will be used in the process of cell validation. + * If a function is used, be sure to execute the callback argument with either `true` (`callback(true)`) if the validation passed + * or with `false` (`callback(false)`), if the validation failed. + * Note, that `this` in the function points to the `cellProperties` object. + * + * If a string is provided, it may be one of the following predefined values: + * * `autocomplete`, + * * `date`, + * * `numeric`, + * * `time`. + * + * Or you can [register](http://docs.handsontable.com/demo-data-validation.html) the validator function under specified name and use + * its name as an alias in your configuration. + * + * See more [in the demo](http://docs.handsontable.com/demo-data-validation.html). + * + * @example + * ```js + * // as a function + * columns: [ + * { + * validator: function(value, callback) { // validation rules } + * } + * ] + * ... + * // as a regexp + * columns: [ + * { + * validator: /^[0-9]$/ // regular expression + * } + * ] + * // as a string + * columns: [ + * { + * validator: 'numeric' + * } + * ] + * ``` + * @type {Function|RegExp|String} + * @default undefined + * @since 0.9.5 + */ + validator: void 0, -/***/ }), -/* 166 */ -/***/ (function(module, exports) { + /** + * @description + * Disable visual cells selection. + * + * Possible values: + * * `true` - Disables any type of visual selection (current and area selection), + * * `false` - Enables any type of visual selection. This is default value. + * * `current` - Disables the selection of a currently selected cell, the area selection is still present. + * * `area` - Disables the area selection, the currently selected cell selection is still present. + * + * @type {Boolean|String|Array} + * @default false + * @since 0.13.2 + * @example + * ```js + * ... + * // as boolean + * disableVisualSelection: true, + * ... + * + * ... + * // as string ('current' or 'area') + * disableVisualSelection: 'current', + * ... + * + * ... + * // as array + * disableVisualSelection: ['current', 'area'], + * ... + * ``` + */ + disableVisualSelection: false, + /** + * @description + * Set whether to display the current sorting order indicator (a triangle icon in the column header, specifying the sorting order). + * + * @type {Boolean} + * @default false + * @since 0.15.0-beta3 + */ + sortIndicator: void 0, + /** + * Disable or enable ManualColumnFreeze plugin. + * + * @type {Boolean} + * @default false + */ + manualColumnFreeze: void 0, -/***/ }), -/* 167 */ -/***/ (function(module, exports) { + /** + * @description + * Defines whether Handsontable should trim the whitespace at the beginning and the end of the cell contents. + * + * @type {Boolean} + * @default true + */ + trimWhitespace: true, + settings: void 0, + /** + * @description + * Defines data source for Autocomplete or Dropdown cell types. + * + * @example + * ```js + * ... + * // source as a array + * columns: [{ + * type: 'autocomplete', + * source: ['A', 'B', 'C', 'D'] + * }] + * ... + * // source as a function + * columns: [{ + * type: 'autocomplete', + * source: function(query, callback) { + * fetch('http://example.com/query?q=' + query, function(response) { + * callback(response.items); + * }) + * } + * }] + * ... + * ``` + * + * @type {Array|Function} + * @default undefined + */ + source: void 0, -/***/ }), -/* 168 */ -/***/ (function(module, exports) { + /** + * @description + * Defines the column header name. + * + * @example + * ```js + * ... + * columns: [{ + * title: 'First name', + * type: 'text', + * }, + * { + * title: 'Last name', + * type: 'text', + * }] + * ... + * ``` + * + * @type {String} + * @default undefined + */ + title: void 0, + /** + * Data template for `'checkbox'` type when checkbox is checked. + * + * @example + * ```js + * checkedTemplate: 'good' + * + * // if a checkbox-typed cell is checked, then getDataAtCell(x,y), where x and y are the coordinates of the cell + * // will return 'good'. + * ``` + * @type {Boolean|String} + * @default true + */ + checkedTemplate: void 0, + /** + * Data template for `'checkbox'` type when checkbox is unchecked. + * + * @example + * ```js + * uncheckedTemplate: 'bad' + * + * // if a checkbox-typed cell is not checked, then getDataAtCell(x,y), where x and y are the coordinates of the cell + * // will return 'bad'. + * ``` + * @type {Boolean|String} + * @default false + */ + uncheckedTemplate: void 0, -/***/ }), -/* 169 */ -/***/ (function(module, exports) { + /** + * @description + * Object which describes if renderer should create checkbox element with label element as a parent. Option desired for + * [checkbox](http://docs.handsontable.com/demo-checkbox.html)-typed cells. + * + * By default the [checkbox](http://docs.handsontable.com/demo-checkbox.html) renderer renders the checkbox without a label. + * + * Possible object properties: + * * `property` - Defines the property name of the data object, which will to be used as a label. + * (eg. `label: {property: 'name.last'}`). This option works only if data was passed as an array of objects. + * * `position` - String which describes where to place the label text (before or after checkbox element). + * Valid values are `'before'` and '`after`' (defaults to `'after'`). + * * `value` - String or a Function which will be used as label text. + * + * @example + * ```js + * ... + * columns: [{ + * type: 'checkbox', + * label: {position: 'after', value: 'My label: '} + * }] + * ... + * ``` + * + * @since 0.19.0 + * @type {Object} + * @default undefined + */ + label: void 0, + /** + * Display format. See [numbrojs](http://numbrojs.com). This option is desired for + * [numeric](http://docs.handsontable.com/demo-numeric.html)-typed cells. + * + * Since 0.26.0 Handsontable uses [numbro](http://numbrojs.com/) as a main library for numbers formatting. + * + * @example + * ```js + * ... + * columns: [{ + * type: 'numeric', + * format: '0,00' + * }] + * ... + * ``` + * + * @type {String} + * @default '0' + */ + format: void 0, + /** + * Language display format. See [numbrojs](http://numbrojs.com/languages.html#supported-languages). This option is desired for + * [numeric](http://docs.handsontable.com/demo-numeric.html)-typed cells. + * + * Since 0.26.0 Handsontable uses [numbro](http://numbrojs.com/) as a main library for numbers formatting. + * + * @example + * ```js + * ... + * columns: [{ + * type: 'numeric', + * language: 'en-US' + * }] + * ... + * ``` + * + * @type {String} + * @default 'en-US' + */ + language: void 0, -/***/ }), -/* 170 */ -/***/ (function(module, exports) { + /** + * @description + * Data source for [select](http://docs.handsontable.com/demo-select.html)-typed cells. + * + * @example + * ```js + * ... + * columns: [{ + * editor: 'select', + * selectOptions: ['A', 'B', 'C'], + * }] + * ... + * ``` + * + * @type {Array} + */ + selectOptions: void 0, + /** + * Enables or disables the autoColumnSize plugin. Default value is `undefined`, which has the same effect as `true`. + * Disabling this plugin can increase performance, as no size-related calculations would be done. + * + * Column width calculations are divided into sync and async part. Each of this parts has their own advantages and + * disadvantages. Synchronous calculations are faster but they block the browser UI, while the slower asynchronous operations don't + * block the browser UI. + * + * To configure the sync/async distribution, you can pass an absolute value (number of columns) or a percentage value. + * `syncLimit` option is available since 0.16.0. + * + * You can also use the `useHeaders` option to take the column headers with into calculation. + * + * @example + * ```js + * ... + * // as a number (300 columns in sync, rest async) + * autoColumnSize: {syncLimit: 300}, + * ... + * + * ... + * // as a string (percent) + * autoColumnSize: {syncLimit: '40%'}, + * ... + * + * ... + * // use headers width while calculation the column width + * autoColumnSize: {useHeaders: true}, + * ... + * + * ``` + * + * @type {Object|Boolean} + * @default {syncLimit: 50} + */ + autoColumnSize: void 0, + /** + * Enables or disables autoRowSize plugin. Default value is `undefined`, which has the same effect as `false` (disabled). + * Enabling this plugin can decrease performance, as size-related calculations would be performed. + * + * Row height calculations are divided into sync and async stages. Each of these stages has their own advantages and + * disadvantages. Synchronous calculations are faster but they block the browser UI, while the slower asynchronous operations don't + * block the browser UI. + * + * To configure the sync/async distribution, you can pass an absolute value (number of columns) or a percentage value. + * `syncLimit` options is available since 0.16.0. + * + * @example + * ```js + * ... + * // as number (300 columns in sync, rest async) + * autoRowSize: {syncLimit: 300}, + * ... + * + * ... + * // as string (percent) + * autoRowSize: {syncLimit: '40%'}, + * ... + * ``` + * @type {Object|Boolean} + * @default {syncLimit: 1000} + */ + autoRowSize: void 0, -/***/ }), -/* 171 */ -/***/ (function(module, exports) { + /** + * Date validation format. + * + * Option desired for `'date'` - typed cells. + * + * @example + * ```js + * ... + * columns: [{ + * type: 'date', + * dateFormat: 'MM/DD/YYYY' + * }] + * ... + * ``` + * + * @type {String} + * @default 'DD/MM/YYYY' + */ + dateFormat: void 0, + /** + * If `true` then dates will be automatically formatted to match the desired format. + * + * Option desired for `'date'`-typed typed cells. + * + * @example + * ```js + * ... + * columns: [{ + * type: 'date', + * dateFormat: 'YYYY-MM-DD', + * correctFormat: true + * }] + * ... + * ``` + * + * @type {Boolean} + * @default false + */ + correctFormat: false, + /** + * Definition of default value which will fill the empty cells. + * + * Option desired for `'date'`-typed cells. + * + * @example + * ```js + * ... + * columns: [{ + * type: 'date', + * defaultData: '2015-02-02' + * }] + * ... + * ``` + * + * @type {String} + */ + defaultDate: void 0, -/***/ }), -/* 172 */ -/***/ (function(module, exports) { + /** + * If set to `true`, the value entered into the cell must match (case-sensitive) the autocomplete source. Otherwise, cell won't pass the validation. + * When filtering the autocomplete source list, the editor will be working in case-insensitive mode. + * + * Option desired for `autocomplete`-typed cells. + * + * @example + * ```js + * ... + * columns: [{ + * type: 'autocomplete', + * source: ['A', 'B', 'C'], + * strict: true + * }] + * ... + * ``` + * + * @type {Boolean} + */ + strict: void 0, + /** + * @description + * If typed `true`, data defined in `source` of the autocomplete or dropdown cell will be treated as HTML. + * + * __Warning:__ Enabling this option can cause serious XSS vulnerabilities. + * + * Option desired for `'autocomplete'`-typed cells. + * @example + * ```js + * ... + * columns: [{ + * type: 'autocomplete', + * allowHtml: true, + * source: ['foo', 'bar'] + * }] + * ... + * ``` + * @type {Boolean} + * @default false + */ + allowHtml: false, + /** + * If typed `true` then virtual rendering mechanism for handsontable will be disabled. + * + * @type {Boolean} + */ + renderAllRows: void 0, -/***/ }), -/* 173 */ -/***/ (function(module, exports) { + /** + * Prevents table to overlap outside the parent element. If `'horizontal'` option is chosen then table will appear horizontal + * scrollbar in case where parent's width is narrower then table's width. + * + * Possible values: + * * `false` - Disables functionality (Default option). + * * `horizontal` - Prevents horizontal overflow table. + * * `vertical` - Prevents vertical overflow table (Not implemented yet). + * + * @since 0.20.3 + * @example + * ```js + * ... + * preventOverflow: 'horizontal' + * ... + * ``` + * + * @type {String|Boolean} + */ + preventOverflow: false, + /** + * @description + * Plugin allowing binding the table rows with their headers. + * If the plugin is enabled, the table row headers will "stick" to the rows, when they are hidden/moved. Basically, if at the initialization + * row 0 has a header titled "A", it will have it no matter what you do with the table. + * + * @pro + * @since 1.0.0-beta1 + * @type {Boolean|String} + * @example + * + * ```js + * ... + * var hot = new Handsontable(document.getElementById('example'), { + * date: getData(), + * bindRowsWithHeaders: true + * }); + * ... + * ``` + * + */ + bindRowsWithHeaders: void 0, + /** + * @description + * The CollapsibleColumns plugin allows collapsing of columns, covered by a header with the `colspan` property defined. + * + * Clicking the "collapse/expand" button collapses (or expands) all "child" headers except the first one. + * + * Setting the `collapsibleColumns` property to `true` will display a "collapse/expand" button in every header with a defined + * `colspan` property. + * + * To limit this functionality to a smaller group of headers, define the `collapsibleColumns` property as an array of objects, as in + * the example below. + * + * @pro + * @since 1.0.0-beta1 + * @type {Boolean|Array} + * @example + * ```js + * ... + * collapsibleColumns: [ + * {row: -4, col: 1, collapsible: true}, + * {row: -3, col: 5, collapsible: true} + * ] + * ... + * // or + * ... + * collapsibleColumns: true + * ... + * ``` + */ + collapsibleColumns: void 0, -/***/ }), -/* 174 */ -/***/ (function(module, exports) { + /** + * @description + * Allows making pre-defined calculations on the cell values and display the results within Handsontable. + * See the demo for more information. + * + * @pro + * @since 1.0.0-beta1 + * @type {Object} + */ + columnSummary: void 0, + /** + * This plugin allows adding a configurable dropdown menu to the table's column headers. + * The dropdown menu acts like the Context Menu, but is triggered by clicking the button in the header. + * + * @pro + * @since 1.0.0-beta1 + * @type {Boolean|Object|Array} + */ + dropdownMenu: void 0, + /** + * The filters plugin. + * It allows filtering the table data either by the built-in component or with the API. + * + * @pro + * @since 1.0.0-beta1 + * @type {Boolean} + */ + filters: void 0, -/***/ }), -/* 175 */ -/***/ (function(module, exports) { + /** + * It allows Handsontable to process formula expressions defined in the provided data. + * + * @pro + * @since 1.7.0 + * @type {Boolean} + */ + formulas: void 0, + /** + * @description + * GanttChart plugin enables a possibility to create a Gantt chart using a Handsontable instance. + * In this case, the whole table becomes read-only. + * + * @pro + * @since 1.0.0-beta1 + * @type {Object} + */ + ganttChart: void 0, + /** + * @description + * Allows adding a tooltip to the table headers. + * + * Available options: + * * the `rows` property defines if tooltips should be added to row headers, + * * the `columns` property defines if tooltips should be added to column headers, + * * the `onlyTrimmed` property defines if tooltips should be added only to headers, which content is trimmed by the header itself (the content being wider then the header). + * + * @pro + * @since 1.0.0-beta1 + * @type {Boolean|Object} + */ + headerTooltips: void 0, -/***/ }), -/* 176 */ -/***/ (function(module, exports) { + /** + * Plugin allowing hiding of certain columns. + * + * @pro + * @since 1.0.0-beta1 + * @type {Boolean|Object} + */ + hiddenColumns: void 0, + /** + * @description + * Plugin allowing hiding of certain rows. + * + * @pro + * @since 1.0.0-beta1 + * @type {Boolean|Object} + */ + hiddenRows: void 0, + /** + * @description + * Allows creating a nested header structure, using the HTML's colspan attribute. + * + * @pro + * @since 1.0.0-beta1 + * @type {Array} + */ + nestedHeaders: void 0, -/***/ }), -/* 177 */ -/***/ (function(module, exports) { + /** + * @description + * Plugin allowing hiding of certain rows. + * + * @pro + * @since 1.0.0-beta1 + * @type {Boolean|Array} + */ + trimRows: void 0, + /** + * @description + * Allows setting a custom width of the row headers. You can provide a number or an array of widths, if many row header levels are defined. + * + * @since 0.22.0 + * @type {Number|Array} + */ + rowHeaderWidth: void 0, + /** + * @description + * Allows setting a custom height of the column headers. You can provide a number or an array of heights, if many column header levels are defined. + * + * @since 0.22.0 + * @type {Number|Array} + */ + columnHeaderHeight: void 0, -/***/ }), -/* 178 */ -/***/ (function(module, exports) { + /** + * @description + * Enabling this plugin switches table into one-way data binding where changes are applied into data source (from outside table) + * will be automatically reflected in the table. + * + * For every data change [afterChangesObserved](Hooks.html#event:afterChangesObserved) hook will be fired. + * + * @type {Boolean} + * @default false + */ + observeChanges: void 0, + /** + * @description + * When passed to the `column` property, allows specifying a custom sorting function for the desired column. + * + * @since 0.24.0 + * @type {Function} + * @example + * ```js + * columns: [ + * { + * sortFunction: function(sortOrder) { + * return function(a, b) { + * // sorting function body. + * // + * // Function parameters: + * // sortOrder: If true, the order is ascending, if false - descending. undefined = original order + * // a, b: Two compared elements. These are 2-element arrays, with the first element being the row index, the second - cell value. + * } + * } + * } + * ] + * ``` + */ + sortFunction: void 0, + /** + * If defined as 'true', the Autocomplete's suggestion list would be sorted by relevance (the closer to the left the match is, the higher the suggestion). + * + * Option desired for cells of the `'autocomplete'` type. + * + * @type {Boolean} + * @default true + */ + sortByRelevance: true, -/***/ }), -/* 179 */ -/***/ (function(module, exports) { + /** + * If defined as 'true', when the user types into the input area the Autocomplete's suggestion list is updated to only + * include those choices starting with what has been typed; if defined as 'false' all suggestions remain shown, with + * those matching what has been typed marked in bold. + * + * @type {Boolean} + * @default true + */ + filter: true, + /** + * If defined as 'true', filtering in the Autocomplete Editor will be case-sensitive. + * + * @type {Boolean} + * @default: false + */ + filteringCaseSensitive: false +}; +exports.default = DefaultSettings; /***/ }), -/* 180 */ -/***/ (function(module, exports) { - +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -/***/ }), -/* 181 */ -/***/ (function(module, exports) { +exports.__esModule = true; +exports.getNormalizedDate = getNormalizedDate; +/* eslint-disable import/prefer-default-export */ +/** + * Get normalized Date object for the ISO formatted date strings. + * Natively, the date object parsed from a ISO 8601 string will be offsetted by the timezone difference, which may result in returning a wrong date. + * See: Github issue #3338. + * + * @param {String} dateString String representing the date. + * @returns {Date} The proper Date object. + */ +function getNormalizedDate(dateString) { + var nativeDate = new Date(dateString); -/***/ }), -/* 182 */ -/***/ (function(module, exports) { + // NaN if dateString is not in ISO format + if (!isNaN(new Date(dateString + "T00:00").getDate())) { + // Compensate timezone offset + return new Date(nativeDate.getTime() + nativeDate.getTimezoneOffset() * 60000); + } + return nativeDate; +} /***/ }), -/* 183 */ -/***/ (function(module, exports) { - - +/* 90 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 184 */ -/***/ (function(module, exports) { +// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) +var $export = __webpack_require__(3); +$export($export.P, 'Array', {copyWithin: __webpack_require__(277)}); +__webpack_require__(37)('copyWithin'); /***/ }), -/* 185 */ -/***/ (function(module, exports) { - - +/* 91 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 186 */ -/***/ (function(module, exports) { +// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) +var $export = __webpack_require__(3); +$export($export.P, 'Array', {fill: __webpack_require__(278)}); +__webpack_require__(37)('fill'); /***/ }), -/* 187 */ -/***/ (function(module, exports) { +/* 92 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; +// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) +var $export = __webpack_require__(3) + , $find = __webpack_require__(52)(6) + , KEY = 'findIndex' + , forced = true; +// Shouldn't skip holes +if(KEY in [])Array(1)[KEY](function(){ forced = false; }); +$export($export.P + $export.F * forced, 'Array', { + findIndex: function findIndex(callbackfn/*, that = undefined */){ + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } +}); +__webpack_require__(37)(KEY); /***/ }), -/* 188 */ -/***/ (function(module, exports) { +/* 93 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; +// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) +var $export = __webpack_require__(3) + , $find = __webpack_require__(52)(5) + , KEY = 'find' + , forced = true; +// Shouldn't skip holes +if(KEY in [])Array(1)[KEY](function(){ forced = false; }); +$export($export.P + $export.F * forced, 'Array', { + find: function find(callbackfn/*, that = undefined */){ + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } +}); +__webpack_require__(37)(KEY); /***/ }), -/* 189 */ -/***/ (function(module, exports) { - +/* 94 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -/***/ }), -/* 190 */ -/***/ (function(module, exports) { +var ctx = __webpack_require__(29) + , $export = __webpack_require__(3) + , toObject = __webpack_require__(41) + , call = __webpack_require__(165) + , isArrayIter = __webpack_require__(161) + , toLength = __webpack_require__(24) + , createProperty = __webpack_require__(73) + , getIterFn = __webpack_require__(176); +$export($export.S + $export.F * !__webpack_require__(78)(function(iter){ Array.from(iter); }), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ + var O = toObject(arrayLike) + , C = typeof this == 'function' ? this : Array + , aLen = arguments.length + , mapfn = aLen > 1 ? arguments[1] : undefined + , mapping = mapfn !== undefined + , index = 0 + , iterFn = getIterFn(O) + , length, result, step, iterator; + if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ + for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ + createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = toLength(O.length); + for(result = new C(length); length > index; index++){ + createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } +}); /***/ }), -/* 191 */ -/***/ (function(module, exports) { - - +/* 95 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 192 */ -/***/ (function(module, exports) { +"use strict"; +var $export = __webpack_require__(3) + , createProperty = __webpack_require__(73); +// WebKit Array.of isn't generic +$export($export.S + $export.F * __webpack_require__(31)(function(){ + function F(){} + return !(Array.of.call(F) instanceof F); +}), 'Array', { + // 22.1.2.3 Array.of( ...items) + of: function of(/* ...args */){ + var index = 0 + , aLen = arguments.length + , result = new (typeof this == 'function' ? this : Array)(aLen); + while(aLen > index)createProperty(result, index, arguments[index++]); + result.length = aLen; + return result; + } +}); /***/ }), -/* 193 */ -/***/ (function(module, exports) { - - +/* 96 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 194 */ -/***/ (function(module, exports) { +var dP = __webpack_require__(19).f + , createDesc = __webpack_require__(40) + , has = __webpack_require__(22) + , FProto = Function.prototype + , nameRE = /^\s*function ([^ (]*)/ + , NAME = 'name'; +var isExtensible = Object.isExtensible || function(){ + return true; +}; +// 19.2.4.2 name +NAME in FProto || __webpack_require__(21) && dP(FProto, NAME, { + configurable: true, + get: function(){ + try { + var that = this + , name = ('' + that).match(nameRE)[1]; + has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name)); + return name; + } catch(e){ + return ''; + } + } +}); /***/ }), -/* 195 */ -/***/ (function(module, exports) { +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +var strong = __webpack_require__(157); +// 23.1 Map Objects +module.exports = __webpack_require__(53)('Map', function(get){ + return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.1.3.6 Map.prototype.get(key) + get: function get(key){ + var entry = strong.getEntry(this, key); + return entry && entry.v; + }, + // 23.1.3.9 Map.prototype.set(key, value) + set: function set(key, value){ + return strong.def(this, key === 0 ? 0 : key, value); + } +}, strong, true); /***/ }), -/* 196 */ -/***/ (function(module, exports) { +/* 98 */ +/***/ (function(module, exports, __webpack_require__) { +// 20.1.2.1 Number.EPSILON +var $export = __webpack_require__(3); +$export($export.S, 'Number', {EPSILON: Math.pow(2, -52)}); /***/ }), -/* 197 */ -/***/ (function(module, exports) { +/* 99 */ +/***/ (function(module, exports, __webpack_require__) { +// 20.1.2.2 Number.isFinite(number) +var $export = __webpack_require__(3) + , _isFinite = __webpack_require__(13).isFinite; +$export($export.S, 'Number', { + isFinite: function isFinite(it){ + return typeof it == 'number' && _isFinite(it); + } +}); /***/ }), -/* 198 */ -/***/ (function(module, exports) { +/* 100 */ +/***/ (function(module, exports, __webpack_require__) { +// 20.1.2.3 Number.isInteger(number) +var $export = __webpack_require__(3); +$export($export.S, 'Number', {isInteger: __webpack_require__(163)}); /***/ }), -/* 199 */ -/***/ (function(module, exports) { +/* 101 */ +/***/ (function(module, exports, __webpack_require__) { +// 20.1.2.4 Number.isNaN(number) +var $export = __webpack_require__(3); +$export($export.S, 'Number', { + isNaN: function isNaN(number){ + return number != number; + } +}); /***/ }), -/* 200 */ -/***/ (function(module, exports) { +/* 102 */ +/***/ (function(module, exports, __webpack_require__) { +// 20.1.2.5 Number.isSafeInteger(number) +var $export = __webpack_require__(3) + , isInteger = __webpack_require__(163) + , abs = Math.abs; +$export($export.S, 'Number', { + isSafeInteger: function isSafeInteger(number){ + return isInteger(number) && abs(number) <= 0x1fffffffffffff; + } +}); /***/ }), -/* 201 */ -/***/ (function(module, exports) { +/* 103 */ +/***/ (function(module, exports, __webpack_require__) { +// 20.1.2.6 Number.MAX_SAFE_INTEGER +var $export = __webpack_require__(3); +$export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff}); /***/ }), -/* 202 */ -/***/ (function(module, exports) { +/* 104 */ +/***/ (function(module, exports, __webpack_require__) { +// 20.1.2.10 Number.MIN_SAFE_INTEGER +var $export = __webpack_require__(3); +$export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff}); /***/ }), -/* 203 */ -/***/ (function(module, exports) { +/* 105 */ +/***/ (function(module, exports, __webpack_require__) { +// 19.1.3.1 Object.assign(target, source) +var $export = __webpack_require__(3); +$export($export.S + $export.F, 'Object', {assign: __webpack_require__(168)}); /***/ }), -/* 204 */ -/***/ (function(module, exports) { - +/* 106 */ +/***/ (function(module, exports, __webpack_require__) { +// 19.1.3.10 Object.is(value1, value2) +var $export = __webpack_require__(3); +$export($export.S, 'Object', {is: __webpack_require__(292)}); /***/ }), -/* 205 */ -/***/ (function(module, exports) { - +/* 107 */ +/***/ (function(module, exports, __webpack_require__) { +// 19.1.3.19 Object.setPrototypeOf(O, proto) +var $export = __webpack_require__(3); +$export($export.S, 'Object', {setPrototypeOf: __webpack_require__(171).set}); /***/ }), -/* 206 */ -/***/ (function(module, exports) { - +/* 108 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -/***/ }), -/* 207 */ -/***/ (function(module, exports) { +var LIBRARY = __webpack_require__(56) + , global = __webpack_require__(13) + , ctx = __webpack_require__(29) + , classof = __webpack_require__(156) + , $export = __webpack_require__(3) + , isObject = __webpack_require__(15) + , aFunction = __webpack_require__(72) + , anInstance = __webpack_require__(51) + , forOf = __webpack_require__(55) + , speciesConstructor = __webpack_require__(293) + , task = __webpack_require__(85).set + , microtask = __webpack_require__(287)() + , PROMISE = 'Promise' + , TypeError = global.TypeError + , process = global.process + , $Promise = global[PROMISE] + , process = global.process + , isNode = classof(process) == 'process' + , empty = function(){ /* empty */ } + , Internal, GenericPromiseCapability, Wrapper; +var USE_NATIVE = !!function(){ + try { + // correct subclassing with @@species support + var promise = $Promise.resolve(1) + , FakePromise = (promise.constructor = {})[__webpack_require__(10)('species')] = function(exec){ exec(empty, empty); }; + // unhandled rejections tracking support, NodeJS Promise without it fails @@species test + return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; + } catch(e){ /* empty */ } +}(); +// helpers +var sameConstructor = function(a, b){ + // with library wrapper special case + return a === b || a === $Promise && b === Wrapper; +}; +var isThenable = function(it){ + var then; + return isObject(it) && typeof (then = it.then) == 'function' ? then : false; +}; +var newPromiseCapability = function(C){ + return sameConstructor($Promise, C) + ? new PromiseCapability(C) + : new GenericPromiseCapability(C); +}; +var PromiseCapability = GenericPromiseCapability = function(C){ + var resolve, reject; + this.promise = new C(function($$resolve, $$reject){ + if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor'); + resolve = $$resolve; + reject = $$reject; + }); + this.resolve = aFunction(resolve); + this.reject = aFunction(reject); +}; +var perform = function(exec){ + try { + exec(); + } catch(e){ + return {error: e}; + } +}; +var notify = function(promise, isReject){ + if(promise._n)return; + promise._n = true; + var chain = promise._c; + microtask(function(){ + var value = promise._v + , ok = promise._s == 1 + , i = 0; + var run = function(reaction){ + var handler = ok ? reaction.ok : reaction.fail + , resolve = reaction.resolve + , reject = reaction.reject + , domain = reaction.domain + , result, then; + try { + if(handler){ + if(!ok){ + if(promise._h == 2)onHandleUnhandled(promise); + promise._h = 1; + } + if(handler === true)result = value; + else { + if(domain)domain.enter(); + result = handler(value); + if(domain)domain.exit(); + } + if(result === reaction.promise){ + reject(TypeError('Promise-chain cycle')); + } else if(then = isThenable(result)){ + then.call(result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch(e){ + reject(e); + } + }; + while(chain.length > i)run(chain[i++]); // variable length - can't use forEach + promise._c = []; + promise._n = false; + if(isReject && !promise._h)onUnhandled(promise); + }); +}; +var onUnhandled = function(promise){ + task.call(global, function(){ + var value = promise._v + , abrupt, handler, console; + if(isUnhandled(promise)){ + abrupt = perform(function(){ + if(isNode){ + process.emit('unhandledRejection', value, promise); + } else if(handler = global.onunhandledrejection){ + handler({promise: promise, reason: value}); + } else if((console = global.console) && console.error){ + console.error('Unhandled promise rejection', value); + } + }); + // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should + promise._h = isNode || isUnhandled(promise) ? 2 : 1; + } promise._a = undefined; + if(abrupt)throw abrupt.error; + }); +}; +var isUnhandled = function(promise){ + if(promise._h == 1)return false; + var chain = promise._a || promise._c + , i = 0 + , reaction; + while(chain.length > i){ + reaction = chain[i++]; + if(reaction.fail || !isUnhandled(reaction.promise))return false; + } return true; +}; +var onHandleUnhandled = function(promise){ + task.call(global, function(){ + var handler; + if(isNode){ + process.emit('rejectionHandled', promise); + } else if(handler = global.onrejectionhandled){ + handler({promise: promise, reason: promise._v}); + } + }); +}; +var $reject = function(value){ + var promise = this; + if(promise._d)return; + promise._d = true; + promise = promise._w || promise; // unwrap + promise._v = value; + promise._s = 2; + if(!promise._a)promise._a = promise._c.slice(); + notify(promise, true); +}; +var $resolve = function(value){ + var promise = this + , then; + if(promise._d)return; + promise._d = true; + promise = promise._w || promise; // unwrap + try { + if(promise === value)throw TypeError("Promise can't be resolved itself"); + if(then = isThenable(value)){ + microtask(function(){ + var wrapper = {_w: promise, _d: false}; // wrap + try { + then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); + } catch(e){ + $reject.call(wrapper, e); + } + }); + } else { + promise._v = value; + promise._s = 1; + notify(promise, false); + } + } catch(e){ + $reject.call({_w: promise, _d: false}, e); // wrap + } +}; -/***/ }), -/* 208 */ -/***/ (function(module, exports) { +// constructor polyfill +if(!USE_NATIVE){ + // 25.4.3.1 Promise(executor) + $Promise = function Promise(executor){ + anInstance(this, $Promise, PROMISE, '_h'); + aFunction(executor); + Internal.call(this); + try { + executor(ctx($resolve, this, 1), ctx($reject, this, 1)); + } catch(err){ + $reject.call(this, err); + } + }; + Internal = function Promise(executor){ + this._c = []; // <- awaiting reactions + this._a = undefined; // <- checked in isUnhandled reactions + this._s = 0; // <- state + this._d = false; // <- done + this._v = undefined; // <- value + this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled + this._n = false; // <- notify + }; + Internal.prototype = __webpack_require__(58)($Promise.prototype, { + // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) + then: function then(onFulfilled, onRejected){ + var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); + reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; + reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.domain = isNode ? process.domain : undefined; + this._c.push(reaction); + if(this._a)this._a.push(reaction); + if(this._s)notify(this, false); + return reaction.promise; + }, + // 25.4.5.1 Promise.prototype.catch(onRejected) + 'catch': function(onRejected){ + return this.then(undefined, onRejected); + } + }); + PromiseCapability = function(){ + var promise = new Internal; + this.promise = promise; + this.resolve = ctx($resolve, promise, 1); + this.reject = ctx($reject, promise, 1); + }; +} +$export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise}); +__webpack_require__(48)($Promise, PROMISE); +__webpack_require__(172)(PROMISE); +Wrapper = __webpack_require__(44)[PROMISE]; +// statics +$export($export.S + $export.F * !USE_NATIVE, PROMISE, { + // 25.4.4.5 Promise.reject(r) + reject: function reject(r){ + var capability = newPromiseCapability(this) + , $$reject = capability.reject; + $$reject(r); + return capability.promise; + } +}); +$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { + // 25.4.4.6 Promise.resolve(x) + resolve: function resolve(x){ + // instanceof instead of internal slot check because we should fix it without replacement native Promise core + if(x instanceof $Promise && sameConstructor(x.constructor, this))return x; + var capability = newPromiseCapability(this) + , $$resolve = capability.resolve; + $$resolve(x); + return capability.promise; + } +}); +$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(78)(function(iter){ + $Promise.all(iter)['catch'](empty); +})), PROMISE, { + // 25.4.4.1 Promise.all(iterable) + all: function all(iterable){ + var C = this + , capability = newPromiseCapability(C) + , resolve = capability.resolve + , reject = capability.reject; + var abrupt = perform(function(){ + var values = [] + , index = 0 + , remaining = 1; + forOf(iterable, false, function(promise){ + var $index = index++ + , alreadyCalled = false; + values.push(undefined); + remaining++; + C.resolve(promise).then(function(value){ + if(alreadyCalled)return; + alreadyCalled = true; + values[$index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if(abrupt)reject(abrupt.error); + return capability.promise; + }, + // 25.4.4.4 Promise.race(iterable) + race: function race(iterable){ + var C = this + , capability = newPromiseCapability(C) + , reject = capability.reject; + var abrupt = perform(function(){ + forOf(iterable, false, function(promise){ + C.resolve(promise).then(capability.resolve, reject); + }); + }); + if(abrupt)reject(abrupt.error); + return capability.promise; + } +}); /***/ }), -/* 209 */ -/***/ (function(module, exports) { - +/* 109 */ +/***/ (function(module, exports, __webpack_require__) { +// 21.2.5.3 get RegExp.prototype.flags() +if(__webpack_require__(21) && /./g.flags != 'g')__webpack_require__(19).f(RegExp.prototype, 'flags', { + configurable: true, + get: __webpack_require__(282) +}); /***/ }), -/* 210 */ -/***/ (function(module, exports) { - +/* 110 */ +/***/ (function(module, exports, __webpack_require__) { +// @@match logic +__webpack_require__(54)('match', 1, function(defined, MATCH, $match){ + // 21.1.3.11 String.prototype.match(regexp) + return [function match(regexp){ + 'use strict'; + var O = defined(this) + , fn = regexp == undefined ? undefined : regexp[MATCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); + }, $match]; +}); /***/ }), -/* 211 */ -/***/ (function(module, exports) { - +/* 111 */ +/***/ (function(module, exports, __webpack_require__) { +// @@replace logic +__webpack_require__(54)('replace', 2, function(defined, REPLACE, $replace){ + // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) + return [function replace(searchValue, replaceValue){ + 'use strict'; + var O = defined(this) + , fn = searchValue == undefined ? undefined : searchValue[REPLACE]; + return fn !== undefined + ? fn.call(searchValue, O, replaceValue) + : $replace.call(String(O), searchValue, replaceValue); + }, $replace]; +}); /***/ }), -/* 212 */ -/***/ (function(module, exports) { - +/* 112 */ +/***/ (function(module, exports, __webpack_require__) { +// @@search logic +__webpack_require__(54)('search', 1, function(defined, SEARCH, $search){ + // 21.1.3.15 String.prototype.search(regexp) + return [function search(regexp){ + 'use strict'; + var O = defined(this) + , fn = regexp == undefined ? undefined : regexp[SEARCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); + }, $search]; +}); /***/ }), -/* 213 */ -/***/ (function(module, exports) { - +/* 113 */ +/***/ (function(module, exports, __webpack_require__) { +// @@split logic +__webpack_require__(54)('split', 2, function(defined, SPLIT, $split){ + 'use strict'; + var isRegExp = __webpack_require__(164) + , _split = $split + , $push = [].push + , $SPLIT = 'split' + , LENGTH = 'length' + , LAST_INDEX = 'lastIndex'; + if( + 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || + 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || + 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || + '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || + '.'[$SPLIT](/()()/)[LENGTH] > 1 || + ''[$SPLIT](/.?/)[LENGTH] + ){ + var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group + // based on es5-shim implementation, need to rework it + $split = function(separator, limit){ + var string = String(this); + if(separator === undefined && limit === 0)return []; + // If `separator` is not a regex, use native split + if(!isRegExp(separator))return _split.call(string, separator, limit); + var output = []; + var flags = (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + + (separator.sticky ? 'y' : ''); + var lastLastIndex = 0; + var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; + // Make `global` and avoid `lastIndex` issues by working with a copy + var separatorCopy = new RegExp(separator.source, flags + 'g'); + var separator2, match, lastIndex, lastLength, i; + // Doesn't need flags gy, but they don't hurt + if(!NPCG)separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); + while(match = separatorCopy.exec(string)){ + // `separatorCopy.lastIndex` is not reliable cross-browser + lastIndex = match.index + match[0][LENGTH]; + if(lastIndex > lastLastIndex){ + output.push(string.slice(lastLastIndex, match.index)); + // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG + if(!NPCG && match[LENGTH] > 1)match[0].replace(separator2, function(){ + for(i = 1; i < arguments[LENGTH] - 2; i++)if(arguments[i] === undefined)match[i] = undefined; + }); + if(match[LENGTH] > 1 && match.index < string[LENGTH])$push.apply(output, match.slice(1)); + lastLength = match[0][LENGTH]; + lastLastIndex = lastIndex; + if(output[LENGTH] >= splitLimit)break; + } + if(separatorCopy[LAST_INDEX] === match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop + } + if(lastLastIndex === string[LENGTH]){ + if(lastLength || !separatorCopy.test(''))output.push(''); + } else output.push(string.slice(lastLastIndex)); + return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; + }; + // Chakra, V8 + } else if('0'[$SPLIT](undefined, 0)[LENGTH]){ + $split = function(separator, limit){ + return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); + }; + } + // 21.1.3.17 String.prototype.split(separator, limit) + return [function split(separator, limit){ + var O = defined(this) + , fn = separator == undefined ? undefined : separator[SPLIT]; + return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); + }, $split]; +}); /***/ }), -/* 214 */ -/***/ (function(module, exports) { - - +/* 114 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 215 */ -/***/ (function(module, exports) { +"use strict"; +var strong = __webpack_require__(157); +// 23.2 Set Objects +module.exports = __webpack_require__(53)('Set', function(get){ + return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.2.3.1 Set.prototype.add(value) + add: function add(value){ + return strong.def(this, value = value === 0 ? 0 : value, value); + } +}, strong); /***/ }), -/* 216 */ -/***/ (function(module, exports) { +/* 115 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; +var $export = __webpack_require__(3) + , $at = __webpack_require__(294)(false); +$export($export.P, 'String', { + // 21.1.3.3 String.prototype.codePointAt(pos) + codePointAt: function codePointAt(pos){ + return $at(this, pos); + } +}); /***/ }), -/* 217 */ -/***/ (function(module, exports) { - - +/* 116 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 218 */ -/***/ (function(module, exports) { +"use strict"; +// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) +var $export = __webpack_require__(3) + , toLength = __webpack_require__(24) + , context = __webpack_require__(84) + , ENDS_WITH = 'endsWith' + , $endsWith = ''[ENDS_WITH]; +$export($export.P + $export.F * __webpack_require__(76)(ENDS_WITH), 'String', { + endsWith: function endsWith(searchString /*, endPosition = @length */){ + var that = context(this, searchString, ENDS_WITH) + , endPosition = arguments.length > 1 ? arguments[1] : undefined + , len = toLength(that.length) + , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len) + , search = String(searchString); + return $endsWith + ? $endsWith.call(that, search, end) + : that.slice(end - search.length, end) === search; + } +}); /***/ }), -/* 219 */ -/***/ (function(module, exports) { +/* 117 */ +/***/ (function(module, exports, __webpack_require__) { +var $export = __webpack_require__(3) + , toIndex = __webpack_require__(59) + , fromCharCode = String.fromCharCode + , $fromCodePoint = String.fromCodePoint; +// length should be 1, old FF problem +$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { + // 21.1.2.2 String.fromCodePoint(...codePoints) + fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars + var res = [] + , aLen = arguments.length + , i = 0 + , code; + while(aLen > i){ + code = +arguments[i++]; + if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); + res.push(code < 0x10000 + ? fromCharCode(code) + : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) + ); + } return res.join(''); + } +}); /***/ }), -/* 220 */ -/***/ (function(module, exports) { - - +/* 118 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 221 */ -/***/ (function(module, exports) { +"use strict"; +// 21.1.3.7 String.prototype.includes(searchString, position = 0) +var $export = __webpack_require__(3) + , context = __webpack_require__(84) + , INCLUDES = 'includes'; +$export($export.P + $export.F * __webpack_require__(76)(INCLUDES), 'String', { + includes: function includes(searchString /*, position = 0 */){ + return !!~context(this, searchString, INCLUDES) + .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); + } +}); /***/ }), -/* 222 */ -/***/ (function(module, exports) { +/* 119 */ +/***/ (function(module, exports, __webpack_require__) { +var $export = __webpack_require__(3) + , toIObject = __webpack_require__(23) + , toLength = __webpack_require__(24); +$export($export.S, 'String', { + // 21.1.2.4 String.raw(callSite, ...substitutions) + raw: function raw(callSite){ + var tpl = toIObject(callSite.raw) + , len = toLength(tpl.length) + , aLen = arguments.length + , res = [] + , i = 0; + while(len > i){ + res.push(String(tpl[i++])); + if(i < aLen)res.push(String(arguments[i])); + } return res.join(''); + } +}); /***/ }), -/* 223 */ -/***/ (function(module, exports) { +/* 120 */ +/***/ (function(module, exports, __webpack_require__) { +var $export = __webpack_require__(3); +$export($export.P, 'String', { + // 21.1.3.13 String.prototype.repeat(count) + repeat: __webpack_require__(174) +}); /***/ }), -/* 224 */ -/***/ (function(module, exports) { - - +/* 121 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 225 */ -/***/ (function(module, exports) { +"use strict"; +// 21.1.3.18 String.prototype.startsWith(searchString [, position ]) +var $export = __webpack_require__(3) + , toLength = __webpack_require__(24) + , context = __webpack_require__(84) + , STARTS_WITH = 'startsWith' + , $startsWith = ''[STARTS_WITH]; +$export($export.P + $export.F * __webpack_require__(76)(STARTS_WITH), 'String', { + startsWith: function startsWith(searchString /*, position = 0 */){ + var that = context(this, searchString, STARTS_WITH) + , index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)) + , search = String(searchString); + return $startsWith + ? $startsWith.call(that, search, index) + : that.slice(index, index + search.length) === search; + } +}); /***/ }), -/* 226 */ -/***/ (function(module, exports) { +/* 122 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; +// ECMAScript 6 symbols shim +var global = __webpack_require__(13) + , has = __webpack_require__(22) + , DESCRIPTORS = __webpack_require__(21) + , $export = __webpack_require__(3) + , redefine = __webpack_require__(33) + , META = __webpack_require__(46).KEY + , $fails = __webpack_require__(31) + , shared = __webpack_require__(83) + , setToStringTag = __webpack_require__(48) + , uid = __webpack_require__(49) + , wks = __webpack_require__(10) + , wksExt = __webpack_require__(175) + , wksDefine = __webpack_require__(295) + , keyOf = __webpack_require__(286) + , enumKeys = __webpack_require__(281) + , isArray = __webpack_require__(162) + , anObject = __webpack_require__(18) + , toIObject = __webpack_require__(23) + , toPrimitive = __webpack_require__(86) + , createDesc = __webpack_require__(40) + , _create = __webpack_require__(79) + , gOPNExt = __webpack_require__(289) + , $GOPD = __webpack_require__(80) + , $DP = __webpack_require__(19) + , $keys = __webpack_require__(39) + , gOPD = $GOPD.f + , dP = $DP.f + , gOPN = gOPNExt.f + , $Symbol = global.Symbol + , $JSON = global.JSON + , _stringify = $JSON && $JSON.stringify + , PROTOTYPE = 'prototype' + , HIDDEN = wks('_hidden') + , TO_PRIMITIVE = wks('toPrimitive') + , isEnum = {}.propertyIsEnumerable + , SymbolRegistry = shared('symbol-registry') + , AllSymbols = shared('symbols') + , OPSymbols = shared('op-symbols') + , ObjectProto = Object[PROTOTYPE] + , USE_NATIVE = typeof $Symbol == 'function' + , QObject = global.QObject; +// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 +var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; -/***/ }), -/* 227 */ -/***/ (function(module, exports) { +// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 +var setSymbolDesc = DESCRIPTORS && $fails(function(){ + return _create(dP({}, 'a', { + get: function(){ return dP(this, 'a', {value: 7}).a; } + })).a != 7; +}) ? function(it, key, D){ + var protoDesc = gOPD(ObjectProto, key); + if(protoDesc)delete ObjectProto[key]; + dP(it, key, D); + if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); +} : dP; +var wrap = function(tag){ + var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); + sym._k = tag; + return sym; +}; +var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ + return typeof it == 'symbol'; +} : function(it){ + return it instanceof $Symbol; +}; -/***/ }), -/* 228 */ -/***/ (function(module, exports) { +var $defineProperty = function defineProperty(it, key, D){ + if(it === ObjectProto)$defineProperty(OPSymbols, key, D); + anObject(it); + key = toPrimitive(key, true); + anObject(D); + if(has(AllSymbols, key)){ + if(!D.enumerable){ + if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; + D = _create(D, {enumerable: createDesc(0, false)}); + } return setSymbolDesc(it, key, D); + } return dP(it, key, D); +}; +var $defineProperties = function defineProperties(it, P){ + anObject(it); + var keys = enumKeys(P = toIObject(P)) + , i = 0 + , l = keys.length + , key; + while(l > i)$defineProperty(it, key = keys[i++], P[key]); + return it; +}; +var $create = function create(it, P){ + return P === undefined ? _create(it) : $defineProperties(_create(it), P); +}; +var $propertyIsEnumerable = function propertyIsEnumerable(key){ + var E = isEnum.call(this, key = toPrimitive(key, true)); + if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; + return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; +}; +var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ + it = toIObject(it); + key = toPrimitive(key, true); + if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; + var D = gOPD(it, key); + if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; + return D; +}; +var $getOwnPropertyNames = function getOwnPropertyNames(it){ + var names = gOPN(toIObject(it)) + , result = [] + , i = 0 + , key; + while(names.length > i){ + if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); + } return result; +}; +var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ + var IS_OP = it === ObjectProto + , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) + , result = [] + , i = 0 + , key; + while(names.length > i){ + if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); + } return result; +}; +// 19.4.1.1 Symbol([description]) +if(!USE_NATIVE){ + $Symbol = function Symbol(){ + if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); + var tag = uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function(value){ + if(this === ObjectProto)$set.call(OPSymbols, value); + if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, createDesc(1, value)); + }; + if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); + return wrap(tag); + }; + redefine($Symbol[PROTOTYPE], 'toString', function toString(){ + return this._k; + }); + $GOPD.f = $getOwnPropertyDescriptor; + $DP.f = $defineProperty; + __webpack_require__(81).f = gOPNExt.f = $getOwnPropertyNames; + __webpack_require__(47).f = $propertyIsEnumerable; + __webpack_require__(57).f = $getOwnPropertySymbols; -/***/ }), -/* 229 */ -/***/ (function(module, exports) { + if(DESCRIPTORS && !__webpack_require__(56)){ + redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + wksExt.f = function(name){ + return wrap(wks(name)); + } +} +$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); -/***/ }), -/* 230 */ -/***/ (function(module, exports) { +for(var symbols = ( + // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' +).split(','), i = 0; symbols.length > i; )wks(symbols[i++]); +for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]); +$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function(key){ + return has(SymbolRegistry, key += '') + ? SymbolRegistry[key] + : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(key){ + if(isSymbol(key))return keyOf(SymbolRegistry, key); + throw TypeError(key + ' is not a symbol!'); + }, + useSetter: function(){ setter = true; }, + useSimple: function(){ setter = false; } +}); -/***/ }), -/* 231 */ -/***/ (function(module, exports) { +$export($export.S + $export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols +}); +// 24.3.2 JSON.stringify(value [, replacer [, space]]) +$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){ + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; +})), 'JSON', { + stringify: function stringify(it){ + if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined + var args = [it] + , i = 1 + , replacer, $replacer; + while(arguments.length > i)args.push(arguments[i++]); + replacer = args[1]; + if(typeof replacer == 'function')$replacer = replacer; + if($replacer || !isArray(replacer))replacer = function(key, value){ + if($replacer)value = $replacer.call(this, key, value); + if(!isSymbol(value))return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } +}); +// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) +$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(32)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +// 19.4.3.5 Symbol.prototype[@@toStringTag] +setToStringTag($Symbol, 'Symbol'); +// 20.2.1.9 Math[@@toStringTag] +setToStringTag(Math, 'Math', true); +// 24.3.3 JSON[@@toStringTag] +setToStringTag(global.JSON, 'JSON', true); /***/ }), -/* 232 */ -/***/ (function(module, exports) { - - +/* 123 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 233 */ -/***/ (function(module, exports) { +"use strict"; +var each = __webpack_require__(52)(0) + , redefine = __webpack_require__(33) + , meta = __webpack_require__(46) + , assign = __webpack_require__(168) + , weak = __webpack_require__(158) + , isObject = __webpack_require__(15) + , getWeak = meta.getWeak + , isExtensible = Object.isExtensible + , uncaughtFrozenStore = weak.ufstore + , tmp = {} + , InternalMap; +var wrapper = function(get){ + return function WeakMap(){ + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; +}; -/***/ }), -/* 234 */ -/***/ (function(module, exports) { +var methods = { + // 23.3.3.3 WeakMap.prototype.get(key) + get: function get(key){ + if(isObject(key)){ + var data = getWeak(key); + if(data === true)return uncaughtFrozenStore(this).get(key); + return data ? data[this._i] : undefined; + } + }, + // 23.3.3.5 WeakMap.prototype.set(key, value) + set: function set(key, value){ + return weak.def(this, key, value); + } +}; +// 23.3 WeakMap Objects +var $WeakMap = module.exports = __webpack_require__(53)('WeakMap', wrapper, methods, weak, true, true); +// IE11 WeakMap frozen keys fix +if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){ + InternalMap = weak.getConstructor(wrapper); + assign(InternalMap.prototype, methods); + meta.NEED = true; + each(['delete', 'has', 'get', 'set'], function(key){ + var proto = $WeakMap.prototype + , method = proto[key]; + redefine(proto, key, function(a, b){ + // store frozen objects on internal weakmap shim + if(isObject(a) && !isExtensible(a)){ + if(!this._f)this._f = new InternalMap; + var result = this._f[key](a, b); + return key == 'set' ? this : result; + // store all the rest on native weakmap + } return method.call(this, a, b); + }); + }); +} /***/ }), -/* 235 */ -/***/ (function(module, exports) { - - +/* 124 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 236 */ -/***/ (function(module, exports) { +"use strict"; +var weak = __webpack_require__(158); +// 23.4 WeakSet Objects +__webpack_require__(53)('WeakSet', function(get){ + return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.4.3.1 WeakSet.prototype.add(value) + add: function add(value){ + return weak.def(this, value, true); + } +}, weak, false, true); /***/ }), -/* 237 */ -/***/ (function(module, exports) { - +/* 125 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -/***/ }), -/* 238 */ -/***/ (function(module, exports) { +// https://github.com/tc39/Array.prototype.includes +var $export = __webpack_require__(3) + , $includes = __webpack_require__(155)(true); +$export($export.P, 'Array', { + includes: function includes(el /*, fromIndex = 0 */){ + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } +}); +__webpack_require__(37)('includes'); /***/ }), -/* 239 */ -/***/ (function(module, exports) { +/* 126 */ +/***/ (function(module, exports, __webpack_require__) { +// https://github.com/tc39/proposal-object-values-entries +var $export = __webpack_require__(3) + , $entries = __webpack_require__(170)(true); +$export($export.S, 'Object', { + entries: function entries(it){ + return $entries(it); + } +}); /***/ }), -/* 240 */ -/***/ (function(module, exports) { +/* 127 */ +/***/ (function(module, exports, __webpack_require__) { +// https://github.com/tc39/proposal-object-getownpropertydescriptors +var $export = __webpack_require__(3) + , ownKeys = __webpack_require__(291) + , toIObject = __webpack_require__(23) + , gOPD = __webpack_require__(80) + , createProperty = __webpack_require__(73); +$export($export.S, 'Object', { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){ + var O = toIObject(object) + , getDesc = gOPD.f + , keys = ownKeys(O) + , result = {} + , i = 0 + , key; + while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key)); + return result; + } +}); /***/ }), -/* 241 */ -/***/ (function(module, exports) { +/* 128 */ +/***/ (function(module, exports, __webpack_require__) { +// https://github.com/tc39/proposal-object-values-entries +var $export = __webpack_require__(3) + , $values = __webpack_require__(170)(false); +$export($export.S, 'Object', { + values: function values(it){ + return $values(it); + } +}); /***/ }), -/* 242 */ -/***/ (function(module, exports) { - - +/* 129 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 243 */ -/***/ (function(module, exports) { +"use strict"; +// https://github.com/tc39/proposal-string-pad-start-end +var $export = __webpack_require__(3) + , $pad = __webpack_require__(173); +$export($export.P, 'String', { + padEnd: function padEnd(maxLength /*, fillString = ' ' */){ + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); + } +}); /***/ }), -/* 244 */ -/***/ (function(module, exports) { - - +/* 130 */ +/***/ (function(module, exports, __webpack_require__) { -/***/ }), -/* 245 */ -/***/ (function(module, exports) { +"use strict"; +// https://github.com/tc39/proposal-string-pad-start-end +var $export = __webpack_require__(3) + , $pad = __webpack_require__(173); +$export($export.P, 'String', { + padStart: function padStart(maxLength /*, fillString = ' ' */){ + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); + } +}); /***/ }), -/* 246 */ -/***/ (function(module, exports) { +/* 131 */ +/***/ (function(module, exports, __webpack_require__) { +var $iterators = __webpack_require__(67) + , redefine = __webpack_require__(33) + , global = __webpack_require__(13) + , hide = __webpack_require__(32) + , Iterators = __webpack_require__(45) + , wks = __webpack_require__(10) + , ITERATOR = wks('iterator') + , TO_STRING_TAG = wks('toStringTag') + , ArrayValues = Iterators.Array; +for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ + var NAME = collections[i] + , Collection = global[NAME] + , proto = Collection && Collection.prototype + , key; + if(proto){ + if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues); + if(!proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = ArrayValues; + for(key in $iterators)if(!proto[key])redefine(proto, key, $iterators[key], true); + } +} /***/ }), -/* 247 */ -/***/ (function(module, exports) { - +/* 132 */ +/***/ (function(module, exports, __webpack_require__) { +var $export = __webpack_require__(3) + , $task = __webpack_require__(85); +$export($export.G + $export.B, { + setImmediate: $task.set, + clearImmediate: $task.clear +}); /***/ }), -/* 248 */ +/* 133 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -23468,7 +17045,7 @@ $export($export.G + $export.B, { })(window); /***/ }), -/* 249 */ +/* 134 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -24073,7 +17650,7 @@ if (true) { } /***/ }), -/* 250 */ +/* 135 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -24095,7 +17672,7 @@ var _eventManager = __webpack_require__(4); var _eventManager2 = _interopRequireDefault(_eventManager); -var _coords = __webpack_require__(43); +var _coords = __webpack_require__(42); var _coords2 = _interopRequireDefault(_coords); @@ -24616,7 +18193,7 @@ var Border = function () { exports.default = Border; /***/ }), -/* 251 */ +/* 136 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -24941,7 +18518,7 @@ var ViewportColumnsCalculator = function () { exports.default = ViewportColumnsCalculator; /***/ }), -/* 252 */ +/* 137 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25121,7 +18698,7 @@ var ViewportRowsCalculator = function () { exports.default = ViewportRowsCalculator; /***/ }), -/* 253 */ +/* 138 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25137,27 +18714,27 @@ var _object = __webpack_require__(1); var _string = __webpack_require__(27); -var _event = __webpack_require__(254); +var _event = __webpack_require__(139); var _event2 = _interopRequireDefault(_event); -var _overlays = __webpack_require__(257); +var _overlays = __webpack_require__(142); var _overlays2 = _interopRequireDefault(_overlays); -var _scroll = __webpack_require__(258); +var _scroll = __webpack_require__(143); var _scroll2 = _interopRequireDefault(_scroll); -var _settings = __webpack_require__(259); +var _settings = __webpack_require__(144); var _settings2 = _interopRequireDefault(_settings); -var _table = __webpack_require__(260); +var _table = __webpack_require__(145); var _table2 = _interopRequireDefault(_table); -var _viewport = __webpack_require__(262); +var _viewport = __webpack_require__(147); var _viewport2 = _interopRequireDefault(_viewport); @@ -25458,7 +19035,7 @@ var Walkontable = function () { exports.default = Walkontable; /***/ }), -/* 254 */ +/* 139 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25696,7 +19273,7 @@ Event.prototype.parentCell = function (elem) { exports.default = Event; /***/ }), -/* 255 */ +/* 140 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25821,7 +19398,7 @@ var ColumnFilter = function () { exports.default = ColumnFilter; /***/ }), -/* 256 */ +/* 141 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25946,7 +19523,7 @@ var RowFilter = function () { exports.default = RowFilter; /***/ }), -/* 257 */ +/* 142 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -26800,7 +20377,7 @@ var Overlays = function () { exports.default = Overlays; /***/ }), -/* 258 */ +/* 143 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -27091,7 +20668,7 @@ var Scroll = function () { exports.default = Scroll; /***/ }), -/* 259 */ +/* 144 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -27302,7 +20879,7 @@ var Settings = function () { exports.default = Settings; /***/ }), -/* 260 */ +/* 145 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -27318,23 +20895,23 @@ var _element = __webpack_require__(0); var _function = __webpack_require__(35); -var _coords = __webpack_require__(43); +var _coords = __webpack_require__(42); var _coords2 = _interopRequireDefault(_coords); -var _range = __webpack_require__(69); +var _range = __webpack_require__(68); var _range2 = _interopRequireDefault(_range); -var _column = __webpack_require__(255); +var _column = __webpack_require__(140); var _column2 = _interopRequireDefault(_column); -var _row = __webpack_require__(256); +var _row = __webpack_require__(141); var _row2 = _interopRequireDefault(_row); -var _tableRenderer = __webpack_require__(261); +var _tableRenderer = __webpack_require__(146); var _tableRenderer2 = _interopRequireDefault(_tableRenderer); @@ -28048,7 +21625,7 @@ var Table = function () { exports.default = Table; /***/ }), -/* 261 */ +/* 146 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -28789,7 +22366,7 @@ function replaceThWithTd(TH, TR) { exports.default = TableRenderer; /***/ }), -/* 262 */ +/* 147 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -28807,11 +22384,11 @@ var _eventManager = __webpack_require__(4); var _eventManager2 = _interopRequireDefault(_eventManager); -var _viewportColumns = __webpack_require__(251); +var _viewportColumns = __webpack_require__(136); var _viewportColumns2 = _interopRequireDefault(_viewportColumns); -var _viewportRows = __webpack_require__(252); +var _viewportRows = __webpack_require__(137); var _viewportRows2 = _interopRequireDefault(_viewportRows); @@ -29344,7 +22921,7 @@ var Viewport = function () { exports.default = Viewport; /***/ }), -/* 263 */ +/* 148 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -29362,7 +22939,7 @@ var _array = __webpack_require__(2); var _element = __webpack_require__(0); -var _handsontableEditor = __webpack_require__(264); +var _handsontableEditor = __webpack_require__(149); var _handsontableEditor2 = _interopRequireDefault(_handsontableEditor); @@ -29802,7 +23379,7 @@ AutocompleteEditor.prototype.discardEditor = function (result) { exports.default = AutocompleteEditor; /***/ }), -/* 264 */ +/* 149 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -29818,7 +23395,7 @@ var _element = __webpack_require__(0); var _event = __webpack_require__(7); -var _textEditor = __webpack_require__(44); +var _textEditor = __webpack_require__(43); var _textEditor2 = _interopRequireDefault(_textEditor); @@ -30004,7 +23581,7 @@ HandsontableEditor.prototype.assignHooks = function () { exports.default = HandsontableEditor; /***/ }), -/* 265 */ +/* 150 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -30035,7 +23612,7 @@ var arrayMapper = { getValueByIndex: function getValueByIndex(index) { var value = void 0; - /* eslint-disable no-cond-assign */ + // eslint-disable-next-line no-cond-assign, no-return-assign return (value = this._arrayMap[index]) === void 0 ? null : value; }, @@ -30049,7 +23626,7 @@ var arrayMapper = { getIndexByValue: function getIndexByValue(value) { var index = void 0; - /* eslint-disable no-cond-assign */ + // eslint-disable-next-line no-cond-assign, no-return-assign return (index = this._arrayMap.indexOf(value)) === -1 ? null : index; }, @@ -30187,7 +23764,7 @@ var arrayMapper = { exports.default = arrayMapper; /***/ }), -/* 266 */ +/* 151 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -30407,7 +23984,7 @@ var BaseUI = function () { exports.default = BaseUI; /***/ }), -/* 267 */ +/* 152 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -30625,7 +24202,7 @@ var BaseUI = function () { exports.default = BaseUI; /***/ }), -/* 268 */ +/* 153 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -30639,7 +24216,7 @@ var _createClass = function () { function defineProperties(target, props) { for exports.registerIdentity = registerIdentity; exports.getTranslator = getTranslator; -var _core = __webpack_require__(64); +var _core = __webpack_require__(63); var _core2 = _interopRequireDefault(_core); @@ -30799,7 +24376,7 @@ function getTranslator(identity) { } /***/ }), -/* 269 */ +/* 154 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31033,14 +24610,14 @@ var SamplesGenerator = function () { exports.default = SamplesGenerator; /***/ }), -/* 270 */ +/* 155 */ /***/ (function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes var toIObject = __webpack_require__(23) , toLength = __webpack_require__(24) - , toIndex = __webpack_require__(61); + , toIndex = __webpack_require__(59); module.exports = function(IS_INCLUDES){ return function($this, el, fromIndex){ var O = toIObject($this) @@ -31059,11 +24636,11 @@ module.exports = function(IS_INCLUDES){ }; /***/ }), -/* 271 */ +/* 156 */ /***/ (function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() -var cof = __webpack_require__(39) +var cof = __webpack_require__(38) , TAG = __webpack_require__(10)('toStringTag') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; @@ -31087,23 +24664,23 @@ module.exports = function(it){ }; /***/ }), -/* 272 */ +/* 157 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var dP = __webpack_require__(19).f - , create = __webpack_require__(80) - , redefineAll = __webpack_require__(60) + , create = __webpack_require__(79) + , redefineAll = __webpack_require__(58) , ctx = __webpack_require__(29) - , anInstance = __webpack_require__(53) + , anInstance = __webpack_require__(51) , defined = __webpack_require__(30) - , forOf = __webpack_require__(57) - , $iterDefine = __webpack_require__(281) - , step = __webpack_require__(282) - , setSpecies = __webpack_require__(287) + , forOf = __webpack_require__(55) + , $iterDefine = __webpack_require__(166) + , step = __webpack_require__(167) + , setSpecies = __webpack_require__(172) , DESCRIPTORS = __webpack_require__(21) - , fastKey = __webpack_require__(47).fastKey + , fastKey = __webpack_require__(46).fastKey , SIZE = DESCRIPTORS ? '_s' : 'size'; var getEntry = function(that, key){ @@ -31235,18 +24812,18 @@ module.exports = { }; /***/ }), -/* 273 */ +/* 158 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var redefineAll = __webpack_require__(60) - , getWeak = __webpack_require__(47).getWeak +var redefineAll = __webpack_require__(58) + , getWeak = __webpack_require__(46).getWeak , anObject = __webpack_require__(18) , isObject = __webpack_require__(15) - , anInstance = __webpack_require__(53) - , forOf = __webpack_require__(57) - , createArrayMethod = __webpack_require__(54) + , anInstance = __webpack_require__(51) + , forOf = __webpack_require__(55) + , createArrayMethod = __webpack_require__(52) , $has = __webpack_require__(22) , arrayFind = createArrayMethod(5) , arrayFindIndex = createArrayMethod(6) @@ -31324,25 +24901,25 @@ module.exports = { }; /***/ }), -/* 274 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(13).document && document.documentElement; /***/ }), -/* 275 */ +/* 160 */ /***/ (function(module, exports, __webpack_require__) { module.exports = !__webpack_require__(21) && !__webpack_require__(31)(function(){ - return Object.defineProperty(__webpack_require__(75)('div'), 'a', {get: function(){ return 7; }}).a != 7; + return Object.defineProperty(__webpack_require__(74)('div'), 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }), -/* 276 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { // check on default Array iterator -var Iterators = __webpack_require__(46) +var Iterators = __webpack_require__(45) , ITERATOR = __webpack_require__(10)('iterator') , ArrayProto = Array.prototype; @@ -31351,17 +24928,17 @@ module.exports = function(it){ }; /***/ }), -/* 277 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { // 7.2.2 IsArray(argument) -var cof = __webpack_require__(39); +var cof = __webpack_require__(38); module.exports = Array.isArray || function isArray(arg){ return cof(arg) == 'Array'; }; /***/ }), -/* 278 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.3 Number.isInteger(number) @@ -31372,12 +24949,12 @@ module.exports = function isInteger(it){ }; /***/ }), -/* 279 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { // 7.2.8 IsRegExp(argument) var isObject = __webpack_require__(15) - , cof = __webpack_require__(39) + , cof = __webpack_require__(38) , MATCH = __webpack_require__(10)('match'); module.exports = function(it){ var isRegExp; @@ -31385,7 +24962,7 @@ module.exports = function(it){ }; /***/ }), -/* 280 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { // call something on iterator step with safe closing on error @@ -31402,20 +24979,20 @@ module.exports = function(iterator, fn, value, entries){ }; /***/ }), -/* 281 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var LIBRARY = __webpack_require__(58) +var LIBRARY = __webpack_require__(56) , $export = __webpack_require__(3) , redefine = __webpack_require__(33) , hide = __webpack_require__(32) , has = __webpack_require__(22) - , Iterators = __webpack_require__(46) - , $iterCreate = __webpack_require__(400) - , setToStringTag = __webpack_require__(49) - , getPrototypeOf = __webpack_require__(405) + , Iterators = __webpack_require__(45) + , $iterCreate = __webpack_require__(285) + , setToStringTag = __webpack_require__(48) + , getPrototypeOf = __webpack_require__(290) , ITERATOR = __webpack_require__(10)('iterator') , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` , FF_ITERATOR = '@@iterator' @@ -31478,7 +25055,7 @@ module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED }; /***/ }), -/* 282 */ +/* 167 */ /***/ (function(module, exports) { module.exports = function(done, value){ @@ -31486,17 +25063,17 @@ module.exports = function(done, value){ }; /***/ }), -/* 283 */ +/* 168 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.2.1 Object.assign(target, source, ...) -var getKeys = __webpack_require__(40) - , gOPS = __webpack_require__(59) - , pIE = __webpack_require__(48) - , toObject = __webpack_require__(42) - , IObject = __webpack_require__(78) +var getKeys = __webpack_require__(39) + , gOPS = __webpack_require__(57) + , pIE = __webpack_require__(47) + , toObject = __webpack_require__(41) + , IObject = __webpack_require__(77) , $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) @@ -31525,13 +25102,13 @@ module.exports = !$assign || __webpack_require__(31)(function(){ } : $assign; /***/ }), -/* 284 */ +/* 169 */ /***/ (function(module, exports, __webpack_require__) { var has = __webpack_require__(22) , toIObject = __webpack_require__(23) - , arrayIndexOf = __webpack_require__(270)(false) - , IE_PROTO = __webpack_require__(83)('IE_PROTO'); + , arrayIndexOf = __webpack_require__(155)(false) + , IE_PROTO = __webpack_require__(82)('IE_PROTO'); module.exports = function(object, names){ var O = toIObject(object) @@ -31547,12 +25124,12 @@ module.exports = function(object, names){ }; /***/ }), -/* 285 */ +/* 170 */ /***/ (function(module, exports, __webpack_require__) { -var getKeys = __webpack_require__(40) +var getKeys = __webpack_require__(39) , toIObject = __webpack_require__(23) - , isEnum = __webpack_require__(48).f; + , isEnum = __webpack_require__(47).f; module.exports = function(isEntries){ return function(it){ var O = toIObject(it) @@ -31568,7 +25145,7 @@ module.exports = function(isEntries){ }; /***/ }), -/* 286 */ +/* 171 */ /***/ (function(module, exports, __webpack_require__) { // Works with __proto__ only. Old v8 can't work with null proto objects. @@ -31583,7 +25160,7 @@ module.exports = { set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line function(test, buggy, set){ try { - set = __webpack_require__(29)(Function.call, __webpack_require__(81).f(Object.prototype, '__proto__').set, 2); + set = __webpack_require__(29)(Function.call, __webpack_require__(80).f(Object.prototype, '__proto__').set, 2); set(test, []); buggy = !(test instanceof Array); } catch(e){ buggy = true; } @@ -31598,7 +25175,7 @@ module.exports = { }; /***/ }), -/* 287 */ +/* 172 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31617,12 +25194,12 @@ module.exports = function(KEY){ }; /***/ }), -/* 288 */ +/* 173 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-string-pad-start-end var toLength = __webpack_require__(24) - , repeat = __webpack_require__(289) + , repeat = __webpack_require__(174) , defined = __webpack_require__(30); module.exports = function(that, maxLength, fillString, left){ @@ -31639,12 +25216,12 @@ module.exports = function(that, maxLength, fillString, left){ /***/ }), -/* 289 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var toInteger = __webpack_require__(62) +var toInteger = __webpack_require__(60) , defined = __webpack_require__(30); module.exports = function repeat(count){ @@ -31657,26 +25234,26 @@ module.exports = function repeat(count){ }; /***/ }), -/* 290 */ +/* 175 */ /***/ (function(module, exports, __webpack_require__) { exports.f = __webpack_require__(10); /***/ }), -/* 291 */ +/* 176 */ /***/ (function(module, exports, __webpack_require__) { -var classof = __webpack_require__(271) +var classof = __webpack_require__(156) , ITERATOR = __webpack_require__(10)('iterator') - , Iterators = __webpack_require__(46); -module.exports = __webpack_require__(45).getIteratorMethod = function(it){ + , Iterators = __webpack_require__(45); +module.exports = __webpack_require__(44).getIteratorMethod = function(it){ if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }), -/* 292 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31737,7 +25314,7 @@ function jQueryWrapper(Handsontable) { }; /***/ }), -/* 293 */ +/* 178 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31746,87 +25323,87 @@ function jQueryWrapper(Handsontable) { exports.__esModule = true; exports.Base = exports.UndoRedo = exports.TouchScroll = exports.Search = exports.PersistentState = exports.ObserveChanges = exports.MultipleSelectionHandles = exports.MergeCells = exports.ManualRowResize = exports.ManualRowMove = exports.ManualColumnResize = exports.ManualColumnMove = exports.ManualColumnFreeze = exports.DragToScroll = exports.CustomBorders = exports.CopyPaste = exports.ContextMenu = exports.Comments = exports.ColumnSorting = exports.AutoRowSize = exports.AutoFill = exports.AutoColumnSize = undefined; -var _autoColumnSize = __webpack_require__(325); +var _autoColumnSize = __webpack_require__(210); var _autoColumnSize2 = _interopRequireDefault(_autoColumnSize); -var _autofill = __webpack_require__(327); +var _autofill = __webpack_require__(212); var _autofill2 = _interopRequireDefault(_autofill); -var _autoRowSize = __webpack_require__(326); +var _autoRowSize = __webpack_require__(211); var _autoRowSize2 = _interopRequireDefault(_autoRowSize); -var _columnSorting = __webpack_require__(329); +var _columnSorting = __webpack_require__(214); var _columnSorting2 = _interopRequireDefault(_columnSorting); -var _comments = __webpack_require__(331); +var _comments = __webpack_require__(216); var _comments2 = _interopRequireDefault(_comments); -var _contextMenu = __webpack_require__(334); +var _contextMenu = __webpack_require__(219); var _contextMenu2 = _interopRequireDefault(_contextMenu); -var _copyPaste = __webpack_require__(351); +var _copyPaste = __webpack_require__(236); var _copyPaste2 = _interopRequireDefault(_copyPaste); -var _customBorders = __webpack_require__(353); +var _customBorders = __webpack_require__(238); var _customBorders2 = _interopRequireDefault(_customBorders); -var _dragToScroll = __webpack_require__(354); +var _dragToScroll = __webpack_require__(239); var _dragToScroll2 = _interopRequireDefault(_dragToScroll); -var _manualColumnFreeze = __webpack_require__(357); +var _manualColumnFreeze = __webpack_require__(242); var _manualColumnFreeze2 = _interopRequireDefault(_manualColumnFreeze); -var _manualColumnMove = __webpack_require__(359); +var _manualColumnMove = __webpack_require__(244); var _manualColumnMove2 = _interopRequireDefault(_manualColumnMove); -var _manualColumnResize = __webpack_require__(362); +var _manualColumnResize = __webpack_require__(247); var _manualColumnResize2 = _interopRequireDefault(_manualColumnResize); -var _manualRowMove = __webpack_require__(363); +var _manualRowMove = __webpack_require__(248); var _manualRowMove2 = _interopRequireDefault(_manualRowMove); -var _manualRowResize = __webpack_require__(367); +var _manualRowResize = __webpack_require__(252); var _manualRowResize2 = _interopRequireDefault(_manualRowResize); -var _mergeCells = __webpack_require__(368); +var _mergeCells = __webpack_require__(253); var _mergeCells2 = _interopRequireDefault(_mergeCells); -var _multipleSelectionHandles = __webpack_require__(369); +var _multipleSelectionHandles = __webpack_require__(254); var _multipleSelectionHandles2 = _interopRequireDefault(_multipleSelectionHandles); -var _observeChanges = __webpack_require__(371); +var _observeChanges = __webpack_require__(256); var _observeChanges2 = _interopRequireDefault(_observeChanges); -var _persistentState = __webpack_require__(373); +var _persistentState = __webpack_require__(258); var _persistentState2 = _interopRequireDefault(_persistentState); -var _search = __webpack_require__(374); +var _search = __webpack_require__(259); var _search2 = _interopRequireDefault(_search); -var _touchScroll = __webpack_require__(375); +var _touchScroll = __webpack_require__(260); var _touchScroll2 = _interopRequireDefault(_touchScroll); -var _undoRedo = __webpack_require__(376); +var _undoRedo = __webpack_require__(261); var _undoRedo2 = _interopRequireDefault(_undoRedo); @@ -31860,31 +25437,31 @@ exports.UndoRedo = _undoRedo2.default; exports.Base = _base2.default; /***/ }), -/* 294 */ +/* 179 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 295 */ +/* 180 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 296 */ +/* 181 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 297 */ +/* 182 */ /***/ (function(module, exports) { /***/ }), -/* 298 */ +/* 183 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31909,14 +25486,14 @@ function autoResize() { text = document.createTextNode(''), span = document.createElement('SPAN'), observe = function observe(element, event, handler) { - if (window.attachEvent) { + if (element.attachEvent) { element.attachEvent('on' + event, handler); } else { element.addEventListener(event, handler, false); } }, _unObserve = function _unObserve(element, event, handler) { - if (window.removeEventListener) { + if (element.removeEventListener) { element.removeEventListener(event, handler, false); } else { element.detachEvent('on' + event, handler); @@ -32070,7 +25647,7 @@ if (true) { } /***/ }), -/* 299 */ +/* 184 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32125,7 +25702,7 @@ _base2.default.registerOverlay(_base2.default.CLONE_DEBUG, DebugOverlay); exports.default = DebugOverlay; /***/ }), -/* 300 */ +/* 185 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32487,7 +26064,7 @@ _base2.default.registerOverlay(_base2.default.CLONE_LEFT, LeftOverlay); exports.default = LeftOverlay; /***/ }), -/* 301 */ +/* 186 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32903,7 +26480,7 @@ _base2.default.registerOverlay(_base2.default.CLONE_TOP, TopOverlay); exports.default = TopOverlay; /***/ }), -/* 302 */ +/* 187 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33013,7 +26590,7 @@ _base2.default.registerOverlay(_base2.default.CLONE_TOP_LEFT_CORNER, TopLeftCorn exports.default = TopLeftCornerOverlay; /***/ }), -/* 303 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33027,15 +26604,15 @@ var _createClass = function () { function defineProperties(target, props) { for var _element = __webpack_require__(0); -var _border2 = __webpack_require__(250); +var _border2 = __webpack_require__(135); var _border3 = _interopRequireDefault(_border2); -var _coords = __webpack_require__(43); +var _coords = __webpack_require__(42); var _coords2 = _interopRequireDefault(_coords); -var _range = __webpack_require__(69); +var _range = __webpack_require__(68); var _range2 = _interopRequireDefault(_range); @@ -33287,7 +26864,7 @@ var Selection = function () { exports.default = Selection; /***/ }), -/* 304 */ +/* 189 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33310,7 +26887,7 @@ exports.default = { }; /***/ }), -/* 305 */ +/* 190 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33330,7 +26907,7 @@ exports.default = { }; /***/ }), -/* 306 */ +/* 191 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33354,7 +26931,7 @@ exports.default = { }; /***/ }), -/* 307 */ +/* 192 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33378,7 +26955,7 @@ exports.default = { }; /***/ }), -/* 308 */ +/* 193 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33399,7 +26976,7 @@ exports.default = { }; /***/ }), -/* 309 */ +/* 194 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33423,7 +27000,7 @@ exports.default = { }; /***/ }), -/* 310 */ +/* 195 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33446,7 +27023,7 @@ exports.default = { }; /***/ }), -/* 311 */ +/* 196 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33468,7 +27045,7 @@ exports.default = { }; /***/ }), -/* 312 */ +/* 197 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33492,7 +27069,7 @@ exports.default = { }; /***/ }), -/* 313 */ +/* 198 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33502,25 +27079,25 @@ exports.__esModule = true; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _SheetClip = __webpack_require__(248); +var _SheetClip = __webpack_require__(133); var _SheetClip2 = _interopRequireDefault(_SheetClip); -var _data = __webpack_require__(65); +var _data = __webpack_require__(64); -var _setting = __webpack_require__(66); +var _setting = __webpack_require__(65); var _object = __webpack_require__(1); var _array = __webpack_require__(2); -var _interval = __webpack_require__(386); +var _interval = __webpack_require__(271); var _interval2 = _interopRequireDefault(_interval); var _number = __webpack_require__(6); -var _multiMap = __webpack_require__(324); +var _multiMap = __webpack_require__(209); var _multiMap2 = _interopRequireDefault(_multiMap); @@ -33944,7 +27521,7 @@ DataMap.prototype.removeCol = function (index, amount, source) { * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed * @returns {Array} Returns removed portion of columns */ -DataMap.prototype.spliceCol = function (col, index, amount /* , elements...*/) { +DataMap.prototype.spliceCol = function (col, index, amount /* , elements... */) { var elements = arguments.length >= 4 ? [].slice.call(arguments, 3) : []; var colData = this.instance.getDataAtCol(col); @@ -33971,7 +27548,7 @@ DataMap.prototype.spliceCol = function (col, index, amount /* , elements...*/) { * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed. * @returns {Array} Returns removed portion of rows */ -DataMap.prototype.spliceRow = function (row, index, amount /* , elements...*/) { +DataMap.prototype.spliceRow = function (row, index, amount /* , elements... */) { var elements = arguments.length >= 4 ? [].slice.call(arguments, 3) : []; var rowData = this.instance.getSourceDataAtRow(row); @@ -34399,7 +27976,7 @@ DataMap.prototype.destroy = function () { exports.default = DataMap; /***/ }), -/* 314 */ +/* 199 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -34660,7 +28237,7 @@ var DataSource = function () { exports.default = DataSource; /***/ }), -/* 315 */ +/* 200 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -34680,7 +28257,7 @@ var _eventManager = __webpack_require__(4); var _eventManager2 = _interopRequireDefault(_eventManager); -var _baseEditor = __webpack_require__(37); +var _baseEditor = __webpack_require__(36); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -35091,7 +28668,7 @@ function EditorManager(instance, priv, selection) { exports.default = EditorManager; /***/ }), -/* 316 */ +/* 201 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35101,7 +28678,7 @@ exports.__esModule = true; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _baseEditor = __webpack_require__(37); +var _baseEditor = __webpack_require__(36); var _baseEditor2 = _interopRequireDefault(_baseEditor); @@ -35170,7 +28747,7 @@ var CheckboxEditor = function (_BaseEditor) { exports.default = CheckboxEditor; /***/ }), -/* 317 */ +/* 202 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35182,15 +28759,15 @@ var _createClass = function () { function defineProperties(target, props) { for var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; -var _moment = __webpack_require__(36); +var _moment = __webpack_require__(61); var _moment2 = _interopRequireDefault(_moment); -var _pikaday = __webpack_require__(419); +var _pikaday = __webpack_require__(302); var _pikaday2 = _interopRequireDefault(_pikaday); -__webpack_require__(411); +__webpack_require__(182); var _element = __webpack_require__(0); @@ -35204,7 +28781,7 @@ var _unicode = __webpack_require__(16); var _event = __webpack_require__(7); -var _textEditor = __webpack_require__(44); +var _textEditor = __webpack_require__(43); var _textEditor2 = _interopRequireDefault(_textEditor); @@ -35503,7 +29080,7 @@ var DateEditor = function (_TextEditor) { exports.default = DateEditor; /***/ }), -/* 318 */ +/* 203 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35515,7 +29092,7 @@ var _createClass = function () { function defineProperties(target, props) { for var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; -var _autocompleteEditor = __webpack_require__(263); +var _autocompleteEditor = __webpack_require__(148); var _autocompleteEditor2 = _interopRequireDefault(_autocompleteEditor); @@ -35572,7 +29149,7 @@ _pluginHooks2.default.getSingleton().add('beforeValidate', function (value, row, exports.default = DropdownEditor; /***/ }), -/* 319 */ +/* 204 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35586,7 +29163,7 @@ var _event = __webpack_require__(7); var _element = __webpack_require__(0); -var _baseEditor = __webpack_require__(37); +var _baseEditor = __webpack_require__(36); var _baseEditor2 = _interopRequireDefault(_baseEditor); @@ -35885,7 +29462,7 @@ MobileTextEditor.prototype.destroy = function () { exports.default = MobileTextEditor; /***/ }), -/* 320 */ +/* 205 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35897,11 +29474,11 @@ var _createClass = function () { function defineProperties(target, props) { for var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; -var _numbro = __webpack_require__(51); +var _numbro = __webpack_require__(87); var _numbro2 = _interopRequireDefault(_numbro); -var _textEditor = __webpack_require__(44); +var _textEditor = __webpack_require__(43); var _textEditor2 = _interopRequireDefault(_textEditor); @@ -35952,7 +29529,7 @@ var NumericEditor = function (_TextEditor) { exports.default = NumericEditor; /***/ }), -/* 321 */ +/* 206 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35966,7 +29543,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec var _element = __webpack_require__(0); -var _textEditor = __webpack_require__(44); +var _textEditor = __webpack_require__(43); var _textEditor2 = _interopRequireDefault(_textEditor); @@ -36016,7 +29593,7 @@ var PasswordEditor = function (_TextEditor) { exports.default = PasswordEditor; /***/ }), -/* 322 */ +/* 207 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36032,7 +29609,7 @@ var _event = __webpack_require__(7); var _unicode = __webpack_require__(16); -var _baseEditor = __webpack_require__(37); +var _baseEditor = __webpack_require__(36); var _baseEditor2 = _interopRequireDefault(_baseEditor); @@ -36284,7 +29861,7 @@ SelectEditor.prototype.getEditedCell = function () { exports.default = SelectEditor; /***/ }), -/* 323 */ +/* 208 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36346,7 +29923,7 @@ __webpack_require__(92); __webpack_require__(91); -__webpack_require__(68); +__webpack_require__(67); __webpack_require__(99); @@ -36378,11 +29955,11 @@ __webpack_require__(132); __webpack_require__(131); -__webpack_require__(294); +__webpack_require__(179); -__webpack_require__(295); +__webpack_require__(180); -__webpack_require__(296); +__webpack_require__(181); var _editors = __webpack_require__(14); @@ -36390,13 +29967,13 @@ var _renderers = __webpack_require__(9); var _validators = __webpack_require__(26); -var _cellTypes = __webpack_require__(63); +var _cellTypes = __webpack_require__(62); -var _core = __webpack_require__(64); +var _core = __webpack_require__(63); var _core2 = _interopRequireDefault(_core); -var _jquery = __webpack_require__(292); +var _jquery = __webpack_require__(177); var _jquery2 = _interopRequireDefault(_jquery); @@ -36408,7 +29985,7 @@ var _pluginHooks = __webpack_require__(8); var _pluginHooks2 = _interopRequireDefault(_pluginHooks); -var _ghostTable = __webpack_require__(67); +var _ghostTable = __webpack_require__(66); var _ghostTable2 = _interopRequireDefault(_ghostTable); @@ -36420,7 +29997,7 @@ var _browser = __webpack_require__(25); var browserHelpers = _interopRequireWildcard(_browser); -var _data = __webpack_require__(65); +var _data = __webpack_require__(64); var dataHelpers = _interopRequireWildcard(_data); @@ -36448,7 +30025,7 @@ var _object = __webpack_require__(1); var objectHelpers = _interopRequireWildcard(_object); -var _setting = __webpack_require__(66); +var _setting = __webpack_require__(65); var settingHelpers = _interopRequireWildcard(_setting); @@ -36468,7 +30045,7 @@ var _event = __webpack_require__(7); var domEventHelpers = _interopRequireWildcard(_event); -var _index = __webpack_require__(293); +var _index = __webpack_require__(178); var plugins = _interopRequireWildcard(_index); @@ -36497,9 +30074,9 @@ Handsontable.DefaultSettings = _defaultSettings2.default; Handsontable.EventManager = _eventManager2.default; Handsontable._getListenersCounter = _eventManager.getListenersCounter; // For MemoryLeak tests -Handsontable.buildDate = "2017-07-10T08:08:33.664Z"; +Handsontable.buildDate = "2017-07-27T11:34:25.509Z"; Handsontable.packageName = "handsontable"; -Handsontable.version = "0.33.0"; +Handsontable.version = "0.34.0"; var baseVersion = undefined; @@ -36603,7 +30180,7 @@ Handsontable.plugins.registerPlugin = _plugins.registerPlugin; module.exports = Handsontable; /***/ }), -/* 324 */ +/* 209 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36662,7 +30239,7 @@ function MultiMap() { exports.default = MultiMap; /***/ }), -/* 325 */ +/* 210 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36686,7 +30263,7 @@ var _feature = __webpack_require__(34); var _element = __webpack_require__(0); -var _ghostTable = __webpack_require__(67); +var _ghostTable = __webpack_require__(66); var _ghostTable2 = _interopRequireDefault(_ghostTable); @@ -36696,7 +30273,7 @@ var _number = __webpack_require__(6); var _plugins = __webpack_require__(5); -var _samplesGenerator = __webpack_require__(269); +var _samplesGenerator = __webpack_require__(154); var _samplesGenerator2 = _interopRequireDefault(_samplesGenerator); @@ -37339,7 +30916,7 @@ var AutoColumnSize = function (_BasePlugin) { exports.default = AutoColumnSize; /***/ }), -/* 326 */ +/* 211 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -37361,7 +30938,7 @@ var _feature = __webpack_require__(34); var _element = __webpack_require__(0); -var _ghostTable = __webpack_require__(67); +var _ghostTable = __webpack_require__(66); var _ghostTable2 = _interopRequireDefault(_ghostTable); @@ -37371,7 +30948,7 @@ var _number = __webpack_require__(6); var _plugins = __webpack_require__(5); -var _samplesGenerator = __webpack_require__(269); +var _samplesGenerator = __webpack_require__(154); var _samplesGenerator2 = _interopRequireDefault(_samplesGenerator); @@ -37988,7 +31565,7 @@ var AutoRowSize = function (_BasePlugin) { exports.default = AutoRowSize; /***/ }), -/* 327 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -38018,7 +31595,7 @@ var _plugins = __webpack_require__(5); var _src = __webpack_require__(11); -var _utils = __webpack_require__(328); +var _utils = __webpack_require__(213); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -38665,7 +32242,7 @@ var Autofill = function (_BasePlugin) { exports.default = Autofill; /***/ }), -/* 328 */ +/* 213 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -38817,7 +32394,7 @@ function getMappedFillHandleSetting(fillHandle) { } /***/ }), -/* 329 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -38831,7 +32408,7 @@ var _createClass = function () { function defineProperties(target, props) { for var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; -var _moment = __webpack_require__(36); +var _moment = __webpack_require__(61); var _moment2 = _interopRequireDefault(_moment); @@ -38849,7 +32426,7 @@ var _base2 = _interopRequireDefault(_base); var _plugins = __webpack_require__(5); -var _mergeSort = __webpack_require__(387); +var _mergeSort = __webpack_require__(272); var _mergeSort2 = _interopRequireDefault(_mergeSort); @@ -39619,7 +33196,7 @@ var ColumnSorting = function (_BasePlugin) { exports.default = ColumnSorting; /***/ }), -/* 330 */ +/* 215 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -39877,7 +33454,7 @@ var CommentEditor = function () { exports.default = CommentEditor; /***/ }), -/* 331 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -39905,17 +33482,17 @@ var _base = __webpack_require__(12); var _base2 = _interopRequireDefault(_base); -var _commentEditor = __webpack_require__(330); +var _commentEditor = __webpack_require__(215); var _commentEditor2 = _interopRequireDefault(_commentEditor); var _utils = __webpack_require__(17); -var _displaySwitch = __webpack_require__(332); +var _displaySwitch = __webpack_require__(217); var _displaySwitch2 = _interopRequireDefault(_displaySwitch); -__webpack_require__(412); +__webpack_require__(296); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -39975,7 +33552,7 @@ var META_READONLY = 'readOnly'; * var commentsPlugin = hot.getPlugin('comments'); * * // Manage comments programmatically: - * commentsPlugin.editor.setCommentAtCell(1, 6, 'Comment contents'); + * commentsPlugin.setCommentAtCell(1, 6, 'Comment contents'); * commentsPlugin.showAtCell(1, 6); * commentsPlugin.removeCommentAtCell(1, 6); * @@ -40843,7 +34420,7 @@ var Comments = function (_BasePlugin) { exports.default = Comments; /***/ }), -/* 332 */ +/* 217 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -40857,7 +34434,7 @@ var _function = __webpack_require__(35); var _object = __webpack_require__(1); -var _localHooks = __webpack_require__(70); +var _localHooks = __webpack_require__(69); var _localHooks2 = _interopRequireDefault(_localHooks); @@ -40986,7 +34563,7 @@ var DisplaySwitch = function () { exports.default = DisplaySwitch; /***/ }), -/* 333 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41118,7 +34695,7 @@ function findSubCommand(subCommandName, subCommands) { exports.default = CommandExecutor; /***/ }), -/* 334 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41140,7 +34717,7 @@ var _pluginHooks2 = _interopRequireDefault(_pluginHooks); var _array = __webpack_require__(2); -var _commandExecutor = __webpack_require__(333); +var _commandExecutor = __webpack_require__(218); var _commandExecutor2 = _interopRequireDefault(_commandExecutor); @@ -41148,11 +34725,11 @@ var _eventManager = __webpack_require__(4); var _eventManager2 = _interopRequireDefault(_eventManager); -var _itemsFactory = __webpack_require__(336); +var _itemsFactory = __webpack_require__(221); var _itemsFactory2 = _interopRequireDefault(_itemsFactory); -var _menu = __webpack_require__(337); +var _menu = __webpack_require__(222); var _menu2 = _interopRequireDefault(_menu); @@ -41162,9 +34739,9 @@ var _event = __webpack_require__(7); var _element = __webpack_require__(0); -var _predefinedItems = __webpack_require__(71); +var _predefinedItems = __webpack_require__(70); -__webpack_require__(413); +__webpack_require__(297); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -41536,7 +35113,7 @@ ContextMenu.SEPARATOR = { exports.default = ContextMenu; /***/ }), -/* 335 */ +/* 220 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41686,7 +35263,7 @@ var Cursor = function () { exports.default = Cursor; /***/ }), -/* 336 */ +/* 221 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41700,7 +35277,7 @@ var _object = __webpack_require__(1); var _array = __webpack_require__(2); -var _predefinedItems = __webpack_require__(71); +var _predefinedItems = __webpack_require__(70); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -41834,7 +35411,7 @@ function _getItems() { exports.default = ItemsFactory; /***/ }), -/* 337 */ +/* 222 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41844,7 +35421,7 @@ exports.__esModule = true; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _core = __webpack_require__(64); +var _core = __webpack_require__(63); var _core2 = _interopRequireDefault(_core); @@ -41852,7 +35429,7 @@ var _element = __webpack_require__(0); var _array = __webpack_require__(2); -var _cursor = __webpack_require__(335); +var _cursor = __webpack_require__(220); var _cursor2 = _interopRequireDefault(_cursor); @@ -41868,11 +35445,11 @@ var _utils = __webpack_require__(17); var _unicode = __webpack_require__(16); -var _localHooks = __webpack_require__(70); +var _localHooks = __webpack_require__(69); var _localHooks2 = _interopRequireDefault(_localHooks); -var _predefinedItems = __webpack_require__(71); +var _predefinedItems = __webpack_require__(70); var _event = __webpack_require__(7); @@ -42691,7 +36268,7 @@ var Menu = function () { exports.default = Menu; /***/ }), -/* 338 */ +/* 223 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -42703,7 +36280,7 @@ exports.default = alignmentItem; var _utils = __webpack_require__(17); -var _separator = __webpack_require__(72); +var _separator = __webpack_require__(71); var KEY = exports.KEY = 'alignment'; @@ -43003,7 +36580,7 @@ function alignmentItem() { } /***/ }), -/* 339 */ +/* 224 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43044,7 +36621,7 @@ function clearColumnItem() { } /***/ }), -/* 340 */ +/* 225 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43087,7 +36664,7 @@ function columnLeftItem() { } /***/ }), -/* 341 */ +/* 226 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43131,7 +36708,7 @@ function columnRightItem() { } /***/ }), -/* 342 */ +/* 227 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43182,7 +36759,7 @@ function readOnlyItem() { } /***/ }), -/* 343 */ +/* 228 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43207,7 +36784,7 @@ function redoItem() { } /***/ }), -/* 344 */ +/* 229 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43244,7 +36821,7 @@ function removeColumnItem() { } /***/ }), -/* 345 */ +/* 230 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43281,7 +36858,7 @@ function removeRowItem() { } /***/ }), -/* 346 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43315,7 +36892,7 @@ function rowAboveItem() { } /***/ }), -/* 347 */ +/* 232 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43349,7 +36926,7 @@ function rowBelowItem() { } /***/ }), -/* 348 */ +/* 233 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43374,7 +36951,7 @@ function undoItem() { } /***/ }), -/* 349 */ +/* 234 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43390,14 +36967,16 @@ function copyItem(copyPastePlugin) { copyPastePlugin.setCopyableText(); copyPastePlugin.copy(true); }, + disabled: function disabled() { + return !copyPastePlugin.hot.getSelected(); + }, - disabled: false, hidden: false }; } /***/ }), -/* 350 */ +/* 235 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43413,14 +36992,16 @@ function cutItem(copyPastePlugin) { copyPastePlugin.setCopyableText(); copyPastePlugin.cut(true); }, + disabled: function disabled() { + return !copyPastePlugin.hot.getSelected(); + }, - disabled: false, hidden: false }; } /***/ }), -/* 351 */ +/* 236 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43442,7 +37023,7 @@ var _pluginHooks = __webpack_require__(8); var _pluginHooks2 = _interopRequireDefault(_pluginHooks); -var _SheetClip = __webpack_require__(248); +var _SheetClip = __webpack_require__(133); var _SheetClip2 = _interopRequireDefault(_SheetClip); @@ -43460,15 +37041,15 @@ var _event = __webpack_require__(7); var _plugins = __webpack_require__(5); -var _textarea = __webpack_require__(352); +var _textarea = __webpack_require__(237); var _textarea2 = _interopRequireDefault(_textarea); -var _copy = __webpack_require__(349); +var _copy = __webpack_require__(234); var _copy2 = _interopRequireDefault(_copy); -var _cut = __webpack_require__(350); +var _cut = __webpack_require__(235); var _cut2 = _interopRequireDefault(_cut); @@ -43476,7 +37057,7 @@ var _eventManager = __webpack_require__(4); var _eventManager2 = _interopRequireDefault(_eventManager); -__webpack_require__(414); +__webpack_require__(298); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -43618,7 +37199,6 @@ var CopyPaste = function (_BasePlugin) { this.addHook('beforeKeyDown', function (event) { return _this2.onBeforeKeyDown(event); }); - // this.addHook('beforeOnCellMouseDown', () => this.onBeforeOnCellMouseDown()); this.registerEvents(); @@ -43652,7 +37232,7 @@ var CopyPaste = function (_BasePlugin) { } /** - * Prepares copyable text in the invisible textarea. + * Prepares copyable text from the cells selection in the invisible textarea. * * @function setCopyable * @memberof CopyPaste# @@ -43662,6 +37242,11 @@ var CopyPaste = function (_BasePlugin) { key: 'setCopyableText', value: function setCopyableText() { var selRange = this.hot.getSelectedRange(); + + if (!selRange) { + return; + } + var topLeft = selRange.getTopLeftCorner(); var bottomRight = selRange.getBottomRightCorner(); var startRow = topLeft.row; @@ -44074,7 +37659,7 @@ var CopyPaste = function (_BasePlugin) { exports.default = CopyPaste; /***/ }), -/* 352 */ +/* 237 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -44258,7 +37843,7 @@ var globalSingleton = new Textarea(); exports.default = Textarea; /***/ }), -/* 353 */ +/* 238 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -44808,7 +38393,7 @@ _pluginHooks2.default.getSingleton().add('afterInit', function () { }); /***/ }), -/* 354 */ +/* 239 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -44944,7 +38529,7 @@ _pluginHooks2.default.getSingleton().add('afterOnCellCornerMouseDown', function exports.default = DragToScroll; /***/ }), -/* 355 */ +/* 240 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -44980,7 +38565,7 @@ function freezeColumnItem(manualColumnFreezePlugin) { } /***/ }), -/* 356 */ +/* 241 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -45016,7 +38601,7 @@ function unfreezeColumnItem(manualColumnFreezePlugin) { } /***/ }), -/* 357 */ +/* 242 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -45036,15 +38621,15 @@ var _plugins = __webpack_require__(5); var _array = __webpack_require__(2); -var _freezeColumn = __webpack_require__(355); +var _freezeColumn = __webpack_require__(240); var _freezeColumn2 = _interopRequireDefault(_freezeColumn); -var _unfreezeColumn = __webpack_require__(356); +var _unfreezeColumn = __webpack_require__(241); var _unfreezeColumn2 = _interopRequireDefault(_unfreezeColumn); -__webpack_require__(415); +__webpack_require__(299); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -45347,7 +38932,7 @@ var ManualColumnFreeze = function (_BasePlugin) { exports.default = ManualColumnFreeze; /***/ }), -/* 358 */ +/* 243 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -45357,7 +38942,7 @@ exports.__esModule = true; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _arrayMapper = __webpack_require__(265); +var _arrayMapper = __webpack_require__(150); var _arrayMapper2 = _interopRequireDefault(_arrayMapper); @@ -45454,7 +39039,7 @@ var ColumnsMapper = function () { exports.default = ColumnsMapper; /***/ }), -/* 359 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -45486,21 +39071,21 @@ var _eventManager2 = _interopRequireDefault(_eventManager); var _plugins = __webpack_require__(5); -var _columnsMapper = __webpack_require__(358); +var _columnsMapper = __webpack_require__(243); var _columnsMapper2 = _interopRequireDefault(_columnsMapper); -var _backlight = __webpack_require__(360); +var _backlight = __webpack_require__(245); var _backlight2 = _interopRequireDefault(_backlight); -var _guideline = __webpack_require__(361); +var _guideline = __webpack_require__(246); var _guideline2 = _interopRequireDefault(_guideline); var _src = __webpack_require__(11); -__webpack_require__(416); +__webpack_require__(300); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -46363,7 +39948,7 @@ var ManualColumnMove = function (_BasePlugin) { exports.default = ManualColumnMove; /***/ }), -/* 360 */ +/* 245 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -46375,7 +39960,7 @@ var _createClass = function () { function defineProperties(target, props) { for var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; -var _base = __webpack_require__(266); +var _base = __webpack_require__(151); var _base2 = _interopRequireDefault(_base); @@ -46424,7 +40009,7 @@ var BacklightUI = function (_BaseUI) { exports.default = BacklightUI; /***/ }), -/* 361 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -46436,7 +40021,7 @@ var _createClass = function () { function defineProperties(target, props) { for var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; -var _base = __webpack_require__(266); +var _base = __webpack_require__(151); var _base2 = _interopRequireDefault(_base); @@ -46485,7 +40070,7 @@ var GuidelineUI = function (_BaseUI) { exports.default = GuidelineUI; /***/ }), -/* 362 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -47147,7 +40732,7 @@ var ManualColumnResize = function (_BasePlugin) { exports.default = ManualColumnResize; /***/ }), -/* 363 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -47179,21 +40764,21 @@ var _eventManager2 = _interopRequireDefault(_eventManager); var _plugins = __webpack_require__(5); -var _rowsMapper = __webpack_require__(364); +var _rowsMapper = __webpack_require__(249); var _rowsMapper2 = _interopRequireDefault(_rowsMapper); -var _backlight = __webpack_require__(365); +var _backlight = __webpack_require__(250); var _backlight2 = _interopRequireDefault(_backlight); -var _guideline = __webpack_require__(366); +var _guideline = __webpack_require__(251); var _guideline2 = _interopRequireDefault(_guideline); var _src = __webpack_require__(11); -__webpack_require__(417); +__webpack_require__(301); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -48081,7 +41666,7 @@ var ManualRowMove = function (_BasePlugin) { exports.default = ManualRowMove; /***/ }), -/* 364 */ +/* 249 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48091,7 +41676,7 @@ exports.__esModule = true; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _arrayMapper = __webpack_require__(265); +var _arrayMapper = __webpack_require__(150); var _arrayMapper2 = _interopRequireDefault(_arrayMapper); @@ -48188,7 +41773,7 @@ var RowsMapper = function () { exports.default = RowsMapper; /***/ }), -/* 365 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48200,7 +41785,7 @@ var _createClass = function () { function defineProperties(target, props) { for var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; -var _base = __webpack_require__(267); +var _base = __webpack_require__(152); var _base2 = _interopRequireDefault(_base); @@ -48249,7 +41834,7 @@ var BacklightUI = function (_BaseUI) { exports.default = BacklightUI; /***/ }), -/* 366 */ +/* 251 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48261,7 +41846,7 @@ var _createClass = function () { function defineProperties(target, props) { for var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; -var _base = __webpack_require__(267); +var _base = __webpack_require__(152); var _base2 = _interopRequireDefault(_base); @@ -48310,7 +41895,7 @@ var GuidelineUI = function (_BaseUI) { exports.default = GuidelineUI; /***/ }), -/* 367 */ +/* 252 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48895,7 +42480,7 @@ var ManualRowResize = function (_BasePlugin) { exports.default = ManualRowResize; /***/ }), -/* 368 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -49549,7 +43134,7 @@ hook.add('afterRemoveRow', onAfterRemoveRow); exports.default = MergeCells; /***/ }), -/* 369 */ +/* 254 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -49969,7 +43554,7 @@ var MultipleSelectionHandles = function (_BasePlugin) { exports.default = MultipleSelectionHandles; /***/ }), -/* 370 */ +/* 255 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -49979,17 +43564,17 @@ exports.__esModule = true; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _jsonPatchDuplex = __webpack_require__(249); +var _jsonPatchDuplex = __webpack_require__(134); var _jsonPatchDuplex2 = _interopRequireDefault(_jsonPatchDuplex); -var _localHooks = __webpack_require__(70); +var _localHooks = __webpack_require__(69); var _localHooks2 = _interopRequireDefault(_localHooks); var _object = __webpack_require__(1); -var _utils = __webpack_require__(372); +var _utils = __webpack_require__(257); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -50113,7 +43698,7 @@ var DataObserver = function () { exports.default = DataObserver; /***/ }), -/* 371 */ +/* 256 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -50129,11 +43714,11 @@ var _base = __webpack_require__(12); var _base2 = _interopRequireDefault(_base); -var _jsonPatchDuplex = __webpack_require__(249); +var _jsonPatchDuplex = __webpack_require__(134); var _jsonPatchDuplex2 = _interopRequireDefault(_jsonPatchDuplex); -var _dataObserver = __webpack_require__(370); +var _dataObserver = __webpack_require__(255); var _dataObserver2 = _interopRequireDefault(_dataObserver); @@ -50402,7 +43987,7 @@ exports.default = ObserveChanges; (0, _plugins.registerPlugin)('observeChanges', ObserveChanges); /***/ }), -/* 372 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -50494,7 +44079,7 @@ function parsePath(path) { } /***/ }), -/* 373 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -50653,7 +44238,7 @@ _pluginHooks2.default.getSingleton().add('afterUpdateSettings', htPersistentStat exports.default = HandsontablePersistentState; /***/ }), -/* 374 */ +/* 259 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -50799,7 +44384,7 @@ _pluginHooks2.default.getSingleton().add('afterUpdateSettings', init); exports.default = Search; /***/ }), -/* 375 */ +/* 260 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -51061,7 +44646,7 @@ var TouchScroll = function (_BasePlugin) { exports.default = TouchScroll; /***/ }), -/* 376 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -51713,7 +45298,7 @@ hook.register('beforeRedo'); hook.register('afterRedo'); /***/ }), -/* 377 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -51755,7 +45340,7 @@ function cellDecorator(instance, TD, row, col, prop, value, cellProperties) { exports.default = cellDecorator; /***/ }), -/* 378 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -51845,7 +45430,7 @@ function autocompleteRenderer(instance, TD, row, col, prop, value, cellPropertie exports.default = autocompleteRenderer; /***/ }), -/* 379 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52208,7 +45793,7 @@ function isCheckboxInput(element) { exports.default = checkboxRenderer; /***/ }), -/* 380 */ +/* 265 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52244,7 +45829,7 @@ function htmlRenderer(instance, TD, row, col, prop, value, cellProperties) { exports.default = htmlRenderer; /***/ }), -/* 381 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52252,7 +45837,7 @@ exports.default = htmlRenderer; exports.__esModule = true; -var _numbro = __webpack_require__(51); +var _numbro = __webpack_require__(87); var _numbro2 = _interopRequireDefault(_numbro); @@ -52305,7 +45890,7 @@ function numericRenderer(instance, TD, row, col, prop, value, cellProperties) { exports.default = numericRenderer; /***/ }), -/* 382 */ +/* 267 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52349,7 +45934,7 @@ function passwordRenderer(instance, TD, row, col, prop, value, cellProperties) { exports.default = passwordRenderer; /***/ }), -/* 383 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52406,7 +45991,7 @@ function textRenderer(instance, TD, row, col, prop, value, cellProperties) { exports.default = textRenderer; /***/ }), -/* 384 */ +/* 269 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53217,7 +46802,7 @@ TableView.prototype.destroy = function () { exports.default = TableView; /***/ }), -/* 385 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53528,7 +47113,7 @@ exports.NodeStructure = NodeStructure; exports.default = LinkedList; /***/ }), -/* 386 */ +/* 271 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53677,7 +47262,7 @@ function parseDelay(delay) { } /***/ }), -/* 387 */ +/* 272 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53687,7 +47272,7 @@ exports.__esModule = true; exports.default = mergeSort; exports.merge = merge; -var _linkedList = __webpack_require__(385); +var _linkedList = __webpack_require__(270); var _linkedList2 = _interopRequireDefault(_linkedList); @@ -53802,7 +47387,7 @@ function merge(array, compareFunction, startIndex, middleIndex, endIndex) { }; /***/ }), -/* 388 */ +/* 273 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53864,7 +47449,7 @@ function process(value, callback) { } /***/ }), -/* 389 */ +/* 274 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53874,7 +47459,7 @@ exports.__esModule = true; exports.default = dateValidator; exports.correctFormat = correctFormat; -var _moment = __webpack_require__(36); +var _moment = __webpack_require__(61); var _moment2 = _interopRequireDefault(_moment); @@ -53955,7 +47540,7 @@ function correctFormat(value, dateFormat) { }; /***/ }), -/* 390 */ +/* 275 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53985,7 +47570,7 @@ function numericValidator(value, callback) { }; /***/ }), -/* 391 */ +/* 276 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53994,7 +47579,7 @@ function numericValidator(value, callback) { exports.__esModule = true; exports.default = timeValidator; -var _moment = __webpack_require__(36); +var _moment = __webpack_require__(61); var _moment2 = _interopRequireDefault(_moment); @@ -54064,14 +47649,14 @@ function timeValidator(value, callback) { }; /***/ }), -/* 392 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) -var toObject = __webpack_require__(42) - , toIndex = __webpack_require__(61) +var toObject = __webpack_require__(41) + , toIndex = __webpack_require__(59) , toLength = __webpack_require__(24); module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){ @@ -54096,14 +47681,14 @@ module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, }; /***/ }), -/* 393 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) -var toObject = __webpack_require__(42) - , toIndex = __webpack_require__(61) +var toObject = __webpack_require__(41) + , toIndex = __webpack_require__(59) , toLength = __webpack_require__(24); module.exports = function fill(value /*, start = 0, end = @length */){ var O = toObject(this) @@ -54117,11 +47702,11 @@ module.exports = function fill(value /*, start = 0, end = @length */){ }; /***/ }), -/* 394 */ +/* 279 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(15) - , isArray = __webpack_require__(277) + , isArray = __webpack_require__(162) , SPECIES = __webpack_require__(10)('species'); module.exports = function(original){ @@ -54138,24 +47723,24 @@ module.exports = function(original){ }; /***/ }), -/* 395 */ +/* 280 */ /***/ (function(module, exports, __webpack_require__) { // 9.4.2.3 ArraySpeciesCreate(originalArray, length) -var speciesConstructor = __webpack_require__(394); +var speciesConstructor = __webpack_require__(279); module.exports = function(original, length){ return new (speciesConstructor(original))(length); }; /***/ }), -/* 396 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { // all enumerable object keys, includes symbols -var getKeys = __webpack_require__(40) - , gOPS = __webpack_require__(59) - , pIE = __webpack_require__(48); +var getKeys = __webpack_require__(39) + , gOPS = __webpack_require__(57) + , pIE = __webpack_require__(47); module.exports = function(it){ var result = getKeys(it) , getSymbols = gOPS.f; @@ -54169,7 +47754,7 @@ module.exports = function(it){ }; /***/ }), -/* 397 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -54188,11 +47773,11 @@ module.exports = function(){ }; /***/ }), -/* 398 */ +/* 283 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(15) - , setPrototypeOf = __webpack_require__(286).set; + , setPrototypeOf = __webpack_require__(171).set; module.exports = function(that, target, C){ var P, S = target.constructor; if(S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf){ @@ -54201,7 +47786,7 @@ module.exports = function(that, target, C){ }; /***/ }), -/* 399 */ +/* 284 */ /***/ (function(module, exports) { // fast apply, http://jsperf.lnkit.com/fast-apply/5 @@ -54222,14 +47807,14 @@ module.exports = function(fn, args, that){ }; /***/ }), -/* 400 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var create = __webpack_require__(80) - , descriptor = __webpack_require__(41) - , setToStringTag = __webpack_require__(49) +var create = __webpack_require__(79) + , descriptor = __webpack_require__(40) + , setToStringTag = __webpack_require__(48) , IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() @@ -54241,10 +47826,10 @@ module.exports = function(Constructor, NAME, next){ }; /***/ }), -/* 401 */ +/* 286 */ /***/ (function(module, exports, __webpack_require__) { -var getKeys = __webpack_require__(40) +var getKeys = __webpack_require__(39) , toIObject = __webpack_require__(23); module.exports = function(object, el){ var O = toIObject(object) @@ -54256,15 +47841,15 @@ module.exports = function(object, el){ }; /***/ }), -/* 402 */ +/* 287 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(13) - , macrotask = __webpack_require__(86).set + , macrotask = __webpack_require__(85).set , Observer = global.MutationObserver || global.WebKitMutationObserver , process = global.process , Promise = global.Promise - , isNode = __webpack_require__(39)(process) == 'process'; + , isNode = __webpack_require__(38)(process) == 'process'; module.exports = function(){ var head, last, notify; @@ -54329,12 +47914,12 @@ module.exports = function(){ }; /***/ }), -/* 403 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(19) , anObject = __webpack_require__(18) - , getKeys = __webpack_require__(40); + , getKeys = __webpack_require__(39); module.exports = __webpack_require__(21) ? Object.defineProperties : function defineProperties(O, Properties){ anObject(O); @@ -54347,12 +47932,12 @@ module.exports = __webpack_require__(21) ? Object.defineProperties : function de }; /***/ }), -/* 404 */ +/* 289 */ /***/ (function(module, exports, __webpack_require__) { // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window var toIObject = __webpack_require__(23) - , gOPN = __webpack_require__(82).f + , gOPN = __webpack_require__(81).f , toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames @@ -54372,13 +47957,13 @@ module.exports.f = function getOwnPropertyNames(it){ /***/ }), -/* 405 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var has = __webpack_require__(22) - , toObject = __webpack_require__(42) - , IE_PROTO = __webpack_require__(83)('IE_PROTO') + , toObject = __webpack_require__(41) + , IE_PROTO = __webpack_require__(82)('IE_PROTO') , ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function(O){ @@ -54390,12 +47975,12 @@ module.exports = Object.getPrototypeOf || function(O){ }; /***/ }), -/* 406 */ +/* 291 */ /***/ (function(module, exports, __webpack_require__) { // all object keys, includes non-enumerable and symbols -var gOPN = __webpack_require__(82) - , gOPS = __webpack_require__(59) +var gOPN = __webpack_require__(81) + , gOPS = __webpack_require__(57) , anObject = __webpack_require__(18) , Reflect = __webpack_require__(13).Reflect; module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){ @@ -54405,7 +47990,7 @@ module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){ }; /***/ }), -/* 407 */ +/* 292 */ /***/ (function(module, exports) { // 7.2.9 SameValue(x, y) @@ -54414,12 +47999,12 @@ module.exports = Object.is || function is(x, y){ }; /***/ }), -/* 408 */ +/* 293 */ /***/ (function(module, exports, __webpack_require__) { // 7.3.20 SpeciesConstructor(O, defaultConstructor) var anObject = __webpack_require__(18) - , aFunction = __webpack_require__(73) + , aFunction = __webpack_require__(72) , SPECIES = __webpack_require__(10)('species'); module.exports = function(O, D){ var C = anObject(O).constructor, S; @@ -54427,10 +48012,10 @@ module.exports = function(O, D){ }; /***/ }), -/* 409 */ +/* 294 */ /***/ (function(module, exports, __webpack_require__) { -var toInteger = __webpack_require__(62) +var toInteger = __webpack_require__(60) , defined = __webpack_require__(30); // true -> String#at // false -> String#codePointAt @@ -54449,13 +48034,13 @@ module.exports = function(TO_STRING){ }; /***/ }), -/* 410 */ +/* 295 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(13) - , core = __webpack_require__(45) - , LIBRARY = __webpack_require__(58) - , wksExt = __webpack_require__(290) + , core = __webpack_require__(44) + , LIBRARY = __webpack_require__(56) + , wksExt = __webpack_require__(175) , defineProperty = __webpack_require__(19).f; module.exports = function(name){ var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); @@ -54463,1526 +48048,48 @@ module.exports = function(name){ }; /***/ }), -/* 411 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), -/* 412 */ +/* 296 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 413 */ +/* 297 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 414 */ +/* 298 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 415 */ +/* 299 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 416 */ +/* 300 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 417 */ +/* 301 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 418 */ -/***/ (function(module, exports, __webpack_require__) { - -var map = { - "./af": 133, - "./af.js": 133, - "./ar": 140, - "./ar-dz": 134, - "./ar-dz.js": 134, - "./ar-kw": 135, - "./ar-kw.js": 135, - "./ar-ly": 136, - "./ar-ly.js": 136, - "./ar-ma": 137, - "./ar-ma.js": 137, - "./ar-sa": 138, - "./ar-sa.js": 138, - "./ar-tn": 139, - "./ar-tn.js": 139, - "./ar.js": 140, - "./az": 141, - "./az.js": 141, - "./be": 142, - "./be.js": 142, - "./bg": 143, - "./bg.js": 143, - "./bn": 144, - "./bn.js": 144, - "./bo": 145, - "./bo.js": 145, - "./br": 146, - "./br.js": 146, - "./bs": 147, - "./bs.js": 147, - "./ca": 148, - "./ca.js": 148, - "./cs": 149, - "./cs.js": 149, - "./cv": 150, - "./cv.js": 150, - "./cy": 151, - "./cy.js": 151, - "./da": 152, - "./da.js": 152, - "./de": 155, - "./de-at": 153, - "./de-at.js": 153, - "./de-ch": 154, - "./de-ch.js": 154, - "./de.js": 155, - "./dv": 156, - "./dv.js": 156, - "./el": 157, - "./el.js": 157, - "./en-au": 158, - "./en-au.js": 158, - "./en-ca": 159, - "./en-ca.js": 159, - "./en-gb": 160, - "./en-gb.js": 160, - "./en-ie": 161, - "./en-ie.js": 161, - "./en-nz": 162, - "./en-nz.js": 162, - "./eo": 163, - "./eo.js": 163, - "./es": 165, - "./es-do": 164, - "./es-do.js": 164, - "./es.js": 165, - "./et": 166, - "./et.js": 166, - "./eu": 167, - "./eu.js": 167, - "./fa": 168, - "./fa.js": 168, - "./fi": 169, - "./fi.js": 169, - "./fo": 170, - "./fo.js": 170, - "./fr": 173, - "./fr-ca": 171, - "./fr-ca.js": 171, - "./fr-ch": 172, - "./fr-ch.js": 172, - "./fr.js": 173, - "./fy": 174, - "./fy.js": 174, - "./gd": 175, - "./gd.js": 175, - "./gl": 176, - "./gl.js": 176, - "./gom-latn": 177, - "./gom-latn.js": 177, - "./he": 178, - "./he.js": 178, - "./hi": 179, - "./hi.js": 179, - "./hr": 180, - "./hr.js": 180, - "./hu": 181, - "./hu.js": 181, - "./hy-am": 182, - "./hy-am.js": 182, - "./id": 183, - "./id.js": 183, - "./is": 184, - "./is.js": 184, - "./it": 185, - "./it.js": 185, - "./ja": 186, - "./ja.js": 186, - "./jv": 187, - "./jv.js": 187, - "./ka": 188, - "./ka.js": 188, - "./kk": 189, - "./kk.js": 189, - "./km": 190, - "./km.js": 190, - "./kn": 191, - "./kn.js": 191, - "./ko": 192, - "./ko.js": 192, - "./ky": 193, - "./ky.js": 193, - "./lb": 194, - "./lb.js": 194, - "./lo": 195, - "./lo.js": 195, - "./lt": 196, - "./lt.js": 196, - "./lv": 197, - "./lv.js": 197, - "./me": 198, - "./me.js": 198, - "./mi": 199, - "./mi.js": 199, - "./mk": 200, - "./mk.js": 200, - "./ml": 201, - "./ml.js": 201, - "./mr": 202, - "./mr.js": 202, - "./ms": 204, - "./ms-my": 203, - "./ms-my.js": 203, - "./ms.js": 204, - "./my": 205, - "./my.js": 205, - "./nb": 206, - "./nb.js": 206, - "./ne": 207, - "./ne.js": 207, - "./nl": 209, - "./nl-be": 208, - "./nl-be.js": 208, - "./nl.js": 209, - "./nn": 210, - "./nn.js": 210, - "./pa-in": 211, - "./pa-in.js": 211, - "./pl": 212, - "./pl.js": 212, - "./pt": 214, - "./pt-br": 213, - "./pt-br.js": 213, - "./pt.js": 214, - "./ro": 215, - "./ro.js": 215, - "./ru": 216, - "./ru.js": 216, - "./sd": 217, - "./sd.js": 217, - "./se": 218, - "./se.js": 218, - "./si": 219, - "./si.js": 219, - "./sk": 220, - "./sk.js": 220, - "./sl": 221, - "./sl.js": 221, - "./sq": 222, - "./sq.js": 222, - "./sr": 224, - "./sr-cyrl": 223, - "./sr-cyrl.js": 223, - "./sr.js": 224, - "./ss": 225, - "./ss.js": 225, - "./sv": 226, - "./sv.js": 226, - "./sw": 227, - "./sw.js": 227, - "./ta": 228, - "./ta.js": 228, - "./te": 229, - "./te.js": 229, - "./tet": 230, - "./tet.js": 230, - "./th": 231, - "./th.js": 231, - "./tl-ph": 232, - "./tl-ph.js": 232, - "./tlh": 233, - "./tlh.js": 233, - "./tr": 234, - "./tr.js": 234, - "./tzl": 235, - "./tzl.js": 235, - "./tzm": 237, - "./tzm-latn": 236, - "./tzm-latn.js": 236, - "./tzm.js": 237, - "./uk": 238, - "./uk.js": 238, - "./ur": 239, - "./ur.js": 239, - "./uz": 241, - "./uz-latn": 240, - "./uz-latn.js": 240, - "./uz.js": 241, - "./vi": 242, - "./vi.js": 242, - "./x-pseudo": 243, - "./x-pseudo.js": 243, - "./yo": 244, - "./yo.js": 244, - "./zh-cn": 245, - "./zh-cn.js": 245, - "./zh-hk": 246, - "./zh-hk.js": 246, - "./zh-tw": 247, - "./zh-tw.js": 247 -}; -function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); -}; -function webpackContextResolve(req) { - var id = map[req]; - if(!(id + 1)) // check for number or string - throw new Error("Cannot find module '" + req + "'."); - return id; -}; -webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); -}; -webpackContext.resolve = webpackContextResolve; -module.exports = webpackContext; -webpackContext.id = 418; - -/***/ }), -/* 419 */ -/***/ (function(module, exports, __webpack_require__) { - -/*! - * Pikaday - * - * Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday - */ - -(function (root, factory) -{ - 'use strict'; - - var moment; - if (true) { - // CommonJS module - // Load moment.js as an optional dependency - try { moment = __webpack_require__(36); } catch (e) {} - module.exports = factory(moment); - } else if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(function (req) - { - // Load moment.js as an optional dependency - var id = 'moment'; - try { moment = req(id); } catch (e) {} - return factory(moment); - }); - } else { - root.Pikaday = factory(root.moment); - } -}(this, function (moment) -{ - 'use strict'; - - /** - * feature detection and helper functions - */ - var hasMoment = typeof moment === 'function', - - hasEventListeners = !!window.addEventListener, - - document = window.document, - - sto = window.setTimeout, - - addEvent = function(el, e, callback, capture) - { - if (hasEventListeners) { - el.addEventListener(e, callback, !!capture); - } else { - el.attachEvent('on' + e, callback); - } - }, - - removeEvent = function(el, e, callback, capture) - { - if (hasEventListeners) { - el.removeEventListener(e, callback, !!capture); - } else { - el.detachEvent('on' + e, callback); - } - }, - - fireEvent = function(el, eventName, data) - { - var ev; - - if (document.createEvent) { - ev = document.createEvent('HTMLEvents'); - ev.initEvent(eventName, true, false); - ev = extend(ev, data); - el.dispatchEvent(ev); - } else if (document.createEventObject) { - ev = document.createEventObject(); - ev = extend(ev, data); - el.fireEvent('on' + eventName, ev); - } - }, - - trim = function(str) - { - return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g,''); - }, - - hasClass = function(el, cn) - { - return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1; - }, - - addClass = function(el, cn) - { - if (!hasClass(el, cn)) { - el.className = (el.className === '') ? cn : el.className + ' ' + cn; - } - }, - - removeClass = function(el, cn) - { - el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' ')); - }, - - isArray = function(obj) - { - return (/Array/).test(Object.prototype.toString.call(obj)); - }, - - isDate = function(obj) - { - return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()); - }, - - isWeekend = function(date) - { - var day = date.getDay(); - return day === 0 || day === 6; - }, - - isLeapYear = function(year) - { - // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 - return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; - }, - - getDaysInMonth = function(year, month) - { - return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; - }, - - setToStartOfDay = function(date) - { - if (isDate(date)) date.setHours(0,0,0,0); - }, - - compareDates = function(a,b) - { - // weak date comparison (use setToStartOfDay(date) to ensure correct result) - return a.getTime() === b.getTime(); - }, - - extend = function(to, from, overwrite) - { - var prop, hasProp; - for (prop in from) { - hasProp = to[prop] !== undefined; - if (hasProp && typeof from[prop] === 'object' && from[prop] !== null && from[prop].nodeName === undefined) { - if (isDate(from[prop])) { - if (overwrite) { - to[prop] = new Date(from[prop].getTime()); - } - } - else if (isArray(from[prop])) { - if (overwrite) { - to[prop] = from[prop].slice(0); - } - } else { - to[prop] = extend({}, from[prop], overwrite); - } - } else if (overwrite || !hasProp) { - to[prop] = from[prop]; - } - } - return to; - }, - - adjustCalendar = function(calendar) { - if (calendar.month < 0) { - calendar.year -= Math.ceil(Math.abs(calendar.month)/12); - calendar.month += 12; - } - if (calendar.month > 11) { - calendar.year += Math.floor(Math.abs(calendar.month)/12); - calendar.month -= 12; - } - return calendar; - }, - - /** - * defaults and localisation - */ - defaults = { - - // bind the picker to a form field - field: null, - - // automatically show/hide the picker on `field` focus (default `true` if `field` is set) - bound: undefined, - - // position of the datepicker, relative to the field (default to bottom & left) - // ('bottom' & 'left' keywords are not used, 'top' & 'right' are modifier on the bottom/left position) - position: 'bottom left', - - // automatically fit in the viewport even if it means repositioning from the position option - reposition: true, - - // the default output format for `.toString()` and `field` value - format: 'YYYY-MM-DD', - - // the initial date to view when first opened - defaultDate: null, - - // make the `defaultDate` the initial selected value - setDefaultDate: false, - - // first day of week (0: Sunday, 1: Monday etc) - firstDay: 0, - - // the default flag for moment's strict date parsing - formatStrict: false, - - // the minimum/earliest date that can be selected - minDate: null, - // the maximum/latest date that can be selected - maxDate: null, - - // number of years either side, or array of upper/lower range - yearRange: 10, - - // show week numbers at head of row - showWeekNumber: false, - - // used internally (don't config outside) - minYear: 0, - maxYear: 9999, - minMonth: undefined, - maxMonth: undefined, - - startRange: null, - endRange: null, - - isRTL: false, - - // Additional text to append to the year in the calendar title - yearSuffix: '', - - // Render the month after year in the calendar title - showMonthAfterYear: false, - - // Render days of the calendar grid that fall in the next or previous month - showDaysInNextAndPreviousMonths: false, - - // how many months are visible - numberOfMonths: 1, - - // when numberOfMonths is used, this will help you to choose where the main calendar will be (default `left`, can be set to `right`) - // only used for the first display or when a selected date is not visible - mainCalendar: 'left', - - // Specify a DOM element to render the calendar in - container: undefined, - - // internationalization - i18n: { - previousMonth : 'Previous Month', - nextMonth : 'Next Month', - months : ['January','February','March','April','May','June','July','August','September','October','November','December'], - weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], - weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] - }, - - // Theme Classname - theme: null, - - // callback function - onSelect: null, - onOpen: null, - onClose: null, - onDraw: null - }, - - - /** - * templating functions to abstract HTML rendering - */ - renderDayName = function(opts, day, abbr) - { - day += opts.firstDay; - while (day >= 7) { - day -= 7; - } - return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day]; - }, - - renderDay = function(opts) - { - var arr = []; - var ariaSelected = 'false'; - if (opts.isEmpty) { - if (opts.showDaysInNextAndPreviousMonths) { - arr.push('is-outside-current-month'); - } else { - return '