You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/SoftMng/Content/bootstraptable-1.12.1-dist/extensions/print/bootstrap-table-print.min.js

7 lines
3.1 KiB
JavaScript

2 years ago
/*
* bootstrap-table - v1.12.1 - 2018-03-12
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2018 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";function b(a){return'<html><head><style type="text/css" media="print"> @page { size: auto; margin: 25px 0 25px 0; }</style><style type="text/css" media="all">table{border-collapse: collapse; font-size: 12px; }\ntable, th, td {border: 1px solid grey}\nth, td {text-align: center; vertical-align: middle;}\np {font-weight: bold; margin-left:20px }\ntable { width:94%; margin-left:3%; margin-right:3%}\ndiv.bs-table-print { text-align:center;}\n</style></head><title>Print Table</title><body><p>Printed on: '+new Date+' </p><div class="bs-table-print">'+a+"</div></body></html>"}var c=a.fn.bootstrapTable.utils.sprintf;a.extend(a.fn.bootstrapTable.defaults,{showPrint:!1,printAsFilteredAndSortedOnUI:!0,printSortColumn:void 0,printSortOrder:"asc",printPageBuilder:function(a){return b(a)}}),a.extend(a.fn.bootstrapTable.COLUMN_DEFAULTS,{printFilter:void 0,printIgnore:!1,printFormatter:void 0}),a.extend(a.fn.bootstrapTable.defaults.icons,{print:"glyphicon-print icon-share"});var d=a.fn.bootstrapTable.Constructor,e=d.prototype.initToolbar;d.prototype.initToolbar=function(){if(this.showToolbar=this.showToolbar||this.options.showPrint,e.apply(this,Array.prototype.slice.apply(arguments)),this.options.showPrint){var b=this,d=this.$toolbar.find(">.btn-group"),f=d.find("button.bs-print");f.length||(f=a(['<button class="bs-print btn btn-default'+c(' btn-%s"',this.options.iconSize)+' name="print" title="print" type="button">',c('<i class="%s %s"></i> ',this.options.iconsPrefix,this.options.icons.print),"</button>"].join("")).appendTo(d),f.click(function(){function a(a,b,c){var d=a[c.field];return"function"==typeof c.printFormatter?c.printFormatter.apply(c,[d,a,b]):"undefined"==typeof d?"-":d}function d(b,d){for(var e=["<table><thead>"],f=0;f<d.length;f++){var g=d[f];e.push("<tr>");for(var h=0;h<g.length;h++)g[h].printIgnore||e.push("<th",c(' rowspan="%s"',g[h].rowspan),c(' colspan="%s"',g[h].colspan),c(">%s</th>",g[h].title));e.push("</tr>")}e.push("</thead><tbody>");for(var i=0;i<b.length;i++){e.push("<tr>");for(var j=0;j<d.length;j++)for(var g=d[j],k=0;k<g.length;k++)!g[k].printIgnore&&g[k].field&&e.push("<td>",a(b[i],i,g[k]),"</td>");e.push("</tr>")}return e.push("</tbody></table>"),e.join("")}function e(a,b,c){if(!b)return a;var d="asc"!=c;return d=-(+d||-1),a.sort(function(a,c){return d*a[b].localeCompare(c[b])})}function f(a,b){for(var c=0;c<b.length;++c)if(a[b[c].colName]!=b[c].value)return!1;return!0}function g(a,b){return a.filter(function(a){return f(a,b)})}function h(a){return a&&a[0]?a[0].filter(function(a){return a.printFilter}).map(function(a){return{colName:a.field,value:a.printFilter}}):[]}var i=function(a){a=g(a,h(b.options.columns)),a=e(a,b.options.printSortColumn,b.options.printSortOrder);var c=d(a,b.options.columns),f=window.open("");f.document.write(b.options.printPageBuilder.call(this,c)),f.print(),f.close()};i(b.options.printAsFilteredAndSortedOnUI?b.getData():b.options.data.slice(0))}))}}}(jQuery);