/*! * Print button for Buttons and DataTables. * © SpryMedia Ltd - datatables.net/license */ import jQuery from"jquery";import DataTable from"datatables.net";import Buttons from"datatables.net-buttons";let $=jQuery;var _link=document.createElement("a"),_styleToAbs=function(t){t=$(t).clone()[0];return"link"===t.nodeName.toLowerCase()&&(t.href=_relToAbs(t.href)),t.outerHTML},_relToAbs=function(t){_link.href=t;t=_link.host;return-1===t.indexOf("/")&&0!==_link.pathname.indexOf("/")&&(t+="/"),_link.protocol+"//"+t+_link.pathname+_link.search};DataTable.ext.buttons.print={className:"buttons-print",text:function(t){return t.i18n("buttons.print","Print")},action:function(t,e,o,n,r){var a=e.buttons.exportData($.extend({decodeEntities:!1},n.exportOptions)),i=e.buttons.exportInfo(n),s=e.columns(n.exportOptions.columns).nodes().map(function(t){return t.className}).toArray(),u='';n.header&&(u+=""+a.headerStructure.map(function(t){return""+t.map(function(t){return t?'":""}).join("")+""}).join("")+""),u+="";for(var l=0,c=a.body.length;l"+a+""}return o+""}(a.body[l],"td");u+="",n.footer&&a.footer&&(u+=""+a.footerStructure.map(function(t){return""+t.map(function(t){return t?'":""}).join("")+""}).join("")+""),u+="
'+t.title+"
'+t.title+"
";var p=window.open("","");if(p){p.document.close();var d=""+i.title+"";$("style, link").each(function(){d+=_styleToAbs(this)});try{p.document.head.innerHTML=d}catch(t){$(p.document.head).html(d)}n.customScripts&&n.customScripts.forEach(function(t){var e=p.document.createElement("script");e.src=t,p.document.getElementsByTagName("head")[0].appendChild(e)}),p.document.body.innerHTML="

"+i.title+"

"+(i.messageTop||"")+"
"+u+"
"+(i.messageBottom||"")+"
",$(p.document.body).addClass("dt-print-view"),$("img",p.document.body).each(function(t,e){e.setAttribute("src",_relToAbs(e.getAttribute("src")))}),n.customize&&n.customize(p,n,e);p.setTimeout(function(){n.autoPrint&&(p.print(),p.close())},1e3),r()}else e.buttons.info(e.i18n("buttons.printErrorTitle","Unable to open print view"),e.i18n("buttons.printErrorMsg","Please allow popups in your browser for this site to be able to view the print view."),5e3)},async:100,title:"*",messageTop:"*",messageBottom:"*",exportOptions:{},header:!0,footer:!0,autoPrint:!0,customize:null};export default DataTable;