2 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},HtmlTableExport=
function(t){this.table=t,this.config={},this.cloneTableStyle=!0,this.colVisProp=
""};HtmlTableExport.prototype.genereateTable=
function(t,e,o,n){this.cloneTableStyle=e,this.config=t||{},this.colVisProp=n;var r=this.generateHeaderElements(),l=this.generateBodyElements(o),a=document.createElement(
"table");
return a.classList.add(
"tabulator-print-table"),a.appendChild(r),a.appendChild(l),this.mapElementStyles(this.table.element,a,[
"border-top",
"border-left",
"border-right",
"border-bottom"]),a},HtmlTableExport.prototype.generateColumnGroupHeaders=
function(){var t=
this,e=[];
return(!1!==this.config.columnGroups?
this.table.columnManager.columns:
this.table.columnManager.columnsByIndex).forEach(
function(o){var n=t.processColumnGroup(o);n&&e.push(n)}),e},HtmlTableExport.prototype.processColumnGroup=
function(t){var e=
this,o=t.columns,n=0,r={title:t.definition.title,column:t,depth:1};
if(o.length){
if(r.subGroups=[],r.width=0,o.forEach(
function(t){var o=e.processColumnGroup(t);o&&(r.width+=o.width,r.subGroups.push(o),o.depth>n&&(n=o.depth))}),r.depth+=n,!r.width)
return!1}
else{
if(!this.columnVisCheck(t))
return!1;r.width=1}
return r},HtmlTableExport.prototype.groupHeadersToRows=
function(t){
function e(t,r){var l=n-r;
void 0===o[r]&&(o[r]=[]),t.height=t.subGroups?1:l-t.depth+1,o[r].push(t),t.subGroups&&t.subGroups.forEach(
function(t){e(t,r+1)})}var o=[],n=0;
return t.forEach(
function(t){t.depth>n&&(n=t.depth)}),t.forEach(
function(t){e(t,0)}),o},HtmlTableExport.prototype.generateHeaderElements=
function(){var t=
this,e=document.createElement(
"thead");
return this.groupHeadersToRows(this.generateColumnGroupHeaders()).forEach(
function(o){var n=document.createElement(
"tr");t.mapElementStyles(t.table.columnManager.getHeadersElement(),e,[
"border-top",
"border-left",
"border-right",
"border-bottom",
"background-color",
"color",
"font-weight",
"font-family",
"font-size"]),o.forEach(
function(e){var o=document.createElement(
"th"),r=e.column.definition.cssClass?e.column.definition.cssClass.split(
" "):[];o.colSpan=e.width,o.rowSpan=e.height,o.innerHTML=e.column.definition.title,t.cloneTableStyle&&(o.style.boxSizing=
"border-box"),r.forEach(
function(t){o.classList.add(t)}),t.mapElementStyles(e.column.getElement(),o,[
"text-align",
"border-top",
"border-left",
"border-right",
"border-bottom",
"background-color",
"color",
"font-weight",
"font-family",
"font-size"]),t.mapElementStyles(e.column.contentElement,o,[
"padding-top",
"padding-left",
"padding-right",
"padding-bottom"]),e.column.visible?t.mapElementStyles(e.column.getElement(),o,[
"width"]):e.column.definition.width&&(o.style.width=e.column.definition.width+
"px"),e.column.parent&&t.mapElementStyles(e.column.parent.groupElement,o,[
"border-top"]),n.appendChild(o)}),e.appendChild(n)}),e},HtmlTableExport.prototype.generateBodyElements=
function(t){var e,o,n,r,l,a,i,s,d=
this;this.cloneTableStyle&&window.getComputedStyle&&(e=this.table.element.querySelector(
".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),o=this.table.element.querySelector(
".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),n=this.table.element.querySelector(
".tabulator-row.tabulator-calcs"),r=this.table.element.querySelector(
".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),a=this.table.element.getElementsByClassName(
"tabulator-group")[0],r&&(i=r.getElementsByClassName(
"tabulator-cell"),l=i[0],i[i.length-1]));var c=document.createElement(
"tbody"),u=t?this.table.rowManager.getVisibleRows(!0):this.table.rowManager.getDisplayRows(),p=[];
return!1!==this.config.columnCalcs&&this.table.modExists(
"columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&u.unshift(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&u.push(this.table.modules.columnCalcs.botRow)),this.table.columnManager.columnsByIndex.forEach(
function(t){d.columnVisCheck(t)&&p.push(t)}),u=u.filter(
function(t){
switch(t.type){
case"group":
return!1!==d.config.rowGroups;
case"calc":
return!1!==d.config.columnCalcs}
return!0}),u.length>1e3&&console.warn(
"It may take a long time to render an HTML table with more than 1000 rows"),u.forEach(
function(t,r){var i=t.getData(),u=document.createElement(
"tr");
switch(u.classList.add(
"tabulator-print-table-row"),t.type){
case"group":var m=document.createElement(
"td");m.colSpan=p.length,m.innerHTML=t.key,u.classList.add(
"tabulator-print-table-group"),d.mapElementStyles(a,u,[
"border-top",
"border-left",
"border-right",
"border-bottom",
"color",
"font-weight",
"font-family",
"font-size",
"background-color"]),d.mapElementStyles(a,m,[
"padding-top",
"padding-left",
"padding-right",
"padding-bottom"]),u.appendChild(m);
break;
case"calc":u.classList.add(
"tabulator-print-table-calcs");
case"row":p.forEach(
function(e){var o=document.createElement(
"td"),n=e.getFieldValue(i),r={modules:{},getValue:
function(){
return n},getField:
function(){
return e.definition.field},getElement:
function(){
return o},getColumn:
function(){
return e.getComponent()},getData:
function(){
return i},getRow:
function(){
return t.getComponent()},getComponent:
function(){
return r},column:e};
if((e.definition.cssClass?e.definition.cssClass.split(
" "):[]).forEach(
function(t){o.classList.add(t)}),d.table.modExists(
"format"))n=d.table.modules.format.formatValue(r);
else switch(
void 0===n?
"undefined":_typeof(n)){
case"object":n=JSON.stringify(n);
break;
case"undefined":
case"null":n=
"";
break;
default:n=n}n instanceof Node?o.appendChild(n):o.innerHTML=n,l&&d.mapElementStyles(l,o,[
"padding-top",
"padding-left",
"padding-right",
"padding-bottom",
"border-top",
"border-left",
"border-right",
"border-bottom",
"color",
"font-weight",
"font-family",
"font-size",
"text-align"]),u.appendChild(o)}),s=
"calc"==t.type?n:r%2&&o?o:e,d.mapElementStyles(s,u,[
"border-top",
"border-left",
"border-right",
"border-bottom",
"color",
"font-weight",
"font-family",
"font-size",
"background-color"])}c.appendChild(u)}),c},HtmlTableExport.prototype.columnVisCheck=
function(t){
return!1!==t.definition[this.colVisProp]&&(t.visible||!t.visible&&t.definition[this.colVisProp])},HtmlTableExport.prototype.getHtml=
function(t,e,o){var n=document.createElement(
"div");
return n.appendChild(this.genereateTable(o||this.table.options.htmlOutputConfig,e,t,
"htmlOutput")),n.innerHTML},HtmlTableExport.prototype.mapElementStyles=
function(t,e,o){
if(this.cloneTableStyle&&t&&e){var n={
"background-color":
"backgroundColor",color:
"fontColor",width:
"width",
"font-weight":
"fontWeight",
"font-family":
"fontFamily",
"font-size":
"fontSize",
"text-align":
"textAlign",
"border-top":
"borderTop",
"border-left":
"borderLeft",
"border-right":
"borderRight",
"border-bottom":
"borderBottom",
"padding-top":
"paddingTop",
"padding-left":
"paddingLeft",
"padding-right":
"paddingRight",
"padding-bottom":
"paddingBottom"};
if(window.getComputedStyle){var r=window.getComputedStyle(t);o.forEach(
function(t){e.style[n[t]]=r.getPropertyValue(t)})}}},Tabulator.prototype.registerModule(
"htmlTableExport",HtmlTableExport);