diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 2e39a4b2..b7a2d8da 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.4.0 by Max Guglielmi - * build date: 2016-10-22T00:13:26.267Z + * build date: 2016-10-22T08:31:21.864Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 6f627184..add39c19 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.4.0 by Max Guglielmi - * build date: 2016-10-22T00:13:26.267Z + * build date: 2016-10-22T08:31:21.864Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 231d0c30..de7dbb89 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.4.0 by Max Guglielmi - * build date: 2016-10-22T00:13:26.267Z + * build date: 2016-10-22T08:31:21.864Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index c4c3285d..453d5f1a 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.4.0 by Max Guglielmi - * build date: 2016-10-22T00:13:26.267Z + * build date: 2016-10-22T08:31:21.864Z * MIT License */ table.TF{border-left:1px solid #ccc;border-top:none;border-right:none;border-bottom:none;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x;border-bottom:1px solid #d0d0d0;border-right:1px solid #d0d0d0;border-left:1px solid #fff;border-top:1px solid #fff;color:#333}table.TF td{border-bottom:1px dotted #999;padding:5px}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.activeHeader{background:#999 !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 5304ab44..e2830a17 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.4.0 by Max Guglielmi - * build date: 2016-10-22T00:13:26.267Z + * build date: 2016-10-22T08:31:21.864Z * MIT License */ table.TF{border-left:1px dotted #81963b;border-top:none;border-right:0;border-bottom:none;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x;border-bottom:0;border-right:1px dotted #d0d0d0;border-left:0;border-top:0;color:#fff}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.activeHeader{background:#81963b !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 879240c3..c8fba33c 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.4.0 by Max Guglielmi - * build date: 2016-10-22T00:13:26.267Z + * build date: 2016-10-22T08:31:21.864Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 278a8ae7..71e4d0d3 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,21381 +1,13 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else { - var a = factory(); - for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; - } -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // install a JSONP callback for chunk loading -/******/ var parentJsonpFunction = window["webpackJsonp"]; -/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, callbacks = []; -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(installedChunks[chunkId]) -/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); -/******/ while(callbacks.length) -/******/ callbacks.shift().call(null, __webpack_require__); -/******/ -/******/ }; -/******/ -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // object to store loaded and loading chunks -/******/ // "0" means "already loaded" -/******/ // Array means "loading", array contains callbacks -/******/ var installedChunks = { -/******/ 0:0 -/******/ }; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ // This file contains only the entry chunk. -/******/ // The chunk loading function for additional chunks -/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { -/******/ // "0" is the signal for "already loaded" -/******/ if(installedChunks[chunkId] === 0) -/******/ return callback.call(null, __webpack_require__); -/******/ -/******/ // an array means "currently loading". -/******/ if(installedChunks[chunkId] !== undefined) { -/******/ installedChunks[chunkId].push(callback); -/******/ } else { -/******/ // start chunk loading -/******/ installedChunks[chunkId] = [callback]; -/******/ var head = document.getElementsByTagName('head')[0]; -/******/ var script = document.createElement('script'); -/******/ script.type = 'text/javascript'; -/******/ script.charset = 'utf-8'; -/******/ script.async = true; -/******/ -/******/ script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js"; -/******/ head.appendChild(script); -/******/ } -/******/ }; -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.TableFilter = undefined; - - 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 _event = __webpack_require__(1); - - var _dom = __webpack_require__(3); - - var _string = __webpack_require__(5); - - var _types = __webpack_require__(4); - - var _number = __webpack_require__(7); - - var _root = __webpack_require__(2); - - var _emitter = __webpack_require__(8); - - var _gridLayout = __webpack_require__(9); - - var _loader = __webpack_require__(12); - - var _highlightKeywords = __webpack_require__(13); - - var _popupFilter = __webpack_require__(14); - - var _dropdown = __webpack_require__(15); - - var _checkList = __webpack_require__(18); - - var _rowsCounter = __webpack_require__(19); - - var _statusBar = __webpack_require__(20); - - var _paging = __webpack_require__(21); - - var _clearButton = __webpack_require__(22); - - var _help = __webpack_require__(23); - - var _alternateRows = __webpack_require__(24); - - var _noResults = __webpack_require__(25); - - var _state = __webpack_require__(26); - - var _dateType = __webpack_require__(30); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var doc = _root.root.document; - - /** - * Makes HTML tables filterable and a bit more :) - * - * @export - * @class TableFilter - */ - - var TableFilter = exports.TableFilter = function () { - - /** - * Creates an instance of TableFilter - * requires `table` or `id` arguments, `row` and `configuration` optional - * @param {DOMElement} table Table DOM element - * @param {String} id Table id - * @param {Number} row index indicating the 1st row - * @param {Object} configuration object - */ - function TableFilter() { - var _this = this; - - _classCallCheck(this, TableFilter); - - /** - * ID of current instance - * @type {String} - * @private - */ - this.id = null; - - /** - * Current version - * @type {String} - */ - this.version = '0.4.0'; - - /** - * Current year - * @type {Number} - * @private - */ - this.year = new Date().getFullYear(); - - /** - * HTML Table DOM element - * @type {DOMElement} - */ - this.tbl = null; - - /** - * Calculated row's index from which starts filtering once filters - * are generated - * @type {Number} - */ - this.refRow = null; - - /** - * Index of the headers row - * @type {Number} - * @private - */ - this.headersRow = null; - - /** - * Configuration object - * @type {Object} - * @private - */ - this.cfg = {}; - - /** - * Number of rows that can be filtered - * @type {Number} - * @private - */ - this.nbFilterableRows = 0; - - /** - * Number of cells in the reference row - * @type {Number} - * @private - */ - this.nbCells = null; - - var startRow = void 0; - - // TODO: use for-of - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - args.forEach(function (arg) { - if ((typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object' && arg.nodeName === 'TABLE') { - _this.tbl = arg; - _this.id = arg.id || 'tf_' + new Date().getTime() + '_'; - } else if ((0, _types.isString)(arg)) { - _this.id = arg; - _this.tbl = (0, _dom.elm)(arg); - } else if ((0, _types.isNumber)(arg)) { - startRow = arg; - } else if ((0, _types.isObj)(arg)) { - _this.cfg = arg; - } - }); - - if (!this.tbl || this.tbl.nodeName !== 'TABLE' || this.getRowsNb() === 0) { - throw new Error('Could not instantiate TableFilter: HTML table\n DOM element not found.'); - } - - // configuration object - var f = this.cfg; - - /** - * Event emitter instance - * @type {Emitter} - */ - this.emitter = new _emitter.Emitter(); - - //Start row et cols nb - this.refRow = (0, _types.isUndef)(startRow) ? 2 : startRow + 1; - try { - this.nbCells = this.getCellsNb(this.refRow); - } catch (e) { - this.nbCells = this.getCellsNb(0); - } - - /** - * Base path for static assets - * @type {String} - */ - this.basePath = f.base_path || 'tablefilter/'; - - /*** filters' grid properties ***/ - - /** - * Enable/disable filters - * @type {Boolean} - */ - this.fltGrid = f.grid === false ? false : true; - - /** - * Enable/disable grid layout (fixed headers) - * @type {Boolean} - */ - this.gridLayout = Boolean(f.grid_layout); - - /** - * Filters row index - * @type {Number} - */ - this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index; - - /** - * Headers row index - * @type {Number} - */ - this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index; - - /** - * Define the type of cell containing a filter (td/th) - * @type {String} - */ - this.fltCellTag = (0, _types.isString)(f.filters_cell_tag) ? f.filters_cell_tag : _const.CELL_TAG; - - /** - * List of filters IDs - * @type {Array} - * @private - */ - this.fltIds = []; - - /** - * List of valid rows indexes (rows visible upon filtering) - * @type {Array} - * @private - */ - this.validRowsIndex = []; - - /** - * Toolbar's container DOM element - * @type {DOMElement} - * @private - */ - this.infDiv = null; - - /** - * Left-side inner container DOM element (rows counter in toolbar) - * @type {DOMElement} - * @private - */ - this.lDiv = null; - - /** - * Right-side inner container DOM element (reset button, - * page length selector in toolbar) - * @type {DOMElement} - * @private - */ - this.rDiv = null; - - /** - * Middle inner container DOM element (paging elements in toolbar) - * @type {DOMElement} - * @private - */ - this.mDiv = null; - - /** - * Css class for toolbar's container DOM element - * @type {String} - */ - this.infDivCssClass = f.inf_div_css_class || 'inf'; - - /** - * Css class for left-side inner container DOM element - * @type {String} - */ - this.lDivCssClass = f.left_div_css_class || 'ldiv'; - - /** - * Css class for right-side inner container DOM element - * @type {String} - */ - this.rDivCssClass = f.right_div_css_class || 'rdiv'; - - /** - * Css class for middle inner container DOM element - * @type {String} - */ - this.mDivCssClass = f.middle_div_css_class || 'mdiv'; - - /*** filters' grid appearance ***/ - /** - * Path for stylesheets - * @type {String} - */ - this.stylePath = f.style_path || this.basePath + 'style/'; - - /** - * Main stylesheet path - * @type {String} - */ - this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.css'; - - /** - * Main stylesheet ID - * @type {String} - * @private - */ - this.stylesheetId = this.id + '_style'; - - /** - * Css class for the filters row - * @type {String} - */ - this.fltsRowCssClass = f.flts_row_css_class || 'fltrow'; - - /** - * Enable/disable icons (paging, reset button) - * @type {Boolean} - */ - this.enableIcons = f.enable_icons === false ? false : true; - - /** - * Enable/disable alternating rows - * @type {Boolean} - */ - this.alternateRows = Boolean(f.alternate_rows); - - /** - * Indicate whether columns widths are set - * @type {Boolean} - * @private - */ - this.hasColWidths = (0, _types.isArray)(f.col_widths); - - /** - * Columns widths array - * @type {Array} - */ - this.colWidths = this.hasColWidths ? f.col_widths : []; - - /** - * Css class for a filter element - * @type {String} - */ - this.fltCssClass = f.flt_css_class || 'flt'; - - /** - * Css class for multiple select filters - * @type {String} - */ - this.fltMultiCssClass = f.flt_multi_css_class || 'flt_multi'; - - /** - * Css class for small filter (when submit button is active) - * @type {String} - */ - this.fltSmallCssClass = f.flt_small_css_class || 'flt_s'; - - /** - * Css class for single filter type - * @type {String} - */ - this.singleFltCssClass = f.single_flt_css_class || 'single_flt'; - - /*** filters' grid behaviours ***/ - - /** - * Enable/disable enter key for input type filters - * @type {Boolean} - */ - this.enterKey = f.enter_key === false ? false : true; - - /** - * Callback fired before filtering process starts - * @type {Function} - */ - this.onBeforeFilter = (0, _types.isFn)(f.on_before_filter) ? f.on_before_filter : null; - - /** - * Callback fired after filtering process is completed - * @type {Function} - */ - this.onAfterFilter = (0, _types.isFn)(f.on_after_filter) ? f.on_after_filter : null; - - /** - * Enable/disable case sensitivity filtering - * @type {Boolean} - */ - this.caseSensitive = Boolean(f.case_sensitive); - - /** - * Indicate whether exact match filtering is enabled on a per column - * basis - * @type {Boolean} - * @private - */ - this.hasExactMatchByCol = (0, _types.isArray)(f.columns_exact_match); - - /** - * Exact match filtering per column array - * @type {Array} - */ - this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : []; - - /** - * Globally enable/disable exact match filtering - * @type {Boolean} - */ - this.exactMatch = Boolean(f.exact_match); - - /** - * Ignore diacritics globally or on a column basis - * @type {Boolean|Array} - */ - this.ignoreDiacritics = f.ignore_diacritics; - - /** - * Enable/disable linked filters filtering mode - * @type {Boolean} - */ - this.linkedFilters = Boolean(f.linked_filters); - - /** - * Enable/disable readonly state for excluded options when - * linked filters filtering mode is on - * @type {Boolean} - */ - this.disableExcludedOptions = Boolean(f.disable_excluded_options); - - /** - * Active filter ID - * @type {String} - * @private - */ - this.activeFilterId = null; - - /** - * Enable/disable always visible rows, excluded from filtering - * @type {Boolean} - */ - this.hasVisibleRows = Boolean(f.rows_always_visible); - - /** - * List of row indexes to be excluded from filtering - * @type {Array} - */ - this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; - - /** - * Enable/disable external filters generation - * @type {Boolean} - */ - this.isExternalFlt = Boolean(f.external_flt_grid); - - /** - * List of containers IDs where external filters will be generated - * @type {Array} - */ - this.externalFltTgtIds = f.external_flt_grid_ids || []; - - /** - * Callback fired after filters are generated - * @type {Function} - */ - this.onFiltersLoaded = (0, _types.isFn)(f.on_filters_loaded) ? f.on_filters_loaded : null; - - /** - * Enable/disable single filter filtering all columns - * @type {Boolean} - */ - this.singleSearchFlt = Boolean(f.single_filter); - - /** - * Callback fired after a row is validated during filtering - * @type {Function} - */ - this.onRowValidated = (0, _types.isFn)(f.on_row_validated) ? f.on_row_validated : null; - - /** - * List of columns implementing custom filtering - * @type {Array} - */ - this.customCellDataCols = f.custom_cell_data_cols ? f.custom_cell_data_cols : []; - - /** - * Delegate function for retrieving cell data with custom logic - * @type {Function} - */ - this.customCellData = (0, _types.isFn)(f.custom_cell_data) ? f.custom_cell_data : null; - - /** - * Global watermark text for input filter type or watermark for each - * filter if an array is supplied - * @type {String|Array} - */ - this.watermark = f.watermark || ''; - - /** - * Indicate whether watermark is on a per column basis - * @type {Boolean} - * @private - */ - this.isWatermarkArray = (0, _types.isArray)(this.watermark); - - /** - * Toolbar's custom container ID - * @type {String} - */ - this.toolBarTgtId = f.toolbar_target_id || null; - - /** - * Indicate whether help UI component is disabled - * @type {Boolean} - */ - this.help = (0, _types.isUndef)(f.help_instructions) ? undefined : Boolean(f.help_instructions); - - /** - * Indicate whether pop-up filters UI is enabled - * @type {Boolean} - */ - this.popupFilters = Boolean(f.popup_filters); - - /** - * Indicate whether filtered (active) columns indicator is enabled - * @type {Boolean} - */ - this.markActiveColumns = Boolean(f.mark_active_columns); - - /** - * Css class for filtered (active) columns - * @type {String} - */ - this.activeColumnsCssClass = f.active_columns_css_class || 'activeHeader'; - - /** - * Callback fired before a column is marked as filtered - * @type {Function} - */ - this.onBeforeActiveColumn = (0, _types.isFn)(f.on_before_active_column) ? f.on_before_active_column : null; - - /** - * Callback fired after a column is marked as filtered - * @type {Function} - */ - this.onAfterActiveColumn = (0, _types.isFn)(f.on_after_active_column) ? f.on_after_active_column : null; - - /*** select filter's customisation and behaviours ***/ - /** - * Text for clear option in drop-down filter types (1st option) - * @type {String} - */ - this.displayAllText = f.display_all_text || 'Clear'; - - /** - * Indicate whether empty option is enabled in drop-down filter types - * @type {Boolean} - */ - this.enableEmptyOption = Boolean(f.enable_empty_option); - - /** - * Text for empty option in drop-down filter types - * @type {String} - */ - this.emptyText = f.empty_text || '(Empty)'; - - /** - * Indicate whether non-empty option is enabled in drop-down filter - * types - * @type {Boolean} - */ - this.enableNonEmptyOption = Boolean(f.enable_non_empty_option); - - /** - * Text for non-empty option in drop-down filter types - * @type {String} - */ - this.nonEmptyText = f.non_empty_text || '(Non empty)'; - - /** - * Indicate whether drop-down filter types filter the table by default - * on change event - * @type {Boolean} - */ - this.onSlcChange = f.on_change === false ? false : true; - - /** - * Indicate whether options in drop-down filter types are sorted in a - * alpha-numeric manner by default - * @type {Boolean} - */ - this.sortSlc = f.sort_select === false ? false : true; - - /** - * Indicate whether options in drop-down filter types are sorted in a - * ascending numeric manner - * @type {Boolean} - * @private - */ - this.isSortNumAsc = Boolean(f.sort_num_asc); - - /** - * List of columns implementing options sorting in a ascending numeric - * manner - * @type {Array} - */ - this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : []; - - /** - * Indicate whether options in drop-down filter types are sorted in a - * descending numeric manner - * @type {Boolean} - * @private - */ - this.isSortNumDesc = Boolean(f.sort_num_desc); - - /** - * List of columns implementing options sorting in a descending numeric - * manner - * @type {Array} - */ - this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : []; - - /** - * Indicate whether drop-down filter types are populated on demand at - * first usage - * @type {Boolean} - */ - this.loadFltOnDemand = Boolean(f.load_filters_on_demand); - - /** - * Indicate whether custom drop-down filter options are implemented - * @type {Boolean} - */ - this.hasCustomOptions = (0, _types.isObj)(f.custom_options); - - /** - * Custom options definition of a per column basis, ie: - * custom_options: { - * cols:[0, 1], - * texts: [ - * ['a0', 'b0', 'c0'], - * ['a1', 'b1', 'c1'] - * ], - * values: [ - * ['a0', 'b0', 'c0'], - * ['a1', 'b1', 'c1'] - * ], - * sorts: [false, true] - * } - * - * @type {Object} - */ - this.customOptions = f.custom_options; - - /*** Filter operators ***/ - /** - * Regular expression operator for input filter. Defaults to 'rgx:' - * @type {String} - */ - this.rgxOperator = f.regexp_operator || 'rgx:'; - - /** - * Empty cells operator for input filter. Defaults to '[empty]' - * @type {String} - */ - this.emOperator = f.empty_operator || '[empty]'; - - /** - * Non-empty cells operator for input filter. Defaults to '[nonempty]' - * @type {String} - */ - this.nmOperator = f.nonempty_operator || '[nonempty]'; - - /** - * Logical OR operator for input filter. Defaults to '||' - * @type {String} - */ - this.orOperator = f.or_operator || '||'; - - /** - * Logical AND operator for input filter. Defaults to '&&' - * @type {String} - */ - this.anOperator = f.and_operator || '&&'; - - /** - * Greater than operator for input filter. Defaults to '>' - * @type {String} - */ - this.grOperator = f.greater_operator || '>'; - - /** - * Lower than operator for input filter. Defaults to '<' - * @type {String} - */ - this.lwOperator = f.lower_operator || '<'; - - /** - * Lower than or equal operator for input filter. Defaults to '<=' - * @type {String} - */ - this.leOperator = f.lower_equal_operator || '<='; - - /** - * Greater than or equal operator for input filter. Defaults to '>=' - * @type {String} - */ - this.geOperator = f.greater_equal_operator || '>='; - - /** - * Inequality operator for input filter. Defaults to '!' - * @type {String} - */ - this.dfOperator = f.different_operator || '!'; - - /** - * Like operator for input filter. Defaults to '!' - * @type {String} - */ - this.lkOperator = f.like_operator || '*'; - - /** - * Strict equality operator for input filter. Defaults to '=' - * @type {String} - */ - this.eqOperator = f.equal_operator || '='; - - /** - * Starts with operator for input filter. Defaults to '=' - * @type {String} - */ - this.stOperator = f.start_with_operator || '{'; - - /** - * Ends with operator for input filter. Defaults to '=' - * @type {String} - */ - this.enOperator = f.end_with_operator || '}'; - - // this.curExp = f.cur_exp || '^[¥£€$]'; - - /** - * Stored values separator - * @type {String} - */ - this.separator = f.separator || ','; - - /** - * Enable rows counter UI component - * @type {Boolean} - */ - this.rowsCounter = Boolean(f.rows_counter); - - /** - * Enable status bar UI component - * @type {Boolean} - */ - this.statusBar = Boolean(f.status_bar); - - /** - * Enable activity/spinner indicator UI component - * @type {Boolean} - */ - this.loader = Boolean(f.loader); - - /*** validation - reset buttons/links ***/ - /** - * Enable filters submission button - * @type {Boolean} - */ - this.displayBtn = Boolean(f.btn); - - /** - * Define filters submission button text - * @type {String} - */ - this.btnText = f.btn_text || (!this.enableIcons ? 'Go' : ''); - - /** - * Css class for filters submission button - * @type {String} - */ - this.btnCssClass = f.btn_css_class || (!this.enableIcons ? 'btnflt' : 'btnflt_icon'); - - /** - * Enable clear button - * @type {Boolean} - */ - this.btnReset = Boolean(f.btn_reset); - - /** - * Callback fired before filters are cleared - * @type {Function} - */ - this.onBeforeReset = (0, _types.isFn)(f.on_before_reset) ? f.on_before_reset : null; - - /** - * Callback fired after filters are cleared - * @type {Function} - */ - this.onAfterReset = (0, _types.isFn)(f.on_after_reset) ? f.on_after_reset : null; - - /** - * Enable paging component - * @type {Boolean} - */ - this.paging = Boolean(f.paging); - - /** - * Number of hidden rows - * @type {Number} - * @private - */ - this.nbHiddenRows = 0; - - /** - * Enable auto-filter behaviour, table is filtered when a user - * stops typing - * @type {Boolean} - */ - this.autoFilter = Boolean(f.auto_filter); - - /** - * Auto-filter delay in msecs - * @type {Number} - */ - this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : _const.AUTO_FILTER_DELAY; - - /** - * Indicate whether user is typing - * @type {Boolean} - * @private - */ - this.isUserTyping = null; - - /** - * Auto-filter interval ID - * @type {String} - * @private - */ - this.autoFilterTimer = null; - - /** - * Enable keyword highlighting behaviour - * @type {Boolean} - */ - this.highlightKeywords = Boolean(f.highlight_keywords); - - /** - * Enable no results message UI component - * @type {Boolean} - */ - this.noResults = (0, _types.isObj)(f.no_results_message) || Boolean(f.no_results_message); - - /** - * Enable state persistence - * @type {Boolean} - */ - this.state = (0, _types.isObj)(f.state) || Boolean(f.state); - - /*** data types ***/ - - /** - * Define default locale, default to 'en' as per Sugar Date module: - * https://sugarjs.com/docs/#/DateLocales - * @type {String} - */ - this.locale = f.locale || 'en'; - - /** - * Define thousands separator ',' or '.', defaults to ',' - * @type {String} - */ - this.thousandsSeparator = f.thousands_separator || ','; - - /** - * Define decimal separator ',' or '.', defaults to '.' - * @type {String} - */ - this.decimalSeparator = f.decimal_separator || '.'; - - /** - * Determine whether table has columns data types - * @type {Boolean} - * @private - */ - this.hasColTypes = (0, _types.isArray)(f.col_types); - - /** - * Define data types on a column basis, possible values 'string', - * 'number', 'formatted-number', 'date', 'ipaddress' ie: - * col_types : [ - * 'string', 'date', 'number', - * { type: 'formatted-number', decimal: ',', thousands: '.' }, - * { type: 'date', locale: 'en-gb' }, - * { type: 'date', format: ['{dd}-{months}-{yyyy|yy}'] } - * ] - * - * Refer to https://sugarjs.com/docs/#/DateParsing for exhaustive - * information on date parsing formats supported by Sugar Date - * @type {Array} - */ - this.colTypes = this.hasColTypes ? f.col_types : []; - - /*** ids prefixes ***/ - /** - * Main prefix - * @private - */ - this.prfxTf = 'TF'; - - /** - * Filter's ID prefix (inputs - selects) - * @private - */ - this.prfxFlt = 'flt'; - - /** - * Button's ID prefix - * @private - */ - this.prfxValButton = 'btn'; - - /** - * Toolbar container ID prefix - * @private - */ - this.prfxInfDiv = 'inf_'; - - /** - * Toolbar left element ID prefix - * @private - */ - this.prfxLDiv = 'ldiv_'; - - /** - * Toolbar right element ID prefix - * @private - */ - this.prfxRDiv = 'rdiv_'; - - /** - * Toolbar middle element ID prefix - * @private - */ - this.prfxMDiv = 'mdiv_'; - - /** - * Responsive Css class - * @private - */ - this.prfxResponsive = 'resp'; - - /*** extensions ***/ - /** - * List of loaded extensions - * @type {Array} - * @private - */ - this.extensions = f.extensions; - - /** - * Determine whether extensions are loaded - * @type {Boolean} - * @private - */ - this.hasExtensions = (0, _types.isArray)(this.extensions); - - /*** themes ***/ - /** - * Enable default theme - * @type {Boolean} - */ - this.enableDefaultTheme = Boolean(f.enable_default_theme); - - /** - * Determine whether themes are enables - * @type {Boolean} - * @private - */ - this.hasThemes = this.enableDefaultTheme || (0, _types.isArray)(f.themes); - - /** - * List of themes, ie: - * themes: [{ name: 'skyblue' }] - * @type {Array} - */ - this.themes = f.themes || []; - - /** - * Define path to themes assets, defaults to - * 'tablefilter/style/themes/'. Usage: - * themes: [{ name: 'skyblue' }] - * @type {Array} - */ - this.themesPath = f.themes_path || this.stylePath + 'themes/'; - - /** - * Enable responsive layout - * @type {Boolean} - */ - this.responsive = Boolean(f.responsive); - - /** - * Features registry - * @private - */ - this.Mod = {}; - - /** - * Extensions registry - * @private - */ - this.ExtRegistry = {}; - } - - /** - * Initialise features and layout - */ - - - TableFilter.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var Mod = this.Mod; - var n = this.singleSearchFlt ? 1 : this.nbCells; - var inpclass = void 0; - - //loads stylesheet if not imported - this.import(this.stylesheetId, this.stylesheet, null, 'link'); - - //loads theme - if (this.hasThemes) { - this.loadThemes(); - } - - // Instanciate sugar date wrapper - if (!Mod.dateType) { - Mod.dateType = new _dateType.DateType(this); - } - Mod.dateType.init(); - - // Instantiate help feature and initialise only if set true - if (!Mod.help) { - Mod.help = new _help.Help(this); - } - if (this.help) { - Mod.help.init(); - } - - if (this.state) { - if (!Mod.state) { - Mod.state = new _state.State(this); - } - Mod.state.init(); - } - - if (this.gridLayout) { - if (!Mod.gridLayout) { - Mod.gridLayout = new _gridLayout.GridLayout(this); - } - Mod.gridLayout.init(); - } - - if (this.loader) { - if (!Mod.loader) { - Mod.loader = new _loader.Loader(this); - } - Mod.loader.init(); - } - - if (this.highlightKeywords) { - Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this); - Mod.highlightKeyword.init(); - } - - if (this.popupFilters) { - if (!Mod.popupFilter) { - Mod.popupFilter = new _popupFilter.PopupFilter(this); - } - Mod.popupFilter.init(); - } - - //filters grid is not generated - if (!this.fltGrid) { - this._initNoFilters(); - } else { - var fltrow = this._insertFiltersRow(); - - this.nbFilterableRows = this.getRowsNb(); - - // Generate filters - for (var i = 0; i < n; i++) { - this.emitter.emit('before-filter-init', this, i); - - var fltcell = (0, _dom.createElm)(this.fltCellTag), - col = this.getFilterType(i); - - if (this.singleSearchFlt) { - fltcell.colSpan = this.nbCells; - } - if (!this.gridLayout) { - fltrow.appendChild(fltcell); - } - inpclass = i === n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass; - - //only 1 input for single search - if (this.singleSearchFlt) { - col = _const.INPUT; - inpclass = this.singleFltCssClass; - } - - //drop-down filters - if (col === _const.SELECT || col === _const.MULTIPLE) { - if (!Mod.dropdown) { - Mod.dropdown = new _dropdown.Dropdown(this); - } - Mod.dropdown.init(i, this.isExternalFlt, fltcell); - } - // checklist - else if (col === _const.CHECKLIST) { - if (!Mod.checkList) { - Mod.checkList = new _checkList.CheckList(this); - } - Mod.checkList.init(i, this.isExternalFlt, fltcell); - } else { - this._buildInputFilter(i, inpclass, fltcell); - } - - // this adds submit button - if (i === n - 1 && this.displayBtn) { - this._buildSubmitButton(i, fltcell); - } - - this.emitter.emit('after-filter-init', this, i); - } - - this.emitter.on(['filter-focus'], function (tf, filter) { - return _this2.setActiveFilterId(filter.id); - }); - } //if this.fltGrid - - /* Features */ - if (this.hasVisibleRows) { - this.emitter.on(['after-filtering'], function () { - return _this2.enforceVisibility(); - }); - this.enforceVisibility(); - } - if (this.rowsCounter) { - Mod.rowsCounter = new _rowsCounter.RowsCounter(this); - Mod.rowsCounter.init(); - } - if (this.statusBar) { - Mod.statusBar = new _statusBar.StatusBar(this); - Mod.statusBar.init(); - } - if (this.paging) { - if (!Mod.paging) { - Mod.paging = new _paging.Paging(this); - Mod.paging.init(); - } else { - Mod.paging.reset(); - } - } - if (this.btnReset) { - Mod.clearButton = new _clearButton.ClearButton(this); - Mod.clearButton.init(); - } - - if (this.hasColWidths && !this.gridLayout) { - this.setColWidths(); - } - if (this.alternateRows) { - Mod.alternateRows = new _alternateRows.AlternateRows(this); - Mod.alternateRows.init(); - } - if (this.noResults) { - if (!Mod.noResults) { - Mod.noResults = new _noResults.NoResults(this); - } - Mod.noResults.init(); - } - - //TF css class is added to table - if (!this.gridLayout) { - (0, _dom.addClass)(this.tbl, this.prfxTf); - if (this.responsive) { - (0, _dom.addClass)(this.tbl, this.prfxResponsive); - } - } - - /* Loads extensions */ - if (this.hasExtensions) { - this.initExtensions(); - } - - // Subscribe to events - if (this.markActiveColumns) { - this.emitter.on(['before-filtering'], function () { - return _this2.clearActiveColumns(); - }); - this.emitter.on(['cell-processed'], function (tf, colIndex) { - return _this2.markActiveColumn(colIndex); - }); - } - if (this.linkedFilters) { - this.emitter.on(['after-filtering'], function () { - return _this2.linkFilters(); - }); - } - - /** - * @inherited - */ - this.initialized = true; - - if (this.onFiltersLoaded) { - this.onFiltersLoaded.call(null, this); - } - this.emitter.emit('initialized', this); - }; - - /** - * Detect key - * @param {Event} evt - */ - - - TableFilter.prototype.detectKey = function detectKey(evt) { - if (!this.enterKey) { - return; - } - if (evt) { - var key = (0, _event.keyCode)(evt); - if (key === _const.ENTER_KEY) { - this.filter(); - (0, _event.cancelEvt)(evt); - (0, _event.stopEvt)(evt); - } else { - this.isUserTyping = true; - _root.root.clearInterval(this.autoFilterTimer); - this.autoFilterTimer = null; - } - } - }; - - /** - * Filter's keyup event: if auto-filter on, detect user is typing and filter - * columns - * @param {Event} evt - */ - - - TableFilter.prototype.onKeyUp = function onKeyUp(evt) { - if (!this.autoFilter) { - return; - } - var key = (0, _event.keyCode)(evt); - this.isUserTyping = false; - - function filter() { - _root.root.clearInterval(this.autoFilterTimer); - this.autoFilterTimer = null; - if (!this.isUserTyping) { - this.filter(); - this.isUserTyping = null; - } - } - - if (key !== _const.ENTER_KEY && key !== _const.TAB_KEY && key !== _const.ESC_KEY && key !== _const.UP_ARROW_KEY && key !== _const.DOWN_ARROW_KEY) { - if (this.autoFilterTimer === null) { - this.autoFilterTimer = _root.root.setInterval(filter.bind(this), this.autoFilterDelay); - } - } else { - _root.root.clearInterval(this.autoFilterTimer); - this.autoFilterTimer = null; - } - }; - - /** - * Filter's keydown event: if auto-filter on, detect user is typing - */ - - - TableFilter.prototype.onKeyDown = function onKeyDown() { - if (this.autoFilter) { - this.isUserTyping = true; - } - }; - - /** - * Filter's focus event - * @param {Event} evt - */ - - - TableFilter.prototype.onInpFocus = function onInpFocus(evt) { - var elm = (0, _event.targetEvt)(evt); - this.emitter.emit('filter-focus', this, elm); - }; - - /** - * Filter's blur event: if auto-filter on, clear interval on filter blur - */ - - - TableFilter.prototype.onInpBlur = function onInpBlur() { - if (this.autoFilter) { - this.isUserTyping = false; - _root.root.clearInterval(this.autoFilterTimer); - } - this.emitter.emit('filter-blur', this); - }; - - /** - * Insert filters row at initialization - */ - - - TableFilter.prototype._insertFiltersRow = function _insertFiltersRow() { - // TODO: prevent filters row generation for popup filters too, - // to reduce and simplify headers row index adjusting across lib modules - // (GridLayout, PopupFilter etc) - if (this.gridLayout) { - return; - } - var fltrow = void 0; - - var thead = (0, _dom.tag)(this.tbl, 'thead'); - if (thead.length > 0) { - fltrow = thead[0].insertRow(this.filtersRowIndex); - } else { - fltrow = this.tbl.insertRow(this.filtersRowIndex); - } - - fltrow.className = this.fltsRowCssClass; - - if (this.isExternalFlt) { - fltrow.style.display = _const.NONE; - } - - this.emitter.emit('filters-row-inserted', this, fltrow); - return fltrow; - }; - - /** - * Initialize filtersless table - */ - - - TableFilter.prototype._initNoFilters = function _initNoFilters() { - if (this.fltGrid) { - return; - } - this.refRow = this.refRow > 0 ? this.refRow - 1 : 0; - this.nbFilterableRows = this.getRowsNb(); - }; - - /** - * Build input filter type - * @param {Number} colIndex Column index - * @param {String} cssClass Css class applied to filter - * @param {DOMElement} container Container DOM element - */ - - - TableFilter.prototype._buildInputFilter = function _buildInputFilter(colIndex, cssClass, container) { - var _this3 = this; - - var col = this.getFilterType(colIndex); - var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; - var inptype = col === _const.INPUT ? 'text' : 'hidden'; - var inp = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxFlt + colIndex + '_' + this.id], ['type', inptype], ['ct', colIndex]); - - if (inptype !== 'hidden' && this.watermark) { - inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark); - } - inp.className = cssClass || this.fltCssClass; - (0, _event.addEvt)(inp, 'focus', function (evt) { - return _this3.onInpFocus(evt); - }); - - //filter is appended in custom element - if (externalFltTgtId) { - (0, _dom.elm)(externalFltTgtId).appendChild(inp); - } else { - container.appendChild(inp); - } - - this.fltIds.push(inp.id); - - (0, _event.addEvt)(inp, 'keypress', function (evt) { - return _this3.detectKey(evt); - }); - (0, _event.addEvt)(inp, 'keydown', function () { - return _this3.onKeyDown(); - }); - (0, _event.addEvt)(inp, 'keyup', function (evt) { - return _this3.onKeyUp(evt); - }); - (0, _event.addEvt)(inp, 'blur', function () { - return _this3.onInpBlur(); - }); - }; - - /** - * Build submit button - * @param {Number} colIndex Column index - * @param {DOMElement} container Container DOM element - */ - - - TableFilter.prototype._buildSubmitButton = function _buildSubmitButton(colIndex, container) { - var _this4 = this; - - var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; - var btn = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxValButton + colIndex + '_' + this.id], ['type', 'button'], ['value', this.btnText]); - btn.className = this.btnCssClass; - - //filter is appended in custom element - if (externalFltTgtId) { - (0, _dom.elm)(externalFltTgtId).appendChild(btn); - } else { - container.appendChild(btn); - } - - (0, _event.addEvt)(btn, 'click', function () { - return _this4.filter(); - }); - }; - - /** - * Return a feature instance for a given name - * @param {String} name Name of the feature - * @return {Object} - */ - - - TableFilter.prototype.feature = function feature(name) { - return this.Mod[name]; - }; - - /** - * Initialise all the extensions defined in the configuration object - */ - - - TableFilter.prototype.initExtensions = function initExtensions() { - var exts = this.extensions; - // Set config's publicPath dynamically for Webpack... - __webpack_require__.p = this.basePath; - - this.emitter.emit('before-loading-extensions', this); - for (var i = 0, len = exts.length; i < len; i++) { - var ext = exts[i]; - if (!this.ExtRegistry[ext.name]) { - this.loadExtension(ext); - } - } - this.emitter.emit('after-loading-extensions', this); - }; - - /** - * Load an extension module - * @param {Object} ext Extension config object - */ - - - TableFilter.prototype.loadExtension = function loadExtension(ext) { - var _this5 = this; - - if (!ext || !ext.name) { - return; - } - - var name = ext.name; - var path = ext.path; - var modulePath = void 0; - - if (name && path) { - modulePath = ext.path + name; - } else { - name = name.replace('.js', ''); - modulePath = 'extensions/{}/{}'.replace(/{}/g, name); - } - - // Require pattern for Webpack - __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(435)("./" + modulePath)]; (function (mod) { - /* eslint-disable */ - var inst = new mod.default(_this5, ext); - /* eslint-enable */ - inst.init(); - _this5.ExtRegistry[name] = inst; - }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}); - }; - - /** - * Get an extension instance - * @param {String} name Name of the extension - * @return {Object} Extension instance - */ - - - TableFilter.prototype.extension = function extension(name) { - return this.ExtRegistry[name]; - }; - - /** - * Check passed extension name exists - * @param {String} name Name of the extension - * @return {Boolean} - */ - - - TableFilter.prototype.hasExtension = function hasExtension(name) { - return !(0, _types.isEmpty)(this.ExtRegistry[name]); - }; - - /** - * Destroy all the extensions defined in the configuration object - */ - - - TableFilter.prototype.destroyExtensions = function destroyExtensions() { - var exts = this.extensions; - - for (var i = 0, len = exts.length; i < len; i++) { - var ext = exts[i]; - var extInstance = this.ExtRegistry[ext.name]; - if (extInstance) { - extInstance.destroy(); - this.ExtRegistry[ext.name] = undefined; - } - } - }; - - /** - * Load themes defined in the configuration object - */ - - - TableFilter.prototype.loadThemes = function loadThemes() { - var themes = this.themes; - this.emitter.emit('before-loading-themes', this); - - //Default theme config - if (this.enableDefaultTheme) { - var defaultTheme = { name: 'default' }; - this.themes.push(defaultTheme); - } - if ((0, _types.isArray)(themes)) { - for (var i = 0, len = themes.length; i < len; i++) { - var theme = themes[i]; - var name = theme.name; - var path = theme.path; - var styleId = this.prfxTf + name; - if (name && !path) { - path = this.themesPath + name + '/' + name + '.css'; - } else if (!name && theme.path) { - name = 'theme{0}'.replace('{0}', i); - } - - if (!this.isImported(path, 'link')) { - this.import(styleId, path, null, 'link'); - } - } - } - - // Enable loader indicator - this.loader = true; - - this.emitter.emit('after-loading-themes', this); - }; - - /** - * Return stylesheet DOM element for a given theme name - * @return {DOMElement} stylesheet element - */ - - - TableFilter.prototype.getStylesheet = function getStylesheet() { - var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default'; - - return (0, _dom.elm)(this.prfxTf + name); - }; - - /** - * Destroy filter grid - */ - - - TableFilter.prototype.destroy = function destroy() { - var _this6 = this; - - if (!this.initialized) { - return; - } - - var Mod = this.Mod; - var emitter = this.emitter; - - if (this.isExternalFlt && !this.popupFilters) { - this.removeExternalFlts(); - } - if (this.infDiv) { - this.removeToolbar(); - } - if (this.markActiveColumns) { - this.clearActiveColumns(); - emitter.off(['before-filtering'], function () { - return _this6.clearActiveColumns(); - }); - emitter.off(['cell-processed'], function (tf, colIndex) { - return _this6.markActiveColumn(colIndex); - }); - } - if (this.hasExtensions) { - this.destroyExtensions(); - } - - this.validateAllRows(); - - if (this.fltGrid && !this.gridLayout) { - this.tbl.deleteRow(this.filtersRowIndex); - } - - // broadcast destroy event - emitter.emit('destroy', this); - - // Destroy modules - // TODO: subcribe modules to destroy event instead - Object.keys(Mod).forEach(function (key) { - var feature = Mod[key]; - if (feature && (0, _types.isFn)(feature.destroy)) { - feature.destroy(); - } - }); - - // unsubscribe to events - if (this.hasVisibleRows) { - emitter.off(['after-filtering'], function () { - return _this6.enforceVisibility(); - }); - } - if (this.linkedFilters) { - emitter.off(['after-filtering'], function () { - return _this6.linkFilters(); - }); - } - this.emitter.off(['filter-focus'], function (tf, filter) { - return _this6.setActiveFilterId(filter.id); - }); - - (0, _dom.removeClass)(this.tbl, this.prfxTf); - (0, _dom.removeClass)(this.tbl, this.prfxResponsive); - - this.nbHiddenRows = 0; - this.validRowsIndex = []; - this.fltIds = []; - this.initialized = false; - }; - - /** - * Generate container element for paging, reset button, rows counter etc. - */ - - - TableFilter.prototype.setToolbar = function setToolbar() { - if (this.infDiv) { - return; - } - - /*** container div ***/ - var infdiv = (0, _dom.createElm)('div', ['id', this.prfxInfDiv + this.id]); - infdiv.className = this.infDivCssClass; - - //custom container - if (this.toolBarTgtId) { - (0, _dom.elm)(this.toolBarTgtId).appendChild(infdiv); - } - //grid-layout - else if (this.gridLayout) { - var gridLayout = this.Mod.gridLayout; - gridLayout.tblMainCont.appendChild(infdiv); - infdiv.className = gridLayout.infDivCssClass; - } - //default location: just above the table - else { - var cont = (0, _dom.createElm)('caption'); - cont.appendChild(infdiv); - this.tbl.insertBefore(cont, this.tbl.firstChild); - } - this.infDiv = (0, _dom.elm)(this.prfxInfDiv + this.id); - - /*** left div containing rows # displayer ***/ - var ldiv = (0, _dom.createElm)('div', ['id', this.prfxLDiv + this.id]); - ldiv.className = this.lDivCssClass; - infdiv.appendChild(ldiv); - this.lDiv = (0, _dom.elm)(this.prfxLDiv + this.id); - - /*** right div containing reset button - + nb results per page select ***/ - var rdiv = (0, _dom.createElm)('div', ['id', this.prfxRDiv + this.id]); - rdiv.className = this.rDivCssClass; - infdiv.appendChild(rdiv); - this.rDiv = (0, _dom.elm)(this.prfxRDiv + this.id); - - /*** mid div containing paging elements ***/ - var mdiv = (0, _dom.createElm)('div', ['id', this.prfxMDiv + this.id]); - mdiv.className = this.mDivCssClass; - infdiv.appendChild(mdiv); - this.mDiv = (0, _dom.elm)(this.prfxMDiv + this.id); - - // emit help initialisation only if undefined - if ((0, _types.isUndef)(this.help)) { - // explicitily set enabled field to true to initialise help by - // default, only if setting is undefined - this.Mod.help.enabled = true; - this.emitter.emit('init-help', this); - } - }; - - /** - * Remove toolbar container element - */ - - - TableFilter.prototype.removeToolbar = function removeToolbar() { - if (!this.infDiv) { - return; - } - (0, _dom.removeElm)(this.infDiv); - this.infDiv = null; - - var tbl = this.tbl; - var captions = (0, _dom.tag)(tbl, 'caption'); - if (captions.length > 0) { - [].forEach.call(captions, function (elm) { - return tbl.removeChild(elm); - }); - } - }; - - /** - * Remove all the external column filters - */ - - - TableFilter.prototype.removeExternalFlts = function removeExternalFlts() { - if (!this.isExternalFlt) { - return; - } - var ids = this.externalFltTgtIds, - len = ids.length; - for (var ct = 0; ct < len; ct++) { - var externalFltTgtId = ids[ct], - externalFlt = (0, _dom.elm)(externalFltTgtId); - if (externalFlt) { - externalFlt.innerHTML = ''; - } - } - }; - - /** - * Check if given column implements a filter with custom options - * @param {Number} colIndex Column's index - * @return {Boolean} - */ - - - TableFilter.prototype.isCustomOptions = function isCustomOptions(colIndex) { - return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) !== -1; - }; - - /** - * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the - * custom options values and texts - * @param {Number} colIndex Column's index - * @return {Array} - */ - - - TableFilter.prototype.getCustomOptions = function getCustomOptions(colIndex) { - if ((0, _types.isEmpty)(colIndex) || !this.isCustomOptions(colIndex)) { - return; - } - - var customOptions = this.customOptions; - var cols = customOptions.cols; - var optTxt = [], - optArray = []; - var index = cols.indexOf(colIndex); - var slcValues = customOptions.values[index]; - var slcTexts = customOptions.texts[index]; - var slcSort = customOptions.sorts[index]; - - for (var r = 0, len = slcValues.length; r < len; r++) { - optArray.push(slcValues[r]); - if (slcTexts[r]) { - optTxt.push(slcTexts[r]); - } else { - optTxt.push(slcValues[r]); - } - } - if (slcSort) { - optArray.sort(); - optTxt.sort(); - } - return [optArray, optTxt]; - }; - - /** - * Filter the table by retrieving the data from each cell in every single - * row and comparing it to the search term for current column. A row is - * hidden when all the search terms are not found in inspected row. - */ - - - TableFilter.prototype.filter = function filter() { - if (!this.fltGrid || !this.initialized) { - return; - } - //invoke onbefore callback - if (this.onBeforeFilter) { - this.onBeforeFilter.call(null, this); - } - this.emitter.emit('before-filtering', this); - - var row = this.tbl.rows, - nbRows = this.getRowsNb(true), - hiddenRows = 0; - - this.validRowsIndex = []; - // search args re-init - var searchArgs = this.getFiltersValue(); - - var numData = void 0; - var decimal = this.decimalSeparator; - var re_le = new RegExp(this.leOperator), - re_ge = new RegExp(this.geOperator), - re_l = new RegExp(this.lwOperator), - re_g = new RegExp(this.grOperator), - re_d = new RegExp(this.dfOperator), - re_lk = new RegExp((0, _string.rgxEsc)(this.lkOperator)), - re_eq = new RegExp(this.eqOperator), - re_st = new RegExp(this.stOperator), - re_en = new RegExp(this.enOperator), - - // re_an = new RegExp(this.anOperator), - // re_cr = new RegExp(this.curExp), - re_em = this.emOperator, - re_nm = this.nmOperator, - re_re = new RegExp((0, _string.rgxEsc)(this.rgxOperator)); - - //keyword highlighting - function highlight(str, ok, cell) { - /*jshint validthis:true */ - if (this.highlightKeywords && ok) { - str = str.replace(re_lk, ''); - str = str.replace(re_eq, ''); - str = str.replace(re_st, ''); - str = str.replace(re_en, ''); - var w = str; - if (re_le.test(str) || re_ge.test(str) || re_l.test(str) || re_g.test(str) || re_d.test(str)) { - w = (0, _dom.getText)(cell); - } - if (w !== '') { - this.emitter.emit('highlight-keyword', this, cell, w); - } - } - } - - //looks for search argument in current row - function hasArg(sA, cellData, colIdx) { - sA = (0, _string.matchCase)(sA, this.caseSensitive); - - var occurence = false; - - //Search arg operator tests - var hasLO = re_l.test(sA), - hasLE = re_le.test(sA), - hasGR = re_g.test(sA), - hasGE = re_ge.test(sA), - hasDF = re_d.test(sA), - hasEQ = re_eq.test(sA), - hasLK = re_lk.test(sA), - - // hasAN = re_an.test(sA), - hasST = re_st.test(sA), - hasEN = re_en.test(sA), - hasEM = re_em === sA, - hasNM = re_nm === sA, - hasRE = re_re.test(sA); - - // Check for dates or resolve date type - if (this.hasType(colIdx, [_const.DATE])) { - var dte1 = void 0, - dte2 = void 0; - - var dateType = this.Mod.dateType; - var isValidDate = dateType.isValid.bind(dateType); - var parseDate = dateType.parse.bind(dateType); - var locale = dateType.getOptions(colIdx).locale || this.locale; - - // Search arg dates tests - var isLDate = hasLO && isValidDate(sA.replace(re_l, ''), locale); - var isLEDate = hasLE && isValidDate(sA.replace(re_le, ''), locale); - var isGDate = hasGR && isValidDate(sA.replace(re_g, ''), locale); - var isGEDate = hasGE && isValidDate(sA.replace(re_ge, ''), locale); - var isDFDate = hasDF && isValidDate(sA.replace(re_d, ''), locale); - var isEQDate = hasEQ && isValidDate(sA.replace(re_eq, ''), locale); - - dte1 = parseDate(cellData, locale); - - // lower date - if (isLDate) { - dte2 = parseDate(sA.replace(re_l, ''), locale); - occurence = dte1 < dte2; - } - // lower equal date - else if (isLEDate) { - dte2 = parseDate(sA.replace(re_le, ''), locale); - occurence = dte1 <= dte2; - } - // greater equal date - else if (isGEDate) { - dte2 = parseDate(sA.replace(re_ge, ''), locale); - occurence = dte1 >= dte2; - } - // greater date - else if (isGDate) { - dte2 = parseDate(sA.replace(re_g, ''), locale); - occurence = dte1 > dte2; - } - // different date - else if (isDFDate) { - dte2 = parseDate(sA.replace(re_d, ''), locale); - occurence = dte1.toString() !== dte2.toString(); - } - // equal date - else if (isEQDate) { - dte2 = parseDate(sA.replace(re_eq, ''), locale); - occurence = dte1.toString() === dte2.toString(); - } - // searched keyword with * operator doesn't have to be a date - else if (re_lk.test(sA)) { - // like date - occurence = (0, _string.contains)(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } else if (isValidDate(sA)) { - dte2 = parseDate(sA, locale); - occurence = dte1.toString() === dte2.toString(); - } - //empty - else if (hasEM) { - occurence = (0, _string.isEmpty)(cellData); - } - //non-empty - else if (hasNM) { - occurence = !(0, _string.isEmpty)(cellData); - } else { - occurence = (0, _string.contains)(sA, cellData, this.isExactMatch(colIdx), this.caseSensitive); - } - } else { - if (this.hasType(colIdx, [_const.FORMATTED_NUMBER])) { - var colType = this.colTypes[colIdx]; - if (colType.hasOwnProperty('decimal')) { - decimal = colType.decimal; - } - } - // Convert to number anyways to auto-resolve type in case not - // defined by configuration - numData = Number(cellData) || (0, _number.parse)(cellData, decimal); - - // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, - // rgx:) - // lower equal - if (hasLE) { - occurence = numData <= (0, _number.parse)(sA.replace(re_le, ''), decimal); - } - //greater equal - else if (hasGE) { - occurence = numData >= (0, _number.parse)(sA.replace(re_ge, ''), decimal); - } - //lower - else if (hasLO) { - occurence = numData < (0, _number.parse)(sA.replace(re_l, ''), decimal); - } - //greater - else if (hasGR) { - occurence = numData > (0, _number.parse)(sA.replace(re_g, ''), decimal); - } - //different - else if (hasDF) { - occurence = (0, _string.contains)(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; - } - //like - else if (hasLK) { - occurence = (0, _string.contains)(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } - //equal - else if (hasEQ) { - occurence = (0, _string.contains)(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); - } - //starts with - else if (hasST) { - occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; - } - //ends with - else if (hasEN) { - var searchArg = sA.replace(re_en, ''); - occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; - } - //empty - else if (hasEM) { - occurence = (0, _string.isEmpty)(cellData); - } - //non-empty - else if (hasNM) { - occurence = !(0, _string.isEmpty)(cellData); - } - //regexp - else if (hasRE) { - //in case regexp throws - try { - //operator is removed - var srchArg = sA.replace(re_re, ''); - var rgx = new RegExp(srchArg); - occurence = rgx.test(cellData); - } catch (ex) { - occurence = false; - } - } else { - // If numeric type data, perform a strict equality test and - // fallback to unformatted number string comparison - if (numData && this.hasType(colIdx, [_const.NUMBER, _const.FORMATTED_NUMBER]) && !this.singleSearchFlt) { - // parseNb can return 0 for strings which are not - // formatted numbers, in that case return the original - // string. TODO: handle this in parseNb - sA = (0, _number.parse)(sA, decimal) || sA; - occurence = numData === sA || (0, _string.contains)(sA.toString(), numData.toString(), this.isExactMatch(colIdx), this.caseSensitive); - } else { - // Finally test search term is contained in cell data - occurence = (0, _string.contains)(sA, cellData, this.isExactMatch(colIdx), this.caseSensitive, this.ignoresDiacritics(colIdx)); - } - } - } //else - return occurence; - } //fn - - for (var k = this.refRow; k < nbRows; k++) { - // already filtered rows display re-init - row[k].style.display = ''; - - var cells = row[k].cells; - var nchilds = cells.length; - - // checks if row has exact cell # - if (nchilds !== this.nbCells) { - continue; - } - - var occurence = [], - isRowValid = true, - - //only for single filter search - singleFltRowValid = false; - - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - //searched keyword - var sA = searchArgs[this.singleSearchFlt ? 0 : j]; - - if (sA === '') { - continue; - } - - var cellData = (0, _string.matchCase)(this.getCellData(cells[j]), this.caseSensitive); - - //multiple search parameter operator || - var sAOrSplit = sA.toString().split(this.orOperator), - - //multiple search || parameter boolean - hasMultiOrSA = sAOrSplit.length > 1, - - //multiple search parameter operator && - sAAndSplit = sA.toString().split(this.anOperator), - - //multiple search && parameter boolean - hasMultiAndSA = sAAndSplit.length > 1; - - //detect operators or array query - if ((0, _types.isArray)(sA) || hasMultiOrSA || hasMultiAndSA) { - var cS = void 0, - s = void 0, - occur = false; - if ((0, _types.isArray)(sA)) { - s = sA; - } else { - s = hasMultiOrSA ? sAOrSplit : sAAndSplit; - } - // TODO: improve clarity/readability of this block - for (var w = 0, len = s.length; w < len; w++) { - cS = (0, _string.trim)(s[w]); - occur = hasArg.call(this, cS, cellData, j); - highlight.call(this, cS, occur, cells[j]); - if (hasMultiOrSA && occur || hasMultiAndSA && !occur) { - break; - } - if ((0, _types.isArray)(sA) && occur) { - break; - } - } - occurence[j] = occur; - } - //single search parameter - else { - occurence[j] = hasArg.call(this, (0, _string.trim)(sA), cellData, j); - highlight.call(this, sA, occurence[j], cells[j]); - } //else single param - - if (!occurence[j]) { - isRowValid = false; - } - if (this.singleSearchFlt && occurence[j]) { - singleFltRowValid = true; - } - - this.emitter.emit('cell-processed', this, j, cells[j]); - } //for j - - if (this.singleSearchFlt && singleFltRowValid) { - isRowValid = true; - } - - if (!isRowValid) { - this.validateRow(k, false); - hiddenRows++; - } else { - this.validateRow(k, true); - } - - this.emitter.emit('row-processed', this, k, this.validRowsIndex.length, isRowValid); - } // for k - - this.nbHiddenRows = hiddenRows; - - //invokes onafterfilter callback - if (this.onAfterFilter) { - this.onAfterFilter.call(null, this); - } - - this.emitter.emit('after-filtering', this, searchArgs); - }; - - /** - * Return the data of a specified column - * @param {Number} colIndex Column index - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} num Optional: return unformatted number - * @param {Array} exclude Optional: list of row indexes to be excluded - * @return {Array} Flat list of data for a column - */ - - - TableFilter.prototype.getColValues = function getColValues(colIndex) { - var includeHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var num = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var exclude = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; - - if (!this.fltGrid) { - return; - } - var row = this.tbl.rows; - var nbRows = this.getRowsNb(true); - var colValues = []; - - if (includeHeaders) { - colValues.push(this.getHeadersText()[colIndex]); - } - - for (var i = this.refRow; i < nbRows; i++) { - var isExludedRow = false; - // checks if current row index appears in exclude array - if (exclude.length > 0) { - isExludedRow = exclude.indexOf(i) !== -1; - } - var cell = row[i].cells, - nchilds = cell.length; - - // checks if row has exact cell # and is not excluded - if (nchilds === this.nbCells && !isExludedRow) { - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - if (j !== colIndex || row[i].style.display !== '') { - continue; - } - var cellData = this.getCellData(cell[j]); - var decimal = this.decimalSeparator; - if (this.hasType(colIndex, [_const.FORMATTED_NUMBER])) { - var colType = this.colTypes[colIndex]; - if (colType.hasOwnProperty('decimal')) { - decimal = colType.decimal; - } - } - var data = num ? Number(cellData) || (0, _number.parse)(cellData, decimal) : cellData; - colValues.push(data); - } - } - } - return colValues; - }; - - /** - * Return the filter's value of a specified column - * @param {Number} index Column index - * @return {String} Filter value - */ - - - TableFilter.prototype.getFilterValue = function getFilterValue(index) { - if (!this.fltGrid) { - return; - } - var fltValue = ''; - var flt = this.getFilterElement(index); - if (!flt) { - return fltValue; - } - - var fltColType = this.getFilterType(index); - if (fltColType !== _const.MULTIPLE && fltColType !== _const.CHECKLIST) { - fltValue = flt.value; - } - //mutiple select - else if (fltColType === _const.MULTIPLE) { - fltValue = this.feature('dropdown').getValues(index); - } - //checklist - else if (fltColType === _const.CHECKLIST) { - fltValue = this.feature('checkList').getValues(index); - } - //return an empty string if collection is empty or contains a single - //empty string - if ((0, _types.isArray)(fltValue) && fltValue.length === 0 || fltValue.length === 1 && fltValue[0] === '') { - fltValue = ''; - } - - return fltValue; - }; - - /** - * Return the filters' values - * @return {Array} List of filters' values - */ - - - TableFilter.prototype.getFiltersValue = function getFiltersValue() { - if (!this.fltGrid) { - return; - } - var searchArgs = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - var fltValue = this.getFilterValue(i); - if ((0, _types.isArray)(fltValue)) { - searchArgs.push(fltValue); - } else { - searchArgs.push((0, _string.trim)(fltValue)); - } - } - return searchArgs; - }; - - /** - * Return the ID of a specified column's filter - * @param {Number} index Column's index - * @return {String} ID of the filter element - */ - - - TableFilter.prototype.getFilterId = function getFilterId(index) { - if (!this.fltGrid) { - return; - } - return this.fltIds[index]; - }; - - /** - * Return the list of ids of filters matching a specified type. - * Note: hidden filters are also returned - * - * @param {String} type Filter type string ('input', 'select', 'multiple', - * 'checklist') - * @param {Boolean} bool If true returns columns indexes instead of IDs - * @return {[type]} List of element IDs or column indexes - */ - - - TableFilter.prototype.getFiltersByType = function getFiltersByType(type, bool) { - if (!this.fltGrid) { - return; - } - var arr = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - var fltType = this.getFilterType(i); - if (fltType === type.toLowerCase()) { - var a = bool ? i : this.fltIds[i]; - arr.push(a); - } - } - return arr; - }; - - /** - * Return the filter's DOM element for a given column - * @param {Number} index Column's index - * @return {DOMElement} - */ - - - TableFilter.prototype.getFilterElement = function getFilterElement(index) { - var fltId = this.fltIds[index]; - return (0, _dom.elm)(fltId); - }; - - /** - * Return the number of cells for a given row index - * @param {Number} rowIndex Index of the row - * @return {Number} Number of cells - */ - - - TableFilter.prototype.getCellsNb = function getCellsNb() { - var rowIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - - var tr = this.tbl.rows[rowIndex]; - return tr.cells.length; - }; - - /** - * Return the number of filterable rows starting from reference row if - * defined - * @param {Boolean} includeHeaders Include the headers row - * @return {Number} Number of filterable rows - */ - - - TableFilter.prototype.getRowsNb = function getRowsNb(includeHeaders) { - var s = (0, _types.isUndef)(this.refRow) ? 0 : this.refRow; - var ntrs = this.tbl.rows.length; - if (includeHeaders) { - s = 0; - } - return parseInt(ntrs - s, 10); - }; - - /** - * Return the data of a given cell - * @param {DOMElement} cell Cell's DOM object - * @return {String} - */ - - - TableFilter.prototype.getCellData = function getCellData(cell) { - var idx = cell.cellIndex; - //Check for customCellData callback - if (this.customCellData && this.customCellDataCols.indexOf(idx) !== -1) { - return this.customCellData.call(null, this, cell, idx); - } else { - return (0, _dom.getText)(cell); - } - }; - - /** - * Return the table data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - - TableFilter.prototype.getTableData = function getTableData() { - var includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var excludeHiddenCols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - var rows = this.tbl.rows; - var nbRows = this.getRowsNb(true); - var tblData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - tblData.push([this.getHeadersRowIndex(), headers]); - } - for (var k = this.refRow; k < nbRows; k++) { - var rowData = [k, []]; - var cells = rows[k].cells; - for (var j = 0, len = cells.length; j < len; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var cellData = this.getCellData(cells[j]); - rowData[1].push(cellData); - } - tblData.push(rowData); - } - return tblData; - }; - - /** - * Return the filtered data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - - TableFilter.prototype.getFilteredData = function getFilteredData() { - var includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var excludeHiddenCols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - if (!this.validRowsIndex) { - return []; - } - var rows = this.tbl.rows, - filteredData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - filteredData.push([this.getHeadersRowIndex(), headers]); - } - - var validRows = this.getValidRows(true); - for (var i = 0; i < validRows.length; i++) { - var rData = [this.validRowsIndex[i], []], - cells = rows[this.validRowsIndex[i]].cells; - for (var k = 0; k < cells.length; k++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(k)) { - continue; - } - } - var cellData = this.getCellData(cells[k]); - rData[1].push(cellData); - } - filteredData.push(rData); - } - return filteredData; - }; - - /** - * Return the filtered data for a given column index - * @param {Number} colIndex Colmun's index - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} Flat list of values ['val0','val1','val2'...] - * - * TODO: provide an API returning data in JSON format - */ - - - TableFilter.prototype.getFilteredDataCol = function getFilteredDataCol(colIndex) { - var includeHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - if ((0, _types.isUndef)(colIndex)) { - return []; - } - var data = this.getFilteredData(), - colData = []; - if (includeHeaders) { - colData.push(this.getHeadersText()[colIndex]); - } - for (var i = 0, len = data.length; i < len; i++) { - var r = data[i], - - //cols values of current row - d = r[1], - - //data of searched column - c = d[colIndex]; - colData.push(c); - } - return colData; - }; - - /** - * Get the display value of a row - * @param {HTMLTableRowElement} row DOM element of the row - * @return {String} Usually 'none' or '' - */ - - - TableFilter.prototype.getRowDisplay = function getRowDisplay(row) { - return row.style.display; - }; - - /** - * Validate/invalidate row by setting the 'validRow' attribute on the row - * @param {Number} rowIndex Index of the row - * @param {Boolean} isValid - */ - - - TableFilter.prototype.validateRow = function validateRow(rowIndex, isValid) { - var row = this.tbl.rows[rowIndex]; - if (!row || typeof isValid !== 'boolean') { - return; - } - - // always visible rows are valid - if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { - isValid = true; - } - - var displayFlag = isValid ? '' : _const.NONE, - validFlag = isValid ? 'true' : 'false'; - row.style.display = displayFlag; - - if (this.paging) { - row.setAttribute('validRow', validFlag); - } - - if (isValid) { - if (this.validRowsIndex.indexOf(rowIndex) === -1) { - this.validRowsIndex.push(rowIndex); - } - - if (this.onRowValidated) { - this.onRowValidated.call(null, this, rowIndex); - } - - this.emitter.emit('row-validated', this, rowIndex); - } - }; - - /** - * Validate all filterable rows - */ - - - TableFilter.prototype.validateAllRows = function validateAllRows() { - if (!this.initialized) { - return; - } - this.validRowsIndex = []; - for (var k = this.refRow; k < this.nbFilterableRows; k++) { - this.validateRow(k, true); - } - }; - - /** - * Set search value to a given filter - * @param {Number} index Column's index - * @param {String or Array} query searcharg Search term - */ - - - TableFilter.prototype.setFilterValue = function setFilterValue(index) { - var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - - if (!this.fltGrid) { - return; - } - var slc = this.getFilterElement(index), - fltColType = this.getFilterType(index); - - if (fltColType !== _const.MULTIPLE && fltColType !== _const.CHECKLIST) { - if (this.loadFltOnDemand && !this.initialized) { - this.emitter.emit('build-select-filter', this, index, this.linkedFilters, this.isExternalFlt); - } - slc.value = query; - } - //multiple selects - else if (fltColType === _const.MULTIPLE) { - var values = (0, _types.isArray)(query) ? query : query.split(' ' + this.orOperator + ' '); - - if (this.loadFltOnDemand && !this.initialized) { - this.emitter.emit('build-select-filter', this, index, this.linkedFilters, this.isExternalFlt); - } - - this.emitter.emit('select-options', this, index, values); - } - //checklist - else if (fltColType === _const.CHECKLIST) { - var _values = []; - if (this.loadFltOnDemand && !this.initialized) { - this.emitter.emit('build-checklist-filter', this, index, this.isExternalFlt); - } - if ((0, _types.isArray)(query)) { - _values = query; - } else { - query = (0, _string.matchCase)(query, this.caseSensitive); - _values = query.split(' ' + this.orOperator + ' '); - } - - this.emitter.emit('select-checklist-options', this, index, _values); - } - }; - - /** - * Set them columns' widths as per configuration - * @param {Element} tbl DOM element - */ - - - TableFilter.prototype.setColWidths = function setColWidths(tbl) { - if (!this.hasColWidths) { - return; - } - tbl = tbl || this.tbl; - - var nbCols = this.nbCells; - var colWidths = this.colWidths; - var colTags = (0, _dom.tag)(tbl, 'col'); - var tblHasColTag = colTags.length > 0; - var frag = !tblHasColTag ? doc.createDocumentFragment() : null; - for (var k = 0; k < nbCols; k++) { - var col = void 0; - if (tblHasColTag) { - col = colTags[k]; - } else { - col = (0, _dom.createElm)('col', ['id', this.id + '_col_' + k]); - frag.appendChild(col); - } - col.style.width = colWidths[k]; - } - if (!tblHasColTag) { - tbl.insertBefore(frag, tbl.firstChild); - } - }; - - /** - * Makes defined rows always visible - */ - - - TableFilter.prototype.enforceVisibility = function enforceVisibility() { - if (!this.hasVisibleRows) { - return; - } - var nbRows = this.getRowsNb(true); - for (var i = 0, len = this.visibleRows.length; i < len; i++) { - var row = this.visibleRows[i]; - //row index cannot be > nrows - if (row <= nbRows) { - this.validateRow(row, true); - } - } - }; - - /** - * Clear all the filters' values - */ - - - TableFilter.prototype.clearFilters = function clearFilters() { - if (!this.fltGrid) { - return; - } - - this.emitter.emit('before-clearing-filters', this); - - if (this.onBeforeReset) { - this.onBeforeReset.call(null, this, this.getFiltersValue()); - } - for (var i = 0, len = this.fltIds.length; i < len; i++) { - this.setFilterValue(i, ''); - } - - this.filter(); - - if (this.onAfterReset) { - this.onAfterReset.call(null, this); - } - this.emitter.emit('after-clearing-filters', this); - }; - - /** - * Clears filtered columns visual indicator (background color) - */ - - - TableFilter.prototype.clearActiveColumns = function clearActiveColumns() { - for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { - (0, _dom.removeClass)(this.getHeaderElement(i), this.activeColumnsCssClass); - } - }; - - /** - * Mark currently filtered column - * @param {Number} colIndex Column index - */ - - - TableFilter.prototype.markActiveColumn = function markActiveColumn(colIndex) { - var header = this.getHeaderElement(colIndex); - if ((0, _dom.hasClass)(header, this.activeColumnsCssClass)) { - return; - } - if (this.onBeforeActiveColumn) { - this.onBeforeActiveColumn.call(null, this, colIndex); - } - (0, _dom.addClass)(header, this.activeColumnsCssClass); - if (this.onAfterActiveColumn) { - this.onAfterActiveColumn.call(null, this, colIndex); - } - }; - - /** - * Return the ID of the current active filter - * @returns {String} - */ - - - TableFilter.prototype.getActiveFilterId = function getActiveFilterId() { - return this.activeFilterId; - }; - - /** - * Set the ID of the current active filter - * @param {String} filterId Element ID - */ - - - TableFilter.prototype.setActiveFilterId = function setActiveFilterId(filterId) { - this.activeFilterId = filterId; - }; - - /** - * Return the column index for a given filter ID - * @param {string} [filterId=''] Filter ID - * @returns {Number} Column index - */ - - - TableFilter.prototype.getColumnIndexFromFilterId = function getColumnIndexFromFilterId() { - var filterId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - - var idx = filterId.split('_')[0]; - idx = idx.split(this.prfxFlt)[1]; - return parseInt(idx, 10); - }; - - /** - * Make specified column's filter active - * @param colIndex Index of a column - */ - - - TableFilter.prototype.activateFilter = function activateFilter(colIndex) { - if ((0, _types.isUndef)(colIndex)) { - return; - } - this.setActiveFilterId(this.getFilterId(colIndex)); - }; - - /** - * Refresh the filters subject to linking ('select', 'multiple', - * 'checklist' type) - */ - - - TableFilter.prototype.linkFilters = function linkFilters() { - if (!this.linkedFilters || !this.activeFilterId) { - return; - } - var slcA1 = this.getFiltersByType(_const.SELECT, true), - slcA2 = this.getFiltersByType(_const.MULTIPLE, true), - slcA3 = this.getFiltersByType(_const.CHECKLIST, true), - slcIndex = slcA1.concat(slcA2); - slcIndex = slcIndex.concat(slcA3); - - var activeIdx = this.getColumnIndexFromFilterId(this.activeFilterId); - - for (var i = 0, len = slcIndex.length; i < len; i++) { - var curSlc = (0, _dom.elm)(this.fltIds[slcIndex[i]]); - var slcSelectedValue = this.getFilterValue(slcIndex[i]); - - // Welcome to cyclomatic complexity hell :) - // TODO: simplify/refactor if statement - if (activeIdx !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) !== -1 && activeIdx === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) !== -1 || slcA2.indexOf(slcIndex[i]) !== -1) || slcSelectedValue === this.displayAllText) { - - //1st option needs to be inserted - if (this.loadFltOnDemand) { - var opt0 = (0, _dom.createOpt)(this.displayAllText, ''); - curSlc.innerHTML = ''; - curSlc.appendChild(opt0); - } - - if (slcA3.indexOf(slcIndex[i]) !== -1) { - this.emitter.emit('build-checklist-filter', this, slcIndex[i]); - } else { - this.emitter.emit('build-select-filter', this, slcIndex[i], true); - } - - this.setFilterValue(slcIndex[i], slcSelectedValue); - } - } - }; - - /** - * Determines if passed filter column implements exact query match - * @param {Number} colIndex Column index - * @return {Boolean} - */ - - - TableFilter.prototype.isExactMatch = function isExactMatch(colIndex) { - var fltType = this.getFilterType(colIndex); - return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== _const.INPUT; - }; - - /** - * Checks if specified column filter ignores diacritics. - * Note this is only valid for input filter types. - * @param {any} colIndex Column index - * @returns {Boolean} - */ - - - TableFilter.prototype.ignoresDiacritics = function ignoresDiacritics(colIndex) { - var ignoreDiac = this.ignoreDiacritics; - if ((0, _types.isArray)(ignoreDiac)) { - return ignoreDiac[colIndex]; - } - return Boolean(ignoreDiac); - }; - - /** - * Check if passed script or stylesheet is already imported - * @param {String} filePath Ressource path - * @param {String} type Possible values: 'script' or 'link' - * @return {Boolean} - */ - - - TableFilter.prototype.isImported = function isImported(filePath) { - var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'script'; - - var imported = false, - attr = type === 'script' ? 'src' : 'href', - files = (0, _dom.tag)(doc, type); - for (var i = 0, len = files.length; i < len; i++) { - if ((0, _types.isUndef)(files[i][attr])) { - continue; - } - if (files[i][attr].match(filePath)) { - imported = true; - break; - } - } - return imported; - }; - - /** - * Import script or stylesheet - * @param {String} fileId Ressource ID - * @param {String} filePath Ressource path - * @param {Function} callback Callback - * @param {String} type Possible values: 'script' or 'link' - */ - - - TableFilter.prototype.import = function _import(fileId, filePath, callback) { - var _this7 = this; - - var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'script'; - - if (this.isImported(filePath, type)) { - return; - } - var o = this, - isLoaded = false, - file = void 0, - head = (0, _dom.tag)(doc, 'head')[0]; - - if (type.toLowerCase() === 'link') { - file = (0, _dom.createElm)('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); - } else { - file = (0, _dom.createElm)('script', ['id', fileId], ['type', 'text/javascript'], ['src', filePath]); - } - - //Browser <> IE onload event works only for scripts, not for stylesheets - file.onload = file.onreadystatechange = function () { - if (!isLoaded && (!_this7.readyState || _this7.readyState === 'loaded' || _this7.readyState === 'complete')) { - isLoaded = true; - if (typeof callback === 'function') { - callback.call(null, o); - } - } - }; - file.onerror = function () { - throw new Error('TableFilter could not load: ' + filePath); - }; - head.appendChild(file); - }; - - /** - * Check if table has filters grid - * @return {Boolean} - */ - - - TableFilter.prototype.isInitialized = function isInitialized() { - return this.initialized; - }; - - /** - * Get list of filter IDs - * @return {[type]} [description] - */ - - - TableFilter.prototype.getFiltersId = function getFiltersId() { - return this.fltIds || []; - }; - - /** - * Get filtered (valid) rows indexes - * @param {Boolean} reCalc Force calculation of filtered rows list - * @return {Array} List of row indexes - */ - - - TableFilter.prototype.getValidRows = function getValidRows(reCalc) { - if (!reCalc) { - return this.validRowsIndex; - } - - var nbRows = this.getRowsNb(true); - this.validRowsIndex = []; - for (var k = this.refRow; k < nbRows; k++) { - var r = this.tbl.rows[k]; - if (!this.paging) { - if (this.getRowDisplay(r) !== _const.NONE) { - this.validRowsIndex.push(r.rowIndex); - } - } else { - if (r.getAttribute('validRow') === 'true' || r.getAttribute('validRow') === null) { - this.validRowsIndex.push(r.rowIndex); - } - } - } - return this.validRowsIndex; - }; - - /** - * Get the index of the row containing the filters - * @return {Number} - */ - - - TableFilter.prototype.getFiltersRowIndex = function getFiltersRowIndex() { - return this.filtersRowIndex; - }; - - /** - * Get the index of the headers row - * @return {Number} - */ - - - TableFilter.prototype.getHeadersRowIndex = function getHeadersRowIndex() { - return this.headersRow; - }; - - /** - * Get the row index from where the filtering process start (1st filterable - * row) - * @return {Number} - */ - - - TableFilter.prototype.getStartRowIndex = function getStartRowIndex() { - return this.refRow; - }; - - /** - * Get the index of the last row - * @return {Number} - */ - - - TableFilter.prototype.getLastRowIndex = function getLastRowIndex() { - var nbRows = this.getRowsNb(true); - return nbRows - 1; - }; - - /** - * Determine whether the specified column has one of the passed types - * @param {Number} colIndex Column index - * @param {Array} [types=[]] List of column types - * @returns {Boolean} - */ - - - TableFilter.prototype.hasType = function hasType(colIndex) { - var types = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - - if (!this.hasColTypes) { - return false; - } - var colType = this.colTypes[colIndex]; - if ((0, _types.isObj)(colType)) { - colType = colType.type; - } - return types.indexOf(colType) !== -1; - }; - - /** - * Get the header DOM element for a given column index - * @param {Number} colIndex Column index - * @return {Element} - */ - - - TableFilter.prototype.getHeaderElement = function getHeaderElement(colIndex) { - var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; - var tHead = (0, _dom.tag)(table, 'thead'); - var headersRow = this.headersRow; - var header = void 0; - for (var i = 0; i < this.nbCells; i++) { - if (i !== colIndex) { - continue; - } - if (tHead.length === 0) { - header = table.rows[headersRow].cells[i]; - } - if (tHead.length === 1) { - header = tHead[0].rows[headersRow].cells[i]; - } - break; - } - return header; - }; - - /** - * Return the list of headers' text - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} list of headers' text - */ - - - TableFilter.prototype.getHeadersText = function getHeadersText() { - var excludeHiddenCols = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - var headers = []; - for (var j = 0; j < this.nbCells; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var header = this.getHeaderElement(j); - var headerText = (0, _dom.getFirstTextNode)(header); - headers.push(headerText); - } - return headers; - }; - - /** - * Return the filter type for a specified column - * @param {Number} colIndex Column's index - * @return {String} - */ - - - TableFilter.prototype.getFilterType = function getFilterType(colIndex) { - var colType = this.cfg['col_' + colIndex]; - return !colType ? _const.INPUT : colType.toLowerCase(); - }; - - /** - * Get the total number of filterable rows - * @return {Number} - */ - - - TableFilter.prototype.getFilterableRowsNb = function getFilterableRowsNb() { - return this.getRowsNb(false); - }; - - /** - * Return the total number of valid rows - * @param {Boolean} [reCalc=false] Forces calculation of filtered rows - * @returns {Number} - */ - - - TableFilter.prototype.getValidRowsNb = function getValidRowsNb() { - var reCalc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - return this.getValidRows(reCalc).length; - }; - - /** - * Get the configuration object (literal object) - * @return {Object} - */ - - - TableFilter.prototype.config = function config() { - return this.cfg; - }; - - return TableFilter; - }(); - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.keyCode = exports.targetEvt = exports.cancelEvt = exports.stopEvt = exports.removeEvt = exports.addEvt = undefined; - - var _root = __webpack_require__(2); - - /** - * DOM event utilities - */ - - /** - * Add event handler for specified event on passed element - * - * @param {DOMElement} obj Element - * @param {String} type Event type - * @param {Function} Handler - * @param {Boolean} capture Specifiy whether the event should be executed in - * the capturing or in the bubbling phase - */ - var addEvt = exports.addEvt = function addEvt(obj, type, func, capture) { - if (obj.addEventListener) { - obj.addEventListener(type, func, capture); - } else if (obj.attachEvent) { - obj.attachEvent('on' + type, func); - } else { - obj['on' + type] = func; - } - }; - - /** - * Remove event handler for specified event on passed element - * - * @param {DOMElement} obj Element - * @param {String} type Event type - * @param {Function} Handler - * @param {Boolean} capture Specifiy whether the event should be executed in - * the capturing or in the bubbling phase - */ - var removeEvt = exports.removeEvt = function removeEvt(obj, type, func, capture) { - if (obj.detachEvent) { - obj.detachEvent('on' + type, func); - } else if (obj.removeEventListener) { - obj.removeEventListener(type, func, capture); - } else { - obj['on' + type] = null; - } - }; - - /** - * Prevents further propagation of the current event in the bubbling phase - * - * @param {Event} evt Event on the DOM - */ - var stopEvt = exports.stopEvt = function stopEvt(evt) { - if (!evt) { - evt = _root.root.event; - } - if (evt.stopPropagation) { - evt.stopPropagation(); - } else { - evt.cancelBubble = true; - } - }; - - /** - * Cancels the event if it is cancelable, without stopping further - * propagation of the event. - * - * @param {Event} evt Event on the DOM - */ - var cancelEvt = exports.cancelEvt = function cancelEvt(evt) { - if (!evt) { - evt = _root.root.event; - } - if (evt.preventDefault) { - evt.preventDefault(); - } else { - evt.returnValue = false; - } - }; - - /** - * Reference to the object that dispatched the event - * - * @param {Event} evt Event on the DOM - * @returns {DOMElement} - */ - var targetEvt = exports.targetEvt = function targetEvt(evt) { - if (!evt) { - evt = _root.root.event; - } - return evt.target || evt.srcElement; - }; - - /** - * Returns the Unicode value of pressed key - * - * @param {Event} evt Event on the DOM - * @returns {Number} - */ - var keyCode = exports.keyCode = function keyCode(evt) { - return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; - }; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: 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; }; - - /** - * Export window or global object depending on the environment - */ - var root = exports.root = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) === 'object' && self.self === self && self || (typeof global === 'undefined' ? 'undefined' : _typeof(global)) === 'object' && global.global === global && global || undefined; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.tag = exports.elm = exports.createCheckItem = exports.createOpt = exports.removeClass = exports.addClass = exports.hasClass = exports.createText = exports.removeElm = exports.createElm = exports.getFirstTextNode = exports.getText = undefined; - - var _root = __webpack_require__(2); - - var _types = __webpack_require__(4); - - var _string = __webpack_require__(5); - - /** - * DOM utilities - */ - - var doc = _root.root.document; - - /** - * Returns text + text of children of given node - * @param {NodeElement} node - * @return {String} - */ - var getText = exports.getText = function getText(node) { - if ((0, _types.isUndef)(node.textContent)) { - return (0, _string.trim)(node.innerText); - } - return (0, _string.trim)(node.textContent); - }; - - /** - * Returns the first text node contained in the supplied node - * @param {NodeElement} node node - * @return {String} - */ - var getFirstTextNode = exports.getFirstTextNode = function getFirstTextNode(node) { - for (var i = 0; i < node.childNodes.length; i++) { - var n = node.childNodes[i]; - if (n.nodeType === 3) { - return n.data; - } - } - }; - - /** - * Creates an html element with given collection of attributes - * @param {String} tag a string of the html tag to create - * @param {Array} an undetermined number of arrays containing the with 2 - * items, the attribute name and its value ['id','myId'] - * @return {Object} created element - */ - var createElm = exports.createElm = function createElm() { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var tag = args[0]; - if (!(0, _types.isString)(tag)) { - return null; - } - - var el = doc.createElement(tag); - for (var i = 0; i < args.length; i++) { - var arg = args[i]; - - if ((0, _types.isArray)(arg) && arg.length === 2) { - el.setAttribute(arg[0], arg[1]); - } - } - - return el; - }; - - /** - * Removes passed node from DOM - * @param {DOMElement} node - * @return {DOMElement} old node reference - */ - var removeElm = exports.removeElm = function removeElm(node) { - return node.parentNode.removeChild(node); - }; - - /** - * Returns a text node with given text - * @param {String} txt - * @return {Object} - */ - var createText = exports.createText = function createText(txt) { - return doc.createTextNode(txt); - }; - - /** - * Determine whether the passed elements is assigned the given class - * @param {DOMElement} ele DOM element - * @param {String} cls CSS class name - * @returns {Boolean} - */ - var hasClass = exports.hasClass = function hasClass(ele, cls) { - if ((0, _types.isUndef)(ele)) { - return false; - } - - if (supportsClassList()) { - return ele.classList.contains(cls); - } - return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); - }; - - /** - * Adds the specified class to the passed element - * @param {DOMElement} ele DOM element - * @param {String} cls CSS class name - */ - var addClass = exports.addClass = function addClass(ele, cls) { - if ((0, _types.isUndef)(ele)) { - return; - } - - if (supportsClassList()) { - ele.classList.add(cls); - return; - } - - if (ele.className === '') { - ele.className = cls; - } else if (!hasClass(ele, cls)) { - ele.className += ' ' + cls; - } - }; - - /** - * Removes the specified class to the passed element - * @param {DOMElement} ele DOM element - * @param {String} cls CSS class name - */ - var removeClass = exports.removeClass = function removeClass(ele, cls) { - if ((0, _types.isUndef)(ele)) { - return; - } - - if (supportsClassList()) { - ele.classList.remove(cls); - return; - } - var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)', 'g'); - ele.className = ele.className.replace(reg, ''); - }; - - /** - * Creates and returns an option element - * @param {String} text option text - * @param {String} value option value - * @param {Boolean} isSel whether option is selected - * @return {Object} option element - */ - var createOpt = exports.createOpt = function createOpt(text, value, isSel) { - var isSelected = isSel ? true : false; - var opt = isSelected ? createElm('option', ['value', value], ['selected', 'true']) : createElm('option', ['value', value]); - opt.appendChild(createText(text)); - return opt; - }; - - /** - * Creates and returns a checklist item - * @param {Number} chkIndex index of check item - * @param {String} chkValue check item value - * @param {String} labelText check item label text - * @return {Object} li DOM element - */ - var createCheckItem = exports.createCheckItem = function createCheckItem(chkIndex, chkValue, labelText) { - var li = createElm('li'); - var label = createElm('label', ['for', chkIndex]); - var check = createElm('input', ['id', chkIndex], ['name', chkIndex], ['type', 'checkbox'], ['value', chkValue]); - label.appendChild(check); - label.appendChild(createText(labelText)); - li.appendChild(label); - li.label = label; - li.check = check; - return li; - }; - - /** - * Returns the element matching the supplied Id - * @param {String} id Element identifier - * @return {DOMElement} - */ - var elm = exports.elm = function elm(id) { - return doc.getElementById(id); - }; - - /** - * Returns list of element matching the supplied tag name - * @param {String} tagname Tag name - * @return {NodeList} - */ - var tag = exports.tag = function tag(o, tagname) { - return o.getElementsByTagName(tagname); - }; - - // HTML5 classList API - function supportsClassList() { - return doc.documentElement.classList; - } - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - /** - * Types utilities - */ - - var UNDEFINED = void 0; - - /** - * Check passed argument is an object - * @param {Object} obj - * @return {Boolean} - */ - var isObj = exports.isObj = function isObj(obj) { - return Object.prototype.toString.call(obj) === '[object Object]'; - }; - - /** - * Check passed argument is a function - * @param {Function} obj - * @return {Boolean} - */ - var isFn = exports.isFn = function isFn(obj) { - return Object.prototype.toString.call(obj) === '[object Function]'; - }; - - /** - * Check passed argument is an array - * @param {Array} obj - * @return {Boolean} - */ - var isArray = exports.isArray = function isArray(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; - - /** - * Check passed argument is a string - * @param {String} obj objue - * @returns {Boolean} - */ - var isString = exports.isString = function isString(obj) { - return Object.prototype.toString.call(obj) === '[object String]'; - }; - - /** - * Check passed argument is a number - * @param {Number} obj - * @returns {Boolean} - */ - var isNumber = exports.isNumber = function isNumber(obj) { - return Object.prototype.toString.call(obj) === '[object Number]'; - }; - - /** - * Check passed argument is undefined - * @param {Any} obj - * @return {Boolean} - */ - var isUndef = exports.isUndef = function isUndef(obj) { - return obj === UNDEFINED; - }; - - /** - * Check passed argument is null - * @param {Any} obj - * @return {Boolean} - */ - var isNull = exports.isNull = function isNull(obj) { - return obj === null; - }; - - /** - * Check passed argument is empty (undefined, null or empty string) - * @param {Any} obj - * @return {Boolean} - */ - var isEmpty = exports.isEmpty = function isEmpty(obj) { - return isUndef(obj) || isNull(obj) || obj.length === 0; - }; - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.contains = exports.matchCase = exports.rgxEsc = exports.isEmpty = exports.trim = undefined; - - var _diacritics = __webpack_require__(6); - - /** - * String utilities - */ - - /** - * Removes whitespace from both sides of passed string - * @param {String} text - * @return {String} - */ - var trim = exports.trim = function trim(text) { - if (text.trim) { - return text.trim(); - } - return text.replace(/^\s*|\s*$/g, ''); - }; - - /** - * Checks if passed string is empty - * @param {String} text - * @return {Boolean} - */ - var isEmpty = exports.isEmpty = function isEmpty(text) { - return trim(text) === ''; - }; - - /** - * Makes regex safe string by escaping special characters from passed string - * @param {String} text - * @return {String} escaped string - */ - var rgxEsc = exports.rgxEsc = function rgxEsc(text) { - var chars = /[-\/\\^$*+?.()|[\]{}]/g; - var escMatch = '\\$&'; - return String(text).replace(chars, escMatch); - }; - - /** - * Returns passed string as lowercase if caseSensitive flag set false. By - * default it returns the string with no casing changes. - * @param {String} text - * @return {String} string - */ - var matchCase = exports.matchCase = function matchCase(text) { - var caseSensitive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - if (!caseSensitive) { - return text.toLowerCase(); - } - return text; - }; - - /** - * Checks if passed data contains the searched term - * @param {String} term Searched term - * @param {String} data Data string - * @param {Boolean} exactMatch Exact match - * @param {Boolean} caseSensitive Case sensitive - * @param {Boolean} ignoreDiacritics Ignore diacritics - * @return {Boolean} - */ - var contains = exports.contains = function contains(term, data) { - var exactMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var caseSensitive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var ignoreDiacritics = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; - - // Improved by Cedric Wartel (cwl) automatic exact match for selects and - // special characters are now filtered - var regexp = void 0; - var modifier = caseSensitive ? 'g' : 'gi'; - if (ignoreDiacritics) { - term = (0, _diacritics.remove)(term); - data = (0, _diacritics.remove)(data); - } - if (exactMatch) { - regexp = new RegExp('(^\\s*)' + rgxEsc(term) + '(\\s*$)', modifier); - } else { - regexp = new RegExp(rgxEsc(term), modifier); - } - return regexp.test(data); - }; - -/***/ }, -/* 6 */ -/***/ function(module, exports) { - - exports.remove = removeDiacritics; - - var replacementList = [ - { - base: ' ', - chars: "\u00A0", - }, { - base: '0', - chars: "\u07C0", - }, { - base: 'A', - chars: "\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F", - }, { - base: 'AA', - chars: "\uA732", - }, { - base: 'AE', - chars: "\u00C6\u01FC\u01E2", - }, { - base: 'AO', - chars: "\uA734", - }, { - base: 'AU', - chars: "\uA736", - }, { - base: 'AV', - chars: "\uA738\uA73A", - }, { - base: 'AY', - chars: "\uA73C", - }, { - base: 'B', - chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181", - }, { - base: 'C', - chars: "\u24b8\uff23\uA73E\u1E08\u0106\u0043\u0108\u010A\u010C\u00C7\u0187\u023B", - }, { - base: 'D', - chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779", - }, { - base: 'Dh', - chars: "\u00D0", - }, { - base: 'DZ', - chars: "\u01F1\u01C4", - }, { - base: 'Dz', - chars: "\u01F2\u01C5", - }, { - base: 'E', - chars: "\u025B\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E\u1D07", - }, { - base: 'F', - chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B", - }, { - base: 'G', - chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262", - }, { - base: 'H', - chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D", - }, { - base: 'I', - chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197", - }, { - base: 'J', - chars: "\u24BF\uFF2A\u0134\u0248\u0237", - }, { - base: 'K', - chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2", - }, { - base: 'L', - chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780", - }, { - base: 'LJ', - chars: "\u01C7", - }, { - base: 'Lj', - chars: "\u01C8", - }, { - base: 'M', - chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB", - }, { - base: 'N', - chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E", - }, { - base: 'NJ', - chars: "\u01CA", - }, { - base: 'Nj', - chars: "\u01CB", - }, { - base: 'O', - chars: "\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C", - }, { - base: 'OE', - chars: "\u0152", - }, { - base: 'OI', - chars: "\u01A2", - }, { - base: 'OO', - chars: "\uA74E", - }, { - base: 'OU', - chars: "\u0222", - }, { - base: 'P', - chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754", - }, { - base: 'Q', - chars: "\u24C6\uFF31\uA756\uA758\u024A", - }, { - base: 'R', - chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782", - }, { - base: 'S', - chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784", - }, { - base: 'T', - chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786", - }, { - base: 'Th', - chars: "\u00DE", - }, { - base: 'TZ', - chars: "\uA728", - }, { - base: 'U', - chars: "\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244", - }, { - base: 'V', - chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245", - }, { - base: 'VY', - chars: "\uA760", - }, { - base: 'W', - chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72", - }, { - base: 'X', - chars: "\u24CD\uFF38\u1E8A\u1E8C", - }, { - base: 'Y', - chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE", - }, { - base: 'Z', - chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762", - }, { - base: 'a', - chars: "\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250\u0251", - }, { - base: 'aa', - chars: "\uA733", - }, { - base: 'ae', - chars: "\u00E6\u01FD\u01E3", - }, { - base: 'ao', - chars: "\uA735", - }, { - base: 'au', - chars: "\uA737", - }, { - base: 'av', - chars: "\uA739\uA73B", - }, { - base: 'ay', - chars: "\uA73D", - }, { - base: 'b', - chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182", - }, { - base: 'c', - chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184", - }, { - base: 'd', - chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA", - }, { - base: 'dh', - chars: "\u00F0", - }, { - base: 'dz', - chars: "\u01F3\u01C6", - }, { - base: 'e', - chars: "\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u01DD", - }, { - base: 'f', - chars: "\u24D5\uFF46\u1E1F\u0192", - }, { - base: 'ff', - chars: "\uFB00", - }, { - base: 'fi', - chars: "\uFB01", - }, { - base: 'fl', - chars: "\uFB02", - }, { - base: 'ffi', - chars: "\uFB03", - }, { - base: 'ffl', - chars: "\uFB04", - }, { - base: 'g', - chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79", - }, { - base: 'h', - chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265", - }, { - base: 'hv', - chars: "\u0195", - }, { - base: 'i', - chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131", - }, { - base: 'j', - chars: "\u24D9\uFF4A\u0135\u01F0\u0249", - }, { - base: 'k', - chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3", - }, { - base: 'l', - chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D", - }, { - base: 'lj', - chars: "\u01C9", - }, { - base: 'm', - chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F", - }, { - base: 'n', - chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509", - }, { - base: 'nj', - chars: "\u01CC", - }, { - base: 'o', - chars: "\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\uA74B\uA74D\u0275\u0254\u1D11", - }, { - base: 'oe', - chars: "\u0153", - }, { - base: 'oi', - chars: "\u01A3", - }, { - base: 'oo', - chars: "\uA74F", - }, { - base: 'ou', - chars: "\u0223", - }, { - base: 'p', - chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1", - }, { - base: 'q', - chars: "\u24E0\uFF51\u024B\uA757\uA759", - }, { - base: 'r', - chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783", - }, { - base: 's', - chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282", - }, { - base: 'ss', - chars: "\xDF", - }, { - base: 't', - chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787", - }, { - base: 'th', - chars: "\u00FE", - }, { - base: 'tz', - chars: "\uA729", - }, { - base: 'u', - chars: "\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289", - }, { - base: 'v', - chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C", - }, { - base: 'vy', - chars: "\uA761", - }, { - base: 'w', - chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73", - }, { - base: 'x', - chars: "\u24E7\uFF58\u1E8B\u1E8D", - }, { - base: 'y', - chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF", - }, { - base: 'z', - chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763", - } - ]; - - var diacriticsMap = {}; - for (var i = 0; i < replacementList.length; i += 1) { - var chars = replacementList[i].chars; - for (var j = 0; j < chars.length; j += 1) { - diacriticsMap[chars[j]] = replacementList[i].base; - } - } - - function removeDiacritics(str) { - return str.replace(/[^\u0000-\u007e]/g, function(c) { - return diacriticsMap[c] || c; - }); - } - - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.parse = undefined; - - var _types = __webpack_require__(4); - - /** - * Takes a string, removes all formatting/cruft and returns the raw float value - * @param {String} Formatted number - * @param {String} Decimal type '.' or ',' - * @return {Number} Unformatted number - * - * https://github.com/openexchangerates/accounting.js/blob/master/accounting.js - */ - var parse = exports.parse = function parse(value) { - var decimal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.'; - - // Return the value as-is if it's already a number - if ((0, _types.isNumber)(value)) { - return value; - } - - // Build regex to strip out everything except digits, decimal point and - // minus sign - var regex = new RegExp('[^0-9-' + decimal + ']', ['g']); - var unformatted = parseFloat(('' + value).replace(/\((.*)\)/, '-$1') // replace bracketed values with negatives - .replace(regex, '') // strip out any cruft - .replace(decimal, '.') // make sure decimal point is standard - ); - - // This will fail silently - return !isNaN(unformatted) ? unformatted : 0; - }; - -/***/ }, -/* 8 */ -/***/ function(module, exports) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /** - * Event emitter class - */ - var Emitter = exports.Emitter = function () { - /** - * Creates an instance of Emitter. - */ - function Emitter() { - _classCallCheck(this, Emitter); - - /** - * Events object - * @type {Object} - */ - this.events = {}; - } - - /** - * Subscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - - Emitter.prototype.on = function on(evts, fn) { - var _this = this; - - evts.forEach(function (evt) { - _this.events[evt] = _this.events[evt] || []; - _this.events[evt].push(fn); - }); - }; - - /** - * Unsubscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - - Emitter.prototype.off = function off(evts, fn) { - var _this2 = this; - - evts.forEach(function (evt) { - if (evt in _this2.events) { - _this2.events[evt].splice(_this2.events[evt].indexOf(fn), 1); - } - }); - }; - - /** - * Emit an event - * @param {String} evt Event name followed by any other argument passed to - * the invoked function - */ - - - Emitter.prototype.emit = function emit(evt /*, args...*/) { - if (evt in this.events) { - for (var i = 0; i < this.events[evt].length; i++) { - this.events[evt][i].apply(this, [].slice.call(arguments, 1)); - } - } - }; - - return Emitter; - }(); - -/***/ }, -/* 9 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.GridLayout = undefined; - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _event = __webpack_require__(1); - - var _string = __webpack_require__(5); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Grid layout, table with fixed headers - */ - var GridLayout = exports.GridLayout = function (_Feature) { - _inherits(GridLayout, _Feature); - - /** - * Creates an instance of GridLayout - * @param {TableFilter} tf TableFilter instance - */ - function GridLayout(tf) { - _classCallCheck(this, GridLayout); - - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'gridLayout')); - - var f = _this.config; - - /** - * Grid-layout container width as CSS string - * @type {String} - */ - _this.width = f.grid_width || null; - - /** - * Grid-layout container height as CSS string - * @type {String} - */ - _this.height = f.grid_height || null; - - /** - * Css class for main container element - * @type {String} - */ - _this.mainContCssClass = f.grid_cont_css_class || 'grd_Cont'; - - /** - * Css class for body table container element - * @type {String} - */ - _this.contCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; - - /** - * Css class for headers table container element - * @type {String} - */ - _this.headContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; - - /** - * Css class for toolbar container element (rows counter, paging etc.) - * @type {String} - */ - _this.infDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; - - /** - * Index of the headers row, default: 0 - * @type {Number} - */ - _this.headRowIndex = f.grid_headers_row_index || 0; - - /** - * Collection of the header row indexes to be moved into headers table - * @type {Array} - */ - _this.headRows = f.grid_headers_rows || [0]; - - /** - * Enable or disable column filters generation, default: true - * @type {Boolean} - */ - _this.enableFilters = f.grid_enable_default_filters === false ? false : true; - - /** - * Enable or disable column headers, default: false - * @type {Boolean} - */ - _this.noHeaders = Boolean(f.grid_no_headers); - - /** - * Grid-layout default column widht as CSS string - * @type {String} - */ - _this.defaultColWidth = f.grid_default_col_width || '100px'; - - /** - * List of column elements - * @type {Array} - * @private - */ - _this.colElms = []; - - /** - * Prefix for grid-layout main container ID - * @type {String} - * @private - */ - _this.prfxMainTblCont = 'gridCont_'; - - /** - * Prefix for grid-layout body table container ID - * @type {String} - * @private - */ - _this.prfxTblCont = 'tblCont_'; - - /** - * Prefix for grid-layout headers table container ID - * @type {String} - * @private - */ - _this.prfxHeadTblCont = 'tblHeadCont_'; - - /** - * Prefix for grid-layout headers table ID - * @type {String} - * @private - */ - _this.prfxHeadTbl = 'tblHead_'; - - /** - * Prefix for grid-layout filter's cell ID - * @type {String} - * @private - */ - _this.prfxGridFltTd = '_td_'; - - /** - * Prefix for grid-layout header's cell ID - * @type {String} - * @private - */ - _this.prfxGridTh = 'tblHeadTh_'; - - /** - * Mark-up of original HTML table - * @type {String} - * @private - */ - _this.sourceTblHtml = tf.tbl.outerHTML; - - /** - * Indicates if working table has column elements - * @type {Boolean} - * @private - */ - _this.tblHasColTag = (0, _dom.tag)(tf.tbl, 'col').length > 0 ? true : false; - - /** - * Main container element - * @private - */ - _this.tblMainCont = null; - - /** - * Table container element - * @private - */ - _this.tblCont = null; - - /** - * Headers' table container element - * @private - */ - _this.headTblCont = null; - - /** - * Headers' table element - * @private - */ - _this.headTbl = null; - - // filters flag at TF level - tf.fltGrid = _this.enableFilters; - return _this; - } - - /** - * Generates a grid with fixed headers - * TODO: reduce size of init by extracting single purposed methods - */ - - - GridLayout.prototype.init = function init() { - var _this2 = this; - - var tf = this.tf; - var tbl = tf.tbl; - - if (this.initialized) { - return; - } - - // Override relevant TableFilter properties - this.setOverrides(); - - // Assign default column widths - this.setDefaultColWidths(); - - // Initial table width - var tblW = this.initialTableWidth(); - - //Main container: it will contain all the elements - this.tblMainCont = this.createContainer(this.prfxMainTblCont + tf.id, 'div', this.mainContCssClass); - if (this.width) { - this.tblMainCont.style.width = this.width; - } - tbl.parentNode.insertBefore(this.tblMainCont, tbl); - - //Table container: div wrapping content table - this.tblCont = this.createContainer(this.prfxTblCont + tf.id, 'div', this.contCssClass); - this.setConfigWidth(this.tblCont); - if (this.height) { - this.tblCont.style.height = this.height; - } - tbl.parentNode.insertBefore(this.tblCont, tbl); - var t = (0, _dom.removeElm)(tbl); - this.tblCont.appendChild(t); - - //In case table width is expressed in % - if (tbl.style.width === '') { - tbl.style.width = ((0, _string.contains)('%', tblW) ? tbl.clientWidth : tblW) + 'px'; - } - - var d = (0, _dom.removeElm)(this.tblCont); - this.tblMainCont.appendChild(d); - - //Headers table container: div wrapping headers table - this.headTblCont = this.createContainer(this.prfxHeadTblCont + tf.id, 'div', this.headContCssClass); - this.setConfigWidth(this.headTblCont); - - //Headers table - this.headTbl = (0, _dom.createElm)('table', ['id', this.prfxHeadTbl + tf.id]); - var tH = (0, _dom.createElm)('tHead'); - - //1st row should be headers row, ids are added if not set - //Those ids are used by the sort feature - var hRow = tbl.rows[this.headRowIndex]; - var sortTriggers = this.getSortTriggerIds(hRow); - - //Filters row is created - var filtersRow = this.createFiltersRow(); - - //Headers row are moved from content table to headers table - this.setHeadersRow(tH); - - this.headTbl.appendChild(tH); - if (tf.filtersRowIndex === 0) { - tH.insertBefore(filtersRow, hRow); - } else { - tH.appendChild(filtersRow); - } - - this.headTblCont.appendChild(this.headTbl); - this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); - - //THead needs to be removed in content table for sort feature - var thead = (0, _dom.tag)(tbl, 'thead'); - if (thead.length > 0) { - tbl.removeChild(thead[0]); - } - - //Headers table style - this.headTbl.style.tableLayout = 'fixed'; - tbl.style.tableLayout = 'fixed'; - this.headTbl.cellPadding = tbl.cellPadding; - this.headTbl.cellSpacing = tbl.cellSpacing; - // this.headTbl.style.width = tbl.style.width; - - //content table without headers needs col widths to be reset - tf.setColWidths(this.headTbl); - - //Headers container width - // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; - - tbl.style.width = ''; - // - this.headTbl.style.width = tbl.clientWidth + 'px'; - // - - //scroll synchronisation - (0, _event.addEvt)(this.tblCont, 'scroll', function (evt) { - var elm = (0, _event.targetEvt)(evt); - var scrollLeft = elm.scrollLeft; - _this2.headTblCont.scrollLeft = scrollLeft; - //New pointerX calc taking into account scrollLeft - // if(!o.isPointerXOverwritten){ - // try{ - // o.Evt.pointerX = function(evt){ - // let e = evt || global.event; - // let bdScrollLeft = tf_StandardBody().scrollLeft + - // scrollLeft; - // return (e.pageX + scrollLeft) || - // (e.clientX + bdScrollLeft); - // }; - // o.isPointerXOverwritten = true; - // } catch(err) { - // o.isPointerXOverwritten = false; - // } - // } - }); - - // TODO: Trigger a custom event handled by sort extension - var sort = tf.extension('sort'); - if (sort) { - sort.asyncSort = true; - sort.triggerIds = sortTriggers; - } - - //Col elements are enough to keep column widths after sorting and - //filtering - this.setColumnElements(); - - if (tf.popupFilters) { - filtersRow.style.display = _const.NONE; - } - - if (tbl.clientWidth !== this.headTbl.clientWidth) { - tbl.style.width = this.headTbl.clientWidth + 'px'; - } - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Overrides TableFilter instance properties to adjust to grid layout mode - * @private - */ - - - GridLayout.prototype.setOverrides = function setOverrides() { - var tf = this.tf; - tf.refRow = 0; - tf.headersRow = 0; - tf.filtersRowIndex = 1; - tf.isExternalFlt = true; - }; - - /** - * Set grid-layout default column widths if column widths are not defined - * @private - */ - - - GridLayout.prototype.setDefaultColWidths = function setDefaultColWidths() { - var tf = this.tf; - if (tf.hasColWidths) { - return; - } - for (var k = 0, len = tf.getCellsNb(); k < len; k++) { - var colW = void 0; - var cell = tf.tbl.rows[tf.getHeadersRowIndex()].cells[k]; - if (cell.width !== '') { - colW = cell.width; - } else if (cell.style.width !== '') { - colW = parseInt(cell.style.width, 10); - } else { - colW = this.defaultColWidth; - } - tf.colWidths[k] = colW; - } - tf.hasColWidths = true; - tf.setColWidths(); - }; - - /** - * Initial table width - * @returns {Number} - * @private - */ - - - GridLayout.prototype.initialTableWidth = function initialTableWidth() { - var tbl = this.tf.tbl; - var width = void 0; //initial table width - - if (tbl.width !== '') { - width = tbl.width; - } else if (tbl.style.width !== '') { - width = tbl.style.width; - } else { - width = tbl.clientWidth; - } - return parseInt(width, 10); - }; - - /** - * Creates container element - * @param {String} id Element ID - * @param {String} tag Tag name - * @param {String} className Css class to assign to element - * @returns {DOMElement} - * @private - */ - - - GridLayout.prototype.createContainer = function createContainer(id, tag, className) { - var element = (0, _dom.createElm)(tag, ['id', id]); - element.className = className; - return element; - }; - - /** - * Creates filters row with cells - * @returns {HTMLTableRowElement} - * @private - */ - - - GridLayout.prototype.createFiltersRow = function createFiltersRow() { - var tf = this.tf; - var filtersRow = (0, _dom.createElm)('tr'); - if (this.enableFilters && tf.fltGrid) { - tf.externalFltTgtIds = []; - for (var j = 0; j < tf.getCellsNb(); j++) { - var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; - var cl = (0, _dom.createElm)(tf.fltCellTag, ['id', fltTdId]); - filtersRow.appendChild(cl); - tf.externalFltTgtIds[j] = fltTdId; - } - } - return filtersRow; - }; - - /** - * Generates column elements if necessary and assigns their widths - * @private - */ - - - GridLayout.prototype.setColumnElements = function setColumnElements() { - var tf = this.tf; - var cols = (0, _dom.tag)(tf.tbl, 'col'); - this.tblHasColTag = cols.length > 0; - - for (var k = tf.nbCells - 1; k >= 0; k--) { - var col = void 0; - var id = tf.id + '_col_' + k; - - if (!this.tblHasColTag) { - col = (0, _dom.createElm)('col', ['id', id]); - tf.tbl.insertBefore(col, tf.tbl.firstChild); - } else { - col = cols[k]; - col.setAttribute('id', id); - } - col.style.width = tf.colWidths[k]; - this.colElms[k] = col; - } - this.tblHasColTag = true; - }; - - /** - * Sets headers row in headers table - * @param {HTMLHeadElement} tableHead Table head element - * @private - */ - - - GridLayout.prototype.setHeadersRow = function setHeadersRow(tableHead) { - if (this.noHeaders) { - // Handle table with no headers, assuming here headers do not - // exist - tableHead.appendChild((0, _dom.createElm)('tr')); - } else { - // Headers row are moved from content table to headers table - for (var i = 0; i < this.headRows.length; i++) { - var row = this.tf.tbl.rows[this.headRows[i]]; - tableHead.appendChild(row); - } - } - }; - - /** - * Sets width defined in configuration to passed element - * @param {DOMElement} element DOM element - * @private - */ - - - GridLayout.prototype.setConfigWidth = function setConfigWidth(element) { - if (!this.width) { - return; - } - if (this.width.indexOf('%') !== -1) { - element.style.width = '100%'; - } else { - element.style.width = this.width; - } - }; - - /** - * Returns a list of header IDs used for specifing external sort triggers - * @param {HTMLTableRowElement} row DOM row element - * @returns {Array} List of IDs - * @private - */ - - - GridLayout.prototype.getSortTriggerIds = function getSortTriggerIds(row) { - var tf = this.tf; - var sortTriggers = []; - for (var n = 0; n < tf.getCellsNb(); n++) { - var c = row.cells[n]; - var thId = c.getAttribute('id'); - if (!thId || thId === '') { - thId = this.prfxGridTh + n + '_' + tf.id; - c.setAttribute('id', thId); - } - sortTriggers.push(thId); - } - return sortTriggers; - }; - - /** - * Removes the grid layout - */ - - - GridLayout.prototype.destroy = function destroy() { - var tf = this.tf; - var tbl = tf.tbl; - - if (!this.initialized) { - return; - } - var t = (0, _dom.removeElm)(tbl); - this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); - (0, _dom.removeElm)(this.tblMainCont); - - this.tblMainCont = null; - this.headTblCont = null; - this.headTbl = null; - this.tblCont = null; - - tbl.outerHTML = this.sourceTblHtml; - //needed to keep reference of table element for future usage - this.tf.tbl = (0, _dom.elm)(tf.id); - - this.initialized = false; - }; - - return GridLayout; - }(_feature.Feature); - -/***/ }, -/* 10 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var NOTIMPLEMENTED = 'Not implemented.'; - - /** - * Base class defining the interface of a TableFilter feature - */ - - var Feature = exports.Feature = function () { - /** - * Creates an instance of Feature - * @param {Object} tf TableFilter instance - * @param {String} feature Feature name known by TableFilter - */ - function Feature(tf, feature) { - _classCallCheck(this, Feature); - - /** - * TableFilter instance - * @type {TableFilter} - */ - this.tf = tf; - - /** - * Feature name - * @type {String} - */ - this.feature = feature; - - /** - * TableFilter feature setting - * @type {Boolean} - */ - this.enabled = tf[feature]; - - /** - * TableFilter configuration - * @type {Object} - */ - this.config = tf.config(); - - /** - * TableFilter emitter instance - * @type {Emitter} - */ - this.emitter = tf.emitter; - - /** - * Field indicating whether Feature is initialized - * @type {Boolean} - */ - this.initialized = false; - } - - /** - * Initialize the feature - */ - - - Feature.prototype.init = function init() { - throw new Error(NOTIMPLEMENTED); - }; - - /** - * Reset the feature after being disabled - */ - - - Feature.prototype.reset = function reset() { - this.enable(); - this.init(); - }; - - /** - * Destroy the feature - */ - - - Feature.prototype.destroy = function destroy() { - throw new Error(NOTIMPLEMENTED); - }; - - /** - * Enable the feature - */ - - - Feature.prototype.enable = function enable() { - this.enabled = true; - }; - - /** - * Disable the feature - */ - - - Feature.prototype.disable = function disable() { - this.enabled = false; - }; - - /** - * Indicate whether the feature is enabled or not - * @returns {Boolean} - */ - - - Feature.prototype.isEnabled = function isEnabled() { - return this.enabled; - }; - - return Feature; - }(); - -/***/ }, -/* 11 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Filter types - */ - - /** - * Input filter type - * @type {String} - */ - var INPUT = exports.INPUT = 'input'; - /** - * Select filter type - * @type {String} - */ - var SELECT = exports.SELECT = 'select'; - /** - * Multiple select filter type - * @type {String} - */ - var MULTIPLE = exports.MULTIPLE = 'multiple'; - /** - * Checklist filter type - * @type {String} - */ - var CHECKLIST = exports.CHECKLIST = 'checklist'; - /** - * None filter type - * @type {String} - */ - var NONE = exports.NONE = 'none'; - - /** - * Key codes - */ - - /** - * Enter key code - * @type {Number} - */ - var ENTER_KEY = exports.ENTER_KEY = 13; - /** - * Tab key code - * @type {Number} - */ - var TAB_KEY = exports.TAB_KEY = 9; - /** - * Escape key code - * @type {Number} - */ - var ESC_KEY = exports.ESC_KEY = 27; - /** - * Up arrow key code - * @type {Number} - */ - var UP_ARROW_KEY = exports.UP_ARROW_KEY = 38; - /** - * Down arrow key code - * @type {Number} - */ - var DOWN_ARROW_KEY = exports.DOWN_ARROW_KEY = 40; - - /** - * HTML tags - */ - - /** - * Header cell tag - * @type {String} - */ - var HEADER_TAG = exports.HEADER_TAG = 'TH'; - /** - * Cell tag - * @type {String} - */ - var CELL_TAG = exports.CELL_TAG = 'TD'; - - /** - * Data types - */ - - /** - * String - * @type {String} - */ - var STRING = exports.STRING = 'string'; - - /** - * Number - * @type {String} - */ - var NUMBER = exports.NUMBER = 'number'; - - /** - * Formatted number - * @type {String} - */ - var FORMATTED_NUMBER = exports.FORMATTED_NUMBER = 'formatted-number'; - - /** - * Date - * @type {String} - */ - var DATE = exports.DATE = 'date'; - - /** - * IP address - * @type {String} - */ - var IP_ADDRESS = exports.IP_ADDRESS = 'ipaddress'; - - /** - * Default values - */ - - /** - * Auto filter delay in milliseconds - * @type {Number} - */ - var AUTO_FILTER_DELAY = exports.AUTO_FILTER_DELAY = 750; - -/***/ }, -/* 12 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Loader = undefined; - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _types = __webpack_require__(4); - - var _root = __webpack_require__(2); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Activity indicator - * - * @export - * @class Loader - * @extends {Feature} - */ - var Loader = exports.Loader = function (_Feature) { - _inherits(Loader, _Feature); - - /** - * Creates an instance of Loader. - * - * @param {TableFilter} tf TableFilter instance - */ - function Loader(tf) { - _classCallCheck(this, Loader); - - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'loader')); - - var f = _this.config; - - /** - * ID of custom container element - * @type {String} - */ - _this.targetId = f.loader_target_id || null; - - /** - * Loader container DOM element - * @type {DOMElement} - */ - _this.cont = null; - - /** - * Text displayed when indicator is visible - * @type {String} - */ - _this.text = f.loader_text || 'Loading...'; - - /** - * Custom HTML injected in Loader's container element - * @type {String} - */ - _this.html = f.loader_html || null; - - /** - * Css class for Loader's container element - * @type {String} - */ - _this.cssClass = f.loader_css_class || 'loader'; - - /** - * Close delay in milliseconds - * @type {Number} - */ - _this.closeDelay = 250; - - /** - * Callback fired when loader is displayed - * @type {Function} - */ - _this.onShow = (0, _types.isFn)(f.on_show_loader) ? f.on_show_loader : null; - - /** - * Callback fired when loader is closed - * @type {Function} - */ - _this.onHide = (0, _types.isFn)(f.on_hide_loader) ? f.on_hide_loader : null; - - /** - * Prefix for container ID - * @type {String} - * @private - */ - _this.prfx = 'load_'; - return _this; - } - - /** - * Initializes Loader instance - */ - - - Loader.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - var containerDiv = (0, _dom.createElm)('div', ['id', this.prfx + tf.id]); - containerDiv.className = this.cssClass; - - var targetEl = !this.targetId ? tf.tbl.parentNode : (0, _dom.elm)(this.targetId); - if (!this.targetId) { - targetEl.insertBefore(containerDiv, tf.tbl); - } else { - targetEl.appendChild(containerDiv); - } - this.cont = containerDiv; - if (!this.html) { - this.cont.appendChild((0, _dom.createText)(this.text)); - } else { - this.cont.innerHTML = this.html; - } - - this.show(_const.NONE); - - // Subscribe to events - emitter.on(['before-filtering', 'before-populating-filter', 'before-page-change', 'before-clearing-filters', 'before-page-length-change', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this2.show(''); - }); - emitter.on(['after-filtering', 'after-populating-filter', 'after-page-change', 'after-clearing-filters', 'after-page-length-change', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.show(_const.NONE); - }); - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Shows or hides activity indicator - * @param {String} Two possible values: '' or 'none' - */ - - - Loader.prototype.show = function show(p) { - var _this3 = this; - - if (!this.isEnabled()) { - return; - } - - var displayLoader = function displayLoader() { - if (!_this3.cont) { - return; - } - if (_this3.onShow && p !== _const.NONE) { - _this3.onShow.call(null, _this3); - } - _this3.cont.style.display = p; - if (_this3.onHide && p === _const.NONE) { - _this3.onHide.call(null, _this3); - } - }; - - var t = p === _const.NONE ? this.closeDelay : 1; - _root.root.setTimeout(displayLoader, t); - }; - - /** - * Removes feature - */ - - - Loader.prototype.destroy = function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - (0, _dom.removeElm)(this.cont); - this.cont = null; - - // Unsubscribe to events - emitter.off(['before-filtering', 'before-populating-filter', 'before-page-change', 'before-clearing-filters', 'before-page-length-change', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this4.show(''); - }); - emitter.off(['after-filtering', 'after-populating-filter', 'after-page-change', 'after-clearing-filters', 'after-page-length-change', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.show(_const.NONE); - }); - - this.initialized = false; - }; - - return Loader; - }(_feature.Feature); - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.HighlightKeyword = undefined; - - var _dom = __webpack_require__(3); - - var _types = __webpack_require__(4); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /** - * Highlight matched keywords upon filtering - * - * @export - * @class HighlightKeyword - */ - var HighlightKeyword = exports.HighlightKeyword = function () { - - /** - * Creates an instance of HighlightKeyword - * @param {TableFilter} tf TableFilter instance - */ - function HighlightKeyword(tf) { - _classCallCheck(this, HighlightKeyword); - - var f = tf.config(); - - /** - * Css class for highlighted term - * @type {String} - */ - this.highlightCssClass = f.highlight_css_class || 'keyword'; - - /** - * TableFilter instance - * @type {TableFilter} - */ - this.tf = tf; - - /** - * TableFilter's emitter instance - * @type {Emitter} - */ - this.emitter = tf.emitter; - } - - /** - * Initializes HighlightKeyword instance - */ - - - HighlightKeyword.prototype.init = function init() { - var _this = this; - - this.emitter.on(['before-filtering', 'destroy'], function () { - return _this.unhighlightAll(); - }); - this.emitter.on(['highlight-keyword'], function (tf, cell, term) { - return _this.highlight(cell, term, _this.highlightCssClass); - }); - }; - - /** - * Highlight occurences of searched term in passed node - * @param {Node} node - * @param {String} term Searched term - * @param {String} cssClass Css class name - * - * TODO: refactor this method - */ - - - HighlightKeyword.prototype.highlight = function highlight(node, term, cssClass) { - // Iterate into this nodes childNodes - if (node.hasChildNodes) { - var children = node.childNodes; - for (var i = 0; i < children.length; i++) { - this.highlight(children[i], term, cssClass); - } - } - - if (node.nodeType === 3) { - var nodeVal = node.nodeValue.toLowerCase(); - var termIdx = nodeVal.indexOf(term.toLowerCase()); - - if (termIdx !== -1) { - var pn = node.parentNode; - if (pn && pn.className !== cssClass) { - // term not highlighted yet - var nv = node.nodeValue, - - // Create a load of replacement nodes - before = (0, _dom.createText)(nv.substr(0, termIdx)), - value = nv.substr(termIdx, term.length), - after = (0, _dom.createText)(nv.substr(termIdx + term.length)), - text = (0, _dom.createText)(value), - container = (0, _dom.createElm)('span'); - container.className = cssClass; - container.appendChild(text); - pn.insertBefore(before, node); - pn.insertBefore(container, node); - pn.insertBefore(after, node); - pn.removeChild(node); - } - } - } - }; - - /** - * Removes highlight to nodes matching passed string - * @param {String} term - * @param {String} cssClass Css class to remove - */ - - - HighlightKeyword.prototype.unhighlight = function unhighlight(term, cssClass) { - var highlightedNodes = this.tf.tbl.querySelectorAll('.' + cssClass); - for (var i = 0; i < highlightedNodes.length; i++) { - var n = highlightedNodes[i]; - var nodeVal = (0, _dom.getText)(n); - - if (nodeVal.toLowerCase().indexOf(term.toLowerCase()) !== -1) { - var parentNode = n.parentNode; - parentNode.replaceChild((0, _dom.createText)(nodeVal), n); - parentNode.normalize(); - } - } - }; - - /** - * Clear all occurrences of highlighted nodes - */ - - - HighlightKeyword.prototype.unhighlightAll = function unhighlightAll() { - var _this2 = this; - - if (!this.tf.highlightKeywords) { - return; - } - // iterate filters values to unhighlight all values - this.tf.getFiltersValue().forEach(function (val) { - if ((0, _types.isArray)(val)) { - val.forEach(function (item) { - return _this2.unhighlight(item, _this2.highlightCssClass); - }); - } else { - _this2.unhighlight(val, _this2.highlightCssClass); - } - }); - }; - - /** - * Remove feature - */ - - - HighlightKeyword.prototype.destroy = function destroy() { - var _this3 = this; - - this.emitter.off(['before-filtering', 'destroy'], function () { - return _this3.unhighlightAll(); - }); - this.emitter.off(['highlight-keyword'], function (tf, cell, term) { - return _this3.highlight(cell, term, _this3.highlightCssClass); - }); - }; - - return HighlightKeyword; - }(); - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.PopupFilter = undefined; - - var _feature = __webpack_require__(10); - - var _types = __webpack_require__(4); - - var _dom = __webpack_require__(3); - - var _event = __webpack_require__(1); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Pop-up filter component - * @export - * @class PopupFilter - * @extends {Feature} - */ - var PopupFilter = exports.PopupFilter = function (_Feature) { - _inherits(PopupFilter, _Feature); - - /** - * Creates an instance of PopupFilter - * @param {TableFilter} tf TableFilter instance - */ - function PopupFilter(tf) { - _classCallCheck(this, PopupFilter); - - // Configuration object - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'popupFilters')); - - var f = _this.config; - - // Enable external filters - tf.isExternalFlt = true; - tf.externalFltTgtIds = []; - - /** - * Filter icon path - * @type {String} - */ - _this.iconPath = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; - - /** - * Active filter icon path - * @type {string} - */ - _this.activeIconPath = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; - - /** - * HTML for the filter icon - * @type {string} - */ - _this.iconHtml = f.popup_filters_image_html || 'Column filter'; - - /** - * Css class assigned to filter container element - * @type {String} - */ - _this.containerCssClass = f.popup_div_css_class || 'popUpFilter'; - - /** - * Callback fired before a popup filter is opened - * @type {Function} - */ - _this.onBeforeOpen = (0, _types.isFn)(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; - - /** - * Callback fired after a popup filter is opened - * @type {Function} - */ - _this.onAfterOpen = (0, _types.isFn)(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; - - /** - * Callback fired before a popup filter is closed - * @type {Function} - */ - _this.onBeforeClose = (0, _types.isFn)(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; - - /** - * Callback fired after a popup filter is closed - * @type {Function} - */ - _this.onAfterClose = (0, _types.isFn)(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; - - /** - * Collection of filters spans - * @type {Array} - * @private - */ - _this.fltSpans = []; - - /** - * Collection of filters icons - * @type {Array} - * @private - */ - _this.fltIcons = []; - - /** - * Collection of filters icons cached after pop-up filters are removed - * @type {Array} - * @private - */ - _this.filtersCache = null; - - /** - * Collection of filters containers - * @type {Array} - * @private - */ - _this.fltElms = _this.filtersCache || []; - - /** - * Ensure filter's container element width matches column width - * @type {Boolean} - */ - _this.adjustToContainer = true; - - /** - * Prefix for pop-up filter span ID - * @type {String} - * @private - */ - _this.prfxSpan = 'popUpSpan_'; - - /** - * Prefix for pop-up filter container ID - * @type {String} - * @private - */ - _this.prfxDiv = 'popUpDiv_'; - return _this; - } - - /** - * Click event handler for pop-up filter icon - * @private - */ - - - PopupFilter.prototype.onClick = function onClick(evt) { - var elm = (0, _event.targetEvt)(evt).parentNode, - colIndex = parseInt(elm.getAttribute('ci'), 10); - - this.closeAll(colIndex); - this.toggle(colIndex); - - if (this.adjustToContainer) { - var popUpDiv = this.fltElms[colIndex], - header = this.tf.getHeaderElement(colIndex), - headerWidth = header.clientWidth * 0.95; - popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; - } - (0, _event.cancelEvt)(evt); - (0, _event.stopEvt)(evt); - }; - - /** - * Initialize DOM elements - */ - - - PopupFilter.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - // Override headers row index if no grouped headers - // TODO: Because of the filters row generation, headers row index needs - // adjusting: prevent useless row generation - if (tf.headersRow <= 1 && isNaN(tf.config().headers_row_index)) { - tf.headersRow = 0; - } - - // Adjust headers row index for grid-layout mode - // TODO: Because of the filters row generation, headers row index needs - // adjusting: prevent useless row generation - if (tf.gridLayout) { - tf.headersRow--; - this.buildIcons(); - } - - // subscribe to events - this.emitter.on(['before-filtering'], function () { - return _this2.setIconsState(); - }); - this.emitter.on(['after-filtering'], function () { - return _this2.closeAll(); - }); - this.emitter.on(['cell-processed'], function (tf, cellIndex) { - return _this2.changeState(cellIndex, true); - }); - this.emitter.on(['filters-row-inserted'], function () { - return _this2.buildIcons(); - }); - this.emitter.on(['before-filter-init'], function (tf, colIndex) { - return _this2.build(colIndex); - }); - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Reset previously destroyed feature - */ - - - PopupFilter.prototype.reset = function reset() { - this.enable(); - this.init(); - this.buildAll(); - }; - - /** - * Build all filters icons - */ - - - PopupFilter.prototype.buildIcons = function buildIcons() { - var _this3 = this; - - var tf = this.tf; - - // TODO: Because of the filters row generation, headers row index needs - // adjusting: prevent useless row generation - tf.headersRow++; - - for (var i = 0; i < tf.nbCells; i++) { - if (tf.getFilterType(i) === _const.NONE) { - continue; - } - var popUpSpan = (0, _dom.createElm)('span', ['id', this.prfxSpan + tf.id + '_' + i], ['ci', i]); - popUpSpan.innerHTML = this.iconHtml; - var header = tf.getHeaderElement(i); - header.appendChild(popUpSpan); - (0, _event.addEvt)(popUpSpan, 'click', function (evt) { - return _this3.onClick(evt); - }); - this.fltSpans[i] = popUpSpan; - this.fltIcons[i] = popUpSpan.firstChild; - } - }; - - /** - * Build all pop-up filters elements - */ - - - PopupFilter.prototype.buildAll = function buildAll() { - for (var i = 0; i < this.filtersCache.length; i++) { - this.build(i, this.filtersCache[i]); - } - }; - - /** - * Build a specified pop-up filter elements - * @param {Number} colIndex Column index - * @param {Object} div Optional container DOM element - */ - - - PopupFilter.prototype.build = function build(colIndex, div) { - var tf = this.tf; - var popUpDiv = !div ? (0, _dom.createElm)('div', ['id', this.prfxDiv + tf.id + '_' + colIndex]) : div; - popUpDiv.className = this.containerCssClass; - tf.externalFltTgtIds.push(popUpDiv.id); - var header = tf.getHeaderElement(colIndex); - header.insertBefore(popUpDiv, header.firstChild); - (0, _event.addEvt)(popUpDiv, 'click', function (evt) { - return (0, _event.stopEvt)(evt); - }); - this.fltElms[colIndex] = popUpDiv; - }; - - /** - * Toogle visibility of specified filter - * @param {Number} colIndex Column index - */ - - - PopupFilter.prototype.toggle = function toggle(colIndex) { - var tf = this.tf, - popUpFltElm = this.fltElms[colIndex]; - - if (popUpFltElm.style.display === _const.NONE || popUpFltElm.style.display === '') { - if (this.onBeforeOpen) { - this.onBeforeOpen.call(null, this, this.fltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'block'; - if (tf.getFilterType(colIndex) === _const.INPUT) { - var flt = tf.getFilterElement(colIndex); - if (flt) { - flt.focus(); - } - } - if (this.onAfterOpen) { - this.onAfterOpen.call(null, this, this.fltElms[colIndex], colIndex); - } - } else { - if (this.onBeforeClose) { - this.onBeforeClose.call(null, this, this.fltElms[colIndex], colIndex); - } - popUpFltElm.style.display = _const.NONE; - if (this.onAfterClose) { - this.onAfterClose.call(null, this, this.fltElms[colIndex], colIndex); - } - } - }; - - /** - * Close all filters excepted for the specified one if any - * @param {Number} exceptIdx Column index of the filter to not close - */ - - - PopupFilter.prototype.closeAll = function closeAll(exceptIdx) { - for (var i = 0; i < this.fltElms.length; i++) { - if (i === exceptIdx) { - continue; - } - var popUpFltElm = this.fltElms[i]; - if (popUpFltElm) { - popUpFltElm.style.display = _const.NONE; - } - } - }; - - /** - * Build all the icons representing the pop-up filters - */ - - - PopupFilter.prototype.setIconsState = function setIconsState() { - for (var i = 0; i < this.fltIcons.length; i++) { - this.changeState(i, false); - } - }; - - /** - * Apply specified icon state - * @param {Number} colIndex Column index - * @param {Boolean} active Apply active state - */ - - - PopupFilter.prototype.changeState = function changeState(colIndex, active) { - if (this.fltIcons[colIndex]) { - this.fltIcons[colIndex].src = active ? this.activeIconPath : this.iconPath; - } - }; - - /** - * Remove pop-up filters - */ - - - PopupFilter.prototype.destroy = function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - this.filtersCache = []; - for (var i = 0; i < this.fltElms.length; i++) { - var popUpFltElm = this.fltElms[i], - popUpFltSpan = this.fltSpans[i], - popUpFltImg = this.fltIcons[i]; - if (popUpFltElm) { - (0, _dom.removeElm)(popUpFltElm); - this.filtersCache[i] = popUpFltElm; - } - popUpFltElm = null; - if (popUpFltSpan) { - (0, _dom.removeElm)(popUpFltSpan); - } - popUpFltSpan = null; - if (popUpFltImg) { - (0, _dom.removeElm)(popUpFltImg); - } - popUpFltImg = null; - } - this.fltElms = []; - this.fltSpans = []; - this.fltIcons = []; - - // unsubscribe to events - this.emitter.off(['before-filtering'], function () { - return _this4.setIconsState(); - }); - this.emitter.off(['after-filtering'], function () { - return _this4.closeAll(); - }); - this.emitter.off(['cell-processed'], function (tf, cellIndex) { - return _this4.changeState(cellIndex, true); - }); - this.emitter.off(['filters-row-inserted'], function () { - return _this4.buildIcons(); - }); - this.emitter.off(['before-filter-init'], function (tf, colIndex) { - return _this4.build(colIndex); - }); - - this.initialized = false; - }; - - return PopupFilter; - }(_feature.Feature); - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Dropdown = undefined; - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _array = __webpack_require__(16); - - var _string = __webpack_require__(5); - - var _sort = __webpack_require__(17); - - var _event = __webpack_require__(1); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var SORT_ERROR = 'Filter options for column {0} cannot be sorted in ' + '{1} manner.'; - - /** - * Dropdown filter UI component - */ - - var Dropdown = exports.Dropdown = function (_Feature) { - _inherits(Dropdown, _Feature); - - /** - * Creates an instance of Dropdown - * @param {TableFilter} tf TableFilter instance - */ - function Dropdown(tf) { - _classCallCheck(this, Dropdown); - - // Configuration object - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'dropdown')); - - var f = _this.config; - - /** - * Enable the reset filter option as first item - * @type {Boolean} - */ - _this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; - - /** - * Non empty option text - * @type {String} - */ - _this.nonEmptyText = f.non_empty_text || '(Non empty)'; - - /** - * Tooltip text appearing on multiple select - * @type {String} - */ - _this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl/Cmd key for multiple selections'; - - /** - * Indicates drop-down has custom options - * @private - */ - _this.isCustom = null; - - /** - * List of options values - * @type {Array} - * @private - */ - _this.opts = null; - - /** - * List of options texts for custom values - * @type {Array} - * @private - */ - _this.optsTxt = null; - return _this; - } - - /** - * Drop-down filter focus event handler - * @param {Event} e DOM Event - * @private - */ - - - Dropdown.prototype.onSlcFocus = function onSlcFocus(e) { - var elm = (0, _event.targetEvt)(e); - var tf = this.tf; - // select is populated when element has focus - if (tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - this.build(ct); - } - this.emitter.emit('filter-focus', tf, elm); - }; - - /** - * Drop-down filter change event handler - * @private - */ - - - Dropdown.prototype.onSlcChange = function onSlcChange() { - if (this.tf.onSlcChange) { - this.tf.filter(); - } - }; - - /** - * Initialize drop-down filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - - Dropdown.prototype.init = function init(colIndex, isExternal, container) { - var _this2 = this; - - var tf = this.tf; - var col = tf.getFilterType(colIndex); - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var slc = (0, _dom.createElm)(_const.SELECT, ['id', tf.prfxFlt + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - - if (col === _const.MULTIPLE) { - slc.multiple = _const.MULTIPLE; - slc.title = this.multipleSlcTooltip; - } - slc.className = col.toLowerCase() === _const.SELECT ? tf.fltCssClass : tf.fltMultiCssClass; - - //filter is appended in container element - if (externalFltTgtId) { - (0, _dom.elm)(externalFltTgtId).appendChild(slc); - } else { - container.appendChild(slc); - } - - tf.fltIds.push(slc.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - //1st option is created here since build isn't invoked - var opt0 = (0, _dom.createOpt)(tf.displayAllText, ''); - slc.appendChild(opt0); - } - - (0, _event.addEvt)(slc, 'change', function () { - return _this2.onSlcChange(); - }); - (0, _event.addEvt)(slc, 'focus', function (e) { - return _this2.onSlcFocus(e); - }); - - this.emitter.on(['build-select-filter'], function (tf, colIndex, isLinked, isExternal) { - return _this2.build(colIndex, isLinked, isExternal); - }); - this.emitter.on(['select-options'], function (tf, colIndex, values) { - return _this2.selectOptions(colIndex, values); - }); - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Build drop-down filter UI - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - */ - - - Dropdown.prototype.build = function build(colIndex) { - var isLinked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - - var slcId = tf.fltIds[colIndex]; - var slc = (0, _dom.elm)(slcId); - var rows = tf.tbl.rows; - var nbRows = tf.getRowsNb(true); - - //custom select test - this.isCustom = tf.isCustomOptions(colIndex); - - //custom selects text - var activeIdx = void 0; - var activeFilterId = tf.getActiveFilterId(); - if (isLinked && activeFilterId) { - activeIdx = tf.getColumnIndexFromFilterId(activeFilterId); - } - - var excludedOpts = null, - filteredDataCol = null; - if (isLinked && tf.disableExcludedOptions) { - excludedOpts = []; - filteredDataCol = []; - } - - for (var k = tf.refRow; k < nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cell = rows[k].cells, - nchilds = cell.length; - - // checks if row has exact cell # - if (nchilds !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - // WTF: cyclomatic complexity hell - // TODO: simplify hell below - if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex === j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) !== -1) && (activeIdx === undefined || activeIdx === colIndex || activeIdx !== colIndex && tf.validRowsIndex.indexOf(k) !== -1))) { - var cellData = tf.getCellData(cell[j]), - - //Vary Peter's patch - cellString = (0, _string.matchCase)(cellData, tf.caseSensitive); - - // checks if celldata is already in array - if (!(0, _array.has)(this.opts, cellString, tf.caseSensitive)) { - this.opts.push(cellData); - } - - if (isLinked && tf.disableExcludedOptions) { - var filteredCol = filteredDataCol[j]; - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!(0, _array.has)(filteredCol, cellString, tf.caseSensitive) && !(0, _array.has)(excludedOpts, cellString, tf.caseSensitive)) { - excludedOpts.push(cellData); - } - } - } //if colIndex==j - } //for j - } //for k - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!tf.caseSensitive) { - this.opts.sort(_sort.ignoreCase); - if (excludedOpts) { - excludedOpts.sort(_sort.ignoreCase); - } - } else { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - } - } - - //asc sort - if (tf.sortNumAsc.indexOf(colIndex) !== -1) { - try { - this.opts.sort(_sort.numSortAsc); - if (excludedOpts) { - excludedOpts.sort(_sort.numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(_sort.numSortAsc); - } - } catch (e) { - throw new Error(SORT_ERROR.replace('{0}', colIndex).replace('{1}', 'ascending')); - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc.indexOf(colIndex) !== -1) { - try { - this.opts.sort(_sort.numSortDesc); - if (excludedOpts) { - excludedOpts.sort(_sort.numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(_sort.numSortDesc); - } - } catch (e) { - throw new Error(SORT_ERROR.replace('{0}', colIndex).replace('{1}', 'ascending')); - } //in case there are alphanumeric values - } - - //populates drop-down - this.addOptions(colIndex, slc, isLinked, excludedOpts); - - this.emitter.emit('after-populating-filter', tf, colIndex, slc); - }; - - /** - * Add drop-down options - * @param {Number} colIndex Column index - * @param {Object} slc Select Dom element - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Array} excludedOpts Array of excluded options - */ - - - Dropdown.prototype.addOptions = function addOptions(colIndex, slc, isLinked, excludedOpts) { - var tf = this.tf, - slcValue = slc.value; - - slc.innerHTML = ''; - slc = this.addFirstOption(slc); - - for (var y = 0; y < this.opts.length; y++) { - if (this.opts[y] === '') { - continue; - } - var val = this.opts[y]; //option value - var lbl = this.isCustom ? this.optsTxt[y] : val; //option text - var isDisabled = false; - if (isLinked && tf.disableExcludedOptions && (0, _array.has)(excludedOpts, (0, _string.matchCase)(val, tf.caseSensitive), tf.caseSensitive)) { - isDisabled = true; - } - - var opt = void 0; - //fill select on demand - if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === _const.SELECT) { - opt = (0, _dom.createOpt)(lbl, val, true); - } else { - opt = (0, _dom.createOpt)(lbl, val, false); - } - if (isDisabled) { - opt.disabled = true; - } - slc.appendChild(opt); - } // for y - - slc.setAttribute('filled', '1'); - }; - - /** - * Add drop-down header option - * @param {Object} slc Select DOM element - */ - - - Dropdown.prototype.addFirstOption = function addFirstOption(slc) { - var tf = this.tf; - - var opt0 = (0, _dom.createOpt)(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); - if (!this.enableSlcResetFilter) { - opt0.style.display = _const.NONE; - } - slc.appendChild(opt0); - if (tf.enableEmptyOption) { - var opt1 = (0, _dom.createOpt)(tf.emptyText, tf.emOperator); - slc.appendChild(opt1); - } - if (tf.enableNonEmptyOption) { - var opt2 = (0, _dom.createOpt)(tf.nonEmptyText, tf.nmOperator); - slc.appendChild(opt2); - } - return slc; - }; - - /** - * Select filter options programmatically - * @param {Number} colIndex Column index - * @param {Array} values Array of option values to select - */ - - - Dropdown.prototype.selectOptions = function selectOptions(colIndex) { - var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - - var tf = this.tf; - if (tf.getFilterType(colIndex) !== _const.MULTIPLE || values.length === 0) { - return; - } - var slc = tf.getFilterElement(colIndex); - [].forEach.call(slc.options, function (option) { - // Empty value means clear all selections and first option is the - // clear all option - if (values[0] === '' || option.value === '') { - option.selected = false; - } - - if (option.value !== '' && (0, _array.has)(values, option.value, true)) { - option.selected = true; - } //if - }); - }; - - /** - * Get filter values for a given column index - * @param {Number} colIndex Column index - * @returns {Array} values Array of selected values - */ - - - Dropdown.prototype.getValues = function getValues(colIndex) { - var tf = this.tf; - var slc = tf.getFilterElement(colIndex); - var values = []; - - // IE >= 9 does not support the selectedOptions property :( - if (slc.selectedOptions) { - [].forEach.call(slc.selectedOptions, function (option) { - return values.push(option.value); - }); - } else { - [].forEach.call(slc.options, function (option) { - if (option.selected) { - values.push(option.value); - } - }); - } - - return values; - }; - - /** - * Destroy Dropdown instance - */ - - - Dropdown.prototype.destroy = function destroy() { - var _this3 = this; - - this.emitter.off(['build-select-filter'], function (colIndex, isLinked, isExternal) { - return _this3.build(colIndex, isLinked, isExternal); - }); - this.emitter.off(['select-options'], function (tf, colIndex, values) { - return _this3.selectOptions(colIndex, values); - }); - }; - - return Dropdown; - }(_feature.Feature); - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.has = undefined; - - var _string = __webpack_require__(5); - - /** - * Checks if given item can be found in the passed collection - * @param {Array} arr collection - * @param {Any} val item to search - * @param {Boolean} caseSensitive respects case if true - * @return {Boolean} - */ - var has = exports.has = function has(arr, val, caseSensitive) { - var sCase = Boolean(caseSensitive); - for (var i = 0, l = arr.length; i < l; i++) { - if ((0, _string.matchCase)(arr[i].toString(), sCase) === val) { - return true; - } - } - return false; - }; /** - * Array utilities - */ - -/***/ }, -/* 17 */ -/***/ function(module, exports) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Sorting utilities - */ - - /** - * Case insensitive compare function for passed strings - * @param {String} First string - * @param {String} Second string - * @return {Number} -1 if first string lower than second one - * 0 if first string same order as second one - * 1 if first string greater than second one - */ - var ignoreCase = exports.ignoreCase = function ignoreCase(a, b) { - var x = a.toLowerCase(); - var y = b.toLowerCase(); - return x < y ? -1 : x > y ? 1 : 0; - }; - - /** - * Sorts passed numbers in a ascending manner - * @param {Number} First number - * @param {Number} Second number - * @param {Number} Negative, zero or positive number - */ - var numSortAsc = exports.numSortAsc = function numSortAsc(a, b) { - return a - b; - }; - - /** - * Sorts passed numbers in a descending manner - * @param {Number} First number - * @param {Number} Second number - * @param {Number} Negative, zero or positive number - */ - var numSortDesc = exports.numSortDesc = function numSortDesc(a, b) { - return b - a; - }; - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.CheckList = undefined; - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _array = __webpack_require__(16); - - var _string = __webpack_require__(5); - - var _sort = __webpack_require__(17); - - var _event = __webpack_require__(1); - - var _types = __webpack_require__(4); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var SORT_ERROR = 'Filter options for column {0} cannot be sorted in ' + '{1} manner.'; - - /** - * Checklist filter UI component - */ - - var CheckList = exports.CheckList = function (_Feature) { - _inherits(CheckList, _Feature); - - /** - * Creates an instance of CheckList - * @param {TableFilter} tf TableFilter instance - */ - function CheckList(tf) { - _classCallCheck(this, CheckList); - - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'checkList')); - - var f = _this.config; - - /** - * List of container DOM elements - * @type {Array} - */ - _this.containers = []; - - /** - * Css class for the container of the checklist filter (div) - * @type {String} - */ - _this.containerCssClass = f.div_checklist_css_class || 'div_checklist'; - - /** - * Css class for the checklist filter element (ul) - * @type {String} - */ - _this.filterCssClass = f.checklist_css_class || 'flt_checklist'; - - /** - * Css class for the item of a checklist (li) - * @type {String} - */ - _this.itemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; - - /** - * Css class for a selected item of a checklist (li) - * @type {String} - */ - _this.selectedItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; - - /** - * Text placed in the filter's container when load filter on demand - * feature is enabled - * @type {String} - */ - _this.activateText = f.activate_checklist_text || 'Click to load filter data'; - - /** - * Css class for a disabled item of a checklist (li) - * @type {String} - */ - _this.disabledItemCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; - - /** - * Enable the reset filter option as first item - * @type {Boolean} - */ - _this.enableResetOption = f.enable_checklist_reset_filter === false ? false : true; - - /** - * Prefix for container element ID - * @type {String} - * @private - */ - _this.prfx = 'chkdiv_'; - - /** - * Has custom options - * @type {Boolean} - * @private - */ - _this.isCustom = false; - - /** - * List of options values - * @type {Array} - * @private - */ - _this.opts = []; - - /** - * List of options texts for custom values - * @type {Array} - * @private - */ - _this.optsTxt = []; - - /** - * List of options to be excluded from the checklist filter - * @type {Array} - * @private - */ - _this.excludedOpts = []; - return _this; - } - - /** - * Checklist option click event handler - * @param {Event} evt - */ - - - CheckList.prototype.optionClick = function optionClick(evt) { - var elm = (0, _event.targetEvt)(evt); - var tf = this.tf; - - this.emitter.emit('filter-focus', tf, elm); - this.setCheckListValues(elm); - tf.filter(); - }; - - /** - * Checklist container click event handler for load-on-demand feature - * @param {Event} evt - */ - - - CheckList.prototype.onCheckListClick = function onCheckListClick(evt) { - var _this2 = this; - - var elm = (0, _event.targetEvt)(evt); - if (this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - var div = this.containers[ct]; - this.build(ct); - (0, _event.removeEvt)(div, 'click', function (evt) { - return _this2.onCheckListClick(evt); - }); - } - }; - - /** - * Initialize checklist filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - - CheckList.prototype.init = function init(colIndex, isExternal, container) { - var _this3 = this; - - var tf = this.tf; - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var divCont = (0, _dom.createElm)('div', ['id', this.prfx + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - divCont.className = this.containerCssClass; - - //filter is appended in desired element - if (externalFltTgtId) { - (0, _dom.elm)(externalFltTgtId).appendChild(divCont); - } else { - container.appendChild(divCont); - } - - this.containers[colIndex] = divCont; - tf.fltIds.push(tf.prfxFlt + colIndex + '_' + tf.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - (0, _event.addEvt)(divCont, 'click', function (evt) { - return _this3.onCheckListClick(evt); - }); - divCont.appendChild((0, _dom.createText)(this.activateText)); - } - - this.emitter.on(['build-checklist-filter'], function (tf, colIndex) { - return _this3.build(colIndex); - }); - - this.emitter.on(['select-checklist-options'], function (tf, colIndex, values) { - return _this3.selectOptions(colIndex, values); - }); - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Build checklist UI - * @param {Number} colIndex Column index - */ - - - CheckList.prototype.build = function build(colIndex) { - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - - var flt = this.containers[colIndex]; - var ul = (0, _dom.createElm)('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); - ul.className = this.filterCssClass; - - var rows = tf.tbl.rows; - var nbRows = tf.getRowsNb(true); - var caseSensitive = tf.caseSensitive; - this.isCustom = tf.isCustomOptions(colIndex); - - var activeIdx = void 0; - var activeFilterId = tf.getActiveFilterId(); - if (tf.linkedFilters && activeFilterId) { - activeIdx = tf.getColumnIndexFromFilterId(activeFilterId); - } - - var filteredDataCol = []; - if (tf.linkedFilters && tf.disableExcludedOptions) { - this.excludedOpts = []; - } - - flt.innerHTML = ''; - - for (var k = tf.refRow; k < nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cells = rows[k].cells; - var ncells = cells.length; - - // checks if row has exact cell # - if (ncells !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < ncells; j++) { - // WTF: cyclomatic complexity hell :) - if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeIdx || activeIdx === colIndex || activeIdx !== colIndex && tf.validRowsIndex.indexOf(k) !== -1))) { - - var cellData = tf.getCellData(cells[j]); - //Vary Peter's patch - var cellString = (0, _string.matchCase)(cellData, caseSensitive); - // checks if celldata is already in array - if (!(0, _array.has)(this.opts, cellString, caseSensitive)) { - this.opts.push(cellData); - } - var filteredCol = filteredDataCol[j]; - if (tf.linkedFilters && tf.disableExcludedOptions) { - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!(0, _array.has)(filteredCol, cellString, caseSensitive) && !(0, _array.has)(this.excludedOpts, cellString, caseSensitive)) { - this.excludedOpts.push(cellData); - } - } - } - } - } - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!caseSensitive) { - this.opts.sort(_sort.ignoreCase); - if (this.excludedOpts) { - this.excludedOpts.sort(_sort.ignoreCase); - } - } else { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - } - } - //asc sort - if (tf.sortNumAsc.indexOf(colIndex) !== -1) { - try { - this.opts.sort(_sort.numSortAsc); - if (this.excludedOpts) { - this.excludedOpts.sort(_sort.numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(_sort.numSortAsc); - } - } catch (e) { - throw new Error(SORT_ERROR.replace('{0}', colIndex).replace('{1}', 'ascending')); - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc.indexOf(colIndex) !== -1) { - try { - this.opts.sort(_sort.numSortDesc); - if (this.excludedOpts) { - this.excludedOpts.sort(_sort.numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(_sort.numSortDesc); - } - } catch (e) { - throw new Error(SORT_ERROR.replace('{0}', colIndex).replace('{1}', 'descending')); - } //in case there are alphanumeric values - } - - this.addChecks(colIndex, ul); - - if (tf.loadFltOnDemand) { - flt.innerHTML = ''; - } - flt.appendChild(ul); - flt.setAttribute('filled', '1'); - - this.emitter.emit('after-populating-filter', tf, colIndex, flt); - }; - - /** - * Add checklist options - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - - CheckList.prototype.addChecks = function addChecks(colIndex, ul) { - var _this4 = this; - - var tf = this.tf; - var chkCt = this.addTChecks(colIndex, ul); - - for (var y = 0; y < this.opts.length; y++) { - var val = this.opts[y]; //item value - var lbl = this.isCustom ? this.optsTxt[y] : val; //item text - var li = (0, _dom.createCheckItem)(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); - li.className = this.itemCssClass; - - if (tf.linkedFilters && tf.disableExcludedOptions && (0, _array.has)(this.excludedOpts, (0, _string.matchCase)(val, tf.caseSensitive), tf.caseSensitive)) { - (0, _dom.addClass)(li, this.disabledItemCssClass); - li.check.disabled = true; - li.disabled = true; - } else { - (0, _event.addEvt)(li.check, 'click', function (evt) { - return _this4.optionClick(evt); - }); - } - ul.appendChild(li); - - if (val === '') { - //item is hidden - li.style.display = _const.NONE; - } - } - }; - - /** - * Add checklist header option - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - - CheckList.prototype.addTChecks = function addTChecks(colIndex, ul) { - var _this5 = this; - - var tf = this.tf; - var chkCt = 1; - var li0 = (0, _dom.createCheckItem)(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); - li0.className = this.itemCssClass; - ul.appendChild(li0); - - (0, _event.addEvt)(li0.check, 'click', function (evt) { - return _this5.optionClick(evt); - }); - - if (!this.enableResetOption) { - li0.style.display = _const.NONE; - } - - if (tf.enableEmptyOption) { - var li1 = (0, _dom.createCheckItem)(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); - li1.className = this.itemCssClass; - ul.appendChild(li1); - (0, _event.addEvt)(li1.check, 'click', function (evt) { - return _this5.optionClick(evt); - }); - chkCt++; - } - - if (tf.enableNonEmptyOption) { - var li2 = (0, _dom.createCheckItem)(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); - li2.className = this.itemCssClass; - ul.appendChild(li2); - (0, _event.addEvt)(li2.check, 'click', function (evt) { - return _this5.optionClick(evt); - }); - chkCt++; - } - return chkCt; - }; - - /** - * Store checked options in DOM element attribute - * @param {Object} o checklist option DOM element - */ - - - CheckList.prototype.setCheckListValues = function setCheckListValues(o) { - if (!o) { - return; - } - - var tf = this.tf; - var chkValue = o.value; //checked item value - // TODO: provide helper to extract column index, ugly! - var chkIndex = parseInt(o.id.split('_')[2], 10); - var colIdx = tf.getColumnIndexFromFilterId(o.id); - var itemTag = 'LI'; - - var n = tf.getFilterElement(parseInt(colIdx, 10)); - var li = n.childNodes[chkIndex]; - var colIndex = n.getAttribute('colIndex'); - var fltValue = n.getAttribute('value'); //filter value (ul tag) - var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) - - if (o.checked) { - //show all item - if (chkValue === '') { - if (fltIndexes && fltIndexes !== '') { - //items indexes - var indSplit = fltIndexes.split(tf.separator); - //checked items loop - for (var u = 0; u < indSplit.length; u++) { - //checked item - var cChk = (0, _dom.elm)(tf.fltIds[colIndex] + '_' + indSplit[u]); - if (cChk) { - cChk.checked = false; - (0, _dom.removeClass)(n.childNodes[indSplit[u]], this.selectedItemCssClass); - } - } - } - n.setAttribute('value', ''); - n.setAttribute('indexes', ''); - } else { - fltValue = fltValue ? fltValue : ''; - chkValue = (0, _string.trim)(fltValue + ' ' + chkValue + ' ' + tf.orOperator); - chkIndex = fltIndexes + chkIndex + tf.separator; - n.setAttribute('value', chkValue); - n.setAttribute('indexes', chkIndex); - //1st option unchecked - if ((0, _dom.elm)(tf.fltIds[colIndex] + '_0')) { - (0, _dom.elm)(tf.fltIds[colIndex] + '_0').checked = false; - } - } - - if (li.nodeName === itemTag) { - (0, _dom.removeClass)(n.childNodes[0], this.selectedItemCssClass); - (0, _dom.addClass)(li, this.selectedItemCssClass); - } - } else { - //removes values and indexes - if (chkValue !== '') { - var replaceValue = new RegExp((0, _string.rgxEsc)(chkValue + ' ' + tf.orOperator)); - fltValue = fltValue.replace(replaceValue, ''); - n.setAttribute('value', (0, _string.trim)(fltValue)); - - var replaceIndex = new RegExp((0, _string.rgxEsc)(chkIndex + tf.separator)); - fltIndexes = fltIndexes.replace(replaceIndex, ''); - n.setAttribute('indexes', fltIndexes); - } - if (li.nodeName === itemTag) { - (0, _dom.removeClass)(li, this.selectedItemCssClass); - } - } - }; - - /** - * Select filter options programmatically - * @param {Number} colIndex Column index - * @param {Array} values Array of option values to select - */ - - - CheckList.prototype.selectOptions = function selectOptions(colIndex) { - var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - - var tf = this.tf; - var flt = tf.getFilterElement(colIndex); - if (tf.getFilterType(colIndex) !== _const.CHECKLIST || !flt) { - return; - } - - var lisNb = (0, _dom.tag)(flt, 'li').length; - - flt.setAttribute('value', ''); - flt.setAttribute('indexes', ''); - - for (var k = 0; k < lisNb; k++) { - var li = (0, _dom.tag)(flt, 'li')[k]; - var lbl = (0, _dom.tag)(li, 'label')[0]; - var chk = (0, _dom.tag)(li, 'input')[0]; - var lblTxt = (0, _string.matchCase)((0, _dom.getText)(lbl), tf.caseSensitive); - - if (lblTxt !== '' && (0, _array.has)(values, lblTxt, tf.caseSensitive)) { - chk.checked = true; - } else { - // Check non-empty-text or empty-text option - if (values.indexOf(tf.nmOperator) !== -1 && lblTxt === (0, _string.matchCase)(tf.nonEmptyText, tf.caseSensitive)) { - chk.checked = true; - } else if (values.indexOf(tf.emOperator) !== -1 && lblTxt === (0, _string.matchCase)(tf.emptyText, tf.caseSensitive)) { - chk.checked = true; - } else { - chk.checked = false; - } - } - this.setCheckListValues(chk); - } - }; - - /** - * Get filter values for a given column index - * @param {Number} colIndex Column index - * @returns {Array} values Collection of selected values - */ - - - CheckList.prototype.getValues = function getValues(colIndex) { - var tf = this.tf; - var flt = tf.getFilterElement(colIndex); - var fltAttr = flt.getAttribute('value'); - var values = (0, _types.isEmpty)(fltAttr) ? '' : fltAttr; - - //removes last operator || - values = values.substr(0, values.length - 3); - //turn || separated values into array - values = values.split(' ' + tf.orOperator + ' '); - - return values; - }; - - /** - * Destroy CheckList instance - */ - - - CheckList.prototype.destroy = function destroy() { - var _this6 = this; - - this.emitter.off(['build-checklist-filter'], function (tf, colIndex, isExternal) { - return _this6.build(colIndex, isExternal); - }); - this.emitter.off(['select-checklist-options'], function (tf, colIndex, values) { - return _this6.selectOptions(colIndex, values); - }); - }; - - return CheckList; - }(_feature.Feature); - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.RowsCounter = undefined; - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _types = __webpack_require__(4); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Rows counter UI component - * @export - * @class RowsCounter - * @extends {Feature} - */ - var RowsCounter = exports.RowsCounter = function (_Feature) { - _inherits(RowsCounter, _Feature); - - /** - * Creates an instance of RowsCounter - * @param {TableFilter} tf TableFilter instance - */ - function RowsCounter(tf) { - _classCallCheck(this, RowsCounter); - - // TableFilter configuration - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'rowsCounter')); - - var f = _this.config; - - /** - * ID of custom container element - * @type {String} - */ - _this.targetId = f.rows_counter_target_id || null; - - /** - * Container DOM element - * @type {DOMElement} - * @private - */ - _this.container = null; - - /** - * Container DOM element for label displaying the total number of rows - * @type {DOMElement} - * @private - */ - _this.label = null; - - /** - * Text preceding the total number of rows - * @type {String} - */ - _this.text = f.rows_counter_text || 'Rows: '; - - /** - * Separator symbol appearing between the first and last visible rows of - * current page when paging is enabled. ie: Rows: 31-40 / 70 - * @type {String} - */ - _this.fromToTextSeparator = f.from_to_text_separator || '-'; - - /** - * Separator symbol appearing between the first and last visible rows of - * current page and the total number of filterable rows when paging is - * enabled. ie: Rows: 31-40 / 70 - * @type {String} - */ - _this.overText = f.over_text || ' / '; - - /** - * Css class for container element - * @type {String} - */ - _this.cssClass = f.tot_rows_css_class || 'tot'; - - /** - * Prefix for container ID - * @type {String} - * @private - */ - _this.prfxCounter = 'counter_'; - - /** - * Prefix for DOM element containing the counter - * @type {String} - * @private - */ - _this.prfxLabel = 'totrows_span_'; - - /** - * Prefix for label preceding the counter - * @type {String} - * @private - */ - _this.prfxText = 'totRowsTextSpan_'; - - /** - * Callback fired before the counter is refreshed - * @type {Function} - */ - _this.onBeforeRefreshCounter = (0, _types.isFn)(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; - - /** - * Callback fired after the counter is refreshed - * @type {Function} - */ - _this.onAfterRefreshCounter = (0, _types.isFn)(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; - return _this; - } - - /** - * Initializes RowsCounter instance - */ - - - RowsCounter.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - //rows counter container - var countDiv = (0, _dom.createElm)('div', ['id', this.prfxCounter + tf.id]); - countDiv.className = this.cssClass; - //rows counter label - var countSpan = (0, _dom.createElm)('span', ['id', this.prfxLabel + tf.id]); - var countText = (0, _dom.createElm)('span', ['id', this.prfxText + tf.id]); - countText.appendChild((0, _dom.createText)(this.text)); - - // counter is added to defined element - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.lDiv : (0, _dom.elm)(this.targetId); - - //default container: 'lDiv' - if (!this.targetId) { - countDiv.appendChild(countText); - countDiv.appendChild(countSpan); - targetEl.appendChild(countDiv); - } else { - //custom container, no need to append statusDiv - targetEl.appendChild(countText); - targetEl.appendChild(countSpan); - } - this.container = countDiv; - this.label = countSpan; - - // subscribe to events - this.emitter.on(['after-filtering', 'grouped-by-page'], function () { - return _this2.refresh(tf.getValidRowsNb()); - }); - this.emitter.on(['rows-changed'], function () { - return _this2.refresh(); - }); - - /** - * @inherited - */ - this.initialized = true; - this.refresh(); - }; - - /** - * Refreshes the rows counter - * @param {Number} p Optional parameter the total number of rows to display - * @returns - */ - - - RowsCounter.prototype.refresh = function refresh(p) { - if (!this.initialized || !this.isEnabled()) { - return; - } - - var tf = this.tf; - - if (this.onBeforeRefreshCounter) { - this.onBeforeRefreshCounter.call(null, tf, this.label); - } - - var totTxt = void 0; - if (!tf.paging) { - if (p && p !== '') { - totTxt = p; - } else { - totTxt = tf.getFilterableRowsNb() - tf.nbHiddenRows; - } - } else { - var paging = tf.feature('paging'); - if (paging) { - //paging start row - var pagingStartRow = parseInt(paging.startPagingRow, 10) + (tf.getValidRowsNb() > 0 ? 1 : 0); - var pagingEndRow = pagingStartRow + paging.pagingLength - 1 <= tf.getValidRowsNb() ? pagingStartRow + paging.pagingLength - 1 : tf.getValidRowsNb(); - totTxt = pagingStartRow + this.fromToTextSeparator + pagingEndRow + this.overText + tf.getValidRowsNb(); - } - } - - this.label.innerHTML = totTxt; - if (this.onAfterRefreshCounter) { - this.onAfterRefreshCounter.call(null, tf, this.label, totTxt); - } - }; - - /** - * Remove feature - */ - - - RowsCounter.prototype.destroy = function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - if (!this.targetId && this.container) { - (0, _dom.removeElm)(this.container); - } else { - (0, _dom.elm)(this.targetId).innerHTML = ''; - } - this.label = null; - this.container = null; - - // unsubscribe to events - this.emitter.off(['after-filtering', 'grouped-by-page'], function () { - return _this3.refresh(tf.getValidRowsNb()); - }); - this.emitter.off(['rows-changed'], function () { - return _this3.refresh(); - }); - - this.initialized = false; - }; - - return RowsCounter; - }(_feature.Feature); - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.StatusBar = undefined; - - var _feature = __webpack_require__(10); - - var _root = __webpack_require__(2); - - var _dom = __webpack_require__(3); - - var _types = __webpack_require__(4); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Status bar UI component - * @export - * @class StatusBar - * @extends {Feature} - */ - var StatusBar = exports.StatusBar = function (_Feature) { - _inherits(StatusBar, _Feature); - - /** - * Creates an instance of StatusBar - * @param {TableFilter} tf TableFilter instance - */ - function StatusBar(tf) { - _classCallCheck(this, StatusBar); - - // Configuration object - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'statusBar')); - - var f = _this.config; - - /** - * ID of custom container element - * @type {String} - */ - _this.targetId = f.status_bar_target_id || null; - - /** - * Container DOM element - * @type {DOMElement} - * @private - */ - _this.container = null; - - /** - * Message container DOM element - * @type {DOMElement} - * @private - */ - _this.msgContainer = null; - - /** - * Label container DOM element - * @type {DOMElement} - * @private - */ - _this.labelContainer = null; - - /** - * Text preceding status message - * @type {String} - */ - _this.text = f.status_bar_text || ''; - - /** - * Css class for container element - * @type {String} - */ - _this.cssClass = f.status_bar_css_class || 'status'; - - /** - * Message visibility duration in milliseconds - * @type {Number} - * @private - */ - _this.delay = 250; - - /** - * Callback fired before the message is displayed - * @type {Function} - */ - _this.onBeforeShowMsg = (0, _types.isFn)(f.on_before_show_msg) ? f.on_before_show_msg : null; - - /** - * Callback fired after the message is displayed - * @type {Function} - */ - _this.onAfterShowMsg = (0, _types.isFn)(f.on_after_show_msg) ? f.on_after_show_msg : null; - - /** - * Message appearing upon filtering - * @type {String} - */ - _this.msgFilter = f.msg_filter || 'Filtering data...'; - - /** - * Message appearing when a drop-down filter is populated - * @type {String} - */ - _this.msgPopulate = f.msg_populate || 'Populating filter...'; - - /** - * Message appearing when a checklist filter is populated - * @type {String} - */ - _this.msgPopulateCheckList = f.msg_populate_checklist || 'Populating list...'; - - /** - * Message appearing when a pagination page is changed - * @type {String} - */ - _this.msgChangePage = f.msg_change_page || 'Collecting paging data...'; - - /** - * Message appearing when filters are cleared - * @type {String} - */ - _this.msgClear = f.msg_clear || 'Clearing filters...'; - - /** - * Message appearing when the page length is changed - * @type {String} - */ - _this.msgChangeResults = f.msg_change_results || 'Changing results per page...'; - - /** - * Message appearing when the page is re-set - * @type {String} - */ - _this.msgResetPage = f.msg_reset_page || 'Re-setting page...'; - - /** - * Message appearing when the page length is re-set - * @type {String} - */ - _this.msgResetPageLength = f.msg_reset_page_length || 'Re-setting page length...'; - - /** - * Message appearing upon column sorting - * @type {String} - */ - _this.msgSort = f.msg_sort || 'Sorting data...'; - - /** - * Message appearing when extensions are loading - * @type {String} - */ - _this.msgLoadExtensions = f.msg_load_extensions || 'Loading extensions...'; - - /** - * Message appearing when themes are loading - * @type {String} - */ - _this.msgLoadThemes = f.msg_load_themes || 'Loading theme(s)...'; - - /** - * Prefix for container ID - * @type {String} - * @private - */ - _this.prfxCont = 'status_'; - - /** - * Prefix for label container ID - * @type {String} - * @private - */ - _this.prfxLabel = 'statusSpan_'; - - /** - * Prefix for text preceding the message - * @type {String} - * @private - */ - _this.prfxText = 'statusText_'; - return _this; - } - - /** - * Initializes StatusBar instance - */ - - - StatusBar.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - //status bar container - var statusDiv = (0, _dom.createElm)('div', ['id', this.prfxCont + tf.id]); - statusDiv.className = this.cssClass; - - //status bar label - var statusSpan = (0, _dom.createElm)('span', ['id', this.prfxLabel + tf.id]); - //preceding text - var statusSpanText = (0, _dom.createElm)('span', ['id', this.prfxText + tf.id]); - statusSpanText.appendChild((0, _dom.createText)(this.text)); - - // target element container - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.lDiv : (0, _dom.elm)(this.targetId); - - //default container: 'lDiv' - if (!this.targetId) { - statusDiv.appendChild(statusSpanText); - statusDiv.appendChild(statusSpan); - targetEl.appendChild(statusDiv); - } else { - // custom container, no need to append statusDiv - targetEl.appendChild(statusSpanText); - targetEl.appendChild(statusSpan); - } - - this.container = statusDiv; - this.msgContainer = statusSpan; - this.labelContainer = statusSpanText; - - // Subscribe to events - emitter.on(['before-filtering'], function () { - return _this2.message(_this2.msgFilter); - }); - emitter.on(['before-populating-filter'], function () { - return _this2.message(_this2.msgPopulate); - }); - emitter.on(['before-page-change'], function () { - return _this2.message(_this2.msgChangePage); - }); - emitter.on(['before-clearing-filters'], function () { - return _this2.message(_this2.msgClear); - }); - emitter.on(['before-page-length-change'], function () { - return _this2.message(_this2.msgChangeResults); - }); - emitter.on(['before-reset-page'], function () { - return _this2.message(_this2.msgResetPage); - }); - emitter.on(['before-reset-page-length'], function () { - return _this2.message(_this2.msgResetPageLength); - }); - emitter.on(['before-loading-extensions'], function () { - return _this2.message(_this2.msgLoadExtensions); - }); - emitter.on(['before-loading-themes'], function () { - return _this2.message(_this2.msgLoadThemes); - }); - - emitter.on(['after-filtering', 'after-populating-filter', 'after-page-change', 'after-clearing-filters', 'after-page-length-change', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.message(''); - }); - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Display status message - * @param {String} [t=''] Message to be displayed - */ - - - StatusBar.prototype.message = function message() { - var _this3 = this; - - var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - - if (!this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, t); - } - - var d = t === '' ? this.delay : 1; - _root.root.setTimeout(function () { - if (!_this3.initialized) { - return; - } - _this3.msgContainer.innerHTML = t; - if (_this3.onAfterShowMsg) { - _this3.onAfterShowMsg.call(null, _this3.tf, t); - } - }, d); - }; - - /** - * Destroy StatusBar instance - */ - - - StatusBar.prototype.destroy = function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - this.container.innerHTML = ''; - if (!this.targetId) { - (0, _dom.removeElm)(this.container); - } - this.labelContainer = null; - this.msgContainer = null; - this.container = null; - - // Unsubscribe to events - emitter.off(['before-filtering'], function () { - return _this4.message(_this4.msgFilter); - }); - emitter.off(['before-populating-filter'], function () { - return _this4.message(_this4.msgPopulate); - }); - emitter.off(['before-page-change'], function () { - return _this4.message(_this4.msgChangePage); - }); - emitter.off(['before-clearing-filters'], function () { - return _this4.message(_this4.msgClear); - }); - emitter.off(['before-page-length-change'], function () { - return _this4.message(_this4.msgChangeResults); - }); - emitter.off(['before-reset-page'], function () { - return _this4.message(_this4.msgResetPage); - }); - emitter.off(['before-reset-page-length'], function () { - return _this4.message(_this4.msgResetPageLength); - }); - emitter.off(['before-loading-extensions'], function () { - return _this4.message(_this4.msgLoadExtensions); - }); - emitter.off(['before-loading-themes'], function () { - return _this4.message(_this4.msgLoadThemes); - }); - - emitter.off(['after-filtering', 'after-populating-filter', 'after-page-change', 'after-clearing-filters', 'after-page-length-change', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.message(''); - }); - - this.initialized = false; - }; - - return StatusBar; - }(_feature.Feature); - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Paging = undefined; - - 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 _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _types = __webpack_require__(4); - - var _event = __webpack_require__(1); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Paging UI component - * @export - * @class Paging - * @extends {Feature} - */ - var Paging = exports.Paging = function (_Feature) { - _inherits(Paging, _Feature); - - /** - * Creates an instance of Paging - * @param {TableFilter} tf TableFilter instance - */ - function Paging(tf) { - _classCallCheck(this, Paging); - - // Configuration object - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'paging')); - - var f = _this.config; - - /** - * Css class for the paging buttons (previous, next, etc.) - * @type {String} - */ - _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; - - /** - * Main select DOM element - * @type {DOMElement} - */ - _this.pagingSlc = null; - - /** - * Results per page select DOM element - * @type {DOMElement} - */ - _this.resultsPerPageSlc = null; - - /** - * ID of custom container element - * @type {String} - */ - _this.pagingTgtId = f.paging_target_id || null; - - /** - * Number of rows contained in a page - * @type {Number} - */ - _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; - - /** - * ID of custom container element for the results per page selector - * @type {String} - */ - _this.resultsPerPageTgtId = f.results_per_page_target_id || null; - - /** - * Css class for the paging select element - * @type {String} - */ - _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; - - /** - * Css class for the paging input element - * @type {String} - */ - _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; - - /** - * Label and values for the results per page select, example of usage: - * ['Records: ', [10,25,50,100]] - * @type {Array} - */ - _this.resultsPerPage = f.results_per_page || null; - - /** - * Determines if results per page is configured - * @type {Boolean} - */ - _this.hasResultsPerPage = (0, _types.isArray)(_this.resultsPerPage); - - /** - * Css class for the results per page select - * @type {String} - */ - _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; - - /** - * Css class for the label preceding results per page select - * @type {String} - */ - _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; - - /** - * Index of the first row of current page - * @type {Number} - * @private - */ - _this.startPagingRow = 0; - - /** - * Total number of pages - * @type {Number} - * @private - */ - _this.nbPages = 0; - - /** - * Current page number - * @type {Number} - * @private - */ - _this.currentPageNb = 1; - - /** - * Next page button text - * @type {String} - */ - _this.btnNextPageText = f.btn_next_page_text || '>'; - - /** - * Previous page button text - * @type {String} - */ - _this.btnPrevPageText = f.btn_prev_page_text || '<'; - - /** - * Last page button text - * @type {String} - */ - _this.btnLastPageText = f.btn_last_page_text || '>|'; - - /** - * First page button text - * @type {String} - */ - _this.btnFirstPageText = f.btn_first_page_text || '|<'; - - /** - * Next page button HTML - * @type {String} - */ - _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); - - /** - * Previous page button HTML - * @type {String} - */ - _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); - - /** - * First page button HTML - * @type {String} - */ - _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); - - /** - * Last page button HTML - * @type {String} - */ - _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); - - /** - * Text preceeding page selector drop-down - * @type {String} - */ - _this.pageText = f.page_text || ' Page '; - - /** - * Text after page selector drop-down - * @type {String} - */ - _this.ofText = f.of_text || ' of '; - - /** - * Css class for the span containing total number of pages - * @type {String} - */ - _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; - - /** - * Determines if paging buttons are enabled (default: true) - * @type {Boolean} - */ - _this.hasPagingBtns = f.paging_btns === false ? false : true; - - /** - * Defines page selector type, two possible values: 'select', 'input' - * @type {String} - */ - _this.pageSelectorType = f.page_selector_type || _const.SELECT; - - /** - * Callback fired before the page is changed - * @type {Function} - */ - _this.onBeforeChangePage = (0, _types.isFn)(f.on_before_change_page) ? f.on_before_change_page : null; - - /** - * Callback fired after the page is changed - * @type {Function} - */ - _this.onAfterChangePage = (0, _types.isFn)(f.on_after_change_page) ? f.on_after_change_page : null; - - /** - * Element IDs prefixes - */ - /** - * Page select - * @type {String} - * @private - */ - _this.prfxSlcPages = 'slcPages_'; - /** - * Results per page select - * @type {String} - * @private - */ - _this.prfxSlcResults = 'slcResults_'; - /** - * Label preciding results per page select - * @type {String} - * @private - */ - _this.prfxSlcResultsTxt = 'slcResultsTxt_'; - /** - * Span containing next page button - * @type {String} - * @private - */ - _this.prfxBtnNextSpan = 'btnNextSpan_'; - /** - * Span containing previous page button - * @type {String} - * @private - */ - _this.prfxBtnPrevSpan = 'btnPrevSpan_'; - /** - * Span containing last page button - * @type {String} - * @private - */ - _this.prfxBtnLastSpan = 'btnLastSpan_'; - /** - * Span containing first page button - * @type {String} - * @private - */ - _this.prfxBtnFirstSpan = 'btnFirstSpan_'; - /** - * Next button - * @type {String} - * @private - */ - _this.prfxBtnNext = 'btnNext_'; - /** - * Previous button - * @type {String} - * @private - */ - _this.prfxBtnPrev = 'btnPrev_'; - /** - * Last button - * @type {String} - * @private - */ - _this.prfxBtnLast = 'btnLast_'; - /** - * First button - * @type {String} - * @private - */ - _this.prfxBtnFirst = 'btnFirst_'; - /** - * Span for tot nb pages - * @type {String} - * @private - */ - _this.prfxPgSpan = 'pgspan_'; - /** - * Span preceding pages select (contains 'Page') - * @type {String} - * @private - */ - _this.prfxPgBeforeSpan = 'pgbeforespan_'; - /** - * Span following pages select (contains ' of ') - * @type {String} - * @private - */ - _this.prfxPgAfterSpan = 'pgafterspan_'; - - var start_row = tf.refRow; - var nrows = tf.getRowsNb(true); - //calculates page nb - _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); - - var o = _this; - /** - * Paging DOM events handlers - * @type {String} - * @private - */ - _this.evt = { - slcIndex: function slcIndex() { - return o.pageSelectorType === _const.SELECT ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; - }, - nbOpts: function nbOpts() { - return o.pageSelectorType === _const.SELECT ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; - }, - next: function next() { - var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; - o.changePage(nextIndex); - }, - prev: function prev() { - var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); - o.changePage(prevIndex); - }, - last: function last() { - o.changePage(o.evt.nbOpts()); - }, - first: function first() { - o.changePage(0); - }, - _detectKey: function _detectKey(e) { - var key = (0, _event.keyCode)(e); - if (key === _const.ENTER_KEY) { - if (tf.sorted) { - tf.filter(); - o.changePage(o.evt.slcIndex()); - } else { - o.changePage(); - } - this.blur(); - } - }, - - slcPagesChange: null, - nextEvt: null, - prevEvt: null, - lastEvt: null, - firstEvt: null - }; - return _this; - } - - /** - * Initialize DOM elements - */ - - - Paging.prototype.init = function init() { - var _this2 = this; - - var slcPages; - var tf = this.tf; - var evt = this.evt; - - if (this.initialized) { - return; - } - - // Check resultsPerPage is in expected format and initialise the - // results per page component - if (this.hasResultsPerPage) { - if (this.resultsPerPage.length < 2) { - this.hasResultsPerPage = false; - } else { - this.pagingLength = this.resultsPerPage[1][0]; - this.setResultsPerPage(); - } - } - - evt.slcPagesChange = function (event) { - var slc = event.target; - _this2.changePage(slc.selectedIndex); - }; - - // Paging drop-down list selector - if (this.pageSelectorType === _const.SELECT) { - slcPages = (0, _dom.createElm)(_const.SELECT, ['id', this.prfxSlcPages + tf.id]); - slcPages.className = this.pgSlcCssClass; - (0, _event.addEvt)(slcPages, 'change', evt.slcPagesChange); - } - - // Paging input selector - if (this.pageSelectorType === _const.INPUT) { - slcPages = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); - slcPages.className = this.pgInpCssClass; - (0, _event.addEvt)(slcPages, 'keypress', evt._detectKey); - } - - // btns containers - var btnNextSpan = (0, _dom.createElm)('span', ['id', this.prfxBtnNextSpan + tf.id]); - var btnPrevSpan = (0, _dom.createElm)('span', ['id', this.prfxBtnPrevSpan + tf.id]); - var btnLastSpan = (0, _dom.createElm)('span', ['id', this.prfxBtnLastSpan + tf.id]); - var btnFirstSpan = (0, _dom.createElm)('span', ['id', this.prfxBtnFirstSpan + tf.id]); - - if (this.hasPagingBtns) { - // Next button - if (!this.btnNextPageHtml) { - var btn_next = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); - btn_next.className = this.btnPageCssClass; - (0, _event.addEvt)(btn_next, 'click', evt.next); - btnNextSpan.appendChild(btn_next); - } else { - btnNextSpan.innerHTML = this.btnNextPageHtml; - (0, _event.addEvt)(btnNextSpan, 'click', evt.next); - } - // Previous button - if (!this.btnPrevPageHtml) { - var btn_prev = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); - btn_prev.className = this.btnPageCssClass; - (0, _event.addEvt)(btn_prev, 'click', evt.prev); - btnPrevSpan.appendChild(btn_prev); - } else { - btnPrevSpan.innerHTML = this.btnPrevPageHtml; - (0, _event.addEvt)(btnPrevSpan, 'click', evt.prev); - } - // Last button - if (!this.btnLastPageHtml) { - var btn_last = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); - btn_last.className = this.btnPageCssClass; - (0, _event.addEvt)(btn_last, 'click', evt.last); - btnLastSpan.appendChild(btn_last); - } else { - btnLastSpan.innerHTML = this.btnLastPageHtml; - (0, _event.addEvt)(btnLastSpan, 'click', evt.last); - } - // First button - if (!this.btnFirstPageHtml) { - var btn_first = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); - btn_first.className = this.btnPageCssClass; - (0, _event.addEvt)(btn_first, 'click', evt.first); - btnFirstSpan.appendChild(btn_first); - } else { - btnFirstSpan.innerHTML = this.btnFirstPageHtml; - (0, _event.addEvt)(btnFirstSpan, 'click', evt.first); - } - } - - // paging elements (buttons+drop-down list) are added to defined element - if (!this.pagingTgtId) { - tf.setToolbar(); - } - var targetEl = !this.pagingTgtId ? tf.mDiv : (0, _dom.elm)(this.pagingTgtId); - targetEl.appendChild(btnFirstSpan); - targetEl.appendChild(btnPrevSpan); - - var pgBeforeSpan = (0, _dom.createElm)('span', ['id', this.prfxPgBeforeSpan + tf.id]); - pgBeforeSpan.appendChild((0, _dom.createText)(this.pageText)); - pgBeforeSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgBeforeSpan); - targetEl.appendChild(slcPages); - var pgAfterSpan = (0, _dom.createElm)('span', ['id', this.prfxPgAfterSpan + tf.id]); - pgAfterSpan.appendChild((0, _dom.createText)(this.ofText)); - pgAfterSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgAfterSpan); - var pgspan = (0, _dom.createElm)('span', ['id', this.prfxPgSpan + tf.id]); - pgspan.className = this.nbPgSpanCssClass; - pgspan.appendChild((0, _dom.createText)(' ' + this.nbPages + ' ')); - targetEl.appendChild(pgspan); - targetEl.appendChild(btnNextSpan); - targetEl.appendChild(btnLastSpan); - this.pagingSlc = (0, _dom.elm)(this.prfxSlcPages + tf.id); - - this.setPagingInfo(); - - if (!tf.fltGrid) { - tf.validateAllRows(); - this.setPagingInfo(tf.validRowsIndex); - } - - this.emitter.on(['after-filtering'], function () { - return _this2.resetPagingInfo(); - }); - this.emitter.on(['change-page'], function (tf, pageNumber) { - return _this2.setPage(pageNumber); - }); - this.emitter.on(['change-page-results'], function (tf, pageLength) { - return _this2.changeResultsPerPage(pageLength); - }); - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Reset paging when filters are already instantiated - * @param {Boolean} filterTable Execute filtering once paging instanciated - */ - - - Paging.prototype.reset = function reset() { - var filterTable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - var tf = this.tf; - if (this.isEnabled()) { - return; - } - this.enable(); - this.init(); - - if (filterTable) { - tf.filter(); - } - }; - - /** - * Reset paging info from scratch after a filtering process - */ - - - Paging.prototype.resetPagingInfo = function resetPagingInfo() { - this.startPagingRow = 0; - this.currentPageNb = 1; - this.setPagingInfo(this.tf.validRowsIndex); - }; - - /** - * Calculate number of pages based on valid rows - * Refresh paging select according to number of pages - * @param {Array} validRows Collection of valid rows - */ - - - Paging.prototype.setPagingInfo = function setPagingInfo(validRows) { - var tf = this.tf; - var mdiv = !this.pagingTgtId ? tf.mDiv : (0, _dom.elm)(this.pagingTgtId); - var pgspan = (0, _dom.elm)(this.prfxPgSpan + tf.id); - - //store valid rows indexes - tf.validRowsIndex = validRows || tf.getValidRows(true); - - //calculate nb of pages - this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); - //refresh page nb span - pgspan.innerHTML = this.nbPages; - //select clearing shortcut - if (this.pageSelectorType === _const.SELECT) { - this.pagingSlc.innerHTML = ''; - } - - if (this.nbPages > 0) { - mdiv.style.visibility = 'visible'; - if (this.pageSelectorType === _const.SELECT) { - for (var z = 0; z < this.nbPages; z++) { - var opt = (0, _dom.createOpt)(z + 1, z * this.pagingLength, false); - this.pagingSlc.options[z] = opt; - } - } else { - //input type - this.pagingSlc.value = this.currentPageNb; - } - } else { - /*** if no results paging select and buttons are hidden ***/ - mdiv.style.visibility = 'hidden'; - } - this.groupByPage(tf.validRowsIndex); - }; - - /** - * Group table rows by page and display valid rows - * @param {Array} validRows Collection of valid rows - */ - - - Paging.prototype.groupByPage = function groupByPage(validRows) { - var tf = this.tf; - var rows = tf.tbl.rows; - var startPagingRow = parseInt(this.startPagingRow, 10); - var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); - - //store valid rows indexes - if (validRows) { - tf.validRowsIndex = validRows; - } - - //this loop shows valid rows of current page - for (var h = 0, len = tf.getValidRowsNb(true); h < len; h++) { - var validRowIdx = tf.validRowsIndex[h]; - var r = rows[validRowIdx]; - var isRowValid = r.getAttribute('validRow'); - var rowDisplayed = false; - - if (h >= startPagingRow && h < endPagingRow) { - if ((0, _types.isNull)(isRowValid) || Boolean(isRowValid === 'true')) { - r.style.display = ''; - rowDisplayed = true; - } - } else { - r.style.display = _const.NONE; - } - this.emitter.emit('row-paged', tf, validRowIdx, h, rowDisplayed); - } - - // broadcast grouping by page - this.emitter.emit('grouped-by-page', tf, this); - }; - - /** - * Return the current page number - * @return {Number} Page number - */ - - - Paging.prototype.getPage = function getPage() { - return this.currentPageNb; - }; - - /** - * Show page defined by passed argument (string or number): - * @param {String}/{Number} cmd possible string values: 'next', - * 'previous', 'last', 'first' or page number as per param - */ - - - Paging.prototype.setPage = function setPage(cmd) { - var tf = this.tf; - if (!tf.isInitialized() || !this.isEnabled()) { - return; - } - var btnEvt = this.evt, - cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); - if (cmdtype === 'string') { - switch (cmd.toLowerCase()) { - case 'next': - btnEvt.next(); - break; - case 'previous': - btnEvt.prev(); - break; - case 'last': - btnEvt.last(); - break; - case 'first': - btnEvt.first(); - break; - default: - btnEvt.next(); - break; - } - } else if (cmdtype === 'number') { - this.changePage(cmd - 1); - } - }; - - /** - * Generates UI elements for the number of results per page drop-down - */ - - - Paging.prototype.setResultsPerPage = function setResultsPerPage() { - var _this3 = this; - - var tf = this.tf; - var evt = this.evt; - - if (this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - - evt.slcResultsChange = function (ev) { - _this3.onChangeResultsPerPage(); - ev.target.blur(); - }; - - var slcR = (0, _dom.createElm)(_const.SELECT, ['id', this.prfxSlcResults + tf.id]); - slcR.className = this.resultsSlcCssClass; - var slcRText = this.resultsPerPage[0], - slcROpts = this.resultsPerPage[1]; - var slcRSpan = (0, _dom.createElm)('span', ['id', this.prfxSlcResultsTxt + tf.id]); - slcRSpan.className = this.resultsSpanCssClass; - - // results per page select is added to external element - if (!this.resultsPerPageTgtId) { - tf.setToolbar(); - } - var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : (0, _dom.elm)(this.resultsPerPageTgtId); - slcRSpan.appendChild((0, _dom.createText)(slcRText)); - - var help = tf.feature('help'); - if (help && help.btn) { - help.btn.parentNode.insertBefore(slcRSpan, help.btn); - help.btn.parentNode.insertBefore(slcR, help.btn); - } else { - targetEl.appendChild(slcRSpan); - targetEl.appendChild(slcR); - } - - for (var r = 0; r < slcROpts.length; r++) { - var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); - slcR.options[r] = currOpt; - } - (0, _event.addEvt)(slcR, 'change', evt.slcResultsChange); - this.resultsPerPageSlc = slcR; - }; - - /** - * Remove number of results per page UI elements - */ - - - Paging.prototype.removeResultsPerPage = function removeResultsPerPage() { - var tf = this.tf; - if (!tf.isInitialized() || !this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - var slcR = this.resultsPerPageSlc, - slcRSpan = (0, _dom.elm)(this.prfxSlcResultsTxt + tf.id); - if (slcR) { - (0, _dom.removeElm)(slcR); - } - if (slcRSpan) { - (0, _dom.removeElm)(slcRSpan); - } - this.resultsPerPageSlc = null; - }; - - /** - * Change the page based on passed index - * @param {Number} index Index of the page (0-n) - */ - - - Paging.prototype.changePage = function changePage(index) { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-page-change', tf, index + 1); - - if (index === null) { - index = this.pageSelectorType === _const.SELECT ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; - } - if (index >= 0 && index <= this.nbPages - 1) { - if (this.onBeforeChangePage) { - this.onBeforeChangePage.call(null, this, index + 1); - } - this.currentPageNb = parseInt(index, 10) + 1; - if (this.pageSelectorType === _const.SELECT) { - this.pagingSlc.options[index].selected = true; - } else { - this.pagingSlc.value = this.currentPageNb; - } - - this.startPagingRow = this.pageSelectorType === _const.SELECT ? this.pagingSlc.value : index * this.pagingLength; - - this.groupByPage(); - - if (this.onAfterChangePage) { - this.onAfterChangePage.call(null, this, index + 1); - } - } - - this.emitter.emit('after-page-change', tf, index + 1); - }; - - /** - * Change the number of results per page based on passed value - * @param {String} val The number of results per page - */ - - - Paging.prototype.changeResultsPerPage = function changeResultsPerPage(val) { - if (!this.isEnabled() || isNaN(val)) { - return; - } - - this.resultsPerPageSlc.value = val; - this.onChangeResultsPerPage(); - }; - - /** - * Change rows according to page results drop-down - */ - - - Paging.prototype.onChangeResultsPerPage = function onChangeResultsPerPage() { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-page-length-change', tf); - - var slcR = this.resultsPerPageSlc; - var slcIndex = slcR.selectedIndex; - var slcPagesSelIndex = this.pageSelectorType === _const.SELECT ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); - this.pagingLength = parseInt(slcR.options[slcIndex].value, 10); - this.startPagingRow = this.pagingLength * slcPagesSelIndex; - - if (!isNaN(this.pagingLength)) { - if (this.startPagingRow >= tf.nbFilterableRows) { - this.startPagingRow = tf.nbFilterableRows - this.pagingLength; - } - this.setPagingInfo(); - - if (this.pageSelectorType === _const.SELECT) { - var slcIdx = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; - this.pagingSlc.options[slcIdx].selected = true; - } - } - - this.emitter.emit('after-page-length-change', tf, this.pagingLength); - }; - - /** - * Re-set page nb at page re-load - */ - - - Paging.prototype.resetPage = function resetPage() { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page', tf); - var pgNb = tf.feature('store').getPageNb(); - if (pgNb !== '') { - this.changePage(pgNb - 1); - } - this.emitter.emit('after-reset-page', tf, pgNb); - }; - - /** - * Re-set page length value at page re-load - */ - - - Paging.prototype.resetPageLength = function resetPageLength() { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page-length', tf); - var pglenIndex = tf.feature('store').getPageLength(); - - if (pglenIndex !== '') { - this.resultsPerPageSlc.options[pglenIndex].selected = true; - this.changeResultsPerPage(); - } - this.emitter.emit('after-reset-page-length', tf, pglenIndex); - }; - - /** - * Remove paging feature - */ - - - Paging.prototype.destroy = function destroy() { - var _this4 = this; - - var tf = this.tf; - - if (!this.initialized) { - return; - } - // btns containers - var btnNextSpan = (0, _dom.elm)(this.prfxBtnNextSpan + tf.id); - var btnPrevSpan = (0, _dom.elm)(this.prfxBtnPrevSpan + tf.id); - var btnLastSpan = (0, _dom.elm)(this.prfxBtnLastSpan + tf.id); - var btnFirstSpan = (0, _dom.elm)(this.prfxBtnFirstSpan + tf.id); - //span containing 'Page' text - var pgBeforeSpan = (0, _dom.elm)(this.prfxPgBeforeSpan + tf.id); - //span containing 'of' text - var pgAfterSpan = (0, _dom.elm)(this.prfxPgAfterSpan + tf.id); - //span containing nb of pages - var pgspan = (0, _dom.elm)(this.prfxPgSpan + tf.id); - - var evt = this.evt; - - if (this.pagingSlc) { - if (this.pageSelectorType === _const.SELECT) { - (0, _event.removeEvt)(this.pagingSlc, 'change', evt.slcPagesChange); - } else if (this.pageSelectorType === _const.INPUT) { - (0, _event.removeEvt)(this.pagingSlc, 'keypress', evt._detectKey); - } - (0, _dom.removeElm)(this.pagingSlc); - } - - if (btnNextSpan) { - (0, _event.removeEvt)(btnNextSpan, 'click', evt.next); - (0, _dom.removeElm)(btnNextSpan); - } - - if (btnPrevSpan) { - (0, _event.removeEvt)(btnPrevSpan, 'click', evt.prev); - (0, _dom.removeElm)(btnPrevSpan); - } - - if (btnLastSpan) { - (0, _event.removeEvt)(btnLastSpan, 'click', evt.last); - (0, _dom.removeElm)(btnLastSpan); - } - - if (btnFirstSpan) { - (0, _event.removeEvt)(btnFirstSpan, 'click', evt.first); - (0, _dom.removeElm)(btnFirstSpan); - } - - if (pgBeforeSpan) { - (0, _dom.removeElm)(pgBeforeSpan); - } - - if (pgAfterSpan) { - (0, _dom.removeElm)(pgAfterSpan); - } - - if (pgspan) { - (0, _dom.removeElm)(pgspan); - } - - if (this.hasResultsPerPage) { - this.removeResultsPerPage(); - } - - this.emitter.off(['after-filtering'], function () { - return _this4.resetPagingInfo(); - }); - this.emitter.off(['change-page'], function (tf, pageNumber) { - return _this4.setPage(pageNumber); - }); - this.emitter.off(['change-page-results'], function (tf, pageLength) { - return _this4.changeResultsPerPage(pageLength); - }); - - this.pagingSlc = null; - this.nbPages = 0; - this.disable(); - this.initialized = false; - }; - - return Paging; - }(_feature.Feature); - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.ClearButton = undefined; - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _event = __webpack_require__(1); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Clear button UI component - */ - var ClearButton = exports.ClearButton = function (_Feature) { - _inherits(ClearButton, _Feature); - - /** - * Creates an instance of ClearButton - * @param {TableFilter} tf TableFilter instance - */ - function ClearButton(tf) { - _classCallCheck(this, ClearButton); - - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'btnReset')); - - var f = _this.config; - - /** - * Container element ID - * @type {String} - */ - _this.targetId = f.btn_reset_target_id || null; - - /** - * Clear button element - * @type {DOMElement} - * @private - */ - _this.element = null; - - /** - * Text for the clear button - * @type {String} - */ - _this.text = f.btn_reset_text || 'Reset'; - - /** - * Css class for reset button - * @type {String} - */ - _this.cssClass = f.btn_reset_css_class || 'reset'; - - /** - * Tooltip text for the clear button - * @type {String} - */ - _this.tooltip = f.btn_reset_tooltip || 'Clear filters'; - - /** - * Custom Html string for the clear button - * @type {String} - */ - _this.html = f.btn_reset_html || (!tf.enableIcons ? null : ''); - - /** - * Prefix for container ID - * @type {String} - * @private - */ - _this.prfxCont = 'resetspan_'; - return _this; - } - - /** - * Click event handler for clear button - * @private - */ - - - ClearButton.prototype.onClick = function onClick() { - if (!this.isEnabled()) { - return; - } - this.tf.clearFilters(); - }; - - /** - * Initialize clear button component - */ - - - ClearButton.prototype.init = function init() { - var _this2 = this; - - var tf = this.tf; - - if (this.initialized) { - return; - } - - var resetspan = (0, _dom.createElm)('span', ['id', this.prfxCont + tf.id]); - - // reset button is added to defined element - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.rDiv : (0, _dom.elm)(this.targetId); - targetEl.appendChild(resetspan); - - if (!this.html) { - var fltReset = (0, _dom.createElm)('a', ['href', 'javascript:void(0);']); - fltReset.className = this.cssClass; - fltReset.appendChild((0, _dom.createText)(this.text)); - resetspan.appendChild(fltReset); - (0, _event.addEvt)(fltReset, 'click', function () { - return _this2.onClick(); - }); - } else { - resetspan.innerHTML = this.html; - var resetEl = resetspan.firstChild; - (0, _event.addEvt)(resetEl, 'click', function () { - return _this2.onClick(); - }); - } - this.element = resetspan.firstChild; - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Destroy ClearButton instance - */ - - - ClearButton.prototype.destroy = function destroy() { - var tf = this.tf; - - if (!this.initialized) { - return; - } - - var resetspan = (0, _dom.elm)(this.prfxCont + tf.id); - if (resetspan) { - (0, _dom.removeElm)(resetspan); - } - this.element = null; - this.initialized = false; - }; - - return ClearButton; - }(_feature.Feature); - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Help = undefined; - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _event = __webpack_require__(1); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; - var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; - - /** - * Help UI component - */ - - var Help = exports.Help = function (_Feature) { - _inherits(Help, _Feature); - - /** - * Creates an instance of Help. - * @param {TableFilter} tf TableFilter instance - */ - function Help(tf) { - _classCallCheck(this, Help); - - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'help')); - - var f = _this.config; - - /** - * ID of main custom container element - * @type {String} - */ - _this.tgtId = f.help_instructions_target_id || null; - - /** - * ID of custom container element for instructions - * @type {String} - */ - _this.contTgtId = f.help_instructions_container_target_id || null; - - /** - * Instructions text (accepts HTML) - * @type {String} - */ - _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; - - /** - * Instructions HTML - * @type {String} - */ - _this.instrHtml = f.help_instructions_html || null; - - /** - * Help button text ('?') - * @type {String} - */ - _this.btnText = f.help_instructions_btn_text || '?'; - - /** - * Custom help button HTML - * @type {String} - */ - _this.btnHtml = f.help_instructions_btn_html || null; - - /** - * Css class for help button - * @type {String} - */ - _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; - - /** - * Css class for help container element - * @type {String} - */ - _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; - - /** - * Stores button DOM element - * @type {DOMElement} - */ - _this.btn = null; - - /** - * Stores help container DOM element - * @type {DOMElement} - */ - _this.cont = null; - - /** - * Default HTML appended to instructions text - * @type {String} - */ - _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; - - /** - * Prefix for help main container ID - * @type {String} - * @private - */ - _this.prfxHelpSpan = 'helpSpan_'; - - /** - * Prefix for help instructions container ID - * @type {String} - * @private - */ - _this.prfxHelpDiv = 'helpDiv_'; - - _this.emitter.on(['init-help'], function () { - return _this.init(); - }); - return _this; - } - - /** - * Initialise Help instance - */ - - - Help.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - var helpspan = (0, _dom.createElm)('span', ['id', this.prfxHelpSpan + tf.id]); - var helpdiv = (0, _dom.createElm)('div', ['id', this.prfxHelpDiv + tf.id]); - - //help button is added to defined element - if (!this.tgtId) { - tf.setToolbar(); - } - var targetEl = !this.tgtId ? tf.rDiv : (0, _dom.elm)(this.tgtId); - targetEl.appendChild(helpspan); - - var divContainer = !this.contTgtId ? helpspan : (0, _dom.elm)(this.contTgtId); - - if (!this.btnHtml) { - divContainer.appendChild(helpdiv); - var helplink = (0, _dom.createElm)('a', ['href', 'javascript:void(0);']); - helplink.className = this.btnCssClass; - helplink.appendChild((0, _dom.createText)(this.btnText)); - helpspan.appendChild(helplink); - (0, _event.addEvt)(helplink, 'click', function () { - return _this2.toggle(); - }); - } else { - helpspan.innerHTML = this.btnHtml; - var helpEl = helpspan.firstChild; - (0, _event.addEvt)(helpEl, 'click', function () { - return _this2.toggle(); - }); - divContainer.appendChild(helpdiv); - } - - if (!this.instrHtml) { - helpdiv.innerHTML = this.instrText; - helpdiv.className = this.contCssClass; - (0, _event.addEvt)(helpdiv, 'dblclick', function () { - return _this2.toggle(); - }); - } else { - if (this.contTgtId) { - divContainer.appendChild(helpdiv); - } - helpdiv.innerHTML = this.instrHtml; - if (!this.contTgtId) { - helpdiv.className = this.contCssClass; - (0, _event.addEvt)(helpdiv, 'dblclick', function () { - return _this2.toggle(); - }); - } - } - helpdiv.innerHTML += this.defaultHtml; - (0, _event.addEvt)(helpdiv, 'click', function () { - return _this2.toggle(); - }); - - this.cont = helpdiv; - this.btn = helpspan; - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Toggle help pop-up - */ - - - Help.prototype.toggle = function toggle() { - // check only if explicitily set to false as in this case undefined - // signifies the help feature is enabled by default - if (this.enabled === false) { - return; - } - var divDisplay = this.cont.style.display; - if (divDisplay === '' || divDisplay === _const.NONE) { - this.cont.style.display = 'inline'; - } else { - this.cont.style.display = _const.NONE; - } - }; - - /** - * Remove help UI - */ - - - Help.prototype.destroy = function destroy() { - if (!this.initialized) { - return; - } - (0, _dom.removeElm)(this.btn); - this.btn = null; - if (!this.cont) { - return; - } - (0, _dom.removeElm)(this.cont); - this.cont = null; - this.initialized = false; - }; - - return Help; - }(_feature.Feature); - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AlternateRows = undefined; - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Rows with alternating background color for improved readability - */ - var AlternateRows = exports.AlternateRows = function (_Feature) { - _inherits(AlternateRows, _Feature); - - /** - * Creates an instance of AlternateRows. - * - * @param {Object} tf TableFilter instance - */ - function AlternateRows(tf) { - _classCallCheck(this, AlternateRows); - - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'alternateRows')); - - var config = _this.config; - /** - * Css class for even rows (default: 'even') - * @type {String} - */ - _this.evenCss = config.even_row_css_class || 'even'; - - /** - * Css class for odd rows (default: 'odd') - * @type {String} - */ - _this.oddCss = config.odd_row_css_class || 'odd'; - return _this; - } - - /** - * Sets alternating rows color - */ - - - AlternateRows.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - this.processAll(); - - // Subscribe to events - this.emitter.on(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this2.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.on(['column-sorted'], function () { - return _this2.processAll(); - }); - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Apply background to all valid rows - */ - - - AlternateRows.prototype.processAll = function processAll() { - if (!this.isEnabled()) { - return; - } - var tf = this.tf; - var validRowsIndex = tf.getValidRows(true); - var indexLen = validRowsIndex.length; - var idx = 0; - - //alternates bg color - for (var j = 0; j < indexLen; j++) { - var rowIdx = validRowsIndex[j]; - this.setRowBg(rowIdx, idx); - idx++; - } - }; - - /** - * Set/remove row background based on row validation - * @param {Number} rowIdx Row index - * @param {Number} arrIdx Array index - * @param {Boolean} isValid Valid row flag - */ - - - AlternateRows.prototype.processRow = function processRow(rowIdx, arrIdx, isValid) { - if (isValid) { - this.setRowBg(rowIdx, arrIdx); - } else { - this.removeRowBg(rowIdx); - } - }; - - /** - * Sets row background color - * @param {Number} rowIdx Row index - * @param {Number} idx Valid rows collection index needed to calculate bg - * color - * @private - */ - - - AlternateRows.prototype.setRowBg = function setRowBg(rowIdx, idx) { - if (!this.isEnabled() || isNaN(rowIdx)) { - return; - } - var rows = this.tf.tbl.rows; - var i = isNaN(idx) ? rowIdx : idx; - this.removeRowBg(rowIdx); - - (0, _dom.addClass)(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); - }; - - /** - * Removes row background color - * @param {Number} idx Row index - * @private - */ - - - AlternateRows.prototype.removeRowBg = function removeRowBg(idx) { - if (isNaN(idx)) { - return; - } - var rows = this.tf.tbl.rows; - (0, _dom.removeClass)(rows[idx], this.oddCss); - (0, _dom.removeClass)(rows[idx], this.evenCss); - }; - - /** - * Removes all alternating backgrounds - */ - - - AlternateRows.prototype.destroy = function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - var nbRows = this.tf.getRowsNb(true); - for (var i = 0; i < nbRows; i++) { - this.removeRowBg(i); - } - - // Unsubscribe to events - this.emitter.off(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this3.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.off(['column-sorted'], function () { - return _this3.processAll(); - }); - - this.initialized = false; - }; - - return AlternateRows; - }(_feature.Feature); - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.NoResults = undefined; - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _types = __webpack_require__(4); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * UI when filtering yields no matches - * @export - * @class NoResults - * @extends {Feature} - */ - var NoResults = exports.NoResults = function (_Feature) { - _inherits(NoResults, _Feature); - - /** - * Creates an instance of NoResults - * @param {TableFilter} tf TableFilter instance - */ - function NoResults(tf) { - _classCallCheck(this, NoResults); - - //configuration object - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'noResults')); - - var f = _this.config.no_results_message; - - /** - * Text (accepts HTML) - * @type {String} - */ - _this.content = f.content || 'No results'; - - /** - * Custom container DOM element - * @type {DOMElement} - */ - _this.customContainer = f.custom_container || null; - - /** - * ID of custom container element - * @type {String} - */ - _this.customContainerId = f.custom_container_id || null; - - /** - * Indicates if UI is contained in a external element - * @type {Boolean} - * @private - */ - _this.isExternal = !(0, _types.isEmpty)(_this.customContainer) || !(0, _types.isEmpty)(_this.customContainerId); - - /** - * Css class assigned to container element - * @type {String} - */ - _this.cssClass = f.css_class || 'no-results'; - - /** - * Stores container DOM element - * @type {DOMElement} - */ - _this.cont = null; - - /** - * Callback fired before the message is displayed - * @type {Function} - */ - _this.onBeforeShow = (0, _types.isFn)(f.on_before_show_msg) ? f.on_before_show_msg : null; - - /** - * Callback fired after the message is displayed - * @type {Function} - */ - _this.onAfterShow = (0, _types.isFn)(f.on_after_show_msg) ? f.on_after_show_msg : null; - - /** - * Callback fired before the message is hidden - * @type {Function} - */ - _this.onBeforeHide = (0, _types.isFn)(f.on_before_hide_msg) ? f.on_before_hide_msg : null; - - /** - * Callback fired after the message is hidden - * @type {Function} - */ - _this.onAfterHide = (0, _types.isFn)(f.on_after_hide_msg) ? f.on_after_hide_msg : null; - - /** - * Prefix for container ID - * @type {String} - * @private - */ - _this.prfx = 'nores_'; - return _this; - } - - /** - * Initializes NoResults instance - */ - - - NoResults.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - var tf = this.tf; - var target = this.customContainer || (0, _dom.elm)(this.customContainerId) || tf.tbl; - - //container - var cont = (0, _dom.createElm)('div', ['id', this.prfx + tf.id]); - cont.className = this.cssClass; - cont.innerHTML = this.content; - - if (this.isExternal) { - target.appendChild(cont); - } else { - target.parentNode.insertBefore(cont, target.nextSibling); - } - - this.cont = cont; - - // subscribe to after-filtering event - this.emitter.on(['after-filtering'], function () { - return _this2.toggle(); - }); - - /** - * @inherited - */ - this.initialized = true; - - this.hide(); - }; - - /** - * Toggle no results message - */ - - - NoResults.prototype.toggle = function toggle() { - if (this.tf.getValidRowsNb() > 0) { - this.hide(); - } else { - this.show(); - } - }; - - /** - * Show no results message - */ - - - NoResults.prototype.show = function show() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeShow) { - this.onBeforeShow.call(null, this.tf, this); - } - - this.setWidth(); - this.cont.style.display = 'block'; - - if (this.onAfterShow) { - this.onAfterShow.call(null, this.tf, this); - } - }; - - /** - * Hide no results message - */ - - - NoResults.prototype.hide = function hide() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeHide) { - this.onBeforeHide.call(null, this.tf, this); - } - - this.cont.style.display = _const.NONE; - - if (this.onAfterHide) { - this.onAfterHide.call(null, this.tf, this); - } - }; - - /** - * Sets no results container width - * @private - */ - - - NoResults.prototype.setWidth = function setWidth() { - if (!this.initialized || this.isExternal || !this.isEnabled()) { - return; - } - var tf = this.tf; - if (tf.gridLayout) { - var gridLayout = tf.feature('gridLayout'); - this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; - } else { - this.cont.style.width = (tf.tbl.tHead ? tf.tbl.tHead.clientWidth : tf.tbl.tBodies[0].clientWidth) + 'px'; - } - }; - - /** - * Remove feature - */ - - - NoResults.prototype.destroy = function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - (0, _dom.removeElm)(this.cont); - this.cont = null; - // unsubscribe to after-filtering event - this.emitter.off(['after-filtering'], function () { - return _this3.toggle(); - }); - - this.initialized = false; - }; - - return NoResults; - }(_feature.Feature); - -/***/ }, -/* 26 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.State = undefined; - - var _feature = __webpack_require__(10); - - var _hash = __webpack_require__(27); - - var _storage = __webpack_require__(28); - - var _string = __webpack_require__(5); - - var _types = __webpack_require__(4); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Features state object persistable with localStorage, cookie or URL hash - * - * @export - * @class State - * @extends {Feature} - */ - var State = exports.State = function (_Feature) { - _inherits(State, _Feature); - - /** - * Creates an instance of State - * @param {TableFilter} tf TableFilter instance - */ - function State(tf) { - _classCallCheck(this, State); - - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'state')); - - var cfg = _this.config.state; - - /** - * Determines whether state is persisted with URL hash - * @type {Boolean} - */ - _this.enableHash = cfg === true || (0, _types.isArray)(cfg.types) && cfg.types.indexOf('hash') !== -1; - - /** - * Determines whether state is persisted with localStorage - * @type {Boolean} - */ - _this.enableLocalStorage = (0, _types.isArray)(cfg.types) && cfg.types.indexOf('local_storage') !== -1; - - /** - * Determines whether state is persisted with localStorage - * @type {Boolean} - */ - _this.enableCookie = (0, _types.isArray)(cfg.types) && cfg.types.indexOf('cookie') !== -1; - - /** - * Persist filters values, enabled by default - * @type {Boolean} - */ - _this.persistFilters = cfg.filters === false ? false : true; - - /** - * Persist current page number when paging is enabled - * @type {Boolean} - */ - _this.persistPageNumber = Boolean(cfg.page_number); - - /** - * Persist page length when paging is enabled - * @type {Boolean} - */ - _this.persistPageLength = Boolean(cfg.page_length); - - /** - * Persist column sorting - * @type {Boolean} - */ - _this.persistSort = Boolean(cfg.sort); - - /** - * Persist columns visibility - * @type {Boolean} - */ - _this.persistColsVisibility = Boolean(cfg.columns_visibility); - - /** - * Persist filters row visibility - * @type {Boolean} - */ - _this.persistFiltersVisibility = Boolean(cfg.filters_visibility); - - /** - * Cookie duration in hours - * @type {Boolean} - */ - _this.cookieDuration = !isNaN(cfg.cookie_duration) ? parseInt(cfg.cookie_duration, 10) : 87600; - - /** - * Enable Storage if localStorage or cookie is required - * @type {Boolean} - * @private - */ - _this.enableStorage = _this.enableLocalStorage || _this.enableCookie; - - /** - * Storage instance if storage is required - * @type {Storage} - * @private - */ - _this.storage = null; - - /** - * Hash instance if URL hash is required - * @type {Boolean} - * @private - */ - _this.hash = null; - - /** - * Current page number - * @type {Number} - * @private - */ - _this.pageNb = null; - - /** - * Current page length - * @type {Number} - * @private - */ - _this.pageLength = null; - - /** - * Current column sorting - * @type {Object} - * @private - */ - _this.sort = null; - - /** - * Current hidden columns - * @type {Object} - * @private - */ - _this.hiddenCols = null; - - /** - * Filters row visibility - * @type {Boolean} - * @private - */ - _this.filtersVisibility = null; - - /** - * State object - * @type {Object} - * @private - */ - _this.state = {}; - - /** - * Prefix for column ID - * @type {String} - * @private - */ - _this.prfxCol = 'col_'; - - /** - * Prefix for page number ID - * @type {String} - * @private - */ - _this.pageNbKey = 'page'; - - /** - * Prefix for page length ID - * @type {String} - * @private - */ - _this.pageLengthKey = 'page_length'; - - /** - * Prefix for filters visibility ID - * @type {String} - * @private - */ - _this.filtersVisKey = 'filters_visibility'; - return _this; - } - - /** - * Initializes State instance - */ - - - State.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - this.emitter.on(['after-filtering'], function () { - return _this2.update(); - }); - this.emitter.on(['after-page-change', 'after-clearing-filters'], function (tf, pageNb) { - return _this2.updatePage(pageNb); - }); - this.emitter.on(['after-page-length-change'], function (tf, pageLength) { - return _this2.updatePageLength(pageLength); - }); - this.emitter.on(['column-sorted'], function (tf, index, descending) { - return _this2.updateSort(index, descending); - }); - this.emitter.on(['sort-initialized'], function () { - return _this2._syncSort(); - }); - this.emitter.on(['columns-visibility-initialized'], function () { - return _this2._syncColsVisibility(); - }); - this.emitter.on(['column-shown', 'column-hidden'], function (tf, feature, colIndex, hiddenCols) { - return _this2.updateColsVisibility(hiddenCols); - }); - this.emitter.on(['filters-visibility-initialized'], function () { - return _this2._syncFiltersVisibility(); - }); - this.emitter.on(['filters-toggled'], function (tf, extension, visible) { - return _this2.updateFiltersVisibility(visible); - }); - - if (this.enableHash) { - this.hash = new _hash.Hash(this); - this.hash.init(); - } - if (this.enableStorage) { - this.storage = new _storage.Storage(this); - this.storage.init(); - } - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Update state object based on current features state - */ - - - State.prototype.update = function update() { - var _this3 = this; - - if (!this.isEnabled()) { - return; - } - var state = this.state; - var tf = this.tf; - - if (this.persistFilters) { - var filterValues = tf.getFiltersValue(); - - filterValues.forEach(function (val, idx) { - var key = '' + _this3.prfxCol + idx; - - if ((0, _types.isString)(val) && (0, _string.isEmpty)(val)) { - if (state.hasOwnProperty(key)) { - state[key].flt = undefined; - } - } else { - state[key] = state[key] || {}; - state[key].flt = val; - } - }); - } - - if (this.persistPageNumber) { - if ((0, _types.isNull)(this.pageNb)) { - state[this.pageNbKey] = undefined; - } else { - state[this.pageNbKey] = this.pageNb; - } - } - - if (this.persistPageLength) { - if ((0, _types.isNull)(this.pageLength)) { - state[this.pageLengthKey] = undefined; - } else { - state[this.pageLengthKey] = this.pageLength; - } - } - - if (this.persistSort) { - if (!(0, _types.isNull)(this.sort)) { - // Remove previuosly sorted column - Object.keys(state).forEach(function (key) { - if (key.indexOf(_this3.prfxCol) !== -1 && state[key]) { - state[key].sort = undefined; - } - }); - - var key = '' + this.prfxCol + this.sort.column; - state[key] = state[key] || {}; - state[key].sort = { descending: this.sort.descending }; - } - } - - if (this.persistColsVisibility) { - if (!(0, _types.isNull)(this.hiddenCols)) { - // Clear previuosly hidden columns - Object.keys(state).forEach(function (key) { - if (key.indexOf(_this3.prfxCol) !== -1 && state[key]) { - state[key].hidden = undefined; - } - }); - - this.hiddenCols.forEach(function (colIdx) { - var key = '' + _this3.prfxCol + colIdx; - state[key] = state[key] || {}; - state[key].hidden = true; - }); - } - } - - if (this.persistFiltersVisibility) { - if ((0, _types.isNull)(this.filtersVisibility)) { - state[this.filtersVisKey] = undefined; - } else { - state[this.filtersVisKey] = this.filtersVisibility; - } - } - - this.emitter.emit('state-changed', tf, state); - }; - - /** - * Refresh page number field on page number changes - * - * @param {Number} pageNb Current page number - */ - - - State.prototype.updatePage = function updatePage(pageNb) { - this.pageNb = pageNb; - this.update(); - }; - - /** - * Refresh page length field on page length changes - * - * @param {Number} pageLength Current page length value - */ - - - State.prototype.updatePageLength = function updatePageLength(pageLength) { - this.pageLength = pageLength; - this.update(); - }; - - /** - * Refresh column sorting information on sort changes - * - * @param index {Number} Column index - * @param {Boolean} descending Descending manner - */ - - - State.prototype.updateSort = function updateSort(index, descending) { - this.sort = { - column: index, - descending: descending - }; - this.update(); - }; - - /** - * Refresh hidden columns information on columns visibility changes - * - * @param {Array} hiddenCols Columns indexes - */ - - - State.prototype.updateColsVisibility = function updateColsVisibility(hiddenCols) { - this.hiddenCols = hiddenCols; - this.update(); - }; - - /** - * Refresh filters visibility on filters visibility change - * - * @param {Boolean} visible Visibility flad - */ - - - State.prototype.updateFiltersVisibility = function updateFiltersVisibility(visible) { - this.filtersVisibility = visible; - this.update(); - }; - - /** - * Override state field - * - * @param state State object - */ - - - State.prototype.override = function override(state) { - this.state = state; - }; - - /** - * Sync stored features state - */ - - - State.prototype.sync = function sync() { - var state = this.state; - var tf = this.tf; - - this._syncFilters(); - - if (this.persistPageNumber) { - var pageNumber = state[this.pageNbKey]; - this.emitter.emit('change-page', tf, pageNumber); - } - - if (this.persistPageLength) { - var pageLength = state[this.pageLengthKey]; - this.emitter.emit('change-page-results', tf, pageLength); - } - - this._syncSort(); - this._syncColsVisibility(); - this._syncFiltersVisibility(); - }; - - /** - * Override current state with passed one and sync features - * - * @param {Object} state State object - */ - - - State.prototype.overrideAndSync = function overrideAndSync(state) { - // To prevent state to react to features changes, state is temporarily - // disabled - this.disable(); - // State is overriden with passed state object - this.override(state); - // New hash state is applied to features - this.sync(); - // State is re-enabled - this.enable(); - }; - - /** - * Sync filters with stored values and filter table - * - * @private - */ - - - State.prototype._syncFilters = function _syncFilters() { - var _this4 = this; - - if (!this.persistFilters) { - return; - } - var state = this.state; - var tf = this.tf; - - Object.keys(state).forEach(function (key) { - if (key.indexOf(_this4.prfxCol) !== -1) { - var colIdx = parseInt(key.replace(_this4.prfxCol, ''), 10); - var val = state[key].flt; - tf.setFilterValue(colIdx, val); - } - }); - - tf.filter(); - }; - - /** - * Sync sorted column with stored sorting information and sort table - * - * @private - */ - - - State.prototype._syncSort = function _syncSort() { - var _this5 = this; - - if (!this.persistSort) { - return; - } - var state = this.state; - var tf = this.tf; - - Object.keys(state).forEach(function (key) { - if (key.indexOf(_this5.prfxCol) !== -1) { - var colIdx = parseInt(key.replace(_this5.prfxCol, ''), 10); - if (!(0, _types.isUndef)(state[key].sort)) { - var sort = state[key].sort; - _this5.emitter.emit('sort', tf, colIdx, sort.descending); - } - } - }); - }; - - /** - * Sync hidden columns with stored information - * - * @private - */ - - - State.prototype._syncColsVisibility = function _syncColsVisibility() { - var _this6 = this; - - if (!this.persistColsVisibility) { - return; - } - var state = this.state; - var tf = this.tf; - var hiddenCols = []; - - Object.keys(state).forEach(function (key) { - if (key.indexOf(_this6.prfxCol) !== -1) { - var colIdx = parseInt(key.replace(_this6.prfxCol, ''), 10); - if (!(0, _types.isUndef)(state[key].hidden)) { - hiddenCols.push(colIdx); - } - } - }); - - hiddenCols.forEach(function (colIdx) { - _this6.emitter.emit('hide-column', tf, colIdx); - }); - }; - - /** - * Sync filters visibility with stored information - * - * @private - */ - - - State.prototype._syncFiltersVisibility = function _syncFiltersVisibility() { - if (!this.persistFiltersVisibility) { - return; - } - var state = this.state; - var tf = this.tf; - var filtersVisibility = state[this.filtersVisKey]; - - this.filtersVisibility = filtersVisibility; - this.emitter.emit('show-filters', tf, filtersVisibility); - }; - - /** - * Destroy State instance - */ - - - State.prototype.destroy = function destroy() { - var _this7 = this; - - if (!this.initialized) { - return; - } - - this.state = {}; - - this.emitter.off(['after-filtering'], function () { - return _this7.update(); - }); - this.emitter.off(['after-page-change', 'after-clearing-filters'], function (tf, pageNb) { - return _this7.updatePage(pageNb); - }); - this.emitter.off(['after-page-length-change'], function (tf, index) { - return _this7.updatePageLength(index); - }); - this.emitter.off(['column-sorted'], function (tf, index, descending) { - return _this7.updateSort(index, descending); - }); - this.emitter.off(['sort-initialized'], function () { - return _this7._syncSort(); - }); - this.emitter.off(['columns-visibility-initialized'], function () { - return _this7._syncColsVisibility(); - }); - this.emitter.off(['column-shown', 'column-hidden'], function (tf, feature, colIndex, hiddenCols) { - return _this7.updateColsVisibility(hiddenCols); - }); - this.emitter.off(['filters-visibility-initialized'], function () { - return _this7._syncFiltersVisibility(); - }); - this.emitter.off(['filters-toggled'], function (tf, extension, visible) { - return _this7.updateFiltersVisibility(visible); - }); - - if (this.enableHash) { - this.hash.destroy(); - this.hash = null; - } - - if (this.enableStorage) { - this.storage.destroy(); - this.storage = null; - } - - this.initialized = false; - }; - - return State; - }(_feature.Feature); - -/***/ }, -/* 27 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Hash = exports.hasHashChange = undefined; - - var _event = __webpack_require__(1); - - var _root = __webpack_require__(2); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var JSON = _root.root.JSON; - var location = _root.root.location; - var decodeURIComponent = _root.root.decodeURIComponent; - var encodeURIComponent = _root.root.encodeURIComponent; - - /** - * Checks if browser has onhashchange event - */ - var hasHashChange = exports.hasHashChange = function hasHashChange() { - var docMode = _root.root.documentMode; - return 'onhashchange' in _root.root && (docMode === undefined || docMode > 7); - }; - - /** - * Manages state via URL hash changes - * - * @export - * @class Hash - */ - - var Hash = exports.Hash = function () { - - /** - * Creates an instance of Hash - * - * @param {State} state Instance of State - */ - function Hash(state) { - _classCallCheck(this, Hash); - - /** - * State object - * @type {State} - */ - this.state = state; - - /** - * Cached URL hash - * @type {String} Hash string - * @private - */ - this.lastHash = null; - - /** - * Application event emitter instance - * @type {Emitter} - */ - this.emitter = state.emitter; - - /** - * Bound sync wrapper for future use - * @private - */ - this.boundSync = null; - } - - /** - * Initializes the Hash object - */ - - - Hash.prototype.init = function init() { - var _this = this; - - if (!hasHashChange()) { - return; - } - - this.lastHash = location.hash; - //Store a bound sync wrapper - this.boundSync = this.sync.bind(this); - this.emitter.on(['state-changed'], function (tf, state) { - return _this.update(state); - }); - this.emitter.on(['initialized'], this.boundSync); - (0, _event.addEvt)(_root.root, 'hashchange', this.boundSync); - }; - - /** - * Updates the URL hash based on a state change - * - * @param {State} state Instance of State - */ - - - Hash.prototype.update = function update(state) { - var hash = '#' + encodeURIComponent(JSON.stringify(state)); - if (this.lastHash === hash) { - return; - } - - location.hash = hash; - this.lastHash = hash; - }; - - /** - * Converts a URL hash into a state JSON object - * - * @param {String} hash URL hash fragment - * @returns {Object} JSON object - */ - - - Hash.prototype.parse = function parse(hash) { - if (hash.indexOf('#') === -1) { - return null; - } - hash = hash.substr(1); - return JSON.parse(decodeURIComponent(hash)); - }; - - /** - * Applies current hash state to features - */ - - - Hash.prototype.sync = function sync() { - var state = this.parse(location.hash); - if (!state) { - return; - } - // override current state with persisted one and sync features - this.state.overrideAndSync(state); - }; - - /** - * Release Hash event subscriptions and clear fields - */ - - - Hash.prototype.destroy = function destroy() { - var _this2 = this; - - this.emitter.off(['state-changed'], function (tf, state) { - return _this2.update(state); - }); - this.emitter.off(['initialized'], this.boundSync); - (0, _event.removeEvt)(_root.root, 'hashchange', this.boundSync); - - this.state = null; - this.lastHash = null; - this.emitter = null; - }; - - return Hash; - }(); - -/***/ }, -/* 28 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Storage = exports.hasStorage = undefined; - - var _cookie = __webpack_require__(29); - - var _cookie2 = _interopRequireDefault(_cookie); - - var _root = __webpack_require__(2); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var JSON = _root.root.JSON; - var localStorage = _root.root.localStorage; - var location = _root.root.location; - - /** - * Checks if browser has Storage feature - */ - var hasStorage = exports.hasStorage = function hasStorage() { - return 'Storage' in _root.root; - }; - - /** - * Stores the features state in browser's local storage or cookie - * - * @export - * @class Storage - */ - - var Storage = exports.Storage = function () { - - /** - * Creates an instance of Storage - * - * @param {State} state Instance of State - */ - function Storage(state) { - _classCallCheck(this, Storage); - - /** - * State object - * @type {State} - * @private - */ - this.state = state; - - /** - * TableFilter object - * @type {TableFilter} - * @private - */ - this.tf = state.tf; - - /** - * Persist with local storage - * @type {Boolean} - * @private - */ - this.enableLocalStorage = state.enableLocalStorage && hasStorage(); - - /** - * Persist with cookie - * @type {Boolean} - * @private - */ - this.enableCookie = state.enableCookie && !this.enableLocalStorage; - - /** - * Emitter object - * @type {Emitter} - * @private - */ - this.emitter = state.emitter; - - /** - * Cookie duration in hours from state object - * @type {Number} - * @private - */ - this.duration = state.cookieDuration; - } - - /** - * Initializes the Storage object - */ - - - Storage.prototype.init = function init() { - var _this = this; - - this.emitter.on(['state-changed'], function (tf, state) { - return _this.save(state); - }); - this.emitter.on(['initialized'], function () { - return _this.sync(); - }); - }; - - /** - * Persists the features state on state changes - * - * @param {State} state Instance of State - */ - - - Storage.prototype.save = function save(state) { - if (this.enableLocalStorage) { - localStorage[this.getKey()] = JSON.stringify(state); - } else { - _cookie2.default.write(this.getKey(), JSON.stringify(state), this.duration); - } - }; - - /** - * Turns stored string into a State JSON object - * - * @returns {Object} JSON object - */ - - - Storage.prototype.retrieve = function retrieve() { - var state = null; - if (this.enableLocalStorage) { - state = localStorage[this.getKey()]; - } else { - state = _cookie2.default.read(this.getKey()); - } - - if (!state) { - return null; - } - return JSON.parse(state); - }; - - /** - * Removes persisted state from storage - */ - - - Storage.prototype.remove = function remove() { - if (this.enableLocalStorage) { - localStorage.removeItem(this.getKey()); - } else { - _cookie2.default.remove(this.getKey()); - } - }; - - /** - * Applies persisted state to features - */ - - - Storage.prototype.sync = function sync() { - var state = this.retrieve(); - if (!state) { - return; - } - // override current state with persisted one and sync features - this.state.overrideAndSync(state); - }; - - /** - * Returns the storage key - * - * @returns {String} Key - */ - - - Storage.prototype.getKey = function getKey() { - return JSON.stringify({ - key: this.tf.prfxTf + '_' + this.tf.id, - path: location.pathname - }); - }; - - /** - * Release Storage event subscriptions and clear fields - */ - - - Storage.prototype.destroy = function destroy() { - var _this2 = this; - - this.emitter.off(['state-changed'], function (tf, state) { - return _this2.save(state); - }); - this.emitter.off(['initialized'], function () { - return _this2.sync(); - }); - - this.remove(); - - this.state = null; - this.emitter = null; - }; - - return Storage; - }(); - -/***/ }, -/* 29 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _root = __webpack_require__(2); - - /** - * Cookie utilities - */ - - var doc = _root.root.document; - - exports.default = { - - /** - * Write a cookie - * @param {String} name Name of the cookie - * @param {String} value Value of the cookie - * @param {Number} hours Cookie duration in hours - */ - write: function write(name, value, hours) { - var expire = ''; - if (hours) { - expire = new Date(new Date().getTime() + hours * 3600000); - expire = '; expires=' + expire.toGMTString(); - } - doc.cookie = name + '=' + escape(value) + expire; - }, - - - /** - * Read a cookie - * @param {String} name Name of the cookie - * @returns {String} Value of the cookie - */ - read: function read(name) { - var cookieValue = '', - search = name + '='; - if (doc.cookie.length > 0) { - var cookie = doc.cookie, - offset = cookie.indexOf(search); - if (offset !== -1) { - offset += search.length; - var end = cookie.indexOf(';', offset); - if (end === -1) { - end = cookie.length; - } - cookieValue = unescape(cookie.substring(offset, end)); - } - } - return cookieValue; - }, - - - /** - * Remove a cookie - * @param {String} name Name of the cookie - */ - remove: function remove(name) { - this.write(name, '', -1); - } - }; - -/***/ }, -/* 30 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.DateType = undefined; - - var _sugarDate = __webpack_require__(31); - - __webpack_require__(417); - - var _feature = __webpack_require__(10); - - var _types = __webpack_require__(4); - - var _const = __webpack_require__(11); - - var _root = __webpack_require__(2); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Wrapper for Sugar Date module providing datetime helpers and locales - * @export - * @class DateType - */ - var DateType = exports.DateType = function (_Feature) { - _inherits(DateType, _Feature); - - /** - * Creates an instance of DateType - * @param {TableFilter} tf TableFilter instance - */ - function DateType(tf) { - _classCallCheck(this, DateType); - - /** - * Global locale - * @type {String} - */ - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'dateType')); - - _this.locale = tf.locale; - - /** - * Sugar Date instance - * @type {Object} - */ - _this.datetime = _sugarDate.Date; - - _this.enable(); - return _this; - } - - /** - * Initialize DateType instance - */ - - - DateType.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - // Set global locale - this.datetime.setLocale(this.locale); - - // Add formats from column types configuration if any - this.addConfigFormats(this.tf.colTypes); - - this.emitter.on(['add-date-type-formats'], function (tf, types) { - return _this2.addConfigFormats(types); - }); - - // Broadcast date-type initialization - this.emitter.emit('date-type-initialized', this.tf, this); - - /** @inherited */ - this.initialized = true; - }; - - /** - * Parse a string representation of a date for a specified locale and return - * a date object - * @param {String} dateStr String representation of a date - * @param {String} localeCode Locale code (ie 'en-us') - * @returns {Date} - */ - - - DateType.prototype.parse = function parse(dateStr, localeCode) { - return this.datetime.create(dateStr, localeCode); - }; - - /** - * Check string representation of a date for a specified locale is valid - * @param {any} dateStr String representation of a date - * @param {any} localeCode Locale code (ie 'en-us') - * @returns {Boolean} - */ - - - DateType.prototype.isValid = function isValid(dateStr, localeCode) { - return this.datetime.isValid(this.parse(dateStr, localeCode)); - }; - - /** - * Return the type object of a specified column as per configuration or - * passed collection - * @param {Number} colIndex Column index - * @param {Array} types Collection of column types, optional - * @returns {Object} - */ - - - DateType.prototype.getOptions = function getOptions(colIndex, types) { - types = types || this.tf.colTypes; - var colType = types[colIndex]; - return (0, _types.isObj)(colType) ? colType : {}; - }; - - /** - * Add date time format(s) to a locale as specified by the passed - * collection of column types, ie: - * [ - * 'string', - * 'number', - * { type: 'date', locale: 'en', format: ['{dd}/{MM}/{yyyy}']} - * ] - * - * @param {Array} [types=[]] Collection of column types - */ - - - DateType.prototype.addConfigFormats = function addConfigFormats() { - var _this3 = this; - - var types = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - - types.forEach(function (type, idx) { - var options = _this3.getOptions(idx, types); - if (options.type === _const.DATE && options.hasOwnProperty('format')) { - (function () { - var locale = _this3.datetime.getLocale(options.locale || _this3.locale); - var formats = (0, _types.isArray)(options.format) ? options.format : [options.format]; - - // Sugar date module throws exceptions with locale.addFormat - try { - formats.forEach(function (format) { - locale.addFormat(format); - }); - } catch (ex) { - _root.root.console.error(ex); - } - })(); - } - }); - }; - - /** - * Remove DateType instance - */ - - - DateType.prototype.destroy = function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - // TODO: remove added formats - - this.emitter.off(['add-date-type-formats'], function (tf, types) { - return _this4.addConfigFormats(types); - }); - - this.initialized = false; - }; - - return DateType; - }(_feature.Feature); - -/***/ }, -/* 31 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(32); - __webpack_require__(370); - - module.exports = __webpack_require__(34); - -/***/ }, -/* 32 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - // Static Methods - __webpack_require__(33); - __webpack_require__(93); - __webpack_require__(139); - __webpack_require__(141); - __webpack_require__(142); - __webpack_require__(143); - __webpack_require__(144); - - // Instance Methods - __webpack_require__(145); - __webpack_require__(152); - __webpack_require__(153); - __webpack_require__(154); - __webpack_require__(155); - __webpack_require__(156); - __webpack_require__(157); - __webpack_require__(158); - __webpack_require__(159); - __webpack_require__(160); - __webpack_require__(161); - __webpack_require__(162); - __webpack_require__(163); - __webpack_require__(164); - __webpack_require__(165); - __webpack_require__(166); - __webpack_require__(167); - __webpack_require__(168); - __webpack_require__(169); - __webpack_require__(170); - __webpack_require__(171); - __webpack_require__(172); - __webpack_require__(173); - __webpack_require__(174); - __webpack_require__(175); - __webpack_require__(176); - __webpack_require__(177); - __webpack_require__(178); - __webpack_require__(179); - __webpack_require__(180); - __webpack_require__(181); - __webpack_require__(182); - __webpack_require__(183); - __webpack_require__(184); - __webpack_require__(185); - __webpack_require__(186); - __webpack_require__(187); - __webpack_require__(188); - __webpack_require__(189); - __webpack_require__(190); - __webpack_require__(191); - __webpack_require__(192); - __webpack_require__(193); - __webpack_require__(194); - __webpack_require__(195); - __webpack_require__(196); - __webpack_require__(197); - __webpack_require__(198); - __webpack_require__(199); - __webpack_require__(200); - __webpack_require__(201); - __webpack_require__(202); - __webpack_require__(203); - __webpack_require__(204); - __webpack_require__(205); - __webpack_require__(206); - __webpack_require__(207); - __webpack_require__(208); - __webpack_require__(209); - __webpack_require__(210); - __webpack_require__(211); - __webpack_require__(212); - __webpack_require__(213); - __webpack_require__(214); - __webpack_require__(215); - __webpack_require__(216); - __webpack_require__(217); - __webpack_require__(218); - __webpack_require__(219); - __webpack_require__(220); - __webpack_require__(221); - __webpack_require__(222); - __webpack_require__(223); - __webpack_require__(224); - __webpack_require__(225); - __webpack_require__(226); - __webpack_require__(227); - __webpack_require__(228); - __webpack_require__(229); - __webpack_require__(230); - __webpack_require__(231); - __webpack_require__(232); - __webpack_require__(240); - __webpack_require__(241); - __webpack_require__(242); - __webpack_require__(243); - __webpack_require__(244); - __webpack_require__(245); - __webpack_require__(246); - __webpack_require__(247); - __webpack_require__(252); - __webpack_require__(253); - __webpack_require__(254); - __webpack_require__(255); - __webpack_require__(256); - __webpack_require__(257); - __webpack_require__(258); - __webpack_require__(259); - __webpack_require__(260); - __webpack_require__(261); - __webpack_require__(262); - __webpack_require__(263); - __webpack_require__(264); - __webpack_require__(265); - __webpack_require__(266); - __webpack_require__(267); - __webpack_require__(268); - __webpack_require__(287); - __webpack_require__(288); - __webpack_require__(289); - __webpack_require__(290); - __webpack_require__(291); - __webpack_require__(292); - __webpack_require__(293); - __webpack_require__(294); - __webpack_require__(295); - __webpack_require__(296); - __webpack_require__(300); - __webpack_require__(301); - __webpack_require__(302); - __webpack_require__(303); - __webpack_require__(306); - __webpack_require__(307); - __webpack_require__(308); - __webpack_require__(309); - __webpack_require__(310); - __webpack_require__(311); - __webpack_require__(312); - __webpack_require__(313); - __webpack_require__(314); - __webpack_require__(315); - __webpack_require__(316); - __webpack_require__(317); - __webpack_require__(318); - __webpack_require__(319); - __webpack_require__(320); - __webpack_require__(321); - __webpack_require__(322); - __webpack_require__(323); - __webpack_require__(324); - __webpack_require__(325); - __webpack_require__(327); - __webpack_require__(328); - __webpack_require__(329); - __webpack_require__(330); - __webpack_require__(331); - __webpack_require__(332); - __webpack_require__(333); - __webpack_require__(334); - __webpack_require__(335); - __webpack_require__(336); - __webpack_require__(337); - __webpack_require__(338); - __webpack_require__(339); - __webpack_require__(340); - __webpack_require__(341); - __webpack_require__(342); - __webpack_require__(343); - __webpack_require__(344); - __webpack_require__(345); - __webpack_require__(348); - __webpack_require__(349); - __webpack_require__(351); - __webpack_require__(352); - __webpack_require__(353); - __webpack_require__(354); - __webpack_require__(355); - __webpack_require__(356); - __webpack_require__(357); - __webpack_require__(358); - __webpack_require__(359); - __webpack_require__(360); - __webpack_require__(361); - __webpack_require__(362); - __webpack_require__(363); - __webpack_require__(364); - __webpack_require__(365); - __webpack_require__(366); - __webpack_require__(367); - - // Accessors - __webpack_require__(368); - __webpack_require__(369); - - module.exports = __webpack_require__(34); - -/***/ }, -/* 33 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - LocaleHelpers = __webpack_require__(35); - - var localeManager = LocaleHelpers.localeManager; - - Sugar.Date.defineStatic({ - - 'addLocale': function(code, set) { - return localeManager.add(code, set); - } - - }); - - module.exports = Sugar.Date.addLocale; - -/***/ }, -/* 34 */ -/***/ function(module, exports) { - - /* WEBPACK VAR INJECTION */(function(global) {/* - * Sugar v2.0.0 - * - * Freely distributable and licensed under the MIT-style license. - * Copyright (c) Andrew Plummer - * https://sugarjs.com/ - * - * ---------------------------- */ - (function() { - 'use strict'; - - /*** - * @module Core - * @description Core functionality including the ability to define methods and - * extend onto natives. - * - ***/ - - // The global to export. - var Sugar; - - // The name of Sugar in the global namespace. - var SUGAR_GLOBAL = 'Sugar'; - - // Natives available on initialization. Letting Object go first to ensure its - // global is set by the time the rest are checking for chainable Object methods. - var NATIVE_NAMES = 'Object Number String Array Date RegExp Function'; - - // Static method flag - var STATIC = 0x1; - - // Instance method flag - var INSTANCE = 0x2; - - // IE8 has a broken defineProperty but no defineProperties so this saves a try/catch. - var PROPERTY_DESCRIPTOR_SUPPORT = !!(Object.defineProperty && Object.defineProperties); - - // The global context. Rhino uses a different "global" keyword so - // do an extra check to be sure that it's actually the global context. - var globalContext = typeof global !== 'undefined' && global.Object === Object ? global : this; - - // Is the environment node? - var hasExports = typeof module !== 'undefined' && module.exports; - - // Whether object instance methods can be mapped to the prototype. - var allowObjectPrototype = false; - - // A map from Array to SugarArray. - var namespacesByName = {}; - - // A map from [object Object] to namespace. - var namespacesByClassString = {}; - - // Defining properties. - var defineProperty = PROPERTY_DESCRIPTOR_SUPPORT ? Object.defineProperty : definePropertyShim; - - // A default chainable class for unknown types. - var DefaultChainable = getNewChainableClass('Chainable'); - - - // Global methods - - function setupGlobal() { - Sugar = globalContext[SUGAR_GLOBAL]; - if (Sugar) { - // Reuse already defined Sugar global object. - return; - } - Sugar = function(arg) { - forEachProperty(Sugar, function(sugarNamespace, name) { - // Although only the only enumerable properties on the global - // object are Sugar namespaces, environments that can't set - // non-enumerable properties will step through the utility methods - // as well here, so use this check to only allow true namespaces. - if (hasOwn(namespacesByName, name)) { - sugarNamespace.extend(arg); - } - }); - return Sugar; - }; - if (hasExports) { - module.exports = Sugar; - } else { - try { - globalContext[SUGAR_GLOBAL] = Sugar; - } catch (e) { - // Contexts such as QML have a read-only global context. - } - } - forEachProperty(NATIVE_NAMES.split(' '), function(name) { - createNamespace(name); - }); - setGlobalProperties(); - } - - /*** - * @method createNamespace() - * @returns Namespace - * @global - * @short Creates a new Sugar namespace. - * @extra This method is for plugin developers who want to define methods to be - * used with natives that Sugar does not handle by default. The new - * namespace will appear on the `Sugar` global with all the methods of - * normal namespaces, including the ability to define new methods. When - * extended, any defined methods will be mapped to `name` in the global - * context. - * - * @example - * - * Sugar.createNamespace('Boolean'); - * - ***/ - function createNamespace(name) { - - // Is the current namespace Object? - var isObject = name === 'Object'; - - // A Sugar namespace is also a chainable class: Sugar.Array, etc. - var sugarNamespace = getNewChainableClass(name, true); - - /*** - * @method extend([options]) - * @returns Sugar - * @global - * @namespace - * @short Extends Sugar defined methods onto natives. - * @extra This method can be called on individual namespaces like - * `Sugar.Array` or on the `Sugar` global itself, in which case - * [options] will be forwarded to each `extend` call. For more, - * see `extending`. - * - * @options - * - * methods An array of method names to explicitly extend. - * - * except An array of method names or global namespaces (`Array`, - * `String`) to explicitly exclude. Namespaces should be the - * actual global objects, not strings. - * - * namespaces An array of global namespaces (`Array`, `String`) to - * explicitly extend. Namespaces should be the actual - * global objects, not strings. - * - * enhance A shortcut to disallow all "enhance" flags at once - * (flags listed below). For more, see `enhanced methods`. - * Default is `true`. - * - * enhanceString A boolean allowing String enhancements. Default is `true`. - * - * enhanceArray A boolean allowing Array enhancements. Default is `true`. - * - * objectPrototype A boolean allowing Sugar to extend Object.prototype - * with instance methods. This option is off by default - * and should generally not be used except with caution. - * For more, see `object methods`. - * - * @example - * - * Sugar.Array.extend(); - * Sugar.extend(); - * - ***/ - var extend = function (opts) { - - var nativeClass = globalContext[name], nativeProto = nativeClass.prototype; - var staticMethods = {}, instanceMethods = {}, methodsByName; - - function objectRestricted(name, target) { - return isObject && target === nativeProto && - (!allowObjectPrototype || name === 'get' || name === 'set'); - } - - function arrayOptionExists(field, val) { - var arr = opts[field]; - if (arr) { - for (var i = 0, el; el = arr[i]; i++) { - if (el === val) { - return true; - } - } - } - return false; - } - - function arrayOptionExcludes(field, val) { - return opts[field] && !arrayOptionExists(field, val); - } - - function disallowedByFlags(methodName, target, flags) { - // Disallowing methods by flag currently only applies if methods already - // exist to avoid enhancing native methods, as aliases should still be - // extended (i.e. Array#all should still be extended even if Array#every - // is being disallowed by a flag). - if (!target[methodName] || !flags) { - return false; - } - for (var i = 0; i < flags.length; i++) { - if (opts[flags[i]] === false) { - return true; - } - } - } - - function namespaceIsExcepted() { - return arrayOptionExists('except', nativeClass) || - arrayOptionExcludes('namespaces', nativeClass); - } - - function methodIsExcepted(methodName) { - return arrayOptionExists('except', methodName); - } - - function canExtend(methodName, method, target) { - return !objectRestricted(methodName, target) && - !disallowedByFlags(methodName, target, method.flags) && - !methodIsExcepted(methodName); - } - - opts = opts || {}; - methodsByName = opts.methods; - - if (namespaceIsExcepted()) { - return; - } else if (isObject && typeof opts.objectPrototype === 'boolean') { - // Store "objectPrototype" flag for future reference. - allowObjectPrototype = opts.objectPrototype; - } - - forEachProperty(methodsByName || sugarNamespace, function(method, methodName) { - if (methodsByName) { - // If we have method names passed in an array, - // then we need to flip the key and value here - // and find the method in the Sugar namespace. - methodName = method; - method = sugarNamespace[methodName]; - } - if (hasOwn(method, 'instance') && canExtend(methodName, method, nativeProto)) { - instanceMethods[methodName] = method.instance; - } - if(hasOwn(method, 'static') && canExtend(methodName, method, nativeClass)) { - staticMethods[methodName] = method; - } - }); - - // Accessing the extend target each time instead of holding a reference as - // it may have been overwritten (for example Date by Sinon). Also need to - // access through the global to allow extension of user-defined namespaces. - extendNative(nativeClass, staticMethods); - extendNative(nativeProto, instanceMethods); - - if (!methodsByName) { - // If there are no method names passed, then - // all methods in the namespace will be extended - // to the native. This includes all future defined - // methods, so add a flag here to check later. - setProperty(sugarNamespace, 'active', true); - } - return Sugar; - }; - - function defineWithOptionCollect(methodName, instance, args) { - setProperty(sugarNamespace, methodName, function(arg1, arg2, arg3) { - var opts = collectDefineOptions(arg1, arg2, arg3); - defineMethods(sugarNamespace, opts.methods, instance, args, opts.last); - return sugarNamespace; - }); - } - - /*** - * @method defineStatic(...) - * @returns Namespace - * @namespace - * @short Defines static methods on the namespace that can later be extended - * onto the native globals. - * @extra Accepts either a single object mapping names to functions, or name - * and function as two arguments. If `extend` was previously called - * with no arguments, the method will be immediately mapped to its - * native when defined. - * - * @example - * - * Sugar.Number.defineStatic({ - * isOdd: function (num) { - * return num % 2 === 1; - * } - * }); - * - ***/ - defineWithOptionCollect('defineStatic', STATIC); - - /*** - * @method defineInstance(...) - * @returns Namespace - * @namespace - * @short Defines methods on the namespace that can later be extended as - * instance methods onto the native prototype. - * @extra Accepts either a single object mapping names to functions, or name - * and function as two arguments. All functions should accept the - * native for which they are mapped as their first argument, and should - * never refer to `this`. If `extend` was previously called with no - * arguments, the method will be immediately mapped to its native when - * defined. - * - * Methods cannot accept more than 4 arguments in addition to the - * native (5 arguments total). Any additional arguments will not be - * mapped. If the method needs to accept unlimited arguments, use - * `defineInstanceWithArguments`. Otherwise if more options are - * required, use an options object instead. - * - * @example - * - * Sugar.Number.defineInstance({ - * square: function (num) { - * return num * num; - * } - * }); - * - ***/ - defineWithOptionCollect('defineInstance', INSTANCE); - - /*** - * @method defineInstanceAndStatic(...) - * @returns Namespace - * @namespace - * @short A shortcut to define both static and instance methods on the namespace. - * @extra This method is intended for use with `Object` instance methods. Sugar - * will not map any methods to `Object.prototype` by default, so defining - * instance methods as static helps facilitate their proper use. - * - * @example - * - * Sugar.Object.defineInstanceAndStatic({ - * isAwesome: function (obj) { - * // check if obj is awesome! - * } - * }); - * - ***/ - defineWithOptionCollect('defineInstanceAndStatic', INSTANCE | STATIC); - - - /*** - * @method defineStaticWithArguments(...) - * @returns Namespace - * @namespace - * @short Defines static methods that collect arguments. - * @extra This method is identical to `defineStatic`, except that when defined - * methods are called, they will collect any arguments past `n - 1`, - * where `n` is the number of arguments that the method accepts. - * Collected arguments will be passed to the method in an array - * as the last argument defined on the function. - * - * @example - * - * Sugar.Number.defineStaticWithArguments({ - * addAll: function (num, args) { - * for (var i = 0; i < args.length; i++) { - * num += args[i]; - * } - * return num; - * } - * }); - * - ***/ - defineWithOptionCollect('defineStaticWithArguments', STATIC, true); - - /*** - * @method defineInstanceWithArguments(...) - * @returns Namespace - * @namespace - * @short Defines instance methods that collect arguments. - * @extra This method is identical to `defineInstance`, except that when - * defined methods are called, they will collect any arguments past - * `n - 1`, where `n` is the number of arguments that the method - * accepts. Collected arguments will be passed to the method as the - * last argument defined on the function. - * - * @example - * - * Sugar.Number.defineInstanceWithArguments({ - * addAll: function (num, args) { - * for (var i = 0; i < args.length; i++) { - * num += args[i]; - * } - * return num; - * } - * }); - * - ***/ - defineWithOptionCollect('defineInstanceWithArguments', INSTANCE, true); - - /*** - * @method defineStaticPolyfill(...) - * @returns Namespace - * @namespace - * @short Defines static methods that are mapped onto the native if they do - * not already exist. - * @extra Intended only for use creating polyfills that follow the ECMAScript - * spec. Accepts either a single object mapping names to functions, or - * name and function as two arguments. - * - * @example - * - * Sugar.Object.defineStaticPolyfill({ - * keys: function (obj) { - * // get keys! - * } - * }); - * - ***/ - setProperty(sugarNamespace, 'defineStaticPolyfill', function(arg1, arg2, arg3) { - var opts = collectDefineOptions(arg1, arg2, arg3); - extendNative(globalContext[name], opts.methods, true, opts.last); - }); - - /*** - * @method defineInstancePolyfill(...) - * @returns Namespace - * @namespace - * @short Defines instance methods that are mapped onto the native prototype - * if they do not already exist. - * @extra Intended only for use creating polyfills that follow the ECMAScript - * spec. Accepts either a single object mapping names to functions, or - * name and function as two arguments. This method differs from - * `defineInstance` as there is no static signature (as the method - * is mapped as-is to the native), so it should refer to its `this` - * object. - * - * @example - * - * Sugar.Array.defineInstancePolyfill({ - * indexOf: function (arr, el) { - * // index finding code here! - * } - * }); - * - ***/ - setProperty(sugarNamespace, 'defineInstancePolyfill', function(arg1, arg2, arg3) { - var opts = collectDefineOptions(arg1, arg2, arg3); - extendNative(globalContext[name].prototype, opts.methods, true, opts.last); - // Map instance polyfills to chainable as well. - forEachProperty(opts.methods, function(fn, methodName) { - defineChainableMethod(sugarNamespace, methodName, fn); - }); - }); - - /*** - * @method alias(, ) - * @returns Namespace - * @namespace - * @short Aliases one Sugar method to another. - * - * @example - * - * Sugar.Array.alias('all', 'every'); - * - ***/ - setProperty(sugarNamespace, 'alias', function(name, source) { - var method = typeof source === 'string' ? sugarNamespace[source] : source; - setMethod(sugarNamespace, name, method); - }); - - // Each namespace can extend only itself through its .extend method. - setProperty(sugarNamespace, 'extend', extend); - - // Cache the class to namespace relationship for later use. - namespacesByName[name] = sugarNamespace; - namespacesByClassString['[object ' + name + ']'] = sugarNamespace; - - mapNativeToChainable(name); - mapObjectChainablesToNamespace(sugarNamespace); - - - // Export - return Sugar[name] = sugarNamespace; - } - - function setGlobalProperties() { - setProperty(Sugar, 'extend', Sugar); - setProperty(Sugar, 'toString', toString); - setProperty(Sugar, 'createNamespace', createNamespace); - - setProperty(Sugar, 'util', { - 'hasOwn': hasOwn, - 'getOwn': getOwn, - 'setProperty': setProperty, - 'classToString': classToString, - 'defineProperty': defineProperty, - 'forEachProperty': forEachProperty, - 'mapNativeToChainable': mapNativeToChainable - }); - } - - function toString() { - return SUGAR_GLOBAL; - } - - - // Defining Methods - - function defineMethods(sugarNamespace, methods, type, args, flags) { - forEachProperty(methods, function(method, methodName) { - var instanceMethod, staticMethod = method; - if (args) { - staticMethod = wrapMethodWithArguments(method); - } - if (flags) { - staticMethod.flags = flags; - } - - // A method may define its own custom implementation, so - // make sure that's not the case before creating one. - if (type & INSTANCE && !method.instance) { - instanceMethod = wrapInstanceMethod(method, args); - setProperty(staticMethod, 'instance', instanceMethod); - } - - if (type & STATIC) { - setProperty(staticMethod, 'static', true); - } - - setMethod(sugarNamespace, methodName, staticMethod); - - if (sugarNamespace.active) { - // If the namespace has been activated (.extend has been called), - // then map this method as well. - sugarNamespace.extend(methodName); - } - }); - } - - function collectDefineOptions(arg1, arg2, arg3) { - var methods, last; - if (typeof arg1 === 'string') { - methods = {}; - methods[arg1] = arg2; - last = arg3; - } else { - methods = arg1; - last = arg2; - } - return { - last: last, - methods: methods - }; - } - - function wrapInstanceMethod(fn, args) { - return args ? wrapMethodWithArguments(fn, true) : wrapInstanceMethodFixed(fn); - } - - function wrapMethodWithArguments(fn, instance) { - // Functions accepting enumerated arguments will always have "args" as the - // last argument, so subtract one from the function length to get the point - // at which to start collecting arguments. If this is an instance method on - // a prototype, then "this" will be pushed into the arguments array so start - // collecting 1 argument earlier. - var startCollect = fn.length - 1 - (instance ? 1 : 0); - return function() { - var args = [], collectedArgs = [], len; - if (instance) { - args.push(this); - } - len = Math.max(arguments.length, startCollect); - // Optimized: no leaking arguments - for (var i = 0; i < len; i++) { - if (i < startCollect) { - args.push(arguments[i]); - } else { - collectedArgs.push(arguments[i]); - } - } - args.push(collectedArgs); - return fn.apply(this, args); - }; - } - - function wrapInstanceMethodFixed(fn) { - switch(fn.length) { - // Wrapped instance methods will always be passed the instance - // as the first argument, but requiring the argument to be defined - // may cause confusion here, so return the same wrapped function regardless. - case 0: - case 1: - return function() { - return fn(this); - }; - case 2: - return function(a) { - return fn(this, a); - }; - case 3: - return function(a, b) { - return fn(this, a, b); - }; - case 4: - return function(a, b, c) { - return fn(this, a, b, c); - }; - case 5: - return function(a, b, c, d) { - return fn(this, a, b, c, d); - }; - } - } - - // Method helpers - - function extendNative(target, source, polyfill, override) { - forEachProperty(source, function(method, name) { - if (polyfill && !override && target[name]) { - // Method exists, so bail. - return; - } - setProperty(target, name, method); - }); - } - - function setMethod(sugarNamespace, methodName, method) { - sugarNamespace[methodName] = method; - if (method.instance) { - defineChainableMethod(sugarNamespace, methodName, method.instance, true); - } - } - - - // Chainables - - function getNewChainableClass(name) { - var fn = function SugarChainable(obj, arg) { - if (!(this instanceof fn)) { - return new fn(obj, arg); - } - if (this.constructor !== fn) { - // Allow modules to define their own constructors. - obj = this.constructor.apply(obj, arguments); - } - this.raw = obj; - }; - setProperty(fn, 'toString', function() { - return SUGAR_GLOBAL + name; - }); - setProperty(fn.prototype, 'valueOf', function() { - return this.raw; - }); - return fn; - } - - function defineChainableMethod(sugarNamespace, methodName, fn) { - var wrapped = wrapWithChainableResult(fn), existing, collision, dcp; - dcp = DefaultChainable.prototype; - existing = dcp[methodName]; - - // If the method was previously defined on the default chainable, then a - // collision exists, so set the method to a disambiguation function that will - // lazily evaluate the object and find it's associated chainable. An extra - // check is required to avoid false positives from Object inherited methods. - collision = existing && existing !== Object.prototype[methodName]; - - // The disambiguation function is only required once. - if (!existing || !existing.disambiguate) { - dcp[methodName] = collision ? disambiguateMethod(methodName) : wrapped; - } - - // The target chainable always receives the wrapped method. Additionally, - // if the target chainable is Sugar.Object, then map the wrapped method - // to all other namespaces as well if they do not define their own method - // of the same name. This way, a Sugar.Number will have methods like - // isEqual that can be called on any object without having to traverse up - // the prototype chain and perform disambiguation, which costs cycles. - // Note that the "if" block below actually does nothing on init as Object - // goes first and no other namespaces exist yet. However it needs to be - // here as Object instance methods defined later also need to be mapped - // back onto existing namespaces. - sugarNamespace.prototype[methodName] = wrapped; - if (sugarNamespace === Sugar.Object) { - mapObjectChainableToAllNamespaces(methodName, wrapped); - } - } - - function mapObjectChainablesToNamespace(sugarNamespace) { - forEachProperty(Sugar.Object && Sugar.Object.prototype, function(val, methodName) { - if (typeof val === 'function') { - setObjectChainableOnNamespace(sugarNamespace, methodName, val); - } - }); - } - - function mapObjectChainableToAllNamespaces(methodName, fn) { - forEachProperty(namespacesByName, function(sugarNamespace) { - setObjectChainableOnNamespace(sugarNamespace, methodName, fn); - }); - } - - function setObjectChainableOnNamespace(sugarNamespace, methodName, fn) { - var proto = sugarNamespace.prototype; - if (!hasOwn(proto, methodName)) { - proto[methodName] = fn; - } - } - - function wrapWithChainableResult(fn) { - return function() { - return new DefaultChainable(fn.apply(this.raw, arguments)); - }; - } - - function disambiguateMethod(methodName) { - var fn = function() { - var raw = this.raw, sugarNamespace, fn; - if (raw != null) { - // Find the Sugar namespace for this unknown. - sugarNamespace = namespacesByClassString[classToString(raw)]; - } - if (!sugarNamespace) { - // If no sugarNamespace can be resolved, then default - // back to Sugar.Object so that undefined and other - // non-supported types can still have basic object - // methods called on them, such as type checks. - sugarNamespace = Sugar.Object; - } - - fn = new sugarNamespace(raw)[methodName]; - - if (fn.disambiguate) { - // If the method about to be called on this chainable is - // itself a disambiguation method, then throw an error to - // prevent infinite recursion. - throw new TypeError('Cannot resolve namespace for ' + raw); - } - - return fn.apply(this, arguments); - }; - fn.disambiguate = true; - return fn; - } - - function mapNativeToChainable(name, methodNames) { - var sugarNamespace = namespacesByName[name], - nativeProto = globalContext[name].prototype; - - if (!methodNames && ownPropertyNames) { - methodNames = ownPropertyNames(nativeProto); - } - - forEachProperty(methodNames, function(methodName) { - if (nativeMethodProhibited(methodName)) { - // Sugar chainables have their own constructors as well as "valueOf" - // methods, so exclude them here. The __proto__ argument should be trapped - // by the function check below, however simply accessing this property on - // Object.prototype causes QML to segfault, so pre-emptively excluding it. - return; - } - try { - var fn = nativeProto[methodName]; - if (typeof fn !== 'function') { - // Bail on anything not a function. - return; - } - } catch (e) { - // Function.prototype has properties that - // will throw errors when accessed. - return; - } - defineChainableMethod(sugarNamespace, methodName, fn); - }); - } - - function nativeMethodProhibited(methodName) { - return methodName === 'constructor' || - methodName === 'valueOf' || - methodName === '__proto__'; - } - - - // Util - - // Internal references - var ownPropertyNames = Object.getOwnPropertyNames, - internalToString = Object.prototype.toString, - internalHasOwnProperty = Object.prototype.hasOwnProperty; - - // Defining this as a variable here as the ES5 module - // overwrites it to patch DONTENUM. - var forEachProperty = function (obj, fn) { - for(var key in obj) { - if (!hasOwn(obj, key)) continue; - if (fn.call(obj, obj[key], key, obj) === false) break; - } - }; - - function definePropertyShim(obj, prop, descriptor) { - obj[prop] = descriptor.value; - } - - function setProperty(target, name, value, enumerable) { - defineProperty(target, name, { - value: value, - enumerable: !!enumerable, - configurable: true, - writable: true - }); - } - - // PERF: Attempts to speed this method up get very Heisenbergy. Quickly - // returning based on typeof works for primitives, but slows down object - // types. Even === checks on null and undefined (no typeof) will end up - // basically breaking even. This seems to be as fast as it can go. - function classToString(obj) { - return internalToString.call(obj); - } - - function hasOwn(obj, prop) { - return !!obj && internalHasOwnProperty.call(obj, prop); - } - - function getOwn(obj, prop) { - if (hasOwn(obj, prop)) { - return obj[prop]; - } - } - - setupGlobal(); - - }).call(this); - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 35 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LazyLoadedLocales = __webpack_require__(36), - AmericanEnglishDefinition = __webpack_require__(43), - getNewLocale = __webpack_require__(45); - - var English, localeManager; - - function buildLocales() { - - function LocaleManager(loc) { - this.locales = {}; - this.add(loc); - } - - LocaleManager.prototype = { - - get: function(code, fallback) { - var loc = this.locales[code]; - if (!loc && LazyLoadedLocales[code]) { - loc = this.add(code, LazyLoadedLocales[code]); - } else if (!loc && code) { - loc = this.locales[code.slice(0, 2)]; - } - return loc || fallback === false ? loc : this.current; - }, - - getAll: function() { - return this.locales; - }, - - set: function(code) { - var loc = this.get(code, false); - if (!loc) { - throw new TypeError('Invalid Locale: ' + code); - } - return this.current = loc; - }, - - add: function(code, def) { - if (!def) { - def = code; - code = def.code; - } else { - def.code = code; - } - var loc = def.compiledFormats ? def : getNewLocale(def); - this.locales[code] = loc; - if (!this.current) { - this.current = loc; - } - return loc; - }, - - remove: function(code) { - if (this.current.code === code) { - this.current = this.get('en'); - } - return delete this.locales[code]; - } - - }; - - // Sorry about this guys... - English = getNewLocale(AmericanEnglishDefinition); - localeManager = new LocaleManager(English); - } - - buildLocales(); - - module.exports = { - English: English, - localeManager: localeManager - }; - -/***/ }, -/* 36 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var BritishEnglishDefinition = __webpack_require__(37), - AmericanEnglishDefinition = __webpack_require__(43), - CanadianEnglishDefinition = __webpack_require__(44); - - var LazyLoadedLocales = { - 'en-US': AmericanEnglishDefinition, - 'en-GB': BritishEnglishDefinition, - 'en-AU': BritishEnglishDefinition, - 'en-CA': CanadianEnglishDefinition - }; - - module.exports = LazyLoadedLocales; - -/***/ }, -/* 37 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getEnglishVariant = __webpack_require__(38); - - var BritishEnglishDefinition = getEnglishVariant({ - 'short': '{dd}/{MM}/{yyyy}', - 'medium': '{d} {Month} {yyyy}', - 'long': '{d} {Month} {yyyy} {H}:{mm}', - 'full': '{Weekday}, {d} {Month}, {yyyy} {time}', - 'stamp': '{Dow} {d} {Mon} {yyyy} {time}' - }); - - module.exports = BritishEnglishDefinition; - -/***/ }, -/* 38 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var EnglishLocaleBaseDefinition = __webpack_require__(39), - simpleMerge = __webpack_require__(40), - simpleClone = __webpack_require__(42); - - function getEnglishVariant(v) { - return simpleMerge(simpleClone(EnglishLocaleBaseDefinition), v); - } - - module.exports = getEnglishVariant; - -/***/ }, -/* 39 */ -/***/ function(module, exports) { - - 'use strict'; - - var EnglishLocaleBaseDefinition = { - 'code': 'en', - 'plural': true, - 'timeMarkers': 'at', - 'ampm': 'AM|A.M.|a,PM|P.M.|p', - 'units': 'millisecond:|s,second:|s,minute:|s,hour:|s,day:|s,week:|s,month:|s,year:|s', - 'months': 'Jan:uary|,Feb:ruary|,Mar:ch|,Apr:il|,May,Jun:e|,Jul:y|,Aug:ust|,Sep:tember|t|,Oct:ober|,Nov:ember|,Dec:ember|', - 'weekdays': 'Sun:day|,Mon:day|,Tue:sday|,Wed:nesday|,Thu:rsday|,Fri:day|,Sat:urday|+weekend', - 'numerals': 'zero,one|first,two|second,three|third,four:|th,five|fifth,six:|th,seven:|th,eight:|h,nin:e|th,ten:|th', - 'articles': 'a,an,the', - 'tokens': 'the,st|nd|rd|th,of|in,a|an,on', - 'time': '{H}:{mm}', - 'past': '{num} {unit} {sign}', - 'future': '{num} {unit} {sign}', - 'duration': '{num} {unit}', - 'modifiers': [ - { 'name': 'half', 'src': 'half', 'value': .5 }, - { 'name': 'midday', 'src': 'noon', 'value': 12 }, - { 'name': 'midday', 'src': 'midnight', 'value': 24 }, - { 'name': 'day', 'src': 'yesterday', 'value': -1 }, - { 'name': 'day', 'src': 'today|tonight', 'value': 0 }, - { 'name': 'day', 'src': 'tomorrow', 'value': 1 }, - { 'name': 'sign', 'src': 'ago|before', 'value': -1 }, - { 'name': 'sign', 'src': 'from now|after|from|in|later', 'value': 1 }, - { 'name': 'edge', 'src': 'first day|first|beginning', 'value': -2 }, - { 'name': 'edge', 'src': 'last day', 'value': 1 }, - { 'name': 'edge', 'src': 'end|last', 'value': 2 }, - { 'name': 'shift', 'src': 'last', 'value': -1 }, - { 'name': 'shift', 'src': 'the|this', 'value': 0 }, - { 'name': 'shift', 'src': 'next', 'value': 1 } - ], - 'parse': [ - '(?:just)? now', - '{shift} {unit:5-7}', - "{months?} (?:{year}|'{yy})", - '{midday} {4?} {day|weekday}', - '{months},?(?:[-.\\/\\s]{year})?', - '{edge} of (?:day)? {day|weekday}', - '{0} {num}{1?} {weekday} {2} {months},? {year?}', - '{shift?} {day?} {weekday?} {timeMarker?} {midday}', - '{sign?} {3?} {half} {3?} {unit:3-4|unit:7} {sign?}', - '{0?} {edge} {weekday?} {2} {shift?} {unit:4-7?} {months?},? {year?}' - ], - 'timeParse': [ - '{day|weekday}', - '{shift} {unit:5?} {weekday}', - '{0?} {date}{1?} {2?} {months?}', - '{weekday} {2?} {shift} {unit:5}', - '{0?} {num} {2?} {months}\\.?,? {year?}', - '{num?} {unit:4-5} {sign} {day|weekday}', - '{year}[-.\\/\\s]{months}[-.\\/\\s]{date}', - '{0|months} {date?}{1?} of {shift} {unit:6-7}', - '{0?} {num}{1?} {weekday} of {shift} {unit:6}', - "{date}[-.\\/\\s]{months}[-.\\/\\s](?:{year}|'?{yy})", - "{weekday?}\\.?,? {months}\\.?,? {date}{1?},? (?:{year}|'{yy})?" - ], - 'timeFrontParse': [ - '{sign} {num} {unit}', - '{num} {unit} {sign}', - '{4?} {day|weekday}' - ] - }; - - module.exports = EnglishLocaleBaseDefinition; - -/***/ }, -/* 40 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var coreUtilityAliases = __webpack_require__(41); - - var forEachProperty = coreUtilityAliases.forEachProperty; - - function simpleMerge(target, source) { - forEachProperty(source, function(val, key) { - target[key] = val; - }); - return target; - } - - module.exports = simpleMerge; - -/***/ }, -/* 41 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - module.exports = { - hasOwn: Sugar.util.hasOwn, - getOwn: Sugar.util.getOwn, - setProperty: Sugar.util.setProperty, - classToString: Sugar.util.classToString, - defineProperty: Sugar.util.defineProperty, - forEachProperty: Sugar.util.forEachProperty, - mapNativeToChainable: Sugar.util.mapNativeToChainable - }; - -/***/ }, -/* 42 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var simpleMerge = __webpack_require__(40); - - function simpleClone(obj) { - return simpleMerge({}, obj); - } - - module.exports = simpleClone; - -/***/ }, -/* 43 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getEnglishVariant = __webpack_require__(38); - - var AmericanEnglishDefinition = getEnglishVariant({ - 'mdy': true, - 'firstDayOfWeek': 0, - 'firstDayOfWeekYear': 1, - 'short': '{MM}/{dd}/{yyyy}', - 'medium': '{Month} {d}, {yyyy}', - 'long': '{Month} {d}, {yyyy} {time}', - 'full': '{Weekday}, {Month} {d}, {yyyy} {time}', - 'stamp': '{Dow} {Mon} {d} {yyyy} {time}', - 'time': '{h}:{mm} {TT}' - }); - - module.exports = AmericanEnglishDefinition; - -/***/ }, -/* 44 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getEnglishVariant = __webpack_require__(38); - - var CanadianEnglishDefinition = getEnglishVariant({ - 'short': '{yyyy}-{MM}-{dd}', - 'medium': '{d} {Month}, {yyyy}', - 'long': '{d} {Month}, {yyyy} {H}:{mm}', - 'full': '{Weekday}, {d} {Month}, {yyyy} {time}', - 'stamp': '{Dow} {d} {Mon} {yyyy} {time}' - }); - - module.exports = CanadianEnglishDefinition; - -/***/ }, -/* 45 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LOCALE_ARRAY_FIELDS = __webpack_require__(46), - ISODefaults = __webpack_require__(47), - ParsingTokens = __webpack_require__(48), - CoreParsingFormats = __webpack_require__(49), - LocalizedParsingTokens = __webpack_require__(50), - map = __webpack_require__(51), - filter = __webpack_require__(52), - forEach = __webpack_require__(53), - isDefined = __webpack_require__(57), - commaSplit = __webpack_require__(58), - classChecks = __webpack_require__(60), - isUndefined = __webpack_require__(68), - mathAliases = __webpack_require__(69), - simpleMerge = __webpack_require__(40), - getOrdinalSuffix = __webpack_require__(70), - getRegNonCapturing = __webpack_require__(71), - coreUtilityAliases = __webpack_require__(41), - getArrayWithOffset = __webpack_require__(72), - iterateOverDateUnits = __webpack_require__(73), - arrayToRegAlternates = __webpack_require__(83), - fullwidthNumberHelpers = __webpack_require__(85), - getAdjustedUnitForNumber = __webpack_require__(88), - getParsingTokenWithSuffix = __webpack_require__(92); - - var getOwn = coreUtilityAliases.getOwn, - forEachProperty = coreUtilityAliases.forEachProperty, - fullWidthNumberMap = fullwidthNumberHelpers.fullWidthNumberMap, - fullWidthNumbers = fullwidthNumberHelpers.fullWidthNumbers, - pow = mathAliases.pow, - max = mathAliases.max, - ISO_FIRST_DAY_OF_WEEK = ISODefaults.ISO_FIRST_DAY_OF_WEEK, - ISO_FIRST_DAY_OF_WEEK_YEAR = ISODefaults.ISO_FIRST_DAY_OF_WEEK_YEAR, - isString = classChecks.isString, - isFunction = classChecks.isFunction; - - function getNewLocale(def) { - - function Locale(def) { - this.init(def); - } - - Locale.prototype = { - - getMonthName: function(n, alternate) { - if (this.monthSuffix) { - return (n + 1) + this.monthSuffix; - } - return getArrayWithOffset(this.months, n, alternate, 12); - }, - - getWeekdayName: function(n, alternate) { - return getArrayWithOffset(this.weekdays, n, alternate, 7); - }, - - getTokenValue: function(field, str) { - var map = this[field + 'Map'], val; - if (map) { - val = map[str]; - } - if (isUndefined(val)) { - val = this.getNumber(str); - if (field === 'month') { - // Months are the only numeric date field - // whose value is not the same as its number. - val -= 1; - } - } - return val; - }, - - getNumber: function(str) { - var num = this.numeralMap[str]; - if (isDefined(num)) { - return num; - } - // The unary plus operator here show better performance and handles - // every format that parseFloat does with the exception of trailing - // characters, which are guaranteed not to be in our string at this point. - num = +str.replace(/,/, '.'); - if (!isNaN(num)) { - return num; - } - num = this.getNumeralValue(str); - if (!isNaN(num)) { - this.numeralMap[str] = num; - return num; - } - return num; - }, - - getNumeralValue: function(str) { - var place = 1, num = 0, lastWasPlace, isPlace, numeral, digit, arr; - // Note that "numerals" that need to be converted through this method are - // all considered to be single characters in order to handle CJK. This - // method is by no means unique to CJK, but the complexity of handling - // inflections in non-CJK languages adds too much overhead for not enough - // value, so avoiding for now. - arr = str.split(''); - for (var i = arr.length - 1; numeral = arr[i]; i--) { - digit = getOwn(this.numeralMap, numeral); - if (isUndefined(digit)) { - digit = getOwn(fullWidthNumberMap, numeral) || 0; - } - isPlace = digit > 0 && digit % 10 === 0; - if (isPlace) { - if (lastWasPlace) { - num += place; - } - if (i) { - place = digit; - } else { - num += digit; - } - } else { - num += digit * place; - place *= 10; - } - lastWasPlace = isPlace; - } - return num; - }, - - getOrdinal: function(n) { - var suffix = this.ordinalSuffix; - return suffix || getOrdinalSuffix(n); - }, - - getRelativeFormat: function(adu, type) { - return this.convertAdjustedToFormat(adu, type); - }, - - getDuration: function(ms) { - return this.convertAdjustedToFormat(getAdjustedUnitForNumber(max(0, ms)), 'duration'); - }, - - getFirstDayOfWeek: function() { - var val = this.firstDayOfWeek; - return isDefined(val) ? val : ISO_FIRST_DAY_OF_WEEK; - }, - - getFirstDayOfWeekYear: function() { - return this.firstDayOfWeekYear || ISO_FIRST_DAY_OF_WEEK_YEAR; - }, - - convertAdjustedToFormat: function(adu, type) { - var sign, unit, mult, - num = adu[0], - u = adu[1], - ms = adu[2], - format = this[type] || this.relative; - if (isFunction(format)) { - return format.call(this, num, u, ms, type); - } - mult = !this.plural || num === 1 ? 0 : 1; - unit = this.units[mult * 8 + u] || this.units[u]; - sign = this[ms > 0 ? 'fromNow' : 'ago']; - return format.replace(/\{(.*?)\}/g, function(full, match) { - switch(match) { - case 'num': return num; - case 'unit': return unit; - case 'sign': return sign; - } - }); - }, - - cacheFormat: function(dif, i) { - this.compiledFormats.splice(i, 1); - this.compiledFormats.unshift(dif); - }, - - addFormat: function(src, to) { - var loc = this; - - function getTokenSrc(str) { - var suffix, src, val, - opt = str.match(/\?$/), - nc = str.match(/^(\d+)\??$/), - slice = str.match(/(\d)(?:-(\d))?/), - key = str.replace(/[^a-z]+$/i, ''); - - // Allowing alias tokens such as {time} - if (val = getOwn(loc.parsingAliases, key)) { - src = replaceParsingTokens(val); - if (opt) { - src = getRegNonCapturing(src, true); - } - return src; - } - - if (nc) { - src = loc.tokens[nc[1]]; - } else if (val = getOwn(ParsingTokens, key)) { - src = val.src; - } else { - val = getOwn(loc.parsingTokens, key) || getOwn(loc, key); - - // Both the "months" array and the "month" parsing token can be accessed - // by either {month} or {months}, falling back as necessary, however - // regardless of whether or not a fallback occurs, the final field to - // be passed to addRawFormat must be normalized as singular. - key = key.replace(/s$/, ''); - - if (!val) { - val = getOwn(loc.parsingTokens, key) || getOwn(loc, key + 's'); - } - - if (isString(val)) { - src = val; - suffix = loc[key + 'Suffix']; - } else { - if (slice) { - val = filter(val, function(m, i) { - var mod = i % (loc.units ? 8 : val.length); - return mod >= slice[1] && mod <= (slice[2] || slice[1]); - }); - } - src = arrayToRegAlternates(val); - } - } - if (!src) { - return ''; - } - if (nc) { - // Non-capturing tokens like {0} - src = getRegNonCapturing(src); - } else { - // Capturing group and add to parsed tokens - to.push(key); - src = '(' + src + ')'; - } - if (suffix) { - // Date/time suffixes such as those in CJK - src = getParsingTokenWithSuffix(key, src, suffix); - } - if (opt) { - src += '?'; - } - return src; - } - - function replaceParsingTokens(str) { - - // Make spaces optional - str = str.replace(/ /g, ' ?'); - - return str.replace(/\{([^,]+?)\}/g, function(match, token) { - var tokens = token.split('|'), src; - if (tokens.length > 1) { - src = getRegNonCapturing(map(tokens, getTokenSrc).join('|')); - } else { - src = getTokenSrc(token); - } - return src; - }); - } - - if (!to) { - to = []; - src = replaceParsingTokens(src); - } - - loc.addRawFormat(src, to); - }, - - addRawFormat: function(format, to) { - this.compiledFormats.unshift({ - reg: RegExp('^ *' + format + ' *$', 'i'), - to: to - }); - }, - - init: function(def) { - var loc = this; - - // -- Initialization helpers - - function initFormats() { - loc.compiledFormats = []; - loc.parsingAliases = {}; - loc.parsingTokens = {}; - } - - function initDefinition() { - simpleMerge(loc, def); - } - - function initArrayFields() { - forEach(LOCALE_ARRAY_FIELDS, function(name) { - var val = loc[name]; - if (isString(val)) { - loc[name] = commaSplit(val); - } else if (!val) { - loc[name] = []; - } - }); - } - - // -- Value array build helpers - - function buildValueArray(name, mod, map, fn) { - var field = name, all = [], setMap; - if (!loc[field]) { - field += 's'; - } - if (!map) { - map = {}; - setMap = true; - } - forAllAlternates(field, function(alt, j, i) { - var idx = j * mod + i, val; - val = fn ? fn(i) : i; - map[alt] = val; - map[alt.toLowerCase()] = val; - all[idx] = alt; - }); - loc[field] = all; - if (setMap) { - loc[name + 'Map'] = map; - } - } - - function forAllAlternates(field, fn) { - forEach(loc[field], function(str, i) { - forEachAlternate(str, function(alt, j) { - fn(alt, j, i); - }); - }); - } - - function forEachAlternate(str, fn) { - var arr = map(str.split('+'), function(split) { - return split.replace(/(.+):(.+)$/, function(full, base, suffixes) { - return map(suffixes.split('|'), function(suffix) { - return base + suffix; - }).join('|'); - }); - }).join('|'); - forEach(arr.split('|'), fn); - } - - function buildNumerals() { - var map = {}; - buildValueArray('numeral', 10, map); - buildValueArray('article', 1, map, function() { - return 1; - }); - buildValueArray('placeholder', 4, map, function(n) { - return pow(10, n + 1); - }); - loc.numeralMap = map; - } - - function buildTimeFormats() { - loc.parsingAliases['time'] = getTimeFormat(); - loc.parsingAliases['tzOffset'] = getTZOffsetFormat(); - } - - function getTimeFormat() { - var src; - if (loc.ampmFront) { - // "ampmFront" exists mostly for CJK locales, which also presume that - // time suffixes exist, allowing this to be a simpler regex. - src = '{ampm?} {hour} (?:{minute} (?::?{second})?)?'; - } else if(loc.ampm.length) { - src = '{hour}(?:[.:]{minute}(?:[.:]{second})? {ampm?}| {ampm})'; - } else { - src = '{hour}(?:[.:]{minute}(?:[.:]{second})?)'; - } - return src; - } - - function getTZOffsetFormat() { - return '(?:{Z}|{GMT?}(?:{tzSign}{tzHour}(?::?{tzMinute}(?: \\([\\w\\s]+\\))?)?)?)?'; - } - - function buildParsingTokens() { - forEachProperty(LocalizedParsingTokens, function(token, name) { - var src, arr; - src = token.base ? ParsingTokens[token.base].src : token.src; - if (token.requiresNumerals || loc.numeralUnits) { - src += getNumeralSrc(); - } - arr = loc[name + 's']; - if (arr && arr.length) { - src += '|' + arrayToRegAlternates(arr); - } - loc.parsingTokens[name] = src; - }); - } - - function getNumeralSrc() { - var all, src = ''; - all = loc.numerals.concat(loc.placeholders).concat(loc.articles); - if (loc.allowsFullWidth) { - all = all.concat(fullWidthNumbers.split('')); - } - if (all.length) { - src = '|(?:' + arrayToRegAlternates(all) + ')+'; - } - return src; - } - - function buildTimeSuffixes() { - iterateOverDateUnits(function(unit, i) { - var token = loc.timeSuffixes[i]; - if (token) { - loc[(unit.alias || unit.name) + 'Suffix'] = token; - } - }); - } - - function buildModifiers() { - forEach(loc.modifiers, function(modifier) { - var name = modifier.name, mapKey = name + 'Map', map; - map = loc[mapKey] || {}; - forEachAlternate(modifier.src, function(alt, j) { - var token = getOwn(loc.parsingTokens, name), val = modifier.value; - map[alt] = val; - loc.parsingTokens[name] = token ? token + '|' + alt : alt; - if (modifier.name === 'sign' && j === 0) { - // Hooking in here to set the first "fromNow" or "ago" modifier - // directly on the locale, so that it can be reused in the - // relative format. - loc[val === 1 ? 'fromNow' : 'ago'] = alt; - } - }); - loc[mapKey] = map; - }); - } - - // -- Format adding helpers - - function addCoreFormats() { - forEach(CoreParsingFormats, function(df) { - var src = df.src; - if (df.mdy && loc.mdy) { - // Use the mm/dd/yyyy variant if it - // exists and the locale requires it - src = df.mdy; - } - if (df.time) { - // Core formats that allow time require the time - // reg on both sides, so add both versions here. - loc.addFormat(getFormatWithTime(src, true)); - loc.addFormat(getFormatWithTime(src)); - } else { - loc.addFormat(src); - } - }); - loc.addFormat('{time}'); - } - - function addLocaleFormats() { - addFormatSet('parse'); - addFormatSet('timeParse', true); - addFormatSet('timeFrontParse', true, true); - } - - function addFormatSet(field, allowTime, timeFront) { - forEach(loc[field], function(format) { - if (allowTime) { - format = getFormatWithTime(format, timeFront); - } - loc.addFormat(format); - }); - } - - function getFormatWithTime(baseFormat, timeBefore) { - if (timeBefore) { - return getTimeBefore() + baseFormat; - } - return baseFormat + getTimeAfter(); - } - - function getTimeBefore() { - return getRegNonCapturing('{time}[,\\s\\u3000]', true); - } - - function getTimeAfter() { - var markers = ',?[\\s\\u3000]', localized; - localized = arrayToRegAlternates(loc.timeMarkers); - if (localized) { - markers += '| (?:' + localized + ') '; - } - markers = getRegNonCapturing(markers, loc.timeMarkerOptional); - return getRegNonCapturing(markers + '{time}', true); - } - - initFormats(); - initDefinition(); - initArrayFields(); - - buildValueArray('month', 12); - buildValueArray('weekday', 7); - buildValueArray('unit', 8); - buildValueArray('ampm', 2); - - buildNumerals(); - buildTimeFormats(); - buildParsingTokens(); - buildTimeSuffixes(); - buildModifiers(); - - // The order of these formats is important. Order is reversed so formats - // that are initialized later will take precedence. Generally, this means - // that more specific formats should come later. - addCoreFormats(); - addLocaleFormats(); - - } - - }; - - return new Locale(def); - } - - module.exports = getNewLocale; - -/***/ }, -/* 46 */ -/***/ function(module, exports) { - - 'use strict'; - - var LOCALE_ARRAY_FIELDS = [ - 'months', 'weekdays', 'units', 'numerals', 'placeholders', - 'articles', 'tokens', 'timeMarkers', 'ampm', 'timeSuffixes', - 'parse', 'timeParse', 'timeFrontParse', 'modifiers' - ]; - - module.exports = LOCALE_ARRAY_FIELDS; - -/***/ }, -/* 47 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = { - ISO_FIRST_DAY_OF_WEEK: 1, - ISO_FIRST_DAY_OF_WEEK_YEAR: 4 - }; - -/***/ }, -/* 48 */ -/***/ function(module, exports) { - - 'use strict'; - - var ParsingTokens = { - 'yyyy': { - param: 'year', - src: '\\d{4}' - }, - 'MM': { - param: 'month', - src: '[01]?\\d' - }, - 'dd': { - param: 'date', - src: '[0123]?\\d' - }, - 'hh': { - param: 'hour', - src: '[0-2]?\\d' - }, - 'mm': { - param: 'minute', - src: '[0-5]\\d' - }, - 'ss': { - param: 'second', - src: '[0-5]\\d(?:[,.]\\d+)?' - }, - 'yy': { - param: 'year', - src: '\\d{2}' - }, - 'y': { - param: 'year', - src: '\\d' - }, - 'yearSign': { - src: '[+-]', - sign: true - }, - 'tzHour': { - src: '[0-1]\\d' - }, - 'tzMinute': { - src: '[0-5]\\d' - }, - 'tzSign': { - src: '[+−-]', - sign: true - }, - 'ihh': { - param: 'hour', - src: '[0-2]?\\d(?:[,.]\\d+)?' - }, - 'imm': { - param: 'minute', - src: '[0-5]\\d(?:[,.]\\d+)?' - }, - 'GMT': { - param: 'utc', - src: 'GMT', - val: 1 - }, - 'Z': { - param: 'utc', - src: 'Z', - val: 1 - }, - 'timestamp': { - src: '\\d+' - } - }; - - module.exports = ParsingTokens; - -/***/ }, -/* 49 */ -/***/ function(module, exports) { - - 'use strict'; - - var CoreParsingFormats = [ - { - // 12-1978 - // 08-1978 (MDY) - src: '{MM}[-.\\/]{yyyy}' - }, - { - // 12/08/1978 - // 08/12/1978 (MDY) - time: true, - src: '{dd}[-.\\/]{MM}(?:[-.\\/]{yyyy|yy|y})?', - mdy: '{MM}[-.\\/]{dd}(?:[-.\\/]{yyyy|yy|y})?' - }, - { - // 1975-08-25 - time: true, - src: '{yyyy}[-.\\/]{MM}(?:[-.\\/]{dd})?' - }, - { - // .NET JSON - src: '\\\\/Date\\({timestamp}(?:[+-]\\d{4,4})?\\)\\\\/' - }, - { - // ISO-8601 - src: '{yearSign?}{yyyy}(?:-?{MM}(?:-?{dd}(?:T{ihh}(?::?{imm}(?::?{ss})?)?)?)?)?{tzOffset?}' - } - ]; - - module.exports = CoreParsingFormats; - -/***/ }, -/* 50 */ -/***/ function(module, exports) { - - 'use strict'; - - var LocalizedParsingTokens = { - 'year': { - base: 'yyyy', - requiresSuffix: true - }, - 'month': { - base: 'MM', - requiresSuffix: true - }, - 'date': { - base: 'dd', - requiresSuffix: true - }, - 'hour': { - base: 'hh', - requiresSuffixOr: ':' - }, - 'minute': { - base: 'mm' - }, - 'second': { - base: 'ss' - }, - 'num': { - src: '\\d+', - requiresNumerals: true - } - }; - - module.exports = LocalizedParsingTokens; - -/***/ }, -/* 51 */ -/***/ function(module, exports) { - - 'use strict'; - - function map(arr, fn) { - // perf: Not using fixed array len here as it may be sparse. - var result = []; - for (var i = 0, len = arr.length; i < len; i++) { - if (i in arr) { - result.push(fn(arr[i], i)); - } - } - return result; - } - - module.exports = map; - -/***/ }, -/* 52 */ -/***/ function(module, exports) { - - 'use strict'; - - function filter(arr, fn) { - var result = []; - for (var i = 0, len = arr.length; i < len; i++) { - var el = arr[i]; - if (i in arr && fn(el, i)) { - result.push(el); - } - } - return result; - } - - module.exports = filter; - -/***/ }, -/* 53 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var iterateOverSparseArray = __webpack_require__(54); - - function forEach(arr, fn) { - for (var i = 0, len = arr.length; i < len; i++) { - if (!(i in arr)) { - return iterateOverSparseArray(arr, fn, i); - } - fn(arr[i], i); - } - } - - module.exports = forEach; - -/***/ }, -/* 54 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getSparseArrayIndexes = __webpack_require__(55); - - function iterateOverSparseArray(arr, fn, fromIndex, loop) { - var indexes = getSparseArrayIndexes(arr, fromIndex, loop), index; - for (var i = 0, len = indexes.length; i < len; i++) { - index = indexes[i]; - fn.call(arr, arr[index], index, arr); - } - return arr; - } - - module.exports = iterateOverSparseArray; - -/***/ }, -/* 55 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var isArrayIndex = __webpack_require__(56); - - function getSparseArrayIndexes(arr, fromIndex, loop, fromRight) { - var indexes = [], i; - for (i in arr) { - if (isArrayIndex(i) && (loop || (fromRight ? i <= fromIndex : i >= fromIndex))) { - indexes.push(+i); - } - } - indexes.sort(function(a, b) { - var aLoop = a > fromIndex; - var bLoop = b > fromIndex; - if (aLoop !== bLoop) { - return aLoop ? -1 : 1; - } - return a - b; - }); - return indexes; - } - - module.exports = getSparseArrayIndexes; - -/***/ }, -/* 56 */ -/***/ function(module, exports) { - - 'use strict'; - - function isArrayIndex(n) { - return n >>> 0 == n && n != 0xFFFFFFFF; - } - - module.exports = isArrayIndex; - -/***/ }, -/* 57 */ -/***/ function(module, exports) { - - 'use strict'; - - function isDefined(o) { - return o !== undefined; - } - - module.exports = isDefined; - -/***/ }, -/* 58 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var CommonChars = __webpack_require__(59); - - var HALF_WIDTH_COMMA = CommonChars.HALF_WIDTH_COMMA; - - function commaSplit(str) { - return str.split(HALF_WIDTH_COMMA); - } - - module.exports = commaSplit; - -/***/ }, -/* 59 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = { - HALF_WIDTH_ZERO: 0x30, - FULL_WIDTH_ZERO: 0xff10, - HALF_WIDTH_PERIOD: '.', - FULL_WIDTH_PERIOD: '.', - HALF_WIDTH_COMMA: ',', - OPEN_BRACE: '{', - CLOSE_BRACE: '}' - }; - -/***/ }, -/* 60 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var NATIVE_TYPES = __webpack_require__(61), - forEach = __webpack_require__(53), - isClass = __webpack_require__(62), - spaceSplit = __webpack_require__(63), - isPlainObject = __webpack_require__(64), - coreUtilityAliases = __webpack_require__(41); - - var classToString = coreUtilityAliases.classToString; - - var isSerializable, - isBoolean, isNumber, isString, - isDate, isRegExp, isFunction, - isArray, isSet, isMap, isError; - - function buildClassChecks() { - - var knownTypes = {}; - - function addCoreTypes() { - - var names = spaceSplit(NATIVE_TYPES); - - isBoolean = buildPrimitiveClassCheck(names[0]); - isNumber = buildPrimitiveClassCheck(names[1]); - isString = buildPrimitiveClassCheck(names[2]); - - isDate = buildClassCheck(names[3]); - isRegExp = buildClassCheck(names[4]); - - // Wanted to enhance performance here by using simply "typeof" - // but Firefox has two major issues that make this impossible, - // one fixed, the other not, so perform a full class check here. - // - // 1. Regexes can be typeof "function" in FF < 3 - // https://bugzilla.mozilla.org/show_bug.cgi?id=61911 (fixed) - // - // 2. HTMLEmbedElement and HTMLObjectElement are be typeof "function" - // https://bugzilla.mozilla.org/show_bug.cgi?id=268945 (won't fix) - isFunction = buildClassCheck(names[5]); - - - isArray = Array.isArray || buildClassCheck(names[6]); - isError = buildClassCheck(names[7]); - - isSet = buildClassCheck(names[8], typeof Set !== 'undefined' && Set); - isMap = buildClassCheck(names[9], typeof Map !== 'undefined' && Map); - - // Add core types as known so that they can be checked by value below, - // notably excluding Functions and adding Arguments and Error. - addKnownType('Arguments'); - addKnownType(names[0]); - addKnownType(names[1]); - addKnownType(names[2]); - addKnownType(names[3]); - addKnownType(names[4]); - addKnownType(names[6]); - - } - - function addArrayTypes() { - var types = 'Int8 Uint8 Uint8Clamped Int16 Uint16 Int32 Uint32 Float32 Float64'; - forEach(spaceSplit(types), function(str) { - addKnownType(str + 'Array'); - }); - } - - function addKnownType(className) { - var str = '[object '+ className +']'; - knownTypes[str] = true; - } - - function isKnownType(className) { - return knownTypes[className]; - } - - function buildClassCheck(className, globalObject) { - if (globalObject && isClass(new globalObject, 'Object')) { - return getConstructorClassCheck(globalObject); - } else { - return getToStringClassCheck(className); - } - } - - function getConstructorClassCheck(obj) { - var ctorStr = String(obj); - return function(obj) { - return String(obj.constructor) === ctorStr; - }; - } - - function getToStringClassCheck(className) { - return function(obj, str) { - // perf: Returning up front on instanceof appears to be slower. - return isClass(obj, className, str); - }; - } - - function buildPrimitiveClassCheck(className) { - var type = className.toLowerCase(); - return function(obj) { - var t = typeof obj; - return t === type || t === 'object' && isClass(obj, className); - }; - } - - addCoreTypes(); - addArrayTypes(); - - isSerializable = function(obj, className) { - // Only known objects can be serialized. This notably excludes functions, - // host objects, Symbols (which are matched by reference), and instances - // of classes. The latter can arguably be matched by value, but - // distinguishing between these and host objects -- which should never be - // compared by value -- is very tricky so not dealing with it here. - className = className || classToString(obj); - return isKnownType(className) || isPlainObject(obj, className); - }; - - } - - buildClassChecks(); - - module.exports = { - isSerializable: isSerializable, - isBoolean: isBoolean, - isNumber: isNumber, - isString: isString, - isDate: isDate, - isRegExp: isRegExp, - isFunction: isFunction, - isArray: isArray, - isSet: isSet, - isMap: isMap, - isError: isError - }; - -/***/ }, -/* 61 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = 'Boolean Number String Date RegExp Function Array Error Set Map'; - -/***/ }, -/* 62 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var coreUtilityAliases = __webpack_require__(41); - - var classToString = coreUtilityAliases.classToString; - - function isClass(obj, className, str) { - if (!str) { - str = classToString(obj); - } - return str === '[object '+ className +']'; - } - - module.exports = isClass; - -/***/ }, -/* 63 */ -/***/ function(module, exports) { - - 'use strict'; - - function spaceSplit(str) { - return str.split(' '); - } - - module.exports = spaceSplit; - -/***/ }, -/* 64 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var isClass = __webpack_require__(62), - isObjectType = __webpack_require__(65), - hasOwnEnumeratedProperties = __webpack_require__(66), - hasValidPlainObjectPrototype = __webpack_require__(67); - - function isPlainObject(obj, className) { - return isObjectType(obj) && - isClass(obj, 'Object', className) && - hasValidPlainObjectPrototype(obj) && - hasOwnEnumeratedProperties(obj); - } - - module.exports = isPlainObject; - -/***/ }, -/* 65 */ -/***/ function(module, exports) { - - 'use strict'; - - function isObjectType(obj, type) { - return !!obj && (type || typeof obj) === 'object'; - } - - module.exports = isObjectType; - -/***/ }, -/* 66 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var coreUtilityAliases = __webpack_require__(41); - - var hasOwn = coreUtilityAliases.hasOwn; - - function hasOwnEnumeratedProperties(obj) { - // Plain objects are generally defined as having enumerated properties - // all their own, however in early IE environments without defineProperty, - // there may also be enumerated methods in the prototype chain, so check - // for both of these cases. - var objectProto = Object.prototype; - for (var key in obj) { - var val = obj[key]; - if (!hasOwn(obj, key) && val !== objectProto[key]) { - return false; - } - } - return true; - } - - module.exports = hasOwnEnumeratedProperties; - -/***/ }, -/* 67 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var coreUtilityAliases = __webpack_require__(41); - - var hasOwn = coreUtilityAliases.hasOwn; - - function hasValidPlainObjectPrototype(obj) { - var hasToString = 'toString' in obj; - var hasConstructor = 'constructor' in obj; - // An object created with Object.create(null) has no methods in the - // prototype chain, so check if any are missing. The additional hasToString - // check is for false positives on some host objects in old IE which have - // toString but no constructor. If the object has an inherited constructor, - // then check if it is Object (the "isPrototypeOf" tapdance here is a more - // robust way of ensuring this if the global has been hijacked). Note that - // accessing the constructor directly (without "in" or "hasOwnProperty") - // will throw a permissions error in IE8 on cross-domain windows. - return (!hasConstructor && !hasToString) || - (hasConstructor && !hasOwn(obj, 'constructor') && - hasOwn(obj.constructor.prototype, 'isPrototypeOf')); - } - - module.exports = hasValidPlainObjectPrototype; - -/***/ }, -/* 68 */ -/***/ function(module, exports) { - - 'use strict'; - - function isUndefined(o) { - return o === undefined; - } - - module.exports = isUndefined; - -/***/ }, -/* 69 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = { - abs: Math.abs, - pow: Math.pow, - min: Math.min, - max: Math.max, - ceil: Math.ceil, - floor: Math.floor, - round: Math.round - }; - -/***/ }, -/* 70 */ -/***/ function(module, exports) { - - 'use strict'; - - function getOrdinalSuffix(num) { - if (num >= 11 && num <= 13) { - return 'th'; - } else { - switch(num % 10) { - case 1: return 'st'; - case 2: return 'nd'; - case 3: return 'rd'; - default: return 'th'; - } - } - } - - module.exports = getOrdinalSuffix; - -/***/ }, -/* 71 */ -/***/ function(module, exports) { - - 'use strict'; - - function getRegNonCapturing(src, opt) { - if (src.length > 1) { - src = '(?:' + src + ')'; - } - if (opt) { - src += '?'; - } - return src; - } - - module.exports = getRegNonCapturing; - -/***/ }, -/* 72 */ -/***/ function(module, exports) { - - 'use strict'; - - function getArrayWithOffset(arr, n, alternate, offset) { - var val; - if (alternate > 1) { - val = arr[n + (alternate - 1) * offset]; - } - return val || arr[n]; - } - - module.exports = getArrayWithOffset; - -/***/ }, -/* 73 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnits = __webpack_require__(74), - DateUnitIndexes = __webpack_require__(82), - isUndefined = __webpack_require__(68); - - var YEAR_INDEX = DateUnitIndexes.YEAR_INDEX; - - function iterateOverDateUnits(fn, startIndex, endIndex) { - endIndex = endIndex || 0; - if (isUndefined(startIndex)) { - startIndex = YEAR_INDEX; - } - for (var index = startIndex; index >= endIndex; index--) { - if (fn(DateUnits[index], index) === false) { - break; - } - } - } - - module.exports = iterateOverDateUnits; - -/***/ }, -/* 74 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getDaysInMonth = __webpack_require__(75); - - var DateUnits = [ - { - name: 'millisecond', - method: 'Milliseconds', - multiplier: 1, - start: 0, - end: 999 - }, - { - name: 'second', - method: 'Seconds', - multiplier: 1000, - start: 0, - end: 59 - }, - { - name: 'minute', - method: 'Minutes', - multiplier: 60 * 1000, - start: 0, - end: 59 - }, - { - name: 'hour', - method: 'Hours', - multiplier: 60 * 60 * 1000, - start: 0, - end: 23 - }, - { - name: 'day', - alias: 'date', - method: 'Date', - ambiguous: true, - multiplier: 24 * 60 * 60 * 1000, - start: 1, - end: function(d) { - return getDaysInMonth(d); - } - }, - { - name: 'week', - method: 'ISOWeek', - ambiguous: true, - multiplier: 7 * 24 * 60 * 60 * 1000 - }, - { - name: 'month', - method: 'Month', - ambiguous: true, - multiplier: 30.4375 * 24 * 60 * 60 * 1000, - start: 0, - end: 11 - }, - { - name: 'year', - method: 'FullYear', - ambiguous: true, - multiplier: 365.25 * 24 * 60 * 60 * 1000, - start: 0 - } - ]; - - module.exports = DateUnits; - -/***/ }, -/* 75 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getYear = __webpack_require__(76), - getMonth = __webpack_require__(81), - callDateGet = __webpack_require__(77); - - function getDaysInMonth(d) { - return 32 - callDateGet(new Date(getYear(d), getMonth(d), 32), 'Date'); - } - - module.exports = getDaysInMonth; - -/***/ }, -/* 76 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var callDateGet = __webpack_require__(77); - - function getYear(d) { - return callDateGet(d, 'FullYear'); - } - - module.exports = getYear; - -/***/ }, -/* 77 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _utc = __webpack_require__(78); - - function callDateGet(d, method) { - return d['get' + (_utc(d) ? 'UTC' : '') + method](); - } - - module.exports = callDateGet; - -/***/ }, -/* 78 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var privatePropertyAccessor = __webpack_require__(79); - - module.exports = privatePropertyAccessor('utc'); - -/***/ }, -/* 79 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var PRIVATE_PROP_PREFIX = __webpack_require__(80), - coreUtilityAliases = __webpack_require__(41); - - var setProperty = coreUtilityAliases.setProperty; - - function privatePropertyAccessor(key) { - var privateKey = PRIVATE_PROP_PREFIX + key; - return function(obj, val) { - if (arguments.length > 1) { - setProperty(obj, privateKey, val); - return obj; - } - return obj[privateKey]; - }; - } - - module.exports = privatePropertyAccessor; - -/***/ }, -/* 80 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = '_sugar_'; - -/***/ }, -/* 81 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var callDateGet = __webpack_require__(77); - - function getMonth(d) { - return callDateGet(d, 'Month'); - } - - module.exports = getMonth; - -/***/ }, -/* 82 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = { - HOURS_INDEX: 3, - DAY_INDEX: 4, - WEEK_INDEX: 5, - MONTH_INDEX: 6, - YEAR_INDEX: 7 - }; - -/***/ }, -/* 83 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var map = __webpack_require__(51), - escapeRegExp = __webpack_require__(84); - - function arrayToRegAlternates(arr) { - var joined = arr.join(''); - if (!arr || !arr.length) { - return ''; - } - if (joined.length === arr.length) { - return '[' + joined + ']'; - } - // map handles sparse arrays so no need to compact the array here. - return map(arr, escapeRegExp).join('|'); - } - - module.exports = arrayToRegAlternates; - -/***/ }, -/* 84 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var classChecks = __webpack_require__(60); - - var isString = classChecks.isString; - - function escapeRegExp(str) { - if (!isString(str)) str = String(str); - return str.replace(/([\\\/\'*+?|()\[\]{}.^$-])/g,'\\$1'); - } - - module.exports = escapeRegExp; - -/***/ }, -/* 85 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var CommonChars = __webpack_require__(59), - chr = __webpack_require__(86), - allCharsReg = __webpack_require__(87); - - var HALF_WIDTH_ZERO = CommonChars.HALF_WIDTH_ZERO, - FULL_WIDTH_ZERO = CommonChars.FULL_WIDTH_ZERO, - HALF_WIDTH_PERIOD = CommonChars.HALF_WIDTH_PERIOD, - FULL_WIDTH_PERIOD = CommonChars.FULL_WIDTH_PERIOD, - HALF_WIDTH_COMMA = CommonChars.HALF_WIDTH_COMMA; - - var fullWidthNumberReg, fullWidthNumberMap, fullWidthNumbers; - - function buildFullWidthNumber() { - var fwp = FULL_WIDTH_PERIOD, hwp = HALF_WIDTH_PERIOD, hwc = HALF_WIDTH_COMMA, fwn = ''; - fullWidthNumberMap = {}; - for (var i = 0, digit; i <= 9; i++) { - digit = chr(i + FULL_WIDTH_ZERO); - fwn += digit; - fullWidthNumberMap[digit] = chr(i + HALF_WIDTH_ZERO); - } - fullWidthNumberMap[hwc] = ''; - fullWidthNumberMap[fwp] = hwp; - // Mapping this to itself to capture it easily - // in stringToNumber to detect decimals later. - fullWidthNumberMap[hwp] = hwp; - fullWidthNumberReg = allCharsReg(fwn + fwp + hwc + hwp); - fullWidthNumbers = fwn; - } - - buildFullWidthNumber(); - - module.exports = { - fullWidthNumberReg: fullWidthNumberReg, - fullWidthNumberMap: fullWidthNumberMap, - fullWidthNumbers: fullWidthNumbers - }; - -/***/ }, -/* 86 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = String.fromCharCode; - -/***/ }, -/* 87 */ -/***/ function(module, exports) { - - 'use strict'; - - function allCharsReg(src) { - return RegExp('[' + src + ']', 'g'); - } - - module.exports = allCharsReg; - -/***/ }, -/* 88 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var trunc = __webpack_require__(89), - withPrecision = __webpack_require__(90), - getAdjustedUnit = __webpack_require__(91); - - function getAdjustedUnitForNumber(ms) { - return getAdjustedUnit(ms, function(unit) { - return trunc(withPrecision(ms / unit.multiplier, 1)); - }); - } - - module.exports = getAdjustedUnitForNumber; - -/***/ }, -/* 89 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var mathAliases = __webpack_require__(69); - - var ceil = mathAliases.ceil, - floor = mathAliases.floor; - - var trunc = Math.trunc || function(n) { - if (n === 0 || !isFinite(n)) return n; - return n < 0 ? ceil(n) : floor(n); - }; - - module.exports = trunc; - -/***/ }, -/* 90 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var mathAliases = __webpack_require__(69); - - var abs = mathAliases.abs, - pow = mathAliases.pow, - round = mathAliases.round; - - function withPrecision(val, precision, fn) { - var multiplier = pow(10, abs(precision || 0)); - fn = fn || round; - if (precision < 0) multiplier = 1 / multiplier; - return fn(val * multiplier) / multiplier; - } - - module.exports = withPrecision; - -/***/ }, -/* 91 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var mathAliases = __webpack_require__(69), - iterateOverDateUnits = __webpack_require__(73); - - var abs = mathAliases.abs; - - function getAdjustedUnit(ms, fn) { - var unitIndex = 0, value = 0; - iterateOverDateUnits(function(unit, i) { - value = abs(fn(unit)); - if (value >= 1) { - unitIndex = i; - return false; - } - }); - return [value, unitIndex, ms]; - } - - module.exports = getAdjustedUnit; - -/***/ }, -/* 92 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LocalizedParsingTokens = __webpack_require__(50), - getRegNonCapturing = __webpack_require__(71); - - function getParsingTokenWithSuffix(field, src, suffix) { - var token = LocalizedParsingTokens[field]; - if (token.requiresSuffix) { - src = getRegNonCapturing(src + getRegNonCapturing(suffix)); - } else if (token.requiresSuffixOr) { - src += getRegNonCapturing(token.requiresSuffixOr + '|' + suffix); - } else { - src += getRegNonCapturing(suffix, true); - } - return src; - } - - module.exports = getParsingTokenWithSuffix; - -/***/ }, -/* 93 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - createDate = __webpack_require__(94); - - __webpack_require__(136); - - Sugar.Date.defineStatic({ - - 'create': function(d, options) { - return createDate(d, options); - } - - }); - - module.exports = Sugar.Date.create; - -/***/ }, -/* 94 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getExtendedDate = __webpack_require__(95); - - function createDate(d, options, forceClone) { - return getExtendedDate(null, d, options, forceClone).date; - } - - module.exports = createDate; - -/***/ }, -/* 95 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var MINUTES = __webpack_require__(96), - ParsingTokens = __webpack_require__(48), - LocaleHelpers = __webpack_require__(35), - DateUnitIndexes = __webpack_require__(82), - _utc = __webpack_require__(78), - trunc = __webpack_require__(89), - forEach = __webpack_require__(53), - tzOffset = __webpack_require__(97), - resetTime = __webpack_require__(98), - isDefined = __webpack_require__(57), - setWeekday = __webpack_require__(103), - updateDate = __webpack_require__(107), - getNewDate = __webpack_require__(108), - isUndefined = __webpack_require__(68), - classChecks = __webpack_require__(60), - advanceDate = __webpack_require__(128), - simpleClone = __webpack_require__(42), - isObjectType = __webpack_require__(65), - moveToEndOfUnit = __webpack_require__(129), - deleteDateParam = __webpack_require__(131), - coreUtilityAliases = __webpack_require__(41), - getParsingTokenValue = __webpack_require__(132), - moveToBeginningOfUnit = __webpack_require__(133), - iterateOverDateParams = __webpack_require__(124), - getYearFromAbbreviation = __webpack_require__(134), - iterateOverHigherDateParams = __webpack_require__(135); - - var isNumber = classChecks.isNumber, - isString = classChecks.isString, - isDate = classChecks.isDate, - hasOwn = coreUtilityAliases.hasOwn, - getOwn = coreUtilityAliases.getOwn, - English = LocaleHelpers.English, - localeManager = LocaleHelpers.localeManager, - DAY_INDEX = DateUnitIndexes.DAY_INDEX, - WEEK_INDEX = DateUnitIndexes.WEEK_INDEX, - MONTH_INDEX = DateUnitIndexes.MONTH_INDEX, - YEAR_INDEX = DateUnitIndexes.YEAR_INDEX; - - function getExtendedDate(contextDate, d, opt, forceClone) { - - var date, set, loc, options, afterCallbacks, relative, weekdayDir; - - afterCallbacks = []; - options = getDateOptions(opt); - - function getDateOptions(opt) { - var options = isString(opt) ? { locale: opt } : opt || {}; - options.prefer = +!!getOwn(options, 'future') - +!!getOwn(options, 'past'); - return options; - } - - function getFormatParams(match, dif) { - var set = getOwn(options, 'params') || {}; - forEach(dif.to, function(field, i) { - var str = match[i + 1], token, val; - if (!str) return; - if (field === 'yy' || field === 'y') { - field = 'year'; - val = getYearFromAbbreviation(str, date, getOwn(options, 'prefer')); - } else if (token = getOwn(ParsingTokens, field)) { - field = token.param || field; - val = getParsingTokenValue(token, str); - } else { - val = loc.getTokenValue(field, str); - } - set[field] = val; - }); - return set; - } - - // Clone date will set the utc flag, but it will - // be overriden later, so set option flags instead. - function cloneDateByFlag(d, clone) { - if (_utc(d) && !isDefined(getOwn(options, 'fromUTC'))) { - options.fromUTC = true; - } - if (_utc(d) && !isDefined(getOwn(options, 'setUTC'))) { - options.setUTC = true; - } - if (clone) { - d = new Date(d.getTime()); - } - return d; - } - - function afterDateSet(fn) { - afterCallbacks.push(fn); - } - - function fireCallbacks() { - forEach(afterCallbacks, function(fn) { - fn.call(); - }); - } - - function parseStringDate(str) { - - str = str.toLowerCase(); - - // The act of getting the locale will initialize - // if it is missing and add the required formats. - loc = localeManager.get(getOwn(options, 'locale')); - - for (var i = 0, dif, match; dif = loc.compiledFormats[i]; i++) { - match = str.match(dif.reg); - if (match) { - - // Note that caching the format will modify the compiledFormats array - // which is not a good idea to do inside its for loop, however we - // know at this point that we have a matched format and that we will - // break out below, so simpler to do it here. - loc.cacheFormat(dif, i); - - set = getFormatParams(match, dif); - - if (isDefined(set.timestamp)) { - str = set.timestamp; - set = null; - break; - } - - if (isDefined(set.ampm)) { - handleAmpm(set.ampm); - } - - if (set.utc || isDefined(set.tzHour)) { - handleTimezoneOffset(set.tzHour, set.tzMinute, set.tzSign); - } - - if (isDefined(set.shift) && isUndefined(set.unit)) { - // "next january", "next monday", etc - handleUnitlessShift(); - } - - if (isDefined(set.num) && isUndefined(set.unit)) { - // "the second of January", etc - handleUnitlessNum(set.num); - } - - if (set.midday) { - // "noon" and "midnight" - handleMidday(set.midday); - } - - if (isDefined(set.day)) { - // Relative day localizations such as "today" and "tomorrow". - handleRelativeDay(set.day); - } - - if (isDefined(set.unit)) { - // "3 days ago", etc - handleRelativeUnit(set.unit); - } - - if (set.edge) { - // "the end of January", etc - handleEdge(set.edge, set); - } - - if (set.yearSign) { - set.year *= set.yearSign; - } - - break; - } - } - - if (!set) { - // Fall back to native parsing - date = new Date(str); - if (getOwn(options, 'fromUTC')) { - // Falling back to system date here which cannot be parsed as UTC, - // so if we're forcing UTC then simply add the offset. - date.setTime(date.getTime() + (tzOffset(date) * MINUTES)); - } - } else if (relative) { - updateDate(date, set, false, 1); - } else { - if (_utc(date)) { - // UTC times can traverse into other days or even months, - // so preemtively reset the time here to prevent this. - resetTime(date); - } - updateDate(date, set, true, 0, getOwn(options, 'prefer'), weekdayDir); - } - fireCallbacks(); - return date; - } - - function handleAmpm(ampm) { - if (ampm === 1 && set.hour < 12) { - // If the time is 1pm-11pm advance the time by 12 hours. - set.hour += 12; - } else if (ampm === 0 && set.hour === 12) { - // If it is 12:00am then set the hour to 0. - set.hour = 0; - } - } - - function handleTimezoneOffset(tzHour, tzMinute, tzSign) { - // Adjust for timezone offset - _utc(date, true); - var offset = (tzSign || 1) * ((tzHour || 0) * 60 + (tzMinute || 0)); - if (offset) { - set.minute = (set.minute || 0) - offset; - } - } - - function handleUnitlessShift() { - if (isDefined(set.month)) { - // "next January" - set.unit = YEAR_INDEX; - } else if (isDefined(set.weekday)) { - // "next Monday" - set.unit = WEEK_INDEX; - } - } - - function handleUnitlessNum(num) { - if (isDefined(set.weekday)) { - // "The second Tuesday of March" - setOrdinalWeekday(num); - } else if (isDefined(set.month)) { - // "The second of March" - set.date = set.num; - } - } - - function handleMidday(hour) { - set.hour = hour % 24; - if (hour > 23) { - // If the date has hours past 24, we need to prevent it from traversing - // into a new day as that would make it being part of a new week in - // ambiguous dates such as "Monday". - afterDateSet(function() { - advanceDate(date, 'date', trunc(hour / 24)); - }); - } - } - - function handleRelativeDay() { - resetTime(date); - if (isUndefined(set.unit)) { - set.unit = DAY_INDEX; - set.num = set.day; - delete set.day; - } - } - - function handleRelativeUnit(unitIndex) { - var num = isDefined(set.num) ? set.num : 1; - - // If a weekday is defined, there are 3 possible formats being applied: - // - // 1. "the day after monday": unit is days - // 2. "next monday": short for "next week monday", unit is weeks - // 3. "the 2nd monday of next month": unit is months - // - // In the first case, we need to set the weekday up front, as the day is - // relative to it. The second case also needs to be handled up front for - // formats like "next monday at midnight" which will have its weekday reset - // if not set up front. The last case will set up the params necessary to - // shift the weekday and allow separateAbsoluteUnits below to handle setting - // it after the date has been shifted. - if(isDefined(set.weekday)) { - if(unitIndex === MONTH_INDEX) { - setOrdinalWeekday(num); - num = 1; - } else { - updateDate(date, { weekday: set.weekday }, true); - delete set.weekday; - } - } - - if (set.half) { - // Allow localized "half" as a standalone colloquialism. Purposely avoiding - // the locale number system to reduce complexity. The units "month" and - // "week" are purposely excluded in the English date formats below, as - // "half a week" and "half a month" are meaningless as exact dates. - num *= set.half; - } - - if (isDefined(set.shift)) { - // Shift and unit, ie "next month", "last week", etc. - num *= set.shift; - } else if (set.sign) { - // Unit and sign, ie "months ago", "weeks from now", etc. - num *= set.sign; - } - - if (isDefined(set.day)) { - // "the day after tomorrow" - num += set.day; - delete set.day; - } - - // Formats like "the 15th of last month" or "6:30pm of next week" - // contain absolute units in addition to relative ones, so separate - // them here, remove them from the params, and set up a callback to - // set them after the relative ones have been set. - separateAbsoluteUnits(unitIndex); - - // Finally shift the unit. - set[English.units[unitIndex]] = num; - relative = true; - } - - function handleEdge(edge, params) { - var edgeIndex = params.unit, weekdayOfMonth; - if (!edgeIndex) { - // If we have "the end of January", then we need to find the unit index. - iterateOverHigherDateParams(params, function(unitName, val, unit, i) { - if (unitName === 'weekday' && isDefined(params.month)) { - // If both a month and weekday exist, then we have a format like - // "the last tuesday in November, 2012", where the "last" is still - // relative to the end of the month, so prevent the unit "weekday" - // from taking over. - return; - } - edgeIndex = i; - }); - } - if (edgeIndex === MONTH_INDEX && isDefined(params.weekday)) { - // If a weekday in a month exists (as described above), - // then set it up to be set after the date has been shifted. - weekdayOfMonth = params.weekday; - delete params.weekday; - } - afterDateSet(function() { - var stopIndex; - // "edge" values that are at the very edge are "2" so the beginning of the - // year is -2 and the end of the year is 2. Conversely, the "last day" is - // actually 00:00am so it is 1. -1 is reserved but unused for now. - if (edge < 0) { - moveToBeginningOfUnit(date, edgeIndex, getOwn(options, 'locale')); - } else if (edge > 0) { - if (edge === 1) { - stopIndex = DAY_INDEX; - moveToBeginningOfUnit(date, DAY_INDEX); - } - moveToEndOfUnit(date, edgeIndex, getOwn(options, 'locale'), stopIndex); - } - if (isDefined(weekdayOfMonth)) { - setWeekday(date, weekdayOfMonth, -edge); - resetTime(date); - } - }); - if (edgeIndex === MONTH_INDEX) { - params.specificity = DAY_INDEX; - } else { - params.specificity = edgeIndex - 1; - } - } - - function setOrdinalWeekday(num) { - // If we have "the 2nd Tuesday of June", then pass the "weekdayDir" - // flag along to updateDate so that the date does not accidentally traverse - // into the previous month. This needs to be independent of the "prefer" - // flag because we are only ensuring that the weekday is in the future, not - // the entire date. - set.weekday = 7 * (num - 1) + set.weekday; - set.date = 1; - weekdayDir = 1; - } - - function separateAbsoluteUnits(unitIndex) { - var params; - - iterateOverDateParams(set, function(name, val, unit, i) { - // If there is a time unit set that is more specific than - // the matched unit we have a string like "5:30am in 2 minutes", - // which is meaningless, so invalidate the date... - if (i >= unitIndex) { - date.setTime(NaN); - return false; - } else if (i < unitIndex) { - // ...otherwise set the params to set the absolute date - // as a callback after the relative date has been set. - params = params || {}; - params[name] = val; - deleteDateParam(set, name); - } - }); - if (params) { - afterDateSet(function() { - updateDate(date, params, true, false, getOwn(options, 'prefer'), weekdayDir); - }); - if (set.edge) { - // "the end of March of next year" - handleEdge(set.edge, params); - delete set.edge; - } - } - } - - if (contextDate && d) { - // If a context date is passed ("get" and "unitsFromNow"), - // then use it as the starting point. - date = cloneDateByFlag(contextDate, true); - } else { - date = getNewDate(); - } - - _utc(date, getOwn(options, 'fromUTC')); - - if (isString(d)) { - date = parseStringDate(d); - } else if (isDate(d)) { - date = cloneDateByFlag(d, hasOwn(options, 'clone') || forceClone); - } else if (isObjectType(d)) { - set = simpleClone(d); - updateDate(date, set, true); - } else if (isNumber(d) || d === null) { - date.setTime(d); - } - // A date created by parsing a string presumes that the format *itself* is - // UTC, but not that the date, once created, should be manipulated as such. In - // other words, if you are creating a date object from a server time - // "2012-11-15T12:00:00Z", in the majority of cases you are using it to create - // a date that will, after creation, be manipulated as local, so reset the utc - // flag here unless "setUTC" is also set. - _utc(date, !!getOwn(options, 'setUTC')); - return { - set: set, - date: date - }; - } - - module.exports = getExtendedDate; - -/***/ }, -/* 96 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = 60 * 1000; - -/***/ }, -/* 97 */ -/***/ function(module, exports) { - - 'use strict'; - - function tzOffset(d) { - return d.getTimezoneOffset(); - } - - module.exports = tzOffset; - -/***/ }, -/* 98 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnitIndexes = __webpack_require__(82), - setUnitAndLowerToEdge = __webpack_require__(99); - - var HOURS_INDEX = DateUnitIndexes.HOURS_INDEX; - - function resetTime(d) { - return setUnitAndLowerToEdge(d, HOURS_INDEX); - } - - module.exports = resetTime; - -/***/ }, -/* 99 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var isDefined = __webpack_require__(57), - classChecks = __webpack_require__(60), - callDateSet = __webpack_require__(100), - walkUnitDown = __webpack_require__(101); - - var isFunction = classChecks.isFunction; - - function setUnitAndLowerToEdge(d, startIndex, stopIndex, end) { - walkUnitDown(startIndex, function(unit, i) { - var val = end ? unit.end : unit.start; - if (isFunction(val)) { - val = val(d); - } - callDateSet(d, unit.method, val); - return !isDefined(stopIndex) || i > stopIndex; - }); - return d; - } - - module.exports = setUnitAndLowerToEdge; - -/***/ }, -/* 100 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _utc = __webpack_require__(78), - callDateGet = __webpack_require__(77); - - function callDateSet(d, method, value, safe) { - // "Safe" denotes not setting the date if the value is the same as what is - // currently set. In theory this should be a noop, however it will cause - // timezone shifts when in the middle of a DST fallback. This is unavoidable - // as the notation itself is ambiguous (i.e. there are two "1:00ams" on - // November 1st, 2015 in northern hemisphere timezones that follow DST), - // however when advancing or rewinding dates this can throw off calculations - // so avoiding this unintentional shifting on an opt-in basis. - if (safe && value === callDateGet(d, method, value)) { - return; - } - d['set' + (_utc(d) ? 'UTC' : '') + method](value); - } - - module.exports = callDateSet; - -/***/ }, -/* 101 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnits = __webpack_require__(74), - getLowerUnitIndex = __webpack_require__(102); - - function walkUnitDown(unitIndex, fn) { - while (unitIndex >= 0) { - if (fn(DateUnits[unitIndex], unitIndex) === false) { - break; - } - unitIndex = getLowerUnitIndex(unitIndex); - } - } - - module.exports = walkUnitDown; - -/***/ }, -/* 102 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnitIndexes = __webpack_require__(82); - - var HOURS_INDEX = DateUnitIndexes.HOURS_INDEX, - DAY_INDEX = DateUnitIndexes.DAY_INDEX, - WEEK_INDEX = DateUnitIndexes.WEEK_INDEX, - MONTH_INDEX = DateUnitIndexes.MONTH_INDEX; - - function getLowerUnitIndex(index) { - if (index === MONTH_INDEX) { - return DAY_INDEX; - } else if (index === WEEK_INDEX) { - return HOURS_INDEX; - } - return index - 1; - } - - module.exports = getLowerUnitIndex; - -/***/ }, -/* 103 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var setDate = __webpack_require__(104), - getDate = __webpack_require__(105), - getWeekday = __webpack_require__(106), - classChecks = __webpack_require__(60), - mathAliases = __webpack_require__(69); - - var isNumber = classChecks.isNumber, - abs = mathAliases.abs; - - function setWeekday(d, dow, dir) { - if (!isNumber(dow)) return; - var currentWeekday = getWeekday(d); - if (dir) { - // Allow a "direction" parameter to determine whether a weekday can - // be set beyond the current weekday in either direction. - var ndir = dir > 0 ? 1 : -1; - var offset = dow % 7 - currentWeekday; - if (offset && offset / abs(offset) !== ndir) { - dow += 7 * ndir; - } - } - setDate(d, getDate(d) + dow - currentWeekday); - return d.getTime(); - } - - module.exports = setWeekday; - -/***/ }, -/* 104 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var callDateSet = __webpack_require__(100); - - function setDate(d, val) { - callDateSet(d, 'Date', val); - } - - module.exports = setDate; - -/***/ }, -/* 105 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var callDateGet = __webpack_require__(77); - - function getDate(d) { - return callDateGet(d, 'Date'); - } - - module.exports = getDate; - -/***/ }, -/* 106 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var callDateGet = __webpack_require__(77); - - function getWeekday(d) { - return callDateGet(d, 'Day'); - } - - module.exports = getWeekday; - -/***/ }, -/* 107 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnits = __webpack_require__(74), - DateUnitIndexes = __webpack_require__(82), - trunc = __webpack_require__(89), - setDate = __webpack_require__(104), - getDate = __webpack_require__(105), - getMonth = __webpack_require__(81), - getNewDate = __webpack_require__(108), - setWeekday = __webpack_require__(103), - mathAliases = __webpack_require__(69), - callDateGet = __webpack_require__(77), - classChecks = __webpack_require__(60), - resetLowerUnits = __webpack_require__(115), - getLowerUnitIndex = __webpack_require__(102), - getHigherUnitIndex = __webpack_require__(116), - callDateSetWithWeek = __webpack_require__(117), - iterateOverDateParams = __webpack_require__(124); - - var DAY_INDEX = DateUnitIndexes.DAY_INDEX, - WEEK_INDEX = DateUnitIndexes.WEEK_INDEX, - MONTH_INDEX = DateUnitIndexes.MONTH_INDEX, - YEAR_INDEX = DateUnitIndexes.YEAR_INDEX, - round = mathAliases.round, - isNumber = classChecks.isNumber; - - function updateDate(d, params, reset, advance, prefer, weekdayDir) { - var upperUnitIndex; - - function setUpperUnit(unitName, unitIndex) { - if (prefer && !upperUnitIndex) { - if (unitName === 'weekday') { - upperUnitIndex = WEEK_INDEX; - } else { - upperUnitIndex = getHigherUnitIndex(unitIndex); - } - } - } - - function setSpecificity(unitIndex) { - // Other functions may preemptively set the specificity before arriving - // here so concede to them if they have already set more specific units. - if (unitIndex > params.specificity) { - return; - } - params.specificity = unitIndex; - } - - function canDisambiguate() { - if (!upperUnitIndex || upperUnitIndex > YEAR_INDEX) { - return; - } - switch(prefer) { - case -1: return d > getNewDate(); - case 1: return d < getNewDate(); - } - } - - function disambiguateHigherUnit() { - var unit = DateUnits[upperUnitIndex]; - advance = prefer; - setUnit(unit.name, 1, unit, upperUnitIndex); - } - - function handleFraction(unit, unitIndex, fraction) { - if (unitIndex) { - var lowerUnit = DateUnits[getLowerUnitIndex(unitIndex)]; - var val = round(unit.multiplier / lowerUnit.multiplier * fraction); - params[lowerUnit.name] = val; - } - } - - function monthHasShifted(d, targetMonth) { - if (targetMonth < 0) { - targetMonth = targetMonth % 12 + 12; - } - return targetMonth % 12 !== getMonth(d); - } - - function setUnit(unitName, value, unit, unitIndex) { - var method = unit.method, checkMonth, fraction; - - setUpperUnit(unitName, unitIndex); - setSpecificity(unitIndex); - - fraction = value % 1; - if (fraction) { - handleFraction(unit, unitIndex, fraction); - value = trunc(value); - } - - if (unitName === 'weekday') { - if (!advance) { - // Weekdays are always considered absolute units so simply set them - // here even if it is an "advance" operation. This is to help avoid - // ambiguous meanings in "advance" as well as to neatly allow formats - // like "Wednesday of next week" without more complex logic. - setWeekday(d, value, weekdayDir); - } - return; - } - checkMonth = unitIndex === MONTH_INDEX && getDate(d) > 28; - - // If we are advancing or rewinding, then we need we need to set the - // absolute time if the unit is "hours" or less. This is due to the fact - // that setting by method is ambiguous during DST shifts. For example, - // 1:00am on November 1st 2015 occurs twice in North American timezones - // with DST, the second time being after the clocks are rolled back at - // 2:00am. When springing forward this is automatically handled as there - // is no 2:00am so the date automatically jumps to 3:00am. However, when - // rolling back, setHours(2) will always choose the first "2am" even if - // the date is currently set to the second, causing unintended jumps. - // This ambiguity is unavoidable when setting dates as the notation is - // ambiguous. However when advancing, we clearly want the resulting date - // to be an acutal hour ahead, which can only be accomplished by setting - // the absolute time. Conversely, any unit higher than "hours" MUST use - // the internal set methods, as they are ambiguous as absolute units of - // time. Years may be 365 or 366 days depending on leap years, months are - // all over the place, and even days may be 23-25 hours depending on DST - // shifts. Finally, note that the kind of jumping described above will - // occur when calling ANY "set" method on the date and will occur even if - // the value being set is identical to the one currently set (i.e. - // setHours(2) on a date at 2am may not be a noop). This is precarious, - // so avoiding this situation in callDateSet by checking up front that - // the value is not the same before setting. - if (advance && !unit.ambiguous) { - d.setTime(d.getTime() + (value * advance * unit.multiplier)); - return; - } else if (advance) { - if (unitIndex === WEEK_INDEX) { - value *= 7; - method = DateUnits[DAY_INDEX].method; - } - value = (value * advance) + callDateGet(d, method); - } - callDateSetWithWeek(d, method, value, advance); - if (checkMonth && monthHasShifted(d, value)) { - // As we are setting the units in reverse order, there is a chance that - // our date may accidentally traverse into a new month, such as setting - // { month: 1, date 15 } on January 31st. Check for this here and reset - // the date to the last day of the previous month if this has happened. - setDate(d, 0); - } - } - - if (isNumber(params) && advance) { - // If param is a number and advancing, the number is in milliseconds. - params = { millisecond: params }; - } else if (isNumber(params)) { - // Otherwise just set the timestamp and return. - d.setTime(params); - return d; - } - - iterateOverDateParams(params, setUnit); - - if (reset && params.specificity) { - resetLowerUnits(d, params.specificity); - } - - // If past or future is preferred, then the process of "disambiguation" will - // ensure that an ambiguous time/date ("4pm", "thursday", "June", etc.) will - // be in the past or future. Weeks are only considered ambiguous if there is - // a weekday, i.e. "thursday" is an ambiguous week, but "the 4th" is an - // ambiguous month. - if (canDisambiguate()) { - disambiguateHigherUnit(); - } - return d; - } - - module.exports = updateDate; - -/***/ }, -/* 108 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _dateOptions = __webpack_require__(109); - - function getNewDate() { - return _dateOptions('newDateInternal')(); - } - - module.exports = getNewDate; - -/***/ }, -/* 109 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DATE_OPTIONS = __webpack_require__(110), - namespaceAliases = __webpack_require__(112), - defineOptionsAccessor = __webpack_require__(113); - - var sugarDate = namespaceAliases.sugarDate; - - module.exports = defineOptionsAccessor(sugarDate, DATE_OPTIONS); - -/***/ }, -/* 110 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var defaultNewDate = __webpack_require__(111); - - var DATE_OPTIONS = { - 'newDateInternal': defaultNewDate - }; - - module.exports = DATE_OPTIONS; - -/***/ }, -/* 111 */ -/***/ function(module, exports) { - - 'use strict'; - - function defaultNewDate() { - return new Date; - } - - module.exports = defaultNewDate; - -/***/ }, -/* 112 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - module.exports = { - sugarObject: Sugar.Object, - sugarArray: Sugar.Array, - sugarDate: Sugar.Date, - sugarString: Sugar.String, - sugarNumber: Sugar.Number, - sugarFunction: Sugar.Function, - sugarRegExp: Sugar.RegExp - }; - -/***/ }, -/* 113 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var simpleClone = __webpack_require__(42), - defineAccessor = __webpack_require__(114); - - function defineOptionsAccessor(namespace, defaults) { - var obj = simpleClone(defaults); - - function getOption(name) { - return obj[name]; - } - - function setOption(name, val) { - if (val === null) { - val = defaults[name]; - } - obj[name] = val; - } - - defineAccessor(namespace, 'getOption', getOption); - defineAccessor(namespace, 'setOption', setOption); - return getOption; - } - - module.exports = defineOptionsAccessor; - -/***/ }, -/* 114 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var coreUtilityAliases = __webpack_require__(41); - - var setProperty = coreUtilityAliases.setProperty; - - function defineAccessor(namespace, name, fn) { - setProperty(namespace, name, fn); - } - - module.exports = defineAccessor; - -/***/ }, -/* 115 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getLowerUnitIndex = __webpack_require__(102), - setUnitAndLowerToEdge = __webpack_require__(99); - - function resetLowerUnits(d, unitIndex) { - return setUnitAndLowerToEdge(d, getLowerUnitIndex(unitIndex)); - } - - module.exports = resetLowerUnits; - -/***/ }, -/* 116 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnitIndexes = __webpack_require__(82); - - var DAY_INDEX = DateUnitIndexes.DAY_INDEX, - MONTH_INDEX = DateUnitIndexes.MONTH_INDEX; - - function getHigherUnitIndex(index) { - return index === DAY_INDEX ? MONTH_INDEX : index + 1; - } - - module.exports = getHigherUnitIndex; - -/***/ }, -/* 117 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var callDateSet = __webpack_require__(100), - setISOWeekNumber = __webpack_require__(118); - - function callDateSetWithWeek(d, method, value, safe) { - if (method === 'ISOWeek') { - setISOWeekNumber(d, value); - } else { - callDateSet(d, method, value, safe); - } - } - - module.exports = callDateSetWithWeek; - -/***/ }, -/* 118 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var ISODefaults = __webpack_require__(47), - getDate = __webpack_require__(105), - setDate = __webpack_require__(104), - setYear = __webpack_require__(119), - getYear = __webpack_require__(76), - getMonth = __webpack_require__(81), - setMonth = __webpack_require__(120), - cloneDate = __webpack_require__(121), - getWeekday = __webpack_require__(106), - setWeekday = __webpack_require__(103), - classChecks = __webpack_require__(60), - moveToFirstDayOfWeekYear = __webpack_require__(122); - - var isNumber = classChecks.isNumber, - ISO_FIRST_DAY_OF_WEEK = ISODefaults.ISO_FIRST_DAY_OF_WEEK, - ISO_FIRST_DAY_OF_WEEK_YEAR = ISODefaults.ISO_FIRST_DAY_OF_WEEK_YEAR; - - function setISOWeekNumber(d, num) { - if (isNumber(num)) { - // Intentionally avoiding updateDate here to prevent circular dependencies. - var isoWeek = cloneDate(d), dow = getWeekday(d); - moveToFirstDayOfWeekYear(isoWeek, ISO_FIRST_DAY_OF_WEEK, ISO_FIRST_DAY_OF_WEEK_YEAR); - setDate(isoWeek, getDate(isoWeek) + 7 * (num - 1)); - setYear(d, getYear(isoWeek)); - setMonth(d, getMonth(isoWeek)); - setDate(d, getDate(isoWeek)); - setWeekday(d, dow || 7); - } - return d.getTime(); - } - - module.exports = setISOWeekNumber; - -/***/ }, -/* 119 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var callDateSet = __webpack_require__(100); - - function setYear(d, val) { - callDateSet(d, 'FullYear', val); - } - - module.exports = setYear; - -/***/ }, -/* 120 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var callDateSet = __webpack_require__(100); - - function setMonth(d, val) { - callDateSet(d, 'Month', val); - } - - module.exports = setMonth; - -/***/ }, -/* 121 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _utc = __webpack_require__(78); - - function cloneDate(d) { - // Rhino environments have a bug where new Date(d) truncates - // milliseconds so need to call getTime() here. - var clone = new Date(d.getTime()); - _utc(clone, !!_utc(d)); - return clone; - } - - module.exports = cloneDate; - -/***/ }, -/* 122 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnitIndexes = __webpack_require__(82), - setDate = __webpack_require__(104), - setUnitAndLowerToEdge = __webpack_require__(99), - moveToBeginningOfWeek = __webpack_require__(123); - - var MONTH_INDEX = DateUnitIndexes.MONTH_INDEX; - - function moveToFirstDayOfWeekYear(d, firstDayOfWeek, firstDayOfWeekYear) { - setUnitAndLowerToEdge(d, MONTH_INDEX); - setDate(d, firstDayOfWeekYear); - moveToBeginningOfWeek(d, firstDayOfWeek); - } - - module.exports = moveToFirstDayOfWeekYear; - -/***/ }, -/* 123 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var setWeekday = __webpack_require__(103), - getWeekday = __webpack_require__(106), - mathAliases = __webpack_require__(69); - - var floor = mathAliases.floor; - - function moveToBeginningOfWeek(d, firstDayOfWeek) { - setWeekday(d, floor((getWeekday(d) - firstDayOfWeek) / 7) * 7 + firstDayOfWeek); - return d; - } - - module.exports = moveToBeginningOfWeek; - -/***/ }, -/* 124 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnitIndexes = __webpack_require__(82), - isDefined = __webpack_require__(57), - getDateParam = __webpack_require__(125), - iterateOverDateUnits = __webpack_require__(73); - - var DAY_INDEX = DateUnitIndexes.DAY_INDEX; - - function iterateOverDateParams(params, fn, startIndex, endIndex) { - - function run(name, unit, i) { - var val = getDateParam(params, name); - if (isDefined(val)) { - fn(name, val, unit, i); - } - } - - iterateOverDateUnits(function (unit, i) { - var result = run(unit.name, unit, i); - if (result !== false && i === DAY_INDEX) { - // Check for "weekday", which has a distinct meaning - // in the context of setting a date, but has the same - // meaning as "day" as a unit of time. - result = run('weekday', unit, i); - } - return result; - }, startIndex, endIndex); - - } - - module.exports = iterateOverDateParams; - -/***/ }, -/* 125 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getDateParamKey = __webpack_require__(126), - coreUtilityAliases = __webpack_require__(41); - - var getOwn = coreUtilityAliases.getOwn; - - function getDateParam(params, key) { - return getOwn(params, getDateParamKey(params, key)); - } - - module.exports = getDateParam; - -/***/ }, -/* 126 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getOwnKey = __webpack_require__(127); - - function getDateParamKey(params, key) { - return getOwnKey(params, key) || - getOwnKey(params, key + 's') || - (key === 'day' && getOwnKey(params, 'date')); - } - - module.exports = getDateParamKey; - -/***/ }, -/* 127 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var coreUtilityAliases = __webpack_require__(41); - - var hasOwn = coreUtilityAliases.hasOwn; - - function getOwnKey(obj, key) { - if (hasOwn(obj, key)) { - return key; - } - } - - module.exports = getOwnKey; - -/***/ }, -/* 128 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var updateDate = __webpack_require__(107); - - function advanceDate(d, unit, num, reset) { - var set = {}; - set[unit] = num; - return updateDate(d, set, reset, 1); - } - - module.exports = advanceDate; - -/***/ }, -/* 129 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LocaleHelpers = __webpack_require__(35), - DateUnitIndexes = __webpack_require__(82), - moveToEndOfWeek = __webpack_require__(130), - getLowerUnitIndex = __webpack_require__(102), - setUnitAndLowerToEdge = __webpack_require__(99); - - var WEEK_INDEX = DateUnitIndexes.WEEK_INDEX, - localeManager = LocaleHelpers.localeManager; - - function moveToEndOfUnit(d, unitIndex, localeCode, stopIndex) { - if (unitIndex === WEEK_INDEX) { - moveToEndOfWeek(d, localeManager.get(localeCode).getFirstDayOfWeek()); - } - return setUnitAndLowerToEdge(d, getLowerUnitIndex(unitIndex), stopIndex, true); - } - - module.exports = moveToEndOfUnit; - -/***/ }, -/* 130 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var setWeekday = __webpack_require__(103), - getWeekday = __webpack_require__(106), - mathAliases = __webpack_require__(69); - - var ceil = mathAliases.ceil; - - function moveToEndOfWeek(d, firstDayOfWeek) { - var target = firstDayOfWeek - 1; - setWeekday(d, ceil((getWeekday(d) - target) / 7) * 7 + target); - return d; - } - - module.exports = moveToEndOfWeek; - -/***/ }, -/* 131 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getDateParamKey = __webpack_require__(126); - - function deleteDateParam(params, key) { - delete params[getDateParamKey(params, key)]; - } - - module.exports = deleteDateParam; - -/***/ }, -/* 132 */ -/***/ function(module, exports) { - - 'use strict'; - - function getParsingTokenValue(token, str) { - var val; - if (token.val) { - val = token.val; - } else if (token.sign) { - val = str === '+' ? 1 : -1; - } else if (token.bool) { - val = !!val; - } else { - val = +str.replace(/,/, '.'); - } - if (token.param === 'month') { - val -= 1; - } - return val; - } - - module.exports = getParsingTokenValue; - -/***/ }, -/* 133 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LocaleHelpers = __webpack_require__(35), - DateUnitIndexes = __webpack_require__(82), - getLowerUnitIndex = __webpack_require__(102), - moveToBeginningOfWeek = __webpack_require__(123), - setUnitAndLowerToEdge = __webpack_require__(99); - - var WEEK_INDEX = DateUnitIndexes.WEEK_INDEX, - localeManager = LocaleHelpers.localeManager; - - function moveToBeginningOfUnit(d, unitIndex, localeCode) { - if (unitIndex === WEEK_INDEX) { - moveToBeginningOfWeek(d, localeManager.get(localeCode).getFirstDayOfWeek()); - } - return setUnitAndLowerToEdge(d, getLowerUnitIndex(unitIndex)); - } - - module.exports = moveToBeginningOfUnit; - -/***/ }, -/* 134 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getYear = __webpack_require__(76), - mathAliases = __webpack_require__(69); - - var abs = mathAliases.abs; - - function getYearFromAbbreviation(str, d, prefer) { - // Following IETF here, adding 1900 or 2000 depending on the last two digits. - // Note that this makes no accordance for what should happen after 2050, but - // intentionally ignoring this for now. https://www.ietf.org/rfc/rfc2822.txt - var val = +str, delta; - val += val < 50 ? 2000 : 1900; - if (prefer) { - delta = val - getYear(d); - if (delta / abs(delta) !== prefer) { - val += prefer * 100; - } - } - return val; - } - - module.exports = getYearFromAbbreviation; - -/***/ }, -/* 135 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnitIndexes = __webpack_require__(82), - iterateOverDateParams = __webpack_require__(124); - - var DAY_INDEX = DateUnitIndexes.DAY_INDEX, - YEAR_INDEX = DateUnitIndexes.YEAR_INDEX; - - function iterateOverHigherDateParams(params, fn) { - iterateOverDateParams(params, fn, YEAR_INDEX, DAY_INDEX); - } - - module.exports = iterateOverHigherDateParams; - -/***/ }, -/* 136 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var setDateChainableConstructor = __webpack_require__(137); - - setDateChainableConstructor(); - -/***/ }, -/* 137 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var createDate = __webpack_require__(94), - namespaceAliases = __webpack_require__(112), - setChainableConstructor = __webpack_require__(138); - - var sugarDate = namespaceAliases.sugarDate; - - function setDateChainableConstructor() { - setChainableConstructor(sugarDate, createDate); - } - - module.exports = setDateChainableConstructor; - -/***/ }, -/* 138 */ -/***/ function(module, exports) { - - 'use strict'; - - function setChainableConstructor(sugarNamespace, createFn) { - sugarNamespace.prototype.constructor = function() { - return createFn.apply(this, arguments); - }; - } - - module.exports = setChainableConstructor; - -/***/ }, -/* 139 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - LocaleHelpers = __webpack_require__(35), - getKeys = __webpack_require__(140); - - var localeManager = LocaleHelpers.localeManager; - - Sugar.Date.defineStatic({ - - 'getAllLocaleCodes': function() { - return getKeys(localeManager.getAll()); - } - - }); - - module.exports = Sugar.Date.getAllLocaleCodes; - -/***/ }, -/* 140 */ -/***/ function(module, exports) { - - 'use strict'; - - function getKeys(obj) { - return Object.keys(obj); - } - - module.exports = getKeys; - -/***/ }, -/* 141 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - LocaleHelpers = __webpack_require__(35); - - var localeManager = LocaleHelpers.localeManager; - - Sugar.Date.defineStatic({ - - 'getAllLocales': function() { - return localeManager.getAll(); - } - - }); - - module.exports = Sugar.Date.getAllLocales; - -/***/ }, -/* 142 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - LocaleHelpers = __webpack_require__(35); - - var localeManager = LocaleHelpers.localeManager; - - Sugar.Date.defineStatic({ - - 'getLocale': function(code) { - return localeManager.get(code, !code); - } - - }); - - module.exports = Sugar.Date.getLocale; - -/***/ }, -/* 143 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - LocaleHelpers = __webpack_require__(35); - - var localeManager = LocaleHelpers.localeManager; - - Sugar.Date.defineStatic({ - - 'removeLocale': function(code) { - return localeManager.remove(code); - } - - }); - - module.exports = Sugar.Date.removeLocale; - -/***/ }, -/* 144 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - LocaleHelpers = __webpack_require__(35); - - var localeManager = LocaleHelpers.localeManager; - - Sugar.Date.defineStatic({ - - 'setLocale': function(code) { - return localeManager.set(code); - } - - }); - - module.exports = Sugar.Date.setLocale; - -/***/ }, -/* 145 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.day; - -/***/ }, -/* 146 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var buildNumberUnitMethods = __webpack_require__(147); - - buildNumberUnitMethods(); - -/***/ }, -/* 147 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnits = __webpack_require__(74), - createDate = __webpack_require__(94), - mathAliases = __webpack_require__(69), - advanceDate = __webpack_require__(128), - namespaceAliases = __webpack_require__(112), - defineInstanceSimilar = __webpack_require__(148); - - var sugarNumber = namespaceAliases.sugarNumber, - round = mathAliases.round; - - function buildNumberUnitMethods() { - defineInstanceSimilar(sugarNumber, DateUnits, function(methods, unit) { - var name = unit.name, base, after, before; - base = function(n) { - return round(n * unit.multiplier); - }; - after = function(n, d, options) { - return advanceDate(createDate(d, options, true), name, n); - }; - before = function(n, d, options) { - return advanceDate(createDate(d, options, true), name, -n); - }; - methods[name] = base; - methods[name + 's'] = base; - methods[name + 'Before'] = before; - methods[name + 'sBefore'] = before; - methods[name + 'Ago'] = before; - methods[name + 'sAgo'] = before; - methods[name + 'After'] = after; - methods[name + 'sAfter'] = after; - methods[name + 'FromNow'] = after; - methods[name + 'sFromNow'] = after; - }); - } - - module.exports = buildNumberUnitMethods; - -/***/ }, -/* 148 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var methodDefineAliases = __webpack_require__(149), - collectSimilarMethods = __webpack_require__(151); - - var defineInstance = methodDefineAliases.defineInstance; - - function defineInstanceSimilar(sugarNamespace, set, fn, flags) { - defineInstance(sugarNamespace, collectSimilarMethods(set, fn), flags); - } - - module.exports = defineInstanceSimilar; - -/***/ }, -/* 149 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var wrapNamespace = __webpack_require__(150); - - module.exports = { - alias: wrapNamespace('alias'), - defineStatic: wrapNamespace('defineStatic'), - defineInstance: wrapNamespace('defineInstance'), - defineStaticPolyfill: wrapNamespace('defineStaticPolyfill'), - defineInstancePolyfill: wrapNamespace('defineInstancePolyfill'), - defineInstanceAndStatic: wrapNamespace('defineInstanceAndStatic'), - defineInstanceWithArguments: wrapNamespace('defineInstanceWithArguments') - }; - -/***/ }, -/* 150 */ -/***/ function(module, exports) { - - 'use strict'; - - function wrapNamespace(method) { - return function(sugarNamespace, arg1, arg2) { - sugarNamespace[method](arg1, arg2); - }; - } - - module.exports = wrapNamespace; - -/***/ }, -/* 151 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var forEach = __webpack_require__(53), - spaceSplit = __webpack_require__(63), - classChecks = __webpack_require__(60); - - var isString = classChecks.isString; - - function collectSimilarMethods(set, fn) { - var methods = {}; - if (isString(set)) { - set = spaceSplit(set); - } - forEach(set, function(el, i) { - fn(methods, el, i); - }); - return methods; - } - - module.exports = collectSimilarMethods; - -/***/ }, -/* 152 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.dayAfter; - -/***/ }, -/* 153 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.dayAgo; - -/***/ }, -/* 154 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.dayBefore; - -/***/ }, -/* 155 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.dayFromNow; - -/***/ }, -/* 156 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.days; - -/***/ }, -/* 157 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.daysAfter; - -/***/ }, -/* 158 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.daysAgo; - -/***/ }, -/* 159 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.daysBefore; - -/***/ }, -/* 160 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.daysFromNow; - -/***/ }, -/* 161 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - LocaleHelpers = __webpack_require__(35); - - var localeManager = LocaleHelpers.localeManager; - - Sugar.Number.defineInstance({ - - 'duration': function(n, localeCode) { - return localeManager.get(localeCode).getDuration(n); - } - - }); - - module.exports = Sugar.Number.duration; - -/***/ }, -/* 162 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hour; - -/***/ }, -/* 163 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hourAfter; - -/***/ }, -/* 164 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hourAgo; - -/***/ }, -/* 165 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hourBefore; - -/***/ }, -/* 166 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hourFromNow; - -/***/ }, -/* 167 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hours; - -/***/ }, -/* 168 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hoursAfter; - -/***/ }, -/* 169 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hoursAgo; - -/***/ }, -/* 170 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hoursBefore; - -/***/ }, -/* 171 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.hoursFromNow; - -/***/ }, -/* 172 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.millisecond; - -/***/ }, -/* 173 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.millisecondAfter; - -/***/ }, -/* 174 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.millisecondAgo; - -/***/ }, -/* 175 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.millisecondBefore; - -/***/ }, -/* 176 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.millisecondFromNow; - -/***/ }, -/* 177 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.milliseconds; - -/***/ }, -/* 178 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.millisecondsAfter; - -/***/ }, -/* 179 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.millisecondsAgo; - -/***/ }, -/* 180 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.millisecondsBefore; - -/***/ }, -/* 181 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.millisecondsFromNow; - -/***/ }, -/* 182 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minute; - -/***/ }, -/* 183 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minuteAfter; - -/***/ }, -/* 184 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minuteAgo; - -/***/ }, -/* 185 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minuteBefore; - -/***/ }, -/* 186 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minuteFromNow; - -/***/ }, -/* 187 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minutes; - -/***/ }, -/* 188 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minutesAfter; - -/***/ }, -/* 189 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minutesAgo; - -/***/ }, -/* 190 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minutesBefore; - -/***/ }, -/* 191 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.minutesFromNow; - -/***/ }, -/* 192 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.month; - -/***/ }, -/* 193 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.monthAfter; - -/***/ }, -/* 194 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.monthAgo; - -/***/ }, -/* 195 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.monthBefore; - -/***/ }, -/* 196 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.monthFromNow; - -/***/ }, -/* 197 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.months; - -/***/ }, -/* 198 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.monthsAfter; - -/***/ }, -/* 199 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.monthsAgo; - -/***/ }, -/* 200 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.monthsBefore; - -/***/ }, -/* 201 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.monthsFromNow; - -/***/ }, -/* 202 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.second; - -/***/ }, -/* 203 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.secondAfter; - -/***/ }, -/* 204 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.secondAgo; - -/***/ }, -/* 205 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.secondBefore; - -/***/ }, -/* 206 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.secondFromNow; - -/***/ }, -/* 207 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.seconds; - -/***/ }, -/* 208 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.secondsAfter; - -/***/ }, -/* 209 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.secondsAgo; - -/***/ }, -/* 210 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.secondsBefore; - -/***/ }, -/* 211 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.secondsFromNow; - -/***/ }, -/* 212 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.week; - -/***/ }, -/* 213 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.weekAfter; - -/***/ }, -/* 214 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.weekAgo; - -/***/ }, -/* 215 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.weekBefore; - -/***/ }, -/* 216 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.weekFromNow; - -/***/ }, -/* 217 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.weeks; - -/***/ }, -/* 218 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.weeksAfter; - -/***/ }, -/* 219 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.weeksAgo; - -/***/ }, -/* 220 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.weeksBefore; - -/***/ }, -/* 221 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.weeksFromNow; - -/***/ }, -/* 222 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.year; - -/***/ }, -/* 223 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.yearAfter; - -/***/ }, -/* 224 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.yearAgo; - -/***/ }, -/* 225 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.yearBefore; - -/***/ }, -/* 226 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.yearFromNow; - -/***/ }, -/* 227 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.years; - -/***/ }, -/* 228 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.yearsAfter; - -/***/ }, -/* 229 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.yearsAgo; - -/***/ }, -/* 230 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.yearsBefore; - -/***/ }, -/* 231 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(146); - - module.exports = Sugar.Number.yearsFromNow; - -/***/ }, -/* 232 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.addDays; - -/***/ }, -/* 233 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var buildDateUnitMethods = __webpack_require__(234); - - buildDateUnitMethods(); - -/***/ }, -/* 234 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnits = __webpack_require__(74), - DateUnitIndexes = __webpack_require__(82), - forEach = __webpack_require__(53), - compareDate = __webpack_require__(235), - advanceDate = __webpack_require__(128), - moveToEndOfUnit = __webpack_require__(129), - simpleCapitalize = __webpack_require__(237), - namespaceAliases = __webpack_require__(112), - defineInstanceSimilar = __webpack_require__(148), - moveToBeginningOfUnit = __webpack_require__(133), - createDateWithContext = __webpack_require__(238), - getTimeDistanceForUnit = __webpack_require__(239); - - var sugarDate = namespaceAliases.sugarDate, - HOURS_INDEX = DateUnitIndexes.HOURS_INDEX, - DAY_INDEX = DateUnitIndexes.DAY_INDEX; - - function buildDateUnitMethods() { - - defineInstanceSimilar(sugarDate, DateUnits, function(methods, unit, index) { - var name = unit.name, caps = simpleCapitalize(name); - - if (index > DAY_INDEX) { - forEach(['Last','This','Next'], function(shift) { - methods['is' + shift + caps] = function(d, localeCode) { - return compareDate(d, shift + ' ' + name, 0, localeCode, { locale: 'en' }); - }; - }); - } - if (index > HOURS_INDEX) { - methods['beginningOf' + caps] = function(d, localeCode) { - return moveToBeginningOfUnit(d, index, localeCode); - }; - methods['endOf' + caps] = function(d, localeCode) { - return moveToEndOfUnit(d, index, localeCode); - }; - } - - methods['add' + caps + 's'] = function(d, num, reset) { - return advanceDate(d, name, num, reset); - }; - - var since = function(date, d, options) { - return getTimeDistanceForUnit(date, createDateWithContext(date, d, options, true), unit); - }; - var until = function(date, d, options) { - return getTimeDistanceForUnit(createDateWithContext(date, d, options, true), date, unit); - }; - - methods[name + 'sAgo'] = methods[name + 'sUntil'] = until; - methods[name + 'sSince'] = methods[name + 'sFromNow'] = since; - - }); - - } - - module.exports = buildDateUnitMethods; - -/***/ }, -/* 235 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var MINUTES = __webpack_require__(96), - DateUnits = __webpack_require__(74), - DateUnitIndexes = __webpack_require__(82), - _utc = __webpack_require__(78), - tzOffset = __webpack_require__(97), - cloneDate = __webpack_require__(121), - isDefined = __webpack_require__(57), - advanceDate = __webpack_require__(128), - dateIsValid = __webpack_require__(236), - moveToEndOfUnit = __webpack_require__(129), - getExtendedDate = __webpack_require__(95), - moveToBeginningOfUnit = __webpack_require__(133); - - var MONTH_INDEX = DateUnitIndexes.MONTH_INDEX; - - function compareDate(date, d, margin, localeCode, options) { - var loMargin = 0, hiMargin = 0, timezoneShift, compareEdges, override, min, max, p, t; - - function getTimezoneShift() { - // If there is any specificity in the date then we're implicitly not - // checking absolute time, so ignore timezone shifts. - if (p.set && p.set.specificity) { - return 0; - } - return (tzOffset(p.date) - tzOffset(date)) * MINUTES; - } - - function addSpecificUnit() { - var unit = DateUnits[p.set.specificity]; - return advanceDate(cloneDate(p.date), unit.name, 1).getTime() - 1; - } - - if (_utc(date)) { - options = options || {}; - options.fromUTC = true; - options.setUTC = true; - } - - p = getExtendedDate(null, d, options, true); - - if (margin > 0) { - loMargin = hiMargin = margin; - override = true; - } - if (!dateIsValid(p.date)) return false; - if (p.set && p.set.specificity) { - if (isDefined(p.set.edge) || isDefined(p.set.shift)) { - compareEdges = true; - moveToBeginningOfUnit(p.date, p.set.specificity, localeCode); - } - if (compareEdges || p.set.specificity === MONTH_INDEX) { - max = moveToEndOfUnit(cloneDate(p.date), p.set.specificity, localeCode).getTime(); - } else { - max = addSpecificUnit(); - } - if (!override && isDefined(p.set.sign) && p.set.specificity) { - // If the time is relative, there can occasionally be an disparity between - // the relative date and "now", which it is being compared to, so set an - // extra margin to account for this. - loMargin = 50; - hiMargin = -50; - } - } - t = date.getTime(); - min = p.date.getTime(); - max = max || min; - timezoneShift = getTimezoneShift(); - if (timezoneShift) { - min -= timezoneShift; - max -= timezoneShift; - } - return t >= (min - loMargin) && t <= (max + hiMargin); - } - - module.exports = compareDate; - -/***/ }, -/* 236 */ -/***/ function(module, exports) { - - 'use strict'; - - function dateIsValid(d) { - return !isNaN(d.getTime()); - } - - module.exports = dateIsValid; - -/***/ }, -/* 237 */ -/***/ function(module, exports) { - - 'use strict'; - - function simpleCapitalize(str) { - return str.charAt(0).toUpperCase() + str.slice(1); - } - - module.exports = simpleCapitalize; - -/***/ }, -/* 238 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getExtendedDate = __webpack_require__(95); - - function createDateWithContext(contextDate, d, options, forceClone) { - return getExtendedDate(contextDate, d, options, forceClone).date; - } - - module.exports = createDateWithContext; - -/***/ }, -/* 239 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var trunc = __webpack_require__(89), - cloneDate = __webpack_require__(121), - advanceDate = __webpack_require__(128); - - function getTimeDistanceForUnit(d1, d2, unit) { - var fwd = d2 > d1, num, tmp; - if (!fwd) { - tmp = d2; - d2 = d1; - d1 = tmp; - } - num = d2 - d1; - if (unit.multiplier > 1) { - num = trunc(num / unit.multiplier); - } - // For higher order with potential ambiguity, use the numeric calculation - // as a starting point, then iterate until we pass the target date. - if (unit.ambiguous) { - d1 = cloneDate(d1); - if (num) { - advanceDate(d1, unit.name, num); - } - while (d1 < d2) { - advanceDate(d1, unit.name, 1); - if (d1 > d2) { - break; - } - num += 1; - } - } - return fwd ? -num : num; - } - - module.exports = getTimeDistanceForUnit; - -/***/ }, -/* 240 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.addHours; - -/***/ }, -/* 241 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.addMilliseconds; - -/***/ }, -/* 242 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.addMinutes; - -/***/ }, -/* 243 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.addMonths; - -/***/ }, -/* 244 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.addSeconds; - -/***/ }, -/* 245 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.addWeeks; - -/***/ }, -/* 246 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.addYears; - -/***/ }, -/* 247 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - advanceDateWithArgs = __webpack_require__(248); - - Sugar.Date.defineInstanceWithArguments({ - - 'advance': function(d, args) { - return advanceDateWithArgs(d, args, 1); - } - - }); - - module.exports = Sugar.Date.advance; - -/***/ }, -/* 248 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var updateDate = __webpack_require__(107), - collectDateArguments = __webpack_require__(249); - - function advanceDateWithArgs(d, args, dir) { - args = collectDateArguments(args, true); - return updateDate(d, args[0], args[1], dir); - } - - module.exports = advanceDateWithArgs; - -/***/ }, -/* 249 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var classChecks = __webpack_require__(60), - simpleClone = __webpack_require__(42), - isObjectType = __webpack_require__(65), - getDateParamsFromString = __webpack_require__(250), - collectDateParamsFromArguments = __webpack_require__(251); - - var isNumber = classChecks.isNumber, - isString = classChecks.isString; - - function collectDateArguments(args, allowDuration) { - var arg1 = args[0], arg2 = args[1]; - if (allowDuration && isString(arg1)) { - arg1 = getDateParamsFromString(arg1); - } else if (isNumber(arg1) && isNumber(arg2)) { - arg1 = collectDateParamsFromArguments(args); - arg2 = null; - } else { - if (isObjectType(arg1)) { - arg1 = simpleClone(arg1); - } - } - return [arg1, arg2]; - } - - module.exports = collectDateArguments; - -/***/ }, -/* 250 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var isUndefined = __webpack_require__(68); - - function getDateParamsFromString(str) { - var match, num, params = {}; - match = str.match(/^(-?\d*[\d.]\d*)?\s?(\w+?)s?$/i); - if (match) { - if (isUndefined(num)) { - num = +match[1]; - if (isNaN(num)) { - num = 1; - } - } - params[match[2].toLowerCase()] = num; - } - return params; - } - - module.exports = getDateParamsFromString; - -/***/ }, -/* 251 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnitIndexes = __webpack_require__(82), - isDefined = __webpack_require__(57), - walkUnitDown = __webpack_require__(101); - - var YEAR_INDEX = DateUnitIndexes.YEAR_INDEX; - - function collectDateParamsFromArguments(args) { - var params = {}, index = 0; - walkUnitDown(YEAR_INDEX, function(unit) { - var arg = args[index++]; - if (isDefined(arg)) { - params[unit.name] = arg; - } - }); - return params; - } - - module.exports = collectDateParamsFromArguments; - -/***/ }, -/* 252 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.beginningOfDay; - -/***/ }, -/* 253 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - resetTime = __webpack_require__(98), - getWeekday = __webpack_require__(106), - setWeekday = __webpack_require__(103); - - Sugar.Date.defineInstance({ - - 'beginningOfISOWeek': function(date) { - var day = getWeekday(date); - if (day === 0) { - day = -6; - } else if (day !== 1) { - day = 1; - } - setWeekday(date, day); - return resetTime(date); - } - - }); - - module.exports = Sugar.Date.beginningOfISOWeek; - -/***/ }, -/* 254 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.beginningOfMonth; - -/***/ }, -/* 255 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.beginningOfWeek; - -/***/ }, -/* 256 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.beginningOfYear; - -/***/ }, -/* 257 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - cloneDate = __webpack_require__(121); - - Sugar.Date.defineInstance({ - - 'clone': function(date) { - return cloneDate(date); - } - - }); - - module.exports = Sugar.Date.clone; - -/***/ }, -/* 258 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.daysAgo; - -/***/ }, -/* 259 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.daysFromNow; - -/***/ }, -/* 260 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - getDaysInMonth = __webpack_require__(75); - - Sugar.Date.defineInstance({ - - 'daysInMonth': function(date) { - return getDaysInMonth(date); - } - - }); - - module.exports = Sugar.Date.daysInMonth; - -/***/ }, -/* 261 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.daysSince; - -/***/ }, -/* 262 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.daysUntil; - -/***/ }, -/* 263 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.endOfDay; - -/***/ }, -/* 264 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - DateUnitIndexes = __webpack_require__(82), - getWeekday = __webpack_require__(106), - setWeekday = __webpack_require__(103), - moveToEndOfUnit = __webpack_require__(129); - - var DAY_INDEX = DateUnitIndexes.DAY_INDEX; - - Sugar.Date.defineInstance({ - - 'endOfISOWeek': function(date) { - if (getWeekday(date) !== 0) { - setWeekday(date, 7); - } - return moveToEndOfUnit(date, DAY_INDEX); - } - - }); - - module.exports = Sugar.Date.endOfISOWeek; - -/***/ }, -/* 265 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.endOfMonth; - -/***/ }, -/* 266 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.endOfWeek; - -/***/ }, -/* 267 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.endOfYear; - -/***/ }, -/* 268 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - dateFormat = __webpack_require__(269); - - Sugar.Date.defineInstance({ - - 'format': function(date, f, localeCode) { - return dateFormat(date, f, localeCode); - } - - }); - - module.exports = Sugar.Date.format; - -/***/ }, -/* 269 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var CoreOutputFormats = __webpack_require__(270), - formattingTokens = __webpack_require__(271), - assertDateIsValid = __webpack_require__(286); - - var dateFormatMatcher = formattingTokens.dateFormatMatcher; - - function dateFormat(d, format, localeCode) { - assertDateIsValid(d); - format = CoreOutputFormats[format] || format || '{long}'; - return dateFormatMatcher(format, d, localeCode); - } - - module.exports = dateFormat; - -/***/ }, -/* 270 */ -/***/ function(module, exports) { - - 'use strict'; - - var CoreOutputFormats = { - 'ISO8601': '{yyyy}-{MM}-{dd}T{HH}:{mm}:{ss}.{SSS}{Z}', - 'RFC1123': '{Dow}, {dd} {Mon} {yyyy} {HH}:{mm}:{ss} {ZZ}', - 'RFC1036': '{Weekday}, {dd}-{Mon}-{yy} {HH}:{mm}:{ss} {ZZ}' - }; - - module.exports = CoreOutputFormats; - -/***/ }, -/* 271 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LocaleHelpers = __webpack_require__(35), - FormatTokensBase = __webpack_require__(272), - CoreOutputFormats = __webpack_require__(270), - forEach = __webpack_require__(53), - padNumber = __webpack_require__(275), - spaceSplit = __webpack_require__(63), - namespaceAliases = __webpack_require__(112), - coreUtilityAliases = __webpack_require__(41), - createFormatMatcher = __webpack_require__(282), - defineInstanceSimilar = __webpack_require__(148); - - var localeManager = LocaleHelpers.localeManager, - hasOwn = coreUtilityAliases.hasOwn, - getOwn = coreUtilityAliases.getOwn, - forEachProperty = coreUtilityAliases.forEachProperty, - sugarDate = namespaceAliases.sugarDate; - - var ldmlTokens, strfTokens; - - function buildDateFormatTokens() { - - function addFormats(target, tokens, fn) { - if (tokens) { - forEach(spaceSplit(tokens), function(token) { - target[token] = fn; - }); - } - } - - function buildLowercase(get) { - return function(d, localeCode) { - return get(d, localeCode).toLowerCase(); - }; - } - - function buildOrdinal(get) { - return function(d, localeCode) { - var n = get(d, localeCode); - return n + localeManager.get(localeCode).getOrdinal(n); - }; - } - - function buildPadded(get, padding) { - return function(d, localeCode) { - return padNumber(get(d, localeCode), padding); - }; - } - - function buildTwoDigits(get) { - return function(d, localeCode) { - return get(d, localeCode) % 100; - }; - } - - function buildAlias(alias) { - return function(d, localeCode) { - return dateFormatMatcher(alias, d, localeCode); - }; - } - - function buildAlternates(f) { - for (var n = 1; n <= 5; n++) { - buildAlternate(f, n); - } - } - - function buildAlternate(f, n) { - var alternate = function(d, localeCode) { - return f.get(d, localeCode, n); - }; - addFormats(ldmlTokens, f.ldml + n, alternate); - if (f.lowerToken) { - ldmlTokens[f.lowerToken + n] = buildLowercase(alternate); - } - } - - function getIdentityFormat(name) { - return function(d, localeCode) { - var loc = localeManager.get(localeCode); - return dateFormatMatcher(loc[name], d, localeCode); - }; - } - - ldmlTokens = {}; - strfTokens = {}; - - forEach(FormatTokensBase, function(f) { - var get = f.get, getPadded; - if (f.lowerToken) { - ldmlTokens[f.lowerToken] = buildLowercase(get); - } - if (f.ordinalToken) { - ldmlTokens[f.ordinalToken] = buildOrdinal(get, f); - } - if (f.ldmlPaddedToken) { - ldmlTokens[f.ldmlPaddedToken] = buildPadded(get, f.ldmlPaddedToken.length); - } - if (f.ldmlTwoDigitToken) { - ldmlTokens[f.ldmlTwoDigitToken] = buildPadded(buildTwoDigits(get), 2); - } - if (f.strfTwoDigitToken) { - strfTokens[f.strfTwoDigitToken] = buildPadded(buildTwoDigits(get), 2); - } - if (f.strfPadding) { - getPadded = buildPadded(get, f.strfPadding); - } - if (f.alias) { - get = buildAlias(f.alias); - } - if (f.allowAlternates) { - buildAlternates(f); - } - addFormats(ldmlTokens, f.ldml, get); - addFormats(strfTokens, f.strf, getPadded || get); - }); - - forEachProperty(CoreOutputFormats, function(src, name) { - addFormats(ldmlTokens, name, buildAlias(src)); - }); - - defineInstanceSimilar(sugarDate, 'short medium long full', function(methods, name) { - var fn = getIdentityFormat(name); - addFormats(ldmlTokens, name, fn); - methods[name] = fn; - }); - - addFormats(ldmlTokens, 'time', getIdentityFormat('time')); - addFormats(ldmlTokens, 'stamp', getIdentityFormat('stamp')); - } - - var dateFormatMatcher; - - function buildDateFormatMatcher() { - - function getLdml(d, token, localeCode) { - return getOwn(ldmlTokens, token)(d, localeCode); - } - - function getStrf(d, token, localeCode) { - return getOwn(strfTokens, token)(d, localeCode); - } - - function checkDateToken(ldml, strf) { - return hasOwn(ldmlTokens, ldml) || hasOwn(strfTokens, strf); - } - - // Format matcher for LDML or STRF tokens. - dateFormatMatcher = createFormatMatcher(getLdml, getStrf, checkDateToken); - } - - buildDateFormatTokens(); - - buildDateFormatMatcher(); - - module.exports = { - ldmlTokens: ldmlTokens, - strfTokens: strfTokens, - dateFormatMatcher: dateFormatMatcher - }; - -/***/ }, -/* 272 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var TIMEZONE_ABBREVIATION_REG = __webpack_require__(273), - LocaleHelpers = __webpack_require__(35), - DateUnitIndexes = __webpack_require__(82), - trunc = __webpack_require__(89), - getDate = __webpack_require__(105), - getYear = __webpack_require__(76), - getHours = __webpack_require__(274), - getMonth = __webpack_require__(81), - cloneDate = __webpack_require__(121), - padNumber = __webpack_require__(275), - getWeekday = __webpack_require__(106), - callDateGet = __webpack_require__(77), - mathAliases = __webpack_require__(69), - getWeekYear = __webpack_require__(277), - getUTCOffset = __webpack_require__(279), - getDaysSince = __webpack_require__(280), - getWeekNumber = __webpack_require__(278), - getMeridiemToken = __webpack_require__(281), - setUnitAndLowerToEdge = __webpack_require__(99); - - var localeManager = LocaleHelpers.localeManager, - MONTH_INDEX = DateUnitIndexes.MONTH_INDEX, - ceil = mathAliases.ceil; - - var FormatTokensBase = [ - { - ldml: 'Dow', - strf: 'a', - lowerToken: 'dow', - get: function(d, localeCode) { - return localeManager.get(localeCode).getWeekdayName(getWeekday(d), 2); - } - }, - { - ldml: 'Weekday', - strf: 'A', - lowerToken: 'weekday', - allowAlternates: true, - get: function(d, localeCode, alternate) { - return localeManager.get(localeCode).getWeekdayName(getWeekday(d), alternate); - } - }, - { - ldml: 'Mon', - strf: 'b h', - lowerToken: 'mon', - get: function(d, localeCode) { - return localeManager.get(localeCode).getMonthName(getMonth(d), 2); - } - }, - { - ldml: 'Month', - strf: 'B', - lowerToken: 'month', - allowAlternates: true, - get: function(d, localeCode, alternate) { - return localeManager.get(localeCode).getMonthName(getMonth(d), alternate); - } - }, - { - strf: 'C', - get: function(d) { - return getYear(d).toString().slice(0, 2); - } - }, - { - ldml: 'd date day', - strf: 'd', - strfPadding: 2, - ldmlPaddedToken: 'dd', - ordinalToken: 'do', - get: function(d) { - return getDate(d); - } - }, - { - strf: 'e', - get: function(d) { - return padNumber(getDate(d), 2, false, 10, ' '); - } - }, - { - ldml: 'H 24hr', - strf: 'H', - strfPadding: 2, - ldmlPaddedToken: 'HH', - get: function(d) { - return getHours(d); - } - }, - { - ldml: 'h hours 12hr', - strf: 'I', - strfPadding: 2, - ldmlPaddedToken: 'hh', - get: function(d) { - return getHours(d) % 12 || 12; - } - }, - { - ldml: 'D', - strf: 'j', - strfPadding: 3, - ldmlPaddedToken: 'DDD', - get: function(d) { - var s = setUnitAndLowerToEdge(cloneDate(d), MONTH_INDEX); - return getDaysSince(d, s) + 1; - } - }, - { - ldml: 'M', - strf: 'm', - strfPadding: 2, - ordinalToken: 'Mo', - ldmlPaddedToken: 'MM', - get: function(d) { - return getMonth(d) + 1; - } - }, - { - ldml: 'm minutes', - strf: 'M', - strfPadding: 2, - ldmlPaddedToken: 'mm', - get: function(d) { - return callDateGet(d, 'Minutes'); - } - }, - { - ldml: 'Q', - get: function(d) { - return ceil((getMonth(d) + 1) / 3); - } - }, - { - ldml: 'TT', - strf: 'p', - get: function(d, localeCode) { - return getMeridiemToken(d, localeCode); - } - }, - { - ldml: 'tt', - strf: 'P', - get: function(d, localeCode) { - return getMeridiemToken(d, localeCode).toLowerCase(); - } - }, - { - ldml: 'T', - lowerToken: 't', - get: function(d, localeCode) { - return getMeridiemToken(d, localeCode).charAt(0); - } - }, - { - ldml: 's seconds', - strf: 'S', - strfPadding: 2, - ldmlPaddedToken: 'ss', - get: function(d) { - return callDateGet(d, 'Seconds'); - } - }, - { - ldml: 'S ms', - strfPadding: 3, - ldmlPaddedToken: 'SSS', - get: function(d) { - return callDateGet(d, 'Milliseconds'); - } - }, - { - ldml: 'e', - strf: 'u', - ordinalToken: 'eo', - get: function(d) { - return getWeekday(d) || 7; - } - }, - { - strf: 'U', - strfPadding: 2, - get: function(d) { - // Sunday first, 0-53 - return getWeekNumber(d, false, 0); - } - }, - { - ldml: 'W', - strf: 'V', - strfPadding: 2, - ordinalToken: 'Wo', - ldmlPaddedToken: 'WW', - get: function(d) { - // Monday first, 1-53 (ISO8601) - return getWeekNumber(d, true); - } - }, - { - strf: 'w', - get: function(d) { - return getWeekday(d); - } - }, - { - ldml: 'w', - ordinalToken: 'wo', - ldmlPaddedToken: 'ww', - get: function(d, localeCode) { - // Locale dependent, 1-53 - var loc = localeManager.get(localeCode), - dow = loc.getFirstDayOfWeek(localeCode), - doy = loc.getFirstDayOfWeekYear(localeCode); - return getWeekNumber(d, true, dow, doy); - } - }, - { - strf: 'W', - strfPadding: 2, - get: function(d) { - // Monday first, 0-53 - return getWeekNumber(d, false); - } - }, - { - ldmlPaddedToken: 'gggg', - ldmlTwoDigitToken: 'gg', - get: function(d, localeCode) { - return getWeekYear(d, localeCode); - } - }, - { - strf: 'G', - strfPadding: 4, - strfTwoDigitToken: 'g', - ldmlPaddedToken: 'GGGG', - ldmlTwoDigitToken: 'GG', - get: function(d, localeCode) { - return getWeekYear(d, localeCode, true); - } - }, - { - ldml: 'year', - ldmlPaddedToken: 'yyyy', - ldmlTwoDigitToken: 'yy', - strf: 'Y', - strfPadding: 4, - strfTwoDigitToken: 'y', - get: function(d) { - return getYear(d); - } - }, - { - ldml: 'ZZ', - strf: 'z', - get: function(d) { - return getUTCOffset(d); - } - }, - { - ldml: 'X', - get: function(d) { - return trunc(d.getTime() / 1000); - } - }, - { - ldml: 'x', - get: function(d) { - return d.getTime(); - } - }, - { - ldml: 'Z', - get: function(d) { - return getUTCOffset(d, true); - } - }, - { - ldml: 'z', - strf: 'Z', - get: function(d) { - // Note that this is not accurate in all browsing environments! - // https://github.com/moment/moment/issues/162 - // It will continue to be supported for Node and usage with the - // understanding that it may be blank. - var match = d.toString().match(TIMEZONE_ABBREVIATION_REG); - return match ? match[1]: ''; - } - }, - { - strf: 'D', - alias: '%m/%d/%y' - }, - { - strf: 'F', - alias: '%Y-%m-%d' - }, - { - strf: 'r', - alias: '%I:%M:%S %p' - }, - { - strf: 'R', - alias: '%H:%M' - }, - { - strf: 'T', - alias: '%H:%M:%S' - }, - { - strf: 'x', - alias: '{short}' - }, - { - strf: 'X', - alias: '{time}' - }, - { - strf: 'c', - alias: '{stamp}' - } - ]; - - module.exports = FormatTokensBase; - -/***/ }, -/* 273 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = /(\w{3})[()\s\d]*$/; - -/***/ }, -/* 274 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var callDateGet = __webpack_require__(77); - - function getHours(d) { - return callDateGet(d, 'Hours'); - } - - module.exports = getHours; - -/***/ }, -/* 275 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var mathAliases = __webpack_require__(69), - repeatString = __webpack_require__(276); - - var abs = mathAliases.abs; - - function padNumber(num, place, sign, base, replacement) { - var str = abs(num).toString(base || 10); - str = repeatString(replacement || '0', place - str.replace(/\.\d+/, '').length) + str; - if (sign || num < 0) { - str = (num < 0 ? '-' : '+') + str; - } - return str; - } - - module.exports = padNumber; - -/***/ }, -/* 276 */ -/***/ function(module, exports) { - - 'use strict'; - - function repeatString(str, num) { - var result = ''; - str = str.toString(); - while (num > 0) { - if (num & 1) { - result += str; - } - if (num >>= 1) { - str += str; - } - } - return result; - } - - module.exports = repeatString; - -/***/ }, -/* 277 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LocaleHelpers = __webpack_require__(35), - getYear = __webpack_require__(76), - getMonth = __webpack_require__(81), - getWeekNumber = __webpack_require__(278); - - var localeManager = LocaleHelpers.localeManager; - - function getWeekYear(d, localeCode, iso) { - var year, month, firstDayOfWeek, firstDayOfWeekYear, week, loc; - year = getYear(d); - month = getMonth(d); - if (month === 0 || month === 11) { - if (!iso) { - loc = localeManager.get(localeCode); - firstDayOfWeek = loc.getFirstDayOfWeek(localeCode); - firstDayOfWeekYear = loc.getFirstDayOfWeekYear(localeCode); - } - week = getWeekNumber(d, false, firstDayOfWeek, firstDayOfWeekYear); - if (month === 0 && week === 0) { - year -= 1; - } else if (month === 11 && week === 1) { - year += 1; - } - } - return year; - } - - module.exports = getWeekYear; - -/***/ }, -/* 278 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var ISODefaults = __webpack_require__(47), - setDate = __webpack_require__(104), - getDate = __webpack_require__(105), - cloneDate = __webpack_require__(121), - isUndefined = __webpack_require__(68), - moveToEndOfWeek = __webpack_require__(130), - moveToBeginningOfWeek = __webpack_require__(123), - moveToFirstDayOfWeekYear = __webpack_require__(122); - - var ISO_FIRST_DAY_OF_WEEK = ISODefaults.ISO_FIRST_DAY_OF_WEEK, - ISO_FIRST_DAY_OF_WEEK_YEAR = ISODefaults.ISO_FIRST_DAY_OF_WEEK_YEAR; - - function getWeekNumber(d, allowPrevious, firstDayOfWeek, firstDayOfWeekYear) { - var isoWeek, n = 0; - if (isUndefined(firstDayOfWeek)) { - firstDayOfWeek = ISO_FIRST_DAY_OF_WEEK; - } - if (isUndefined(firstDayOfWeekYear)) { - firstDayOfWeekYear = ISO_FIRST_DAY_OF_WEEK_YEAR; - } - // Moving to the end of the week allows for forward year traversal, ie - // Dec 29 2014 is actually week 01 of 2015. - isoWeek = moveToEndOfWeek(cloneDate(d), firstDayOfWeek); - moveToFirstDayOfWeekYear(isoWeek, firstDayOfWeek, firstDayOfWeekYear); - if (allowPrevious && d < isoWeek) { - // If the date is still before the start of the year, then it should be - // the last week of the previous year, ie Jan 1 2016 is actually week 53 - // of 2015, so move to the beginning of the week to traverse the year. - isoWeek = moveToBeginningOfWeek(cloneDate(d), firstDayOfWeek); - moveToFirstDayOfWeekYear(isoWeek, firstDayOfWeek, firstDayOfWeekYear); - } - while (isoWeek <= d) { - // Doing a very simple walk to get the week number. - setDate(isoWeek, getDate(isoWeek) + 7); - n++; - } - return n; - } - - module.exports = getWeekNumber; - -/***/ }, -/* 279 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _utc = __webpack_require__(78), - trunc = __webpack_require__(89), - tzOffset = __webpack_require__(97), - padNumber = __webpack_require__(275), - mathAliases = __webpack_require__(69); - - var abs = mathAliases.abs; - - function getUTCOffset(d, iso) { - var offset = _utc(d) ? 0 : tzOffset(d), hours, mins, colon; - colon = iso === true ? ':' : ''; - if (!offset && iso) return 'Z'; - hours = padNumber(trunc(-offset / 60), 2, true); - mins = padNumber(abs(offset % 60), 2); - return hours + colon + mins; - } - - module.exports = getUTCOffset; - -/***/ }, -/* 280 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DateUnits = __webpack_require__(74), - DateUnitIndexes = __webpack_require__(82), - getTimeDistanceForUnit = __webpack_require__(239); - - var DAY_INDEX = DateUnitIndexes.DAY_INDEX; - - function getDaysSince(d1, d2) { - return getTimeDistanceForUnit(d1, d2, DateUnits[DAY_INDEX]); - } - - module.exports = getDaysSince; - -/***/ }, -/* 281 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LocaleHelpers = __webpack_require__(35), - trunc = __webpack_require__(89), - getHours = __webpack_require__(274); - - var localeManager = LocaleHelpers.localeManager; - - function getMeridiemToken(d, localeCode) { - var hours = getHours(d); - return localeManager.get(localeCode).ampm[trunc(hours / 12)] || ''; - } - - module.exports = getMeridiemToken; - -/***/ }, -/* 282 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var STRING_FORMAT_REG = __webpack_require__(283), - CommonChars = __webpack_require__(59), - memoizeFunction = __webpack_require__(284); - - var OPEN_BRACE = CommonChars.OPEN_BRACE, - CLOSE_BRACE = CommonChars.CLOSE_BRACE; - - function createFormatMatcher(bracketMatcher, percentMatcher, precheck) { - - var reg = STRING_FORMAT_REG; - var compileMemoized = memoizeFunction(compile); - - function getToken(format, match) { - var get, token, literal, fn; - var bKey = match[2]; - var pLit = match[3]; - var pKey = match[5]; - if (match[4] && percentMatcher) { - token = pKey; - get = percentMatcher; - } else if (bKey) { - token = bKey; - get = bracketMatcher; - } else if (pLit && percentMatcher) { - literal = pLit; - } else { - literal = match[1] || match[0]; - } - if (get) { - assertPassesPrecheck(precheck, bKey, pKey); - fn = function(obj, opt) { - return get(obj, token, opt); - }; - } - format.push(fn || getLiteral(literal)); - } - - function getSubstring(format, str, start, end) { - if (end > start) { - var sub = str.slice(start, end); - assertNoUnmatched(sub, OPEN_BRACE); - assertNoUnmatched(sub, CLOSE_BRACE); - format.push(function() { - return sub; - }); - } - } - - function getLiteral(str) { - return function() { - return str; - }; - } - - function assertPassesPrecheck(precheck, bt, pt) { - if (precheck && !precheck(bt, pt)) { - throw new TypeError('Invalid token '+ (bt || pt) +' in format string'); - } - } - - function assertNoUnmatched(str, chr) { - if (str.indexOf(chr) !== -1) { - throw new TypeError('Unmatched '+ chr +' in format string'); - } - } - - function compile(str) { - var format = [], lastIndex = 0, match; - reg.lastIndex = 0; - while(match = reg.exec(str)) { - getSubstring(format, str, lastIndex, match.index); - getToken(format, match); - lastIndex = reg.lastIndex; - } - getSubstring(format, str, lastIndex, str.length); - return format; - } - - return function(str, obj, opt) { - var format = compileMemoized(str), result = ''; - for (var i = 0; i < format.length; i++) { - result += format[i](obj, opt); - } - return result; - }; - } - - module.exports = createFormatMatcher; - -/***/ }, -/* 283 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = /([{}])\1|\{([^}]*)\}|(%)%|(%(\w*))/g; - -/***/ }, -/* 284 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var INTERNAL_MEMOIZE_LIMIT = __webpack_require__(285), - coreUtilityAliases = __webpack_require__(41); - - var hasOwn = coreUtilityAliases.hasOwn; - - function memoizeFunction(fn) { - var memo = {}, counter = 0; - - return function(key) { - if (hasOwn(memo, key)) { - return memo[key]; - } - if (counter === INTERNAL_MEMOIZE_LIMIT) { - memo = {}; - counter = 0; - } - counter++; - return memo[key] = fn(key); - }; - } - - module.exports = memoizeFunction; - -/***/ }, -/* 285 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = 1000; - -/***/ }, -/* 286 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var dateIsValid = __webpack_require__(236); - - function assertDateIsValid(d) { - if (!dateIsValid(d)) { - throw new TypeError('Date is not valid'); - } - } - - module.exports = assertDateIsValid; - -/***/ }, -/* 287 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - createDateWithContext = __webpack_require__(238); - - Sugar.Date.defineInstance({ - - 'get': function(date, d, options) { - return createDateWithContext(date, d, options); - } - - }); - - module.exports = Sugar.Date.get; - -/***/ }, -/* 288 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - getWeekNumber = __webpack_require__(278); - - Sugar.Date.defineInstance({ - - 'getISOWeek': function(date) { - return getWeekNumber(date, true); - } - - }); - - module.exports = Sugar.Date.getISOWeek; - -/***/ }, -/* 289 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - getUTCOffset = __webpack_require__(279); - - Sugar.Date.defineInstance({ - - 'getUTCOffset': function(date, iso) { - return getUTCOffset(date, iso); - } - - }); - - module.exports = Sugar.Date.getUTCOffset; - -/***/ }, -/* 290 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - Sugar.Date.defineInstance({ - - 'getUTCWeekday': function(date) { - return date.getUTCDay(); - } - - }); - - module.exports = Sugar.Date.getUTCWeekday; - -/***/ }, -/* 291 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - getWeekday = __webpack_require__(106); - - Sugar.Date.defineInstance({ - - 'getWeekday': function(date) { - return getWeekday(date); - } - - }); - - module.exports = Sugar.Date.getWeekday; - -/***/ }, -/* 292 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.hoursAgo; - -/***/ }, -/* 293 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.hoursFromNow; - -/***/ }, -/* 294 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.hoursSince; - -/***/ }, -/* 295 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.hoursUntil; - -/***/ }, -/* 296 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - fullCompareDate = __webpack_require__(297); - - Sugar.Date.defineInstance({ - - 'is': function(date, d, margin) { - return fullCompareDate(date, d, margin); - } - - }); - - module.exports = Sugar.Date.is; - -/***/ }, -/* 297 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LocaleHelpers = __webpack_require__(35), - trim = __webpack_require__(298), - getMonth = __webpack_require__(81), - isDefined = __webpack_require__(57), - getNewDate = __webpack_require__(108), - compareDay = __webpack_require__(299), - getWeekday = __webpack_require__(106), - dateIsValid = __webpack_require__(236), - classChecks = __webpack_require__(60), - compareDate = __webpack_require__(235); - - var isString = classChecks.isString, - English = LocaleHelpers.English; - - function fullCompareDate(date, d, margin) { - var tmp; - if (!dateIsValid(date)) return; - if (isString(d)) { - d = trim(d).toLowerCase(); - switch(true) { - case d === 'future': return date.getTime() > getNewDate().getTime(); - case d === 'past': return date.getTime() < getNewDate().getTime(); - case d === 'today': return compareDay(date); - case d === 'tomorrow': return compareDay(date, 1); - case d === 'yesterday': return compareDay(date, -1); - case d === 'weekday': return getWeekday(date) > 0 && getWeekday(date) < 6; - case d === 'weekend': return getWeekday(date) === 0 || getWeekday(date) === 6; - - case (isDefined(tmp = English.weekdayMap[d])): - return getWeekday(date) === tmp; - case (isDefined(tmp = English.monthMap[d])): - return getMonth(date) === tmp; - } - } - return compareDate(date, d, margin); - } - - module.exports = fullCompareDate; - -/***/ }, -/* 298 */ -/***/ function(module, exports) { - - 'use strict'; - - function trim(str) { - return str.trim(); - } - - module.exports = trim; - -/***/ }, -/* 299 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var setDate = __webpack_require__(104), - getDate = __webpack_require__(105), - getYear = __webpack_require__(76), - getMonth = __webpack_require__(81), - getNewDate = __webpack_require__(108); - - function compareDay(d, shift) { - var comp = getNewDate(); - if (shift) { - setDate(comp, getDate(comp) + shift); - } - return getYear(d) === getYear(comp) && - getMonth(d) === getMonth(comp) && - getDate(d) === getDate(comp); - } - - module.exports = compareDay; - -/***/ }, -/* 300 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - createDate = __webpack_require__(94); - - Sugar.Date.defineInstance({ - - 'isAfter': function(date, d, margin) { - return date.getTime() > createDate(d).getTime() - (margin || 0); - } - - }); - - module.exports = Sugar.Date.isAfter; - -/***/ }, -/* 301 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - createDate = __webpack_require__(94); - - Sugar.Date.defineInstance({ - - 'isBefore': function(date, d, margin) { - return date.getTime() < createDate(d).getTime() + (margin || 0); - } - - }); - - module.exports = Sugar.Date.isBefore; - -/***/ }, -/* 302 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - createDate = __webpack_require__(94), - mathAliases = __webpack_require__(69); - - var min = mathAliases.min, - max = mathAliases.max; - - Sugar.Date.defineInstance({ - - 'isBetween': function(date, d1, d2, margin) { - var t = date.getTime(); - var t1 = createDate(d1).getTime(); - var t2 = createDate(d2).getTime(); - var lo = min(t1, t2); - var hi = max(t1, t2); - margin = margin || 0; - return (lo - margin <= t) && (hi + margin >= t); - } - - }); - - module.exports = Sugar.Date.isBetween; - -/***/ }, -/* 303 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isFriday; - -/***/ }, -/* 304 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var buildRelativeAliases = __webpack_require__(305); - - buildRelativeAliases(); - -/***/ }, -/* 305 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LocaleHelpers = __webpack_require__(35), - spaceSplit = __webpack_require__(63), - fullCompareDate = __webpack_require__(297), - namespaceAliases = __webpack_require__(112), - defineInstanceSimilar = __webpack_require__(148); - - var English = LocaleHelpers.English, - sugarDate = namespaceAliases.sugarDate; - - function buildRelativeAliases() { - var special = spaceSplit('Today Yesterday Tomorrow Weekday Weekend Future Past'); - var weekdays = English.weekdays.slice(0, 7); - var months = English.months.slice(0, 12); - var together = special.concat(weekdays).concat(months); - defineInstanceSimilar(sugarDate, together, function(methods, name) { - methods['is'+ name] = function(d) { - return fullCompareDate(d, name); - }; - }); - } - - module.exports = buildRelativeAliases; - -/***/ }, -/* 306 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isFuture; - -/***/ }, -/* 307 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.isLastMonth; - -/***/ }, -/* 308 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.isLastWeek; - -/***/ }, -/* 309 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.isLastYear; - -/***/ }, -/* 310 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - getYear = __webpack_require__(76); - - Sugar.Date.defineInstance({ - - 'isLeapYear': function(date) { - var year = getYear(date); - return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0); - } - - }); - - module.exports = Sugar.Date.isLeapYear; - -/***/ }, -/* 311 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isMonday; - -/***/ }, -/* 312 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.isNextMonth; - -/***/ }, -/* 313 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.isNextWeek; - -/***/ }, -/* 314 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.isNextYear; - -/***/ }, -/* 315 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isPast; - -/***/ }, -/* 316 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isSaturday; - -/***/ }, -/* 317 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isSunday; - -/***/ }, -/* 318 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.isThisMonth; - -/***/ }, -/* 319 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.isThisWeek; - -/***/ }, -/* 320 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.isThisYear; - -/***/ }, -/* 321 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isThursday; - -/***/ }, -/* 322 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isToday; - -/***/ }, -/* 323 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isTomorrow; - -/***/ }, -/* 324 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isTuesday; - -/***/ }, -/* 325 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - isUTC = __webpack_require__(326); - - Sugar.Date.defineInstance({ - - 'isUTC': function(date) { - return isUTC(date); - } - - }); - - module.exports = Sugar.Date.isUTC; - -/***/ }, -/* 326 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _utc = __webpack_require__(78), - tzOffset = __webpack_require__(97); - - function isUTC(d) { - return !!_utc(d) || tzOffset(d) === 0; - } - - module.exports = isUTC; - -/***/ }, -/* 327 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - dateIsValid = __webpack_require__(236); - - Sugar.Date.defineInstance({ - - 'isValid': function(date) { - return dateIsValid(date); - } - - }); - - module.exports = Sugar.Date.isValid; - -/***/ }, -/* 328 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isWednesday; - -/***/ }, -/* 329 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isWeekday; - -/***/ }, -/* 330 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isWeekend; - -/***/ }, -/* 331 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(304); - - module.exports = Sugar.Date.isYesterday; - -/***/ }, -/* 332 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - Sugar.Date.defineInstance({ - - 'iso': function(date) { - return date.toISOString(); - } - - }); - - module.exports = Sugar.Date.iso; - -/***/ }, -/* 333 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.millisecondsAgo; - -/***/ }, -/* 334 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.millisecondsFromNow; - -/***/ }, -/* 335 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.millisecondsSince; - -/***/ }, -/* 336 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.millisecondsUntil; - -/***/ }, -/* 337 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.minutesAgo; - -/***/ }, -/* 338 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.minutesFromNow; - -/***/ }, -/* 339 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.minutesSince; - -/***/ }, -/* 340 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.minutesUntil; - -/***/ }, -/* 341 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.monthsAgo; - -/***/ }, -/* 342 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.monthsFromNow; - -/***/ }, -/* 343 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.monthsSince; - -/***/ }, -/* 344 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.monthsUntil; - -/***/ }, -/* 345 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - dateRelative = __webpack_require__(346); - - Sugar.Date.defineInstance({ - - 'relative': function(date, localeCode, fn) { - return dateRelative(date, null, localeCode, fn); - } - - }); - - module.exports = Sugar.Date.relative; - -/***/ }, -/* 346 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var LocaleHelpers = __webpack_require__(35), - dateFormat = __webpack_require__(269), - classChecks = __webpack_require__(60), - assertDateIsValid = __webpack_require__(286), - getAdjustedUnitForDate = __webpack_require__(347); - - var isFunction = classChecks.isFunction, - localeManager = LocaleHelpers.localeManager; - - function dateRelative(d, dRelative, arg1, arg2) { - var adu, format, type, localeCode, fn; - assertDateIsValid(d); - if (isFunction(arg1)) { - fn = arg1; - } else { - localeCode = arg1; - fn = arg2; - } - adu = getAdjustedUnitForDate(d, dRelative); - if (fn) { - format = fn.apply(d, adu.concat(localeManager.get(localeCode))); - if (format) { - return dateFormat(d, format, localeCode); - } - } - // Adjust up if time is in ms, as this doesn't - // look very good for a standard relative date. - if (adu[1] === 0) { - adu[1] = 1; - adu[0] = 1; - } - if (dRelative) { - type = 'duration'; - } else if (adu[2] > 0) { - type = 'future'; - } else { - type = 'past'; - } - return localeManager.get(localeCode).getRelativeFormat(adu, type); - } - - module.exports = dateRelative; - -/***/ }, -/* 347 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var getNewDate = __webpack_require__(108), - mathAliases = __webpack_require__(69), - getAdjustedUnit = __webpack_require__(91), - getTimeDistanceForUnit = __webpack_require__(239); - - var abs = mathAliases.abs; - - function getAdjustedUnitForDate(d, dRelative) { - var ms; - if (!dRelative) { - dRelative = getNewDate(); - if (d > dRelative) { - // If our date is greater than the one that we got from getNewDate, it - // means that we are finding the unit for a date that is in the future - // relative to now. However, often the incoming date was created in - // the same cycle as our comparison, but our "now" date will have been - // created an instant after it, creating situations where "5 minutes from - // now" becomes "4 minutes from now" in the same tick. To prevent this, - // subtract a buffer of 10ms to compensate. - dRelative = new Date(dRelative.getTime() - 10); - } - } - ms = d - dRelative; - return getAdjustedUnit(ms, function(u) { - return abs(getTimeDistanceForUnit(d, dRelative, u)); - }); - } - - module.exports = getAdjustedUnitForDate; - -/***/ }, -/* 348 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - createDate = __webpack_require__(94), - dateRelative = __webpack_require__(346); - - Sugar.Date.defineInstance({ - - 'relativeTo': function(date, d, localeCode) { - return dateRelative(date, createDate(d), localeCode); - } - - }); - - module.exports = Sugar.Date.relativeTo; - -/***/ }, -/* 349 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - DateUnitIndexes = __webpack_require__(82), - moveToBeginningOfUnit = __webpack_require__(133), - getUnitIndexForParamName = __webpack_require__(350); - - var DAY_INDEX = DateUnitIndexes.DAY_INDEX; - - Sugar.Date.defineInstance({ - - 'reset': function(date, unit, localeCode) { - var unitIndex = unit ? getUnitIndexForParamName(unit) : DAY_INDEX; - moveToBeginningOfUnit(date, unitIndex, localeCode); - return date; - } - - }); - - module.exports = Sugar.Date.reset; - -/***/ }, -/* 350 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var iterateOverDateParams = __webpack_require__(124); - - function getUnitIndexForParamName(name) { - var params = {}, unitIndex; - params[name] = 1; - iterateOverDateParams(params, function(name, val, unit, i) { - unitIndex = i; - return false; - }); - return unitIndex; - } - - module.exports = getUnitIndexForParamName; - -/***/ }, -/* 351 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - advanceDateWithArgs = __webpack_require__(248); - - Sugar.Date.defineInstanceWithArguments({ - - 'rewind': function(d, args) { - return advanceDateWithArgs(d, args, -1); - } - - }); - - module.exports = Sugar.Date.rewind; - -/***/ }, -/* 352 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.secondsAgo; - -/***/ }, -/* 353 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.secondsFromNow; - -/***/ }, -/* 354 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.secondsSince; - -/***/ }, -/* 355 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.secondsUntil; - -/***/ }, -/* 356 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - updateDate = __webpack_require__(107), - collectDateArguments = __webpack_require__(249); - - Sugar.Date.defineInstanceWithArguments({ - - 'set': function(d, args) { - args = collectDateArguments(args); - return updateDate(d, args[0], args[1]); - } - - }); - - module.exports = Sugar.Date.set; - -/***/ }, -/* 357 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - setISOWeekNumber = __webpack_require__(118); - - Sugar.Date.defineInstance({ - - 'setISOWeek': function(date, num) { - return setISOWeekNumber(date, num); - } - - }); - - module.exports = Sugar.Date.setISOWeek; - -/***/ }, -/* 358 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - _utc = __webpack_require__(78); - - Sugar.Date.defineInstance({ - - 'setUTC': function(date, on) { - return _utc(date, on); - } - - }); - - module.exports = Sugar.Date.setUTC; - -/***/ }, -/* 359 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - setWeekday = __webpack_require__(103); - - Sugar.Date.defineInstance({ - - 'setWeekday': function(date, dow) { - return setWeekday(date, dow); - } - - }); - - module.exports = Sugar.Date.setWeekday; - -/***/ }, -/* 360 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.weeksAgo; - -/***/ }, -/* 361 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.weeksFromNow; - -/***/ }, -/* 362 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.weeksSince; - -/***/ }, -/* 363 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.weeksUntil; - -/***/ }, -/* 364 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.yearsAgo; - -/***/ }, -/* 365 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.yearsFromNow; - -/***/ }, -/* 366 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.yearsSince; - -/***/ }, -/* 367 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34); - - __webpack_require__(233); - - module.exports = Sugar.Date.yearsUntil; - -/***/ }, -/* 368 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - _dateOptions = __webpack_require__(109); - - module.exports = Sugar.Date.getOption; - -/***/ }, -/* 369 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - _dateOptions = __webpack_require__(109); - - module.exports = Sugar.Date.setOption; - -/***/ }, -/* 370 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - // Static Methods - __webpack_require__(371); - - // Prototype Methods - __webpack_require__(385); - __webpack_require__(388); - __webpack_require__(389); - __webpack_require__(390); - __webpack_require__(402); - __webpack_require__(403); - __webpack_require__(404); - __webpack_require__(405); - __webpack_require__(406); - __webpack_require__(407); - __webpack_require__(408); - __webpack_require__(409); - __webpack_require__(410); - __webpack_require__(412); - __webpack_require__(413); - __webpack_require__(414); - __webpack_require__(415); - __webpack_require__(416); - - module.exports = __webpack_require__(34); - -/***/ }, -/* 371 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Sugar = __webpack_require__(34), - DateRangeConstructor = __webpack_require__(372); - - Sugar.Date.defineStatic({ - - 'range': DateRangeConstructor - - }); - - module.exports = Sugar.Date.range; - -/***/ }, -/* 372 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - classChecks = __webpack_require__(60), - getDateForRange = __webpack_require__(376), - createDateRangeFromString = __webpack_require__(377); - - var isString = classChecks.isString; - - var DateRangeConstructor = function(start, end) { - if (arguments.length === 1 && isString(start)) { - return createDateRangeFromString(start); - } - return new Range(getDateForRange(start), getDateForRange(end)); - }; - - module.exports = DateRangeConstructor; - -/***/ }, -/* 373 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var cloneRangeMember = __webpack_require__(374); - - function Range(start, end) { - this.start = cloneRangeMember(start); - this.end = cloneRangeMember(end); - } - - module.exports = Range; - -/***/ }, -/* 374 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var classChecks = __webpack_require__(60), - getRangeMemberPrimitiveValue = __webpack_require__(375); - - var isDate = classChecks.isDate; - - function cloneRangeMember(m) { - if (isDate(m)) { - return new Date(m.getTime()); - } else { - return getRangeMemberPrimitiveValue(m); - } - } - - module.exports = cloneRangeMember; - -/***/ }, -/* 375 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var classChecks = __webpack_require__(60); - - var isDate = classChecks.isDate; - - function getRangeMemberPrimitiveValue(m) { - if (m == null) return m; - return isDate(m) ? m.getTime() : m.valueOf(); - } - - module.exports = getRangeMemberPrimitiveValue; - -/***/ }, -/* 376 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var classChecks = __webpack_require__(60), - namespaceAliases = __webpack_require__(112); - - var isDate = classChecks.isDate, - sugarDate = namespaceAliases.sugarDate; - - function getDateForRange(d) { - if (isDate(d)) { - return d; - } else if (d == null) { - return new Date(); - } else if (sugarDate.create) { - return sugarDate.create(d); - } - return new Date(d); - } - - module.exports = getDateForRange; - -/***/ }, -/* 377 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - DurationTextFormats = __webpack_require__(378), - incrementDate = __webpack_require__(381), - getDateForRange = __webpack_require__(376), - namespaceAliases = __webpack_require__(112), - getDateIncrementObject = __webpack_require__(383); - - var sugarDate = namespaceAliases.sugarDate, - RANGE_REG_FROM_TO = DurationTextFormats.RANGE_REG_FROM_TO, - RANGE_REG_REAR_DURATION = DurationTextFormats.RANGE_REG_REAR_DURATION, - RANGE_REG_FRONT_DURATION = DurationTextFormats.RANGE_REG_FRONT_DURATION; - - function createDateRangeFromString(str) { - var match, datetime, duration, dio, start, end; - if (sugarDate.get && (match = str.match(RANGE_REG_FROM_TO))) { - start = getDateForRange(match[1].replace('from', 'at')); - end = sugarDate.get(start, match[2]); - return new Range(start, end); - } - if (match = str.match(RANGE_REG_FRONT_DURATION)) { - duration = match[1]; - datetime = match[2]; - } - if (match = str.match(RANGE_REG_REAR_DURATION)) { - datetime = match[1]; - duration = match[2]; - } - if (datetime && duration) { - start = getDateForRange(datetime); - dio = getDateIncrementObject(duration); - end = incrementDate(start, dio[0], dio[1]); - } else { - start = str; - } - return new Range(getDateForRange(start), getDateForRange(end)); - } - - module.exports = createDateRangeFromString; - -/***/ }, -/* 378 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var FULL_CAPTURED_DURATION = __webpack_require__(379); - - module.exports = { - RANGE_REG_FROM_TO: /(?:from)?\s*(.+)\s+(?:to|until)\s+(.+)$/i, - RANGE_REG_REAR_DURATION: RegExp('(.+)\\s*for\\s*' + FULL_CAPTURED_DURATION, 'i'), - RANGE_REG_FRONT_DURATION: RegExp('(?:for)?\\s*'+ FULL_CAPTURED_DURATION +'\\s*(?:starting)?\\s*at\\s*(.+)', 'i') - }; - -/***/ }, -/* 379 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DURATION_UNITS = __webpack_require__(380); - - module.exports = '((?:\\d+)?\\s*(?:' + DURATION_UNITS + '))s?'; - -/***/ }, -/* 380 */ -/***/ function(module, exports) { - - 'use strict'; - - module.exports = 'year|month|week|day|hour|minute|second|millisecond'; - -/***/ }, -/* 381 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var MULTIPLIERS = __webpack_require__(382), - callDateSet = __webpack_require__(100), - callDateGet = __webpack_require__(77); - - function incrementDate(src, amount, unit) { - var mult = MULTIPLIERS[unit], d; - if (mult) { - d = new Date(src.getTime() + (amount * mult)); - } else { - d = new Date(src); - callDateSet(d, unit, callDateGet(src, unit) + amount); - } - return d; - } - - module.exports = incrementDate; - -/***/ }, -/* 382 */ -/***/ function(module, exports) { - - 'use strict'; - - var MULTIPLIERS = { - 'Hours': 60 * 60 * 1000, - 'Minutes': 60 * 1000, - 'Seconds': 1000, - 'Milliseconds': 1 - }; - - module.exports = MULTIPLIERS; - -/***/ }, -/* 383 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DURATION_REG = __webpack_require__(384), - classChecks = __webpack_require__(60), - simpleCapitalize = __webpack_require__(237); - - var isNumber = classChecks.isNumber; - - function getDateIncrementObject(amt) { - var match, val, unit; - if (isNumber(amt)) { - return [amt, 'Milliseconds']; - } - match = amt.match(DURATION_REG); - val = +match[1] || 1; - unit = simpleCapitalize(match[2].toLowerCase()); - if (unit.match(/hour|minute|second/i)) { - unit += 's'; - } else if (unit === 'Year') { - unit = 'FullYear'; - } else if (unit === 'Week') { - unit = 'Date'; - val *= 7; - } else if (unit === 'Day') { - unit = 'Date'; - } - return [val, unit]; - } - - module.exports = getDateIncrementObject; - -/***/ }, -/* 384 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var DURATION_UNITS = __webpack_require__(380); - - module.exports = RegExp('(\\d+)?\\s*('+ DURATION_UNITS +')s?', 'i'); - -/***/ }, -/* 385 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - rangeClamp = __webpack_require__(386), - defineOnPrototype = __webpack_require__(387); - - defineOnPrototype(Range, { - - 'clamp': function(obj) { - return rangeClamp(this, obj); - } - - }); - - // This package does not export anything as it is - // simply defining "clamp" on Range.prototype. - -/***/ }, -/* 386 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var cloneRangeMember = __webpack_require__(374); - - function rangeClamp(range, obj) { - var clamped, - start = range.start, - end = range.end, - min = end < start ? end : start, - max = start > end ? start : end; - if (obj < min) { - clamped = min; - } else if (obj > max) { - clamped = max; - } else { - clamped = obj; - } - return cloneRangeMember(clamped); - } - - module.exports = rangeClamp; - -/***/ }, -/* 387 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var coreUtilityAliases = __webpack_require__(41); - - var forEachProperty = coreUtilityAliases.forEachProperty; - - function defineOnPrototype(ctor, methods) { - var proto = ctor.prototype; - forEachProperty(methods, function(val, key) { - proto[key] = val; - }); - } - - module.exports = defineOnPrototype; - -/***/ }, -/* 388 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - defineOnPrototype = __webpack_require__(387); - - defineOnPrototype(Range, { - - 'clone': function() { - return new Range(this.start, this.end); - } - - }); - - // This package does not export anything as it is - // simply defining "clone" on Range.prototype. - -/***/ }, -/* 389 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - defineOnPrototype = __webpack_require__(387); - - defineOnPrototype(Range, { - - 'contains': function(obj) { - if (obj == null) return false; - if (obj.start && obj.end) { - return obj.start >= this.start && obj.start <= this.end && - obj.end >= this.start && obj.end <= this.end; - } else { - return obj >= this.start && obj <= this.end; - } - } - - }); - - // This package does not export anything as it is - // simply defining "contains" on Range.prototype. - -/***/ }, -/* 390 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(391); - - // This package does not export anything as it is - // simply defining "days" on Range.prototype. - -/***/ }, -/* 391 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var buildDateRangeUnits = __webpack_require__(392); - - buildDateRangeUnits(); - -/***/ }, -/* 392 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var MULTIPLIERS = __webpack_require__(382), - DURATION_UNITS = __webpack_require__(380), - Range = __webpack_require__(373), - trunc = __webpack_require__(89), - forEach = __webpack_require__(53), - rangeEvery = __webpack_require__(393), - simpleCapitalize = __webpack_require__(237), - defineOnPrototype = __webpack_require__(387); - - function buildDateRangeUnits() { - var methods = {}; - forEach(DURATION_UNITS.split('|'), function(unit, i) { - var name = unit + 's', mult, fn; - if (i < 4) { - fn = function() { - return rangeEvery(this, unit, true); - }; - } else { - mult = MULTIPLIERS[simpleCapitalize(name)]; - fn = function() { - return trunc((this.end - this.start) / mult); - }; - } - methods[name] = fn; - }); - defineOnPrototype(Range, methods); - } - - module.exports = buildDateRangeUnits; - -/***/ }, -/* 393 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var classChecks = __webpack_require__(60), - rangeIsValid = __webpack_require__(394), - incrementDate = __webpack_require__(381), - incrementNumber = __webpack_require__(397), - incrementString = __webpack_require__(398), - getGreaterPrecision = __webpack_require__(399), - getDateIncrementObject = __webpack_require__(383); - - var isNumber = classChecks.isNumber, - isString = classChecks.isString, - isDate = classChecks.isDate, - isFunction = classChecks.isFunction; - - function rangeEvery(range, step, countOnly, fn) { - var increment, - precision, - dio, - unit, - start = range.start, - end = range.end, - inverse = end < start, - current = start, - index = 0, - result = []; - - if (!rangeIsValid(range)) { - return []; - } - if (isFunction(step)) { - fn = step; - step = null; - } - step = step || 1; - if (isNumber(start)) { - precision = getGreaterPrecision(start, step); - increment = function() { - return incrementNumber(current, step, precision); - }; - } else if (isString(start)) { - increment = function() { - return incrementString(current, step); - }; - } else if (isDate(start)) { - dio = getDateIncrementObject(step); - step = dio[0]; - unit = dio[1]; - increment = function() { - return incrementDate(current, step, unit); - }; - } - // Avoiding infinite loops - if (inverse && step > 0) { - step *= -1; - } - while(inverse ? current >= end : current <= end) { - if (!countOnly) { - result.push(current); - } - if (fn) { - fn(current, index, range); - } - current = increment(); - index++; - } - return countOnly ? index - 1 : result; - } - - module.exports = rangeEvery; - -/***/ }, -/* 394 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var isValidRangeMember = __webpack_require__(395); - - function rangeIsValid(range) { - return isValidRangeMember(range.start) && - isValidRangeMember(range.end) && - typeof range.start === typeof range.end; - } - - module.exports = rangeIsValid; - -/***/ }, -/* 395 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var valueIsNotInfinite = __webpack_require__(396), - getRangeMemberPrimitiveValue = __webpack_require__(375); - - function isValidRangeMember(m) { - var val = getRangeMemberPrimitiveValue(m); - return (!!val || val === 0) && valueIsNotInfinite(m); - } - - module.exports = isValidRangeMember; - -/***/ }, -/* 396 */ -/***/ function(module, exports) { - - 'use strict'; - - function valueIsNotInfinite(m) { - return m !== -Infinity && m !== Infinity; - } - - module.exports = valueIsNotInfinite; - -/***/ }, -/* 397 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var withPrecision = __webpack_require__(90); - - function incrementNumber(current, amount, precision) { - return withPrecision(current + amount, precision); - } - - module.exports = incrementNumber; - -/***/ }, -/* 398 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var chr = __webpack_require__(86); - - function incrementString(current, amount) { - return chr(current.charCodeAt(0) + amount); - } - - module.exports = incrementString; - -/***/ }, -/* 399 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var mathAliases = __webpack_require__(69), - getPrecision = __webpack_require__(400); - - var max = mathAliases.max; - - function getGreaterPrecision(n1, n2) { - return max(getPrecision(n1), getPrecision(n2)); - } - - module.exports = getGreaterPrecision; - -/***/ }, -/* 400 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var periodSplit = __webpack_require__(401); - - function getPrecision(n) { - var split = periodSplit(n.toString()); - return split[1] ? split[1].length : 0; - } - - module.exports = getPrecision; - -/***/ }, -/* 401 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var CommonChars = __webpack_require__(59); - - var HALF_WIDTH_PERIOD = CommonChars.HALF_WIDTH_PERIOD; - - function periodSplit(str) { - return str.split(HALF_WIDTH_PERIOD); - } - - module.exports = periodSplit; - -/***/ }, -/* 402 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - rangeEvery = __webpack_require__(393), - defineOnPrototype = __webpack_require__(387); - - defineOnPrototype(Range, { - - 'every': function(amount, fn) { - return rangeEvery(this, amount, false, fn); - } - - }); - - // This package does not export anything as it is - // simply defining "every" on Range.prototype. - -/***/ }, -/* 403 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(391); - - // This package does not export anything as it is - // simply defining "hours" on Range.prototype. - -/***/ }, -/* 404 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - defineOnPrototype = __webpack_require__(387); - - defineOnPrototype(Range, { - - 'intersect': function(range) { - if (range.start > this.end || range.end < this.start) { - return new Range(NaN, NaN); - } - return new Range( - this.start > range.start ? this.start : range.start, - this.end < range.end ? this.end : range.end - ); - } - - }); - - // This package does not export anything as it is - // simply defining "intersect" on Range.prototype. - -/***/ }, -/* 405 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - rangeIsValid = __webpack_require__(394), - defineOnPrototype = __webpack_require__(387); - - defineOnPrototype(Range, { - - 'isValid': function() { - return rangeIsValid(this); - } - - }); - - // This package does not export anything as it is - // simply defining "isValid" on Range.prototype. - -/***/ }, -/* 406 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(391); - - // This package does not export anything as it is - // simply defining "milliseconds" on Range.prototype. - -/***/ }, -/* 407 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(391); - - // This package does not export anything as it is - // simply defining "minutes" on Range.prototype. - -/***/ }, -/* 408 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(391); - - // This package does not export anything as it is - // simply defining "months" on Range.prototype. - -/***/ }, -/* 409 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(391); - - // This package does not export anything as it is - // simply defining "seconds" on Range.prototype. - -/***/ }, -/* 410 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - mathAliases = __webpack_require__(69), - rangeIsValid = __webpack_require__(394), - defineOnPrototype = __webpack_require__(387), - getRangeMemberNumericValue = __webpack_require__(411); - - var abs = mathAliases.abs; - - defineOnPrototype(Range, { - - 'span': function() { - var n = getRangeMemberNumericValue(this.end) - getRangeMemberNumericValue(this.start); - return rangeIsValid(this) ? abs(n) + 1 : NaN; - } - - }); - - // This package does not export anything as it is - // simply defining "span" on Range.prototype. - -/***/ }, -/* 411 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var classChecks = __webpack_require__(60); - - var isString = classChecks.isString; - - function getRangeMemberNumericValue(m) { - return isString(m) ? m.charCodeAt(0) : m; - } - - module.exports = getRangeMemberNumericValue; - -/***/ }, -/* 412 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - rangeEvery = __webpack_require__(393), - defineOnPrototype = __webpack_require__(387); - - defineOnPrototype(Range, { - - 'toArray': function() { - return rangeEvery(this); - } - - }); - - // This package does not export anything as it is - // simply defining "toArray" on Range.prototype. - -/***/ }, -/* 413 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - rangeIsValid = __webpack_require__(394), - defineOnPrototype = __webpack_require__(387); - - defineOnPrototype(Range, { - - 'toString': function() { - return rangeIsValid(this) ? this.start + '..' + this.end : 'Invalid Range'; - } - - }); - - // This package does not export anything as it is - // simply defining "toString" on Range.prototype. - -/***/ }, -/* 414 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Range = __webpack_require__(373), - defineOnPrototype = __webpack_require__(387); - - defineOnPrototype(Range, { - - 'union': function(range) { - return new Range( - this.start < range.start ? this.start : range.start, - this.end > range.end ? this.end : range.end - ); - } - - }); - - // This package does not export anything as it is - // simply defining "union" on Range.prototype. - -/***/ }, -/* 415 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(391); - - // This package does not export anything as it is - // simply defining "weeks" on Range.prototype. - -/***/ }, -/* 416 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(391); - - // This package does not export anything as it is - // simply defining "years" on Range.prototype. - -/***/ }, -/* 417 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - __webpack_require__(418); - __webpack_require__(419); - __webpack_require__(420); - __webpack_require__(421); - __webpack_require__(422); - __webpack_require__(423); - __webpack_require__(424); - __webpack_require__(425); - __webpack_require__(426); - __webpack_require__(427); - __webpack_require__(428); - __webpack_require__(429); - __webpack_require__(430); - __webpack_require__(431); - __webpack_require__(432); - __webpack_require__(433); - __webpack_require__(434); - - module.exports = __webpack_require__(34); - -/***/ }, -/* 418 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Catalan locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('ca') - * - */ - addLocale('ca', { - 'plural': true, - 'units': 'milisegon:|s,segon:|s,minut:|s,hor:a|es,di:a|es,setman:a|es,mes:|os,any:|s', - 'months': 'gen:er|,febr:er|,mar:ç|,abr:il|,mai:g|,jun:y|,jul:iol|,ag:ost|,set:embre|,oct:ubre|,nov:embre|,des:embre|', - 'weekdays': 'diumenge|dg,dilluns|dl,dimarts|dt,dimecres|dc,dijous|dj,divendres|dv,dissabte|ds', - 'numerals': 'zero,un,dos,tres,quatre,cinc,sis,set,vuit,nou,deu', - 'tokens': 'el,la,de', - 'short': '{dd}/{MM}/{yyyy}', - 'medium': '{d} {month} {yyyy}', - 'long': '{d} {month} {yyyy} {time}', - 'full': '{weekday} {d} {month} {yyyy} {time}', - 'stamp': '{dow} {d} {mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'past': '{sign} {num} {unit}', - 'future': '{sign} {num} {unit}', - 'duration': '{num} {unit}', - 'timeMarkers': 'a las', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': "abans d'ahir", 'value': -2 }, - { 'name': 'day', 'src': 'ahir', 'value': -1 }, - { 'name': 'day', 'src': 'avui', 'value': 0 }, - { 'name': 'day', 'src': 'demà|dema', 'value': 1 }, - { 'name': 'sign', 'src': 'fa', 'value': -1 }, - { 'name': 'sign', 'src': 'en', 'value': 1 }, - { 'name': 'shift', 'src': 'passat', 'value': -1 }, - { 'name': 'shift', 'src': 'el proper|la propera', 'value': 1 } - ], - 'parse': [ - '{sign} {num} {unit}', - '{num} {unit} {sign}', - '{0?}{1?} {unit:5-7} {shift}', - '{0?}{1?} {shift} {unit:5-7}' - ], - 'timeParse': [ - '{shift} {weekday}', - '{weekday} {shift}', - '{date?} {2?} {months}\\.? {2?} {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "ca" locale. - -/***/ }, -/* 419 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Danish locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('da') - * - */ - addLocale('da', { - 'plural': true, - 'units': 'millisekund:|er,sekund:|er,minut:|ter,tim:e|er,dag:|e,ug:e|er|en,måned:|er|en+maaned:|er|en,år:||et+aar:||et', - 'months': 'jan:uar|,feb:ruar|,mar:ts|,apr:il|,maj,jun:i|,jul:i|,aug:ust|,sep:tember|,okt:ober|,nov:ember|,dec:ember|', - 'weekdays': 'søn:dag|+son:dag|,man:dag|,tir:sdag|,ons:dag|,tor:sdag|,fre:dag|,lør:dag|+lor:dag|', - 'numerals': 'nul,en|et,to,tre,fire,fem,seks,syv,otte,ni,ti', - 'tokens': 'den,for', - 'articles': 'den', - 'short': '{dd}-{MM}-{yyyy}', - 'medium': '{d}. {month} {yyyy}', - 'long': '{d}. {month} {yyyy} {time}', - 'full': '{weekday} d. {d}. {month} {yyyy} {time}', - 'stamp': '{dow} {d} {mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'past': '{num} {unit} {sign}', - 'future': '{sign} {num} {unit}', - 'duration': '{num} {unit}', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': 'forgårs|i forgårs|forgaars|i forgaars', 'value': -2 }, - { 'name': 'day', 'src': 'i går|igår|i gaar|igaar', 'value': -1 }, - { 'name': 'day', 'src': 'i dag|idag', 'value': 0 }, - { 'name': 'day', 'src': 'i morgen|imorgen', 'value': 1 }, - { 'name': 'day', 'src': 'over morgon|overmorgen|i over morgen|i overmorgen|iovermorgen', 'value': 2 }, - { 'name': 'sign', 'src': 'siden', 'value': -1 }, - { 'name': 'sign', 'src': 'om', 'value': 1 }, - { 'name': 'shift', 'src': 'i sidste|sidste', 'value': -1 }, - { 'name': 'shift', 'src': 'denne', 'value': 0 }, - { 'name': 'shift', 'src': 'næste|naeste', 'value': 1 } - ], - 'parse': [ - '{months} {year?}', - '{num} {unit} {sign}', - '{sign} {num} {unit}', - '{1?} {num} {unit} {sign}', - '{shift} {unit:5-7}' - ], - 'timeParse': [ - '{day|weekday}', - '{date} {months?}\\.? {year?}' - ], - 'timeFrontParse': [ - '{shift} {weekday}', - '{0?} {weekday?},? {date}\\.? {months?}\\.? {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "da" locale. - -/***/ }, -/* 420 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * German locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('de') - * - */ - addLocale('de', { - 'plural': true, - 'units': 'Millisekunde:|n,Sekunde:|n,Minute:|n,Stunde:|n,Tag:|en,Woche:|n,Monat:|en,Jahr:|en|e', - 'months': 'Jan:uar|,Feb:ruar|,M:är|ärz|ar|arz,Apr:il|,Mai,Juni,Juli,Aug:ust|,Sept:ember|,Okt:ober|,Nov:ember|,Dez:ember|', - 'weekdays': 'So:nntag|,Mo:ntag|,Di:enstag|,Mi:ttwoch|,Do:nnerstag|,Fr:eitag|,Sa:mstag|', - 'numerals': 'null,ein:|e|er|en|em,zwei,drei,vier,fuenf,sechs,sieben,acht,neun,zehn', - 'tokens': 'der', - 'short': '{dd}.{MM}.{yyyy}', - 'medium': '{d}. {Month} {yyyy}', - 'long': '{d}. {Month} {yyyy} {time}', - 'full': '{Weekday}, {d}. {Month} {yyyy} {time}', - 'stamp': '{Dow} {d} {Mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'past': '{sign} {num} {unit}', - 'future': '{sign} {num} {unit}', - 'duration': '{num} {unit}', - 'timeMarkers': 'um', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': 'vorgestern', 'value': -2 }, - { 'name': 'day', 'src': 'gestern', 'value': -1 }, - { 'name': 'day', 'src': 'heute', 'value': 0 }, - { 'name': 'day', 'src': 'morgen', 'value': 1 }, - { 'name': 'day', 'src': 'übermorgen|ubermorgen|uebermorgen', 'value': 2 }, - { 'name': 'sign', 'src': 'vor:|her', 'value': -1 }, - { 'name': 'sign', 'src': 'in', 'value': 1 }, - { 'name': 'shift', 'src': 'letzte:|r|n|s', 'value': -1 }, - { 'name': 'shift', 'src': 'nächste:|r|n|s+nachste:|r|n|s+naechste:|r|n|s+kommende:n|r', 'value': 1 } - ], - 'parse': [ - '{months} {year?}', - '{sign} {num} {unit}', - '{num} {unit} {sign}', - '{shift} {unit:5-7}' - ], - 'timeParse': [ - '{shift?} {day|weekday}', - '{weekday?},? {date}\\.? {months?}\\.? {year?}' - ], - 'timeFrontParse': [ - '{shift} {weekday}', - '{weekday?},? {date}\\.? {months?}\\.? {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "de" locale. - -/***/ }, -/* 421 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Spanish locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('es') - * - */ - addLocale('es', { - 'plural': true, - 'units': 'milisegundo:|s,segundo:|s,minuto:|s,hora:|s,día|días|dia|dias,semana:|s,mes:|es,año|años|ano|anos', - 'months': 'ene:ro|,feb:rero|,mar:zo|,abr:il|,may:o|,jun:io|,jul:io|,ago:sto|,sep:tiembre|,oct:ubre|,nov:iembre|,dic:iembre|', - 'weekdays': 'dom:ingo|,lun:es|,mar:tes|,mié:rcoles|+mie:rcoles|,jue:ves|,vie:rnes|,sáb:ado|+sab:ado|', - 'numerals': 'cero,uno,dos,tres,cuatro,cinco,seis,siete,ocho,nueve,diez', - 'tokens': 'el,la,de', - 'short': '{dd}/{MM}/{yyyy}', - 'medium': '{d} de {Month} de {yyyy}', - 'long': '{d} de {Month} de {yyyy} {time}', - 'full': '{weekday}, {d} de {month} de {yyyy} {time}', - 'stamp': '{dow} {d} {mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'past': '{sign} {num} {unit}', - 'future': '{sign} {num} {unit}', - 'duration': '{num} {unit}', - 'timeMarkers': 'a las', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': 'anteayer', 'value': -2 }, - { 'name': 'day', 'src': 'ayer', 'value': -1 }, - { 'name': 'day', 'src': 'hoy', 'value': 0 }, - { 'name': 'day', 'src': 'mañana|manana', 'value': 1 }, - { 'name': 'sign', 'src': 'hace', 'value': -1 }, - { 'name': 'sign', 'src': 'dentro de', 'value': 1 }, - { 'name': 'shift', 'src': 'pasad:o|a', 'value': -1 }, - { 'name': 'shift', 'src': 'próximo|próxima|proximo|proxima', 'value': 1 } - ], - 'parse': [ - '{months} {2?} {year?}', - '{sign} {num} {unit}', - '{num} {unit} {sign}', - '{0?}{1?} {unit:5-7} {shift}', - '{0?}{1?} {shift} {unit:5-7}' - ], - 'timeParse': [ - '{shift?} {day|weekday} {shift?}', - '{date} {2?} {months?}\\.? {2?} {year?}' - ], - 'timeFrontParse': [ - '{shift?} {weekday} {shift?}', - '{date} {2?} {months?}\\.? {2?} {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "es" locale. - -/***/ }, -/* 422 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Finnish locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('fi') - * - */ - addLocale('fi', { - 'plural': true, - 'units': 'millisekun:ti|tia|nin|teja|tina,sekun:ti|tia|nin|teja|tina,minuut:ti|tia|in|teja|tina,tun:ti|tia|nin|teja|tina,päiv:ä|ää|än|iä|änä,viik:ko|koa|on|olla|koja|kona,kuukau:si|tta|den+kuussa,vuo:si|tta|den|sia|tena|nna', - 'months': 'tammi:kuuta||kuu,helmi:kuuta||kuu,maalis:kuuta||kuu,huhti:kuuta||kuu,touko:kuuta||kuu,kesä:kuuta||kuu,heinä:kuuta||kuu,elo:kuuta||kuu,syys:kuuta||kuu,loka:kuuta||kuu,marras:kuuta||kuu,joulu:kuuta||kuu', - 'weekdays': 'su:nnuntai||nnuntaina,ma:anantai||anantaina,ti:istai||istaina,ke:skiviikko||skiviikkona,to:rstai||rstaina,pe:rjantai||rjantaina,la:uantai||uantaina', - 'numerals': 'nolla,yksi|ensimmäinen,kaksi|toinen,kolm:e|as,neljä:|s,vii:si|des,kuu:si|des,seitsemä:n|s,kahdeksa:n|s,yhdeksä:n|s,kymmene:n|s', - 'short': '{d}.{M}.{yyyy}', - 'medium': '{d}. {month} {yyyy}', - 'long': '{d}. {month} {yyyy} klo {time}', - 'full': '{weekday} {d}. {month} {yyyy} klo {time}', - 'stamp': '{dow} {d} {mon} {yyyy} {time}', - 'time': '{H}.{mm}', - 'timeMarkers': 'klo,kello', - 'ordinalSuffix': '.', - 'relative': function(num, unit, ms, format) { - var units = this['units']; - function numberWithUnit(mult) { - return num + ' ' + units[(8 * mult) + unit]; - } - function baseUnit() { - return numberWithUnit(num === 1 ? 0 : 1); - } - switch(format) { - case 'duration': return baseUnit(); - case 'past': return baseUnit() + ' sitten'; - case 'future': return numberWithUnit(2) + ' kuluttua'; - } - }, - 'modifiers': [ - { 'name': 'day', 'src': 'toissa päivänä', 'value': -2 }, - { 'name': 'day', 'src': 'eilen|eilistä', 'value': -1 }, - { 'name': 'day', 'src': 'tänään', 'value': 0 }, - { 'name': 'day', 'src': 'huomenna|huomista', 'value': 1 }, - { 'name': 'day', 'src': 'ylihuomenna|ylihuomista', 'value': 2 }, - { 'name': 'sign', 'src': 'sitten|aiemmin', 'value': -1 }, - { 'name': 'sign', 'src': 'päästä|kuluttua|myöhemmin', 'value': 1 }, - { 'name': 'edge', 'src': 'lopussa', 'value': 2 }, - { 'name': 'edge', 'src': 'ensimmäinen|ensimmäisenä', 'value': -2 }, - { 'name': 'shift', 'src': 'edel:linen|lisenä', 'value': -1 }, - { 'name': 'shift', 'src': 'viime', 'value': -1 }, - { 'name': 'shift', 'src': 'tä:llä|ssä|nä|mä', 'value': 0 }, - { 'name': 'shift', 'src': 'seuraava|seuraavana|tuleva|tulevana|ensi', 'value': 1 } - ], - 'parse': [ - '{months} {year?}', - '{shift} {unit:5-7}' - ], - 'timeParse': [ - '{shift?} {day|weekday}', - '{weekday?},? {date}\\.? {months?}\\.? {year?}' - ], - 'timeFrontParse': [ - '{shift?} {day|weekday}', - '{num?} {unit} {sign}', - '{weekday?},? {date}\\.? {months?}\\.? {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "fi" locale. - -/***/ }, -/* 423 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * French locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('fr') - * - */ - addLocale('fr', { - 'plural': true, - 'units': 'milliseconde:|s,seconde:|s,minute:|s,heure:|s,jour:|s,semaine:|s,mois,an:|s|née|nee', - 'months': 'janv:ier|,févr:ier|+fevr:ier|,mars,avr:il|,mai,juin,juil:let|,août,sept:embre|,oct:obre|,nov:embre|,déc:embre|+dec:embre|', - 'weekdays': 'dim:anche|,lun:di|,mar:di|,mer:credi|,jeu:di|,ven:dredi|,sam:edi|', - 'numerals': 'zéro,un:|e,deux,trois,quatre,cinq,six,sept,huit,neuf,dix', - 'tokens': "l'|la|le,er", - 'short': '{dd}/{MM}/{yyyy}', - 'medium': '{d} {month} {yyyy}', - 'long': '{d} {month} {yyyy} {time}', - 'full': '{weekday} {d} {month} {yyyy} {time}', - 'stamp': '{dow} {d} {mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'past': '{sign} {num} {unit}', - 'future': '{sign} {num} {unit}', - 'duration': '{num} {unit}', - 'timeMarkers': 'à', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': 'hier', 'value': -1 }, - { 'name': 'day', 'src': "aujourd'hui", 'value': 0 }, - { 'name': 'day', 'src': 'demain', 'value': 1 }, - { 'name': 'sign', 'src': 'il y a', 'value': -1 }, - { 'name': 'sign', 'src': "dans|d'ici", 'value': 1 }, - { 'name': 'shift', 'src': 'derni:èr|er|ère|ere', 'value': -1 }, - { 'name': 'shift', 'src': 'prochain:|e', 'value': 1 } - ], - 'parse': [ - '{months} {year?}', - '{sign} {num} {unit}', - '{0?} {unit:5-7} {shift}' - ], - 'timeParse': [ - '{day|weekday} {shift?}', - '{weekday?},? {0?} {date}{1?} {months}\\.? {year?}' - ], - 'timeFrontParse': [ - '{0?} {weekday} {shift}', - '{weekday?},? {0?} {date}{1?} {months}\\.? {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "fr" locale. - -/***/ }, -/* 424 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Italian locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('it') - * - */ - addLocale('it', { - 'plural': true, - 'units': 'millisecond:o|i,second:o|i,minut:o|i,or:a|e,giorn:o|i,settiman:a|e,mes:e|i,ann:o|i', - 'months': 'gen:naio|,feb:braio|,mar:zo|,apr:ile|,mag:gio|,giu:gno|,lug:lio|,ago:sto|,set:tembre|,ott:obre|,nov:embre|,dic:embre|', - 'weekdays': 'dom:enica|,lun:edì||edi,mar:tedì||tedi,mer:coledì||coledi,gio:vedì||vedi,ven:erdì||erdi,sab:ato|', - 'numerals': "zero,un:|a|o|',due,tre,quattro,cinque,sei,sette,otto,nove,dieci", - 'tokens': "l'|la|il", - 'short': '{dd}/{MM}/{yyyy}', - 'medium': '{d} {month} {yyyy}', - 'long': '{d} {month} {yyyy} {time}', - 'full': '{weekday}, {d} {month} {yyyy} {time}', - 'stamp': '{dow} {d} {mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'past': '{num} {unit} {sign}', - 'future': '{num} {unit} {sign}', - 'duration': '{num} {unit}', - 'timeMarkers': 'alle', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': 'ieri', 'value': -1 }, - { 'name': 'day', 'src': 'oggi', 'value': 0 }, - { 'name': 'day', 'src': 'domani', 'value': 1 }, - { 'name': 'day', 'src': 'dopodomani', 'value': 2 }, - { 'name': 'sign', 'src': 'fa', 'value': -1 }, - { 'name': 'sign', 'src': 'da adesso', 'value': 1 }, - { 'name': 'shift', 'src': 'scors:o|a', 'value': -1 }, - { 'name': 'shift', 'src': 'prossim:o|a', 'value': 1 } - ], - 'parse': [ - '{months} {year?}', - '{num} {unit} {sign}', - '{0?} {unit:5-7} {shift}', - '{0?} {shift} {unit:5-7}' - ], - 'timeParse': [ - '{shift?} {day|weekday}', - '{weekday?},? {date} {months?}\\.? {year?}' - ], - 'timeFrontParse': [ - '{shift?} {day|weekday}', - '{weekday?},? {date} {months?}\\.? {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "it" locale. - -/***/ }, -/* 425 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Japanese locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('ja') - * - */ - addLocale('ja', { - 'ampmFront': true, - 'numeralUnits': true, - 'allowsFullWidth': true, - 'timeMarkerOptional': true, - 'firstDayOfWeek': 0, - 'firstDayOfWeekYear': 1, - 'units': 'ミリ秒,秒,分,時間,日,週間|週,ヶ月|ヵ月|月,年|年度', - 'weekdays': '日:曜日||曜,月:曜日||曜,火:曜日||曜,水:曜日||曜,木:曜日||曜,金:曜日||曜,土:曜日||曜', - 'numerals': '〇,一,二,三,四,五,六,七,八,九', - 'placeholders': '十,百,千,万', - 'timeSuffixes': ',秒,分,時,日,,月,年度?', - 'short': '{yyyy}/{MM}/{dd}', - 'medium': '{yyyy}年{M}月{d}日', - 'long': '{yyyy}年{M}月{d}日{time}', - 'full': '{yyyy}年{M}月{d}日{time} {weekday}', - 'stamp': '{yyyy}年{M}月{d}日 {H}:{mm} {dow}', - 'time': '{tt}{h}時{mm}分', - 'past': '{num}{unit}{sign}', - 'future': '{num}{unit}{sign}', - 'duration': '{num}{unit}', - 'ampm': '午前,午後', - 'modifiers': [ - { 'name': 'day', 'src': '一昨々日|前々々日', 'value': -3 }, - { 'name': 'day', 'src': '一昨日|おととい|前々日', 'value': -2 }, - { 'name': 'day', 'src': '昨日|前日', 'value': -1 }, - { 'name': 'day', 'src': '今日|当日|本日', 'value': 0 }, - { 'name': 'day', 'src': '明日|翌日|次日', 'value': 1 }, - { 'name': 'day', 'src': '明後日|翌々日', 'value': 2 }, - { 'name': 'day', 'src': '明々後日|翌々々日', 'value': 3 }, - { 'name': 'sign', 'src': '前', 'value': -1 }, - { 'name': 'sign', 'src': '後', 'value': 1 }, - { 'name': 'edge', 'src': '始|初日|頭', 'value': -2 }, - { 'name': 'edge', 'src': '末|尻', 'value': 2 }, - { 'name': 'edge', 'src': '末日', 'value': 1 }, - { 'name': 'shift', 'src': '一昨々|前々々', 'value': -3 }, - { 'name': 'shift', 'src': '一昨|前々|先々', 'value': -2 }, - { 'name': 'shift', 'src': '先|昨|去|前', 'value': -1 }, - { 'name': 'shift', 'src': '今|本|当', 'value': 0 }, - { 'name': 'shift', 'src': '来|明|翌|次', 'value': 1 }, - { 'name': 'shift', 'src': '明後|翌々|次々|再来|さ来', 'value': 2 }, - { 'name': 'shift', 'src': '明々後|翌々々', 'value': 3 } - ], - 'parse': [ - '{month}{edge}', - '{num}{unit}{sign}', - '{year?}{month}', - '{year}' - ], - 'timeParse': [ - '{day|weekday}', - '{shift}{unit:5}{weekday?}', - '{shift}{unit:7}{month}{edge}', - '{shift}{unit:7}{month?}{date?}', - '{shift}{unit:6}{edge?}{date?}', - '{year?}{month?}{date}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "ja" locale. - -/***/ }, -/* 426 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Korean locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('ko') - * - */ - addLocale('ko', { - 'ampmFront': true, - 'numeralUnits': true, - 'units': '밀리초,초,분,시간,일,주,개월|달,년|해', - 'weekdays': '일:요일|,월:요일|,화:요일|,수:요일|,목:요일|,금:요일|,토:요일|', - 'numerals': '영|제로,일|한,이,삼,사,오,육,칠,팔,구,십', - 'short': '{yyyy}.{MM}.{dd}', - 'medium': '{yyyy}년 {M}월 {d}일', - 'long': '{yyyy}년 {M}월 {d}일 {time}', - 'full': '{yyyy}년 {M}월 {d}일 {weekday} {time}', - 'stamp': '{yyyy}년 {M}월 {d}일 {H}:{mm} {dow}', - 'time': '{tt} {h}시 {mm}분', - 'past': '{num}{unit} {sign}', - 'future': '{num}{unit} {sign}', - 'duration': '{num}{unit}', - 'timeSuffixes': ',초,분,시,일,,월,년', - 'ampm': '오전,오후', - 'modifiers': [ - { 'name': 'day', 'src': '그저께', 'value': -2 }, - { 'name': 'day', 'src': '어제', 'value': -1 }, - { 'name': 'day', 'src': '오늘', 'value': 0 }, - { 'name': 'day', 'src': '내일', 'value': 1 }, - { 'name': 'day', 'src': '모레', 'value': 2 }, - { 'name': 'sign', 'src': '전', 'value': -1 }, - { 'name': 'sign', 'src': '후', 'value': 1 }, - { 'name': 'shift', 'src': '지난|작', 'value': -1 }, - { 'name': 'shift', 'src': '이번|올', 'value': 0 }, - { 'name': 'shift', 'src': '다음|내', 'value': 1 } - ], - 'parse': [ - '{num}{unit} {sign}', - '{shift?} {unit:5-7}', - '{year?} {month}', - '{year}' - ], - 'timeParse': [ - '{day|weekday}', - '{shift} {unit:5?} {weekday}', - '{year?} {month?} {date} {weekday?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "ko" locale. - -/***/ }, -/* 427 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Dutch locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('nl') - * - */ - addLocale('nl', { - 'plural': true, - 'units': 'milliseconde:|n,seconde:|n,minu:ut|ten,uur,dag:|en,we:ek|ken,maand:|en,jaar', - 'months': 'jan:uari|,feb:ruari|,maart|mrt,apr:il|,mei,jun:i|,jul:i|,aug:ustus|,sep:tember|,okt:ober|,nov:ember|,dec:ember|', - 'weekdays': 'zondag|zo,maandag|ma,dinsdag|di,woensdag|wo|woe,donderdag|do,vrijdag|vr|vrij,zaterdag|za', - 'numerals': 'nul,een,twee,drie,vier,vijf,zes,zeven,acht,negen,tien', - 'short': '{dd}-{MM}-{yyyy}', - 'medium': '{d} {month} {yyyy}', - 'long': '{d} {Month} {yyyy} {time}', - 'full': '{weekday} {d} {Month} {yyyy} {time}', - 'stamp': '{dow} {d} {Mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'past': '{num} {unit} {sign}', - 'future': '{num} {unit} {sign}', - 'duration': '{num} {unit}', - 'timeMarkers': "'s,om", - 'modifiers': [ - { 'name': 'day', 'src': 'gisteren', 'value': -1 }, - { 'name': 'day', 'src': 'vandaag', 'value': 0 }, - { 'name': 'day', 'src': 'morgen', 'value': 1 }, - { 'name': 'day', 'src': 'overmorgen', 'value': 2 }, - { 'name': 'sign', 'src': 'geleden', 'value': -1 }, - { 'name': 'sign', 'src': 'vanaf nu', 'value': 1 }, - { 'name': 'shift', 'src': 'laatste|vorige|afgelopen', 'value': -1 }, - { 'name': 'shift', 'src': 'volgend:|e', 'value': 1 } - ], - 'parse': [ - '{months} {year?}', - '{num} {unit} {sign}', - '{0?} {unit:5-7} {shift}', - '{0?} {shift} {unit:5-7}' - ], - 'timeParse': [ - '{shift?} {day|weekday}', - '{weekday?},? {date} {months?}\\.? {year?}' - ], - 'timeFrontParse': [ - '{shift?} {day|weekday}', - '{weekday?},? {date} {months?}\\.? {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "nl" locale. - -/***/ }, -/* 428 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Norwegian locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('no') - * - */ - addLocale('no', { - 'plural': true, - 'units': 'millisekund:|er,sekund:|er,minutt:|er,tim:e|er,dag:|er,uk:e|er|en,måned:|er|en+maaned:|er|en,år:||et+aar:||et', - 'months': 'januar,februar,mars,april,mai,juni,juli,august,september,oktober,november,desember', - 'weekdays': 'søndag|sondag,mandag,tirsdag,onsdag,torsdag,fredag,lørdag|lordag', - 'numerals': 'en|et,to,tre,fire,fem,seks,sju|syv,åtte,ni,ti', - 'tokens': 'den,for', - 'articles': 'den', - 'short':'d. {d}. {month} {yyyy}', - 'long': 'den {d}. {month} {yyyy} {H}:{mm}', - 'full': '{Weekday} den {d}. {month} {yyyy} {H}:{mm}:{ss}', - 'past': '{num} {unit} {sign}', - 'future': '{sign} {num} {unit}', - 'duration': '{num} {unit}', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': 'forgårs|i forgårs|forgaars|i forgaars', 'value': -2 }, - { 'name': 'day', 'src': 'i går|igår|i gaar|igaar', 'value': -1 }, - { 'name': 'day', 'src': 'i dag|idag', 'value': 0 }, - { 'name': 'day', 'src': 'i morgen|imorgen', 'value': 1 }, - { 'name': 'day', 'src': 'overimorgen|overmorgen|over i morgen', 'value': 2 }, - { 'name': 'sign', 'src': 'siden', 'value': -1 }, - { 'name': 'sign', 'src': 'om', 'value': 1 }, - { 'name': 'shift', 'src': 'i siste|siste', 'value': -1 }, - { 'name': 'shift', 'src': 'denne', 'value': 0 }, - { 'name': 'shift', 'src': 'neste', 'value': 1 } - ], - 'parse': [ - '{num} {unit} {sign}', - '{sign} {num} {unit}', - '{1?} {num} {unit} {sign}', - '{shift} {unit:5-7}' - ], - 'timeParse': [ - '{date} {month}', - '{shift} {weekday}', - '{0?} {weekday?},? {date?} {month}\\.? {year}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "no" locale. - -/***/ }, -/* 429 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Polish locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('pl') - * - */ - addLocale('pl', { - 'plural': true, - 'units': 'milisekund:a|y|,sekund:a|y|,minut:a|y|,godzin:a|y|,dzień|dni|dni,tydzień|tygodnie|tygodni,miesiąc|miesiące|miesięcy,rok|lata|lat', - 'months': 'sty:cznia||czeń,lut:ego||y,mar:ca||zec,kwi:etnia||ecień,maj:a|,cze:rwca||rwiec,lip:ca||iec,sie:rpnia||rpień,wrz:eśnia||esień,paź:dziernika||dziernik,lis:topada||topad,gru:dnia||dzień', - 'weekdays': 'nie:dziela||dzielę,pon:iedziałek|,wt:orek|,śr:oda||odę,czw:artek|,piątek|pt,sobota|sb|sobotę', - 'numerals': 'zero,jeden|jedną,dwa|dwie,trzy,cztery,pięć,sześć,siedem,osiem,dziewięć,dziesięć', - 'tokens': 'w|we,roku', - 'short': '{dd}.{MM}.{yyyy}', - 'medium': '{d} {month} {yyyy}', - 'long': '{d} {month} {yyyy} {time}', - 'full' : '{weekday}, {d} {month} {yyyy} {time}', - 'stamp': '{dow} {d} {mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'timeMarkers': 'o', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': 'przedwczoraj', 'value': -2 }, - { 'name': 'day', 'src': 'wczoraj', 'value': -1 }, - { 'name': 'day', 'src': 'dzisiaj|dziś', 'value': 0 }, - { 'name': 'day', 'src': 'jutro', 'value': 1 }, - { 'name': 'day', 'src': 'pojutrze', 'value': 2 }, - { 'name': 'sign', 'src': 'temu|przed', 'value': -1 }, - { 'name': 'sign', 'src': 'za', 'value': 1 }, - { 'name': 'shift', 'src': 'zeszły|zeszła|ostatni|ostatnia', 'value': -1 }, - { 'name': 'shift', 'src': 'następny|następna|następnego|przyszły|przyszła|przyszłego', 'value': 1 } - ], - 'relative': function (num, unit, ms, format) { - // special cases for relative days - var DAY = 4; - if (unit === DAY) { - if (num === 1 && format === 'past') return 'wczoraj'; - if (num === 1 && format === 'future') return 'jutro'; - if (num === 2 && format === 'past') return 'przedwczoraj'; - if (num === 2 && format === 'future') return 'pojutrze'; - } - - var mult; - var last = +num.toFixed(0).slice(-1); - var last2 = +num.toFixed(0).slice(-2); - switch (true) { - case num === 1: mult = 0; break; - case last2 >= 12 && last2 <= 14: mult = 2; break; - case last >= 2 && last <= 4: mult = 1; break; - default: mult = 2; - } - var text = this['units'][(mult * 8) + unit]; - var prefix = num + ' '; - - // changing to accusative case for 'past' and 'future' formats - // (only singular feminine unit words are different in accusative, each of which ends with 'a') - if ((format === 'past' || format === 'future') && num === 1) { - text = text.replace(/a$/, 'ę'); - } - - text = prefix + text; - switch (format) { - case 'duration': return text; - case 'past': return text + ' temu'; - case 'future': return 'za ' + text; - } - }, - 'parse': [ - '{num} {unit} {sign}', - '{sign} {num} {unit}', - '{months} {year?}', - '{shift} {unit:5-7}', - '{0} {shift?} {weekday}' - ], - 'timeFrontParse': [ - '{day|weekday}', - '{date} {months} {year?} {1?}', - '{0?} {shift?} {weekday}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "pl" locale. - -/***/ }, -/* 430 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Portuguese locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('pt') - * - */ - addLocale('pt', { - 'plural': true, - 'units': 'milisegundo:|s,segundo:|s,minuto:|s,hora:|s,dia:|s,semana:|s,mês|mêses|mes|meses,ano:|s', - 'months': 'jan:eiro|,fev:ereiro|,mar:ço|,abr:il|,mai:o|,jun:ho|,jul:ho|,ago:sto|,set:embro|,out:ubro|,nov:embro|,dez:embro|', - 'weekdays': 'dom:ingo|,seg:unda-feira|,ter:ça-feira|,qua:rta-feira|,qui:nta-feira|,sex:ta-feira|,sáb:ado||ado', - 'numerals': 'zero,um:|a,dois|duas,três|tres,quatro,cinco,seis,sete,oito,nove,dez', - 'tokens': 'a,de', - 'short': '{dd}/{MM}/{yyyy}', - 'medium': '{d} de {Month} de {yyyy}', - 'long': '{d} de {Month} de {yyyy} {time}', - 'full': '{Weekday}, {d} de {Month} de {yyyy} {time}', - 'stamp': '{Dow} {d} {Mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'past': '{num} {unit} {sign}', - 'future': '{sign} {num} {unit}', - 'duration': '{num} {unit}', - 'timeMarkers': 'às', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': 'anteontem', 'value': -2 }, - { 'name': 'day', 'src': 'ontem', 'value': -1 }, - { 'name': 'day', 'src': 'hoje', 'value': 0 }, - { 'name': 'day', 'src': 'amanh:ã|a', 'value': 1 }, - { 'name': 'sign', 'src': 'atrás|atras|há|ha', 'value': -1 }, - { 'name': 'sign', 'src': 'daqui a', 'value': 1 }, - { 'name': 'shift', 'src': 'passad:o|a', 'value': -1 }, - { 'name': 'shift', 'src': 'próximo|próxima|proximo|proxima', 'value': 1 } - ], - 'parse': [ - '{months} {1?} {year?}', - '{num} {unit} {sign}', - '{sign} {num} {unit}', - '{0?} {unit:5-7} {shift}', - '{0?} {shift} {unit:5-7}' - ], - 'timeParse': [ - '{shift?} {day|weekday}', - '{0?} {shift} {weekday}', - '{date} {1?} {months?} {1?} {year?}' - ], - 'timeFrontParse': [ - '{shift?} {day|weekday}', - '{date} {1?} {months?} {1?} {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "pt" locale. - -/***/ }, -/* 431 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Russian locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('ru') - * - */ - addLocale('ru', { - 'firstDayOfWeekYear': 1, - 'units': 'миллисекунд:а|у|ы|,секунд:а|у|ы|,минут:а|у|ы|,час:||а|ов,день|день|дня|дней,недел:я|ю|и|ь|е,месяц:||а|ев|е,год|год|года|лет|году', - 'months': 'янв:аря||.|арь,фев:раля||р.|раль,мар:та||т,апр:еля||.|ель,мая|май,июн:я||ь,июл:я||ь,авг:уста||.|уст,сен:тября||т.|тябрь,окт:ября||.|ябрь,ноя:бря||брь,дек:абря||.|абрь', - 'weekdays': 'воскресенье|вс,понедельник|пн,вторник|вт,среда|ср,четверг|чт,пятница|пт,суббота|сб', - 'numerals': 'ноль,од:ин|ну,дв:а|е,три,четыре,пять,шесть,семь,восемь,девять,десять', - 'tokens': 'в|на,г\\.?(?:ода)?', - 'short': '{dd}.{MM}.{yyyy}', - 'medium': '{d} {month} {yyyy} г.', - 'long': '{d} {month} {yyyy} г., {time}', - 'full': '{weekday}, {d} {month} {yyyy} г., {time}', - 'stamp': '{dow} {d} {mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'timeMarkers': 'в', - 'ampm': ' утра, вечера', - 'modifiers': [ - { 'name': 'day', 'src': 'позавчера', 'value': -2 }, - { 'name': 'day', 'src': 'вчера', 'value': -1 }, - { 'name': 'day', 'src': 'сегодня', 'value': 0 }, - { 'name': 'day', 'src': 'завтра', 'value': 1 }, - { 'name': 'day', 'src': 'послезавтра', 'value': 2 }, - { 'name': 'sign', 'src': 'назад', 'value': -1 }, - { 'name': 'sign', 'src': 'через', 'value': 1 }, - { 'name': 'shift', 'src': 'прошл:ый|ой|ом', 'value': -1 }, - { 'name': 'shift', 'src': 'следующ:ий|ей|ем', 'value': 1 } - ], - 'relative': function(num, unit, ms, format) { - var numberWithUnit, last = num.toString().slice(-1), mult; - switch(true) { - case num >= 11 && num <= 15: mult = 3; break; - case last == 1: mult = 1; break; - case last >= 2 && last <= 4: mult = 2; break; - default: mult = 3; - } - numberWithUnit = num + ' ' + this['units'][(mult * 8) + unit]; - switch(format) { - case 'duration': return numberWithUnit; - case 'past': return numberWithUnit + ' назад'; - case 'future': return 'через ' + numberWithUnit; - } - }, - 'parse': [ - '{num} {unit} {sign}', - '{sign} {num} {unit}', - '{months} {year?}', - '{0?} {shift} {unit:5-7}' - ], - 'timeParse': [ - '{day|weekday}', - '{0?} {shift} {weekday}', - '{date} {months?} {year?} {1?}' - ], - 'timeFrontParse': [ - '{0?} {shift} {weekday}', - '{date} {months?} {year?} {1?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "ru" locale. - -/***/ }, -/* 432 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Swedish locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('sv') - * - */ - addLocale('sv', { - 'plural': true, - 'units': 'millisekund:|er,sekund:|er,minut:|er,timm:e|ar,dag:|ar,veck:a|or|an,månad:|er|en+manad:|er|en,år:||et+ar:||et', - 'months': 'jan:uari|,feb:ruari|,mar:s|,apr:il|,maj,jun:i|,jul:i|,aug:usti|,sep:tember|,okt:ober|,nov:ember|,dec:ember|', - 'weekdays': 'sön:dag|+son:dag|,mån:dag||dagen+man:dag||dagen,tis:dag|,ons:dag|,tor:sdag|,fre:dag|,lör:dag||dag', - 'numerals': 'noll,en|ett,två|tva,tre,fyra,fem,sex,sju,åtta|atta,nio,tio', - 'tokens': 'den,för|for', - 'articles': 'den', - 'short': '{yyyy}-{MM}-{dd}', - 'medium': '{d} {month} {yyyy}', - 'long': '{d} {month} {yyyy} {time}', - 'full': '{weekday} {d} {month} {yyyy} {time}', - 'stamp': '{dow} {d} {mon} {yyyy} {time}', - 'time': '{H}:{mm}', - 'past': '{num} {unit} {sign}', - 'future': '{sign} {num} {unit}', - 'duration': '{num} {unit}', - 'ampm': 'am,pm', - 'modifiers': [ - { 'name': 'day', 'src': 'förrgår|i förrgår|iförrgår|forrgar|i forrgar|iforrgar', 'value': -2 }, - { 'name': 'day', 'src': 'går|i går|igår|gar|i gar|igar', 'value': -1 }, - { 'name': 'day', 'src': 'dag|i dag|idag', 'value': 0 }, - { 'name': 'day', 'src': 'morgon|i morgon|imorgon', 'value': 1 }, - { 'name': 'day', 'src': 'över morgon|övermorgon|i över morgon|i övermorgon|iövermorgon|over morgon|overmorgon|i over morgon|i overmorgon|iovermorgon', 'value': 2 }, - { 'name': 'sign', 'src': 'sedan|sen', 'value': -1 }, - { 'name': 'sign', 'src': 'om', 'value': 1 }, - { 'name': 'shift', 'src': 'i förra|förra|i forra|forra', 'value': -1 }, - { 'name': 'shift', 'src': 'denna', 'value': 0 }, - { 'name': 'shift', 'src': 'nästa|nasta', 'value': 1 } - ], - 'parse': [ - '{months} {year?}', - '{num} {unit} {sign}', - '{sign} {num} {unit}', - '{1?} {num} {unit} {sign}', - '{shift} {unit:5-7}' - ], - 'timeParse': [ - '{day|weekday}', - '{shift} {weekday}', - '{0?} {weekday?},? {date} {months?}\\.? {year?}' - ], - 'timeFrontParse': [ - '{day|weekday}', - '{shift} {weekday}', - '{0?} {weekday?},? {date} {months?}\\.? {year?}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "sv" locale. - -/***/ }, -/* 433 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Simplified Chinese locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('zh-CN') - * - */ - addLocale('zh-CN', { - 'ampmFront': true, - 'numeralUnits': true, - 'allowsFullWidth': true, - 'timeMarkerOptional': true, - 'units': '毫秒,秒钟,分钟,小时,天,个星期|周,个月,年', - 'weekdays': '星期日|日|周日|星期天,星期一|一|周一,星期二|二|周二,星期三|三|周三,星期四|四|周四,星期五|五|周五,星期六|六|周六', - 'numerals': '〇,一,二,三,四,五,六,七,八,九', - 'placeholders': '十,百,千,万', - 'short': '{yyyy}-{MM}-{dd}', - 'medium': '{yyyy}年{M}月{d}日', - 'long': '{yyyy}年{M}月{d}日{time}', - 'full': '{yyyy}年{M}月{d}日{weekday}{time}', - 'stamp': '{yyyy}年{M}月{d}日{H}:{mm}{dow}', - 'time': '{tt}{h}点{mm}分', - 'past': '{num}{unit}{sign}', - 'future': '{num}{unit}{sign}', - 'duration': '{num}{unit}', - 'timeSuffixes': ',秒,分钟?,点|时,日|号,,月,年', - 'ampm': '上午,下午', - 'modifiers': [ - { 'name': 'day', 'src': '大前天', 'value': -3 }, - { 'name': 'day', 'src': '前天', 'value': -2 }, - { 'name': 'day', 'src': '昨天', 'value': -1 }, - { 'name': 'day', 'src': '今天', 'value': 0 }, - { 'name': 'day', 'src': '明天', 'value': 1 }, - { 'name': 'day', 'src': '后天', 'value': 2 }, - { 'name': 'day', 'src': '大后天', 'value': 3 }, - { 'name': 'sign', 'src': '前', 'value': -1 }, - { 'name': 'sign', 'src': '后', 'value': 1 }, - { 'name': 'shift', 'src': '上|去', 'value': -1 }, - { 'name': 'shift', 'src': '这', 'value': 0 }, - { 'name': 'shift', 'src': '下|明', 'value': 1 } - ], - 'parse': [ - '{num}{unit}{sign}', - '{shift}{unit:5-7}', - '{year?}{month}', - '{year}' - ], - 'timeParse': [ - '{day|weekday}', - '{shift}{weekday}', - '{year?}{month?}{date}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "zh-CN" locale. - -/***/ }, -/* 434 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var addLocale = __webpack_require__(33); - - /* - * Traditional Chinese locale definition. - * See the readme for customization and more information. - * To set this locale globally: - * - * Sugar.Date.setLocale('zh-TW') - * - */ - addLocale('zh-TW', { - 'ampmFront': true, - 'numeralUnits': true, - 'allowsFullWidth': true, - 'timeMarkerOptional': true, - 'units': '毫秒,秒鐘,分鐘,小時,天,個星期|週,個月,年', - 'weekdays': '星期日|日|週日|星期天,星期一|一|週一,星期二|二|週二,星期三|三|週三,星期四|四|週四,星期五|五|週五,星期六|六|週六', - 'numerals': '〇,一,二,三,四,五,六,七,八,九', - 'placeholders': '十,百,千,万', - 'short': '{yyyy}/{MM}/{dd}', - 'medium': '{yyyy}年{M}月{d}日', - 'long': '{yyyy}年{M}月{d}日{time}', - 'full': '{yyyy}年{M}月{d}日{weekday}{time}', - 'stamp': '{yyyy}年{M}月{d}日{H}:{mm}{dow}', - 'time': '{tt}{h}點{mm}分', - 'past': '{num}{unit}{sign}', - 'future': '{num}{unit}{sign}', - 'duration': '{num}{unit}', - 'timeSuffixes': ',秒,分鐘?,點|時,日|號,,月,年', - 'ampm': '上午,下午', - 'modifiers': [ - { 'name': 'day', 'src': '大前天', 'value': -3 }, - { 'name': 'day', 'src': '前天', 'value': -2 }, - { 'name': 'day', 'src': '昨天', 'value': -1 }, - { 'name': 'day', 'src': '今天', 'value': 0 }, - { 'name': 'day', 'src': '明天', 'value': 1 }, - { 'name': 'day', 'src': '後天', 'value': 2 }, - { 'name': 'day', 'src': '大後天', 'value': 3 }, - { 'name': 'sign', 'src': '前', 'value': -1 }, - { 'name': 'sign', 'src': '後', 'value': 1 }, - { 'name': 'shift', 'src': '上|去', 'value': -1 }, - { 'name': 'shift', 'src': '這', 'value': 0 }, - { 'name': 'shift', 'src': '下|明', 'value': 1 } - ], - 'parse': [ - '{num}{unit}{sign}', - '{shift}{unit:5-7}', - '{year?}{month}', - '{year}' - ], - 'timeParse': [ - '{day|weekday}', - '{shift}{weekday}', - '{year?}{month?}{date}' - ] - }); - - - // This package does not export anything as it is - // simply registering the "zh-TW" locale. - -/***/ } -/******/ ]) -}); -; -//# sourceMappingURL=tablefilter.js.map \ No newline at end of file +/** + * tablefilter v0.4.0 by Max Guglielmi + * build date: 2016-10-22T08:31:21.770Z + * MIT License + */ + +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return t[i].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var i=window.webpackJsonp;window.webpackJsonp=function(n,r){for(var a,o,l=0,u=[];l",this.lwOperator=c.lower_operator||"<",this.leOperator=c.lower_equal_operator||"<=",this.geOperator=c.greater_equal_operator||">=",this.dfOperator=c.different_operator||"!",this.lkOperator=c.like_operator||"*",this.eqOperator=c.equal_operator||"=",this.stOperator=c.start_with_operator||"{",this.enOperator=c.end_with_operator||"}",this.separator=c.separator||",",this.rowsCounter=Boolean(c.rows_counter),this.statusBar=Boolean(c.status_bar),this.loader=Boolean(c.loader),this.displayBtn=Boolean(c.btn),this.btnText=c.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=c.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(c.btn_reset),this.onBeforeReset=(0,l.isFn)(c.on_before_reset)?c.on_before_reset:null,this.onAfterReset=(0,l.isFn)(c.on_after_reset)?c.on_after_reset:null,this.paging=Boolean(c.paging),this.nbHiddenRows=0,this.autoFilter=Boolean(c.auto_filter),this.autoFilterDelay=isNaN(c.auto_filter_delay)?N.AUTO_FILTER_DELAY:c.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(c.highlight_keywords),this.noResults=(0,l.isObj)(c.no_results_message)||Boolean(c.no_results_message),this.state=(0,l.isObj)(c.state)||Boolean(c.state),this.locale=c.locale||"en",this.thousandsSeparator=c.thousands_separator||",",this.decimalSeparator=c.decimal_separator||".",this.hasColTypes=(0,l.isArray)(c.col_types),this.colTypes=this.hasColTypes?c.col_types:[],this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxResponsive="resp",this.extensions=c.extensions,this.hasExtensions=(0,l.isArray)(this.extensions),this.enableDefaultTheme=Boolean(c.enable_default_theme),this.hasThemes=this.enableDefaultTheme||(0,l.isArray)(c.themes),this.themes=c.themes||[],this.themesPath=c.themes_path||this.stylePath+"themes/",this.responsive=Boolean(c.responsive),this.Mod={},this.ExtRegistry={}}return t.prototype.init=function(){var t=this;if(!this.initialized){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,n=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),e.dateType||(e.dateType=new k.DateType(this)),e.dateType.init(),e.help||(e.help=new w.Help(this)),this.help&&e.help.init(),this.state&&(e.state||(e.state=new T.State(this)),e.state.init()),this.gridLayout&&(e.gridLayout||(e.gridLayout=new h.GridLayout(this)),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new d.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new p.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new m.PopupFilter(this)),e.popupFilter.init()),this.fltGrid){var s=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb();for(var r=0;r0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display=N.NONE),this.emitter.emit("filters-row-inserted",this,t),t}},t.prototype._initNoFilters=function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb())},t.prototype._buildInputFilter=function(t,e,i){var n=this,s=this.getFilterType(t),o=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===N.INPUT?"text":"hidden",u=(0,a.createElm)(N.INPUT,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&u.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),u.className=e||this.fltCssClass,(0,r.addEvt)(u,"focus",function(t){return n.onInpFocus(t)}),o?(0,a.elm)(o).appendChild(u):i.appendChild(u),this.fltIds.push(u.id),(0,r.addEvt)(u,"keypress",function(t){return n.detectKey(t)}),(0,r.addEvt)(u,"keydown",function(){return n.onKeyDown()}),(0,r.addEvt)(u,"keyup",function(t){return n.onKeyUp(t)}),(0,r.addEvt)(u,"blur",function(){return n.onInpBlur()})},t.prototype._buildSubmitButton=function(t,e){var i=this,n=this.isExternalFlt?this.externalFltTgtIds[t]:null,s=(0,a.createElm)(N.INPUT,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);s.className=this.btnCssClass,n?(0,a.elm)(n).appendChild(s):e.appendChild(s),(0,r.addEvt)(s,"click",function(){return i.filter()})},t.prototype.feature=function(t){return this.Mod[t]},t.prototype.initExtensions=function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,n=t.length;e0&&void 0!==arguments[0]?arguments[0]:"default";return(0,a.elm)(this.prfxTf+t)},t.prototype.destroy=function(){var t=this;if(this.initialized){var e=this.Mod,i=this.emitter;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.markActiveColumns&&(this.clearActiveColumns(),i.off(["before-filtering"],function(){return t.clearActiveColumns()}),i.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions(),this.validateAllRows(),this.fltGrid&&!this.gridLayout&&this.tbl.deleteRow(this.filtersRowIndex),i.emit("destroy",this),Object.keys(e).forEach(function(t){var i=e[t];i&&(0,l.isFn)(i.destroy)&&i.destroy()}),this.hasVisibleRows&&i.off(["after-filtering"],function(){return t.enforceVisibility()}),this.linkedFilters&&i.off(["after-filtering"],function(){return t.linkFilters()}),this.emitter.off(["filter-focus"],function(e,i){return t.setActiveFilterId(i.id)}),(0,a.removeClass)(this.tbl,this.prfxTf),(0,a.removeClass)(this.tbl,this.prfxResponsive),this.nbHiddenRows=0,this.validRowsIndex=[],this.fltIds=[],this.initialized=!1}},t.prototype.setToolbar=function(){if(!this.infDiv){var t=(0,a.createElm)("div",["id",this.prfxInfDiv+this.id]);if(t.className=this.infDivCssClass,this.toolBarTgtId)(0,a.elm)(this.toolBarTgtId).appendChild(t);else if(this.gridLayout){var e=this.Mod.gridLayout;e.tblMainCont.appendChild(t),t.className=e.infDivCssClass}else{var i=(0,a.createElm)("caption");i.appendChild(t),this.tbl.insertBefore(i,this.tbl.firstChild)}this.infDiv=(0,a.elm)(this.prfxInfDiv+this.id);var n=(0,a.createElm)("div",["id",this.prfxLDiv+this.id]);n.className=this.lDivCssClass,t.appendChild(n),this.lDiv=(0,a.elm)(this.prfxLDiv+this.id);var s=(0,a.createElm)("div",["id",this.prfxRDiv+this.id]);s.className=this.rDivCssClass,t.appendChild(s),this.rDiv=(0,a.elm)(this.prfxRDiv+this.id);var r=(0,a.createElm)("div",["id",this.prfxMDiv+this.id]);r.className=this.mDivCssClass,t.appendChild(r),this.mDiv=(0,a.elm)(this.prfxMDiv+this.id),(0,l.isUndef)(this.help)&&(this.Mod.help.enabled=!0,this.emitter.emit("init-help",this))}},t.prototype.removeToolbar=function(){if(this.infDiv){(0,a.removeElm)(this.infDiv),this.infDiv=null;var t=this.tbl,e=(0,a.tag)(t,"caption");e.length>0&&[].forEach.call(e,function(e){return t.removeChild(e)})}},t.prototype.removeExternalFlts=function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;i=R):z?(R=L(t.replace(m,""),j),n=I>R):U?(R=L(t.replace(g,""),j),n=I.toString()!==R.toString()):V?(R=L(t.replace(v,""),j),n=I.toString()===R.toString()):y.test(t)?n=(0,o.contains)(t.replace(y,""),e,!1,this.caseSensitive):A(t)?(R=L(t,j),n=I.toString()===R.toString()):n=F?(0,o.isEmpty)(e):P?!(0,o.isEmpty)(e):(0,o.contains)(t,e,this.isExactMatch(i),this.caseSensitive)}else{if(this.hasType(i,[N.FORMATTED_NUMBER])){var K=this.colTypes[i];K.hasOwnProperty("decimal")&&(f=K.decimal)}if(c=Number(e)||(0,u.parse)(e,f),r)n=c<=(0,u.parse)(t.replace(h,""),f);else if(l)n=c>=(0,u.parse)(t.replace(d,""),f);else if(s)n=c<(0,u.parse)(t.replace(p,""),f);else if(a)n=c>(0,u.parse)(t.replace(m,""),f);else if(E)n=!(0,o.contains)(t.replace(g,""),e,!1,this.caseSensitive);else if(k)n=(0,o.contains)(t.replace(y,""),e,!1,this.caseSensitive);else if(T)n=(0,o.contains)(t.replace(v,""),e,!0,this.caseSensitive);else if(S)n=0===e.indexOf(t.replace(b,""));else if(O){var Y=t.replace(x,"");n=e.lastIndexOf(Y,e.length-1)===e.length-1-(Y.length-1)&&e.lastIndexOf(Y,e.length-1)>-1}else if(F)n=(0,o.isEmpty)(e);else if(P)n=!(0,o.isEmpty)(e);else if(D)try{var G=t.replace(C,""),X=new RegExp(G);n=X.test(e)}catch(q){n=!1}else c&&this.hasType(i,[N.NUMBER,N.FORMATTED_NUMBER])&&!this.singleSearchFlt?(t=(0,u.parse)(t,f)||t,n=c===t||(0,o.contains)(t.toString(),c.toString(),this.isExactMatch(i),this.caseSensitive)):n=(0,o.contains)(t,e,this.isExactMatch(i),this.caseSensitive,this.ignoresDiacritics(i))}return n}if(this.fltGrid&&this.initialized){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,n=this.getRowsNb(!0),s=0;this.validRowsIndex=[];for(var r=this.getFiltersValue(),c=void 0,f=this.decimalSeparator,h=new RegExp(this.leOperator),d=new RegExp(this.geOperator),p=new RegExp(this.lwOperator),m=new RegExp(this.grOperator),g=new RegExp(this.dfOperator),y=new RegExp((0,o.rgxEsc)(this.lkOperator)),v=new RegExp(this.eqOperator),b=new RegExp(this.stOperator),x=new RegExp(this.enOperator),_=this.emOperator,w=this.nmOperator,C=new RegExp((0,o.rgxEsc)(this.rgxOperator)),E=this.refRow;E1,A=D.toString().split(this.anOperator),L=A.length>1;if((0,l.isArray)(D)||M||L){var j=void 0,H=void 0,B=!1;H=(0,l.isArray)(D)?D:M?R:A;for(var z=0,W=H.length;z1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(this.fltGrid){var s=this.tbl.rows,r=this.getRowsNb(!0),a=[];e&&a.push(this.getHeadersText()[t]);for(var o=this.refRow;o0&&(l=n.indexOf(o)!==-1);var c=s[o].cells,f=c.length;if(f===this.nbCells&&!l)for(var h=0;h0&&void 0!==arguments[0]?arguments[0]:0,e=this.tbl.rows[t];return e.cells.length},t.prototype.getRowsNb=function(t){var e=(0,l.isUndef)(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)},t.prototype.getCellData=function(t){var e=t.cellIndex;return this.customCellData&&this.customCellDataCols.indexOf(e)!==-1?this.customCellData.call(null,this,t,e):(0,a.getText)(t)},t.prototype.getTableData=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.tbl.rows,n=this.getRowsNb(!0),s=[];if(t){var r=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),r])}for(var a=this.refRow;a0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,n=[];if(t){var s=this.getHeadersText(e);n.push([this.getHeadersRowIndex(),s])}for(var r=this.getValidRows(!0),a=0;a1&&void 0!==arguments[1]&&arguments[1];if((0,l.isUndef)(t))return[];var i=this.getFilteredData(),n=[];e&&n.push(this.getHeadersText()[t]);for(var s=0,r=i.length;s1&&void 0!==arguments[1]?arguments[1]:"";if(this.fltGrid){var i=this.getFilterElement(t),n=this.getFilterType(t);if(n!==N.MULTIPLE&&n!==N.CHECKLIST)this.loadFltOnDemand&&!this.initialized&&this.emitter.emit("build-select-filter",this,t,this.linkedFilters,this.isExternalFlt),i.value=e;else if(n===N.MULTIPLE){var s=(0,l.isArray)(e)?e:e.split(" "+this.orOperator+" ");this.loadFltOnDemand&&!this.initialized&&this.emitter.emit("build-select-filter",this,t,this.linkedFilters,this.isExternalFlt),this.emitter.emit("select-options",this,t,s)}else if(n===N.CHECKLIST){var r=[];this.loadFltOnDemand&&!this.initialized&&this.emitter.emit("build-checklist-filter",this,t,this.isExternalFlt),(0,l.isArray)(e)?r=e:(e=(0,o.matchCase)(e,this.caseSensitive),r=e.split(" "+this.orOperator+" ")),this.emitter.emit("select-checklist-options",this,t,r)}}},t.prototype.setColWidths=function(t){if(this.hasColWidths){t=t||this.tbl;for(var e=this.nbCells,i=this.colWidths,n=(0,a.tag)(t,"col"),s=n.length>0,r=s?null:S.createDocumentFragment(),o=0;o0&&void 0!==arguments[0]?arguments[0]:"",e=t.split("_")[0];return e=e.split(this.prfxFlt)[1],parseInt(e,10)},t.prototype.activateFilter=function(t){(0,l.isUndef)(t)||this.setActiveFilterId(this.getFilterId(t))},t.prototype.linkFilters=function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(N.SELECT,!0),e=this.getFiltersByType(N.MULTIPLE,!0),i=this.getFiltersByType(N.CHECKLIST,!0),n=t.concat(e);n=n.concat(i);for(var s=this.getColumnIndexFromFilterId(this.activeFilterId),r=0,o=n.length;r1&&void 0!==arguments[1]?arguments[1]:"script",i=!1,n="script"===e?"src":"href",s=(0,a.tag)(S,e),r=0,o=s.length;r3&&void 0!==arguments[3]?arguments[3]:"script";if(!this.isImported(e,s)){var r=this,o=!1,l=void 0,u=(0,a.tag)(S,"head")[0];l="link"===s.toLowerCase()?(0,a.createElm)("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):(0,a.createElm)("script",["id",t],["type","text/javascript"],["src",e]),l.onload=l.onreadystatechange=function(){o||n.readyState&&"loaded"!==n.readyState&&"complete"!==n.readyState||(o=!0,"function"==typeof i&&i.call(null,r))},l.onerror=function(){throw new Error("TableFilter could not load: "+e)},u.appendChild(l)}},t.prototype.isInitialized=function(){return this.initialized},t.prototype.getFiltersId=function(){return this.fltIds||[]},t.prototype.getValidRows=function(t){if(!t)return this.validRowsIndex;var e=this.getRowsNb(!0);this.validRowsIndex=[];for(var i=this.refRow;i1&&void 0!==arguments[1]?arguments[1]:[];if(!this.hasColTypes)return!1;var i=this.colTypes[t];return(0,l.isObj)(i)&&(i=i.type),e.indexOf(i)!==-1},t.prototype.getHeaderElement=function(t){for(var e=this.gridLayout?this.Mod.gridLayout.headTbl:this.tbl,i=(0,a.tag)(e,"thead"),n=this.headersRow,s=void 0,r=0;r0&&void 0!==arguments[0]&&arguments[0],e=[],i=0;i0&&void 0!==arguments[0]&&arguments[0];return this.getValidRows(t).length},t.prototype.config=function(){return this.cfg},t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.keyCode=e.targetEvt=e.cancelEvt=e.stopEvt=e.removeEvt=e.addEvt=void 0;var n=i(2);e.addEvt=function(t,e,i,n){t.addEventListener?t.addEventListener(e,i,n):t.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i},e.removeEvt=function(t,e,i,n){t.detachEvent?t.detachEvent("on"+e,i):t.removeEventListener?t.removeEventListener(e,i,n):t["on"+e]=null},e.stopEvt=function(t){t||(t=n.root.event),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},e.cancelEvt=function(t){t||(t=n.root.event),t.preventDefault?t.preventDefault():t.returnValue=!1},e.targetEvt=function(t){return t||(t=n.root.event),t.target||t.srcElement},e.keyCode=function(t){return t.charCode?t.charCode:t.keyCode?t.keyCode:t.which?t.which:0}},function(t,e){(function(t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.root="object"===("undefined"==typeof self?"undefined":i(self))&&self.self===self&&self||"object"===("undefined"==typeof t?"undefined":i(t))&&t.global===t&&t||void 0}).call(e,function(){return this}())},function(t,e,i){"use strict";function n(){return o.documentElement.classList}Object.defineProperty(e,"__esModule",{value:!0}),e.tag=e.elm=e.createCheckItem=e.createOpt=e.removeClass=e.addClass=e.hasClass=e.createText=e.removeElm=e.createElm=e.getFirstTextNode=e.getText=void 0;var s=i(2),r=i(4),a=i(5),o=s.root.document,l=(e.getText=function(t){return(0,r.isUndef)(t.textContent)?(0,a.trim)(t.innerText):(0,a.trim)(t.textContent)},e.getFirstTextNode=function(t){for(var e=0;e1&&void 0!==arguments[1]&&arguments[1];return e?t:t.toLowerCase()},e.contains=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=void 0,l=s?"g":"gi";return a&&(t=(0,n.remove)(t),e=(0,n.remove)(e)),o=i?new RegExp("(^\\s*)"+r(t)+"(\\s*$)",l):new RegExp(r(t),l),o.test(e)}},function(t,e){function i(t){return t.replace(/[^\u0000-\u007e]/g,function(t){return s[t]||t})}e.remove=i;for(var n=[{base:" ",chars:" "},{base:"0",chars:"߀"},{base:"A",chars:"ⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",chars:"Ꜳ"},{base:"AE",chars:"ÆǼǢ"},{base:"AO",chars:"Ꜵ"},{base:"AU",chars:"Ꜷ"},{base:"AV",chars:"ꜸꜺ"},{base:"AY",chars:"Ꜽ"},{base:"B",chars:"ⒷBḂḄḆɃƁ"},{base:"C",chars:"ⒸCꜾḈĆCĈĊČÇƇȻ"},{base:"D",chars:"ⒹDḊĎḌḐḒḎĐƊƉᴅꝹ"},{base:"Dh",chars:"Ð"},{base:"DZ",chars:"DZDŽ"},{base:"Dz",chars:"DzDž"},{base:"E",chars:"ɛⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎᴇ"},{base:"F",chars:"ꝼⒻFḞƑꝻ"},{base:"G",chars:"ⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾɢ"},{base:"H",chars:"ⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",chars:"ⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",chars:"ⒿJĴɈȷ"},{base:"K",chars:"ⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",chars:"ⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",chars:"LJ"},{base:"Lj",chars:"Lj"},{base:"M",chars:"ⓂMḾṀṂⱮƜϻ"},{base:"N",chars:"ꞤȠⓃNǸŃÑṄŇṆŅṊṈƝꞐᴎ"},{base:"NJ",chars:"NJ"},{base:"Nj",chars:"Nj"},{base:"O",chars:"ⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OE",chars:"Œ"},{base:"OI",chars:"Ƣ"},{base:"OO",chars:"Ꝏ"},{base:"OU",chars:"Ȣ"},{base:"P",chars:"ⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",chars:"ⓆQꝖꝘɊ"},{base:"R",chars:"ⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",chars:"ⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",chars:"ⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"Th",chars:"Þ"},{base:"TZ",chars:"Ꜩ"},{base:"U",chars:"ⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",chars:"ⓋVṼṾƲꝞɅ"},{base:"VY",chars:"Ꝡ"},{base:"W",chars:"ⓌWẀẂŴẆẄẈⱲ"},{base:"X",chars:"ⓍXẊẌ"},{base:"Y",chars:"ⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",chars:"ⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",chars:"ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑ"},{base:"aa",chars:"ꜳ"},{base:"ae",chars:"æǽǣ"},{base:"ao",chars:"ꜵ"},{base:"au",chars:"ꜷ"},{base:"av",chars:"ꜹꜻ"},{base:"ay",chars:"ꜽ"},{base:"b",chars:"ⓑbḃḅḇƀƃɓƂ"},{base:"c",chars:"cⓒćĉċčçḉƈȼꜿↄ"},{base:"d",chars:"ⓓdḋďḍḑḓḏđƌɖɗƋᏧԁꞪ"},{base:"dh",chars:"ð"},{base:"dz",chars:"dzdž"},{base:"e",chars:"ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇǝ"},{base:"f",chars:"ⓕfḟƒ"},{base:"ff",chars:"ff"},{base:"fi",chars:"fi"},{base:"fl",chars:"fl"},{base:"ffi",chars:"ffi"},{base:"ffl",chars:"ffl"},{base:"g",chars:"ⓖgǵĝḡğġǧģǥɠꞡꝿᵹ"},{base:"h",chars:"ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",chars:"ƕ"},{base:"i",chars:"ⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",chars:"ⓙjĵǰɉ"},{base:"k",chars:"ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",chars:"ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇɭ"},{base:"lj",chars:"lj"},{base:"m",chars:"ⓜmḿṁṃɱɯ"},{base:"n",chars:"ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥлԉ"},{base:"nj",chars:"nj"},{base:"o",chars:"ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿꝋꝍɵɔᴑ"},{base:"oe",chars:"œ"},{base:"oi",chars:"ƣ"},{base:"oo",chars:"ꝏ"},{base:"ou",chars:"ȣ"},{base:"p",chars:"ⓟpṕṗƥᵽꝑꝓꝕρ"},{base:"q",chars:"ⓠqɋꝗꝙ"},{base:"r",chars:"ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",chars:"ⓢsśṥŝṡšṧṣṩșşȿꞩꞅẛʂ"},{base:"ss",chars:"ß"},{base:"t",chars:"ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"th",chars:"þ"},{base:"tz",chars:"ꜩ"},{base:"u",chars:"ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",chars:"ⓥvṽṿʋꝟʌ"},{base:"vy",chars:"ꝡ"},{base:"w",chars:"ⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",chars:"ⓧxẋẍ"},{base:"y",chars:"ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",chars:"ⓩzźẑżžẓẕƶȥɀⱬꝣ"}],s={},r=0;r1&&void 0!==arguments[1]?arguments[1]:".";if((0,n.isNumber)(t))return t;var i=new RegExp("[^0-9-"+e+"]",["g"]),s=parseFloat((""+t).replace(/\((.*)\)/,"-$1").replace(i,"").replace(e,"."));return isNaN(s)?0:s}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});e.Emitter=function(){function t(){i(this,t),this.events={}}return t.prototype.on=function(t,e){var i=this;t.forEach(function(t){i.events[t]=i.events[t]||[],i.events[t].push(e)})},t.prototype.off=function(t,e){var i=this;t.forEach(function(t){t in i.events&&i.events[t].splice(i.events[t].indexOf(e),1)})},t.prototype.emit=function(t){if(t in this.events)for(var e=0;e0,r.tblMainCont=null,r.tblCont=null,r.headTblCont=null,r.headTbl=null,i.fltGrid=r.enableFilters,r}return r(e,t),e.prototype.init=function(){var t=this,e=this.tf,i=e.tbl;if(!this.initialized){this.setOverrides(),this.setDefaultColWidths();var n=this.initialTableWidth();this.tblMainCont=this.createContainer(this.prfxMainTblCont+e.id,"div",this.mainContCssClass),this.width&&(this.tblMainCont.style.width=this.width),i.parentNode.insertBefore(this.tblMainCont,i),this.tblCont=this.createContainer(this.prfxTblCont+e.id,"div",this.contCssClass),this.setConfigWidth(this.tblCont),this.height&&(this.tblCont.style.height=this.height),i.parentNode.insertBefore(this.tblCont,i);var s=(0,o.removeElm)(i);this.tblCont.appendChild(s),""===i.style.width&&(i.style.width=((0,u.contains)("%",n)?i.clientWidth:n)+"px");var r=(0,o.removeElm)(this.tblCont);this.tblMainCont.appendChild(r),this.headTblCont=this.createContainer(this.prfxHeadTblCont+e.id,"div",this.headContCssClass),this.setConfigWidth(this.headTblCont),this.headTbl=(0,o.createElm)("table",["id",this.prfxHeadTbl+e.id]);var a=(0,o.createElm)("tHead"),f=i.rows[this.headRowIndex],h=this.getSortTriggerIds(f),d=this.createFiltersRow();this.setHeadersRow(a),this.headTbl.appendChild(a),0===e.filtersRowIndex?a.insertBefore(d,f):a.appendChild(d),this.headTblCont.appendChild(this.headTbl),this.tblCont.parentNode.insertBefore(this.headTblCont,this.tblCont);var p=(0,o.tag)(i,"thead");p.length>0&&i.removeChild(p[0]),this.headTbl.style.tableLayout="fixed",i.style.tableLayout="fixed",this.headTbl.cellPadding=i.cellPadding,this.headTbl.cellSpacing=i.cellSpacing,e.setColWidths(this.headTbl),i.style.width="",this.headTbl.style.width=i.clientWidth+"px",(0,l.addEvt)(this.tblCont,"scroll",function(e){var i=(0,l.targetEvt)(e),n=i.scrollLeft;t.headTblCont.scrollLeft=n});var m=e.extension("sort");m&&(m.asyncSort=!0,m.triggerIds=h),this.setColumnElements(),e.popupFilters&&(d.style.display=c.NONE),i.clientWidth!==this.headTbl.clientWidth&&(i.style.width=this.headTbl.clientWidth+"px"),this.initialized=!0}},e.prototype.setOverrides=function(){var t=this.tf;t.refRow=0,t.headersRow=0,t.filtersRowIndex=1,t.isExternalFlt=!0},e.prototype.setDefaultColWidths=function(){var t=this.tf;if(!t.hasColWidths){for(var e=0,i=t.getCellsNb();e0;for(var i=t.nbCells-1;i>=0;i--){var n=void 0,s=t.id+"_col_"+i;this.tblHasColTag?(n=e[i],n.setAttribute("id",s)):(n=(0,o.createElm)("col",["id",s]),t.tbl.insertBefore(n,t.tbl.firstChild)),n.style.width=t.colWidths[i],this.colElms[i]=n}this.tblHasColTag=!0},e.prototype.setHeadersRow=function(t){if(this.noHeaders)t.appendChild((0,o.createElm)("tr"));else for(var e=0;e',r.containerCssClass=a.popup_div_css_class||"popUpFilter",r.onBeforeOpen=(0,o.isFn)(a.on_before_popup_filter_open)?a.on_before_popup_filter_open:null,r.onAfterOpen=(0,o.isFn)(a.on_after_popup_filter_open)?a.on_after_popup_filter_open:null,r.onBeforeClose=(0,o.isFn)(a.on_before_popup_filter_close)?a.on_before_popup_filter_close:null,r.onAfterClose=(0,o.isFn)(a.on_after_popup_filter_close)?a.on_after_popup_filter_close:null,r.fltSpans=[],r.fltIcons=[],r.filtersCache=null,r.fltElms=r.filtersCache||[],r.adjustToContainer=!0,r.prfxSpan="popUpSpan_",r.prfxDiv="popUpDiv_",r}return r(e,t),e.prototype.onClick=function(t){var e=(0,u.targetEvt)(t).parentNode,i=parseInt(e.getAttribute("ci"),10);if(this.closeAll(i),this.toggle(i),this.adjustToContainer){var n=this.fltElms[i],s=this.tf.getHeaderElement(i),r=.95*s.clientWidth;n.style.width=parseInt(r,10)+"px"}(0,u.cancelEvt)(t),(0,u.stopEvt)(t)},e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&isNaN(e.config().headers_row_index)&&(e.headersRow=0),e.gridLayout&&(e.headersRow--,this.buildIcons()),this.emitter.on(["before-filtering"],function(){return t.setIconsState()}),this.emitter.on(["after-filtering"],function(){return t.closeAll()}),this.emitter.on(["cell-processed"],function(e,i){return t.changeState(i,!0)}),this.emitter.on(["filters-row-inserted"],function(){return t.buildIcons()}),this.emitter.on(["before-filter-init"],function(e,i){return t.build(i)}),this.initialized=!0}},e.prototype.reset=function(){this.enable(),this.init(),this.buildAll()},e.prototype.buildIcons=function(){var t=this,e=this.tf;e.headersRow++;for(var i=0;i1&&void 0!==arguments[1]&&arguments[1],i=this.tf;t=parseInt(t,10),this.emitter.emit("before-populating-filter",i,t),this.opts=[],this.optsTxt=[];var n=i.fltIds[t],s=(0,o.elm)(n),r=i.tbl.rows,a=i.getRowsNb(!0);this.isCustom=i.isCustomOptions(t);var f=void 0,h=i.getActiveFilterId();e&&h&&(f=i.getColumnIndexFromFilterId(h));var p=null,m=null;e&&i.disableExcludedOptions&&(p=[],m=[]);for(var g=i.refRow;g1&&void 0!==arguments[1]?arguments[1]:[],i=this.tf;if(i.getFilterType(t)===h.MULTIPLE&&0!==e.length){var n=i.getFilterElement(t);[].forEach.call(n.options,function(t){""!==e[0]&&""!==t.value||(t.selected=!1),""!==t.value&&(0,l.has)(e,t.value,!0)&&(t.selected=!0)})}},e.prototype.getValues=function(t){var e=this.tf,i=e.getFilterElement(t),n=[];return i.selectedOptions?[].forEach.call(i.selectedOptions,function(t){return n.push(t.value)}):[].forEach.call(i.options,function(t){t.selected&&n.push(t.value)}),n},e.prototype.destroy=function(){var t=this;this.emitter.off(["build-select-filter"],function(e,i,n){return t.build(e,i,n)}),this.emitter.off(["select-options"],function(e,i,n){ +return t.selectOptions(i,n)})},e}(a.Feature)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.has=void 0;var n=i(5);e.has=function(t,e,i){for(var s=Boolean(i),r=0,a=t.length;rn?1:0},e.numSortAsc=function(t,e){return t-e},e.numSortDesc=function(t,e){return e-t}},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.CheckList=void 0;var a=i(10),o=i(3),l=i(16),u=i(5),c=i(17),f=i(1),h=i(4),d=i(11),p="Filter options for column {0} cannot be sorted in {1} manner.";e.CheckList=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"checkList")),a=r.config;return r.containers=[],r.containerCssClass=a.div_checklist_css_class||"div_checklist",r.filterCssClass=a.checklist_css_class||"flt_checklist",r.itemCssClass=a.checklist_item_css_class||"flt_checklist_item",r.selectedItemCssClass=a.checklist_selected_item_css_class||"flt_checklist_slc_item",r.activateText=a.activate_checklist_text||"Click to load filter data",r.disabledItemCssClass=a.checklist_item_disabled_css_class||"flt_checklist_item_disabled",r.enableResetOption=a.enable_checklist_reset_filter!==!1,r.prfx="chkdiv_",r.isCustom=!1,r.opts=[],r.optsTxt=[],r.excludedOpts=[],r}return r(e,t),e.prototype.optionClick=function(t){var e=(0,f.targetEvt)(t),i=this.tf;this.emitter.emit("filter-focus",i,e),this.setCheckListValues(e),i.filter()},e.prototype.onCheckListClick=function(t){var e=this,i=(0,f.targetEvt)(t);if(this.tf.loadFltOnDemand&&"0"===i.getAttribute("filled")){var n=i.getAttribute("ct"),s=this.containers[n];this.build(n),(0,f.removeEvt)(s,"click",function(t){return e.onCheckListClick(t)})}},e.prototype.init=function(t,e,i){var n=this,s=this.tf,r=e?s.externalFltTgtIds[t]:null,a=(0,o.createElm)("div",["id",this.prfx+t+"_"+s.id],["ct",t],["filled","0"]);a.className=this.containerCssClass,r?(0,o.elm)(r).appendChild(a):i.appendChild(a),this.containers[t]=a,s.fltIds.push(s.prfxFlt+t+"_"+s.id),s.loadFltOnDemand?((0,f.addEvt)(a,"click",function(t){return n.onCheckListClick(t)}),a.appendChild((0,o.createText)(this.activateText))):this.build(t),this.emitter.on(["build-checklist-filter"],function(t,e){return n.build(e)}),this.emitter.on(["select-checklist-options"],function(t,e,i){return n.selectOptions(e,i)}),this.initialized=!0},e.prototype.build=function(t){var e=this.tf;t=parseInt(t,10),this.emitter.emit("before-populating-filter",e,t),this.opts=[],this.optsTxt=[];var i=this.containers[t],n=(0,o.createElm)("ul",["id",e.fltIds[t]],["colIndex",t]);n.className=this.filterCssClass;var s=e.tbl.rows,r=e.getRowsNb(!0),a=e.caseSensitive;this.isCustom=e.isCustomOptions(t);var f=void 0,h=e.getActiveFilterId();e.linkedFilters&&h&&(f=e.getColumnIndexFromFilterId(h));var d=[];e.linkedFilters&&e.disableExcludedOptions&&(this.excludedOpts=[]),i.innerHTML="";for(var m=e.refRow;m1&&void 0!==arguments[1]?arguments[1]:[],i=this.tf,n=i.getFilterElement(t);if(i.getFilterType(t)===d.CHECKLIST&&n){var s=(0,o.tag)(n,"li").length;n.setAttribute("value",""),n.setAttribute("indexes","");for(var r=0;r0?1:0),r=s+n.pagingLength-1<=e.getValidRowsNb()?s+n.pagingLength-1:e.getValidRowsNb();i=s+this.fromToTextSeparator+r+this.overText+e.getValidRowsNb()}}else i=t&&""!==t?t:e.getFilterableRowsNb()-e.nbHiddenRows;this.label.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.label,i)}},e.prototype.destroy=function(){var t=this;this.initialized&&(!this.targetId&&this.container?(0,o.removeElm)(this.container):(0,o.elm)(this.targetId).innerHTML="",this.label=null,this.container=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.getValidRowsNb())}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.StatusBar=void 0;var a=i(10),o=i(2),l=i(3),u=i(4);e.StatusBar=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"statusBar")),a=r.config;return r.targetId=a.status_bar_target_id||null,r.container=null,r.msgContainer=null,r.labelContainer=null,r.text=a.status_bar_text||"",r.cssClass=a.status_bar_css_class||"status",r.delay=250,r.onBeforeShowMsg=(0,u.isFn)(a.on_before_show_msg)?a.on_before_show_msg:null,r.onAfterShowMsg=(0,u.isFn)(a.on_after_show_msg)?a.on_after_show_msg:null,r.msgFilter=a.msg_filter||"Filtering data...",r.msgPopulate=a.msg_populate||"Populating filter...",r.msgPopulateCheckList=a.msg_populate_checklist||"Populating list...",r.msgChangePage=a.msg_change_page||"Collecting paging data...",r.msgClear=a.msg_clear||"Clearing filters...",r.msgChangeResults=a.msg_change_results||"Changing results per page...",r.msgResetPage=a.msg_reset_page||"Re-setting page...",r.msgResetPageLength=a.msg_reset_page_length||"Re-setting page length...",r.msgSort=a.msg_sort||"Sorting data...",r.msgLoadExtensions=a.msg_load_extensions||"Loading extensions...",r.msgLoadThemes=a.msg_load_themes||"Loading theme(s)...",r.prfxCont="status_",r.prfxLabel="statusSpan_",r.prfxText="statusText_",r}return r(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,i=this.emitter,n=(0,l.createElm)("div",["id",this.prfxCont+e.id]);n.className=this.cssClass;var s=(0,l.createElm)("span",["id",this.prfxLabel+e.id]),r=(0,l.createElm)("span",["id",this.prfxText+e.id]);r.appendChild((0,l.createText)(this.text)),this.targetId||e.setToolbar();var a=this.targetId?(0,l.elm)(this.targetId):e.lDiv;this.targetId?(a.appendChild(r),a.appendChild(s)):(n.appendChild(r),n.appendChild(s),a.appendChild(n)),this.container=n,this.msgContainer=s,this.labelContainer=r,i.on(["before-filtering"],function(){return t.message(t.msgFilter)}),i.on(["before-populating-filter"],function(){return t.message(t.msgPopulate)}),i.on(["before-page-change"],function(){return t.message(t.msgChangePage)}),i.on(["before-clearing-filters"],function(){return t.message(t.msgClear)}),i.on(["before-page-length-change"],function(){return t.message(t.msgChangeResults)}),i.on(["before-reset-page"],function(){return t.message(t.msgResetPage)}),i.on(["before-reset-page-length"],function(){return t.message(t.msgResetPageLength)}),i.on(["before-loading-extensions"],function(){return t.message(t.msgLoadExtensions)}),i.on(["before-loading-themes"],function(){return t.message(t.msgLoadThemes)}),i.on(["after-filtering","after-populating-filter","after-page-change","after-clearing-filters","after-page-length-change","after-reset-page","after-reset-page-length","after-loading-extensions","after-loading-themes"],function(){return t.message("")}),this.initialized=!0}},e.prototype.message=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(this.isEnabled()){this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,e);var i=""===e?this.delay:1;o.root.setTimeout(function(){t.initialized&&(t.msgContainer.innerHTML=e,t.onAfterShowMsg&&t.onAfterShowMsg.call(null,t.tf,e))},i)}},e.prototype.destroy=function(){var t=this;if(this.initialized){var e=this.emitter;this.container.innerHTML="",this.targetId||(0,l.removeElm)(this.container),this.labelContainer=null,this.msgContainer=null,this.container=null,e.off(["before-filtering"],function(){return t.message(t.msgFilter)}),e.off(["before-populating-filter"],function(){return t.message(t.msgPopulate)}),e.off(["before-page-change"],function(){return t.message(t.msgChangePage)}),e.off(["before-clearing-filters"],function(){return t.message(t.msgClear)}),e.off(["before-page-length-change"],function(){return t.message(t.msgChangeResults)}),e.off(["before-reset-page"],function(){return t.message(t.msgResetPage)}),e.off(["before-reset-page-length"],function(){return t.message(t.msgResetPageLength)}),e.off(["before-loading-extensions"],function(){return t.message(t.msgLoadExtensions)}),e.off(["before-loading-themes"],function(){return t.message(t.msgLoadThemes)}),e.off(["after-filtering","after-populating-filter","after-page-change","after-clearing-filters","after-page-length-change","after-reset-page","after-reset-page-length","after-loading-extensions","after-loading-themes"],function(){return t.message("")}),this.initialized=!1}},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Paging=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=i(10),l=i(3),u=i(4),c=i(1),f=i(11);e.Paging=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"paging")),a=r.config;r.btnPageCssClass=a.paging_btn_css_class||"pgInp",r.pagingSlc=null,r.resultsPerPageSlc=null,r.pagingTgtId=a.paging_target_id||null,r.pagingLength=isNaN(a.paging_length)?10:a.paging_length,r.resultsPerPageTgtId=a.results_per_page_target_id||null,r.pgSlcCssClass=a.paging_slc_css_class||"pgSlc",r.pgInpCssClass=a.paging_inp_css_class||"pgNbInp",r.resultsPerPage=a.results_per_page||null,r.hasResultsPerPage=(0,u.isArray)(r.resultsPerPage),r.resultsSlcCssClass=a.results_slc_css_class||"rspg",r.resultsSpanCssClass=a.results_span_css_class||"rspgSpan",r.startPagingRow=0,r.nbPages=0,r.currentPageNb=1,r.btnNextPageText=a.btn_next_page_text||">",r.btnPrevPageText=a.btn_prev_page_text||"<",r.btnLastPageText=a.btn_last_page_text||">|",r.btnFirstPageText=a.btn_first_page_text||"|<",r.btnNextPageHtml=a.btn_next_page_html||(i.enableIcons?'':null),r.btnPrevPageHtml=a.btn_prev_page_html||(i.enableIcons?'':null),r.btnFirstPageHtml=a.btn_first_page_html||(i.enableIcons?'':null),r.btnLastPageHtml=a.btn_last_page_html||(i.enableIcons?'':null),r.pageText=a.page_text||" Page ",r.ofText=a.of_text||" of ",r.nbPgSpanCssClass=a.nb_pages_css_class||"nbpg",r.hasPagingBtns=a.paging_btns!==!1,r.pageSelectorType=a.page_selector_type||f.SELECT,r.onBeforeChangePage=(0,u.isFn)(a.on_before_change_page)?a.on_before_change_page:null,r.onAfterChangePage=(0,u.isFn)(a.on_after_change_page)?a.on_after_change_page:null,r.prfxSlcPages="slcPages_",r.prfxSlcResults="slcResults_",r.prfxSlcResultsTxt="slcResultsTxt_",r.prfxBtnNextSpan="btnNextSpan_",r.prfxBtnPrevSpan="btnPrevSpan_",r.prfxBtnLastSpan="btnLastSpan_",r.prfxBtnFirstSpan="btnFirstSpan_",r.prfxBtnNext="btnNext_",r.prfxBtnPrev="btnPrev_",r.prfxBtnLast="btnLast_",r.prfxBtnFirst="btnFirst_",r.prfxPgSpan="pgspan_",r.prfxPgBeforeSpan="pgbeforespan_",r.prfxPgAfterSpan="pgafterspan_";var o=i.refRow,l=i.getRowsNb(!0);r.nbPages=Math.ceil((l-o)/r.pagingLength);var h=r;return r.evt={slcIndex:function(){return h.pageSelectorType===f.SELECT?h.pagingSlc.options.selectedIndex:parseInt(h.pagingSlc.value,10)-1},nbOpts:function(){return h.pageSelectorType===f.SELECT?parseInt(h.pagingSlc.options.length,10)-1:h.nbPages-1},next:function(){var t=h.evt.slcIndex()0?h.evt.slcIndex()-1:h.evt.nbOpts();h.changePage(t)},last:function(){h.changePage(h.evt.nbOpts())},first:function(){h.changePage(0)},_detectKey:function(t){var e=(0,c.keyCode)(t);e===f.ENTER_KEY&&(i.sorted?(i.filter(),h.changePage(h.evt.slcIndex())):h.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},r}return r(e,t),e.prototype.init=function(){var t,e=this,i=this.tf,n=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),n.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===f.SELECT&&(t=(0,l.createElm)(f.SELECT,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,(0,c.addEvt)(t,"change",n.slcPagesChange)),this.pageSelectorType===f.INPUT&&(t=(0,l.createElm)(f.INPUT,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,(0,c.addEvt)(t,"keypress",n._detectKey));var s=(0,l.createElm)("span",["id",this.prfxBtnNextSpan+i.id]),r=(0,l.createElm)("span",["id",this.prfxBtnPrevSpan+i.id]),a=(0,l.createElm)("span",["id",this.prfxBtnLastSpan+i.id]),o=(0,l.createElm)("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)s.innerHTML=this.btnNextPageHtml,(0,c.addEvt)(s,"click",n.next);else{var u=(0,l.createElm)(f.INPUT,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);u.className=this.btnPageCssClass,(0,c.addEvt)(u,"click",n.next),s.appendChild(u)}if(this.btnPrevPageHtml)r.innerHTML=this.btnPrevPageHtml,(0,c.addEvt)(r,"click",n.prev);else{var h=(0,l.createElm)(f.INPUT,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,(0,c.addEvt)(h,"click",n.prev),r.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,(0,c.addEvt)(a,"click",n.last);else{var d=(0,l.createElm)(f.INPUT,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);d.className=this.btnPageCssClass,(0,c.addEvt)(d,"click",n.last),a.appendChild(d)}if(this.btnFirstPageHtml)o.innerHTML=this.btnFirstPageHtml,(0,c.addEvt)(o,"click",n.first);else{var p=(0,l.createElm)(f.INPUT,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);p.className=this.btnPageCssClass,(0,c.addEvt)(p,"click",n.first),o.appendChild(p)}}this.pagingTgtId||i.setToolbar();var m=this.pagingTgtId?(0,l.elm)(this.pagingTgtId):i.mDiv;m.appendChild(o),m.appendChild(r);var g=(0,l.createElm)("span",["id",this.prfxPgBeforeSpan+i.id]);g.appendChild((0,l.createText)(this.pageText)),g.className=this.nbPgSpanCssClass,m.appendChild(g),m.appendChild(t);var y=(0,l.createElm)("span",["id",this.prfxPgAfterSpan+i.id]);y.appendChild((0,l.createText)(this.ofText)),y.className=this.nbPgSpanCssClass,m.appendChild(y);var v=(0,l.createElm)("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild((0,l.createText)(" "+this.nbPages+" ")),m.appendChild(v),m.appendChild(s),m.appendChild(a),this.pagingSlc=(0,l.elm)(this.prfxSlcPages+i.id),this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["change-page"],function(t,i){return e.setPage(i)}),this.emitter.on(["change-page-results"],function(t,i){return e.changeResultsPerPage(i)}),this.initialized=!0}},e.prototype.reset=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.tf;this.isEnabled()||(this.enable(),this.init(),t&&e.filter())},e.prototype.resetPagingInfo=function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)},e.prototype.setPagingInfo=function(t){var e=this.tf,i=this.pagingTgtId?(0,l.elm)(this.pagingTgtId):e.mDiv,n=(0,l.elm)(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),n.innerHTML=this.nbPages,this.pageSelectorType===f.SELECT&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===f.SELECT)for(var s=0;s=n&&r=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t+1),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===f.SELECT?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,this.startPagingRow=this.pageSelectorType===f.SELECT?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t+1)),this.emitter.emit("after-page-change",e,t+1))},e.prototype.changeResultsPerPage=function(t){this.isEnabled()&&!isNaN(t)&&(this.resultsPerPageSlc.value=t,this.onChangeResultsPerPage())},e.prototype.onChangeResultsPerPage=function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-page-length-change",t);var e=this.resultsPerPageSlc,i=e.selectedIndex,n=this.pageSelectorType===f.SELECT?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[i].value,10),this.startPagingRow=this.pagingLength*n,!isNaN(this.pagingLength)&&(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===f.SELECT)){var s=this.pagingSlc.options.length-1<=n?this.pagingSlc.options.length-1:n;this.pagingSlc.options[s].selected=!0}this.emitter.emit("after-page-length-change",t,this.pagingLength)}},e.prototype.resetPage=function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",t);var e=t.feature("store").getPageNb();""!==e&&this.changePage(e-1),this.emitter.emit("after-reset-page",t,e)}},e.prototype.resetPageLength=function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",t);var e=t.feature("store").getPageLength();""!==e&&(this.resultsPerPageSlc.options[e].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",t,e)}},e.prototype.destroy=function(){var t=this,e=this.tf;if(this.initialized){var i=(0,l.elm)(this.prfxBtnNextSpan+e.id),n=(0,l.elm)(this.prfxBtnPrevSpan+e.id),s=(0,l.elm)(this.prfxBtnLastSpan+e.id),r=(0,l.elm)(this.prfxBtnFirstSpan+e.id),a=(0,l.elm)(this.prfxPgBeforeSpan+e.id),o=(0,l.elm)(this.prfxPgAfterSpan+e.id),u=(0,l.elm)(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===f.SELECT?(0,c.removeEvt)(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===f.INPUT&&(0,c.removeEvt)(this.pagingSlc,"keypress",h._detectKey),(0,l.removeElm)(this.pagingSlc)),i&&((0,c.removeEvt)(i,"click",h.next),(0,l.removeElm)(i)),n&&((0,c.removeEvt)(n,"click",h.prev),(0,l.removeElm)(n)),s&&((0,c.removeEvt)(s,"click",h.last),(0,l.removeElm)(s)),r&&((0,c.removeEvt)(r,"click",h.first),(0,l.removeElm)(r)),a&&(0,l.removeElm)(a),o&&(0,l.removeElm)(o),u&&(0,l.removeElm)(u),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["change-page"],function(e,i){return t.setPage(i)}),this.emitter.off(["change-page-results"],function(e,i){return t.changeResultsPerPage(i)}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}},e}(o.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.ClearButton=void 0;var a=i(10),o=i(3),l=i(1);e.ClearButton=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"btnReset")),a=r.config;return r.targetId=a.btn_reset_target_id||null,r.element=null,r.text=a.btn_reset_text||"Reset",r.cssClass=a.btn_reset_css_class||"reset",r.tooltip=a.btn_reset_tooltip||"Clear filters",r.html=a.btn_reset_html||(i.enableIcons?'':null),r.prfxCont="resetspan_",r}return r(e,t),e.prototype.onClick=function(){this.isEnabled()&&this.tf.clearFilters()},e.prototype.init=function(){var t=this,e=this.tf;if(!this.initialized){var i=(0,o.createElm)("span",["id",this.prfxCont+e.id]);this.targetId||e.setToolbar();var n=this.targetId?(0,o.elm)(this.targetId):e.rDiv;if(n.appendChild(i),this.html){i.innerHTML=this.html;var s=i.firstChild;(0,l.addEvt)(s,"click",function(){return t.onClick()})}else{var r=(0,o.createElm)("a",["href","javascript:void(0);"]);r.className=this.cssClass,r.appendChild((0,o.createText)(this.text)),i.appendChild(r),(0,l.addEvt)(r,"click",function(){return t.onClick(); +})}this.element=i.firstChild,this.initialized=!0}},e.prototype.destroy=function(){var t=this.tf;if(this.initialized){var e=(0,o.elm)(this.prfxCont+t.id);e&&(0,o.removeElm)(e),this.element=null,this.initialized=!1}},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Help=void 0;var a=i(10),o=i(3),l=i(1),u=i(11),c="https://github.com/koalyptus/TableFilter/wiki/4.-Filter-operators",f="http://koalyptus.github.io/TableFilter/";e.Help=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"help")),a=r.config;return r.tgtId=a.help_instructions_target_id||null,r.contTgtId=a.help_instructions_container_target_id||null,r.instrText=a.help_instructions_text?a.help_instructions_text:'Use the filters above each column to filter and limit table data. Advanced searches can be performed by using the following operators:
<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',r.instrHtml=a.help_instructions_html||null,r.btnText=a.help_instructions_btn_text||"?",r.btnHtml=a.help_instructions_btn_html||null,r.btnCssClass=a.help_instructions_btn_css_class||"helpBtn",r.contCssClass=a.help_instructions_container_css_class||"helpCont",r.btn=null,r.cont=null,r.defaultHtml='

TableFilter v'+i.version+'

'+f+"
©2015-"+i.year+' Max Guglielmi
',r.prfxHelpSpan="helpSpan_",r.prfxHelpDiv="helpDiv_",r.emitter.on(["init-help"],function(){return r.init()}),r}return r(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,i=(0,o.createElm)("span",["id",this.prfxHelpSpan+e.id]),n=(0,o.createElm)("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var s=this.tgtId?(0,o.elm)(this.tgtId):e.rDiv;s.appendChild(i);var r=this.contTgtId?(0,o.elm)(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;(0,l.addEvt)(a,"click",function(){return t.toggle()}),r.appendChild(n)}else{r.appendChild(n);var u=(0,o.createElm)("a",["href","javascript:void(0);"]);u.className=this.btnCssClass,u.appendChild((0,o.createText)(this.btnText)),i.appendChild(u),(0,l.addEvt)(u,"click",function(){return t.toggle()})}this.instrHtml?(this.contTgtId&&r.appendChild(n),n.innerHTML=this.instrHtml,this.contTgtId||(n.className=this.contCssClass,(0,l.addEvt)(n,"dblclick",function(){return t.toggle()}))):(n.innerHTML=this.instrText,n.className=this.contCssClass,(0,l.addEvt)(n,"dblclick",function(){return t.toggle()})),n.innerHTML+=this.defaultHtml,(0,l.addEvt)(n,"click",function(){return t.toggle()}),this.cont=n,this.btn=i,this.initialized=!0}},e.prototype.toggle=function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||t===u.NONE?this.cont.style.display="inline":this.cont.style.display=u.NONE}},e.prototype.destroy=function(){this.initialized&&((0,o.removeElm)(this.btn),this.btn=null,this.cont&&((0,o.removeElm)(this.cont),this.cont=null,this.initialized=!1))},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.AlternateRows=void 0;var a=i(10),o=i(3);e.AlternateRows=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"alternateRows")),a=r.config;return r.evenCss=a.even_row_css_class||"even",r.oddCss=a.odd_row_css_class||"odd",r}return r(e,t),e.prototype.init=function(){var t=this;this.initialized||(this.processAll(),this.emitter.on(["row-processed","row-paged"],function(e,i,n,s){return t.processRow(i,n,s)}),this.emitter.on(["column-sorted"],function(){return t.processAll()}),this.initialized=!0)},e.prototype.processAll=function(){if(this.isEnabled())for(var t=this.tf,e=t.getValidRows(!0),i=e.length,n=0,s=0;s0?this.hide():this.show()},e.prototype.show=function(){this.initialized&&this.isEnabled()&&(this.onBeforeShow&&this.onBeforeShow.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShow&&this.onAfterShow.call(null,this.tf,this))},e.prototype.hide=function(){this.initialized&&this.isEnabled()&&(this.onBeforeHide&&this.onBeforeHide.call(null,this.tf,this),this.cont.style.display=u.NONE,this.onAfterHide&&this.onAfterHide.call(null,this.tf,this))},e.prototype.setWidth=function(){if(this.initialized&&!this.isExternal&&this.isEnabled()){var t=this.tf;if(t.gridLayout){var e=t.feature("gridLayout");this.cont.style.width=e.tblCont.clientWidth+"px"}else this.cont.style.width=(t.tbl.tHead?t.tbl.tHead.clientWidth:t.tbl.tBodies[0].clientWidth)+"px"}},e.prototype.destroy=function(){var t=this;this.initialized&&((0,o.removeElm)(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.State=void 0;var a=i(10),o=i(27),l=i(28),u=i(5),c=i(4);e.State=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"state")),a=r.config.state;return r.enableHash=a===!0||(0,c.isArray)(a.types)&&a.types.indexOf("hash")!==-1,r.enableLocalStorage=(0,c.isArray)(a.types)&&a.types.indexOf("local_storage")!==-1,r.enableCookie=(0,c.isArray)(a.types)&&a.types.indexOf("cookie")!==-1,r.persistFilters=a.filters!==!1,r.persistPageNumber=Boolean(a.page_number),r.persistPageLength=Boolean(a.page_length),r.persistSort=Boolean(a.sort),r.persistColsVisibility=Boolean(a.columns_visibility),r.persistFiltersVisibility=Boolean(a.filters_visibility),r.cookieDuration=isNaN(a.cookie_duration)?87600:parseInt(a.cookie_duration,10),r.enableStorage=r.enableLocalStorage||r.enableCookie,r.storage=null,r.hash=null,r.pageNb=null,r.pageLength=null,r.sort=null,r.hiddenCols=null,r.filtersVisibility=null,r.state={},r.prfxCol="col_",r.pageNbKey="page",r.pageLengthKey="page_length",r.filtersVisKey="filters_visibility",r}return r(e,t),e.prototype.init=function(){var t=this;this.initialized||(this.emitter.on(["after-filtering"],function(){return t.update()}),this.emitter.on(["after-page-change","after-clearing-filters"],function(e,i){return t.updatePage(i)}),this.emitter.on(["after-page-length-change"],function(e,i){return t.updatePageLength(i)}),this.emitter.on(["column-sorted"],function(e,i,n){return t.updateSort(i,n)}),this.emitter.on(["sort-initialized"],function(){return t._syncSort()}),this.emitter.on(["columns-visibility-initialized"],function(){return t._syncColsVisibility()}),this.emitter.on(["column-shown","column-hidden"],function(e,i,n,s){return t.updateColsVisibility(s)}),this.emitter.on(["filters-visibility-initialized"],function(){return t._syncFiltersVisibility()}),this.emitter.on(["filters-toggled"],function(e,i,n){return t.updateFiltersVisibility(n)}),this.enableHash&&(this.hash=new o.Hash(this),this.hash.init()),this.enableStorage&&(this.storage=new l.Storage(this),this.storage.init()),this.initialized=!0)},e.prototype.update=function(){var t=this;if(this.isEnabled()){var e=this.state,i=this.tf;if(this.persistFilters){var n=i.getFiltersValue();n.forEach(function(i,n){var s=""+t.prfxCol+n;(0,c.isString)(i)&&(0,u.isEmpty)(i)?e.hasOwnProperty(s)&&(e[s].flt=void 0):(e[s]=e[s]||{},e[s].flt=i)})}if(this.persistPageNumber&&((0,c.isNull)(this.pageNb)?e[this.pageNbKey]=void 0:e[this.pageNbKey]=this.pageNb),this.persistPageLength&&((0,c.isNull)(this.pageLength)?e[this.pageLengthKey]=void 0:e[this.pageLengthKey]=this.pageLength),this.persistSort&&!(0,c.isNull)(this.sort)){Object.keys(e).forEach(function(i){i.indexOf(t.prfxCol)!==-1&&e[i]&&(e[i].sort=void 0)});var s=""+this.prfxCol+this.sort.column;e[s]=e[s]||{},e[s].sort={descending:this.sort.descending}}this.persistColsVisibility&&((0,c.isNull)(this.hiddenCols)||(Object.keys(e).forEach(function(i){i.indexOf(t.prfxCol)!==-1&&e[i]&&(e[i].hidden=void 0)}),this.hiddenCols.forEach(function(i){var n=""+t.prfxCol+i;e[n]=e[n]||{},e[n].hidden=!0}))),this.persistFiltersVisibility&&((0,c.isNull)(this.filtersVisibility)?e[this.filtersVisKey]=void 0:e[this.filtersVisKey]=this.filtersVisibility),this.emitter.emit("state-changed",i,e)}},e.prototype.updatePage=function(t){this.pageNb=t,this.update()},e.prototype.updatePageLength=function(t){this.pageLength=t,this.update()},e.prototype.updateSort=function(t,e){this.sort={column:t,descending:e},this.update()},e.prototype.updateColsVisibility=function(t){this.hiddenCols=t,this.update()},e.prototype.updateFiltersVisibility=function(t){this.filtersVisibility=t,this.update()},e.prototype.override=function(t){this.state=t},e.prototype.sync=function(){var t=this.state,e=this.tf;if(this._syncFilters(),this.persistPageNumber){var i=t[this.pageNbKey];this.emitter.emit("change-page",e,i)}if(this.persistPageLength){var n=t[this.pageLengthKey];this.emitter.emit("change-page-results",e,n)}this._syncSort(),this._syncColsVisibility(),this._syncFiltersVisibility()},e.prototype.overrideAndSync=function(t){this.disable(),this.override(t),this.sync(),this.enable()},e.prototype._syncFilters=function(){var t=this;if(this.persistFilters){var e=this.state,i=this.tf;Object.keys(e).forEach(function(n){if(n.indexOf(t.prfxCol)!==-1){var s=parseInt(n.replace(t.prfxCol,""),10),r=e[n].flt;i.setFilterValue(s,r)}}),i.filter()}},e.prototype._syncSort=function(){var t=this;if(this.persistSort){var e=this.state,i=this.tf;Object.keys(e).forEach(function(n){if(n.indexOf(t.prfxCol)!==-1){var s=parseInt(n.replace(t.prfxCol,""),10);if(!(0,c.isUndef)(e[n].sort)){var r=e[n].sort;t.emitter.emit("sort",i,s,r.descending)}}})}},e.prototype._syncColsVisibility=function(){var t=this;if(this.persistColsVisibility){var e=this.state,i=this.tf,n=[];Object.keys(e).forEach(function(i){if(i.indexOf(t.prfxCol)!==-1){var s=parseInt(i.replace(t.prfxCol,""),10);(0,c.isUndef)(e[i].hidden)||n.push(s)}}),n.forEach(function(e){t.emitter.emit("hide-column",i,e)})}},e.prototype._syncFiltersVisibility=function(){if(this.persistFiltersVisibility){var t=this.state,e=this.tf,i=t[this.filtersVisKey];this.filtersVisibility=i,this.emitter.emit("show-filters",e,i)}},e.prototype.destroy=function(){var t=this;this.initialized&&(this.state={},this.emitter.off(["after-filtering"],function(){return t.update()}),this.emitter.off(["after-page-change","after-clearing-filters"],function(e,i){return t.updatePage(i)}),this.emitter.off(["after-page-length-change"],function(e,i){return t.updatePageLength(i)}),this.emitter.off(["column-sorted"],function(e,i,n){return t.updateSort(i,n)}),this.emitter.off(["sort-initialized"],function(){return t._syncSort()}),this.emitter.off(["columns-visibility-initialized"],function(){return t._syncColsVisibility()}),this.emitter.off(["column-shown","column-hidden"],function(e,i,n,s){return t.updateColsVisibility(s)}),this.emitter.off(["filters-visibility-initialized"],function(){return t._syncFiltersVisibility()}),this.emitter.off(["filters-toggled"],function(e,i,n){return t.updateFiltersVisibility(n)}),this.enableHash&&(this.hash.destroy(),this.hash=null),this.enableStorage&&(this.storage.destroy(),this.storage=null),this.initialized=!1)},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.hasHashChange=void 0;var s=i(1),r=i(2),a=r.root.JSON,o=r.root.location,l=r.root.decodeURIComponent,u=r.root.encodeURIComponent,c=e.hasHashChange=function(){var t=r.root.documentMode;return"onhashchange"in r.root&&(void 0===t||t>7)};e.Hash=function(){function t(e){n(this,t),this.state=e,this.lastHash=null,this.emitter=e.emitter,this.boundSync=null}return t.prototype.init=function(){var t=this;c()&&(this.lastHash=o.hash,this.boundSync=this.sync.bind(this),this.emitter.on(["state-changed"],function(e,i){return t.update(i)}),this.emitter.on(["initialized"],this.boundSync),(0,s.addEvt)(r.root,"hashchange",this.boundSync))},t.prototype.update=function(t){var e="#"+u(a.stringify(t));this.lastHash!==e&&(o.hash=e,this.lastHash=e)},t.prototype.parse=function(t){return t.indexOf("#")===-1?null:(t=t.substr(1),a.parse(l(t)))},t.prototype.sync=function(){var t=this.parse(o.hash);t&&this.state.overrideAndSync(t)},t.prototype.destroy=function(){var t=this;this.emitter.off(["state-changed"],function(e,i){return t.update(i)}),this.emitter.off(["initialized"],this.boundSync),(0,s.removeEvt)(r.root,"hashchange",this.boundSync),this.state=null,this.lastHash=null,this.emitter=null},t}()},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Storage=e.hasStorage=void 0;var r=i(29),a=n(r),o=i(2),l=o.root.JSON,u=o.root.localStorage,c=o.root.location,f=e.hasStorage=function(){return"Storage"in o.root};e.Storage=function(){function t(e){s(this,t),this.state=e,this.tf=e.tf,this.enableLocalStorage=e.enableLocalStorage&&f(),this.enableCookie=e.enableCookie&&!this.enableLocalStorage,this.emitter=e.emitter,this.duration=e.cookieDuration}return t.prototype.init=function(){var t=this;this.emitter.on(["state-changed"],function(e,i){return t.save(i)}),this.emitter.on(["initialized"],function(){return t.sync()})},t.prototype.save=function(t){this.enableLocalStorage?u[this.getKey()]=l.stringify(t):a["default"].write(this.getKey(),l.stringify(t),this.duration)},t.prototype.retrieve=function(){var t=null;return t=this.enableLocalStorage?u[this.getKey()]:a["default"].read(this.getKey()),t?l.parse(t):null},t.prototype.remove=function(){this.enableLocalStorage?u.removeItem(this.getKey()):a["default"].remove(this.getKey())},t.prototype.sync=function(){var t=this.retrieve();t&&this.state.overrideAndSync(t)},t.prototype.getKey=function(){return l.stringify({key:this.tf.prfxTf+"_"+this.tf.id,path:c.pathname})},t.prototype.destroy=function(){var t=this;this.emitter.off(["state-changed"],function(e,i){return t.save(i)}),this.emitter.off(["initialized"],function(){return t.sync()}),this.remove(),this.state=null,this.emitter=null},t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(2),s=n.root.document;e["default"]={write:function(t,e,i){var n="";i&&(n=new Date((new Date).getTime()+36e5*i),n="; expires="+n.toGMTString()),s.cookie=t+"="+escape(e)+n},read:function(t){var e="",i=t+"=";if(s.cookie.length>0){var n=s.cookie,r=n.indexOf(i);if(r!==-1){r+=i.length;var a=n.indexOf(";",r);a===-1&&(a=n.length),e=unescape(n.substring(r,a))}}return e},remove:function(t){this.write(t,"",-1)}}},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.DateType=void 0;var a=i(31);i(417);var o=i(10),l=i(4),u=i(11),c=i(2);e.DateType=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"dateType"));return r.locale=i.locale,r.datetime=a.Date,r.enable(),r}return r(e,t),e.prototype.init=function(){var t=this;this.initialized||(this.datetime.setLocale(this.locale),this.addConfigFormats(this.tf.colTypes),this.emitter.on(["add-date-type-formats"],function(e,i){return t.addConfigFormats(i)}),this.emitter.emit("date-type-initialized",this.tf,this),this.initialized=!0)},e.prototype.parse=function(t,e){return this.datetime.create(t,e)},e.prototype.isValid=function(t,e){return this.datetime.isValid(this.parse(t,e))},e.prototype.getOptions=function(t,e){e=e||this.tf.colTypes;var i=e[t];return(0,l.isObj)(i)?i:{}},e.prototype.addConfigFormats=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(function(i,n){var s=t.getOptions(n,e);s.type===u.DATE&&s.hasOwnProperty("format")&&!function(){var e=t.datetime.getLocale(s.locale||t.locale),i=(0,l.isArray)(s.format)?s.format:[s.format];try{i.forEach(function(t){e.addFormat(t)})}catch(n){c.root.console.error(n)}}()})},e.prototype.destroy=function(){var t=this;this.initialized&&(this.emitter.off(["add-date-type-formats"],function(e,i){return t.addConfigFormats(i)}),this.initialized=!1)},e}(o.Feature)},function(t,e,i){"use strict";i(32),i(370),t.exports=i(34)},function(t,e,i){"use strict";i(33),i(93),i(139),i(141),i(142),i(143),i(144),i(145),i(152),i(153),i(154),i(155),i(156),i(157),i(158),i(159),i(160),i(161),i(162),i(163),i(164),i(165),i(166),i(167),i(168),i(169),i(170),i(171),i(172),i(173),i(174),i(175),i(176),i(177),i(178),i(179),i(180),i(181),i(182),i(183),i(184),i(185),i(186),i(187),i(188),i(189),i(190),i(191),i(192),i(193),i(194),i(195),i(196),i(197),i(198),i(199),i(200),i(201),i(202),i(203),i(204),i(205),i(206),i(207),i(208),i(209),i(210),i(211),i(212),i(213),i(214),i(215),i(216),i(217),i(218),i(219),i(220),i(221),i(222),i(223),i(224),i(225),i(226),i(227),i(228),i(229),i(230),i(231),i(232),i(240),i(241),i(242),i(243),i(244),i(245),i(246),i(247),i(252),i(253),i(254),i(255),i(256),i(257),i(258),i(259),i(260),i(261),i(262),i(263),i(264),i(265),i(266),i(267),i(268),i(287),i(288),i(289),i(290),i(291),i(292),i(293),i(294),i(295),i(296),i(300),i(301),i(302),i(303),i(306),i(307),i(308),i(309),i(310),i(311),i(312),i(313),i(314),i(315),i(316),i(317),i(318),i(319),i(320),i(321),i(322),i(323),i(324),i(325),i(327),i(328),i(329),i(330),i(331),i(332),i(333),i(334),i(335),i(336),i(337),i(338),i(339),i(340),i(341),i(342),i(343),i(344),i(345),i(348),i(349),i(351),i(352),i(353),i(354),i(355),i(356),i(357),i(358),i(359),i(360),i(361),i(362),i(363),i(364),i(365),i(366),i(367),i(368),i(369),t.exports=i(34)},function(t,e,i){"use strict";var n=i(34),s=i(35),r=s.localeManager;n.Date.defineStatic({addLocale:function(t,e){return r.add(t,e)}}),t.exports=n.Date.addLocale},function(t,e){(function(e){(function(){"use strict";function i(){if(N=I[S],!N){if(N=function(t){return U(N,function(e,i){T(A,i)&&e.extend(t)}),N},R)t.exports=N;else try{I[S]=N}catch(e){}U(O.split(" "),function(t){n(t)}),s()}}function n(t){function e(t,e,i){C(n,t,function(t,s,r){var l=o(t,s,r);return a(n,l.methods,e,i,l.last),n})}var i="Object"===t,n=d(t,!0),s=function(e){function s(t,e){return i&&e===p&&(!M||"get"===t||"set"===t)}function r(t,i){var n=e[t];if(n)for(var s,r=0;s=n[r];r++)if(s===i)return!0;return!1}function a(t,i){return e[t]&&!r(t,i)}function o(t,i,n){if(!i[t]||!n)return!1;for(var s=0;s0&&s%10===0,i?(e&&(o+=a),l?a=s:o+=s):(o+=s*a,a*=10),e=i;return o},getOrdinal:function(t){var e=this.ordinalSuffix;return e||v(t)},getRelativeFormat:function(t,e){return this.convertAdjustedToFormat(t,e)},getDuration:function(t){return this.convertAdjustedToFormat(T(D(0,t)),"duration")},getFirstDayOfWeek:function(){var t=this.firstDayOfWeek;return h(t)?t:I},getFirstDayOfWeekYear:function(){return this.firstDayOfWeekYear||R},convertAdjustedToFormat:function(t,e){var i,n,s,r=t[0],a=t[1],o=t[2],l=this[e]||this.relative;return A(l)?l.call(this,r,a,o,e):(s=this.plural&&1!==r?1:0,n=this.units[8*s+a]||this.units[a],i=this[o>0?"fromNow":"ago"],l.replace(/\{(.*?)\}/g,function(t,e){switch(e){case"num":return r;case"unit":return n;case"sign":return i}}))},cacheFormat:function(t,e){this.compiledFormats.splice(e,1),this.compiledFormats.unshift(t)},addFormat:function(t,e){function i(t){var i,r,o,l=t.match(/\?$/),u=t.match(/^(\d+)\??$/),f=t.match(/(\d)(?:-(\d))?/),h=t.replace(/[^a-z]+$/i,"");return(o=N(s.parsingAliases,h))?(r=n(o),l&&(r=b(r,!0)),r):(u?r=s.tokens[u[1]]:(o=N(a,h))?r=o.src:(o=N(s.parsingTokens,h)||N(s,h),h=h.replace(/s$/,""),o||(o=N(s.parsingTokens,h)||N(s,h+"s")),M(o)?(r=o,i=s[h+"Suffix"]):(f&&(o=c(o,function(t,e){var i=e%(s.units?8:o.length);return i>=f[1]&&i<=(f[2]||f[1])})),r=C(o))),r?(u?r=b(r):(e.push(h),r="("+r+")"),i&&(r=k(h,r,i)),l&&(r+="?"),r):"")}function n(t){return t=t.replace(/ /g," ?"),t.replace(/\{([^,]+?)\}/g,function(t,e){var n,s=e.split("|");return n=s.length>1?b(u(s,i).join("|")):i(e)})}var s=this;e||(e=[],t=n(t)),s.addRawFormat(t,e)},addRawFormat:function(t,e){this.compiledFormats.unshift({reg:RegExp("^ *"+t+" *$","i"),to:e})},init:function(t){function e(){L.compiledFormats=[],L.parsingAliases={},L.parsingTokens={}}function i(){y(L,t)}function n(){f(s,function(t){var e=L[t];M(e)?L[t]=d(e):e||(L[t]=[])})}function r(t,e,i,n){var s,r=t,a=[];L[r]||(r+="s"),i||(i={},s=!0),c(r,function(t,s,r){var o,l=s*e+r;o=n?n(r):r,i[t]=o,i[t.toLowerCase()]=o,a[l]=t}),L[r]=a,s&&(L[t+"Map"]=i)}function c(t,e){f(L[t],function(t,i){h(t,function(t,n){e(t,n,i)})})}function h(t,e){var i=u(t.split("+"),function(t){return t.replace(/(.+):(.+)$/,function(t,e,i){return u(i.split("|"),function(t){return e+t}).join("|")})}).join("|");f(i.split("|"),e)}function p(){var t={};r("numeral",10,t),r("article",1,t,function(){return 1}),r("placeholder",4,t,function(t){return P(10,t+1)}),L.numeralMap=t}function m(){L.parsingAliases.time=g(),L.parsingAliases.tzOffset=v()}function g(){var t;return t=L.ampmFront?"{ampm?} {hour} (?:{minute} (?::?{second})?)?":L.ampm.length?"{hour}(?:[.:]{minute}(?:[.:]{second})? {ampm?}| {ampm})":"{hour}(?:[.:]{minute}(?:[.:]{second})?)"}function v(){return"(?:{Z}|{GMT?}(?:{tzSign}{tzHour}(?::?{tzMinute}(?: \\([\\w\\s]+\\))?)?)?)?"}function x(){S(l,function(t,e){var i,n;i=t.base?a[t.base].src:t.src,(t.requiresNumerals||L.numeralUnits)&&(i+=_()),n=L[e+"s"],n&&n.length&&(i+="|"+C(n)),L.parsingTokens[e]=i})}function _(){var t,e="";return t=L.numerals.concat(L.placeholders).concat(L.articles),L.allowsFullWidth&&(t=t.concat(F.split(""))),t.length&&(e="|(?:"+C(t)+")+"),e}function E(){w(function(t,e){var i=L.timeSuffixes[e];i&&(L[(t.alias||t.name)+"Suffix"]=i)})}function T(){f(L.modifiers,function(t){var e,i=t.name,n=i+"Map";e=L[n]||{},h(t.src,function(n,s){var r=N(L.parsingTokens,i),a=t.value;e[n]=a,L.parsingTokens[i]=r?r+"|"+n:n,"sign"===t.name&&0===s&&(L[1===a?"fromNow":"ago"]=n)}),L[n]=e})}function k(){f(o,function(t){var e=t.src;t.mdy&&L.mdy&&(e=t.mdy),t.time?(L.addFormat(I(e,!0)),L.addFormat(I(e))):L.addFormat(e)}),L.addFormat("{time}")}function O(){D("parse"),D("timeParse",!0),D("timeFrontParse",!0,!0)}function D(t,e,i){f(L[t],function(t){e&&(t=I(t,i)),L.addFormat(t)})}function I(t,e){return e?R()+t:t+A()}function R(){return b("{time}[,\\s\\u3000]",!0)}function A(){var t,e=",?[\\s\\u3000]";return t=C(L.timeMarkers),t&&(e+="| (?:"+t+") "),e=b(e,L.timeMarkerOptional),b(e+"{time}",!0)}var L=this;e(),i(),n(),r("month",12),r("weekday",7),r("unit",8),r("ampm",2),p(),m(),x(),E(),T(),k(),O()}},new e(t)}var s=i(46),r=i(47),a=i(48),o=i(49),l=i(50),u=i(51),c=i(52),f=i(53),h=i(57),d=i(58),p=i(60),m=i(68),g=i(69),y=i(40),v=i(70),b=i(71),x=i(41),_=i(72),w=i(73),C=i(83),E=i(85),T=i(88),k=i(92),N=x.getOwn,S=x.forEachProperty,O=E.fullWidthNumberMap,F=E.fullWidthNumbers,P=g.pow,D=g.max,I=r.ISO_FIRST_DAY_OF_WEEK,R=r.ISO_FIRST_DAY_OF_WEEK_YEAR,M=p.isString,A=p.isFunction;t.exports=n},function(t,e){"use strict";var i=["months","weekdays","units","numerals","placeholders","articles","tokens","timeMarkers","ampm","timeSuffixes","parse","timeParse","timeFrontParse","modifiers"];t.exports=i},function(t,e){"use strict";t.exports={ISO_FIRST_DAY_OF_WEEK:1,ISO_FIRST_DAY_OF_WEEK_YEAR:4}},function(t,e){"use strict";var i={yyyy:{param:"year",src:"\\d{4}"},MM:{param:"month",src:"[01]?\\d"},dd:{param:"date",src:"[0123]?\\d"},hh:{param:"hour",src:"[0-2]?\\d"},mm:{param:"minute",src:"[0-5]\\d"},ss:{param:"second",src:"[0-5]\\d(?:[,.]\\d+)?"},yy:{param:"year",src:"\\d{2}"},y:{param:"year",src:"\\d"},yearSign:{src:"[+-]",sign:!0},tzHour:{src:"[0-1]\\d"},tzMinute:{src:"[0-5]\\d"},tzSign:{src:"[+−-]",sign:!0},ihh:{param:"hour",src:"[0-2]?\\d(?:[,.]\\d+)?"},imm:{param:"minute",src:"[0-5]\\d(?:[,.]\\d+)?"},GMT:{param:"utc",src:"GMT",val:1},Z:{param:"utc",src:"Z",val:1},timestamp:{src:"\\d+"}};t.exports=i},function(t,e){"use strict";var i=[{src:"{MM}[-.\\/]{yyyy}"},{time:!0,src:"{dd}[-.\\/]{MM}(?:[-.\\/]{yyyy|yy|y})?",mdy:"{MM}[-.\\/]{dd}(?:[-.\\/]{yyyy|yy|y})?"},{time:!0,src:"{yyyy}[-.\\/]{MM}(?:[-.\\/]{dd})?"},{src:"\\\\/Date\\({timestamp}(?:[+-]\\d{4,4})?\\)\\\\/"},{src:"{yearSign?}{yyyy}(?:-?{MM}(?:-?{dd}(?:T{ihh}(?::?{imm}(?::?{ss})?)?)?)?)?{tzOffset?}"}];t.exports=i},function(t,e){"use strict";var i={year:{base:"yyyy",requiresSuffix:!0},month:{base:"MM",requiresSuffix:!0},date:{base:"dd",requiresSuffix:!0},hour:{base:"hh",requiresSuffixOr:":"},minute:{base:"mm"},second:{base:"ss"},num:{src:"\\d+",requiresNumerals:!0}};t.exports=i},function(t,e){"use strict";function i(t,e){for(var i=[],n=0,s=t.length;n=e))&&a.push(+r);return a.sort(function(t,i){var n=t>e,s=i>e;return n!==s?n?-1:1:t-i}),a}var s=i(56);t.exports=n},function(t,e){"use strict";function i(t){return t>>>0==t&&4294967295!=t}t.exports=i},function(t,e){"use strict";function i(t){return void 0!==t}t.exports=i},function(t,e,i){"use strict";function n(t){return t.split(r)}var s=i(59),r=s.HALF_WIDTH_COMMA;t.exports=n},function(t,e){"use strict";t.exports={HALF_WIDTH_ZERO:48,FULL_WIDTH_ZERO:65296,HALF_WIDTH_PERIOD:".",FULL_WIDTH_PERIOD:".",HALF_WIDTH_COMMA:",",OPEN_BRACE:"{",CLOSE_BRACE:"}"}},function(t,e,i){"use strict";function n(){function t(){var t=v(m);r=E(t[0]),a=E(t[1]),o=E(t[2]),l=x(t[3]),u=x(t[4]),c=x(t[5]),f=Array.isArray||x(t[6]),p=x(t[7]),h=x(t[8],"undefined"!=typeof Set&&Set),d=x(t[9],"undefined"!=typeof Map&&Map),i("Arguments"),i(t[0]),i(t[1]),i(t[2]),i(t[3]),i(t[4]),i(t[6])}function e(){var t="Int8 Uint8 Uint8Clamped Int16 Uint16 Int32 Uint32 Float32 Float64";g(v(t),function(t){i(t+"Array")})}function i(t){var e="[object "+t+"]";T[e]=!0}function n(t){return T[t]}function x(t,e){return e&&y(new e,"Object")?w(e):C(t)}function w(t){var e=String(t);return function(t){return String(t.constructor)===e}}function C(t){return function(e,i){return y(e,t,i)}}function E(t){var e=t.toLowerCase();return function(i){var n=typeof i;return n===e||"object"===n&&y(i,t)}}var T={};t(),e(),s=function(t,e){return e=e||_(t),n(e)||b(t,e)}}var s,r,a,o,l,u,c,f,h,d,p,m=i(61),g=i(53),y=i(62),v=i(63),b=i(64),x=i(41),_=x.classToString;n(),t.exports={isSerializable:s,isBoolean:r,isNumber:a,isString:o,isDate:l,isRegExp:u,isFunction:c,isArray:f,isSet:h,isMap:d,isError:p}},function(t,e){"use strict";t.exports="Boolean Number String Date RegExp Function Array Error Set Map"},function(t,e,i){"use strict";function n(t,e,i){return i||(i=r(t)),i==="[object "+e+"]"}var s=i(41),r=s.classToString;t.exports=n},function(t,e){"use strict";function i(t){return t.split(" ")}t.exports=i},function(t,e,i){"use strict";function n(t,e){return r(t)&&s(t,"Object",e)&&o(t)&&a(t)}var s=i(62),r=i(65),a=i(66),o=i(67);t.exports=n},function(t,e){"use strict";function i(t,e){return!!t&&"object"===(e||typeof t)}t.exports=i},function(t,e,i){"use strict";function n(t){var e=Object.prototype;for(var i in t){var n=t[i];if(!r(t,i)&&n!==e[i])return!1}return!0}var s=i(41),r=s.hasOwn;t.exports=n},function(t,e,i){"use strict";function n(t){var e="toString"in t,i="constructor"in t;return!i&&!e||i&&!r(t,"constructor")&&r(t.constructor.prototype,"isPrototypeOf")}var s=i(41),r=s.hasOwn;t.exports=n},function(t,e){"use strict";function i(t){return void 0===t}t.exports=i},function(t,e){"use strict";t.exports={abs:Math.abs,pow:Math.pow,min:Math.min,max:Math.max,ceil:Math.ceil,floor:Math.floor,round:Math.round}},function(t,e){"use strict";function i(t){if(t>=11&&t<=13)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}t.exports=i},function(t,e){"use strict";function i(t,e){return t.length>1&&(t="(?:"+t+")"),e&&(t+="?"),t}t.exports=i},function(t,e){"use strict";function i(t,e,i,n){var s;return i>1&&(s=t[e+(i-1)*n]),s||t[e]}t.exports=i},function(t,e,i){"use strict";function n(t,e,i){i=i||0,a(e)&&(e=o);for(var n=e;n>=i&&t(s[n],n)!==!1;n--);}var s=i(74),r=i(82),a=i(68),o=r.YEAR_INDEX;t.exports=n},function(t,e,i){"use strict";var n=i(75),s=[{name:"millisecond",method:"Milliseconds",multiplier:1,start:0,end:999},{name:"second",method:"Seconds",multiplier:1e3,start:0,end:59},{name:"minute",method:"Minutes",multiplier:6e4,start:0,end:59},{name:"hour",method:"Hours",multiplier:36e5,start:0,end:23},{name:"day",alias:"date",method:"Date",ambiguous:!0,multiplier:864e5,start:1,end:function(t){return n(t)}},{name:"week",method:"ISOWeek",ambiguous:!0,multiplier:6048e5},{name:"month",method:"Month",ambiguous:!0,multiplier:26298e5,start:0,end:11},{name:"year",method:"FullYear",ambiguous:!0,multiplier:315576e5,start:0}];t.exports=s},function(t,e,i){"use strict";function n(t){return 32-a(new Date(s(t),r(t),32),"Date")}var s=i(76),r=i(81),a=i(77);t.exports=n},function(t,e,i){"use strict";function n(t){return s(t,"FullYear")}var s=i(77);t.exports=n},function(t,e,i){"use strict";function n(t,e){return t["get"+(s(t)?"UTC":"")+e]()}var s=i(78);t.exports=n},function(t,e,i){"use strict";var n=i(79);t.exports=n("utc")},function(t,e,i){"use strict";function n(t){var e=s+t;return function(t,i){return arguments.length>1?(a(t,e,i),t):t[e]}}var s=i(80),r=i(41),a=r.setProperty;t.exports=n},function(t,e){"use strict";t.exports="_sugar_"},function(t,e,i){"use strict";function n(t){return s(t,"Month")}var s=i(77);t.exports=n},function(t,e){"use strict";t.exports={HOURS_INDEX:3,DAY_INDEX:4,WEEK_INDEX:5,MONTH_INDEX:6,YEAR_INDEX:7}},function(t,e,i){"use strict";function n(t){var e=t.join("");return t&&t.length?e.length===t.length?"["+e+"]":s(t,r).join("|"):""}var s=i(51),r=i(84);t.exports=n},function(t,e,i){"use strict";function n(t){return r(t)||(t=String(t)),t.replace(/([\\\/\'*+?|()\[\]{}.^$-])/g,"\\$1")}var s=i(60),r=s.isString;t.exports=n},function(t,e,i){"use strict";function n(){var t=d,e=h,i=p,n="";r={};for(var o,m=0;m<=9;m++)o=l(m+f),n+=o,r[o]=l(m+c);r[i]="",r[t]=e,r[e]=e,s=u(n+t+i+e),a=n}var s,r,a,o=i(59),l=i(86),u=i(87),c=o.HALF_WIDTH_ZERO,f=o.FULL_WIDTH_ZERO,h=o.HALF_WIDTH_PERIOD,d=o.FULL_WIDTH_PERIOD,p=o.HALF_WIDTH_COMMA;n(),t.exports={fullWidthNumberReg:s,fullWidthNumberMap:r,fullWidthNumbers:a}},function(t,e){"use strict";t.exports=String.fromCharCode},function(t,e){"use strict";function i(t){return RegExp("["+t+"]","g")}t.exports=i},function(t,e,i){"use strict";function n(t){return a(t,function(e){return s(r(t/e.multiplier,1))})}var s=i(89),r=i(90),a=i(91);t.exports=n},function(t,e,i){"use strict";var n=i(69),s=n.ceil,r=n.floor,a=Math.trunc||function(t){return 0!==t&&isFinite(t)?t<0?s(t):r(t):t};t.exports=a},function(t,e,i){"use strict";function n(t,e,i){var n=a(10,r(e||0));return i=i||o,e<0&&(n=1/n),i(t*n)/n}var s=i(69),r=s.abs,a=s.pow,o=s.round;t.exports=n},function(t,e,i){"use strict";function n(t,e){var i=0,n=0;return r(function(t,s){if(n=a(e(t)),n>=1)return i=s,!1}),[n,i,t]}var s=i(69),r=i(73),a=s.abs;t.exports=n},function(t,e,i){"use strict";function n(t,e,i){var n=s[t];return n.requiresSuffix?e=r(e+r(i)):e+=n.requiresSuffixOr?r(n.requiresSuffixOr+"|"+i):r(i,!0),e}var s=i(50),r=i(71);t.exports=n},function(t,e,i){"use strict";var n=i(34),s=i(94);i(136),n.Date.defineStatic({create:function(t,e){return s(t,e)}}),t.exports=n.Date.create},function(t,e,i){"use strict";function n(t,e,i){return s(null,t,e,i).date}var s=i(95);t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n){function a(t){var e=P(t)?{locale:t}:t||{};return e.prefer=+!!R(e,"future")-+!!R(e,"past"),e}function o(t,e){var i=R(it,"params")||{};return c(e.to,function(e,n){var s,a,o=t[n+1];o&&("yy"===e||"y"===e?(e="year",a=S(o,Q,R(it,"prefer"))):(s=R(r,e))?(e=s.param||e,a=T(s,o)):a=et.getTokenValue(e,o),i[e]=a)}),i}function v(t,e){return l(t)&&!d(R(it,"fromUTC"))&&(it.fromUTC=!0),l(t)&&!d(R(it,"setUTC"))&&(it.setUTC=!0),e&&(t=new Date(t.getTime())),t}function E(t){nt.push(t)}function z(){c(nt,function(t){t.call()})}function W(t){t=t.toLowerCase(),et=A.get(R(it,"locale"));for(var e,i,n=0;e=et.compiledFormats[n];n++)if(i=t.match(e.reg)){if(et.cacheFormat(e,n),tt=o(i,e),d(tt.timestamp)){t=tt.timestamp,tt=null;break}d(tt.ampm)&&U(tt.ampm),(tt.utc||d(tt.tzHour))&&V(tt.tzHour,tt.tzMinute,tt.tzSign),d(tt.shift)&&y(tt.unit)&&K(),d(tt.num)&&y(tt.unit)&&Y(tt.num),tt.midday&&G(tt.midday),d(tt.day)&&X(tt.day),d(tt.unit)&&q(tt.unit),tt.edge&&Z(tt.edge,tt),tt.yearSign&&(tt.year*=tt.yearSign);break}return tt?st?m(Q,tt,!1,1):(l(Q)&&h(Q),m(Q,tt,!0,0,R(it,"prefer"),rt)):(Q=new Date(t),R(it,"fromUTC")&&Q.setTime(Q.getTime()+f(Q)*s)),z(),Q}function U(t){1===t&&tt.hour<12?tt.hour+=12:0===t&&12===tt.hour&&(tt.hour=0)}function V(t,e,i){l(Q,!0);var n=(i||1)*(60*(t||0)+(e||0));n&&(tt.minute=(tt.minute||0)-n)}function K(){d(tt.month)?tt.unit=B:d(tt.weekday)&&(tt.unit=j)}function Y(t){d(tt.weekday)?$(t):d(tt.month)&&(tt.date=tt.num)}function G(t){tt.hour=t%24,t>23&&E(function(){b(Q,"date",u(t/24))})}function X(){h(Q),y(tt.unit)&&(tt.unit=L,tt.num=tt.day,delete tt.day)}function q(t){var e=d(tt.num)?tt.num:1;d(tt.weekday)&&(t===H?($(e),e=1):(m(Q,{weekday:tt.weekday},!0),delete tt.weekday)),tt.half&&(e*=tt.half),d(tt.shift)?e*=tt.shift:tt.sign&&(e*=tt.sign),d(tt.day)&&(e+=tt.day,delete tt.day),J(t),tt[M.units[t]]=e,st=!0}function Z(t,e){var i,n=e.unit;n||O(e,function(t,i,s,r){"weekday"===t&&d(e.month)||(n=r)}),n===H&&d(e.weekday)&&(i=e.weekday,delete e.weekday),E(function(){var e;t<0?k(Q,n,R(it,"locale")):t>0&&(1===t&&(e=L,k(Q,L)),w(Q,n,R(it,"locale"),e)),d(i)&&(p(Q,i,-t),h(Q))}),n===H?e.specificity=L:e.specificity=n-1}function $(t){tt.weekday=7*(t-1)+tt.weekday,tt.date=1,rt=1}function J(t){var e;N(tt,function(i,n,s,r){return r>=t?(Q.setTime(NaN),!1):void(ri}),t}var s=i(57),r=i(60),a=i(100),o=i(101),l=r.isFunction;t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n){n&&i===r(t,e,i)||t["set"+(s(t)?"UTC":"")+e](i)}var s=i(78),r=i(77);t.exports=n},function(t,e,i){"use strict";function n(t,e){for(;t>=0&&e(s[t],t)!==!1;)t=r(t)}var s=i(74),r=i(102);t.exports=n},function(t,e,i){"use strict";function n(t){return t===l?a:t===o?r:t-1}var s=i(82),r=s.HOURS_INDEX,a=s.DAY_INDEX,o=s.WEEK_INDEX,l=s.MONTH_INDEX;t.exports=n},function(t,e,i){"use strict";function n(t,e,i){if(u(e)){var n=a(t);if(i){var o=i>0?1:-1,l=e%7-n;l&&l/c(l)!==o&&(e+=7*o)}return s(t,r(t)+e-n),t.getTime()}}var s=i(104),r=i(105),a=i(106),o=i(60),l=i(69),u=o.isNumber,c=l.abs;t.exports=n},function(t,e,i){"use strict";function n(t,e){s(t,"Date",e)}var s=i(100);t.exports=n},function(t,e,i){"use strict";function n(t){return s(t,"Date")}var s=i(77);t.exports=n},function(t,e,i){"use strict";function n(t){return s(t,"Day")}var s=i(77);t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n,r,h){function p(t,e){r&&!D&&(D="weekday"===t?_:y(e))}function k(t){t>e.specificity||(e.specificity=t)}function N(){if(D&&!(D>C))switch(r){case-1:return t>c();case 1:return t28,n&&!r.ambiguous?void t.setTime(t.getTime()+i*n*r.multiplier):(n&&(u===_&&(i*=7,g=s[x].method),i=i*n+d(t,g)),v(t,g,i,n),void(c&&F(t,i)&&o(t,0))))}var D;if(T(e)&&n)e={millisecond:e};else if(T(e))return t.setTime(e),t;return b(e,P),i&&e.specificity&&m(t,e.specificity),N()&&S(),t}var s=i(74),r=i(82),a=i(89),o=i(104),l=i(105),u=i(81),c=i(108),f=i(103),h=i(69),d=i(77),p=i(60),m=i(115),g=i(102),y=i(116),v=i(117),b=i(124),x=r.DAY_INDEX,_=r.WEEK_INDEX,w=r.MONTH_INDEX,C=r.YEAR_INDEX,E=h.round,T=p.isNumber;t.exports=n},function(t,e,i){"use strict";function n(){return s("newDateInternal")()}var s=i(109);t.exports=n},function(t,e,i){"use strict";var n=i(110),s=i(112),r=i(113),a=s.sugarDate;t.exports=r(a,n)},function(t,e,i){"use strict";var n=i(111),s={newDateInternal:n};t.exports=s},function(t,e){"use strict";function i(){return new Date}t.exports=i},function(t,e,i){"use strict";var n=i(34);t.exports={sugarObject:n.Object,sugarArray:n.Array,sugarDate:n.Date,sugarString:n.String,sugarNumber:n.Number,sugarFunction:n.Function,sugarRegExp:n.RegExp}},function(t,e,i){"use strict";function n(t,e){function i(t){return a[t]}function n(t,i){null===i&&(i=e[t]),a[t]=i}var a=s(e);return r(t,"getOption",i),r(t,"setOption",n),i}var s=i(42),r=i(114);t.exports=n},function(t,e,i){"use strict";function n(t,e,i){r(t,e,i)}var s=i(41),r=s.setProperty;t.exports=n},function(t,e,i){"use strict";function n(t,e){return r(t,s(e))}var s=i(102),r=i(99);t.exports=n},function(t,e,i){"use strict";function n(t){return t===r?a:t+1}var s=i(82),r=s.DAY_INDEX,a=s.MONTH_INDEX;t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n){"ISOWeek"===e?r(t,i):s(t,e,i,n)}var s=i(100),r=i(118);t.exports=n},function(t,e,i){"use strict";function n(t,e){if(g(e)){var i=f(t),n=h(t);m(i,y,v),a(i,r(i)+7*(e-1)),o(t,l(i)),c(t,u(i)),a(t,r(i)),d(t,n||7)}return t.getTime()}var s=i(47),r=i(105),a=i(104),o=i(119),l=i(76),u=i(81),c=i(120),f=i(121),h=i(106),d=i(103),p=i(60),m=i(122),g=p.isNumber,y=s.ISO_FIRST_DAY_OF_WEEK,v=s.ISO_FIRST_DAY_OF_WEEK_YEAR;t.exports=n},function(t,e,i){"use strict";function n(t,e){s(t,"FullYear",e)}var s=i(100);t.exports=n},function(t,e,i){"use strict";function n(t,e){s(t,"Month",e)}var s=i(100);t.exports=n},function(t,e,i){"use strict";function n(t){var e=new Date(t.getTime());return s(e,!!s(t)),e}var s=i(78);t.exports=n},function(t,e,i){"use strict";function n(t,e,i){a(t,l),r(t,i),o(t,e)}var s=i(82),r=i(104),a=i(99),o=i(123),l=s.MONTH_INDEX;t.exports=n},function(t,e,i){"use strict";function n(t,e){return s(t,7*o((r(t)-e)/7)+e),t}var s=i(103),r=i(106),a=i(69),o=a.floor;t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n){function s(i,n,s){var o=a(t,i);r(o)&&e(i,o,n,s)}o(function(t,e){var i=s(t.name,t,e);return i!==!1&&e===l&&(i=s("weekday",t,e)),i},i,n)}var s=i(82),r=i(57),a=i(125),o=i(73),l=s.DAY_INDEX;t.exports=n},function(t,e,i){"use strict";function n(t,e){return a(t,s(t,e))}var s=i(126),r=i(41),a=r.getOwn;t.exports=n},function(t,e,i){"use strict";function n(t,e){return s(t,e)||s(t,e+"s")||"day"===e&&s(t,"date")}var s=i(127);t.exports=n},function(t,e,i){"use strict";function n(t,e){if(r(t,e))return e}var s=i(41),r=s.hasOwn;t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n){var r={};return r[e]=i,s(t,r,n,1)}var s=i(107);t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n){return e===u&&a(t,c.get(i).getFirstDayOfWeek()),l(t,o(e),n,!0)}var s=i(35),r=i(82),a=i(130),o=i(102),l=i(99),u=r.WEEK_INDEX,c=s.localeManager;t.exports=n},function(t,e,i){"use strict";function n(t,e){var i=e-1;return s(t,7*o((r(t)-i)/7)+i),t}var s=i(103),r=i(106),a=i(69),o=a.ceil;t.exports=n},function(t,e,i){"use strict";function n(t,e){delete t[s(t,e)]}var s=i(126);t.exports=n},function(t,e){"use strict";function i(t,e){var i;return i=t.val?t.val:t.sign?"+"===e?1:-1:t.bool?!!i:+e.replace(/,/,"."),"month"===t.param&&(i-=1),i}t.exports=i},function(t,e,i){"use strict";function n(t,e,i){return e===u&&o(t,c.get(i).getFirstDayOfWeek()),l(t,a(e))}var s=i(35),r=i(82),a=i(102),o=i(123),l=i(99),u=r.WEEK_INDEX,c=s.localeManager;t.exports=n},function(t,e,i){"use strict";function n(t,e,i){var n,r=+t;return r+=r<50?2e3:1900,i&&(n=r-s(e),n/a(n)!==i&&(r+=100*i)),r}var s=i(76),r=i(69),a=r.abs;t.exports=n},function(t,e,i){"use strict";function n(t,e){r(t,e,o,a)}var s=i(82),r=i(124),a=s.DAY_INDEX,o=s.YEAR_INDEX;t.exports=n},function(t,e,i){"use strict";var n=i(137);n()},function(t,e,i){"use strict";function n(){a(o,s)}var s=i(94),r=i(112),a=i(138),o=r.sugarDate;t.exports=n},function(t,e){"use strict";function i(t,e){t.prototype.constructor=function(){return e.apply(this,arguments)}}t.exports=i},function(t,e,i){"use strict";var n=i(34),s=i(35),r=i(140),a=s.localeManager;n.Date.defineStatic({getAllLocaleCodes:function(){return r(a.getAll())}}),t.exports=n.Date.getAllLocaleCodes},function(t,e){"use strict";function i(t){return Object.keys(t)}t.exports=i},function(t,e,i){"use strict";var n=i(34),s=i(35),r=s.localeManager;n.Date.defineStatic({getAllLocales:function(){return r.getAll()}}),t.exports=n.Date.getAllLocales},function(t,e,i){"use strict";var n=i(34),s=i(35),r=s.localeManager;n.Date.defineStatic({getLocale:function(t){return r.get(t,!t)}}),t.exports=n.Date.getLocale},function(t,e,i){"use strict";var n=i(34),s=i(35),r=s.localeManager;n.Date.defineStatic({removeLocale:function(t){return r.remove(t)}}),t.exports=n.Date.removeLocale},function(t,e,i){"use strict";var n=i(34),s=i(35),r=s.localeManager;n.Date.defineStatic({setLocale:function(t){return r.set(t)}}),t.exports=n.Date.setLocale},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.day},function(t,e,i){"use strict";var n=i(147);n()},function(t,e,i){"use strict";function n(){u(c,s,function(t,e){var i,n,s,a=e.name;i=function(t){return f(t*e.multiplier)},n=function(t,e,i){return o(r(e,i,!0),a,t)},s=function(t,e,i){return o(r(e,i,!0),a,-t)},t[a]=i,t[a+"s"]=i,t[a+"Before"]=s,t[a+"sBefore"]=s,t[a+"Ago"]=s,t[a+"sAgo"]=s,t[a+"After"]=n,t[a+"sAfter"]=n,t[a+"FromNow"]=n,t[a+"sFromNow"]=n})}var s=i(74),r=i(94),a=i(69),o=i(128),l=i(112),u=i(148),c=l.sugarNumber,f=a.round;t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n){a(t,r(e,i),n)}var s=i(149),r=i(151),a=s.defineInstance;t.exports=n},function(t,e,i){"use strict";var n=i(150);t.exports={alias:n("alias"),defineStatic:n("defineStatic"),defineInstance:n("defineInstance"),defineStaticPolyfill:n("defineStaticPolyfill"),defineInstancePolyfill:n("defineInstancePolyfill"),defineInstanceAndStatic:n("defineInstanceAndStatic"),defineInstanceWithArguments:n("defineInstanceWithArguments")}},function(t,e){"use strict";function i(t){return function(e,i,n){e[t](i,n)}}t.exports=i},function(t,e,i){"use strict";function n(t,e){var i={};return o(t)&&(t=r(t)),s(t,function(t,n){e(i,t,n)}),i}var s=i(53),r=i(63),a=i(60),o=a.isString;t.exports=n},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.dayAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.dayAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.dayBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.dayFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.days},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.daysAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.daysAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.daysBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.daysFromNow},function(t,e,i){"use strict";var n=i(34),s=i(35),r=s.localeManager;n.Number.defineInstance({duration:function(t,e){return r.get(e).getDuration(t)}}),t.exports=n.Number.duration},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hour},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hourAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hourAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hourBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hourFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hours},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hoursAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hoursAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hoursBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.hoursFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.millisecond},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.millisecondAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.millisecondAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.millisecondBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.millisecondFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.milliseconds},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.millisecondsAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.millisecondsAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.millisecondsBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.millisecondsFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minute},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minuteAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minuteAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minuteBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minuteFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minutes},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minutesAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minutesAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minutesBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.minutesFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.month},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.monthAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.monthAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.monthBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.monthFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.months},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.monthsAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.monthsAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.monthsBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.monthsFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.second},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.secondAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.secondAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.secondBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.secondFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.seconds},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.secondsAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.secondsAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.secondsBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.secondsFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.week},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.weekAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.weekAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.weekBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.weekFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.weeks},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.weeksAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.weeksAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.weeksBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.weeksFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.year},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.yearAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.yearAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.yearBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.yearFromNow},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.years},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.yearsAfter},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.yearsAgo},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.yearsBefore},function(t,e,i){"use strict";var n=i(34);i(146),t.exports=n.Number.yearsFromNow},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.addDays},function(t,e,i){"use strict";var n=i(234);n()},function(t,e,i){"use strict";function n(){h(g,s,function(t,e,i){var n=e.name,s=c(n);i>v&&a(["Last","This","Next"],function(e){t["is"+e+s]=function(t,i){return o(t,e+" "+n,0,i,{locale:"en"})}}),i>y&&(t["beginningOf"+s]=function(t,e){ +return d(t,i,e)},t["endOf"+s]=function(t,e){return u(t,i,e)}),t["add"+s+"s"]=function(t,e,i){return l(t,n,e,i)};var r=function(t,i,n){return m(t,p(t,i,n,!0),e)},f=function(t,i,n){return m(p(t,i,n,!0),t,e)};t[n+"sAgo"]=t[n+"sUntil"]=f,t[n+"sSince"]=t[n+"sFromNow"]=r})}var s=i(74),r=i(82),a=i(53),o=i(235),l=i(128),u=i(129),c=i(237),f=i(112),h=i(148),d=i(133),p=i(238),m=i(239),g=f.sugarDate,y=r.HOURS_INDEX,v=r.DAY_INDEX;t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n,a){function y(){return E.set&&E.set.specificity?0:(l(E.date)-l(t))*s}function v(){var t=r[E.set.specificity];return f(u(E.date),t.name,1).getTime()-1}var b,x,_,w,C,E,T,k=0,N=0;return o(t)&&(a=a||{},a.fromUTC=!0,a.setUTC=!0),E=p(null,e,a,!0),i>0&&(k=N=i,_=!0),!!h(E.date)&&(E.set&&E.set.specificity&&((c(E.set.edge)||c(E.set.shift))&&(x=!0,m(E.date,E.set.specificity,n)),C=x||E.set.specificity===g?d(u(E.date),E.set.specificity,n).getTime():v(),!_&&c(E.set.sign)&&E.set.specificity&&(k=50,N=-50)),T=t.getTime(),w=E.date.getTime(),C=C||w,b=y(),b&&(w-=b,C-=b),T>=w-k&&T<=C+N)}var s=i(96),r=i(74),a=i(82),o=i(78),l=i(97),u=i(121),c=i(57),f=i(128),h=i(236),d=i(129),p=i(95),m=i(133),g=a.MONTH_INDEX;t.exports=n},function(t,e){"use strict";function i(t){return!isNaN(t.getTime())}t.exports=i},function(t,e){"use strict";function i(t){return t.charAt(0).toUpperCase()+t.slice(1)}t.exports=i},function(t,e,i){"use strict";function n(t,e,i,n){return s(t,e,i,n).date}var s=i(95);t.exports=n},function(t,e,i){"use strict";function n(t,e,i){var n,o,l=e>t;if(l||(o=e,e=t,t=o),n=e-t,i.multiplier>1&&(n=s(n/i.multiplier)),i.ambiguous)for(t=r(t),n&&a(t,i.name,n);te));)n+=1;return l?-n:n}var s=i(89),r=i(121),a=i(128);t.exports=n},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.addHours},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.addMilliseconds},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.addMinutes},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.addMonths},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.addSeconds},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.addWeeks},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.addYears},function(t,e,i){"use strict";var n=i(34),s=i(248);n.Date.defineInstanceWithArguments({advance:function(t,e){return s(t,e,1)}}),t.exports=n.Date.advance},function(t,e,i){"use strict";function n(t,e,i){return e=r(e,!0),s(t,e[0],e[1],i)}var s=i(107),r=i(249);t.exports=n},function(t,e,i){"use strict";function n(t,e){var i=t[0],n=t[1];return e&&c(i)?i=o(i):u(i)&&u(n)?(i=l(t),n=null):a(i)&&(i=r(i)),[i,n]}var s=i(60),r=i(42),a=i(65),o=i(250),l=i(251),u=s.isNumber,c=s.isString;t.exports=n},function(t,e,i){"use strict";function n(t){var e,i,n={};return e=t.match(/^(-?\d*[\d.]\d*)?\s?(\w+?)s?$/i),e&&(s(i)&&(i=+e[1],isNaN(i)&&(i=1)),n[e[2].toLowerCase()]=i),n}var s=i(68);t.exports=n},function(t,e,i){"use strict";function n(t){var e={},i=0;return a(o,function(n){var s=t[i++];r(s)&&(e[n.name]=s)}),e}var s=i(82),r=i(57),a=i(101),o=s.YEAR_INDEX;t.exports=n},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.beginningOfDay},function(t,e,i){"use strict";var n=i(34),s=i(98),r=i(106),a=i(103);n.Date.defineInstance({beginningOfISOWeek:function(t){var e=r(t);return 0===e?e=-6:1!==e&&(e=1),a(t,e),s(t)}}),t.exports=n.Date.beginningOfISOWeek},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.beginningOfMonth},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.beginningOfWeek},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.beginningOfYear},function(t,e,i){"use strict";var n=i(34),s=i(121);n.Date.defineInstance({clone:function(t){return s(t)}}),t.exports=n.Date.clone},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.daysAgo},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.daysFromNow},function(t,e,i){"use strict";var n=i(34),s=i(75);n.Date.defineInstance({daysInMonth:function(t){return s(t)}}),t.exports=n.Date.daysInMonth},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.daysSince},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.daysUntil},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.endOfDay},function(t,e,i){"use strict";var n=i(34),s=i(82),r=i(106),a=i(103),o=i(129),l=s.DAY_INDEX;n.Date.defineInstance({endOfISOWeek:function(t){return 0!==r(t)&&a(t,7),o(t,l)}}),t.exports=n.Date.endOfISOWeek},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.endOfMonth},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.endOfWeek},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.endOfYear},function(t,e,i){"use strict";var n=i(34),s=i(269);n.Date.defineInstance({format:function(t,e,i){return s(t,e,i)}}),t.exports=n.Date.format},function(t,e,i){"use strict";function n(t,e,i){return a(t),e=s[e]||e||"{long}",o(e,t,i)}var s=i(270),r=i(271),a=i(286),o=r.dateFormatMatcher;t.exports=n},function(t,e){"use strict";var i={ISO8601:"{yyyy}-{MM}-{dd}T{HH}:{mm}:{ss}.{SSS}{Z}",RFC1123:"{Dow}, {dd} {Mon} {yyyy} {HH}:{mm}:{ss} {ZZ}",RFC1036:"{Weekday}, {dd}-{Mon}-{yy} {HH}:{mm}:{ss} {ZZ}"};t.exports=i},function(t,e,i){"use strict";function n(){function t(t,e,i){e&&f(d(e),function(e){t[e]=i})}function e(t){return function(e,i){return t(e,i).toLowerCase()}}function i(t){return function(e,i){var n=t(e,i);return n+v.get(i).getOrdinal(n)}}function n(t,e){return function(i,n){return h(t(i,n),e)}}function s(t){return function(e,i){return t(e,i)%100}}function l(t){return function(e,i){return o(t,e,i)}}function p(t){for(var e=1;e<=5;e++)m(t,e)}function m(i,n){var s=function(t,e){return i.get(t,e,n)};t(r,i.ldml+n,s),i.lowerToken&&(r[i.lowerToken+n]=e(s))}function g(t){return function(e,i){var n=v.get(i);return o(n[t],e,i)}}r={},a={},f(u,function(o){var u,c=o.get;o.lowerToken&&(r[o.lowerToken]=e(c)),o.ordinalToken&&(r[o.ordinalToken]=i(c,o)),o.ldmlPaddedToken&&(r[o.ldmlPaddedToken]=n(c,o.ldmlPaddedToken.length)),o.ldmlTwoDigitToken&&(r[o.ldmlTwoDigitToken]=n(s(c),2)),o.strfTwoDigitToken&&(a[o.strfTwoDigitToken]=n(s(c),2)),o.strfPadding&&(u=n(c,o.strfPadding)),o.alias&&(c=l(o.alias)),o.allowAlternates&&p(o),t(r,o.ldml,c),t(a,o.strf,u||c)}),_(c,function(e,i){t(r,i,l(e))}),y(w,"short medium long full",function(e,i){var n=g(i);t(r,i,n),e[i]=n}),t(r,"time",g("time")),t(r,"stamp",g("stamp"))}function s(){function t(t,e,i){return x(r,e)(t,i)}function e(t,e,i){return x(a,e)(t,i)}function i(t,e){return b(r,t)||b(a,e)}o=g(t,e,i)}var r,a,o,l=i(35),u=i(272),c=i(270),f=i(53),h=i(275),d=i(63),p=i(112),m=i(41),g=i(282),y=i(148),v=l.localeManager,b=m.hasOwn,x=m.getOwn,_=m.forEachProperty,w=p.sugarDate;n(),s(),t.exports={ldmlTokens:r,strfTokens:a,dateFormatMatcher:o}},function(t,e,i){"use strict";var n=i(273),s=i(35),r=i(82),a=i(89),o=i(105),l=i(76),u=i(274),c=i(81),f=i(121),h=i(275),d=i(106),p=i(77),m=i(69),g=i(277),y=i(279),v=i(280),b=i(278),x=i(281),_=i(99),w=s.localeManager,C=r.MONTH_INDEX,E=m.ceil,T=[{ldml:"Dow",strf:"a",lowerToken:"dow",get:function(t,e){return w.get(e).getWeekdayName(d(t),2)}},{ldml:"Weekday",strf:"A",lowerToken:"weekday",allowAlternates:!0,get:function(t,e,i){return w.get(e).getWeekdayName(d(t),i)}},{ldml:"Mon",strf:"b h",lowerToken:"mon",get:function(t,e){return w.get(e).getMonthName(c(t),2)}},{ldml:"Month",strf:"B",lowerToken:"month",allowAlternates:!0,get:function(t,e,i){return w.get(e).getMonthName(c(t),i)}},{strf:"C",get:function(t){return l(t).toString().slice(0,2)}},{ldml:"d date day",strf:"d",strfPadding:2,ldmlPaddedToken:"dd",ordinalToken:"do",get:function(t){return o(t)}},{strf:"e",get:function(t){return h(o(t),2,!1,10," ")}},{ldml:"H 24hr",strf:"H",strfPadding:2,ldmlPaddedToken:"HH",get:function(t){return u(t)}},{ldml:"h hours 12hr",strf:"I",strfPadding:2,ldmlPaddedToken:"hh",get:function(t){return u(t)%12||12}},{ldml:"D",strf:"j",strfPadding:3,ldmlPaddedToken:"DDD",get:function(t){var e=_(f(t),C);return v(t,e)+1}},{ldml:"M",strf:"m",strfPadding:2,ordinalToken:"Mo",ldmlPaddedToken:"MM",get:function(t){return c(t)+1}},{ldml:"m minutes",strf:"M",strfPadding:2,ldmlPaddedToken:"mm",get:function(t){return p(t,"Minutes")}},{ldml:"Q",get:function(t){return E((c(t)+1)/3)}},{ldml:"TT",strf:"p",get:function(t,e){return x(t,e)}},{ldml:"tt",strf:"P",get:function(t,e){return x(t,e).toLowerCase()}},{ldml:"T",lowerToken:"t",get:function(t,e){return x(t,e).charAt(0)}},{ldml:"s seconds",strf:"S",strfPadding:2,ldmlPaddedToken:"ss",get:function(t){return p(t,"Seconds")}},{ldml:"S ms",strfPadding:3,ldmlPaddedToken:"SSS",get:function(t){return p(t,"Milliseconds")}},{ldml:"e",strf:"u",ordinalToken:"eo",get:function(t){return d(t)||7}},{strf:"U",strfPadding:2,get:function(t){return b(t,!1,0)}},{ldml:"W",strf:"V",strfPadding:2,ordinalToken:"Wo",ldmlPaddedToken:"WW",get:function(t){return b(t,!0)}},{strf:"w",get:function(t){return d(t)}},{ldml:"w",ordinalToken:"wo",ldmlPaddedToken:"ww",get:function(t,e){var i=w.get(e),n=i.getFirstDayOfWeek(e),s=i.getFirstDayOfWeekYear(e);return b(t,!0,n,s)}},{strf:"W",strfPadding:2,get:function(t){return b(t,!1)}},{ldmlPaddedToken:"gggg",ldmlTwoDigitToken:"gg",get:function(t,e){return g(t,e)}},{strf:"G",strfPadding:4,strfTwoDigitToken:"g",ldmlPaddedToken:"GGGG",ldmlTwoDigitToken:"GG",get:function(t,e){return g(t,e,!0)}},{ldml:"year",ldmlPaddedToken:"yyyy",ldmlTwoDigitToken:"yy",strf:"Y",strfPadding:4,strfTwoDigitToken:"y",get:function(t){return l(t)}},{ldml:"ZZ",strf:"z",get:function(t){return y(t)}},{ldml:"X",get:function(t){return a(t.getTime()/1e3)}},{ldml:"x",get:function(t){return t.getTime()}},{ldml:"Z",get:function(t){return y(t,!0)}},{ldml:"z",strf:"Z",get:function(t){var e=t.toString().match(n);return e?e[1]:""}},{strf:"D",alias:"%m/%d/%y"},{strf:"F",alias:"%Y-%m-%d"},{strf:"r",alias:"%I:%M:%S %p"},{strf:"R",alias:"%H:%M"},{strf:"T",alias:"%H:%M:%S"},{strf:"x",alias:"{short}"},{strf:"X",alias:"{time}"},{strf:"c",alias:"{stamp}"}];t.exports=T},function(t,e){"use strict";t.exports=/(\w{3})[()\s\d]*$/},function(t,e,i){"use strict";function n(t){return s(t,"Hours")}var s=i(77);t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n,s){var o=a(t).toString(n||10);return o=r(s||"0",e-o.replace(/\.\d+/,"").length)+o,(i||t<0)&&(o=(t<0?"-":"+")+o),o}var s=i(69),r=i(276),a=s.abs;t.exports=n},function(t,e){"use strict";function i(t,e){var i="";for(t=t.toString();e>0;)1&e&&(i+=t),(e>>=1)&&(t+=t);return i}t.exports=i},function(t,e,i){"use strict";function n(t,e,i){var n,s,u,c,f,h;return n=r(t),s=a(t),0!==s&&11!==s||(i||(h=l.get(e),u=h.getFirstDayOfWeek(e),c=h.getFirstDayOfWeekYear(e)),f=o(t,!1,u,c),0===s&&0===f?n-=1:11===s&&1===f&&(n+=1)),n}var s=i(35),r=i(76),a=i(81),o=i(278),l=s.localeManager;t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n){var s,p=0;for(l(i)&&(i=h),l(n)&&(n=d),s=u(o(t),i),f(s,i,n),e&&ti){var s=e.slice(i,n);f(s,o),f(s,l),t.push(function(){return s})}}function u(t){return function(){return t}}function c(t,e,i){if(t&&!t(e,i))throw new TypeError("Invalid token "+(e||i)+" in format string")}function f(t,e){if(t.indexOf(e)!==-1)throw new TypeError("Unmatched "+e+" in format string")}function h(t){var e,i=[],s=0;for(d.lastIndex=0;e=d.exec(t);)r(i,t,s,e.index),n(i,e),s=d.lastIndex;return r(i,t,s,t.length),i}var d=s,p=a(h);return function(t,e,i){for(var n=p(t),s="",r=0;rl().getTime();case"past"===e:return t.getTime()0&&c(t)<6;case"weekend"===e:return 0===c(t)||6===c(t);case o(n=m.weekdayMap[e]):return c(t)===n;case o(n=m.monthMap[e]):return a(t)===n}return d(t,e,i)}}var s=i(35),r=i(298),a=i(81),o=i(57),l=i(108),u=i(299),c=i(106),f=i(236),h=i(60),d=i(235),p=h.isString,m=s.English;t.exports=n},function(t,e){"use strict";function i(t){return t.trim()}t.exports=i},function(t,e,i){"use strict";function n(t,e){var i=l();return e&&s(i,r(i)+e),a(t)===a(i)&&o(t)===o(i)&&r(t)===r(i)}var s=i(104),r=i(105),a=i(76),o=i(81),l=i(108);t.exports=n},function(t,e,i){"use strict";var n=i(34),s=i(94);n.Date.defineInstance({isAfter:function(t,e,i){return t.getTime()>s(e).getTime()-(i||0)}}),t.exports=n.Date.isAfter},function(t,e,i){"use strict";var n=i(34),s=i(94);n.Date.defineInstance({isBefore:function(t,e,i){return t.getTime()=r}}),t.exports=n.Date.isBetween},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isFriday},function(t,e,i){"use strict";var n=i(305);n()},function(t,e,i){"use strict";function n(){var t=r("Today Yesterday Tomorrow Weekday Weekend Future Past"),e=u.weekdays.slice(0,7),i=u.months.slice(0,12),n=t.concat(e).concat(i);l(c,n,function(t,e){t["is"+e]=function(t){return a(t,e)}})}var s=i(35),r=i(63),a=i(297),o=i(112),l=i(148),u=s.English,c=o.sugarDate;t.exports=n},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isFuture},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.isLastMonth},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.isLastWeek},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.isLastYear},function(t,e,i){"use strict";var n=i(34),s=i(76);n.Date.defineInstance({isLeapYear:function(t){var e=s(t);return e%4===0&&e%100!==0||e%400===0}}),t.exports=n.Date.isLeapYear},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isMonday},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.isNextMonth},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.isNextWeek},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.isNextYear},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isPast},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isSaturday},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isSunday},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.isThisMonth},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.isThisWeek},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.isThisYear},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isThursday},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isToday},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isTomorrow},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isTuesday},function(t,e,i){"use strict";var n=i(34),s=i(326);n.Date.defineInstance({isUTC:function(t){return s(t)}}),t.exports=n.Date.isUTC},function(t,e,i){"use strict";function n(t){return!!s(t)||0===r(t)}var s=i(78),r=i(97);t.exports=n},function(t,e,i){"use strict";var n=i(34),s=i(236);n.Date.defineInstance({isValid:function(t){return s(t)}}),t.exports=n.Date.isValid},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isWednesday},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isWeekday},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isWeekend},function(t,e,i){"use strict";var n=i(34);i(304),t.exports=n.Date.isYesterday},function(t,e,i){"use strict";var n=i(34);n.Date.defineInstance({iso:function(t){return t.toISOString()}}),t.exports=n.Date.iso},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.millisecondsAgo},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.millisecondsFromNow},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.millisecondsSince},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.millisecondsUntil},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.minutesAgo},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.minutesFromNow},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.minutesSince},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.minutesUntil},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.monthsAgo},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.monthsFromNow},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.monthsSince},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.monthsUntil},function(t,e,i){"use strict";var n=i(34),s=i(346);n.Date.defineInstance({relative:function(t,e,i){return s(t,null,e,i)}}),t.exports=n.Date.relative},function(t,e,i){"use strict";function n(t,e,i,n){var s,a,f,h,d;return o(t),u(i)?d=i:(h=i,d=n),s=l(t,e),d&&(a=d.apply(t,s.concat(c.get(h))))?r(t,a,h):(0===s[1]&&(s[1]=1,s[0]=1),f=e?"duration":s[2]>0?"future":"past",c.get(h).getRelativeFormat(s,f))}var s=i(35),r=i(269),a=i(60),o=i(286),l=i(347),u=a.isFunction,c=s.localeManager;t.exports=n},function(t,e,i){"use strict";function n(t,e){var i;return e||(e=s(),t>e&&(e=new Date(e.getTime()-10))),i=t-e,a(i,function(i){return l(o(t,e,i))})}var s=i(108),r=i(69),a=i(91),o=i(239),l=r.abs;t.exports=n},function(t,e,i){"use strict";var n=i(34),s=i(94),r=i(346);n.Date.defineInstance({relativeTo:function(t,e,i){return r(t,s(e),i)}}),t.exports=n.Date.relativeTo},function(t,e,i){"use strict";var n=i(34),s=i(82),r=i(133),a=i(350),o=s.DAY_INDEX;n.Date.defineInstance({reset:function(t,e,i){var n=e?a(e):o;return r(t,n,i),t}}),t.exports=n.Date.reset},function(t,e,i){"use strict";function n(t){var e,i={};return i[t]=1,s(i,function(t,i,n,s){return e=s,!1}),e}var s=i(124);t.exports=n},function(t,e,i){"use strict";var n=i(34),s=i(248);n.Date.defineInstanceWithArguments({rewind:function(t,e){return s(t,e,-1)}}),t.exports=n.Date.rewind},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.secondsAgo},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.secondsFromNow},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.secondsSince},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.secondsUntil},function(t,e,i){"use strict";var n=i(34),s=i(107),r=i(249);n.Date.defineInstanceWithArguments({set:function(t,e){return e=r(e),s(t,e[0],e[1])}}),t.exports=n.Date.set},function(t,e,i){"use strict";var n=i(34),s=i(118);n.Date.defineInstance({setISOWeek:function(t,e){return s(t,e)}}),t.exports=n.Date.setISOWeek},function(t,e,i){"use strict";var n=i(34),s=i(78);n.Date.defineInstance({setUTC:function(t,e){return s(t,e)}}),t.exports=n.Date.setUTC},function(t,e,i){"use strict";var n=i(34),s=i(103);n.Date.defineInstance({setWeekday:function(t,e){return s(t,e)}}),t.exports=n.Date.setWeekday},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.weeksAgo},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.weeksFromNow},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.weeksSince},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.weeksUntil},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.yearsAgo},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.yearsFromNow},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.yearsSince},function(t,e,i){"use strict";var n=i(34);i(233),t.exports=n.Date.yearsUntil},function(t,e,i){"use strict";var n=i(34);i(109);t.exports=n.Date.getOption},function(t,e,i){"use strict";var n=i(34);i(109);t.exports=n.Date.setOption},function(t,e,i){"use strict";i(371),i(385),i(388),i(389),i(390),i(402),i(403),i(404),i(405),i(406),i(407),i(408),i(409),i(410),i(412),i(413),i(414),i(415),i(416),t.exports=i(34)},function(t,e,i){"use strict";var n=i(34),s=i(372);n.Date.defineStatic({range:s}),t.exports=n.Date.range},function(t,e,i){"use strict";var n=i(373),s=i(60),r=i(376),a=i(377),o=s.isString,l=function(t,e){return 1===arguments.length&&o(t)?a(t):new n(r(t),r(e))};t.exports=l},function(t,e,i){"use strict";function n(t,e){this.start=s(t),this.end=s(e)}var s=i(374);t.exports=n},function(t,e,i){"use strict";function n(t){return a(t)?new Date(t.getTime()):r(t)}var s=i(60),r=i(375),a=s.isDate;t.exports=n},function(t,e,i){"use strict";function n(t){return null==t?t:r(t)?t.getTime():t.valueOf()}var s=i(60),r=s.isDate;t.exports=n},function(t,e,i){"use strict";function n(t){return a(t)?t:null==t?new Date:o.create?o.create(t):new Date(t)}var s=i(60),r=i(112),a=s.isDate,o=r.sugarDate;t.exports=n},function(t,e,i){"use strict";function n(t){var e,i,n,r,l,p;return c.get&&(e=t.match(f))?(l=o(e[1].replace("from","at")),p=c.get(l,e[2]),new s(l,p)):((e=t.match(d))&&(n=e[1],i=e[2]),(e=t.match(h))&&(i=e[1],n=e[2]),i&&n?(l=o(i),r=u(n),p=a(l,r[0],r[1])):l=t,new s(o(l),o(p)))}var s=i(373),r=i(378),a=i(381),o=i(376),l=i(112),u=i(383),c=l.sugarDate,f=r.RANGE_REG_FROM_TO,h=r.RANGE_REG_REAR_DURATION,d=r.RANGE_REG_FRONT_DURATION;t.exports=n},function(t,e,i){"use strict";var n=i(379);t.exports={RANGE_REG_FROM_TO:/(?:from)?\s*(.+)\s+(?:to|until)\s+(.+)$/i,RANGE_REG_REAR_DURATION:RegExp("(.+)\\s*for\\s*"+n,"i"),RANGE_REG_FRONT_DURATION:RegExp("(?:for)?\\s*"+n+"\\s*(?:starting)?\\s*at\\s*(.+)","i")}},function(t,e,i){"use strict";var n=i(380);t.exports="((?:\\d+)?\\s*(?:"+n+"))s?"},function(t,e){"use strict";t.exports="year|month|week|day|hour|minute|second|millisecond"},function(t,e,i){"use strict";function n(t,e,i){var n,o=s[i];return o?n=new Date(t.getTime()+e*o):(n=new Date(t),r(n,i,a(t,i)+e)),n}var s=i(382),r=i(100),a=i(77);t.exports=n},function(t,e){"use strict";var i={Hours:36e5,Minutes:6e4,Seconds:1e3,Milliseconds:1};t.exports=i},function(t,e,i){"use strict";function n(t){var e,i,n;return o(t)?[t,"Milliseconds"]:(e=t.match(s),i=+e[1]||1,n=a(e[2].toLowerCase()),n.match(/hour|minute|second/i)?n+="s":"Year"===n?n="FullYear":"Week"===n?(n="Date",i*=7):"Day"===n&&(n="Date"),[i,n])}var s=i(384),r=i(60),a=i(237),o=r.isNumber;t.exports=n},function(t,e,i){"use strict";var n=i(380);t.exports=RegExp("(\\d+)?\\s*("+n+")s?","i")},function(t,e,i){"use strict";var n=i(373),s=i(386),r=i(387);r(n,{clamp:function(t){return s(this,t)}})},function(t,e,i){"use strict";function n(t,e){var i,n=t.start,r=t.end,a=rr?n:r;return i=eo?o:e,s(i)}var s=i(374);t.exports=n},function(t,e,i){"use strict";function n(t,e){var i=t.prototype;r(e,function(t,e){i[e]=t})}var s=i(41),r=s.forEachProperty;t.exports=n},function(t,e,i){"use strict";var n=i(373),s=i(387);s(n,{clone:function(){return new n(this.start,this.end)}})},function(t,e,i){"use strict";var n=i(373),s=i(387);s(n,{contains:function(t){return null!=t&&(t.start&&t.end?t.start>=this.start&&t.start<=this.end&&t.end>=this.start&&t.end<=this.end:t>=this.start&&t<=this.end)}})},function(t,e,i){"use strict";i(391)},function(t,e,i){"use strict";var n=i(392);n()},function(t,e,i){"use strict";function n(){var t={};l(r.split("|"),function(e,i){var n,r,a=e+"s";i<4?r=function(){return u(this,e,!0)}:(n=s[c(a)],r=function(){return o((this.end-this.start)/n)}),t[a]=r}),f(a,t)}var s=i(382),r=i(380),a=i(373),o=i(89),l=i(53),u=i(393),c=i(237),f=i(387);t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n){var s,m,g,y,v=t.start,b=t.end,x=b0&&(e*=-1);x?_>=b:_<=b;)i||C.push(_),n&&n(_,w,t),_=s(),w++;return i?w-1:C}var s=i(60),r=i(394),a=i(381),o=i(397),l=i(398),u=i(399),c=i(383),f=s.isNumber,h=s.isString,d=s.isDate,p=s.isFunction;t.exports=n},function(t,e,i){"use strict";function n(t){return s(t.start)&&s(t.end)&&typeof t.start==typeof t.end}var s=i(395);t.exports=n},function(t,e,i){"use strict";function n(t){var e=r(t);return(!!e||0===e)&&s(t)}var s=i(396),r=i(375);t.exports=n},function(t,e){"use strict";function i(t){return t!==-(1/0)&&t!==1/0}t.exports=i},function(t,e,i){"use strict";function n(t,e,i){return s(t+e,i)}var s=i(90);t.exports=n},function(t,e,i){"use strict";function n(t,e){return s(t.charCodeAt(0)+e)}var s=i(86);t.exports=n},function(t,e,i){"use strict";function n(t,e){return a(r(t),r(e))}var s=i(69),r=i(400),a=s.max;t.exports=n},function(t,e,i){"use strict";function n(t){var e=s(t.toString());return e[1]?e[1].length:0}var s=i(401);t.exports=n},function(t,e,i){"use strict";function n(t){return t.split(r)}var s=i(59),r=s.HALF_WIDTH_PERIOD;t.exports=n},function(t,e,i){"use strict";var n=i(373),s=i(393),r=i(387);r(n,{every:function(t,e){return s(this,t,!1,e)}})},function(t,e,i){"use strict";i(391)},function(t,e,i){"use strict";var n=i(373),s=i(387);s(n,{intersect:function(t){return t.start>this.end||t.endt.start?this.start:t.start,this.endt.end?this.end:t.end)}})},function(t,e,i){"use strict";i(391)},function(t,e,i){"use strict";i(391)},function(t,e,i){"use strict";i(418),i(419),i(420),i(421),i(422),i(423),i(424),i(425),i(426),i(427),i(428),i(429),i(430),i(431),i(432),i(433),i(434),t.exports=i(34)},function(t,e,i){"use strict";var n=i(33);n("ca",{plural:!0,units:"milisegon:|s,segon:|s,minut:|s,hor:a|es,di:a|es,setman:a|es,mes:|os,any:|s",months:"gen:er|,febr:er|,mar:ç|,abr:il|,mai:g|,jun:y|,jul:iol|,ag:ost|,set:embre|,oct:ubre|,nov:embre|,des:embre|",weekdays:"diumenge|dg,dilluns|dl,dimarts|dt,dimecres|dc,dijous|dj,divendres|dv,dissabte|ds",numerals:"zero,un,dos,tres,quatre,cinc,sis,set,vuit,nou,deu",tokens:"el,la,de","short":"{dd}/{MM}/{yyyy}",medium:"{d} {month} {yyyy}","long":"{d} {month} {yyyy} {time}",full:"{weekday} {d} {month} {yyyy} {time}",stamp:"{dow} {d} {mon} {yyyy} {time}",time:"{H}:{mm}",past:"{sign} {num} {unit}",future:"{sign} {num} {unit}",duration:"{num} {unit}",timeMarkers:"a las",ampm:"am,pm",modifiers:[{name:"day",src:"abans d'ahir",value:-2},{name:"day",src:"ahir",value:-1},{name:"day",src:"avui",value:0},{name:"day",src:"demà|dema",value:1},{name:"sign",src:"fa",value:-1},{name:"sign",src:"en",value:1},{name:"shift",src:"passat",value:-1},{name:"shift",src:"el proper|la propera",value:1}],parse:["{sign} {num} {unit}","{num} {unit} {sign}","{0?}{1?} {unit:5-7} {shift}","{0?}{1?} {shift} {unit:5-7}"],timeParse:["{shift} {weekday}","{weekday} {shift}","{date?} {2?} {months}\\.? {2?} {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("da",{plural:!0,units:"millisekund:|er,sekund:|er,minut:|ter,tim:e|er,dag:|e,ug:e|er|en,måned:|er|en+maaned:|er|en,år:||et+aar:||et",months:"jan:uar|,feb:ruar|,mar:ts|,apr:il|,maj,jun:i|,jul:i|,aug:ust|,sep:tember|,okt:ober|,nov:ember|,dec:ember|",weekdays:"søn:dag|+son:dag|,man:dag|,tir:sdag|,ons:dag|,tor:sdag|,fre:dag|,lør:dag|+lor:dag|",numerals:"nul,en|et,to,tre,fire,fem,seks,syv,otte,ni,ti",tokens:"den,for",articles:"den","short":"{dd}-{MM}-{yyyy}",medium:"{d}. {month} {yyyy}","long":"{d}. {month} {yyyy} {time}",full:"{weekday} d. {d}. {month} {yyyy} {time}",stamp:"{dow} {d} {mon} {yyyy} {time}",time:"{H}:{mm}",past:"{num} {unit} {sign}",future:"{sign} {num} {unit}",duration:"{num} {unit}",ampm:"am,pm",modifiers:[{name:"day",src:"forgårs|i forgårs|forgaars|i forgaars",value:-2},{name:"day",src:"i går|igår|i gaar|igaar",value:-1},{name:"day",src:"i dag|idag",value:0},{name:"day",src:"i morgen|imorgen",value:1},{name:"day",src:"over morgon|overmorgen|i over morgen|i overmorgen|iovermorgen",value:2},{name:"sign",src:"siden",value:-1},{name:"sign",src:"om",value:1},{name:"shift",src:"i sidste|sidste",value:-1},{name:"shift",src:"denne",value:0},{name:"shift",src:"næste|naeste",value:1}],parse:["{months} {year?}","{num} {unit} {sign}","{sign} {num} {unit}","{1?} {num} {unit} {sign}","{shift} {unit:5-7}"],timeParse:["{day|weekday}","{date} {months?}\\.? {year?}"],timeFrontParse:["{shift} {weekday}","{0?} {weekday?},? {date}\\.? {months?}\\.? {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("de",{plural:!0,units:"Millisekunde:|n,Sekunde:|n,Minute:|n,Stunde:|n,Tag:|en,Woche:|n,Monat:|en,Jahr:|en|e",months:"Jan:uar|,Feb:ruar|,M:är|ärz|ar|arz,Apr:il|,Mai,Juni,Juli,Aug:ust|,Sept:ember|,Okt:ober|,Nov:ember|,Dez:ember|",weekdays:"So:nntag|,Mo:ntag|,Di:enstag|,Mi:ttwoch|,Do:nnerstag|,Fr:eitag|,Sa:mstag|",numerals:"null,ein:|e|er|en|em,zwei,drei,vier,fuenf,sechs,sieben,acht,neun,zehn",tokens:"der","short":"{dd}.{MM}.{yyyy}",medium:"{d}. {Month} {yyyy}","long":"{d}. {Month} {yyyy} {time}",full:"{Weekday}, {d}. {Month} {yyyy} {time}",stamp:"{Dow} {d} {Mon} {yyyy} {time}", +time:"{H}:{mm}",past:"{sign} {num} {unit}",future:"{sign} {num} {unit}",duration:"{num} {unit}",timeMarkers:"um",ampm:"am,pm",modifiers:[{name:"day",src:"vorgestern",value:-2},{name:"day",src:"gestern",value:-1},{name:"day",src:"heute",value:0},{name:"day",src:"morgen",value:1},{name:"day",src:"übermorgen|ubermorgen|uebermorgen",value:2},{name:"sign",src:"vor:|her",value:-1},{name:"sign",src:"in",value:1},{name:"shift",src:"letzte:|r|n|s",value:-1},{name:"shift",src:"nächste:|r|n|s+nachste:|r|n|s+naechste:|r|n|s+kommende:n|r",value:1}],parse:["{months} {year?}","{sign} {num} {unit}","{num} {unit} {sign}","{shift} {unit:5-7}"],timeParse:["{shift?} {day|weekday}","{weekday?},? {date}\\.? {months?}\\.? {year?}"],timeFrontParse:["{shift} {weekday}","{weekday?},? {date}\\.? {months?}\\.? {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("es",{plural:!0,units:"milisegundo:|s,segundo:|s,minuto:|s,hora:|s,día|días|dia|dias,semana:|s,mes:|es,año|años|ano|anos",months:"ene:ro|,feb:rero|,mar:zo|,abr:il|,may:o|,jun:io|,jul:io|,ago:sto|,sep:tiembre|,oct:ubre|,nov:iembre|,dic:iembre|",weekdays:"dom:ingo|,lun:es|,mar:tes|,mié:rcoles|+mie:rcoles|,jue:ves|,vie:rnes|,sáb:ado|+sab:ado|",numerals:"cero,uno,dos,tres,cuatro,cinco,seis,siete,ocho,nueve,diez",tokens:"el,la,de","short":"{dd}/{MM}/{yyyy}",medium:"{d} de {Month} de {yyyy}","long":"{d} de {Month} de {yyyy} {time}",full:"{weekday}, {d} de {month} de {yyyy} {time}",stamp:"{dow} {d} {mon} {yyyy} {time}",time:"{H}:{mm}",past:"{sign} {num} {unit}",future:"{sign} {num} {unit}",duration:"{num} {unit}",timeMarkers:"a las",ampm:"am,pm",modifiers:[{name:"day",src:"anteayer",value:-2},{name:"day",src:"ayer",value:-1},{name:"day",src:"hoy",value:0},{name:"day",src:"mañana|manana",value:1},{name:"sign",src:"hace",value:-1},{name:"sign",src:"dentro de",value:1},{name:"shift",src:"pasad:o|a",value:-1},{name:"shift",src:"próximo|próxima|proximo|proxima",value:1}],parse:["{months} {2?} {year?}","{sign} {num} {unit}","{num} {unit} {sign}","{0?}{1?} {unit:5-7} {shift}","{0?}{1?} {shift} {unit:5-7}"],timeParse:["{shift?} {day|weekday} {shift?}","{date} {2?} {months?}\\.? {2?} {year?}"],timeFrontParse:["{shift?} {weekday} {shift?}","{date} {2?} {months?}\\.? {2?} {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("fi",{plural:!0,units:"millisekun:ti|tia|nin|teja|tina,sekun:ti|tia|nin|teja|tina,minuut:ti|tia|in|teja|tina,tun:ti|tia|nin|teja|tina,päiv:ä|ää|än|iä|änä,viik:ko|koa|on|olla|koja|kona,kuukau:si|tta|den+kuussa,vuo:si|tta|den|sia|tena|nna",months:"tammi:kuuta||kuu,helmi:kuuta||kuu,maalis:kuuta||kuu,huhti:kuuta||kuu,touko:kuuta||kuu,kesä:kuuta||kuu,heinä:kuuta||kuu,elo:kuuta||kuu,syys:kuuta||kuu,loka:kuuta||kuu,marras:kuuta||kuu,joulu:kuuta||kuu",weekdays:"su:nnuntai||nnuntaina,ma:anantai||anantaina,ti:istai||istaina,ke:skiviikko||skiviikkona,to:rstai||rstaina,pe:rjantai||rjantaina,la:uantai||uantaina",numerals:"nolla,yksi|ensimmäinen,kaksi|toinen,kolm:e|as,neljä:|s,vii:si|des,kuu:si|des,seitsemä:n|s,kahdeksa:n|s,yhdeksä:n|s,kymmene:n|s","short":"{d}.{M}.{yyyy}",medium:"{d}. {month} {yyyy}","long":"{d}. {month} {yyyy} klo {time}",full:"{weekday} {d}. {month} {yyyy} klo {time}",stamp:"{dow} {d} {mon} {yyyy} {time}",time:"{H}.{mm}",timeMarkers:"klo,kello",ordinalSuffix:".",relative:function(t,e,i,n){function s(i){return t+" "+a[8*i+e]}function r(){return s(1===t?0:1)}var a=this.units;switch(n){case"duration":return r();case"past":return r()+" sitten";case"future":return s(2)+" kuluttua"}},modifiers:[{name:"day",src:"toissa päivänä",value:-2},{name:"day",src:"eilen|eilistä",value:-1},{name:"day",src:"tänään",value:0},{name:"day",src:"huomenna|huomista",value:1},{name:"day",src:"ylihuomenna|ylihuomista",value:2},{name:"sign",src:"sitten|aiemmin",value:-1},{name:"sign",src:"päästä|kuluttua|myöhemmin",value:1},{name:"edge",src:"lopussa",value:2},{name:"edge",src:"ensimmäinen|ensimmäisenä",value:-2},{name:"shift",src:"edel:linen|lisenä",value:-1},{name:"shift",src:"viime",value:-1},{name:"shift",src:"tä:llä|ssä|nä|mä",value:0},{name:"shift",src:"seuraava|seuraavana|tuleva|tulevana|ensi",value:1}],parse:["{months} {year?}","{shift} {unit:5-7}"],timeParse:["{shift?} {day|weekday}","{weekday?},? {date}\\.? {months?}\\.? {year?}"],timeFrontParse:["{shift?} {day|weekday}","{num?} {unit} {sign}","{weekday?},? {date}\\.? {months?}\\.? {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("fr",{plural:!0,units:"milliseconde:|s,seconde:|s,minute:|s,heure:|s,jour:|s,semaine:|s,mois,an:|s|née|nee",months:"janv:ier|,févr:ier|+fevr:ier|,mars,avr:il|,mai,juin,juil:let|,août,sept:embre|,oct:obre|,nov:embre|,déc:embre|+dec:embre|",weekdays:"dim:anche|,lun:di|,mar:di|,mer:credi|,jeu:di|,ven:dredi|,sam:edi|",numerals:"zéro,un:|e,deux,trois,quatre,cinq,six,sept,huit,neuf,dix",tokens:"l'|la|le,er","short":"{dd}/{MM}/{yyyy}",medium:"{d} {month} {yyyy}","long":"{d} {month} {yyyy} {time}",full:"{weekday} {d} {month} {yyyy} {time}",stamp:"{dow} {d} {mon} {yyyy} {time}",time:"{H}:{mm}",past:"{sign} {num} {unit}",future:"{sign} {num} {unit}",duration:"{num} {unit}",timeMarkers:"à",ampm:"am,pm",modifiers:[{name:"day",src:"hier",value:-1},{name:"day",src:"aujourd'hui",value:0},{name:"day",src:"demain",value:1},{name:"sign",src:"il y a",value:-1},{name:"sign",src:"dans|d'ici",value:1},{name:"shift",src:"derni:èr|er|ère|ere",value:-1},{name:"shift",src:"prochain:|e",value:1}],parse:["{months} {year?}","{sign} {num} {unit}","{0?} {unit:5-7} {shift}"],timeParse:["{day|weekday} {shift?}","{weekday?},? {0?} {date}{1?} {months}\\.? {year?}"],timeFrontParse:["{0?} {weekday} {shift}","{weekday?},? {0?} {date}{1?} {months}\\.? {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("it",{plural:!0,units:"millisecond:o|i,second:o|i,minut:o|i,or:a|e,giorn:o|i,settiman:a|e,mes:e|i,ann:o|i",months:"gen:naio|,feb:braio|,mar:zo|,apr:ile|,mag:gio|,giu:gno|,lug:lio|,ago:sto|,set:tembre|,ott:obre|,nov:embre|,dic:embre|",weekdays:"dom:enica|,lun:edì||edi,mar:tedì||tedi,mer:coledì||coledi,gio:vedì||vedi,ven:erdì||erdi,sab:ato|",numerals:"zero,un:|a|o|',due,tre,quattro,cinque,sei,sette,otto,nove,dieci",tokens:"l'|la|il","short":"{dd}/{MM}/{yyyy}",medium:"{d} {month} {yyyy}","long":"{d} {month} {yyyy} {time}",full:"{weekday}, {d} {month} {yyyy} {time}",stamp:"{dow} {d} {mon} {yyyy} {time}",time:"{H}:{mm}",past:"{num} {unit} {sign}",future:"{num} {unit} {sign}",duration:"{num} {unit}",timeMarkers:"alle",ampm:"am,pm",modifiers:[{name:"day",src:"ieri",value:-1},{name:"day",src:"oggi",value:0},{name:"day",src:"domani",value:1},{name:"day",src:"dopodomani",value:2},{name:"sign",src:"fa",value:-1},{name:"sign",src:"da adesso",value:1},{name:"shift",src:"scors:o|a",value:-1},{name:"shift",src:"prossim:o|a",value:1}],parse:["{months} {year?}","{num} {unit} {sign}","{0?} {unit:5-7} {shift}","{0?} {shift} {unit:5-7}"],timeParse:["{shift?} {day|weekday}","{weekday?},? {date} {months?}\\.? {year?}"],timeFrontParse:["{shift?} {day|weekday}","{weekday?},? {date} {months?}\\.? {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("ja",{ampmFront:!0,numeralUnits:!0,allowsFullWidth:!0,timeMarkerOptional:!0,firstDayOfWeek:0,firstDayOfWeekYear:1,units:"ミリ秒,秒,分,時間,日,週間|週,ヶ月|ヵ月|月,年|年度",weekdays:"日:曜日||曜,月:曜日||曜,火:曜日||曜,水:曜日||曜,木:曜日||曜,金:曜日||曜,土:曜日||曜",numerals:"〇,一,二,三,四,五,六,七,八,九",placeholders:"十,百,千,万",timeSuffixes:",秒,分,時,日,,月,年度?","short":"{yyyy}/{MM}/{dd}",medium:"{yyyy}年{M}月{d}日","long":"{yyyy}年{M}月{d}日{time}",full:"{yyyy}年{M}月{d}日{time} {weekday}",stamp:"{yyyy}年{M}月{d}日 {H}:{mm} {dow}",time:"{tt}{h}時{mm}分",past:"{num}{unit}{sign}",future:"{num}{unit}{sign}",duration:"{num}{unit}",ampm:"午前,午後",modifiers:[{name:"day",src:"一昨々日|前々々日",value:-3},{name:"day",src:"一昨日|おととい|前々日",value:-2},{name:"day",src:"昨日|前日",value:-1},{name:"day",src:"今日|当日|本日",value:0},{name:"day",src:"明日|翌日|次日",value:1},{name:"day",src:"明後日|翌々日",value:2},{name:"day",src:"明々後日|翌々々日",value:3},{name:"sign",src:"前",value:-1},{name:"sign",src:"後",value:1},{name:"edge",src:"始|初日|頭",value:-2},{name:"edge",src:"末|尻",value:2},{name:"edge",src:"末日",value:1},{name:"shift",src:"一昨々|前々々",value:-3},{name:"shift",src:"一昨|前々|先々",value:-2},{name:"shift",src:"先|昨|去|前",value:-1},{name:"shift",src:"今|本|当",value:0},{name:"shift",src:"来|明|翌|次",value:1},{name:"shift",src:"明後|翌々|次々|再来|さ来",value:2},{name:"shift",src:"明々後|翌々々",value:3}],parse:["{month}{edge}","{num}{unit}{sign}","{year?}{month}","{year}"],timeParse:["{day|weekday}","{shift}{unit:5}{weekday?}","{shift}{unit:7}{month}{edge}","{shift}{unit:7}{month?}{date?}","{shift}{unit:6}{edge?}{date?}","{year?}{month?}{date}"]})},function(t,e,i){"use strict";var n=i(33);n("ko",{ampmFront:!0,numeralUnits:!0,units:"밀리초,초,분,시간,일,주,개월|달,년|해",weekdays:"일:요일|,월:요일|,화:요일|,수:요일|,목:요일|,금:요일|,토:요일|",numerals:"영|제로,일|한,이,삼,사,오,육,칠,팔,구,십","short":"{yyyy}.{MM}.{dd}",medium:"{yyyy}년 {M}월 {d}일","long":"{yyyy}년 {M}월 {d}일 {time}",full:"{yyyy}년 {M}월 {d}일 {weekday} {time}",stamp:"{yyyy}년 {M}월 {d}일 {H}:{mm} {dow}",time:"{tt} {h}시 {mm}분",past:"{num}{unit} {sign}",future:"{num}{unit} {sign}",duration:"{num}{unit}",timeSuffixes:",초,분,시,일,,월,년",ampm:"오전,오후",modifiers:[{name:"day",src:"그저께",value:-2},{name:"day",src:"어제",value:-1},{name:"day",src:"오늘",value:0},{name:"day",src:"내일",value:1},{name:"day",src:"모레",value:2},{name:"sign",src:"전",value:-1},{name:"sign",src:"후",value:1},{name:"shift",src:"지난|작",value:-1},{name:"shift",src:"이번|올",value:0},{name:"shift",src:"다음|내",value:1}],parse:["{num}{unit} {sign}","{shift?} {unit:5-7}","{year?} {month}","{year}"],timeParse:["{day|weekday}","{shift} {unit:5?} {weekday}","{year?} {month?} {date} {weekday?}"]})},function(t,e,i){"use strict";var n=i(33);n("nl",{plural:!0,units:"milliseconde:|n,seconde:|n,minu:ut|ten,uur,dag:|en,we:ek|ken,maand:|en,jaar",months:"jan:uari|,feb:ruari|,maart|mrt,apr:il|,mei,jun:i|,jul:i|,aug:ustus|,sep:tember|,okt:ober|,nov:ember|,dec:ember|",weekdays:"zondag|zo,maandag|ma,dinsdag|di,woensdag|wo|woe,donderdag|do,vrijdag|vr|vrij,zaterdag|za",numerals:"nul,een,twee,drie,vier,vijf,zes,zeven,acht,negen,tien","short":"{dd}-{MM}-{yyyy}",medium:"{d} {month} {yyyy}","long":"{d} {Month} {yyyy} {time}",full:"{weekday} {d} {Month} {yyyy} {time}",stamp:"{dow} {d} {Mon} {yyyy} {time}",time:"{H}:{mm}",past:"{num} {unit} {sign}",future:"{num} {unit} {sign}",duration:"{num} {unit}",timeMarkers:"'s,om",modifiers:[{name:"day",src:"gisteren",value:-1},{name:"day",src:"vandaag",value:0},{name:"day",src:"morgen",value:1},{name:"day",src:"overmorgen",value:2},{name:"sign",src:"geleden",value:-1},{name:"sign",src:"vanaf nu",value:1},{name:"shift",src:"laatste|vorige|afgelopen",value:-1},{name:"shift",src:"volgend:|e",value:1}],parse:["{months} {year?}","{num} {unit} {sign}","{0?} {unit:5-7} {shift}","{0?} {shift} {unit:5-7}"],timeParse:["{shift?} {day|weekday}","{weekday?},? {date} {months?}\\.? {year?}"],timeFrontParse:["{shift?} {day|weekday}","{weekday?},? {date} {months?}\\.? {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("no",{plural:!0,units:"millisekund:|er,sekund:|er,minutt:|er,tim:e|er,dag:|er,uk:e|er|en,måned:|er|en+maaned:|er|en,år:||et+aar:||et",months:"januar,februar,mars,april,mai,juni,juli,august,september,oktober,november,desember",weekdays:"søndag|sondag,mandag,tirsdag,onsdag,torsdag,fredag,lørdag|lordag",numerals:"en|et,to,tre,fire,fem,seks,sju|syv,åtte,ni,ti",tokens:"den,for",articles:"den","short":"d. {d}. {month} {yyyy}","long":"den {d}. {month} {yyyy} {H}:{mm}",full:"{Weekday} den {d}. {month} {yyyy} {H}:{mm}:{ss}",past:"{num} {unit} {sign}",future:"{sign} {num} {unit}",duration:"{num} {unit}",ampm:"am,pm",modifiers:[{name:"day",src:"forgårs|i forgårs|forgaars|i forgaars",value:-2},{name:"day",src:"i går|igår|i gaar|igaar",value:-1},{name:"day",src:"i dag|idag",value:0},{name:"day",src:"i morgen|imorgen",value:1},{name:"day",src:"overimorgen|overmorgen|over i morgen",value:2},{name:"sign",src:"siden",value:-1},{name:"sign",src:"om",value:1},{name:"shift",src:"i siste|siste",value:-1},{name:"shift",src:"denne",value:0},{name:"shift",src:"neste",value:1}],parse:["{num} {unit} {sign}","{sign} {num} {unit}","{1?} {num} {unit} {sign}","{shift} {unit:5-7}"],timeParse:["{date} {month}","{shift} {weekday}","{0?} {weekday?},? {date?} {month}\\.? {year}"]})},function(t,e,i){"use strict";var n=i(33);n("pl",{plural:!0,units:"milisekund:a|y|,sekund:a|y|,minut:a|y|,godzin:a|y|,dzień|dni|dni,tydzień|tygodnie|tygodni,miesiąc|miesiące|miesięcy,rok|lata|lat",months:"sty:cznia||czeń,lut:ego||y,mar:ca||zec,kwi:etnia||ecień,maj:a|,cze:rwca||rwiec,lip:ca||iec,sie:rpnia||rpień,wrz:eśnia||esień,paź:dziernika||dziernik,lis:topada||topad,gru:dnia||dzień",weekdays:"nie:dziela||dzielę,pon:iedziałek|,wt:orek|,śr:oda||odę,czw:artek|,piątek|pt,sobota|sb|sobotę",numerals:"zero,jeden|jedną,dwa|dwie,trzy,cztery,pięć,sześć,siedem,osiem,dziewięć,dziesięć",tokens:"w|we,roku","short":"{dd}.{MM}.{yyyy}",medium:"{d} {month} {yyyy}","long":"{d} {month} {yyyy} {time}",full:"{weekday}, {d} {month} {yyyy} {time}",stamp:"{dow} {d} {mon} {yyyy} {time}",time:"{H}:{mm}",timeMarkers:"o",ampm:"am,pm",modifiers:[{name:"day",src:"przedwczoraj",value:-2},{name:"day",src:"wczoraj",value:-1},{name:"day",src:"dzisiaj|dziś",value:0},{name:"day",src:"jutro",value:1},{name:"day",src:"pojutrze",value:2},{name:"sign",src:"temu|przed",value:-1},{name:"sign",src:"za",value:1},{name:"shift",src:"zeszły|zeszła|ostatni|ostatnia",value:-1},{name:"shift",src:"następny|następna|następnego|przyszły|przyszła|przyszłego",value:1}],relative:function(t,e,i,n){var s=4;if(e===s){if(1===t&&"past"===n)return"wczoraj";if(1===t&&"future"===n)return"jutro";if(2===t&&"past"===n)return"przedwczoraj";if(2===t&&"future"===n)return"pojutrze"}var r,a=+t.toFixed(0).slice(-1),o=+t.toFixed(0).slice(-2);switch(!0){case 1===t:r=0;break;case o>=12&&o<=14:r=2;break;case a>=2&&a<=4:r=1;break;default:r=2}var l=this.units[8*r+e],u=t+" ";switch("past"!==n&&"future"!==n||1!==t||(l=l.replace(/a$/,"ę")),l=u+l,n){case"duration":return l;case"past":return l+" temu";case"future":return"za "+l}},parse:["{num} {unit} {sign}","{sign} {num} {unit}","{months} {year?}","{shift} {unit:5-7}","{0} {shift?} {weekday}"],timeFrontParse:["{day|weekday}","{date} {months} {year?} {1?}","{0?} {shift?} {weekday}"]})},function(t,e,i){"use strict";var n=i(33);n("pt",{plural:!0,units:"milisegundo:|s,segundo:|s,minuto:|s,hora:|s,dia:|s,semana:|s,mês|mêses|mes|meses,ano:|s",months:"jan:eiro|,fev:ereiro|,mar:ço|,abr:il|,mai:o|,jun:ho|,jul:ho|,ago:sto|,set:embro|,out:ubro|,nov:embro|,dez:embro|",weekdays:"dom:ingo|,seg:unda-feira|,ter:ça-feira|,qua:rta-feira|,qui:nta-feira|,sex:ta-feira|,sáb:ado||ado",numerals:"zero,um:|a,dois|duas,três|tres,quatro,cinco,seis,sete,oito,nove,dez",tokens:"a,de","short":"{dd}/{MM}/{yyyy}",medium:"{d} de {Month} de {yyyy}","long":"{d} de {Month} de {yyyy} {time}",full:"{Weekday}, {d} de {Month} de {yyyy} {time}",stamp:"{Dow} {d} {Mon} {yyyy} {time}",time:"{H}:{mm}",past:"{num} {unit} {sign}",future:"{sign} {num} {unit}",duration:"{num} {unit}",timeMarkers:"às",ampm:"am,pm",modifiers:[{name:"day",src:"anteontem",value:-2},{name:"day",src:"ontem",value:-1},{name:"day",src:"hoje",value:0},{name:"day",src:"amanh:ã|a",value:1},{name:"sign",src:"atrás|atras|há|ha",value:-1},{name:"sign",src:"daqui a",value:1},{name:"shift",src:"passad:o|a",value:-1},{name:"shift",src:"próximo|próxima|proximo|proxima",value:1}],parse:["{months} {1?} {year?}","{num} {unit} {sign}","{sign} {num} {unit}","{0?} {unit:5-7} {shift}","{0?} {shift} {unit:5-7}"],timeParse:["{shift?} {day|weekday}","{0?} {shift} {weekday}","{date} {1?} {months?} {1?} {year?}"],timeFrontParse:["{shift?} {day|weekday}","{date} {1?} {months?} {1?} {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("ru",{firstDayOfWeekYear:1,units:"миллисекунд:а|у|ы|,секунд:а|у|ы|,минут:а|у|ы|,час:||а|ов,день|день|дня|дней,недел:я|ю|и|ь|е,месяц:||а|ев|е,год|год|года|лет|году",months:"янв:аря||.|арь,фев:раля||р.|раль,мар:та||т,апр:еля||.|ель,мая|май,июн:я||ь,июл:я||ь,авг:уста||.|уст,сен:тября||т.|тябрь,окт:ября||.|ябрь,ноя:бря||брь,дек:абря||.|абрь",weekdays:"воскресенье|вс,понедельник|пн,вторник|вт,среда|ср,четверг|чт,пятница|пт,суббота|сб",numerals:"ноль,од:ин|ну,дв:а|е,три,четыре,пять,шесть,семь,восемь,девять,десять",tokens:"в|на,г\\.?(?:ода)?","short":"{dd}.{MM}.{yyyy}",medium:"{d} {month} {yyyy} г.","long":"{d} {month} {yyyy} г., {time}",full:"{weekday}, {d} {month} {yyyy} г., {time}",stamp:"{dow} {d} {mon} {yyyy} {time}",time:"{H}:{mm}",timeMarkers:"в",ampm:" утра, вечера",modifiers:[{name:"day",src:"позавчера",value:-2},{name:"day",src:"вчера",value:-1},{name:"day",src:"сегодня",value:0},{name:"day",src:"завтра",value:1},{name:"day",src:"послезавтра",value:2},{name:"sign",src:"назад",value:-1},{name:"sign",src:"через",value:1},{name:"shift",src:"прошл:ый|ой|ом",value:-1},{name:"shift",src:"следующ:ий|ей|ем",value:1}],relative:function(t,e,i,n){var s,r,a=t.toString().slice(-1);switch(!0){case t>=11&&t<=15:r=3;break;case 1==a:r=1;break;case a>=2&&a<=4:r=2;break;default:r=3}switch(s=t+" "+this.units[8*r+e],n){case"duration":return s;case"past":return s+" назад";case"future":return"через "+s}},parse:["{num} {unit} {sign}","{sign} {num} {unit}","{months} {year?}","{0?} {shift} {unit:5-7}"],timeParse:["{day|weekday}","{0?} {shift} {weekday}","{date} {months?} {year?} {1?}"],timeFrontParse:["{0?} {shift} {weekday}","{date} {months?} {year?} {1?}"]})},function(t,e,i){"use strict";var n=i(33);n("sv",{plural:!0,units:"millisekund:|er,sekund:|er,minut:|er,timm:e|ar,dag:|ar,veck:a|or|an,månad:|er|en+manad:|er|en,år:||et+ar:||et",months:"jan:uari|,feb:ruari|,mar:s|,apr:il|,maj,jun:i|,jul:i|,aug:usti|,sep:tember|,okt:ober|,nov:ember|,dec:ember|",weekdays:"sön:dag|+son:dag|,mån:dag||dagen+man:dag||dagen,tis:dag|,ons:dag|,tor:sdag|,fre:dag|,lör:dag||dag",numerals:"noll,en|ett,två|tva,tre,fyra,fem,sex,sju,åtta|atta,nio,tio",tokens:"den,för|for",articles:"den","short":"{yyyy}-{MM}-{dd}",medium:"{d} {month} {yyyy}","long":"{d} {month} {yyyy} {time}",full:"{weekday} {d} {month} {yyyy} {time}",stamp:"{dow} {d} {mon} {yyyy} {time}",time:"{H}:{mm}",past:"{num} {unit} {sign}",future:"{sign} {num} {unit}",duration:"{num} {unit}",ampm:"am,pm",modifiers:[{name:"day",src:"förrgår|i förrgår|iförrgår|forrgar|i forrgar|iforrgar",value:-2},{name:"day",src:"går|i går|igår|gar|i gar|igar",value:-1},{name:"day",src:"dag|i dag|idag",value:0},{name:"day",src:"morgon|i morgon|imorgon",value:1},{name:"day",src:"över morgon|övermorgon|i över morgon|i övermorgon|iövermorgon|over morgon|overmorgon|i over morgon|i overmorgon|iovermorgon",value:2},{name:"sign",src:"sedan|sen",value:-1},{name:"sign",src:"om",value:1},{name:"shift",src:"i förra|förra|i forra|forra",value:-1},{name:"shift",src:"denna",value:0},{name:"shift",src:"nästa|nasta",value:1}],parse:["{months} {year?}","{num} {unit} {sign}","{sign} {num} {unit}","{1?} {num} {unit} {sign}","{shift} {unit:5-7}"],timeParse:["{day|weekday}","{shift} {weekday}","{0?} {weekday?},? {date} {months?}\\.? {year?}"],timeFrontParse:["{day|weekday}","{shift} {weekday}","{0?} {weekday?},? {date} {months?}\\.? {year?}"]})},function(t,e,i){"use strict";var n=i(33);n("zh-CN",{ampmFront:!0,numeralUnits:!0,allowsFullWidth:!0,timeMarkerOptional:!0,units:"毫秒,秒钟,分钟,小时,天,个星期|周,个月,年",weekdays:"星期日|日|周日|星期天,星期一|一|周一,星期二|二|周二,星期三|三|周三,星期四|四|周四,星期五|五|周五,星期六|六|周六",numerals:"〇,一,二,三,四,五,六,七,八,九",placeholders:"十,百,千,万","short":"{yyyy}-{MM}-{dd}",medium:"{yyyy}年{M}月{d}日","long":"{yyyy}年{M}月{d}日{time}",full:"{yyyy}年{M}月{d}日{weekday}{time}",stamp:"{yyyy}年{M}月{d}日{H}:{mm}{dow}",time:"{tt}{h}点{mm}分",past:"{num}{unit}{sign}",future:"{num}{unit}{sign}",duration:"{num}{unit}",timeSuffixes:",秒,分钟?,点|时,日|号,,月,年",ampm:"上午,下午",modifiers:[{name:"day",src:"大前天",value:-3},{name:"day",src:"前天",value:-2},{name:"day",src:"昨天",value:-1},{name:"day",src:"今天",value:0},{name:"day",src:"明天",value:1},{name:"day",src:"后天",value:2},{name:"day",src:"大后天",value:3},{name:"sign",src:"前",value:-1},{name:"sign",src:"后",value:1},{name:"shift",src:"上|去",value:-1},{name:"shift",src:"这",value:0},{name:"shift",src:"下|明",value:1}],parse:["{num}{unit}{sign}","{shift}{unit:5-7}","{year?}{month}","{year}"],timeParse:["{day|weekday}","{shift}{weekday}","{year?}{month?}{date}"]})},function(t,e,i){"use strict";var n=i(33);n("zh-TW",{ampmFront:!0,numeralUnits:!0,allowsFullWidth:!0,timeMarkerOptional:!0,units:"毫秒,秒鐘,分鐘,小時,天,個星期|週,個月,年",weekdays:"星期日|日|週日|星期天,星期一|一|週一,星期二|二|週二,星期三|三|週三,星期四|四|週四,星期五|五|週五,星期六|六|週六",numerals:"〇,一,二,三,四,五,六,七,八,九",placeholders:"十,百,千,万","short":"{yyyy}/{MM}/{dd}",medium:"{yyyy}年{M}月{d}日","long":"{yyyy}年{M}月{d}日{time}",full:"{yyyy}年{M}月{d}日{weekday}{time}",stamp:"{yyyy}年{M}月{d}日{H}:{mm}{dow}",time:"{tt}{h}點{mm}分",past:"{num}{unit}{sign}",future:"{num}{unit}{sign}",duration:"{num}{unit}",timeSuffixes:",秒,分鐘?,點|時,日|號,,月,年",ampm:"上午,下午",modifiers:[{name:"day",src:"大前天",value:-3},{name:"day",src:"前天",value:-2},{name:"day",src:"昨天",value:-1},{name:"day",src:"今天",value:0},{name:"day",src:"明天",value:1},{name:"day",src:"後天",value:2},{name:"day",src:"大後天",value:3},{name:"sign",src:"前",value:-1},{name:"sign",src:"後",value:1},{name:"shift",src:"上|去",value:-1},{name:"shift",src:"這",value:0},{name:"shift",src:"下|明",value:1}],parse:["{num}{unit}{sign}","{shift}{unit:5-7}","{year?}{month}","{year}"],timeParse:["{day|weekday}","{shift}{weekday}","{year?}{month?}{date}"]})}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 27222914..d9f8fdc9 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,2822 +1,8 @@ -webpackJsonp([1],{ +/** + * tablefilter v0.4.0 by Max Guglielmi + * build date: 2016-10-22T08:31:21.770Z + * MIT License + */ -/***/ 435: -/***/ function(module, exports, __webpack_require__) { - - var map = { - "./array": 16, - "./array.js": 16, - "./const": 11, - "./const.js": 11, - "./cookie": 29, - "./cookie.js": 29, - "./dom": 3, - "./dom.js": 3, - "./emitter": 8, - "./emitter.js": 8, - "./event": 1, - "./event.js": 1, - "./extensions/advancedGrid/adapterEzEditTable": 436, - "./extensions/advancedGrid/adapterEzEditTable.js": 436, - "./extensions/advancedGrid/advancedGrid": 437, - "./extensions/advancedGrid/advancedGrid.js": 437, - "./extensions/colOps/colOps": 438, - "./extensions/colOps/colOps.js": 438, - "./extensions/colsVisibility/colsVisibility": 439, - "./extensions/colsVisibility/colsVisibility.js": 439, - "./extensions/filtersVisibility/filtersVisibility": 440, - "./extensions/filtersVisibility/filtersVisibility.js": 440, - "./extensions/sort/adapterSortabletable": 441, - "./extensions/sort/adapterSortabletable.js": 441, - "./extensions/sort/sort": 442, - "./extensions/sort/sort.js": 442, - "./feature": 10, - "./feature.js": 10, - "./modules/alternateRows": 24, - "./modules/alternateRows.js": 24, - "./modules/checkList": 18, - "./modules/checkList.js": 18, - "./modules/clearButton": 22, - "./modules/clearButton.js": 22, - "./modules/dateType": 30, - "./modules/dateType.js": 30, - "./modules/dropdown": 15, - "./modules/dropdown.js": 15, - "./modules/gridLayout": 9, - "./modules/gridLayout.js": 9, - "./modules/hash": 27, - "./modules/hash.js": 27, - "./modules/help": 23, - "./modules/help.js": 23, - "./modules/highlightKeywords": 13, - "./modules/highlightKeywords.js": 13, - "./modules/loader": 12, - "./modules/loader.js": 12, - "./modules/noResults": 25, - "./modules/noResults.js": 25, - "./modules/paging": 21, - "./modules/paging.js": 21, - "./modules/popupFilter": 14, - "./modules/popupFilter.js": 14, - "./modules/rowsCounter": 19, - "./modules/rowsCounter.js": 19, - "./modules/state": 26, - "./modules/state.js": 26, - "./modules/statusBar": 20, - "./modules/statusBar.js": 20, - "./modules/storage": 28, - "./modules/storage.js": 28, - "./number": 7, - "./number.js": 7, - "./root": 2, - "./root.js": 2, - "./sort": 17, - "./sort.js": 17, - "./string": 5, - "./string.js": 5, - "./types": 4, - "./types.js": 4 - }; - function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); - }; - function webpackContextResolve(req) { - return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); - }; - webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); - }; - webpackContext.resolve = webpackContextResolve; - module.exports = webpackContext; - webpackContext.id = 435; - - -/***/ }, - -/***/ 436: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _const = __webpack_require__(11); - - var _root = __webpack_require__(2); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var INSTANTIATION_ERROR = 'Failed to instantiate EditTable object.\n \n"ezEditTable" dependency not found.'; - - /** - * Adapter module for ezEditTable, an external library providing advanced - * grid features (selection and edition): - * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus - */ - - var AdapterEzEditTable = function (_Feature) { - _inherits(AdapterEzEditTable, _Feature); - - /** - * Creates an instance of AdapterEzEditTable - * - * @param {TableFilter} tf TableFilter instance - * @param {Object} cfg Configuration options for ezEditTable library - */ - function AdapterEzEditTable(tf, cfg) { - _classCallCheck(this, AdapterEzEditTable); - - /** - * Module description - * @type {String} - */ - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, cfg.name)); - - _this.desc = cfg.description || 'ezEditTable adapter'; - - /** - * Filename of ezEditTable library - * @type {String} - */ - _this.filename = cfg.filename || 'ezEditTable.js'; - - /** - * Path to ezEditTable library - * @type {String} - */ - _this.vendorPath = cfg.vendor_path; - - /** - * Load ezEditTable stylesheet - * @type {Boolean} - */ - _this.loadStylesheet = Boolean(cfg.load_stylesheet); - - /** - * Path to ezEditTable stylesheet - * @type {String} - */ - _this.stylesheet = cfg.stylesheet || _this.vendorPath + 'ezEditTable.css'; - - /** - * Name of ezEditTable stylesheet - * @type {String} - */ - _this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; - - // Enable the ezEditTable's scroll into view behaviour if grid layout on - cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; - - /** - * ezEditTable instance - * @type {EditTable} - * @private - */ - _this._ezEditTable = null; - - /** - * ezEditTable configuration - * @private - */ - _this.cfg = cfg; - - _this.enable(); - return _this; - } - - /** - * Conditionally load ezEditTable library and set advanced grid - */ - - - AdapterEzEditTable.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - var tf = this.tf; - if (_root.root.EditTable) { - this._setAdvancedGrid(); - } else { - var path = this.vendorPath + this.filename; - tf.import(this.filename, path, function () { - return _this2._setAdvancedGrid(); - }); - } - if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { - tf.import(this.stylesheetName, this.stylesheet, null, 'link'); - } - - // TODO: hack to prevent ezEditTable enter key event hijaking. - // Needs to be fixed in the vendor's library - this.emitter.on(['filter-focus', 'filter-blur'], function () { - return _this2._toggleForInputFilter(); - }); - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Instantiate ezEditTable component for advanced grid features - * @private - */ - - - AdapterEzEditTable.prototype._setAdvancedGrid = function _setAdvancedGrid() { - var tf = this.tf; - - //start row for EditTable constructor needs to be calculated - var startRow = void 0, - cfg = this.cfg, - thead = (0, _dom.tag)(tf.tbl, 'thead'); - - //if thead exists and startRow not specified, startRow is calculated - //automatically by EditTable - if (thead.length > 0 && !cfg.startRow) { - startRow = undefined; - } - //otherwise startRow config property if any or TableFilter refRow - else { - startRow = cfg.startRow || tf.refRow; - } - - cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; - var editable = cfg.editable; - var selectable = cfg.selection; - - if (selectable) { - cfg.default_selection = cfg.default_selection || 'row'; - } - //CSS Styles - cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; - - var _lastValidRowIndex = 0; - var _lastRowIndex = 0; - - if (selectable) { - (function () { - //Row navigation needs to be calculated according to TableFilter's - //validRowsIndex array - var onAfterSelection = function onAfterSelection(et, selectedElm, e) { - var slc = et.Selection; - //Next valid filtered row needs to be selected - var doSelect = function doSelect(nextRowIndex) { - if (et.defaultSelection === 'row') { - /* eslint-disable */ - slc.SelectRowByIndex(nextRowIndex); - /* eslint-enable */ - } else { - /* eslint-disable */ - et.ClearSelections(); - /* eslint-enable */ - var cellIndex = selectedElm.cellIndex, - _row = tf.tbl.rows[nextRowIndex]; - if (et.defaultSelection === 'both') { - /* eslint-disable */ - slc.SelectRowByIndex(nextRowIndex); - /* eslint-enable */ - } - if (_row) { - /* eslint-disable */ - slc.SelectCell(_row.cells[cellIndex]); - /* eslint-enable */ - } - } - //Table is filtered - if (tf.validRowsIndex.length !== tf.getRowsNb()) { - var r = tf.tbl.rows[nextRowIndex]; - if (r) { - r.scrollIntoView(false); - } - if (cell) { - if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { - tf.tblCont.scrollLeft = 100000000; - } else if (cell.cellIndex === 0 && tf.gridLayout) { - tf.tblCont.scrollLeft = 0; - } else { - cell.scrollIntoView(false); - } - } - } - }; - - //table is not filtered - if (!tf.validRowsIndex) { - return; - } - var validIndexes = tf.validRowsIndex, - validIdxLen = validIndexes.length, - row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm, - - //cell for default_selection = 'both' or 'cell' - cell = selectedElm.nodeName === 'TD' ? selectedElm : null, - - /* eslint-disable */ - keyCode = e !== undefined ? et.Event.GetKey(e) : 0, - - /* eslint-enable */ - isRowValid = validIndexes.indexOf(row.rowIndex) !== -1, - nextRowIndex = void 0, - paging = tf.feature('paging'), - - //pgup/pgdown keys - d = keyCode === 34 || keyCode === 33 ? paging && paging.pagingLength || et.nbRowsPerPage : 1; - - //If next row is not valid, next valid filtered row needs to be - //calculated - if (!isRowValid) { - //Selection direction up/down - if (row.rowIndex > _lastRowIndex) { - //last row - if (row.rowIndex >= validIndexes[validIdxLen - 1]) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - var calcRowIndex = _lastValidRowIndex + d; - if (calcRowIndex > validIdxLen - 1) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - nextRowIndex = validIndexes[calcRowIndex]; - } - } - } else { - //first row - if (row.rowIndex <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - var v = validIndexes[_lastValidRowIndex - d]; - nextRowIndex = v ? v : validIndexes[0]; - } - } - _lastRowIndex = row.rowIndex; - doSelect(nextRowIndex); - } else { - //If filtered row is valid, special calculation for - //pgup/pgdown keys - if (keyCode !== 34 && keyCode !== 33) { - _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); - _lastRowIndex = row.rowIndex; - } else { - if (keyCode === 34) { - //pgdown - //last row - if (_lastValidRowIndex + d <= validIdxLen - 1) { - nextRowIndex = validIndexes[_lastValidRowIndex + d]; - } else { - nextRowIndex = [validIdxLen - 1]; - } - } else { - //pgup - //first row - if (_lastValidRowIndex - d <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - nextRowIndex = validIndexes[_lastValidRowIndex - d]; - } - } - _lastRowIndex = nextRowIndex; - _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); - doSelect(nextRowIndex); - } - } - }; - - //Page navigation has to be enforced whenever selected row is out of - //the current page range - var onBeforeSelection = function onBeforeSelection(et, selectedElm) { - var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; - if (tf.paging) { - if (tf.feature('paging').nbPages > 1) { - var paging = tf.feature('paging'); - //page length is re-assigned in case it has changed - et.nbRowsPerPage = paging.pagingLength; - var validIndexes = tf.validRowsIndex, - validIdxLen = validIndexes.length, - pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); - var rowIndex = row.rowIndex; - - if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { - paging.setPage('last'); - } else if (rowIndex === validIndexes[0] && paging.currentPageNb !== 1) { - paging.setPage('first'); - } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { - paging.setPage('next'); - } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { - paging.setPage('previous'); - } - } - } - }; - - //Selected row needs to be visible when paging is activated - if (tf.paging) { - tf.feature('paging').onAfterChangePage = function (paging) { - var advGrid = paging.tf.extension('advancedGrid'); - var et = advGrid._ezEditTable; - var slc = et.Selection; - /* eslint-disable */ - var row = slc.GetActiveRow(); - /* eslint-enable */ - if (row) { - row.scrollIntoView(false); - } - /* eslint-disable */ - var cell = slc.GetActiveCell(); - /* eslint-enable */ - if (cell) { - cell.scrollIntoView(false); - } - }; - } - - //Rows navigation when rows are filtered is performed with the - //EditTable row selection callback events - if (cfg.default_selection === 'row') { - (function () { - var fnB = cfg.on_before_selected_row; - cfg.on_before_selected_row = function () { - onBeforeSelection(arguments[0], arguments[1], arguments[2]); - if (fnB) { - fnB.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - var fnA = cfg.on_after_selected_row; - cfg.on_after_selected_row = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnA) { - fnA.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - })(); - } else { - (function () { - var fnD = cfg.on_before_selected_cell; - cfg.on_before_selected_cell = function () { - onBeforeSelection(arguments[0], arguments[1], arguments[2]); - if (fnD) { - fnD.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - var fnC = cfg.on_after_selected_cell; - cfg.on_after_selected_cell = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnC) { - fnC.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - })(); - } - })(); - } - if (editable) { - (function () { - //Added or removed rows, TF rows number needs to be re-calculated - var fnE = cfg.on_added_dom_row; - cfg.on_added_dom_row = function () { - tf.nbFilterableRows++; - if (!tf.paging) { - tf.emitter.emit('rows-changed', tf, this); - } else { - tf.nbFilterableRows++; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnE) { - fnE.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - if (cfg.actions && cfg.actions['delete']) { - (function () { - var fnF = cfg.actions['delete'].on_after_submit; - cfg.actions['delete'].on_after_submit = function () { - tf.nbFilterableRows--; - if (!tf.paging) { - tf.emitter.emit('rows-changed', tf, this); - } else { - tf.nbFilterableRows--; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(false); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnF) { - fnF.call(null, arguments[0], arguments[1]); - } - }; - })(); - } - })(); - } - - try { - /* eslint-disable */ - this._ezEditTable = new EditTable(tf.id, cfg, startRow); - this._ezEditTable.Init(); - /* eslint-enable */ - } catch (e) { - throw new Error(INSTANTIATION_ERROR); - } - - this.initialized = true; - }; - - /** - * Reset advanced grid when previously removed - */ - - - AdapterEzEditTable.prototype.reset = function reset() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - /* eslint-disable */ - ezEditTable.Selection.Set(); - /* eslint-enable */ - } - if (this.cfg.editable) { - /* eslint-disable */ - ezEditTable.Editable.Set(); - /* eslint-enable */ - } - } - }; - - /** - * Toggle behaviour - */ - - - AdapterEzEditTable.prototype.toggle = function toggle() { - var ezEditTable = this._ezEditTable; - if (ezEditTable.editable) { - /* eslint-disable */ - ezEditTable.Editable.Remove(); - /* eslint-enable */ - } else { - /* eslint-disable */ - ezEditTable.Editable.Set(); - /* eslint-enable */ - } - if (ezEditTable.selection) { - /* eslint-disable */ - ezEditTable.Selection.Remove(); - /* eslint-enable */ - } else { - /* eslint-disable */ - ezEditTable.Selection.Set(); - /* eslint-enable */ - } - }; - - AdapterEzEditTable.prototype._toggleForInputFilter = function _toggleForInputFilter() { - var tf = this.tf; - if (!tf.getActiveFilterId()) { - return; - } - var colIndex = tf.getColumnIndexFromFilterId(tf.getActiveFilterId()); - var filterType = tf.getFilterType(colIndex); - if (filterType === _const.INPUT) { - this.toggle(); - } - }; - - /** - * Remove advanced grid - */ - - - AdapterEzEditTable.prototype.destroy = function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - /* eslint-disable */ - ezEditTable.Selection.ClearSelections(); - ezEditTable.Selection.Remove(); - /* eslint-enable */ - } - if (this.cfg.editable) { - /* eslint-disable */ - ezEditTable.Editable.Remove(); - /* eslint-enable */ - } - } - - this.emitter.off(['filter-focus', 'filter-blur'], function () { - return _this3._toggleForInputFilter(); - }); - this.initialized = false; - }; - - return AdapterEzEditTable; - }(_feature.Feature); - - exports.default = AdapterEzEditTable; - -/***/ }, - -/***/ 437: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterEzEditTable = __webpack_require__(436); - - var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _adapterEzEditTable2.default; - -/***/ }, - -/***/ 438: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _types = __webpack_require__(4); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Column calculations extension - */ - var ColOps = function (_Feature) { - _inherits(ColOps, _Feature); - - /** - * Creates an instance of ColOps - * - * @param {TableFilter} tf TableFilter instance - * @param {Object} opts Configuration object - */ - function ColOps(tf, opts) { - _classCallCheck(this, ColOps); - - /** - * Callback fired before columns operations start - * @type {Function} - */ - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, opts.name)); - - _this.onBeforeOperation = (0, _types.isFn)(opts.on_before_operation) ? opts.on_before_operation : null; - - /** - * Callback fired after columns operations are completed - * @type {Function} - */ - _this.onAfterOperation = (0, _types.isFn)(opts.on_after_operation) ? opts.on_after_operation : null; - - /** - * Configuration options - * @type {Object} - */ - _this.opts = opts; - - _this.enable(); - return _this; - } - - /** - * Initializes ColOps instance - */ - - - ColOps.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - // subscribe to events - this.emitter.on(['after-filtering'], function () { - return _this2.calc(); - }); - - this.calc(); - - /** - * @inherited - */ - this.initialized = true; - }; - - /** - * Calculates columns' values - * Configuration options are stored in 'opts' property - * - 'id' contains ids of elements showing result (array) - * - 'col' contains the columns' indexes (array) - * - 'operation' contains operation type (array, values: 'sum', 'mean', - * 'min', 'max', 'median', 'q1', 'q3') - * - 'write_method' array defines which method to use for displaying the - * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' - * - 'tot_row_index' defines in which row results are displayed - * (integers array) - * - * - changes made by Nuovella: - * (1) optimized the routine (now it will only process each column once), - * (2) added calculations for the median, lower and upper quartile. - */ - - - ColOps.prototype.calc = function calc() { - var tf = this.tf; - if (!tf.isInitialized()) { - return; - } - - if (this.onBeforeOperation) { - this.onBeforeOperation.call(null, tf, this); - } - this.emitter.emit('before-column-operation', tf, this); - - var opts = this.opts, - labelId = opts.id, - colIndex = opts.col, - operation = opts.operation, - outputType = opts.write_method, - totRowIndex = opts.tot_row_index, - excludeRow = opts.exclude_row, - decimalPrecision = (0, _types.isUndef)(opts.decimal_precision) ? 2 : opts.decimal_precision; - - //nuovella: determine unique list of columns to operate on - var ucolIndex = [], - ucolMax = 0; - ucolIndex[ucolMax] = colIndex[0]; - - for (var ii = 1; ii < colIndex.length; ii++) { - var saved = 0; - //see if colIndex[ii] is already in the list of unique indexes - for (var jj = 0; jj <= ucolMax; jj++) { - if (ucolIndex[jj] === colIndex[ii]) { - saved = 1; - } - } - //if not saved then, save the index; - if (saved === 0) { - ucolMax++; - ucolIndex[ucolMax] = colIndex[ii]; - } - } - - if ((0, _types.isArray)(labelId) && (0, _types.isArray)(colIndex) && (0, _types.isArray)(operation)) { - var rows = tf.tbl.rows, - colvalues = [], - ucol = 0; - - for (; ucol <= ucolMax; ucol++) { - //this retrieves col values - //use ucolIndex because we only want to pass through this loop - //once for each column get the values in this unique column - colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); - - //next: calculate all operations for this column - var result = void 0, - nbvalues = 0, - temp = void 0, - meanValue = 0, - sumValue = 0, - minValue = null, - maxValue = null, - q1Value = null, - medValue = null, - q3Value = null, - meanFlag = 0, - sumFlag = 0, - minFlag = 0, - maxFlag = 0, - q1Flag = 0, - medFlag = 0, - q3Flag = 0, - theList = [], - opsThisCol = [], - decThisCol = [], - labThisCol = [], - oTypeThisCol = [], - mThisCol = -1, - k = 0, - j = 0, - i = 0; - - for (; k < colIndex.length; k++) { - if (colIndex[k] === ucolIndex[ucol]) { - mThisCol++; - opsThisCol[mThisCol] = operation[k].toLowerCase(); - decThisCol[mThisCol] = decimalPrecision[k]; - labThisCol[mThisCol] = labelId[k]; - oTypeThisCol = (0, _types.isArray)(outputType) ? outputType[k] : null; - - switch (opsThisCol[mThisCol]) { - case 'mean': - meanFlag = 1; - break; - case 'sum': - sumFlag = 1; - break; - case 'min': - minFlag = 1; - break; - case 'max': - maxFlag = 1; - break; - case 'median': - medFlag = 1; - break; - case 'q1': - q1Flag = 1; - break; - case 'q3': - q3Flag = 1; - break; - } - } - } - - for (; j < colvalues[ucol].length; j++) { - //sort the list for calculation of median and quartiles - if (q1Flag === 1 || q3Flag === 1 || medFlag === 1) { - if (j < colvalues[ucol].length - 1) { - for (k = j + 1; k < colvalues[ucol].length; k++) { - /* eslint-disable */ - if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { - /* eslint-enable */ - temp = colvalues[ucol][j]; - colvalues[ucol][j] = colvalues[ucol][k]; - colvalues[ucol][k] = temp; - } - } - } - } - var cvalue = parseFloat(colvalues[ucol][j]); - theList[j] = parseFloat(cvalue); - - if (!isNaN(cvalue)) { - nbvalues++; - if (sumFlag === 1 || meanFlag === 1) { - sumValue += parseFloat(cvalue); - } - if (minFlag === 1) { - if (minValue === null) { - minValue = parseFloat(cvalue); - } else { - minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; - } - } - if (maxFlag === 1) { - if (maxValue === null) { - maxValue = parseFloat(cvalue); - } else { - maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; - } - } - } - } //for j - if (meanFlag === 1) { - meanValue = sumValue / nbvalues; - } - if (medFlag === 1) { - var aux = 0; - if (nbvalues % 2 === 1) { - aux = Math.floor(nbvalues / 2); - medValue = theList[aux]; - } else { - medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; - } - } - var posa = void 0; - if (q1Flag === 1) { - posa = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa === nbvalues) { - q1Value = (theList[posa - 1] + theList[posa]) / 2; - } else { - q1Value = theList[posa]; - } - } - if (q3Flag === 1) { - posa = 0.0; - var posb = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa === nbvalues) { - posb = 3 * posa; - q3Value = (theList[posb] + theList[posb - 1]) / 2; - } else { - q3Value = theList[nbvalues - posa - 1]; - } - } - - for (; i <= mThisCol; i++) { - switch (opsThisCol[i]) { - case 'mean': - result = meanValue; - break; - case 'sum': - result = sumValue; - break; - case 'min': - result = minValue; - break; - case 'max': - result = maxValue; - break; - case 'median': - result = medValue; - break; - case 'q1': - result = q1Value; - break; - case 'q3': - result = q3Value; - break; - } - - var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; - - //if outputType is defined - if (oTypeThisCol && result) { - result = result.toFixed(precision); - - if ((0, _dom.elm)(labThisCol[i])) { - switch (oTypeThisCol.toLowerCase()) { - case 'innerhtml': - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - (0, _dom.elm)(labThisCol[i]).innerHTML = '.'; - } else { - (0, _dom.elm)(labThisCol[i]).innerHTML = result; - } - break; - case 'setvalue': - (0, _dom.elm)(labThisCol[i]).value = result; - break; - case 'createtextnode': - var oldnode = (0, _dom.elm)(labThisCol[i]).firstChild; - var txtnode = (0, _dom.createText)(result); - (0, _dom.elm)(labThisCol[i]).replaceChild(txtnode, oldnode); - break; - } //switch - } - } else { - try { - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - (0, _dom.elm)(labThisCol[i]).innerHTML = '.'; - } else { - (0, _dom.elm)(labThisCol[i]).innerHTML = result.toFixed(precision); - } - } catch (e) {} //catch - } //else - } //for i - - // row(s) with result are always visible - var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; - if (totRow) { - totRow.style.display = ''; - } - } //for ucol - } //if typeof - - if (this.onAfterOperation) { - this.onAfterOperation.call(null, tf, this); - } - this.emitter.emit('after-column-operation', tf, this); - }; - - /** - * Remove extension - */ - - - ColOps.prototype.destroy = function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - // unsubscribe to events - this.emitter.off(['after-filtering'], function () { - return _this3.calc(); - }); - this.initialized = false; - }; - - return ColOps; - }(_feature.Feature); - - exports.default = ColOps; - -/***/ }, - -/***/ 439: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _types = __webpack_require__(4); - - var _event = __webpack_require__(1); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Columns Visibility extension - */ - var ColsVisibility = function (_Feature) { - _inherits(ColsVisibility, _Feature); - - /** - * Creates an instance of ColsVisibility - * @param {TableFilter} tf TableFilter instance - * @param {Object} Configuration object - */ - function ColsVisibility(tf, f) { - _classCallCheck(this, ColsVisibility); - - // Configuration object - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, f.name)); - - var cfg = _this.config; - - /** - * Module name - * @type {String} - */ - _this.name = f.name; - - /** - * Module description - * @type {String} - */ - _this.desc = f.description || 'Columns visibility manager'; - - /** - * show/hide columns container element - * @private - */ - _this.spanEl = null; - - /** - * show/hide columns button element - * @private - */ - _this.btnEl = null; - - /** - * show/hide columns main container element - * @private - */ - _this.contEl = null; - - /** - * Enable tick to hide a column, defaults to true - * @type {Boolean} - */ - _this.tickToHide = f.tick_to_hide === false ? false : true; - - /** - * Enable columns manager UI, defaults to true - * @type {Boolean} - */ - _this.manager = f.manager === false ? false : true; - - /** - * Headers HTML table reference only if headers are external - * @type {DOMElement} - */ - _this.headersTbl = f.headers_table || null; - - /** - * Headers row index only if headers are external - * @type {Number} - */ - _this.headersIndex = f.headers_index || 1; - - /** - * ID of main container element - * @type {String} - */ - _this.contElTgtId = f.container_target_id || null; - - /** - * Alternative text for column headers in column manager UI - * @type {Array} - */ - _this.headersText = f.headers_text || null; - - /** - * ID of button's container element - * @type {String} - */ - _this.btnTgtId = f.btn_target_id || null; - - /** - * Button's text, defaults to Columns▼ - * @type {String} - */ - _this.btnText = f.btn_text || 'Columns▼'; - - /** - * Button's inner HTML - * @type {String} - */ - _this.btnHtml = f.btn_html || null; - - /** - * Css class for button - * @type {String} - */ - _this.btnCssClass = f.btn_css_class || 'colVis'; - - /** - * Columns manager UI close link text, defaults to 'Close' - * @type {String} - */ - _this.btnCloseText = f.btn_close_text || 'Close'; - - /** - * Columns manager UI close link HTML - * @type {String} - */ - _this.btnCloseHtml = f.btn_close_html || null; - - /** - * Css for columns manager UI close link - * @type {String} - */ - _this.btnCloseCssClass = f.btn_close_css_class || _this.btnCssClass; - - /** - * Extension's stylesheet filename - * @type {String} - */ - _this.stylesheet = f.stylesheet || 'colsVisibility.css'; - - /** - * Extension's prefix - * @private - */ - _this.prfx = 'colVis_'; - - /** - * Css for columns manager UI span - * @type {String} - */ - _this.spanCssClass = f.span_css_class || 'colVisSpan'; - - /** - * Main container prefix - * @private - */ - _this.prfxCont = _this.prfx + 'Cont_'; - - /** - * Css for columns manager UI main container - * @type {String} - */ - _this.contCssClass = f.cont_css_class || 'colVisCont'; - - /** - * Css for columns manager UI checklist (ul) - * @type {String} - */ - _this.listCssClass = cfg.list_css_class || 'cols_checklist'; - - /** - * Css for columns manager UI checklist item (li) - * @type {String} - */ - _this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; - - /** - * Css for columns manager UI checklist item selected state (li) - * @type {String} - */ - _this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; - - /** - * Text preceding the columns list, defaults to 'Hide' or 'Show' - * depending on tick mode (tick_to_hide option) - * @type {String} - */ - _this.text = f.text || (_this.tickToHide ? 'Hide: ' : 'Show: '); - - /** - * List of columns indexes to be hidden at initialization - * @type {Array} - */ - _this.atStart = f.at_start || []; - - /** - * Enable hover behaviour on columns manager button/link - * @type {Boolean} - */ - _this.enableHover = Boolean(f.enable_hover); - - /** - * Enable select all option, disabled by default - * @type {Boolean} - */ - _this.enableTickAll = Boolean(f.enable_tick_all); - - /** - * Text for select all option, defaults to 'Select all:' - * @type {String} - */ - _this.tickAllText = f.tick_all_text || 'Select all:'; - - /** - * List of indexes of hidden columns - * @private - */ - _this.hiddenCols = []; - - /** - * Callback fired when the extension is initialized - * @type {Function} - */ - _this.onLoaded = (0, _types.isFn)(f.on_loaded) ? f.on_loaded : null; - - /** - * Callback fired before the columns manager is opened - * @type {Function} - */ - _this.onBeforeOpen = (0, _types.isFn)(f.on_before_open) ? f.on_before_open : null; - - /** - * Callback fired after the columns manager is opened - * @type {Function} - */ - _this.onAfterOpen = (0, _types.isFn)(f.on_after_open) ? f.on_after_open : null; - - /** - * Callback fired before the columns manager is closed - * @type {Function} - */ - _this.onBeforeClose = (0, _types.isFn)(f.on_before_close) ? f.on_before_close : null; - - /** - * Callback fired after the columns manager is closed - * @type {Function} - */ - _this.onAfterClose = (0, _types.isFn)(f.on_after_close) ? f.on_after_close : null; - - /** - * Callback fired before a column is hidden - * @type {Function} - */ - _this.onBeforeColHidden = (0, _types.isFn)(f.on_before_col_hidden) ? f.on_before_col_hidden : null; - - /** - * Callback fired after a column is hidden - * @type {Function} - */ - _this.onAfterColHidden = (0, _types.isFn)(f.on_after_col_hidden) ? f.on_after_col_hidden : null; - - /** - * Callback fired before a column is displayed - * @type {Function} - */ - _this.onBeforeColDisplayed = (0, _types.isFn)(f.on_before_col_displayed) ? f.on_before_col_displayed : null; - - /** - * Callback fired after a column is displayed - * @type {Function} - */ - _this.onAfterColDisplayed = (0, _types.isFn)(f.on_after_col_displayed) ? f.on_after_col_displayed : null; - - //Grid layout support - if (tf.gridLayout) { - _this.headersTbl = tf.feature('gridLayout').headTbl; //headers table - _this.headersIndex = 0; //headers index - _this.onAfterColDisplayed = function () {}; - _this.onAfterColHidden = function () {}; - } - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + _this.stylesheet, null, 'link'); - - _this.enable(); - return _this; - } - - /** - * Toggle columns manager UI - */ - - - ColsVisibility.prototype.toggle = function toggle() { - var contDisplay = this.contEl.style.display; - var onBeforeOpen = this.onBeforeOpen; - var onBeforeClose = this.onBeforeClose; - var onAfterOpen = this.onAfterOpen; - var onAfterClose = this.onAfterClose; - - if (onBeforeOpen && contDisplay !== 'inline') { - onBeforeOpen.call(null, this); - } - if (onBeforeClose && contDisplay === 'inline') { - onBeforeClose.call(null, this); - } - - this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; - - if (onAfterOpen && contDisplay !== 'inline') { - onAfterOpen.call(null, this); - } - if (onAfterClose && contDisplay === 'inline') { - onAfterClose.call(null, this); - } - }; - - /** - * Check an item in columns manager UI - * @private - */ - - - ColsVisibility.prototype.checkItem = function checkItem(lbl) { - var li = lbl.parentNode; - if (!li || !lbl) { - return; - } - var isChecked = lbl.firstChild.checked; - var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; - colIndex = parseInt(colIndex, 10); - if (isChecked) { - (0, _dom.addClass)(li, this.listSlcItemCssClass); - } else { - (0, _dom.removeClass)(li, this.listSlcItemCssClass); - } - - var hide = false; - if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { - hide = true; - } - this.setHidden(colIndex, hide); - }; - - /** - * Initializes ColsVisibility instance - */ - - - ColsVisibility.prototype.init = function init() { - var _this2 = this; - - if (this.initialized || !this.manager) { - return; - } - - this.emitter.on(['hide-column'], function (tf, colIndex) { - return _this2.hideCol(colIndex); - }); - - this.buildBtn(); - this.buildManager(); - - /** - * @inherited - */ - this.initialized = true; - - this.emitter.emit('columns-visibility-initialized', this.tf, this); - - // Hide columns at start at very end of initialization, do not move - // as order is important - this._hideAtStart(); - }; - - /** - * Build main button UI - */ - - - ColsVisibility.prototype.buildBtn = function buildBtn() { - var _this3 = this; - - if (this.btnEl) { - return; - } - var tf = this.tf; - var span = (0, _dom.createElm)('span', ['id', this.prfx + tf.id]); - span.className = this.spanCssClass; - - //Container element (rdiv or custom element) - if (!this.btnTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnTgtId ? tf.rDiv : (0, _dom.elm)(this.btnTgtId); - - if (!this.btnTgtId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - if (!this.btnHtml) { - var btn = (0, _dom.createElm)('a', ['href', 'javascript:;']); - btn.className = this.btnCssClass; - btn.title = this.desc; - - btn.innerHTML = this.btnText; - span.appendChild(btn); - if (!this.enableHover) { - (0, _event.addEvt)(btn, 'click', function (evt) { - return _this3.toggle(evt); - }); - } else { - (0, _event.addEvt)(btn, 'mouseover', function (evt) { - return _this3.toggle(evt); - }); - } - } else { - //Custom html - span.innerHTML = this.btnHtml; - var colVisEl = span.firstChild; - if (!this.enableHover) { - (0, _event.addEvt)(colVisEl, 'click', function (evt) { - return _this3.toggle(evt); - }); - } else { - (0, _event.addEvt)(colVisEl, 'mouseover', function (evt) { - return _this3.toggle(evt); - }); - } - } - - this.spanEl = span; - this.btnEl = this.spanEl.firstChild; - - if (this.onLoaded) { - this.onLoaded.call(null, this); - } - }; - - /** - * Build columns manager UI - */ - - - ColsVisibility.prototype.buildManager = function buildManager() { - var _this4 = this; - - var tf = this.tf; - - var container = !this.contElTgtId ? (0, _dom.createElm)('div', ['id', this.prfxCont + tf.id]) : (0, _dom.elm)(this.contElTgtId); - container.className = this.contCssClass; - - //Extension description - var extNameLabel = (0, _dom.createElm)('p'); - extNameLabel.innerHTML = this.text; - container.appendChild(extNameLabel); - - //Headers list - var ul = (0, _dom.createElm)('ul', ['id', 'ul' + this.name + '_' + tf.id]); - ul.className = this.listCssClass; - - var tbl = this.headersTbl ? this.headersTbl : tf.tbl; - var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); - var headerRow = tbl.rows[headerIndex]; - - //Tick all option - if (this.enableTickAll) { - (function () { - var li = (0, _dom.createCheckItem)('col__' + tf.id, _this4.tickAllText, _this4.tickAllText); - (0, _dom.addClass)(li, _this4.listItemCssClass); - ul.appendChild(li); - li.check.checked = !_this4.tickToHide; - - (0, _event.addEvt)(li.check, 'click', function () { - for (var h = 0; h < headerRow.cells.length; h++) { - var itm = (0, _dom.elm)('col_' + h + '_' + tf.id); - if (itm && li.check.checked !== itm.checked) { - itm.click(); - itm.checked = li.check.checked; - } - } - }); - })(); - } - - for (var i = 0; i < headerRow.cells.length; i++) { - var cell = headerRow.cells[i]; - var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); - var liElm = (0, _dom.createCheckItem)('col_' + i + '_' + tf.id, cellText, cellText); - (0, _dom.addClass)(liElm, this.listItemCssClass); - if (!this.tickToHide) { - (0, _dom.addClass)(liElm, this.listSlcItemCssClass); - } - ul.appendChild(liElm); - if (!this.tickToHide) { - liElm.check.checked = true; - } - - (0, _event.addEvt)(liElm.check, 'click', function (evt) { - var elm = (0, _event.targetEvt)(evt); - var lbl = elm.parentNode; - _this4.checkItem(lbl); - }); - } - - //separator - var p = (0, _dom.createElm)('p', ['align', 'center']); - var btn = void 0; - //Close link - if (!this.btnCloseHtml) { - btn = (0, _dom.createElm)('a', ['href', 'javascript:;']); - btn.className = this.btnCloseCssClass; - btn.innerHTML = this.btnCloseText; - (0, _event.addEvt)(btn, 'click', function (evt) { - return _this4.toggle(evt); - }); - p.appendChild(btn); - } else { - p.innerHTML = this.btnCloseHtml; - btn = p.firstChild; - (0, _event.addEvt)(btn, 'click', function (evt) { - return _this4.toggle(evt); - }); - } - - container.appendChild(ul); - container.appendChild(p); - - this.btnEl.parentNode.insertBefore(container, this.btnEl); - this.contEl = container; - }; - - /** - * Hide or show specified columns - * @param {Number} colIndex Column index - * @param {Boolean} hide Hide column if true or show if false - */ - - - ColsVisibility.prototype.setHidden = function setHidden(colIndex, hide) { - var tf = this.tf; - var tbl = tf.tbl; - - if (this.onBeforeColHidden && hide) { - this.onBeforeColHidden.call(null, this, colIndex); - } - if (this.onBeforeColDisplayed && !hide) { - this.onBeforeColDisplayed.call(null, this, colIndex); - } - - this._hideCells(tbl, colIndex, hide); - if (this.headersTbl) { - this._hideCells(this.headersTbl, colIndex, hide); - } - - var hiddenCols = this.hiddenCols; - var itemIndex = hiddenCols.indexOf(colIndex); - if (hide) { - if (itemIndex === -1) { - this.hiddenCols.push(colIndex); - } - } else { - if (itemIndex !== -1) { - this.hiddenCols.splice(itemIndex, 1); - } - } - - var gridLayout = void 0; - var headTbl = void 0; - var gridColElms = void 0; - if (hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.colElms; - var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); - - var headTblW = parseInt(headTbl.style.width, 10); - headTbl.style.width = headTblW - hiddenWidth + 'px'; - tbl.style.width = headTbl.style.width; - } - if (this.onAfterColHidden) { - this.onAfterColHidden.call(null, this, colIndex); - } - this.emitter.emit('column-hidden', tf, this, colIndex, this.hiddenCols); - } - - if (!hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.colElms; - var width = parseInt(gridColElms[colIndex].style.width, 10); - headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; - tf.tbl.style.width = headTbl.style.width; - } - if (this.onAfterColDisplayed) { - this.onAfterColDisplayed.call(null, this, colIndex); - } - this.emitter.emit('column-shown', tf, this, colIndex, this.hiddenCols); - } - }; - - /** - * Show specified column - * @param {Number} colIndex Column index - */ - - - ColsVisibility.prototype.showCol = function showCol(colIndex) { - if (colIndex === undefined || !this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = (0, _dom.elm)('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, false); - } - }; - - /** - * Hide specified column - * @param {Number} colIndex Column index - */ - - - ColsVisibility.prototype.hideCol = function hideCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = (0, _dom.elm)('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, true); - } - }; - - /** - * Determine if specified column is hidden - * @param {Number} colIndex Column index - */ - - - ColsVisibility.prototype.isColHidden = function isColHidden(colIndex) { - if (this.hiddenCols.indexOf(colIndex) !== -1) { - return true; - } - return false; - }; - - /** - * Toggle visibility of specified column - * @param {Number} colIndex Column index - */ - - - ColsVisibility.prototype.toggleCol = function toggleCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - this.showCol(colIndex); - } else { - this.hideCol(colIndex); - } - }; - - /** - * Return the indexes of the columns currently hidden - * @return {Array} column indexes - */ - - - ColsVisibility.prototype.getHiddenCols = function getHiddenCols() { - return this.hiddenCols; - }; - - /** - * Remove the columns manager - */ - - - ColsVisibility.prototype.destroy = function destroy() { - var _this5 = this; - - if (!this.initialized) { - return; - } - if ((0, _dom.elm)(this.contElTgtId)) { - (0, _dom.elm)(this.contElTgtId).innerHTML = ''; - } else { - this.contEl.innerHTML = ''; - (0, _dom.removeElm)(this.contEl); - this.contEl = null; - } - this.btnEl.innerHTML = ''; - (0, _dom.removeElm)(this.btnEl); - this.btnEl = null; - - this.emitter.off(['hide-column'], function (tf, colIndex) { - return _this5.hideCol(colIndex); - }); - - this.initialized = false; - }; - - ColsVisibility.prototype._getHeaderText = function _getHeaderText(cell) { - if (!cell.hasChildNodes) { - return ''; - } - - for (var i = 0; i < cell.childNodes.length; i++) { - var n = cell.childNodes[i]; - if (n.nodeType === 3) { - return n.nodeValue; - } else if (n.nodeType === 1) { - if (n.id && n.id.indexOf('popUp') !== -1) { - continue; - } else { - return (0, _dom.getText)(n); - } - } - continue; - } - return ''; - }; - - ColsVisibility.prototype._hideCells = function _hideCells(tbl, colIndex, hide) { - for (var i = 0; i < tbl.rows.length; i++) { - var row = tbl.rows[i]; - var cell = row.cells[colIndex]; - if (cell) { - cell.style.display = hide ? 'none' : ''; - } - } - }; - - ColsVisibility.prototype._hideAtStart = function _hideAtStart() { - var _this6 = this; - - this.atStart.forEach(function (colIdx) { - _this6.hideCol(colIdx); - }); - }; - - return ColsVisibility; - }(_feature.Feature); - - exports.default = ColsVisibility; - -/***/ }, - -/***/ 440: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _feature = __webpack_require__(10); - - var _dom = __webpack_require__(3); - - var _types = __webpack_require__(4); - - var _event = __webpack_require__(1); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * Filters Visibility extension - */ - var FiltersVisibility = function (_Feature) { - _inherits(FiltersVisibility, _Feature); - - /** - * Creates an instance of FiltersVisibility - * @param {TableFilter} tf TableFilter instance - * @param {Object} Configuration object - */ - function FiltersVisibility(tf, f) { - _classCallCheck(this, FiltersVisibility); - - /** - * Module name - * @type {String} - */ - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, f.name)); - - _this.name = f.name; - - /** - * Module description - * @type {String} - */ - _this.desc = f.description || 'Filters row visibility manager'; - - /** - * Extension's stylesheet filename - * @type {String} - */ - _this.stylesheet = f.stylesheet || 'filtersVisibility.css'; - - /** - * Expand icon filename - * @type {String} - */ - _this.icnExpand = f.expand_icon_name || 'icn_exp.png'; - - /** - * Collapse icon filename - * @type {String} - */ - _this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; - - /** - * Main container element - * @private - */ - _this.contEl = null; - - /** - * Button element - * @private - */ - _this.btnEl = null; - - /** - * Expand icon HTML - * @private - */ - _this.icnExpandHtml = 'Expand filters'; - - /** - * Collapse icon HTML - * @private - */ - _this.icnCollapseHtml = 'Collapse filters'; - - /** - * Default text - * @private - */ - _this.defaultText = 'Toggle filters'; - - /** - * ID of main container element - * @type {String} - */ - _this.targetId = f.target_id || null; - - /** - * Enable expand/collapse icon, defaults to true - * @type {Boolean} - */ - _this.enableIcon = f.enable_icon === false ? false : true; - - /** - * Custom text for button - * @type {String} - */ - _this.btnText = f.btn_text || ''; - - /** - * Collapse button HTML - * @private - */ - _this.collapseBtnHtml = _this.enableIcon ? _this.icnCollapseHtml + _this.btnText : _this.btnText || _this.defaultText; - - /** - * Expand button HTML - * @private - */ - _this.expandBtnHtml = _this.enableIcon ? _this.icnExpandHtml + _this.btnText : _this.btnText || _this.defaultText; - - /** - * Button's custom HTML - * @type {String} - */ - _this.btnHtml = f.btn_html || null; - - /** - * Css class for expand/collapse filters button - * @type {String} - */ - _this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; - - /** - * Css class for main container - * @type {String} - */ - _this.contCssClass = f.cont_css_class || 'expClpFlt'; - - /** - * Filters row index - * @type {Number} - */ - _this.filtersRowIndex = !(0, _types.isUndef)(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); - - /** - * Make filters visible at initialization, defaults to true - * @type {Boolean} - */ - _this.visibleAtStart = !(0, _types.isUndef)(f.visible_at_start) ? Boolean(f.visible_at_start) : true; - - /** - * Extension's prefix - * @private - */ - _this.prfx = 'fltsVis_'; - - /** - * Callback fired before filters row is shown - * @type {Function} - */ - _this.onBeforeShow = (0, _types.isFn)(f.on_before_show) ? f.on_before_show : null; - - /** - * Callback fired after filters row is shown - * @type {Function} - */ - _this.onAfterShow = (0, _types.isFn)(f.on_after_show) ? f.on_after_show : null; - - /** - * Callback fired before filters row is hidden - * @type {Function} - */ - _this.onBeforeHide = (0, _types.isFn)(f.on_before_hide) ? f.on_before_hide : null; - - /** - * Callback fired after filters row is hidden - * @type {Function} - */ - _this.onAfterHide = (0, _types.isFn)(f.on_after_hide) ? f.on_after_hide : null; - - //Import extension's stylesheet - tf.import(f.name + 'Style', tf.stylePath + _this.stylesheet, null, 'link'); - - _this.enable(); - return _this; - } - - /** - * Initialise extension - */ - - - FiltersVisibility.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - this.buildUI(); - - /** - * @inherited - */ - this.initialized = true; - - this.emitter.on(['show-filters'], function (tf, visible) { - return _this2.show(visible); - }); - this.emitter.emit('filters-visibility-initialized', this.tf, this); - }; - - /** - * Build UI elements - */ - - - FiltersVisibility.prototype.buildUI = function buildUI() { - var _this3 = this; - - var tf = this.tf; - var span = (0, _dom.createElm)('span', ['id', this.prfx + tf.id]); - span.className = this.contCssClass; - - //Container element (rdiv or custom element) - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.rDiv : (0, _dom.elm)(this.targetId); - - if (!this.targetId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - var btn = void 0; - if (!this.btnHtml) { - btn = (0, _dom.createElm)('a', ['href', 'javascript:void(0);']); - btn.className = this.btnCssClass; - btn.title = this.btnText || this.defaultText; - btn.innerHTML = this.collapseBtnHtml; - span.appendChild(btn); - } else { - //Custom html - span.innerHTML = this.btnHtml; - btn = span.firstChild; - } - - (0, _event.addEvt)(btn, 'click', function () { - return _this3.toggle(); - }); - - this.contEl = span; - this.btnEl = btn; - - if (!this.visibleAtStart) { - this.toggle(); - } - }; - - /** - * Toggle filters visibility - */ - - - FiltersVisibility.prototype.toggle = function toggle() { - var tf = this.tf; - var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; - var fltRow = tbl.rows[this.filtersRowIndex]; - var isDisplayed = fltRow.style.display === ''; - - this.show(!isDisplayed); - }; - - /** - * Show or hide filters - * - * @param {boolean} [visible=true] Visibility flag - */ - - - FiltersVisibility.prototype.show = function show() { - var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - - var tf = this.tf; - var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; - var fltRow = tbl.rows[this.filtersRowIndex]; - - if (this.onBeforeShow && visible) { - this.onBeforeShow.call(this, this); - } - if (this.onBeforeHide && !visible) { - this.onBeforeHide.call(null, this); - } - - fltRow.style.display = visible ? '' : 'none'; - if (this.enableIcon && !this.btnHtml) { - this.btnEl.innerHTML = visible ? this.collapseBtnHtml : this.expandBtnHtml; - } - - if (this.onAfterShow && visible) { - this.onAfterShow.call(null, this); - } - if (this.onAfterHide && !visible) { - this.onAfterHide.call(null, this); - } - - this.emitter.emit('filters-toggled', tf, this, visible); - }; - - /** - * Destroy the UI - */ - - - FiltersVisibility.prototype.destroy = function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - this.emitter.off(['show-filters'], function (tf, visible) { - return _this4.show(visible); - }); - - this.btnEl.innerHTML = ''; - (0, _dom.removeElm)(this.btnEl); - this.btnEl = null; - - this.contEl.innerHTML = ''; - (0, _dom.removeElm)(this.contEl); - this.contEl = null; - this.initialized = false; - }; - - return FiltersVisibility; - }(_feature.Feature); - - exports.default = FiltersVisibility; - -/***/ }, - -/***/ 441: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _feature = __webpack_require__(10); - - var _types = __webpack_require__(4); - - var _dom = __webpack_require__(3); - - var _event = __webpack_require__(1); - - var _number = __webpack_require__(7); - - var _const = __webpack_require__(11); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - /** - * SortableTable Adapter module - */ - var AdapterSortableTable = function (_Feature) { - _inherits(AdapterSortableTable, _Feature); - - /** - * Creates an instance of AdapterSortableTable - * @param {TableFilter} tf TableFilter instance - * @param {Object} opts Configuration object - */ - function AdapterSortableTable(tf, opts) { - _classCallCheck(this, AdapterSortableTable); - - /** - * Module name - * @type {String} - */ - var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, opts.name)); - - _this.name = opts.name; - - /** - * Module description - * @type {String} - */ - _this.desc = opts.description || 'Sortable table'; - - /** - * Indicate whether table previously sorted - * @type {Boolean} - * @private - */ - _this.sorted = false; - - /** - * List of sort type per column basis - * @type {Array} - */ - _this.sortTypes = (0, _types.isArray)(opts.types) ? opts.types : tf.colTypes; - - /** - * Column to be sorted at initialization, ie: - * sort_col_at_start: [1, true] - * @type {Array} - */ - _this.sortColAtStart = (0, _types.isArray)(opts.sort_col_at_start) ? opts.sort_col_at_start : null; - - /** - * Enable asynchronous sort, if triggers are external - * @type {Boolean} - */ - _this.asyncSort = Boolean(opts.async_sort); - - /** - * List of element IDs triggering sort on a per column basis - * @type {Array} - */ - _this.triggerIds = (0, _types.isArray)(opts.trigger_ids) ? opts.trigger_ids : []; - - // edit .sort-arrow.descending / .sort-arrow.ascending in - // tablefilter.css to reflect any path change - /** - * Path to images - * @type {String} - */ - _this.imgPath = opts.images_path || tf.themesPath; - - /** - * Blank image file name - * @type {String} - */ - _this.imgBlank = opts.image_blank || 'blank.png'; - - /** - * Css class for sort indicator image - * @type {String} - */ - _this.imgClassName = opts.image_class_name || 'sort-arrow'; - - /** - * Css class for ascending sort indicator image - * @type {String} - */ - _this.imgAscClassName = opts.image_asc_class_name || 'ascending'; - - /** - * Css class for descending sort indicator image - * @type {String} - */ - _this.imgDescClassName = opts.image_desc_class_name || 'descending'; - - /** - * Cell attribute key storing custom value used for sorting - * @type {String} - */ - _this.customKey = opts.custom_key || 'data-tf-sortKey'; - - /** - * Callback fired when sort extension is instanciated - * @type {Function} - */ - _this.onSortLoaded = (0, _types.isFn)(opts.on_sort_loaded) ? opts.on_sort_loaded : null; - - /** - * Callback fired before a table column is sorted - * @type {Function} - */ - _this.onBeforeSort = (0, _types.isFn)(opts.on_before_sort) ? opts.on_before_sort : null; - - /** - * Callback fired after a table column is sorted - * @type {Function} - */ - _this.onAfterSort = (0, _types.isFn)(opts.on_after_sort) ? opts.on_after_sort : null; - - /** - * SortableTable instance - * @private - */ - _this.stt = null; - - _this.enable(); - return _this; - } - - /** - * Initializes AdapterSortableTable instance - */ - - - AdapterSortableTable.prototype.init = function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - var tf = this.tf; - var adpt = this; - - // SortableTable class sanity check (sortabletable.js) - if ((0, _types.isUndef)(SortableTable)) { - throw new Error('SortableTable class not found.'); - } - - // Add any date format if needed - this.emitter.emit('add-date-type-formats', this.tf, this.sortTypes); - - this.overrideSortableTable(); - this.setSortTypes(); - - // Column sort at start - var sortColAtStart = adpt.sortColAtStart; - if (sortColAtStart) { - this.stt.sort(sortColAtStart[0], sortColAtStart[1]); - } - - if (this.onSortLoaded) { - this.onSortLoaded.call(null, tf, this); - } - - /*** SortableTable callbacks ***/ - this.stt.onbeforesort = function () { - if (adpt.onBeforeSort) { - adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); - } - - /*** sort behaviour for paging ***/ - if (tf.paging) { - tf.feature('paging').disable(); - } - }; - - this.stt.onsort = function () { - adpt.sorted = true; - - //sort behaviour for paging - if (tf.paging) { - var paginator = tf.feature('paging'); - // recalculate valid rows index as sorting may have change it - tf.getValidRows(true); - paginator.enable(); - paginator.setPage(paginator.getPage()); - } - - if (adpt.onAfterSort) { - adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn, adpt.stt.descending); - } - - adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn, adpt.stt.descending); - }; - - this.emitter.on(['sort'], function (tf, colIdx, desc) { - return _this2.sortByColumnIndex(colIdx, desc); - }); - - /** @inherited */ - this.initialized = true; - - this.emitter.emit('sort-initialized', tf, this); - }; - - /** - * Sort specified column - * @param {Number} colIdx Column index - * @param {Boolean} desc Optional: descending manner - */ - - - AdapterSortableTable.prototype.sortByColumnIndex = function sortByColumnIndex(colIdx, desc) { - this.stt.sort(colIdx, desc); - }; - - /** - * Set SortableTable overrides for TableFilter integration - */ - - - AdapterSortableTable.prototype.overrideSortableTable = function overrideSortableTable() { - var adpt = this, - tf = this.tf; - - /** - * Overrides headerOnclick method in order to handle th event - * @param {Object} e [description] - */ - SortableTable.prototype.headerOnclick = function (evt) { - if (!adpt.initialized) { - return; - } - - // find Header element - var el = evt.target || evt.srcElement; - - while (el.tagName !== _const.CELL_TAG && el.tagName !== _const.HEADER_TAG) { - el = el.parentNode; - } - - this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); - }; - - /** - * Overrides getCellIndex IE returns wrong cellIndex when columns are - * hidden - * @param {Object} oTd TD element - * @return {Number} Cell index - */ - SortableTable.getCellIndex = function (oTd) { - var cells = oTd.parentNode.cells, - l = cells.length, - i = void 0; - for (i = 0; cells[i] !== oTd && i < l; i++) {} - return i; - }; - - /** - * Overrides initHeader in order to handle filters row position - * @param {Array} oSortTypes - */ - SortableTable.prototype.initHeader = function (oSortTypes) { - var stt = this; - if (!stt.tHead) { - if (tf.gridLayout) { - stt.tHead = tf.feature('gridLayout').headTbl.tHead; - } else { - return; - } - } - - stt.headersRow = tf.headersRow; - var cells = stt.tHead.rows[stt.headersRow].cells; - stt.sortTypes = oSortTypes || []; - var l = cells.length; - var img = void 0, - c = void 0; - - for (var i = 0; i < l; i++) { - c = cells[i]; - if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { - c.style.cursor = 'pointer'; - img = (0, _dom.createElm)('img', ['src', adpt.imgPath + adpt.imgBlank]); - c.appendChild(img); - if (stt.sortTypes[i] !== null) { - c.setAttribute('_sortType', stt.sortTypes[i]); - } - (0, _event.addEvt)(c, 'click', stt._headerOnclick); - } else { - c.setAttribute('_sortType', oSortTypes[i]); - c._sortType = 'None'; - } - } - stt.updateHeaderArrows(); - }; - - /** - * Overrides updateHeaderArrows in order to handle arrows indicators - */ - SortableTable.prototype.updateHeaderArrows = function () { - var stt = this; - var cells = void 0, - l = void 0, - img = void 0; - - // external headers - if (adpt.asyncSort && adpt.triggerIds.length > 0) { - var triggers = adpt.triggerIds; - cells = []; - l = triggers.length; - for (var j = 0; j < l; j++) { - cells.push((0, _dom.elm)(triggers[j])); - } - } else { - if (!this.tHead) { - return; - } - cells = stt.tHead.rows[stt.headersRow].cells; - l = cells.length; - } - for (var i = 0; i < l; i++) { - var cell = cells[i]; - if (!cell) { - continue; - } - var cellAttr = cell.getAttribute('_sortType'); - if (cellAttr !== null && cellAttr !== 'None') { - img = cell.lastChild || cell; - if (img.nodeName.toLowerCase() !== 'img') { - img = (0, _dom.createElm)('img', ['src', adpt.imgPath + adpt.imgBlank]); - cell.appendChild(img); - } - if (i === stt.sortColumn) { - img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); - } else { - img.className = adpt.imgClassName; - } - } - } - }; - - /** - * Overrides getRowValue for custom key value feature - * @param {Object} oRow Row element - * @param {String} sType - * @param {Number} nColumn - * @return {String} - */ - SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { - var stt = this; - // if we have defined a custom getRowValue use that - var sortTypeInfo = stt._sortTypeInfo[sType]; - if (sortTypeInfo && sortTypeInfo.getRowValue) { - return sortTypeInfo.getRowValue(oRow, nColumn); - } - var c = oRow.cells[nColumn]; - var s = SortableTable.getInnerText(c); - return stt.getValueFromString(s, sType); - }; - - /** - * Overrides getInnerText in order to avoid Firefox unexpected sorting - * behaviour with untrimmed text elements - * @param {Object} oNode DOM element - * @return {String} DOM element inner text - */ - SortableTable.getInnerText = function (oNode) { - if (!oNode) { - return; - } - if (oNode.getAttribute(adpt.customKey)) { - return oNode.getAttribute(adpt.customKey); - } else { - return (0, _dom.getText)(oNode); - } - }; - }; - - /** - * Adds a sort type - */ - - - AdapterSortableTable.prototype.addSortType = function addSortType() { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - // Extract the arguments - var id = args[0]; - var caster = args[1]; - var sorter = args[2]; - - SortableTable.prototype.addSortType(id, caster, sorter); - }; - - /** - * Sets the sort types on a column basis - * @private - */ - - - AdapterSortableTable.prototype.setSortTypes = function setSortTypes() { - var _this3 = this; - - var tf = this.tf, - sortTypes = this.sortTypes, - _sortTypes = []; - - for (var i = 0; i < tf.nbCells; i++) { - var colType = void 0; - if (sortTypes[i]) { - colType = sortTypes[i]; - if ((0, _types.isObj)(colType)) { - if (colType.type === _const.DATE) { - colType = this._addDateType(i, sortTypes); - } else if (colType.type === _const.FORMATTED_NUMBER) { - var decimal = colType.decimal || tf.decimalSeparator; - colType = this._addNumberType(i, decimal); - } - } else { - colType = colType.toLowerCase(); - if (colType === _const.DATE) { - colType = this._addDateType(i, sortTypes); - } else if (colType === _const.FORMATTED_NUMBER || colType === _const.NUMBER) { - colType = this._addNumberType(i, tf.decimalSeparator); - } else if (colType === _const.NONE) { - // TODO: normalise 'none' vs 'None' - colType = 'None'; - } - } - } else { - colType = _const.STRING; - } - _sortTypes.push(colType); - } - - //Public TF method to add sort type - - //Custom sort types - this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); - this.addSortType(_const.STRING); - this.addSortType(_const.IP_ADDRESS, ipAddress, sortIP); - - this.stt = new SortableTable(tf.tbl, _sortTypes); - - /*** external table headers adapter ***/ - if (this.asyncSort && this.triggerIds.length > 0) { - (function () { - var triggers = _this3.triggerIds; - for (var j = 0; j < triggers.length; j++) { - if (triggers[j] === null) { - continue; - } - var trigger = (0, _dom.elm)(triggers[j]); - if (trigger) { - trigger.style.cursor = 'pointer'; - - (0, _event.addEvt)(trigger, 'click', function (evt) { - var elm = evt.target; - if (!_this3.tf.sort) { - return; - } - _this3.stt.asyncSort(triggers.indexOf(elm.id)); - }); - trigger.setAttribute('_sortType', _sortTypes[j]); - } - } - })(); - } - }; - - AdapterSortableTable.prototype._addDateType = function _addDateType(colIndex, types) { - var tf = this.tf; - var dateType = tf.feature('dateType'); - var locale = dateType.getOptions(colIndex, types).locale || tf.locale; - var colType = _const.DATE + '-' + locale; - - this.addSortType(colType, function (value) { - return dateType.parse(value, locale); - }); - return colType; - }; - - AdapterSortableTable.prototype._addNumberType = function _addNumberType(colIndex, decimal) { - var colType = '' + _const.FORMATTED_NUMBER + (decimal === '.' ? '' : '-custom'); - - this.addSortType(colType, function (value) { - return (0, _number.parse)(value, decimal); - }); - return colType; - }; - - /** - * Remove extension - */ - - - AdapterSortableTable.prototype.destroy = function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - var tf = this.tf; - this.emitter.off(['sort'], function (tf, colIdx, desc) { - return _this4.sortByColumnIndex(colIdx, desc); - }); - this.sorted = false; - this.stt.destroy(); - - var ids = tf.getFiltersId(); - for (var idx = 0; idx < ids.length; idx++) { - var header = tf.getHeaderElement(idx); - var img = (0, _dom.tag)(header, 'img'); - - if (img.length === 1) { - header.removeChild(img[0]); - } - } - this.initialized = false; - }; - - return AdapterSortableTable; - }(_feature.Feature); - - //Converters - - - exports.default = AdapterSortableTable; - function ipAddress(value) { - var vals = value.split('.'); - for (var x in vals) { - var val = vals[x]; - while (3 > val.length) { - val = '0' + val; - } - vals[x] = val; - } - return vals.join('.'); - } - - function sortIP(a, b) { - var aa = ipAddress(a.value.toLowerCase()); - var bb = ipAddress(b.value.toLowerCase()); - if (aa === bb) { - return 0; - } else if (aa < bb) { - return -1; - } else { - return 1; - } - } - -/***/ }, - -/***/ 442: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterSortabletable = __webpack_require__(441); - - var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); - - var _root = __webpack_require__(2); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - if (!_root.root.SortableTable) { - __webpack_require__(443); - } - - exports.default = _adapterSortabletable2.default; - -/***/ }, - -/***/ 443: -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(444)(__webpack_require__(445)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") - -/***/ }, - -/***/ 444: -/***/ function(module, exports) { - - /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra - */ - module.exports = function(src) { - if (typeof execScript !== "undefined") - execScript(src); - else - eval.call(null, src); - } - - -/***/ }, - -/***/ 445: -/***/ function(module, exports) { - - module.exports = "/*----------------------------------------------------------------------------\\\n| Sortable Table 1.12 |\n|-----------------------------------------------------------------------------|\n| Created by Erik Arvidsson |\n| (http://webfx.eae.net/contact.html#erik) |\n| For WebFX (http://webfx.eae.net/) |\n|-----------------------------------------------------------------------------|\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\n|-----------------------------------------------------------------------------|\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\n|-----------------------------------------------------------------------------|\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\n| use this file except in compliance with the License. You may obtain a copy |\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\n| Unless required by applicable law or agreed to in writing, software |\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\n| License for the specific language governing permissions and limitations |\n| under the License. |\n|-----------------------------------------------------------------------------|\n| 2003-01-10 | First version |\n| 2003-01-19 | Minor changes to the date parsing |\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\n| | Using onclick DOM0 event if no support for addEventListener |\n| | or attachEvent |\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\n| | easier to add new, custom sort types. |\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\n| | Change defaultDescending to suit your needs. |\n| 2004-03-14 | Improved sort type None look and feel a bit |\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\n| | can use another tHead or no tHead, and you can chose some |\n| | other tBody. |\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\n|-----------------------------------------------------------------------------|\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\n\\----------------------------------------------------------------------------*/\n\n\nfunction SortableTable(oTable, oSortTypes) {\n\n\tthis.sortTypes = oSortTypes || [];\n\n\tthis.sortColumn = null;\n\tthis.descending = null;\n\n\tvar oThis = this;\n\tthis._headerOnclick = function (e) {\n\t\toThis.headerOnclick(e);\n\t};\n\n\tif (oTable) {\n\t\tthis.setTable( oTable );\n\t\tthis.document = oTable.ownerDocument || oTable.document;\n\t}\n\telse {\n\t\tthis.document = document;\n\t}\n\n\n\t// only IE needs this\n\tvar win = this.document.defaultView || this.document.parentWindow;\n\tthis._onunload = function () {\n\t\toThis.destroy();\n\t};\n\tif (win && typeof win.attachEvent != \"undefined\") {\n\t\twin.attachEvent(\"onunload\", this._onunload);\n\t}\n}\n\nSortableTable.gecko = navigator.product == \"Gecko\";\nSortableTable.msie = /msie/i.test(navigator.userAgent);\n// Mozilla is faster when doing the DOM manipulations on\n// an orphaned element. MSIE is not\nSortableTable.removeBeforeSort = SortableTable.gecko;\n\nSortableTable.prototype.onsort = function () {};\n\n// default sort order. true -> descending, false -> ascending\nSortableTable.prototype.defaultDescending = false;\n\n// shared between all instances. This is intentional to allow external files\n// to modify the prototype\nSortableTable.prototype._sortTypeInfo = {};\n\nSortableTable.prototype.setTable = function (oTable) {\n\tif ( this.tHead )\n\t\tthis.uninitHeader();\n\tthis.element = oTable;\n\tthis.setTHead( oTable.tHead );\n\tthis.setTBody( oTable.tBodies[0] );\n};\n\nSortableTable.prototype.setTHead = function (oTHead) {\n\tif (this.tHead && this.tHead != oTHead )\n\t\tthis.uninitHeader();\n\tthis.tHead = oTHead;\n\tthis.initHeader( this.sortTypes );\n};\n\nSortableTable.prototype.setTBody = function (oTBody) {\n\tthis.tBody = oTBody;\n};\n\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\n\tif ( this.tHead )\n\t\tthis.uninitHeader();\n\tthis.sortTypes = oSortTypes || [];\n\tif ( this.tHead )\n\t\tthis.initHeader( this.sortTypes );\n};\n\n// adds arrow containers and events\n// also binds sort type to the header cells so that reordering columns does\n// not break the sort types\nSortableTable.prototype.initHeader = function (oSortTypes) {\n\tif (!this.tHead) return;\n\tvar cells = this.tHead.rows[0].cells;\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\n\tthis.sortTypes = oSortTypes || [];\n\tvar l = cells.length;\n\tvar img, c;\n\tfor (var i = 0; i < l; i++) {\n\t\tc = cells[i];\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\n\t\t\timg = doc.createElement(\"IMG\");\n\t\t\timg.src = \"images/blank.png\";\n\t\t\tc.appendChild(img);\n\t\t\tif (this.sortTypes[i] != null)\n\t\t\t\tc._sortType = this.sortTypes[i];\n\t\t\tif (typeof c.addEventListener != \"undefined\")\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\n\t\t\telse\n\t\t\t\tc.onclick = this._headerOnclick;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\n\t\t\tc._sortType = \"None\";\n\t\t}\n\t}\n\tthis.updateHeaderArrows();\n};\n\n// remove arrows and events\nSortableTable.prototype.uninitHeader = function () {\n\tif (!this.tHead) return;\n\tvar cells = this.tHead.rows[0].cells;\n\tvar l = cells.length;\n\tvar c;\n\tfor (var i = 0; i < l; i++) {\n\t\tc = cells[i];\n\t\tif (c._sortType != null && c._sortType != \"None\") {\n\t\t\tc.removeChild(c.lastChild);\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\n\t\t\tc._sortType = null;\n\t\t\tc.removeAttribute( \"_sortType\" );\n\t\t}\n\t}\n};\n\nSortableTable.prototype.updateHeaderArrows = function () {\n\tif (!this.tHead) return;\n\tvar cells = this.tHead.rows[0].cells;\n\tvar l = cells.length;\n\tvar img;\n\tfor (var i = 0; i < l; i++) {\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\n\t\t\timg = cells[i].lastChild;\n\t\t\tif (i == this.sortColumn)\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\n\t\t\telse\n\t\t\t\timg.className = \"sort-arrow\";\n\t\t}\n\t}\n};\n\nSortableTable.prototype.headerOnclick = function (e) {\n\t// find TD element\n\tvar el = e.target || e.srcElement;\n\twhile (el.tagName != \"TD\")\n\t\tel = el.parentNode;\n\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\n};\n\n// IE returns wrong cellIndex when columns are hidden\nSortableTable.getCellIndex = function (oTd) {\n\tvar cells = oTd.parentNode.childNodes\n\tvar l = cells.length;\n\tvar i;\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\n\t\t;\n\treturn i;\n};\n\nSortableTable.prototype.getSortType = function (nColumn) {\n\treturn this.sortTypes[nColumn] || \"String\";\n};\n\n// only nColumn is required\n// if bDescending is left out the old value is taken into account\n// if sSortType is left out the sort type is found from the sortTypes array\n\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\n\tif (!this.tBody) return;\n\tif (sSortType == null)\n\t\tsSortType = this.getSortType(nColumn);\n\n\t// exit if None\n\tif (sSortType == \"None\")\n\t\treturn;\n\n\tif (bDescending == null) {\n\t\tif (this.sortColumn != nColumn)\n\t\t\tthis.descending = this.defaultDescending;\n\t\telse\n\t\t\tthis.descending = !this.descending;\n\t}\n\telse\n\t\tthis.descending = bDescending;\n\n\tthis.sortColumn = nColumn;\n\n\tif (typeof this.onbeforesort == \"function\")\n\t\tthis.onbeforesort();\n\n\tvar f = this.getSortFunction(sSortType, nColumn);\n\tvar a = this.getCache(sSortType, nColumn);\n\tvar tBody = this.tBody;\n\n\ta.sort(f);\n\n\tif (this.descending)\n\t\ta.reverse();\n\n\tif (SortableTable.removeBeforeSort) {\n\t\t// remove from doc\n\t\tvar nextSibling = tBody.nextSibling;\n\t\tvar p = tBody.parentNode;\n\t\tp.removeChild(tBody);\n\t}\n\n\t// insert in the new order\n\tvar l = a.length;\n\tfor (var i = 0; i < l; i++)\n\t\ttBody.appendChild(a[i].element);\n\n\tif (SortableTable.removeBeforeSort) {\n\t\t// insert into doc\n\t\tp.insertBefore(tBody, nextSibling);\n\t}\n\n\tthis.updateHeaderArrows();\n\n\tthis.destroyCache(a);\n\n\tif (typeof this.onsort == \"function\")\n\t\tthis.onsort();\n};\n\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\n\tvar oThis = this;\n\tthis._asyncsort = function () {\n\t\toThis.sort(nColumn, bDescending, sSortType);\n\t};\n\twindow.setTimeout(this._asyncsort, 1);\n};\n\nSortableTable.prototype.getCache = function (sType, nColumn) {\n\tif (!this.tBody) return [];\n\tvar rows = this.tBody.rows;\n\tvar l = rows.length;\n\tvar a = new Array(l);\n\tvar r;\n\tfor (var i = 0; i < l; i++) {\n\t\tr = rows[i];\n\t\ta[i] = {\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\n\t\t\telement:\tr\n\t\t};\n\t};\n\treturn a;\n};\n\nSortableTable.prototype.destroyCache = function (oArray) {\n\tvar l = oArray.length;\n\tfor (var i = 0; i < l; i++) {\n\t\toArray[i].value = null;\n\t\toArray[i].element = null;\n\t\toArray[i] = null;\n\t}\n};\n\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\n\t// if we have defined a custom getRowValue use that\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\n\n\tvar s;\n\tvar c = oRow.cells[nColumn];\n\tif (typeof c.innerText != \"undefined\")\n\t\ts = c.innerText;\n\telse\n\t\ts = SortableTable.getInnerText(c);\n\treturn this.getValueFromString(s, sType);\n};\n\nSortableTable.getInnerText = function (oNode) {\n\tvar s = \"\";\n\tvar cs = oNode.childNodes;\n\tvar l = cs.length;\n\tfor (var i = 0; i < l; i++) {\n\t\tswitch (cs[i].nodeType) {\n\t\t\tcase 1: //ELEMENT_NODE\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\n\t\t\t\tbreak;\n\t\t\tcase 3:\t//TEXT_NODE\n\t\t\t\ts += cs[i].nodeValue;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn s;\n};\n\nSortableTable.prototype.getValueFromString = function (sText, sType) {\n\tif (this._sortTypeInfo[sType])\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\n\treturn sText;\n\t/*\n\tswitch (sType) {\n\t\tcase \"Number\":\n\t\t\treturn Number(sText);\n\t\tcase \"CaseInsensitiveString\":\n\t\t\treturn sText.toUpperCase();\n\t\tcase \"Date\":\n\t\t\tvar parts = sText.split(\"-\");\n\t\t\tvar d = new Date(0);\n\t\t\td.setFullYear(parts[0]);\n\t\t\td.setDate(parts[2]);\n\t\t\td.setMonth(parts[1] - 1);\n\t\t\treturn d.valueOf();\n\t}\n\treturn sText;\n\t*/\n\t};\n\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\n\tif (this._sortTypeInfo[sType])\n\t\treturn this._sortTypeInfo[sType].compare;\n\treturn SortableTable.basicCompare;\n};\n\nSortableTable.prototype.destroy = function () {\n\tthis.uninitHeader();\n\tvar win = this.document.parentWindow;\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\n\t\twin.detachEvent(\"onunload\", this._onunload);\n\t}\n\tthis._onunload = null;\n\tthis.element = null;\n\tthis.tHead = null;\n\tthis.tBody = null;\n\tthis.document = null;\n\tthis._headerOnclick = null;\n\tthis.sortTypes = null;\n\tthis._asyncsort = null;\n\tthis.onsort = null;\n};\n\n// Adds a sort type to all instance of SortableTable\n// sType : String - the identifier of the sort type\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\n// string and casts it to a desired format. If left out the string is just\n// returned\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\n// compare function. Takes two values and compares them. If left out less than,\n// <, compare is used\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\n// that takes the row and the column index and returns the value used to compare.\n// If left out then the innerText is first taken for the cell and then the\n// fGetValueFromString is used to convert that string the desired value and type\n\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\n\tthis._sortTypeInfo[sType] = {\n\t\ttype:\t\t\t\tsType,\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\n\t\tgetRowValue:\t\tfGetRowValue\n\t};\n};\n\n// this removes the sort type from all instances of SortableTable\nSortableTable.prototype.removeSortType = function (sType) {\n\tdelete this._sortTypeInfo[sType];\n};\n\nSortableTable.basicCompare = function compare(n1, n2) {\n\tif (n1.value < n2.value)\n\t\treturn -1;\n\tif (n2.value < n1.value)\n\t\treturn 1;\n\treturn 0;\n};\n\nSortableTable.idFunction = function (x) {\n\treturn x;\n};\n\nSortableTable.toUpperCase = function (s) {\n\treturn s.toUpperCase();\n};\n\nSortableTable.toDate = function (s) {\n\tvar parts = s.split(\"-\");\n\tvar d = new Date(0);\n\td.setFullYear(parts[0]);\n\td.setDate(parts[2]);\n\td.setMonth(parts[1] - 1);\n\treturn d.valueOf();\n};\n\n\n// add sort types\nSortableTable.prototype.addSortType(\"Number\", Number);\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\nSortableTable.prototype.addSortType(\"String\");\n// None is a special case\n" - -/***/ } - -}); -//# sourceMappingURL=tf-1.js.map \ No newline at end of file +webpackJsonp([1],{435:function(t,e,n){function o(t){return n(i(t))}function i(t){return s[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var s={"./array":16,"./array.js":16,"./const":11,"./const.js":11,"./cookie":29,"./cookie.js":29,"./dom":3,"./dom.js":3,"./emitter":8,"./emitter.js":8,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":436,"./extensions/advancedGrid/adapterEzEditTable.js":436,"./extensions/advancedGrid/advancedGrid":437,"./extensions/advancedGrid/advancedGrid.js":437,"./extensions/colOps/colOps":438,"./extensions/colOps/colOps.js":438,"./extensions/colsVisibility/colsVisibility":439,"./extensions/colsVisibility/colsVisibility.js":439,"./extensions/filtersVisibility/filtersVisibility":440,"./extensions/filtersVisibility/filtersVisibility.js":440,"./extensions/sort/adapterSortabletable":441,"./extensions/sort/adapterSortabletable.js":441,"./extensions/sort/sort":442,"./extensions/sort/sort.js":442,"./feature":10,"./feature.js":10,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dateType":30,"./modules/dateType.js":30,"./modules/dropdown":15,"./modules/dropdown.js":15,"./modules/gridLayout":9,"./modules/gridLayout.js":9,"./modules/hash":27,"./modules/hash.js":27,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":13,"./modules/highlightKeywords.js":13,"./modules/loader":12,"./modules/loader.js":12,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":14,"./modules/popupFilter.js":14,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/state":26,"./modules/state.js":26,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/storage":28,"./modules/storage.js":28,"./number":7,"./number.js":7,"./root":2,"./root.js":2,"./sort":17,"./sort.js":17,"./string":5,"./string.js":5,"./types":4,"./types.js":4};o.keys=function(){return Object.keys(s)},o.resolve=i,t.exports=o,o.id=435},436:function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(10),r=n(3),a=n(11),d=n(2),c='Failed to instantiate EditTable object.\n \n"ezEditTable" dependency not found.',u=function(t){function e(n,s){o(this,e);var l=i(this,t.call(this,n,s.name));return l.desc=s.description||"ezEditTable adapter",l.filename=s.filename||"ezEditTable.js",l.vendorPath=s.vendor_path,l.loadStylesheet=Boolean(s.load_stylesheet),l.stylesheet=s.stylesheet||l.vendorPath+"ezEditTable.css",l.stylesheetName=s.stylesheet_name||"ezEditTableCss",s.scroll_into_view=s.scroll_into_view!==!1&&n.gridLayout,l._ezEditTable=null,l.cfg=s,l.enable(),l}return s(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf;if(d.root.EditTable)this._setAdvancedGrid();else{var n=this.vendorPath+this.filename;e["import"](this.filename,n,function(){return t._setAdvancedGrid()})}this.loadStylesheet&&!e.isImported(this.stylesheet,"link")&&e["import"](this.stylesheetName,this.stylesheet,null,"link"),this.emitter.on(["filter-focus","filter-blur"],function(){return t._toggleForInputFilter()}),this.initialized=!0}},e.prototype._setAdvancedGrid=function(){var t=this.tf,e=void 0,n=this.cfg,o=(0,r.tag)(t.tbl,"thead");e=o.length>0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var i=n.editable,s=n.selection;s&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;s&&!function(){var e=function(e,n,o){var i=e.Selection,s=function(o){if("row"===e.defaultSelection)i.SelectRowByIndex(o);else{e.ClearSelections();var s=n.cellIndex,l=t.tbl.rows[o];"both"===e.defaultSelection&&i.SelectRowByIndex(o),l&&i.SelectCell(l.cells[s])}if(t.validRowsIndex.length!==t.getRowsNb()){var r=t.tbl.rows[o];r&&r.scrollIntoView(!1),u&&(u.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===u.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:u.scrollIntoView(!1))}};if(t.validRowsIndex){var r=t.validRowsIndex,d=r.length,c="row"!==e.defaultSelection?n.parentNode:n,u="TD"===n.nodeName?n:null,h=void 0!==o?e.Event.GetKey(o):0,p=r.indexOf(c.rowIndex)!==-1,f=void 0,b=t.feature("paging"),m=34===h||33===h?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==h&&33!==h?(l=r.indexOf(c.rowIndex),a=c.rowIndex):(f=34===h?l+m<=d-1?r[l+m]:[d-1]:l-m<=r[0]?r[0]:r[l-m],a=f,l=r.indexOf(f),s(f));else{if(c.rowIndex>a)if(c.rowIndex>=r[d-1])f=r[d-1];else{var y=l+m;f=y>d-1?r[d-1]:r[y]}else if(c.rowIndex<=r[0])f=r[0];else{var g=r[l-m];f=g?g:r[0]}a=c.rowIndex,s(f)}}},o=function(e,n){var o="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var i=t.feature("paging");e.nbRowsPerPage=i.pagingLength;var s=t.validRowsIndex,l=s.length,r=parseInt(i.startPagingRow,10)+parseInt(i.pagingLength,10),a=o.rowIndex;a===s[l-1]&&i.currentPageNb!==i.nbPages?i.setPage("last"):a===s[0]&&1!==i.currentPageNb?i.setPage("first"):a>s[r-1]&&as[0]&&i.setPage("previous")}};t.paging&&(t.feature("paging").onAfterChangePage=function(t){var e=t.tf.extension("advancedGrid"),n=e._ezEditTable,o=n.Selection,i=o.GetActiveRow();i&&i.scrollIntoView(!1);var s=o.GetActiveCell();s&&s.scrollIntoView(!1)}),"row"===n.default_selection?!function(){var t=n.on_before_selected_row;n.on_before_selected_row=function(){o(arguments[0],arguments[1],arguments[2]),t&&t.call(null,arguments[0],arguments[1],arguments[2])};var i=n.on_after_selected_row;n.on_after_selected_row=function(){e(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])}}():!function(){var t=n.on_before_selected_cell;n.on_before_selected_cell=function(){o(arguments[0],arguments[1],arguments[2]),t&&t.call(null,arguments[0],arguments[1],arguments[2])};var i=n.on_after_selected_cell;n.on_after_selected_cell=function(){e(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])}}()}(),i&&!function(){var e=n.on_added_dom_row;n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),e&&e.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]&&!function(){var e=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),e&&e.call(null,arguments[0],arguments[1])}}()}();try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(d){throw new Error(c)}this.initialized=!0},e.prototype.reset=function(){var t=this._ezEditTable;t&&(this.cfg.selection&&t.Selection.Set(),this.cfg.editable&&t.Editable.Set())},e.prototype.toggle=function(){var t=this._ezEditTable;t.editable?t.Editable.Remove():t.Editable.Set(),t.selection?t.Selection.Remove():t.Selection.Set()},e.prototype._toggleForInputFilter=function(){var t=this.tf;if(t.getActiveFilterId()){var e=t.getColumnIndexFromFilterId(t.getActiveFilterId()),n=t.getFilterType(e);n===a.INPUT&&this.toggle()}},e.prototype.destroy=function(){var t=this;if(this.initialized){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return t._toggleForInputFilter()}),this.initialized=!1}},e}(l.Feature);e["default"]=u},437:function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(436),s=o(i);e["default"]=s["default"]},438:function(module,exports,__webpack_require__){"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(exports,"__esModule",{value:!0});var _feature=__webpack_require__(10),_dom=__webpack_require__(3),_types=__webpack_require__(4),ColOps=function(_Feature){function ColOps(t,e){_classCallCheck(this,ColOps);var n=_possibleConstructorReturn(this,_Feature.call(this,t,e.name));return n.onBeforeOperation=(0,_types.isFn)(e.on_before_operation)?e.on_before_operation:null,n.onAfterOperation=(0,_types.isFn)(e.on_after_operation)?e.on_after_operation:null,n.opts=e,n.enable(),n}return _inherits(ColOps,_Feature),ColOps.prototype.init=function(){var t=this;this.initialized||(this.emitter.on(["after-filtering"],function(){return t.calc()}),this.calc(),this.initialized=!0)},ColOps.prototype.calc=function calc(){var tf=this.tf;if(tf.isInitialized()){this.onBeforeOperation&&this.onBeforeOperation.call(null,tf,this),this.emitter.emit("before-column-operation",tf,this);var opts=this.opts,labelId=opts.id,colIndex=opts.col,operation=opts.operation,outputType=opts.write_method,totRowIndex=opts.tot_row_index,excludeRow=opts.exclude_row,decimalPrecision=(0,_types.isUndef)(opts.decimal_precision)?2:opts.decimal_precision,ucolIndex=[],ucolMax=0;ucolIndex[ucolMax]=colIndex[0];for(var ii=1;iimaxValue?parseFloat(cvalue):maxValue))}if(1===meanFlag&&(meanValue=sumValue/nbvalues),1===medFlag){var aux=0;nbvalues%2===1?(aux=Math.floor(nbvalues/2),medValue=theList[aux]):medValue=(theList[nbvalues/2]+theList[nbvalues/2-1])/2}var posa=void 0;if(1===q1Flag&&(posa=0,posa=Math.floor(nbvalues/4),q1Value=4*posa===nbvalues?(theList[posa-1]+theList[posa])/2:theList[posa]),1===q3Flag){posa=0;var posb=0;posa=Math.floor(nbvalues/4),4*posa===nbvalues?(posb=3*posa,q3Value=(theList[posb]+theList[posb-1])/2):q3Value=theList[nbvalues-posa-1]}for(;i<=mThisCol;i++){switch(opsThisCol[i]){case"mean":result=meanValue;break;case"sum":result=sumValue;break;case"min":result=minValue;break;case"max":result=maxValue;break;case"median":result=medValue;break;case"q1":result=q1Value;break;case"q3":result=q3Value}var precision=isNaN(decThisCol[i])?2:decThisCol[i];if(oTypeThisCol&&result){if(result=result.toFixed(precision),(0,_dom.elm)(labThisCol[i]))switch(oTypeThisCol.toLowerCase()){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?(0,_dom.elm)(labThisCol[i]).innerHTML=".":(0,_dom.elm)(labThisCol[i]).innerHTML=result;break;case"setvalue":(0,_dom.elm)(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=(0,_dom.elm)(labThisCol[i]).firstChild,txtnode=(0,_dom.createText)(result);(0,_dom.elm)(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?(0,_dom.elm)(labThisCol[i]).innerHTML=".":(0,_dom.elm)(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf,this),this.emitter.emit("after-column-operation",tf,this)}},ColOps.prototype.destroy=function(){var t=this;this.initialized&&(this.emitter.off(["after-filtering"],function(){return t.calc()}),this.initialized=!1)},ColOps}(_feature.Feature);exports["default"]=ColOps},439:function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(10),r=n(3),a=n(4),d=n(1),c=function(t){function e(n,s){o(this,e);var l=i(this,t.call(this,n,s.name)),r=l.config;return l.name=s.name,l.desc=s.description||"Columns visibility manager",l.spanEl=null,l.btnEl=null,l.contEl=null,l.tickToHide=s.tick_to_hide!==!1,l.manager=s.manager!==!1,l.headersTbl=s.headers_table||null,l.headersIndex=s.headers_index||1,l.contElTgtId=s.container_target_id||null,l.headersText=s.headers_text||null,l.btnTgtId=s.btn_target_id||null,l.btnText=s.btn_text||"Columns▼",l.btnHtml=s.btn_html||null,l.btnCssClass=s.btn_css_class||"colVis",l.btnCloseText=s.btn_close_text||"Close",l.btnCloseHtml=s.btn_close_html||null,l.btnCloseCssClass=s.btn_close_css_class||l.btnCssClass,l.stylesheet=s.stylesheet||"colsVisibility.css",l.prfx="colVis_",l.spanCssClass=s.span_css_class||"colVisSpan",l.prfxCont=l.prfx+"Cont_",l.contCssClass=s.cont_css_class||"colVisCont",l.listCssClass=r.list_css_class||"cols_checklist",l.listItemCssClass=r.checklist_item_css_class||"cols_checklist_item",l.listSlcItemCssClass=r.checklist_selected_item_css_class||"cols_checklist_slc_item",l.text=s.text||(l.tickToHide?"Hide: ":"Show: "),l.atStart=s.at_start||[],l.enableHover=Boolean(s.enable_hover),l.enableTickAll=Boolean(s.enable_tick_all),l.tickAllText=s.tick_all_text||"Select all:",l.hiddenCols=[],l.onLoaded=(0,a.isFn)(s.on_loaded)?s.on_loaded:null,l.onBeforeOpen=(0,a.isFn)(s.on_before_open)?s.on_before_open:null,l.onAfterOpen=(0,a.isFn)(s.on_after_open)?s.on_after_open:null,l.onBeforeClose=(0,a.isFn)(s.on_before_close)?s.on_before_close:null,l.onAfterClose=(0,a.isFn)(s.on_after_close)?s.on_after_close:null,l.onBeforeColHidden=(0,a.isFn)(s.on_before_col_hidden)?s.on_before_col_hidden:null,l.onAfterColHidden=(0,a.isFn)(s.on_after_col_hidden)?s.on_after_col_hidden:null,l.onBeforeColDisplayed=(0,a.isFn)(s.on_before_col_displayed)?s.on_before_col_displayed:null,l.onAfterColDisplayed=(0,a.isFn)(s.on_after_col_displayed)?s.on_after_col_displayed:null,n.gridLayout&&(l.headersTbl=n.feature("gridLayout").headTbl,l.headersIndex=0,l.onAfterColDisplayed=function(){},l.onAfterColHidden=function(){}),n["import"](s.name+"Style",n.stylePath+l.stylesheet,null,"link"),l.enable(),l}return s(e,t),e.prototype.toggle=function(){var t=this.contEl.style.display,e=this.onBeforeOpen,n=this.onBeforeClose,o=this.onAfterOpen,i=this.onAfterClose;e&&"inline"!==t&&e.call(null,this),n&&"inline"===t&&n.call(null,this),this.contEl.style.display="inline"===t?"none":"inline",o&&"inline"!==t&&o.call(null,this),i&&"inline"===t&&i.call(null,this)},e.prototype.checkItem=function(t){var e=t.parentNode;if(e&&t){var n=t.firstChild.checked,o=t.firstChild.getAttribute("id").split("_")[1];o=parseInt(o,10),n?(0,r.addClass)(e,this.listSlcItemCssClass):(0,r.removeClass)(e,this.listSlcItemCssClass);var i=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(i=!0),this.setHidden(o,i)}},e.prototype.init=function(){var t=this;!this.initialized&&this.manager&&(this.emitter.on(["hide-column"],function(e,n){return t.hideCol(n)}),this.buildBtn(),this.buildManager(),this.initialized=!0,this.emitter.emit("columns-visibility-initialized",this.tf,this),this._hideAtStart())},e.prototype.buildBtn=function(){var t=this;if(!this.btnEl){var e=this.tf,n=(0,r.createElm)("span",["id",this.prfx+e.id]);n.className=this.spanCssClass,this.btnTgtId||e.setToolbar();var o=this.btnTgtId?(0,r.elm)(this.btnTgtId):e.rDiv;if(this.btnTgtId)o.appendChild(n);else{var i=o.firstChild;i.parentNode.insertBefore(n,i)}if(this.btnHtml){n.innerHTML=this.btnHtml;var s=n.firstChild;this.enableHover?(0,d.addEvt)(s,"mouseover",function(e){return t.toggle(e)}):(0,d.addEvt)(s,"click",function(e){return t.toggle(e)})}else{var l=(0,r.createElm)("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?(0,d.addEvt)(l,"mouseover",function(e){return t.toggle(e)}):(0,d.addEvt)(l,"click",function(e){return t.toggle(e)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}},e.prototype.buildManager=function(){var t=this,e=this.tf,n=this.contElTgtId?(0,r.elm)(this.contElTgtId):(0,r.createElm)("div",["id",this.prfxCont+e.id]);n.className=this.contCssClass;var o=(0,r.createElm)("p");o.innerHTML=this.text,n.appendChild(o);var i=(0,r.createElm)("ul",["id","ul"+this.name+"_"+e.id]);i.className=this.listCssClass;var s=this.headersTbl?this.headersTbl:e.tbl,l=this.headersTbl?this.headersIndex:e.getHeadersRowIndex(),a=s.rows[l];this.enableTickAll&&!function(){var n=(0,r.createCheckItem)("col__"+e.id,t.tickAllText,t.tickAllText);(0,r.addClass)(n,t.listItemCssClass),i.appendChild(n),n.check.checked=!t.tickToHide,(0,d.addEvt)(n.check,"click",function(){for(var t=0;t',l.icnCollapseHtml='Collapse filters',l.defaultText="Toggle filters",l.targetId=s.target_id||null,l.enableIcon=s.enable_icon!==!1,l.btnText=s.btn_text||"",l.collapseBtnHtml=l.enableIcon?l.icnCollapseHtml+l.btnText:l.btnText||l.defaultText,l.expandBtnHtml=l.enableIcon?l.icnExpandHtml+l.btnText:l.btnText||l.defaultText,l.btnHtml=s.btn_html||null,l.btnCssClass=s.btn_css_class||"btnExpClpFlt",l.contCssClass=s.cont_css_class||"expClpFlt",l.filtersRowIndex=(0,a.isUndef)(s.filters_row_index)?n.getFiltersRowIndex():s.filters_row_index,l.visibleAtStart=!!(0,a.isUndef)(s.visible_at_start)||Boolean(s.visible_at_start),l.prfx="fltsVis_",l.onBeforeShow=(0,a.isFn)(s.on_before_show)?s.on_before_show:null,l.onAfterShow=(0,a.isFn)(s.on_after_show)?s.on_after_show:null,l.onBeforeHide=(0,a.isFn)(s.on_before_hide)?s.on_before_hide:null,l.onAfterHide=(0,a.isFn)(s.on_after_hide)?s.on_after_hide:null,n["import"](s.name+"Style",n.stylePath+l.stylesheet,null,"link"),l.enable(),l}return s(e,t),e.prototype.init=function(){var t=this;this.initialized||(this.buildUI(),this.initialized=!0,this.emitter.on(["show-filters"],function(e,n){return t.show(n)}),this.emitter.emit("filters-visibility-initialized",this.tf,this))},e.prototype.buildUI=function(){var t=this,e=this.tf,n=(0,r.createElm)("span",["id",this.prfx+e.id]);n.className=this.contCssClass,this.targetId||e.setToolbar();var o=this.targetId?(0,r.elm)(this.targetId):e.rDiv;if(this.targetId)o.appendChild(n);else{var i=o.firstChild;i.parentNode.insertBefore(n,i)}var s=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,s=n.firstChild):(s=(0,r.createElm)("a",["href","javascript:void(0);"]),s.className=this.btnCssClass,s.title=this.btnText||this.defaultText,s.innerHTML=this.collapseBtnHtml,n.appendChild(s)),(0,d.addEvt)(s,"click",function(){return t.toggle()}),this.contEl=n,this.btnEl=s,this.visibleAtStart||this.toggle()},e.prototype.toggle=function(){var t=this.tf,e=t.gridLayout?t.feature("gridLayout").headTbl:t.tbl,n=e.rows[this.filtersRowIndex],o=""===n.style.display;this.show(!o)},e.prototype.show=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this.tf,n=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,o=n.rows[this.filtersRowIndex];this.onBeforeShow&&t&&this.onBeforeShow.call(this,this),this.onBeforeHide&&!t&&this.onBeforeHide.call(null,this),o.style.display=t?"":"none",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=t?this.collapseBtnHtml:this.expandBtnHtml),this.onAfterShow&&t&&this.onAfterShow.call(null,this),this.onAfterHide&&!t&&this.onAfterHide.call(null,this),this.emitter.emit("filters-toggled",e,this,t)},e.prototype.destroy=function(){var t=this;this.initialized&&(this.emitter.off(["show-filters"],function(e,n){return t.show(n)}),this.btnEl.innerHTML="",(0,r.removeElm)(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",(0,r.removeElm)(this.contEl),this.contEl=null,this.initialized=!1)},e}(l.Feature);e["default"]=c},441:function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t){var e=t.split(".");for(var n in e){for(var o=e[n];3>o.length;)o="0"+o;e[n]=o}return e.join(".")}function r(t,e){var n=l(t.value.toLowerCase()),o=l(e.value.toLowerCase());return n===o?0:n0){var s=t.triggerIds;n=[],o=s.length;for(var l=0;l0&&!function(){for(var e=t.triggerIds,n=0;n descending, false -> ascending\nSortableTable.prototype.defaultDescending = false;\n\n// shared between all instances. This is intentional to allow external files\n// to modify the prototype\nSortableTable.prototype._sortTypeInfo = {};\n\nSortableTable.prototype.setTable = function (oTable) {\n\tif ( this.tHead )\n\t\tthis.uninitHeader();\n\tthis.element = oTable;\n\tthis.setTHead( oTable.tHead );\n\tthis.setTBody( oTable.tBodies[0] );\n};\n\nSortableTable.prototype.setTHead = function (oTHead) {\n\tif (this.tHead && this.tHead != oTHead )\n\t\tthis.uninitHeader();\n\tthis.tHead = oTHead;\n\tthis.initHeader( this.sortTypes );\n};\n\nSortableTable.prototype.setTBody = function (oTBody) {\n\tthis.tBody = oTBody;\n};\n\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\n\tif ( this.tHead )\n\t\tthis.uninitHeader();\n\tthis.sortTypes = oSortTypes || [];\n\tif ( this.tHead )\n\t\tthis.initHeader( this.sortTypes );\n};\n\n// adds arrow containers and events\n// also binds sort type to the header cells so that reordering columns does\n// not break the sort types\nSortableTable.prototype.initHeader = function (oSortTypes) {\n\tif (!this.tHead) return;\n\tvar cells = this.tHead.rows[0].cells;\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\n\tthis.sortTypes = oSortTypes || [];\n\tvar l = cells.length;\n\tvar img, c;\n\tfor (var i = 0; i < l; i++) {\n\t\tc = cells[i];\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\n\t\t\timg = doc.createElement("IMG");\n\t\t\timg.src = "images/blank.png";\n\t\t\tc.appendChild(img);\n\t\t\tif (this.sortTypes[i] != null)\n\t\t\t\tc._sortType = this.sortTypes[i];\n\t\t\tif (typeof c.addEventListener != "undefined")\n\t\t\t\tc.addEventListener("click", this._headerOnclick, false);\n\t\t\telse if (typeof c.attachEvent != "undefined")\n\t\t\t\tc.attachEvent("onclick", this._headerOnclick);\n\t\t\telse\n\t\t\t\tc.onclick = this._headerOnclick;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc.setAttribute( "_sortType", oSortTypes[i] );\n\t\t\tc._sortType = "None";\n\t\t}\n\t}\n\tthis.updateHeaderArrows();\n};\n\n// remove arrows and events\nSortableTable.prototype.uninitHeader = function () {\n\tif (!this.tHead) return;\n\tvar cells = this.tHead.rows[0].cells;\n\tvar l = cells.length;\n\tvar c;\n\tfor (var i = 0; i < l; i++) {\n\t\tc = cells[i];\n\t\tif (c._sortType != null && c._sortType != "None") {\n\t\t\tc.removeChild(c.lastChild);\n\t\t\tif (typeof c.removeEventListener != "undefined")\n\t\t\t\tc.removeEventListener("click", this._headerOnclick, false);\n\t\t\telse if (typeof c.detachEvent != "undefined")\n\t\t\t\tc.detachEvent("onclick", this._headerOnclick);\n\t\t\tc._sortType = null;\n\t\t\tc.removeAttribute( "_sortType" );\n\t\t}\n\t}\n};\n\nSortableTable.prototype.updateHeaderArrows = function () {\n\tif (!this.tHead) return;\n\tvar cells = this.tHead.rows[0].cells;\n\tvar l = cells.length;\n\tvar img;\n\tfor (var i = 0; i < l; i++) {\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != "None") {\n\t\t\timg = cells[i].lastChild;\n\t\t\tif (i == this.sortColumn)\n\t\t\t\timg.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\n\t\t\telse\n\t\t\t\timg.className = "sort-arrow";\n\t\t}\n\t}\n};\n\nSortableTable.prototype.headerOnclick = function (e) {\n\t// find TD element\n\tvar el = e.target || e.srcElement;\n\twhile (el.tagName != "TD")\n\t\tel = el.parentNode;\n\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\n};\n\n// IE returns wrong cellIndex when columns are hidden\nSortableTable.getCellIndex = function (oTd) {\n\tvar cells = oTd.parentNode.childNodes\n\tvar l = cells.length;\n\tvar i;\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\n\t\t;\n\treturn i;\n};\n\nSortableTable.prototype.getSortType = function (nColumn) {\n\treturn this.sortTypes[nColumn] || "String";\n};\n\n// only nColumn is required\n// if bDescending is left out the old value is taken into account\n// if sSortType is left out the sort type is found from the sortTypes array\n\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\n\tif (!this.tBody) return;\n\tif (sSortType == null)\n\t\tsSortType = this.getSortType(nColumn);\n\n\t// exit if None\n\tif (sSortType == "None")\n\t\treturn;\n\n\tif (bDescending == null) {\n\t\tif (this.sortColumn != nColumn)\n\t\t\tthis.descending = this.defaultDescending;\n\t\telse\n\t\t\tthis.descending = !this.descending;\n\t}\n\telse\n\t\tthis.descending = bDescending;\n\n\tthis.sortColumn = nColumn;\n\n\tif (typeof this.onbeforesort == "function")\n\t\tthis.onbeforesort();\n\n\tvar f = this.getSortFunction(sSortType, nColumn);\n\tvar a = this.getCache(sSortType, nColumn);\n\tvar tBody = this.tBody;\n\n\ta.sort(f);\n\n\tif (this.descending)\n\t\ta.reverse();\n\n\tif (SortableTable.removeBeforeSort) {\n\t\t// remove from doc\n\t\tvar nextSibling = tBody.nextSibling;\n\t\tvar p = tBody.parentNode;\n\t\tp.removeChild(tBody);\n\t}\n\n\t// insert in the new order\n\tvar l = a.length;\n\tfor (var i = 0; i < l; i++)\n\t\ttBody.appendChild(a[i].element);\n\n\tif (SortableTable.removeBeforeSort) {\n\t\t// insert into doc\n\t\tp.insertBefore(tBody, nextSibling);\n\t}\n\n\tthis.updateHeaderArrows();\n\n\tthis.destroyCache(a);\n\n\tif (typeof this.onsort == "function")\n\t\tthis.onsort();\n};\n\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\n\tvar oThis = this;\n\tthis._asyncsort = function () {\n\t\toThis.sort(nColumn, bDescending, sSortType);\n\t};\n\twindow.setTimeout(this._asyncsort, 1);\n};\n\nSortableTable.prototype.getCache = function (sType, nColumn) {\n\tif (!this.tBody) return [];\n\tvar rows = this.tBody.rows;\n\tvar l = rows.length;\n\tvar a = new Array(l);\n\tvar r;\n\tfor (var i = 0; i < l; i++) {\n\t\tr = rows[i];\n\t\ta[i] = {\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\n\t\t\telement:\tr\n\t\t};\n\t};\n\treturn a;\n};\n\nSortableTable.prototype.destroyCache = function (oArray) {\n\tvar l = oArray.length;\n\tfor (var i = 0; i < l; i++) {\n\t\toArray[i].value = null;\n\t\toArray[i].element = null;\n\t\toArray[i] = null;\n\t}\n};\n\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\n\t// if we have defined a custom getRowValue use that\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\n\n\tvar s;\n\tvar c = oRow.cells[nColumn];\n\tif (typeof c.innerText != "undefined")\n\t\ts = c.innerText;\n\telse\n\t\ts = SortableTable.getInnerText(c);\n\treturn this.getValueFromString(s, sType);\n};\n\nSortableTable.getInnerText = function (oNode) {\n\tvar s = "";\n\tvar cs = oNode.childNodes;\n\tvar l = cs.length;\n\tfor (var i = 0; i < l; i++) {\n\t\tswitch (cs[i].nodeType) {\n\t\t\tcase 1: //ELEMENT_NODE\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\n\t\t\t\tbreak;\n\t\t\tcase 3:\t//TEXT_NODE\n\t\t\t\ts += cs[i].nodeValue;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn s;\n};\n\nSortableTable.prototype.getValueFromString = function (sText, sType) {\n\tif (this._sortTypeInfo[sType])\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\n\treturn sText;\n\t/*\n\tswitch (sType) {\n\t\tcase "Number":\n\t\t\treturn Number(sText);\n\t\tcase "CaseInsensitiveString":\n\t\t\treturn sText.toUpperCase();\n\t\tcase "Date":\n\t\t\tvar parts = sText.split("-");\n\t\t\tvar d = new Date(0);\n\t\t\td.setFullYear(parts[0]);\n\t\t\td.setDate(parts[2]);\n\t\t\td.setMonth(parts[1] - 1);\n\t\t\treturn d.valueOf();\n\t}\n\treturn sText;\n\t*/\n\t};\n\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\n\tif (this._sortTypeInfo[sType])\n\t\treturn this._sortTypeInfo[sType].compare;\n\treturn SortableTable.basicCompare;\n};\n\nSortableTable.prototype.destroy = function () {\n\tthis.uninitHeader();\n\tvar win = this.document.parentWindow;\n\tif (win && typeof win.detachEvent != "undefined") {\t// only IE needs this\n\t\twin.detachEvent("onunload", this._onunload);\n\t}\n\tthis._onunload = null;\n\tthis.element = null;\n\tthis.tHead = null;\n\tthis.tBody = null;\n\tthis.document = null;\n\tthis._headerOnclick = null;\n\tthis.sortTypes = null;\n\tthis._asyncsort = null;\n\tthis.onsort = null;\n};\n\n// Adds a sort type to all instance of SortableTable\n// sType : String - the identifier of the sort type\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\n// string and casts it to a desired format. If left out the string is just\n// returned\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\n// compare function. Takes two values and compares them. If left out less than,\n// <, compare is used\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\n// that takes the row and the column index and returns the value used to compare.\n// If left out then the innerText is first taken for the cell and then the\n// fGetValueFromString is used to convert that string the desired value and type\n\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\n\tthis._sortTypeInfo[sType] = {\n\t\ttype:\t\t\t\tsType,\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\n\t\tgetRowValue:\t\tfGetRowValue\n\t};\n};\n\n// this removes the sort type from all instances of SortableTable\nSortableTable.prototype.removeSortType = function (sType) {\n\tdelete this._sortTypeInfo[sType];\n};\n\nSortableTable.basicCompare = function compare(n1, n2) {\n\tif (n1.value < n2.value)\n\t\treturn -1;\n\tif (n2.value < n1.value)\n\t\treturn 1;\n\treturn 0;\n};\n\nSortableTable.idFunction = function (x) {\n\treturn x;\n};\n\nSortableTable.toUpperCase = function (s) {\n\treturn s.toUpperCase();\n};\n\nSortableTable.toDate = function (s) {\n\tvar parts = s.split("-");\n\tvar d = new Date(0);\n\td.setFullYear(parts[0]);\n\td.setDate(parts[2]);\n\td.setMonth(parts[1] - 1);\n\treturn d.valueOf();\n};\n\n\n// add sort types\nSortableTable.prototype.addSortType("Number", Number);\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\nSortableTable.prototype.addSortType("String");\n// None is a special case\n'}}); \ No newline at end of file diff --git a/test/test-ignore-diacritics.html b/test/test-ignore-diacritics.html new file mode 100644 index 00000000..5926608e --- /dev/null +++ b/test/test-ignore-diacritics.html @@ -0,0 +1,57 @@ + + + + + TableFilter ignore diacritics tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CompanyContactCountry
Alfreds FutterkisteBRÜNHILD AndersGermany
La baguetteJérôme DupontFrance
Ernst HandelZoë PunktAustria
Island TradingHelen BennettUK
Laughing Bacchus WinecellarsYoshi TannamuriCanada
Falò Alimentari RiunitiGiovanni RovelliItaly
+ + + + +
+
+ + diff --git a/test/test-ignore-diacritics.js b/test/test-ignore-diacritics.js new file mode 100644 index 00000000..d234dfea --- /dev/null +++ b/test/test-ignore-diacritics.js @@ -0,0 +1,90 @@ +(function(win, TableFilter){ + var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + ignore_diacritics: true + }); + tf.init(); + + module('Sanity checks'); + test('Enable ignore diacritics', function() { + deepEqual(tf instanceof TableFilter, true, 'TableFilter type'); + deepEqual(tf.ignoreDiacritics, true, 'Ignore diacritics enabled'); + }); + + module('Behaviour'); + test('Filter with `jero`', function() { + tf.setFilterValue(1, 'jero'); + tf.filter(); + deepEqual(tf.getValidRows().length, 1, 'Expected match'); + }); + + test('Filter with `jérô`', function() { + tf.setFilterValue(1, 'jérô'); + tf.filter(); + deepEqual(tf.getValidRows().length, 1, 'Expected match'); + }); + + test('Filter with `brun`', function() { + tf.setFilterValue(1, 'brun'); + tf.filter(); + deepEqual(tf.getValidRows().length, 1, 'Expected match'); + }); + + test('Filter with `brün`', function() { + tf.setFilterValue(1, 'brün'); + tf.filter(); + deepEqual(tf.getValidRows().length, 1, 'Expected match'); + }); + + test('Ignore diacritcs default', function() { + tf.destroy(); + tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/' + }); + tf.init(); + + tf.setFilterValue(1, 'jero'); + tf.filter(); + deepEqual(tf.getValidRows().length, 0, '0 matches'); + + tf.clearFilters(); + tf.setFilterValue(1, 'jérô'); + tf.filter(); + deepEqual(tf.getValidRows().length, 1, '1 matches'); + }); + + test('Ignore diacritcs on a column basis', function() { + tf.destroy(); + tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + ignore_diacritics: [false, true, false] + }); + tf.init(); + + tf.setFilterValue(0, 'falo'); + tf.filter(); + deepEqual(tf.getValidRows().length, 0, 'Column: 0 - 0 matches'); + + tf.clearFilters(); + tf.setFilterValue(0, 'falò'); + tf.filter(); + deepEqual(tf.getValidRows().length, 1, 'Column: 0 - 1 matches'); + + tf.clearFilters(); + tf.setFilterValue(1, 'jero'); + tf.filter(); + deepEqual(tf.getValidRows().length, 1, 'Column: 1 - 1 matches'); + + tf.clearFilters(); + tf.setFilterValue(1, 'jérô'); + tf.filter(); + deepEqual(tf.getValidRows().length, 1, 'Column: 1 - 1 matches'); + }); + + module('Tear-down'); + test('can destroy', function() { + tf.destroy(); + deepEqual(tf.isInitialized(), false, 'Removed'); + }); + +})(window, TableFilter);