UNPKG

tabulator-tables

Version:

Interactive table generation JavaScript library

3 lines 295 kB
/* Tabulator v4.3.0 (c) Oliver Folkerd */ var _typeof="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};!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Tabulator=e()}(this,function(){"use strict";Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),o=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n<o;){var s=e[n];if(t.call(i,s,n,e))return n;n++}return-1}}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),o=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n<o;){var s=e[n];if(t.call(i,s,n,e))return s;n++}}});var t=function(t){this.table=t,this.blockHozScrollEvent=!1,this.headersElement=this.createHeadersElement(),this.element=this.createHeaderElement(),this.rowManager=null,this.columns=[],this.columnsByIndex=[],this.columnsByField={},this.scrollLeft=0,this.element.insertBefore(this.headersElement,this.element.firstChild)};t.prototype.createHeadersElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-headers"),t},t.prototype.createHeaderElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-header"),this.table.options.headerVisible||t.classList.add("tabulator-header-hidden"),t},t.prototype.initialize=function(){},t.prototype.setRowManager=function(t){this.rowManager=t},t.prototype.getElement=function(){return this.element},t.prototype.getHeadersElement=function(){return this.headersElement},t.prototype.scrollHorizontal=function(t){var e=0,o=this.element.scrollWidth-this.table.element.clientWidth;this.element.scrollLeft=t,t>o?(e=t-o,this.element.style.marginLeft=-e+"px"):this.element.style.marginLeft=0,this.scrollLeft=t,this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.scrollHorizontal()},t.prototype.generateColumnsFromRowData=function(t){var e,o,i=[];if(t&&t.length){e=t[0];for(var n in e){var s={field:n,title:n},r=e[n];switch(void 0===r?"undefined":_typeof(r)){case"undefined":o="string";break;case"boolean":o="boolean";break;case"object":o=Array.isArray(r)?"array":"string";break;default:o=isNaN(r)||""===r?r.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?"alphanum":"string":"number"}s.sorter=o,i.push(s)}this.table.options.columns=i,this.setColumns(this.table.options.columns)}},t.prototype.setColumns=function(t,e){for(var o=this;o.headersElement.firstChild;)o.headersElement.removeChild(o.headersElement.firstChild);o.columns=[],o.columnsByIndex=[],o.columnsByField={},o.table.modExists("frozenColumns")&&o.table.modules.frozenColumns.reset(),t.forEach(function(t,e){o._addColumn(t)}),o._reIndexColumns(),o.table.options.responsiveLayout&&o.table.modExists("responsiveLayout",!0)&&o.table.modules.responsiveLayout.initialize(),o.redraw(!0)},t.prototype._addColumn=function(t,e,o){var n=new i(t,this),s=n.getElement(),r=o?this.findColumnIndex(o):o;if(o&&r>-1){var a=this.columns.indexOf(o.getTopColumn()),l=o.getElement();e?(this.columns.splice(a,0,n),l.parentNode.insertBefore(s,l)):(this.columns.splice(a+1,0,n),l.parentNode.insertBefore(s,l.nextSibling))}else e?(this.columns.unshift(n),this.headersElement.insertBefore(n.getElement(),this.headersElement.firstChild)):(this.columns.push(n),this.headersElement.appendChild(n.getElement()));return n},t.prototype.registerColumnField=function(t){t.definition.field&&(this.columnsByField[t.definition.field]=t)},t.prototype.registerColumnPosition=function(t){this.columnsByIndex.push(t)},t.prototype._reIndexColumns=function(){this.columnsByIndex=[],this.columns.forEach(function(t){t.reRegisterPosition()})},t.prototype._verticalAlignHeaders=function(){var t=this,e=0;t.columns.forEach(function(t){var o;t.clearVerticalAlign(),(o=t.getHeight())>e&&(e=o)}),t.columns.forEach(function(o){o.verticalAlign(t.table.options.columnVertAlign,e)}),t.rowManager.adjustTableSize()},t.prototype.findColumn=function(t){var e=this;if("object"!=(void 0===t?"undefined":_typeof(t)))return this.columnsByField[t]||!1;if(t instanceof i)return t;if(t instanceof o)return t._getSelf()||!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement){return e.columns.find(function(e){return e.element===t})||!1}return!1},t.prototype.getColumnByField=function(t){return this.columnsByField[t]},t.prototype.getColumnByIndex=function(t){return this.columnsByIndex[t]},t.prototype.getFirstVisibileColumn=function(t){var t=this.columnsByIndex.findIndex(function(t){return t.visible});return t>-1&&this.columnsByIndex[t]},t.prototype.getColumns=function(){return this.columns},t.prototype.findColumnIndex=function(t){return this.columnsByIndex.findIndex(function(e){return t===e})},t.prototype.getRealColumns=function(){return this.columnsByIndex},t.prototype.traverse=function(t){this.columnsByIndex.forEach(function(e,o){t(e,o)})},t.prototype.getDefinitions=function(t){var e=this,o=[];return e.columnsByIndex.forEach(function(e){(!t||t&&e.visible)&&o.push(e.getDefinition())}),o},t.prototype.getDefinitionTree=function(){var t=this,e=[];return t.columns.forEach(function(t){e.push(t.getDefinition(!0))}),e},t.prototype.getComponents=function(t){var e=this,o=[];return(t?e.columns:e.columnsByIndex).forEach(function(t){o.push(t.getComponent())}),o},t.prototype.getWidth=function(){var t=0;return this.columnsByIndex.forEach(function(e){e.visible&&(t+=e.getWidth())}),t},t.prototype.moveColumn=function(t,e,o){this._moveColumnInArray(this.columns,t,e,o),this._moveColumnInArray(this.columnsByIndex,t,e,o,!0),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.options.columnMoved&&this.table.options.columnMoved.call(this.table,t.getComponent(),this.table.columnManager.getComponents()),this.table.options.persistentLayout&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("columns")},t.prototype._moveColumnInArray=function(t,e,o,i,n){var s,r=t.indexOf(e);r>-1&&(t.splice(r,1),s=t.indexOf(o),s>-1?i&&(s+=1):s=r,t.splice(s,0,e),n&&this.table.rowManager.rows.forEach(function(t){if(t.cells.length){var e=t.cells.splice(r,1)[0];t.cells.splice(s,0,e)}}))},t.prototype.scrollToColumn=function(t,e,o){var i=this,n=0,s=0,r=0,a=t.getElement();return new Promise(function(l,c){if(void 0===e&&(e=i.table.options.scrollToColumnPosition),void 0===o&&(o=i.table.options.scrollToColumnIfVisible),t.visible){switch(e){case"middle":case"center":r=-i.element.clientWidth/2;break;case"right":r=a.clientWidth-i.headersElement.clientWidth}if(!o&&(s=a.offsetLeft)>0&&s+a.offsetWidth<i.element.clientWidth)return!1;n=a.offsetLeft+i.element.scrollLeft+r,n=Math.max(Math.min(n,i.table.rowManager.element.scrollWidth-i.table.rowManager.element.clientWidth),0),i.table.rowManager.scrollHorizontal(n),i.scrollHorizontal(n),l()}else console.warn("Scroll Error - Column not visible"),c("Scroll Error - Column not visible")})},t.prototype.generateCells=function(t){var e=this,o=[];return e.columnsByIndex.forEach(function(e){o.push(e.generateCell(t))}),o},t.prototype.getFlexBaseWidth=function(){var t=this,e=t.table.element.clientWidth,o=0;return t.rowManager.element.scrollHeight>t.rowManager.element.clientHeight&&(e-=t.rowManager.element.offsetWidth-t.rowManager.element.clientWidth),this.columnsByIndex.forEach(function(i){var n,s,r;i.visible&&(n=i.definition.width||0,s=void 0===i.minWidth?t.table.options.columnMinWidth:parseInt(i.minWidth),r="string"==typeof n?n.indexOf("%")>-1?e/100*parseInt(n):parseInt(n):n,o+=r>s?r:s)}),o},t.prototype.addColumn=function(t,e,o){var i=this._addColumn(t,e,o);this._reIndexColumns(),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),this.redraw(),"fitColumns"!=this.table.modules.layout.getMode()&&i.reinitializeWidth(),this._verticalAlignHeaders(),this.table.rowManager.reinitialize()},t.prototype.deregisterColumn=function(t){var e,o=t.getField();o&&delete this.columnsByField[o],e=this.columnsByIndex.indexOf(t),e>-1&&this.columnsByIndex.splice(e,1),e=this.columns.indexOf(t),e>-1&&this.columns.splice(e,1),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.redraw()},t.prototype.redraw=function(t){t&&(u.prototype.helpers.elVisible(this.element)&&this._verticalAlignHeaders(),this.table.rowManager.resetScroll(),this.table.rowManager.reinitialize()),"fitColumns"==this.table.modules.layout.getMode()?this.table.modules.layout.layout():t?this.table.modules.layout.layout():this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),t&&(this.table.options.persistentLayout&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("columns"),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.redraw()),this.table.footerManager.redraw()};var o=function(t){this._column=t,this.type="ColumnComponent"};o.prototype.getElement=function(){return this._column.getElement()},o.prototype.getDefinition=function(){return this._column.getDefinition()},o.prototype.getField=function(){return this._column.getField()},o.prototype.getCells=function(){var t=[];return this._column.cells.forEach(function(e){t.push(e.getComponent())}),t},o.prototype.getVisibility=function(){return this._column.visible},o.prototype.show=function(){this._column.isGroup?this._column.columns.forEach(function(t){t.show()}):this._column.show()},o.prototype.hide=function(){this._column.isGroup?this._column.columns.forEach(function(t){t.hide()}):this._column.hide()},o.prototype.toggle=function(){this._column.visible?this.hide():this.show()},o.prototype.delete=function(){this._column.delete()},o.prototype.getSubColumns=function(){var t=[];return this._column.columns.length&&this._column.columns.forEach(function(e){t.push(e.getComponent())}),t},o.prototype.getParentColumn=function(){return this._column.parent instanceof i&&this._column.parent.getComponent()},o.prototype._getSelf=function(){return this._column},o.prototype.scrollTo=function(){return this._column.table.columnManager.scrollToColumn(this._column)},o.prototype.getTable=function(){return this._column.table},o.prototype.headerFilterFocus=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterFocus(this._column)},o.prototype.reloadHeaderFilter=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.reloadHeaderFilter(this._column)},o.prototype.setHeaderFilterValue=function(t){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterValue(this._column,t)},o.prototype.getNextColumn=function(){var t=this._column.nextColumn();return!!t&&t.getComponent()},o.prototype.getPrevColumn=function(){var t=this._column.prevColumn();return!!t&&t.getComponent()};var i=function t(e,o){var i=this;this.table=o.table,this.definition=e,this.parent=o,this.type="column",this.columns=[],this.cells=[],this.element=this.createElement(),this.contentElement=!1,this.groupElement=this.createGroupElement(),this.isGroup=!1,this.tooltip=!1,this.hozAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.setField(this.definition.field),this.checkDefinition(),this.modules={},this.cellEvents={cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1},this.width=null,this.widthStyled="",this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,this._mapDepricatedFunctionality(),e.columns?(this.isGroup=!0,e.columns.forEach(function(e,o){var n=new t(e,i);i.attachColumn(n)}),i.checkColumnVisibility()):o.registerColumnField(this),e.rowHandle&&!1!==this.table.options.movableRows&&this.table.modExists("moveRow")&&this.table.modules.moveRow.setHandle(!0),this._buildHeader()};i.prototype.createElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-col"),t.setAttribute("role","columnheader"),t.setAttribute("aria-sort","none"),t},i.prototype.createGroupElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-col-group-cols"),t},i.prototype.checkDefinition=function(){var t=this;Object.keys(this.definition).forEach(function(e){-1===t.defaultOptionList.indexOf(e)&&console.warn("Invalid column definition option in '"+(t.field||t.definition.title)+"' column:",e)})},i.prototype.setField=function(t){this.field=t,this.fieldStructure=t?this.table.options.nestedFieldSeparator?t.split(this.table.options.nestedFieldSeparator):[t]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNesteData:this._setFlatData},i.prototype.registerColumnPosition=function(t){this.parent.registerColumnPosition(t)},i.prototype.registerColumnField=function(t){this.parent.registerColumnField(t)},i.prototype.reRegisterPosition=function(){this.isGroup?this.columns.forEach(function(t){t.reRegisterPosition()}):this.registerColumnPosition(this)},i.prototype._mapDepricatedFunctionality=function(){void 0!==this.definition.hideInHtml&&(this.definition.htmlOutput=!this.definition.hideInHtml,console.warn("hideInHtml column definition property is depricated, you should now use htmlOutput"))},i.prototype.setTooltip=function(){var t=this,e=t.definition,o=e.headerTooltip||!1===e.tooltip?e.headerTooltip:t.table.options.tooltipsHeader;o?!0===o?e.field?t.table.modules.localize.bind("columns|"+e.field,function(o){t.element.setAttribute("title",o||e.title)}):t.element.setAttribute("title",e.title):("function"==typeof o&&!1===(o=o(t.getComponent()))&&(o=""),t.element.setAttribute("title",o)):t.element.setAttribute("title","")},i.prototype._buildHeader=function(){for(var t=this,e=t.definition;t.element.firstChild;)t.element.removeChild(t.element.firstChild);e.headerVertical&&(t.element.classList.add("tabulator-col-vertical"),"flip"===e.headerVertical&&t.element.classList.add("tabulator-col-vertical-flip")),t.contentElement=t._bindEvents(),t.contentElement=t._buildColumnHeaderContent(),t.element.appendChild(t.contentElement),t.isGroup?t._buildGroupHeader():t._buildColumnHeader(),t.setTooltip(),t.table.options.resizableColumns&&t.table.modExists("resizeColumns")&&t.table.modules.resizeColumns.initializeColumn("header",t,t.element),e.headerFilter&&t.table.modExists("filter")&&t.table.modExists("edit")&&(void 0!==e.headerFilterPlaceholder&&e.field&&t.table.modules.localize.setHeaderFilterColumnPlaceholder(e.field,e.headerFilterPlaceholder),t.table.modules.filter.initializeColumn(t)),t.table.modExists("frozenColumns")&&t.table.modules.frozenColumns.initializeColumn(t),t.table.options.movableColumns&&!t.isGroup&&t.table.modExists("moveColumn")&&t.table.modules.moveColumn.initializeColumn(t),(e.topCalc||e.bottomCalc)&&t.table.modExists("columnCalcs")&&t.table.modules.columnCalcs.initializeColumn(t),t.element.addEventListener("mouseenter",function(e){t.setTooltip()})},i.prototype._bindEvents=function(){var t,e,o,i=this,n=i.definition;"function"==typeof n.headerClick&&i.element.addEventListener("click",function(t){n.headerClick(t,i.getComponent())}),"function"==typeof n.headerDblClick&&i.element.addEventListener("dblclick",function(t){n.headerDblClick(t,i.getComponent())}),"function"==typeof n.headerContext&&i.element.addEventListener("contextmenu",function(t){n.headerContext(t,i.getComponent())}),"function"==typeof n.headerTap&&(o=!1,i.element.addEventListener("touchstart",function(t){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(t){o&&n.headerTap(t,i.getComponent()),o=!1})),"function"==typeof n.headerDblTap&&(t=null,i.element.addEventListener("touchend",function(e){t?(clearTimeout(t),t=null,n.headerDblTap(e,i.getComponent())):t=setTimeout(function(){clearTimeout(t),t=null},300)})),"function"==typeof n.headerTapHold&&(e=null,i.element.addEventListener("touchstart",function(t){clearTimeout(e),e=setTimeout(function(){clearTimeout(e),e=null,o=!1,n.headerTapHold(t,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(t){clearTimeout(e),e=null})),"function"==typeof n.cellClick&&(i.cellEvents.cellClick=n.cellClick),"function"==typeof n.cellDblClick&&(i.cellEvents.cellDblClick=n.cellDblClick),"function"==typeof n.cellContext&&(i.cellEvents.cellContext=n.cellContext),"function"==typeof n.cellMouseEnter&&(i.cellEvents.cellMouseEnter=n.cellMouseEnter),"function"==typeof n.cellMouseLeave&&(i.cellEvents.cellMouseLeave=n.cellMouseLeave),"function"==typeof n.cellMouseOver&&(i.cellEvents.cellMouseOver=n.cellMouseOver),"function"==typeof n.cellMouseOut&&(i.cellEvents.cellMouseOut=n.cellMouseOut),"function"==typeof n.cellMouseMove&&(i.cellEvents.cellMouseMove=n.cellMouseMove),"function"==typeof n.cellTap&&(i.cellEvents.cellTap=n.cellTap),"function"==typeof n.cellDblTap&&(i.cellEvents.cellDblTap=n.cellDblTap),"function"==typeof n.cellTapHold&&(i.cellEvents.cellTapHold=n.cellTapHold),"function"==typeof n.cellEdited&&(i.cellEvents.cellEdited=n.cellEdited),"function"==typeof n.cellEditing&&(i.cellEvents.cellEditing=n.cellEditing),"function"==typeof n.cellEditCancelled&&(i.cellEvents.cellEditCancelled=n.cellEditCancelled)},i.prototype._buildColumnHeader=function(){var t=this,e=t.definition,o=t.table;if(o.modExists("sort")&&o.modules.sort.initializeColumn(t,t.contentElement),o.modExists("format")&&o.modules.format.initializeColumn(t),void 0!==e.editor&&o.modExists("edit")&&o.modules.edit.initializeColumn(t),void 0!==e.validator&&o.modExists("validate")&&o.modules.validate.initializeColumn(t),o.modExists("mutator")&&o.modules.mutator.initializeColumn(t),o.modExists("accessor")&&o.modules.accessor.initializeColumn(t),_typeof(o.options.responsiveLayout)&&o.modExists("responsiveLayout")&&o.modules.responsiveLayout.initializeColumn(t),void 0!==e.visible&&(e.visible?t.show(!0):t.hide(!0)),e.cssClass){e.cssClass.split(" ").forEach(function(e){t.element.classList.add(e)})}e.field&&this.element.setAttribute("tabulator-field",e.field),t.setMinWidth(void 0===e.minWidth?t.table.options.columnMinWidth:parseInt(e.minWidth)),t.reinitializeWidth(),t.tooltip=t.definition.tooltip||!1===t.definition.tooltip?t.definition.tooltip:t.table.options.tooltips,t.hozAlign=void 0===t.definition.align?"":t.definition.align},i.prototype._buildColumnHeaderContent=function(){var t=this,e=(t.definition,t.table,document.createElement("div"));return e.classList.add("tabulator-col-content"),e.appendChild(t._buildColumnHeaderTitle()),e},i.prototype._buildColumnHeaderTitle=function(){var t=this,e=t.definition,o=t.table,i=document.createElement("div");if(i.classList.add("tabulator-col-title"),e.editableTitle){var n=document.createElement("input");n.classList.add("tabulator-title-editor"),n.addEventListener("click",function(t){t.stopPropagation(),n.focus()}),n.addEventListener("change",function(){e.title=n.value,o.options.columnTitleChanged.call(t.table,t.getComponent())}),i.appendChild(n),e.field?o.modules.localize.bind("columns|"+e.field,function(t){n.value=t||e.title||"&nbsp"}):n.value=e.title||"&nbsp"}else e.field?o.modules.localize.bind("columns|"+e.field,function(o){t._formatColumnHeaderTitle(i,o||e.title||"&nbsp")}):t._formatColumnHeaderTitle(i,e.title||"&nbsp");return i},i.prototype._formatColumnHeaderTitle=function(t,e){var o,i,n,s;if(this.definition.titleFormatter&&this.table.modExists("format"))switch(o=this.table.modules.format.getFormatter(this.definition.titleFormatter),s={getValue:function(){return e},getElement:function(){return t}},n=this.definition.titleFormatterParams||{},n="function"==typeof n?n():n,i=o.call(this.table.modules.format,s,n),void 0===i?"undefined":_typeof(i)){case"object":i instanceof Node?t.appendChild(i):(t.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",i));break;case"undefined":case"null":t.innerHTML="";break;default:t.innerHTML=i}else t.innerHTML=e},i.prototype._buildGroupHeader=function(){this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.element.appendChild(this.groupElement)},i.prototype._getFlatData=function(t){return t[this.field]},i.prototype._getNestedData=function(t){for(var e,o=t,i=this.fieldStructure,n=i.length,s=0;s<n&&(o=o[i[s]],e=o,o);s++);return e},i.prototype._setFlatData=function(t,e){this.field&&(t[this.field]=e)},i.prototype._setNesteData=function(t,e){for(var o=t,i=this.fieldStructure,n=i.length,s=0;s<n;s++)s==n-1?o[i[s]]=e:(o[i[s]]||(o[i[s]]={}),o=o[i[s]])},i.prototype.attachColumn=function(t){var e=this;e.groupElement?(e.columns.push(t),e.groupElement.appendChild(t.getElement())):console.warn("Column Warning - Column being attached to another column instead of column group")},i.prototype.verticalAlign=function(t,e){var o=this.parent.isGroup?this.parent.getGroupElement().clientHeight:e||this.parent.getHeadersElement().clientHeight;this.element.style.height=o+"px",this.isGroup&&(this.groupElement.style.minHeight=o-this.contentElement.offsetHeight+"px"),this.isGroup||"top"===t||(this.element.style.paddingTop="bottom"===t?this.element.clientHeight-this.contentElement.offsetHeight+"px":(this.element.clientHeight-this.contentElement.offsetHeight)/2+"px"),this.columns.forEach(function(e){e.verticalAlign(t)})},i.prototype.clearVerticalAlign=function(){this.element.style.paddingTop="",this.element.style.height="",this.element.style.minHeight="",this.groupElement.style.minHeight="",this.columns.forEach(function(t){t.clearVerticalAlign()})},i.prototype.getElement=function(){return this.element},i.prototype.getGroupElement=function(){return this.groupElement},i.prototype.getField=function(){return this.field},i.prototype.getFirstColumn=function(){return this.isGroup?!!this.columns.length&&this.columns[0].getFirstColumn():this},i.prototype.getLastColumn=function(){return this.isGroup?!!this.columns.length&&this.columns[this.columns.length-1].getLastColumn():this},i.prototype.getColumns=function(){return this.columns},i.prototype.getCells=function(){return this.cells},i.prototype.getTopColumn=function(){return this.parent.isGroup?this.parent.getTopColumn():this},i.prototype.getDefinition=function(t){var e=[];return this.isGroup&&t&&(this.columns.forEach(function(t){e.push(t.getDefinition(!0))}),this.definition.columns=e),this.definition},i.prototype.checkColumnVisibility=function(){var t=!1;this.columns.forEach(function(e){e.visible&&(t=!0)}),t?(this.show(),this.parent.table.options.columnVisibilityChanged.call(this.table,this.getComponent(),!1)):this.hide()},i.prototype.show=function(t,e){this.visible||(this.visible=!0,this.element.style.display="",this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(t){t.show()}),this.isGroup||null!==this.width||this.reinitializeWidth(),this.table.columnManager._verticalAlignHeaders(),this.table.options.persistentLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.persistence.save("columns"),!e&&this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.updateColumnVisibility(this,this.visible),t||this.table.options.columnVisibilityChanged.call(this.table,this.getComponent(),!0),this.parent.isGroup&&this.parent.matchChildWidths())},i.prototype.hide=function(t,e){this.visible&&(this.visible=!1,this.element.style.display="none",this.table.columnManager._verticalAlignHeaders(),this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(t){t.hide()}),this.table.options.persistentLayout&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("columns"),!e&&this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.updateColumnVisibility(this,this.visible),t||this.table.options.columnVisibilityChanged.call(this.table,this.getComponent(),!1),this.parent.isGroup&&this.parent.matchChildWidths())},i.prototype.matchChildWidths=function(){var t=0;this.contentElement&&this.columns.length&&(this.columns.forEach(function(e){e.visible&&(t+=e.getWidth())}),this.contentElement.style.maxWidth=t-1+"px")},i.prototype.setWidth=function(t){this.widthFixed=!0,this.setWidthActual(t)},i.prototype.setWidthActual=function(t){isNaN(t)&&(t=Math.floor(this.table.element.clientWidth/100*parseInt(t))),t=Math.max(this.minWidth,t),this.width=t,this.widthStyled=t?t+"px":"",this.element.style.width=this.widthStyled,this.isGroup||this.cells.forEach(function(t){t.setWidth()}),this.parent.isGroup&&this.parent.matchChildWidths(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()},i.prototype.checkCellHeights=function(){var t=[];this.cells.forEach(function(e){e.row.heightInitialized&&(null!==e.row.getElement().offsetParent?(t.push(e.row),e.row.clearCellHeight()):e.row.heightInitialized=!1)}),t.forEach(function(t){t.calcHeight()}),t.forEach(function(t){t.setCellHeight()})},i.prototype.getWidth=function(){return this.width},i.prototype.getHeight=function(){return this.element.offsetHeight},i.prototype.setMinWidth=function(t){this.minWidth=t,this.minWidthStyled=t?t+"px":"",this.element.style.minWidth=this.minWidthStyled,this.cells.forEach(function(t){t.setMinWidth()})},i.prototype.delete=function(){this.isGroup&&this.columns.forEach(function(t){t.delete()});for(var t=this.cells.length,e=0;e<t;e++)this.cells[0].delete();this.element.parentNode.removeChild(this.element),this.table.columnManager.deregisterColumn(this)},i.prototype.generateCell=function(t){var e=this,o=new l(e,t);return this.cells.push(o),o},i.prototype.nextColumn=function(){var t=this.table.columnManager.findColumnIndex(this);return t>-1&&this.table.columnManager.getColumnByIndex(t+1)},i.prototype.prevColumn=function(){var t=this.table.columnManager.findColumnIndex(this);return t>-1&&this.table.columnManager.getColumnByIndex(t-1)},i.prototype.reinitializeWidth=function(t){this.widthFixed=!1,void 0===this.definition.width||t||this.setWidth(this.definition.width),this.table.modExists("filter")&&this.table.modules.filter.hideHeaderFilterElements(),this.fitToData(),this.table.modExists("filter")&&this.table.modules.filter.showHeaderFilterElements()},i.prototype.fitToData=function(){var t=this;this.widthFixed||(this.element.style.width="",t.cells.forEach(function(t){t.clearWidth()}));var e=this.element.offsetWidth;t.width&&this.widthFixed||(t.cells.forEach(function(t){var o=t.getWidth();o>e&&(e=o)}),e&&t.setWidthActual(e+1))},i.prototype.deleteCell=function(t){var e=this.cells.indexOf(t);e>-1&&this.cells.splice(e,1)},i.prototype.defaultOptionList=["title","field","columns","visible","align","width","minWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","hideInHtml","print","htmlOutput","sorter","sorterParams","formatter","formatterParams","variableHeight","editable","editor","editorParams","validator","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","download","downloadTitle","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerTooltip","headerVertical","editableTitle","titleFormatter","titleFormatterParams","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter","print"],i.prototype.getComponent=function(){return new o(this)};var n=function(t){this.table=t,this.element=this.createHolderElement(),this.tableElement=this.createTableElement(),this.columnManager=null,this.height=0,this.firstRender=!1,this.renderMode="classic",this.rows=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.scrollTop=0,this.scrollLeft=0,this.vDomRowHeight=20,this.vDomTop=0,this.vDomBottom=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomMaxRenderChain=90,this.vDomWindowBuffer=0,this.vDomWindowMinTotalRows=20,this.vDomWindowMinMarginRows=5,this.vDomTopNewRows=[],this.vDomBottomNewRows=[]};n.prototype.createHolderElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-tableHolder"),t.setAttribute("tabindex",0),t},n.prototype.createTableElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-table"),t},n.prototype.getElement=function(){return this.element},n.prototype.getTableElement=function(){return this.tableElement},n.prototype.getRowPosition=function(t,e){return e?this.activeRows.indexOf(t):this.rows.indexOf(t)},n.prototype.setColumnManager=function(t){this.columnManager=t},n.prototype.initialize=function(){var t=this;t.setRenderMode(),t.element.appendChild(t.tableElement),t.firstRender=!0,t.element.addEventListener("scroll",function(){var e=t.element.scrollLeft;t.scrollLeft!=e&&(t.columnManager.scrollHorizontal(e),t.table.options.groupBy&&t.table.modules.groupRows.scrollHeaders(e),t.table.modExists("columnCalcs")&&t.table.modules.columnCalcs.scrollHorizontal(e)),t.scrollLeft=e}),"virtual"===this.renderMode&&t.element.addEventListener("scroll",function(){var e=t.element.scrollTop,o=t.scrollTop>e;t.scrollTop!=e?(t.scrollTop=e,t.scrollVertical(o),"scroll"==t.table.options.ajaxProgressiveLoad&&t.table.modules.ajax.nextPage(t.element.scrollHeight-t.element.clientHeight-e)):t.scrollTop=e})},n.prototype.findRow=function(t){var e=this;if("object"!=(void 0===t?"undefined":_typeof(t))){if(void 0===t||null===t)return!1;return e.rows.find(function(o){return o.data[e.table.options.index]==t})||!1}if(t instanceof r)return t;if(t instanceof s)return t._getSelf()||!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement){return e.rows.find(function(e){return e.element===t})||!1}return!1},n.prototype.getRowFromDataObject=function(t){return this.rows.find(function(e){return e.data===t})||!1},n.prototype.getRowFromPosition=function(t,e){return e?this.activeRows[t]:this.rows[t]},n.prototype.scrollToRow=function(t,e,o){var i,n=this,s=this.getDisplayRows().indexOf(t),r=t.getElement(),a=0;return new Promise(function(t,l){if(s>-1){if(void 0===e&&(e=n.table.options.scrollToRowPosition),void 0===o&&(o=n.table.options.scrollToRowIfVisible),"nearest"===e)switch(n.renderMode){case"classic":i=u.prototype.helpers.elOffset(r).top, e=Math.abs(n.element.scrollTop-i)>Math.abs(n.element.scrollTop+n.element.clientHeight-i)?"bottom":"top";break;case"virtual":e=Math.abs(n.vDomTop-s)>Math.abs(n.vDomBottom-s)?"bottom":"top"}if(!o&&u.prototype.helpers.elVisible(r)&&(a=u.prototype.helpers.elOffset(r).top-u.prototype.helpers.elOffset(n.element).top)>0&&a<n.element.clientHeight-r.offsetHeight)return!1;switch(n.renderMode){case"classic":n.element.scrollTop=u.prototype.helpers.elOffset(r).top-u.prototype.helpers.elOffset(n.element).top+n.element.scrollTop;break;case"virtual":n._virtualRenderFill(s,!0)}switch(e){case"middle":case"center":n.element.scrollTop=n.element.scrollTop-n.element.clientHeight/2;break;case"bottom":n.element.scrollTop=n.element.scrollTop-n.element.clientHeight+r.offsetHeight}t()}else console.warn("Scroll Error - Row not visible"),l("Scroll Error - Row not visible")})},n.prototype.setData=function(t,e){var o=this,i=this;return new Promise(function(n,s){e&&o.getDisplayRows().length?i.table.options.pagination?i._setDataActual(t,!0):o.reRenderInPosition(function(){i._setDataActual(t)}):(o.table.options.autoColumns&&o.table.columnManager.generateColumnsFromRowData(t),o.resetScroll(),o._setDataActual(t)),n()})},n.prototype._setDataActual=function(t,e){var o=this;o.table.options.dataLoading.call(this.table,t),this._wipeElements(),this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.clear(),Array.isArray(t)?(this.table.modExists("selectRow")&&this.table.modules.selectRow.clearSelectionData(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchData(t),t.forEach(function(t,e){if(t&&"object"===(void 0===t?"undefined":_typeof(t))){var i=new r(t,o);o.rows.push(i)}else console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:",t)}),o.table.options.dataLoaded.call(this.table,t),o.refreshActiveData(!1,!1,e)):console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ",void 0===t?"undefined":_typeof(t),"\nData: ",t)},n.prototype._wipeElements=function(){this.rows.forEach(function(t){t.wipe()}),this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.wipe(),this.rows=[]},n.prototype.deleteRow=function(t,e){var o=this.rows.indexOf(t),i=this.activeRows.indexOf(t);i>-1&&this.activeRows.splice(i,1),o>-1&&this.rows.splice(o,1),this.setActiveRows(this.activeRows),this.displayRowIterator(function(e){var o=e.indexOf(t);o>-1&&e.splice(o,1)}),e||this.reRenderInPosition(),this.table.options.rowDeleted.call(this.table,t.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.groupRows.updateGroupRows(!0):this.table.options.pagination&&this.table.modExists("page")?this.refreshActiveData(!1,!1,!0):this.table.options.pagination&&this.table.modExists("page")&&this.refreshActiveData("page")},n.prototype.addRow=function(t,e,o,i){var n=this.addRowActual(t,e,o,i);return this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowAdd",n,{data:t,pos:e,index:o}),n},n.prototype.addRows=function(t,e,o){var i=this,n=this,s=0,r=[];return new Promise(function(a,l){e=i.findAddRowPos(e),Array.isArray(t)||(t=[t]),s=t.length-1,(void 0===o&&e||void 0!==o&&!e)&&t.reverse(),t.forEach(function(t,i){var s=n.addRow(t,e,o,!0);r.push(s)}),i.table.options.groupBy&&i.table.modExists("groupRows")?i.table.modules.groupRows.updateGroupRows(!0):i.table.options.pagination&&i.table.modExists("page")?i.refreshActiveData(!1,!1,!0):i.reRenderInPosition(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),a(r)})},n.prototype.findAddRowPos=function(t){return void 0===t&&(t=this.table.options.addRowPos),"pos"===t&&(t=!0),"bottom"===t&&(t=!1),t},n.prototype.addRowActual=function(t,e,o,i){var n,s=t instanceof r?t:new r(t||{},this),a=this.findAddRowPos(e);if(!o&&this.table.options.pagination&&"page"==this.table.options.paginationAddRow&&(n=this.getDisplayRows(),a?n.length?o=n[0]:this.activeRows.length&&(o=this.activeRows[this.activeRows.length-1],a=!1):n.length&&(o=n[n.length-1],a=!(n.length<this.table.modules.page.getPageSize()))),o&&(o=this.findRow(o)),this.table.options.groupBy&&this.table.modExists("groupRows")){this.table.modules.groupRows.assignRowToGroup(s);var l=s.getGroup().rows;l.length>1&&(!o||o&&-1==l.indexOf(o)?a?l[0]!==s&&(o=l[0],this._moveRowInArray(s.getGroup().rows,s,o,a)):l[l.length-1]!==s&&(o=l[l.length-1],this._moveRowInArray(s.getGroup().rows,s,o,a)):this._moveRowInArray(s.getGroup().rows,s,o,a))}if(o){var c=this.rows.indexOf(o),u=this.activeRows.indexOf(o);this.displayRowIterator(function(t){var e=t.indexOf(o);e>-1&&t.splice(a?e:e+1,0,s)}),u>-1&&this.activeRows.splice(a?u:u+1,0,s),c>-1&&this.rows.splice(a?c:c+1,0,s)}else a?(this.displayRowIterator(function(t){t.unshift(s)}),this.activeRows.unshift(s),this.rows.unshift(s)):(this.displayRowIterator(function(t){t.push(s)}),this.activeRows.push(s),this.rows.push(s));return this.setActiveRows(this.activeRows),this.table.options.rowAdded.call(this.table,s.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),i||this.reRenderInPosition(),s},n.prototype.moveRow=function(t,e,o){this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowMove",t,{pos:this.getRowPosition(t),to:e,after:o}),this.moveRowActual(t,e,o),this.table.options.rowMoved.call(this.table,t.getComponent())},n.prototype.moveRowActual=function(t,e,o){var i=this;if(this._moveRowInArray(this.rows,t,e,o),this._moveRowInArray(this.activeRows,t,e,o),this.displayRowIterator(function(n){i._moveRowInArray(n,t,e,o)}),this.table.options.groupBy&&this.table.modExists("groupRows")){var n=e.getGroup(),s=t.getGroup();n===s?this._moveRowInArray(n.rows,t,e,o):(s&&s.removeRow(t),n.insertRow(t,e,o))}},n.prototype._moveRowInArray=function(t,e,o,i){var n,s,r,a;if(e!==o&&(n=t.indexOf(e),n>-1&&(t.splice(n,1),s=t.indexOf(o),s>-1?i?t.splice(s+1,0,e):t.splice(s,0,e):t.splice(n,0,e)),t===this.getDisplayRows())){r=n<s?n:s,a=s>n?s:n+1;for(var l=r;l<=a;l++)t[l]&&this.styleRow(t[l],l)}},n.prototype.clearData=function(){this.setData([])},n.prototype.getRowIndex=function(t){return this.findRowIndex(t,this.rows)},n.prototype.getDisplayRowIndex=function(t){var e=this.getDisplayRows().indexOf(t);return e>-1&&e},n.prototype.nextDisplayRow=function(t,e){var o=this.getDisplayRowIndex(t),i=!1;return!1!==o&&o<this.displayRowsCount-1&&(i=this.getDisplayRows()[o+1]),!i||i instanceof r&&"row"==i.type?i:this.nextDisplayRow(i,e)},n.prototype.prevDisplayRow=function(t,e){var o=this.getDisplayRowIndex(t),i=!1;return o&&(i=this.getDisplayRows()[o-1]),!i||i instanceof r&&"row"==i.type?i:this.prevDisplayRow(i,e)},n.prototype.findRowIndex=function(t,e){var o;return!!((t=this.findRow(t))&&(o=e.indexOf(t))>-1)&&o},n.prototype.getData=function(t,e){var o=this,i=[];return(t?o.activeRows:o.rows).forEach(function(t){i.push(t.getData(e||"data"))}),i},n.prototype.getComponents=function(t){var e=this,o=[];return(t?e.activeRows:e.rows).forEach(function(t){o.push(t.getComponent())}),o},n.prototype.getDataCount=function(t){return t?this.activeRows.length:this.rows.length},n.prototype._genRemoteRequest=function(){var t=this,e=t.table,o=e.options,i={};if(e.modExists("page")){if(o.ajaxSorting){var n=t.table.modules.sort.getSort();n.forEach(function(t){delete t.column}),i[t.table.modules.page.paginationDataSentNames.sorters]=n}if(o.ajaxFiltering){var s=t.table.modules.filter.getFilters(!0,!0);i[t.table.modules.page.paginationDataSentNames.filters]=s}t.table.modules.ajax.setParams(i,!0)}e.modules.ajax.sendRequest().then(function(e){t.setData(e)}).catch(function(t){})},n.prototype.filterRefresh=function(){var t=this.table,e=t.options,o=this.scrollLeft;e.ajaxFiltering?"remote"==e.pagination&&t.modExists("page")?(t.modules.page.reset(!0),t.modules.page.setPage(1).then(function(){}).catch(function(){})):e.ajaxProgressiveLoad?t.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData("filter"),this.scrollHorizontal(o)},n.prototype.sorterRefresh=function(t){var e=this.table,o=this.table.options,i=this.scrollLeft;o.ajaxSorting?("remote"==o.pagination||o.progressiveLoad)&&e.modExists("page")?(e.modules.page.reset(!0),e.modules.page.setPage(1).then(function(){}).catch(function(){})):o.ajaxProgressiveLoad?e.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData(t?"filter":"sort"),this.scrollHorizontal(i)},n.prototype.scrollHorizontal=function(t){this.scrollLeft=t,this.element.scrollLeft=t,this.table.options.groupBy&&this.table.modules.groupRows.scrollHeaders(t),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.scrollHorizontal(t)},n.prototype.refreshActiveData=function(t,e,o){var i,n=this,s=this.table;switch(n.table.modExists("edit")&&n.table.modules.edit.cancelEdit(),t||(t="all"),s.options.selectable&&!s.options.selectablePersistence&&s.modExists("selectRow")&&s.modules.selectRow.deselectRows(),t){case"all":case"filter":e?e=!1:s.modExists("filter")?n.setActiveRows(s.modules.filter.filter(n.rows)):n.setActiveRows(n.rows.slice(0));case"sort":e?e=!1:s.modExists("sort")&&s.modules.sort.sort(this.activeRows);case"display":this.resetDisplayRows();case"freeze":e?e=!1:this.table.modExists("frozenRows")&&s.modules.frozenRows.isFrozen()&&(s.modules.frozenRows.getDisplayIndex()||s.modules.frozenRows.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.frozenRows.getDisplayIndex(),!0!==(i=n.setDisplayRows(s.modules.frozenRows.getRows(this.getDisplayRows(i-1)),i))&&s.modules.frozenRows.setDisplayIndex(i));case"group":e?e=!1:s.options.groupBy&&s.modExists("groupRows")&&(s.modules.groupRows.getDisplayIndex()||s.modules.groupRows.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.groupRows.getDisplayIndex(),!0!==(i=n.setDisplayRows(s.modules.groupRows.getRows(this.getDisplayRows(i-1)),i))&&s.modules.groupRows.setDisplayIndex(i));case"tree":e?e=!1:s.options.dataTree&&s.modExists("dataTree")&&(s.modules.dataTree.getDisplayIndex()||s.modules.dataTree.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.dataTree.getDisplayIndex(),!0!==(i=n.setDisplayRows(s.modules.dataTree.getRows(this.getDisplayRows(i-1)),i))&&s.modules.dataTree.setDisplayIndex(i)),s.options.pagination&&s.modExists("page")&&!o&&"local"==s.modules.page.getMode()&&s.modules.page.reset();case"page":e?e=!1:s.options.pagination&&s.modExists("page")&&(s.modules.page.getDisplayIndex()||s.modules.page.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.page.getDisplayIndex(),"local"==s.modules.page.getMode()&&s.modules.page.setMaxRows(this.getDisplayRows(i-1).length),!0!==(i=n.setDisplayRows(s.modules.page.getRows(this.getDisplayRows(i-1)),i))&&s.modules.page.setDisplayIndex(i))}u.prototype.helpers.elVisible(n.element)&&(o?n.reRenderInPosition():(n.renderTable(),s.options.layoutColumnsOnNewData&&n.table.columnManager.redraw(!0))),s.modExists("columnCalcs")&&s.modules.columnCalcs.recalc(this.activeRows)},n.prototype.setActiveRows=function(t){this.activeRows=t,this.activeRowsCount=this.activeRows.length},n.prototype.resetDisplayRows=function(){this.displayRows=[],this.displayRows.push(this.activeRows.slice(0)),this.displayRowsCount=this.displayRows[0].length,this.table.modExists("frozenRows")&&this.table.modules.frozenRows.setDisplayIndex(0),this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.setDisplayIndex(0),this.table.options.pagination&&this.table.modExists("page")&&this.table.modules.page.setDisplayIndex(0)},n.prototype.getNextDisplayIndex=function(){return this.displayRows.length},n.prototype.setDisplayRows=function(t,e){var o=!0;return e&&void 0!==this.displayRows[e]?(this.displayRows[e]=t,o=!0):(this.displayRows.push(t),o=e=this.displayRows.length-1),e==this.displayRows.length-1&&(this.displayRowsCount=this.displayRows[this.displayRows.length-1].length),o},n.prototype.getDisplayRows=function(t){return void 0===t?this.displayRows.length?this.displayRows[this.displayRows.length-1]:[]:this.displayRows[t]||[]},n.prototype.getVisibleRows=function(t){var e=this.element.scrollTop,o=this.element.clientHeight+e,i=!1,n=0,s=0,r=this.getDisplayRows();if(t){this.getDisplayRows();for(var a=this.vDomTop;a<=this.vDomBottom;a++)if(r[a])if(i){if(!(o-r[a].getElement().offsetTop>=0))break;s=a}else e-r[a].getElement().offsetTop>=0?n=a:i=!0}else n=this.vDomTop,s=this.vDomBottom;return r.slice(n,s+1)},n.prototype.displayRowIterator=function(t){this.displayRows.forEach(t),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length},n.prototype.getRows=function(){return this.rows},n.prototype.reRenderInPosition=function(t){if("virtual"==this.getRenderMode()){for(var e=this.element.scrollTop,o=!1,i=!1,n=this.scrollLeft,s=this.getDisplayRows(),r=this.vDomTop;r<=this.vDomBottom;r++)if(s[r]){var a=e-s[r].getElement().offsetTop;if(!(!1===i||Math.abs(a)<i))break;i=a,o=r}t&&t(),this._virtualRenderFill(!1===o?this.displayRowsCount-1:o,!0,i||0),this.scrollHorizontal(n)}else this.renderTable(),t&&t()},n.prototype.setRenderMode=function(){(this.table.element.clientHeight||this.table.options.height)&&this.table.options.virtualDom?this.renderMode="virtual":this.renderMode="classic"},n.prototype.getRenderMode=function(){return this.renderMode},n.prototype.renderTable=function(){var t=this;switch(t.table.options.renderStarted.call(this.table),t.element.scrollTop=0,t.renderMode){case"classic":t._simpleRender();break;case"virtual":t._virtualRenderFill()}t.firstRender&&(t.displayRowsCount?(t.firstRender=!1,t.table.modules.layout.layout()):t.renderEmptyScroll()),t.table.modExists("frozenColumns")&&t.table.modules.frozenColumns.layout(),t.displayRowsCount||t.table.options.placeholder&&(this.renderMode&&t.table.options.placeholder.setAttribute("tabulator-render-mode",this.renderMode),t.getElement().appendChild(t.table.options.placeholder)),t.table.options.renderComplete.call(this.table)},n.prototype._simpleRender=function(){this._clearVirtualDom(),this.displayRowsCount?this.checkClassicModeGroupHeaderWidth():this.renderEmptyScroll()},n.prototype.checkClassicModeGroupHeaderWidth=function(){var t=this,e=this.tableElement,o=!0;t.getDisplayRows().forEach(function(i,n){t.styleRow(i,n),e.appendChild(i.getElement()),i.initialize(!0),"group"!==i.type&&(o=!1)}),e.style.minWidth=o?t.table.columnManager.getWidth()+"px":""},n.prototype.renderEmptyScroll=function(){this.tableElement.style.minWidth=this.table.columnManager.getWidth()+"px",this.tableElement.style.minHeight="1px",this.tableElement.style.visibility="hidden"},n.prototype._clearVirtualDom=function(){var t=this.tableElement;for(this.table.options.placeholder&&this.table.options.placeholder.parentNode&&this.table.options.placeholder.parentNode.removeChild(this.table.options.placeholder);t.firstChild;)t.removeChild(t.firstChild);t.style.paddingTop="",t.style.paddingBottom="",t.style.minWidth="",t.style.minHeight="",t.style.visibility="",this.scrollTop=0,this.scrollLeft=0,this.vDomTop=0,this.vDomBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0},n.prototype.styleRow=function(t,e){var o=t.getElement();e%2?(o.classList.add("tabulator-row-even"),o.classList.remove("tabulator-row-odd")):(o.classList.add("tabulator-row-odd"),o.classList.remove("tabulator-row-even"))},n.prototype._virtualRenderFill=function(t,e,o){var i=this,n=i.tableElement,s=i.element,r=0,a=0,l=0,c=0,d=!0,h=i.getDisplayRows();if(t=t||0,o=o||0,t){for(;n.firstChild;)n.removeChild(n.firstChild);var p=(i.displayRowsCount-t+1)*i.vDomRowHeight;p<i.height&&(t-=Math.ceil((i.height-p)/i.vDomRowHeight))<0&&(t=0),r=Math.min(Math.max(Math.floor(i.vDomWindowBuffer/i.vDomRowHeight),i.vDomWindowMinMarginRows),t),t-=r}else i._clearVirtualDom();if(i.displayRowsCount&&u.prototype.helpers.elVisible(i.element)){for(i.vDomTop=t,i.vDomBottom=t-1;(a<=i.height+i.vDomWindowBuffer||c<i.vDomWindowMinTotalRows)&&i.vDomBottom<i.displayRowsCount-1;){var m=i.vDomBottom+1,f=h[m],g=0;i.styleRow(f,m),n.appendChild(f.getElement()),f.initialized?f.heightInitialized||f.normalizeHeight(!0):f.initialize(!0),g=f.getHeight(),c<r?l+=g:a+=g,g>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*g),"group"!==f.type&&(d=!1),i.vDomBottom++,c++}t?(i.vDomTopPad=e?i.vDomRowHeight*this.vDomTop+o:i.scrollTop-l,i.vDomBottomPad=i.vDomBottom==i.displayRowsCount-1?0:Math.max(i.vDomScrollHeight-i.vDomTopPad-a-l,0)):(this.vDomTopPad=0,i.vDomRowHeight=Math.floor((a+l)/c),i.vDomBottomPad=i.vDomRowHeight*(i.displayRowsCount-i.vDomBottom-1),i.vDomScrollHeight=l+a+i.vDomBottomPad-i.height),n.style.paddingTop=i.vDomTopPad+"px",n.style.paddingBottom=i.vDomBottomPad+"px",e&&(this.scrollTop=i.vDomTopPad+l+o-(this.element.scrollWidth>this.element.clientWidth?this.element.offsetHeight-this.element.clientHeight:0)),this.scrollTop=Math.min(this.scrollTop,this.element.scrollHeight-this.height),this.element.scrollWidth>this.element.offsetWidth&&e&&(this.scrollTop+=this.element.offsetHeight-this.element.clientHeight),this.vDomScrollPosTop=this.scrollTop,this.vDomScrollPosBottom=this.scrollTop,s.scrollTop=this.scrollTop,n.style.minWidth=d?i.table.columnManager.getWidth()+"px":"",i.table.options.groupBy&&"fitDataFill"!=i.table.modules.layout.getMode()&&i.displayRowsCount==i.table.modules.groupRows.countGroups()&&(i.tableElement.style.minWidth=i.table.columnManager.getWidth())}else this.renderEmptyScroll()},n.prototype.scrollVertical=function(t){var e=this.scrollTop-this.vDomScrollPosTop,o=this.scrollTop-this.vDomScrollPosBottom,i=2*this.vDomWindowBuffer;if(-e>i||o>i){var n=this.scrollLeft;this._virtualRenderFill(Math.floor(this.element.scrollTop/this.element.scrollHeight*this.displayRowsCount)),this.scrollHorizontal(n)}else t?(e<0&&this._addTopRow(-e),o<0&