UNPKG

tabulator-tables

Version:

Interactive table generation JavaScript library

3 lines 116 kB
/* Tabulator v4.3.0 (c) Oliver Folkerd */ "use strict";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};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 l=e[n];if(t.call(i,l,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 l=e[n];if(t.call(i,l,n,e))return l;n++}}});var ColumnManager=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)};ColumnManager.prototype.createHeadersElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-headers"),t},ColumnManager.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},ColumnManager.prototype.initialize=function(){},ColumnManager.prototype.setRowManager=function(t){this.rowManager=t},ColumnManager.prototype.getElement=function(){return this.element},ColumnManager.prototype.getHeadersElement=function(){return this.headersElement},ColumnManager.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()},ColumnManager.prototype.generateColumnsFromRowData=function(t){var e,o,i=[];if(t&&t.length){e=t[0];for(var n in e){var l={field:n,title:n},s=e[n];switch(void 0===s?"undefined":_typeof(s)){case"undefined":o="string";break;case"boolean":o="boolean";break;case"object":o=Array.isArray(s)?"array":"string";break;default:o=isNaN(s)||""===s?s.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?"alphanum":"string":"number"}l.sorter=o,i.push(l)}this.table.options.columns=i,this.setColumns(this.table.options.columns)}},ColumnManager.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)},ColumnManager.prototype._addColumn=function(t,e,o){var i=new Column(t,this),n=i.getElement(),l=o?this.findColumnIndex(o):o;if(o&&l>-1){var s=this.columns.indexOf(o.getTopColumn()),a=o.getElement();e?(this.columns.splice(s,0,i),a.parentNode.insertBefore(n,a)):(this.columns.splice(s+1,0,i),a.parentNode.insertBefore(n,a.nextSibling))}else e?(this.columns.unshift(i),this.headersElement.insertBefore(i.getElement(),this.headersElement.firstChild)):(this.columns.push(i),this.headersElement.appendChild(i.getElement()));return i},ColumnManager.prototype.registerColumnField=function(t){t.definition.field&&(this.columnsByField[t.definition.field]=t)},ColumnManager.prototype.registerColumnPosition=function(t){this.columnsByIndex.push(t)},ColumnManager.prototype._reIndexColumns=function(){this.columnsByIndex=[],this.columns.forEach(function(t){t.reRegisterPosition()})},ColumnManager.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()},ColumnManager.prototype.findColumn=function(t){var e=this;if("object"!=(void 0===t?"undefined":_typeof(t)))return this.columnsByField[t]||!1;if(t instanceof Column)return t;if(t instanceof ColumnComponent)return t._getSelf()||!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement){return e.columns.find(function(e){return e.element===t})||!1}return!1},ColumnManager.prototype.getColumnByField=function(t){return this.columnsByField[t]},ColumnManager.prototype.getColumnByIndex=function(t){return this.columnsByIndex[t]},ColumnManager.prototype.getFirstVisibileColumn=function(t){var t=this.columnsByIndex.findIndex(function(t){return t.visible});return t>-1&&this.columnsByIndex[t]},ColumnManager.prototype.getColumns=function(){return this.columns},ColumnManager.prototype.findColumnIndex=function(t){return this.columnsByIndex.findIndex(function(e){return t===e})},ColumnManager.prototype.getRealColumns=function(){return this.columnsByIndex},ColumnManager.prototype.traverse=function(t){this.columnsByIndex.forEach(function(e,o){t(e,o)})},ColumnManager.prototype.getDefinitions=function(t){var e=this,o=[];return e.columnsByIndex.forEach(function(e){(!t||t&&e.visible)&&o.push(e.getDefinition())}),o},ColumnManager.prototype.getDefinitionTree=function(){var t=this,e=[];return t.columns.forEach(function(t){e.push(t.getDefinition(!0))}),e},ColumnManager.prototype.getComponents=function(t){var e=this,o=[];return(t?e.columns:e.columnsByIndex).forEach(function(t){o.push(t.getComponent())}),o},ColumnManager.prototype.getWidth=function(){var t=0;return this.columnsByIndex.forEach(function(e){e.visible&&(t+=e.getWidth())}),t},ColumnManager.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")},ColumnManager.prototype._moveColumnInArray=function(t,e,o,i,n){var l,s=t.indexOf(e);s>-1&&(t.splice(s,1),l=t.indexOf(o),l>-1?i&&(l+=1):l=s,t.splice(l,0,e),n&&this.table.rowManager.rows.forEach(function(t){if(t.cells.length){var e=t.cells.splice(s,1)[0];t.cells.splice(l,0,e)}}))},ColumnManager.prototype.scrollToColumn=function(t,e,o){var i=this,n=0,l=0,s=0,a=t.getElement();return new Promise(function(r,u){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":s=-i.element.clientWidth/2;break;case"right":s=a.clientWidth-i.headersElement.clientWidth}if(!o&&(l=a.offsetLeft)>0&&l+a.offsetWidth<i.element.clientWidth)return!1;n=a.offsetLeft+i.element.scrollLeft+s,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),r()}else console.warn("Scroll Error - Column not visible"),u("Scroll Error - Column not visible")})},ColumnManager.prototype.generateCells=function(t){var e=this,o=[];return e.columnsByIndex.forEach(function(e){o.push(e.generateCell(t))}),o},ColumnManager.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,l,s;i.visible&&(n=i.definition.width||0,l=void 0===i.minWidth?t.table.options.columnMinWidth:parseInt(i.minWidth),s="string"==typeof n?n.indexOf("%")>-1?e/100*parseInt(n):parseInt(n):n,o+=s>l?s:l)}),o},ColumnManager.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()},ColumnManager.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()},ColumnManager.prototype.redraw=function(t){t&&(Tabulator.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 ColumnComponent=function(t){this._column=t,this.type="ColumnComponent"};ColumnComponent.prototype.getElement=function(){return this._column.getElement()},ColumnComponent.prototype.getDefinition=function(){return this._column.getDefinition()},ColumnComponent.prototype.getField=function(){return this._column.getField()},ColumnComponent.prototype.getCells=function(){var t=[];return this._column.cells.forEach(function(e){t.push(e.getComponent())}),t},ColumnComponent.prototype.getVisibility=function(){return this._column.visible},ColumnComponent.prototype.show=function(){this._column.isGroup?this._column.columns.forEach(function(t){t.show()}):this._column.show()},ColumnComponent.prototype.hide=function(){this._column.isGroup?this._column.columns.forEach(function(t){t.hide()}):this._column.hide()},ColumnComponent.prototype.toggle=function(){this._column.visible?this.hide():this.show()},ColumnComponent.prototype.delete=function(){this._column.delete()},ColumnComponent.prototype.getSubColumns=function(){var t=[];return this._column.columns.length&&this._column.columns.forEach(function(e){t.push(e.getComponent())}),t},ColumnComponent.prototype.getParentColumn=function(){return this._column.parent instanceof Column&&this._column.parent.getComponent()},ColumnComponent.prototype._getSelf=function(){return this._column},ColumnComponent.prototype.scrollTo=function(){return this._column.table.columnManager.scrollToColumn(this._column)},ColumnComponent.prototype.getTable=function(){return this._column.table},ColumnComponent.prototype.headerFilterFocus=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterFocus(this._column)},ColumnComponent.prototype.reloadHeaderFilter=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.reloadHeaderFilter(this._column)},ColumnComponent.prototype.setHeaderFilterValue=function(t){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterValue(this._column,t)},ColumnComponent.prototype.getNextColumn=function(){var t=this._column.nextColumn();return!!t&&t.getComponent()},ColumnComponent.prototype.getPrevColumn=function(){var t=this._column.prevColumn();return!!t&&t.getComponent()};var Column=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()};Column.prototype.createElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-col"),t.setAttribute("role","columnheader"),t.setAttribute("aria-sort","none"),t},Column.prototype.createGroupElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-col-group-cols"),t},Column.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)})},Column.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},Column.prototype.registerColumnPosition=function(t){this.parent.registerColumnPosition(t)},Column.prototype.registerColumnField=function(t){this.parent.registerColumnField(t)},Column.prototype.reRegisterPosition=function(){this.isGroup?this.columns.forEach(function(t){t.reRegisterPosition()}):this.registerColumnPosition(this)},Column.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"))},Column.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","")},Column.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()})},Column.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)},Column.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},Column.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},Column.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},Column.prototype._formatColumnHeaderTitle=function(t,e){var o,i,n,l;if(this.definition.titleFormatter&&this.table.modExists("format"))switch(o=this.table.modules.format.getFormatter(this.definition.titleFormatter),l={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,l,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},Column.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)},Column.prototype._getFlatData=function(t){return t[this.field]},Column.prototype._getNestedData=function(t){for(var e,o=t,i=this.fieldStructure,n=i.length,l=0;l<n&&(o=o[i[l]],e=o,o);l++);return e},Column.prototype._setFlatData=function(t,e){this.field&&(t[this.field]=e)},Column.prototype._setNesteData=function(t,e){for(var o=t,i=this.fieldStructure,n=i.length,l=0;l<n;l++)l==n-1?o[i[l]]=e:(o[i[l]]||(o[i[l]]={}),o=o[i[l]])},Column.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")},Column.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)})},Column.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()})},Column.prototype.getElement=function(){return this.element},Column.prototype.getGroupElement=function(){return this.groupElement},Column.prototype.getField=function(){return this.field},Column.prototype.getFirstColumn=function(){return this.isGroup?!!this.columns.length&&this.columns[0].getFirstColumn():this},Column.prototype.getLastColumn=function(){return this.isGroup?!!this.columns.length&&this.columns[this.columns.length-1].getLastColumn():this},Column.prototype.getColumns=function(){return this.columns},Column.prototype.getCells=function(){return this.cells},Column.prototype.getTopColumn=function(){return this.parent.isGroup?this.parent.getTopColumn():this},Column.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},Column.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()},Column.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())},Column.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())},Column.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")},Column.prototype.setWidth=function(t){this.widthFixed=!0,this.setWidthActual(t)},Column.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()},Column.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()})},Column.prototype.getWidth=function(){return this.width},Column.prototype.getHeight=function(){return this.element.offsetHeight},Column.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()})},Column.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)},Column.prototype.generateCell=function(t){var e=this,o=new Cell(e,t);return this.cells.push(o),o},Column.prototype.nextColumn=function(){var t=this.table.columnManager.findColumnIndex(this);return t>-1&&this.table.columnManager.getColumnByIndex(t+1)},Column.prototype.prevColumn=function(){var t=this.table.columnManager.findColumnIndex(this);return t>-1&&this.table.columnManager.getColumnByIndex(t-1)},Column.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()},Column.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))},Column.prototype.deleteCell=function(t){var e=this.cells.indexOf(t);e>-1&&this.cells.splice(e,1)},Column.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"],Column.prototype.getComponent=function(){return new ColumnComponent(this)};var RowManager=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=[]};RowManager.prototype.createHolderElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-tableHolder"),t.setAttribute("tabindex",0),t},RowManager.prototype.createTableElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-table"),t},RowManager.prototype.getElement=function(){return this.element},RowManager.prototype.getTableElement=function(){return this.tableElement},RowManager.prototype.getRowPosition=function(t,e){return e?this.activeRows.indexOf(t):this.rows.indexOf(t)},RowManager.prototype.setColumnManager=function(t){this.columnManager=t},RowManager.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})},RowManager.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 Row)return t;if(t instanceof RowComponent)return t._getSelf()||!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement){return e.rows.find(function(e){return e.element===t})||!1}return!1},RowManager.prototype.getRowFromDataObject=function(t){return this.rows.find(function(e){return e.data===t})||!1},RowManager.prototype.getRowFromPosition=function(t,e){return e?this.activeRows[t]:this.rows[t]},RowManager.prototype.scrollToRow=function(t,e,o){var i,n=this,l=this.getDisplayRows().indexOf(t),s=t.getElement(),a=0;return new Promise(function(t,r){if(l>-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=Tabulator.prototype.helpers.elOffset(s).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-l)>Math.abs(n.vDomBottom-l)?"bottom":"top"}if(!o&&Tabulator.prototype.helpers.elVisible(s)&&(a=Tabulator.prototype.helpers.elOffset(s).top-Tabulator.prototype.helpers.elOffset(n.element).top)>0&&a<n.element.clientHeight-s.offsetHeight)return!1;switch(n.renderMode){case"classic":n.element.scrollTop=Tabulator.prototype.helpers.elOffset(s).top-Tabulator.prototype.helpers.elOffset(n.element).top+n.element.scrollTop;break;case"virtual":n._virtualRenderFill(l,!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+s.offsetHeight}t()}else console.warn("Scroll Error - Row not visible"),r("Scroll Error - Row not visible")})},RowManager.prototype.setData=function(t,e){var o=this,i=this;return new Promise(function(n,l){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()})},RowManager.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 Row(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)},RowManager.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=[]},RowManager.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")},RowManager.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},RowManager.prototype.addRows=function(t,e,o){var i=this,n=this,l=0,s=[];return new Promise(function(a,r){e=i.findAddRowPos(e),Array.isArray(t)||(t=[t]),l=t.length-1,(void 0===o&&e||void 0!==o&&!e)&&t.reverse(),t.forEach(function(t,i){var l=n.addRow(t,e,o,!0);s.push(l)}),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(s)})},RowManager.prototype.findAddRowPos=function(t){return void 0===t&&(t=this.table.options.addRowPos),"pos"===t&&(t=!0),"bottom"===t&&(t=!1),t},RowManager.prototype.addRowActual=function(t,e,o,i){var n,l=t instanceof Row?t:new Row(t||{},this),s=this.findAddRowPos(e);if(!o&&this.table.options.pagination&&"page"==this.table.options.paginationAddRow&&(n=this.getDisplayRows(),s?n.length?o=n[0]:this.activeRows.length&&(o=this.activeRows[this.activeRows.length-1],s=!1):n.length&&(o=n[n.length-1],s=!(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(l);var a=l.getGroup().rows;a.length>1&&(!o||o&&-1==a.indexOf(o)?s?a[0]!==l&&(o=a[0],this._moveRowInArray(l.getGroup().rows,l,o,s)):a[a.length-1]!==l&&(o=a[a.length-1],this._moveRowInArray(l.getGroup().rows,l,o,s)):this._moveRowInArray(l.getGroup().rows,l,o,s))}if(o){var r=this.rows.indexOf(o),u=this.activeRows.indexOf(o);this.displayRowIterator(function(t){var e=t.indexOf(o);e>-1&&t.splice(s?e:e+1,0,l)}),u>-1&&this.activeRows.splice(s?u:u+1,0,l),r>-1&&this.rows.splice(s?r:r+1,0,l)}else s?(this.displayRowIterator(function(t){t.unshift(l)}),this.activeRows.unshift(l),this.rows.unshift(l)):(this.displayRowIterator(function(t){t.push(l)}),this.activeRows.push(l),this.rows.push(l));return this.setActiveRows(this.activeRows),this.table.options.rowAdded.call(this.table,l.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),i||this.reRenderInPosition(),l},RowManager.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())},RowManager.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(),l=t.getGroup();n===l?this._moveRowInArray(n.rows,t,e,o):(l&&l.removeRow(t),n.insertRow(t,e,o))}},RowManager.prototype._moveRowInArray=function(t,e,o,i){var n,l,s,a;if(e!==o&&(n=t.indexOf(e),n>-1&&(t.splice(n,1),l=t.indexOf(o),l>-1?i?t.splice(l+1,0,e):t.splice(l,0,e):t.splice(n,0,e)),t===this.getDisplayRows())){s=n<l?n:l,a=l>n?l:n+1;for(var r=s;r<=a;r++)t[r]&&this.styleRow(t[r],r)}},RowManager.prototype.clearData=function(){this.setData([])},RowManager.prototype.getRowIndex=function(t){return this.findRowIndex(t,this.rows)},RowManager.prototype.getDisplayRowIndex=function(t){var e=this.getDisplayRows().indexOf(t);return e>-1&&e},RowManager.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 Row&&"row"==i.type?i:this.nextDisplayRow(i,e)},RowManager.prototype.prevDisplayRow=function(t,e){var o=this.getDisplayRowIndex(t),i=!1;return o&&(i=this.getDisplayRows()[o-1]),!i||i instanceof Row&&"row"==i.type?i:this.prevDisplayRow(i,e)},RowManager.prototype.findRowIndex=function(t,e){var o;return!!((t=this.findRow(t))&&(o=e.indexOf(t))>-1)&&o},RowManager.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},RowManager.prototype.getComponents=function(t){var e=this,o=[];return(t?e.activeRows:e.rows).forEach(function(t){o.push(t.getComponent())}),o},RowManager.prototype.getDataCount=function(t){return t?this.activeRows.length:this.rows.length},RowManager.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 l=t.table.modules.filter.getFilters(!0,!0);i[t.table.modules.page.paginationDataSentNames.filters]=l}t.table.modules.ajax.setParams(i,!0)}e.modules.ajax.sendRequest().then(function(e){t.setData(e)}).catch(function(t){})},RowManager.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)},RowManager.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)},RowManager.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)},RowManager.prototype.refreshActiveData=function(t,e,o){var i,n=this,l=this.table;switch(n.table.modExists("edit")&&n.table.modules.edit.cancelEdit(),t||(t="all"),l.options.selectable&&!l.options.selectablePersistence&&l.modExists("selectRow")&&l.modules.selectRow.deselectRows(),t){case"all":case"filter":e?e=!1:l.modExists("filter")?n.setActiveRows(l.modules.filter.filter(n.rows)):n.setActiveRows(n.rows.slice(0));case"sort":e?e=!1:l.modExists("sort")&&l.modules.sort.sort(this.activeRows);case"display":this.resetDisplayRows();case"freeze":e?e=!1:this.table.modExists("frozenRows")&&l.modules.frozenRows.isFrozen()&&(l.modules.frozenRows.getDisplayIndex()||l.modules.frozenRows.setDisplayIndex(this.getNextDisplayIndex()),i=l.modules.frozenRows.getDisplayIndex(),!0!==(i=n.setDisplayRows(l.modules.frozenRows.getRows(this.getDisplayRows(i-1)),i))&&l.modules.frozenRows.setDisplayIndex(i));case"group":e?e=!1:l.options.groupBy&&l.modExists("groupRows")&&(l.modules.groupRows.getDisplayIndex()||l.modules.groupRows.setDisplayIndex(this.getNextDisplayIndex()),i=l.modules.groupRows.getDisplayIndex(),!0!==(i=n.setDisplayRows(l.modules.groupRows.getRows(this.getDisplayRows(i-1)),i))&&l.modules.groupRows.setDisplayIndex(i));case"tree":e?e=!1:l.options.dataTree&&l.modExists("dataTree")&&(l.modules.dataTree.getDisplayIndex()||l.modules.dataTree.setDisplayIndex(this.getNextDisplayIndex()),i=l.modules.dataTree.getDisplayIndex(),!0!==(i=n.setDisplayRows(l.modules.dataTree.getRows(this.getDisplayRows(i-1)),i))&&l.modules.dataTree.setDisplayIndex(i)),l.options.pagination&&l.modExists("page")&&!o&&"local"==l.modules.page.getMode()&&l.modules.page.reset();case"page":e?e=!1:l.options.pagination&&l.modExists("page")&&(l.modules.page.getDisplayIndex()||l.modules.page.setDisplayIndex(this.getNextDisplayIndex()),i=l.modules.page.getDisplayIndex(),"local"==l.modules.page.getMode()&&l.modules.page.setMaxRows(this.getDisplayRows(i-1).length),!0!==(i=n.setDisplayRows(l.modules.page.getRows(this.getDisplayRows(i-1)),i))&&l.modules.page.setDisplayIndex(i))}Tabulator.prototype.helpers.elVisible(n.element)&&(o?n.reRenderInPosition():(n.renderTable(),l.options.layoutColumnsOnNewData&&n.table.columnManager.redraw(!0))),l.modExists("columnCalcs")&&l.modules.columnCalcs.recalc(this.activeRows)},RowManager.prototype.setActiveRows=function(t){this.activeRows=t,this.activeRowsCount=this.activeRows.length},RowManager.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)},RowManager.prototype.getNextDisplayIndex=function(){return this.displayRows.length},RowManager.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},RowManager.prototype.getDisplayRows=function(t){return void 0===t?this.displayRows.length?this.displayRows[this.displayRows.length-1]:[]:this.displayRows[t]||[]},RowManager.prototype.getVisibleRows=function(t){var e=this.element.scrollTop,o=this.element.clientHeight+e,i=!1,n=0,l=0,s=this.getDisplayRows();if(t){this.getDisplayRows();for(var a=this.vDomTop;a<=this.vDomBottom;a++)if(s[a])if(i){if(!(o-s[a].getElement().offsetTop>=0))break;l=a}else e-s[a].getElement().offsetTop>=0?n=a:i=!0}else n=this.vDomTop,l=this.vDomBottom;return s.slice(n,l+1)},RowManager.prototype.displayRowIterator=function(t){this.displayRows.forEach(t),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length},RowManager.prototype.getRows=function(){return this.rows},RowManager.prototype.reRenderInPosition=function(t){if("virtual"==this.getRenderMode()){for(var e=this.element.scrollTop,o=!1,i=!1,n=this.scrollLeft,l=this.getDisplayRows(),s=this.vDomTop;s<=this.vDomBottom;s++)if(l[s]){var a=e-l[s].getElement().offsetTop;if(!(!1===i||Math.abs(a)<i))break;i=a,o=s}t&&t(),this._virtualRenderFill(!1===o?this.displayRowsCount-1:o,!0,i||0),this.scrollHorizontal(n)}else this.renderTable(),t&&t()},RowManager.prototype.setRenderMode=function(){(this.table.element.clientHeight||this.table.options.height)&&this.table.options.virtualDom?this.renderMode="virtual":this.renderMode="classic"},RowManager.prototype.getRenderMode=function(){return this.renderMode},RowManager.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)},RowManager.prototype._simpleRender=function(){this._clearVirtualDom(),this.displayRowsCount?this.checkClassicModeGroupHeaderWidth():this.renderEmptyScroll()},RowManager.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":""},RowManager.prototype.renderEmptyScroll=function(){this.tableElement.style.minWidth=this.table.columnManager.getWidth()+"px",this.tableElement.style.minHeight="1px",this.tableElement.style.visibility="hidden"},RowManager.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},RowManager.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"))},RowManager.prototype._virtualRenderFill=function(t,e,o){var i=this,n=i.tableElement,l=i.element,s=0,a=0,r=0,u=0,c=!0,h=i.getDisplayRows();if(t=t||0,o=o||0,t){for(;n.firstChild;)n.removeChild(n.firstChild);var d=(i.displayRowsCount-t+1)*i.vDomRowHeight;d<i.height&&(t-=Math.ceil((i.height-d)/i.vDomRowHeight))<0&&(t=0),s=Math.min(Math.max(Math.floor(i.vDomWindowBuffer/i.vDomRowHeight),i.vDomWindowMinMarginRows),t),t-=s}else i._clearVirtualDom();if(i.displayRowsCount&&Tabulator.prototype.helpers.elVisible(i.element)){for(i.vDomTop=t,i.vDomBottom=t-1;(a<=i.height+i.vDomWindowBuffer||u<i.vDomWindowMinTotalRows)&&i.vDomBottom<i.displayRowsCount-1;){var p=i.vDomBottom+1,m=h[p],f=0;i.styleRow(m,p),n.appendChild(m.getElement()),m.initialized?m.heightInitialized||m.normalizeHeight(!0):m.initialize(!0),f=m.getHeight(),u<s?r+=f:a+=f,f>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*f),"group"!==m.type&&(c=!1),i.vDomBottom++,u++}t?(i.vDomTopPad=e?i.vDomRowHeight*this.vDomTop+o:i.scrollTop-r,i.vDomBottomPad=i.vDomBottom==i.displayRowsCount-1?0:Math.max(i.vDo