datatables.net-buttons
Advanced tools
Comparing version 1.2.4 to 1.3.0
@@ -51,3 +51,4 @@ /*! | ||
extend: 'columnsToggle', | ||
columns: conf.columns | ||
columns: conf.columns, | ||
columnText: conf.columnText | ||
} ] | ||
@@ -62,3 +63,4 @@ }; | ||
extend: 'columnToggle', | ||
columns: idx | ||
columns: idx, | ||
columnText: conf.columnText | ||
}; | ||
@@ -74,3 +76,4 @@ } ).toArray(); | ||
extend: 'columnVisibility', | ||
columns: conf.columns | ||
columns: conf.columns, | ||
columnText: conf.columnText | ||
}; | ||
@@ -85,3 +88,4 @@ }, | ||
columns: idx, | ||
visibility: conf.visibility | ||
visibility: conf.visibility, | ||
columnText: conf.columnText | ||
}; | ||
@@ -97,3 +101,3 @@ } ).toArray(); | ||
text: function ( dt, button, conf ) { | ||
return conf._columnText( dt, conf.columns ); | ||
return conf._columnText( dt, conf ); | ||
}, | ||
@@ -132,3 +136,3 @@ className: 'buttons-columnVisibility', | ||
that.text( conf._columnText( dt, conf.columns ) ); | ||
that.text( conf._columnText( dt, conf ) ); | ||
that.active( col.visible() ); | ||
@@ -145,3 +149,3 @@ } ); | ||
_columnText: function ( dt, col ) { | ||
_columnText: function ( dt, conf ) { | ||
// Use DataTables' internal data structure until this is presented | ||
@@ -151,7 +155,11 @@ // is a public API. The other option is to use | ||
// populated when Buttons is constructed. | ||
var idx = dt.column( col ).index(); | ||
return dt.settings()[0].aoColumns[ idx ].sTitle | ||
var idx = dt.column( conf.columns ).index(); | ||
var title = dt.settings()[0].aoColumns[ idx ].sTitle | ||
.replace(/\n/g," ") // remove new lines | ||
.replace( /<.*?>/g, "" ) // strip HTML | ||
.replace(/^\s+|\s+$/g,""); // trim | ||
return conf.columnText ? | ||
conf.columnText( dt, idx, title ) : | ||
title; | ||
} | ||
@@ -158,0 +166,0 @@ }, |
@@ -755,3 +755,6 @@ /*! | ||
for ( var i=0, ien=data.body.length ; i<ien ; i++ ) { | ||
str = data.body[i][col].toString(); | ||
var point = data.body[i][col]; | ||
str = point !== null && point !== undefined ? | ||
point.toString() : | ||
''; | ||
@@ -778,3 +781,3 @@ // If there is a newline character, workout the width of the column | ||
if ( max > 40 ) { | ||
break; | ||
return 52; // 40 * 1.3 | ||
} | ||
@@ -789,8 +792,16 @@ } | ||
try { | ||
var _serialiser = new XMLSerializer(); | ||
var _ieExcel; | ||
} | ||
catch (t) {} | ||
var _serialiser = ""; | ||
if (typeof window.XMLSerializer === 'undefined') { | ||
_serialiser = new function () { | ||
this.serializeToString = function (input) { | ||
return input.xml | ||
} | ||
}; | ||
} else { | ||
_serialiser = new XMLSerializer(); | ||
} | ||
var _ieExcel; | ||
/** | ||
@@ -859,3 +870,3 @@ * Convert XML documents in an object to strings | ||
// various elements making them useless. This strips them out | ||
str = str.replace( /<(.*?) xmlns=""(.*?)>/g, '<$1 $2>' ); | ||
str = str.replace( /<([^<>]*?) xmlns=""([^<>]*?)>/g, '<$1 $2>' ); | ||
@@ -1017,2 +1028,7 @@ obj[ name ] = str; | ||
'<xf numFmtId="0" fontId="4" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="0" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="1" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="2" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="3" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="4" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="0" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
@@ -1023,7 +1039,2 @@ '<xf numFmtId="0" fontId="1" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="4" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="0" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="1" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="2" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="3" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="4" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="0" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
@@ -1149,2 +1160,4 @@ '<xf numFmtId="0" fontId="1" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
this.processing( true ); | ||
var flash = config._flash; | ||
@@ -1159,2 +1172,4 @@ var data = _exportData( dt, config ); | ||
this.processing( false ); | ||
dt.buttons.info( | ||
@@ -1208,2 +1223,4 @@ dt.i18n( 'buttons.copyTitle', 'Copy to clipboard' ), | ||
action: function ( e, dt, button, config ) { | ||
this.processing( true ); | ||
var flash = config._flash; | ||
@@ -1254,3 +1271,6 @@ var rowPos = 0; | ||
if ( row[i].match && row[i].match( special.match ) ) { | ||
// TODO Need to provide the ability for the specials to say | ||
// if they are returning a string, since at the moment it is | ||
// assumed to be a number | ||
if ( row[i].match && ! row[i].match(/^0\d+/) && row[i].match( special.match ) ) { | ||
var val = row[i].replace(/[^\d\.\-]/g, ''); | ||
@@ -1371,2 +1391,4 @@ | ||
_setText( flash, '' ); | ||
this.processing( false ); | ||
}, | ||
@@ -1388,2 +1410,4 @@ | ||
action: function ( e, dt, button, config ) { | ||
this.processing( true ); | ||
// Set the text | ||
@@ -1412,2 +1436,4 @@ var flash = config._flash; | ||
} ) ); | ||
this.processing( false ); | ||
}, | ||
@@ -1414,0 +1440,0 @@ |
@@ -476,3 +476,3 @@ /*! | ||
// various elements making them useless. This strips them out | ||
str = str.replace( /<(.*?) xmlns=""(.*?)>/g, '<$1 $2>' ); | ||
str = str.replace( /<([^<>]*?) xmlns=""([^<>]*?)>/g, '<$1 $2>' ); | ||
@@ -531,3 +531,6 @@ zip.file( name, str ); | ||
for ( var i=0, ien=data.body.length ; i<ien ; i++ ) { | ||
str = data.body[i][col].toString(); | ||
var point = data.body[i][col]; | ||
str = point !== null && point !== undefined ? | ||
point.toString() : | ||
''; | ||
@@ -554,3 +557,3 @@ // If there is a newline character, workout the width of the column | ||
if ( max > 40 ) { | ||
break; | ||
return 52; // 40 * 1.3 | ||
} | ||
@@ -715,2 +718,7 @@ } | ||
'<xf numFmtId="0" fontId="4" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="0" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="1" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="2" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="3" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="4" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="0" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
@@ -721,7 +729,2 @@ '<xf numFmtId="0" fontId="1" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="4" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="0" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="1" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="2" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="3" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="4" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
'<xf numFmtId="0" fontId="0" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
@@ -832,2 +835,5 @@ '<xf numFmtId="0" fontId="1" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/>'+ | ||
action: function ( e, dt, button, config ) { | ||
this.processing( true ); | ||
var that = this; | ||
var exportData = _exportData( dt, config ); | ||
@@ -872,2 +878,4 @@ var output = exportData.str; | ||
); | ||
this.processing( false ); | ||
return; | ||
@@ -906,2 +914,3 @@ } | ||
close(); | ||
that.processing( false ); | ||
} | ||
@@ -911,2 +920,3 @@ } ) | ||
close(); | ||
that.processing( false ); | ||
} ); | ||
@@ -943,2 +953,4 @@ }, | ||
action: function ( e, dt, button, config ) { | ||
this.processing( true ); | ||
// Set the text | ||
@@ -974,2 +986,4 @@ var output = _exportData( dt, config ).str; | ||
); | ||
this.processing( false ); | ||
}, | ||
@@ -1011,2 +1025,5 @@ | ||
action: function ( e, dt, button, config ) { | ||
this.processing( true ); | ||
var that = this; | ||
var rowPos = 0; | ||
@@ -1063,3 +1080,6 @@ var getXml = function ( type ) { | ||
if ( row[i].match && row[i].match( special.match ) ) { | ||
// TODO Need to provide the ability for the specials to say | ||
// if they are returning a string, since at the moment it is | ||
// assumed to be a number | ||
if ( row[i].match && ! row[i].match(/^0\d+/) && row[i].match( special.match ) ) { | ||
var val = row[i].replace(/[^\d\.\-]/g, ''); | ||
@@ -1189,2 +1209,3 @@ | ||
_saveAs( blob, _filename( config ) ); | ||
that.processing( false ); | ||
} ); | ||
@@ -1198,2 +1219,3 @@ } | ||
); | ||
this.processing( false ); | ||
} | ||
@@ -1228,3 +1250,5 @@ }, | ||
action: function ( e, dt, button, config ) { | ||
var newLine = _newLine( config ); | ||
this.processing( true ); | ||
var that = this; | ||
var data = dt.buttons.exportData( config.exportOptions ); | ||
@@ -1302,7 +1326,7 @@ var rows = []; | ||
if ( config.message ) { | ||
doc.content.unshift( { | ||
text: typeof config.message == 'function' ? config.message(dt, button, config) : config.message, | ||
style: 'message', | ||
margin: [ 0, 0, 0, 12 ] | ||
} ); | ||
doc.content.unshift( { | ||
text: typeof config.message == 'function' ? config.message(dt, button, config) : config.message, | ||
style: 'message', | ||
margin: [ 0, 0, 0, 12 ] | ||
} ); | ||
} | ||
@@ -1326,2 +1350,3 @@ | ||
pdf.open(); | ||
this.processing( false ); | ||
} | ||
@@ -1333,2 +1358,3 @@ else { | ||
_saveAs( blob, _filename( config ) ); | ||
that.processing( false ); | ||
} ); | ||
@@ -1335,0 +1361,0 @@ } |
@@ -43,8 +43,8 @@ /*! | ||
/** | ||
* Convert a `link` tag's URL from a relative to an absolute address so it will | ||
* work correctly in the popup window which has no base URL. | ||
* Clone link and style tags, taking into account the need to change the source | ||
* path. | ||
* | ||
* @param {node} el Element to convert | ||
*/ | ||
var _relToAbs = function( el ) { | ||
var _styleToAbs = function( el ) { | ||
var url; | ||
@@ -55,15 +55,27 @@ var clone = $(el).clone()[0]; | ||
if ( clone.nodeName.toLowerCase() === 'link' ) { | ||
_link.href = clone.href; | ||
linkHost = _link.host; | ||
clone.href = _relToAbs( clone.href ); | ||
} | ||
// IE doesn't have a trailing slash on the host | ||
// Chrome has it on the pathname | ||
if ( linkHost.indexOf('/') === -1 && _link.pathname.indexOf('/') !== 0) { | ||
linkHost += '/'; | ||
} | ||
return clone.outerHTML; | ||
}; | ||
clone.href = _link.protocol+"//"+linkHost+_link.pathname+_link.search; | ||
/** | ||
* Convert a URL from a relative to an absolute address so it will work | ||
* correctly in the popup window which has no base URL. | ||
* | ||
* @param {string} href URL | ||
*/ | ||
var _relToAbs = function( href ) { | ||
// Assign to a link on the original page so the browser will do all the | ||
// hard work of figuring out where the file actually is | ||
_link.href = href; | ||
var linkHost = _link.host; | ||
// IE doesn't have a trailing slash on the host | ||
// Chrome has it on the pathname | ||
if ( linkHost.indexOf('/') === -1 && _link.pathname.indexOf('/') !== 0) { | ||
linkHost += '/'; | ||
} | ||
return clone.outerHTML; | ||
return _link.protocol+"//"+linkHost+_link.pathname+_link.search; | ||
}; | ||
@@ -128,3 +140,3 @@ | ||
$('style, link').each( function () { | ||
head += _relToAbs( this ); | ||
head += _styleToAbs( this ); | ||
} ); | ||
@@ -152,2 +164,6 @@ | ||
$('img', win.document.body).each( function ( i, img ) { | ||
img.setAttribute( 'src', _relToAbs( img.getAttribute('src') ) ); | ||
} ); | ||
if ( config.customize ) { | ||
@@ -154,0 +170,0 @@ config.customize( win ); |
@@ -1,2 +0,2 @@ | ||
/*! Buttons for DataTables 1.2.4 | ||
/*! Buttons for DataTables 1.3.0 | ||
* ©2016 SpryMedia Ltd - datatables.net/license | ||
@@ -51,2 +51,7 @@ */ | ||
{ | ||
// If there is no config set it to an empty object | ||
if ( typeof( config ) === 'undefined' ) { | ||
config = {}; | ||
} | ||
// Allow a boolean true for defaults | ||
@@ -258,2 +263,20 @@ if ( config === true ) { | ||
/** | ||
* Set / get a processing class on the selected button | ||
* @param {boolean} flag true to add, false to remove, undefined to get | ||
* @return {boolean|Buttons} Getter value or this if a setter. | ||
*/ | ||
processing: function ( node, flag ) | ||
{ | ||
var button = this._nodeToButton( node ); | ||
if ( flag === undefined ) { | ||
return $(button.node).hasClass( 'processing' ); | ||
} | ||
$(button.node).toggleClass( 'processing', flag ); | ||
return this; | ||
}, | ||
/** | ||
* Remove a button. | ||
@@ -467,3 +490,4 @@ * @param {node} node Button node | ||
built.collection = $('<'+collectionDom.tag+'/>') | ||
.addClass( collectionDom.className ); | ||
.addClass( collectionDom.className ) | ||
.attr( 'role', 'menu') ; | ||
built.conf._collection = built.collection; | ||
@@ -575,3 +599,3 @@ | ||
if ( config.titleAttr ) { | ||
button.attr( 'title', config.titleAttr ); | ||
button.attr( 'title', text( config.titleAttr ) ); | ||
} | ||
@@ -1125,3 +1149,3 @@ | ||
*/ | ||
Buttons.version = '1.2.4'; | ||
Buttons.version = '1.3.0'; | ||
@@ -1407,2 +1431,15 @@ | ||
// Get / set button processing state | ||
DataTable.Api.registerPlural( 'buttons().processing()', 'button().processing()', function ( flag ) { | ||
if ( flag === undefined ) { | ||
return this.map( function ( set ) { | ||
return set.inst.processing( set.node ); | ||
} ); | ||
} | ||
return this.each( function ( set ) { | ||
set.inst.processing( set.node, flag ); | ||
} ); | ||
} ); | ||
// Get / set button text (i.e. the button labels) | ||
@@ -1565,2 +1602,5 @@ DataTable.Api.registerPlural( 'buttons().text()', 'button().text()', function ( label ) { | ||
// Always remove script tags | ||
str = str.replace( /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '' ); | ||
if ( config.stripHtml ) { | ||
@@ -1567,0 +1607,0 @@ str = str.replace( /<[^>]*>/g, '' ); |
{ | ||
"name": "datatables.net-buttons", | ||
"version": "1.2.4", | ||
"version": "1.3.0", | ||
"description": "Buttons for DataTables ", | ||
@@ -5,0 +5,0 @@ "files": [ |
# Buttons for DataTables | ||
This package contains distribution files for the [Buttons extension](https://datatables.net/extensions/buttons) for [DataTables](https://datatables.net/). Only the core software for this library is contained in this package - to be correctly styled, a styling package for Buttons must also be included. Styling options include DataTable's native styling, [Bootstrap](http://getboostrap.com) and [Foundation](http://foundation.zurb.com/). | ||
This package contains distribution files for the [Buttons extension](https://datatables.net/extensions/buttons) for [DataTables](https://datatables.net/). Only the core software for this library is contained in this package - to be correctly styled, a styling package for Buttons must also be included. Styling options include DataTable's native styling, [Bootstrap](http://getbootstrap.com) and [Foundation](http://foundation.zurb.com/). | ||
@@ -5,0 +5,0 @@ The Buttons extension for DataTables provides a common set of options, API methods and styling to display buttons on a page that will interact with a DataTable. It also provides plug-ins for file export (HTML5 and Flash), print view and column visibility. Other libraries, such as Editor and Select also provide buttons specific to their use cases. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141670
4167