From 84e66745589cd6f0ae82b00f2a882d821e47a50a Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 15 Nov 2022 11:20:35 +0000 Subject: [PATCH] d145c8bc5c29bf3931bdbd7deca9d875d085d865 Sync to source repo @d145c8bc5c29bf3931bdb7deca9d875d085d865 --- datatables.json | 2 +- js/buttons.colVis.js | 3 +-- js/buttons.colVis.min.js | 2 +- js/buttons.colVis.min.mjs | 2 +- js/buttons.colVis.mjs | 2 +- js/buttons.html5.js | 3 +-- js/buttons.html5.min.js | 2 +- js/buttons.html5.min.mjs | 2 +- js/buttons.html5.mjs | 2 +- js/buttons.print.js | 3 +-- js/buttons.print.min.js | 2 +- js/buttons.print.min.mjs | 2 +- js/buttons.print.mjs | 2 +- js/dataTables.buttons.js | 1 - 14 files changed, 13 insertions(+), 17 deletions(-) diff --git a/datatables.json b/datatables.json index 1d46102..d8e5812 100644 --- a/datatables.json +++ b/datatables.json @@ -25,5 +25,5 @@ ], "src-repo": "http://github.com/DataTables/Buttons", "last-tag": "2.3.2", - "last-sync": "d145c8bc5c29bf3931bdbd7deca9d875d085d865" + "last-sync": "d145c8bc5c29bf3931bdb7deca9d875d085d865" } \ No newline at end of file diff --git a/js/buttons.colVis.js b/js/buttons.colVis.js index f5c6e66..5d5541e 100755 --- a/js/buttons.colVis.js +++ b/js/buttons.colVis.js @@ -29,11 +29,10 @@ require('datatables.net')(root, $); } - if ( ! $.fn.dataTable ) { + if ( ! $.fn.dataTable.Buttons ) { require('datatables.net-buttons')(root, $); } - return factory( $, root, root.document ); }; } diff --git a/js/buttons.colVis.min.js b/js/buttons.colVis.min.js index c1ea512..4e15560 100644 --- a/js/buttons.colVis.min.js +++ b/js/buttons.colVis.min.js @@ -2,4 +2,4 @@ * Column visibility buttons for Buttons and DataTables. * 2016 SpryMedia Ltd - datatables.net/license */ -!function(t){"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(n){return t(n,window,document)}):"object"==typeof exports?module.exports=function(n,e){return n=n||window,(e=e||("undefined"!=typeof window?require("jquery"):require("jquery")(n))).fn.dataTable||require("datatables.net")(n,e),e.fn.dataTable||require("datatables.net-buttons")(n,e),t(e,0,n.document)}:t(jQuery,window,document)}(function(n,e,t,l){"use strict";var o=n.fn.dataTable;return n.extend(o.ext.buttons,{colvis:function(o,i){var l=null,n={extend:"collection",init:function(n,e){l=e},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}]};return o.on("column-reorder.dt"+i.namespace,function(n,e,t){o.button(null,o.button(null,l).node()).collectionRebuild([{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}])}),n},columnsToggle:function(n,e){return n.columns(e.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:e.columnText}}).toArray()},columnToggle:function(n,e){return{extend:"columnVisibility",columns:e.columns,columnText:e.columnText}},columnsVisibility:function(n,e){return n.columns(e.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:e.visibility,columnText:e.columnText}}).toArray()},columnVisibility:{columns:l,text:function(n,e,t){return t._columnText(n,t)},className:"buttons-columnVisibility",action:function(n,e,t,o){var e=e.columns(o.columns),i=e.visible();e.visible(o.visibility!==l?o.visibility:!(i.length&&i[0]))},init:function(o,n,i){var l=this;n.attr("data-cv-idx",i.columns),o.on("column-visibility.dt"+i.namespace,function(n,e){e.bDestroying||e.nTable!=o.settings()[0].nTable||l.active(o.column(i.columns).visible())}).on("column-reorder.dt"+i.namespace,function(n,e,t){i.destroying||1===o.columns(i.columns).count()&&(l.text(i._columnText(o,i)),l.active(o.column(i.columns).visible()))}),this.active(o.column(i.columns).visible())},destroy:function(n,e,t){n.off("column-visibility.dt"+t.namespace).off("column-reorder.dt"+t.namespace)},_columnText:function(n,e){var t=n.column(e.columns).index(),o=n.settings()[0].aoColumns[t].sTitle;return o=(o=o||n.column(t).header().innerHTML).replace(/\n/g," ").replace(//gi," ").replace(//g,"").replace(//g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),e.columnText?e.columnText(n,t,o):o}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(e,n,t){t._visOriginal=e.columns().indexes().map(function(n){return e.column(n).visible()}).toArray()},action:function(n,e,t,o){e.columns().every(function(n){n=e.colReorder&&e.colReorder.transpose?e.colReorder.transpose(n,"toOriginal"):n;this.visible(o._visOriginal[n])})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,e,t,o){e.columns(o.show).visible(!0,!1),e.columns(o.hide).visible(!1,!1),e.columns.adjust()},show:[],hide:[]}}),o}); \ No newline at end of file +!function(t){"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(n){return t(n,window,document)}):"object"==typeof exports?module.exports=function(n,e){return n=n||window,(e=e||("undefined"!=typeof window?require("jquery"):require("jquery")(n))).fn.dataTable||require("datatables.net")(n,e),e.fn.dataTable.Buttons||require("datatables.net-buttons")(n,e),t(e,0,n.document)}:t(jQuery,window,document)}(function(n,e,t,l){"use strict";var o=n.fn.dataTable;return n.extend(o.ext.buttons,{colvis:function(o,i){var l=null,n={extend:"collection",init:function(n,e){l=e},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}]};return o.on("column-reorder.dt"+i.namespace,function(n,e,t){o.button(null,o.button(null,l).node()).collectionRebuild([{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}])}),n},columnsToggle:function(n,e){return n.columns(e.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:e.columnText}}).toArray()},columnToggle:function(n,e){return{extend:"columnVisibility",columns:e.columns,columnText:e.columnText}},columnsVisibility:function(n,e){return n.columns(e.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:e.visibility,columnText:e.columnText}}).toArray()},columnVisibility:{columns:l,text:function(n,e,t){return t._columnText(n,t)},className:"buttons-columnVisibility",action:function(n,e,t,o){var e=e.columns(o.columns),i=e.visible();e.visible(o.visibility!==l?o.visibility:!(i.length&&i[0]))},init:function(o,n,i){var l=this;n.attr("data-cv-idx",i.columns),o.on("column-visibility.dt"+i.namespace,function(n,e){e.bDestroying||e.nTable!=o.settings()[0].nTable||l.active(o.column(i.columns).visible())}).on("column-reorder.dt"+i.namespace,function(n,e,t){i.destroying||1===o.columns(i.columns).count()&&(l.text(i._columnText(o,i)),l.active(o.column(i.columns).visible()))}),this.active(o.column(i.columns).visible())},destroy:function(n,e,t){n.off("column-visibility.dt"+t.namespace).off("column-reorder.dt"+t.namespace)},_columnText:function(n,e){var t=n.column(e.columns).index(),o=n.settings()[0].aoColumns[t].sTitle;return o=(o=o||n.column(t).header().innerHTML).replace(/\n/g," ").replace(//gi," ").replace(//g,"").replace(//g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),e.columnText?e.columnText(n,t,o):o}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(e,n,t){t._visOriginal=e.columns().indexes().map(function(n){return e.column(n).visible()}).toArray()},action:function(n,e,t,o){e.columns().every(function(n){n=e.colReorder&&e.colReorder.transpose?e.colReorder.transpose(n,"toOriginal"):n;this.visible(o._visOriginal[n])})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,e,t,o){e.columns(o.show).visible(!0,!1),e.columns(o.hide).visible(!1,!1),e.columns.adjust()},show:[],hide:[]}}),o}); \ No newline at end of file diff --git a/js/buttons.colVis.min.mjs b/js/buttons.colVis.min.mjs index 5e09778..1c42e58 100644 --- a/js/buttons.colVis.min.mjs +++ b/js/buttons.colVis.min.mjs @@ -2,4 +2,4 @@ * Column visibility buttons for Buttons and DataTables. * 2016 SpryMedia Ltd - datatables.net/license */ -import $ from"jquery";import DataTable from"datatables.net";import"datatables.net-buttons";$.extend(DataTable.ext.buttons,{colvis:function(e,i){var l=null,n={extend:"collection",init:function(n,o){l=o},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}]};return e.on("column-reorder.dt"+i.namespace,function(n,o,t){e.button(null,e.button(null,l).node()).collectionRebuild([{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}])}),n},columnsToggle:function(n,o){return n.columns(o.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:o.columnText}}).toArray()},columnToggle:function(n,o){return{extend:"columnVisibility",columns:o.columns,columnText:o.columnText}},columnsVisibility:function(n,o){return n.columns(o.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:o.visibility,columnText:o.columnText}}).toArray()},columnVisibility:{columns:void 0,text:function(n,o,t){return t._columnText(n,t)},className:"buttons-columnVisibility",action:function(n,o,t,e){var o=o.columns(e.columns),i=o.visible();o.visible(void 0!==e.visibility?e.visibility:!(i.length&&i[0]))},init:function(e,n,i){var l=this;n.attr("data-cv-idx",i.columns),e.on("column-visibility.dt"+i.namespace,function(n,o){o.bDestroying||o.nTable!=e.settings()[0].nTable||l.active(e.column(i.columns).visible())}).on("column-reorder.dt"+i.namespace,function(n,o,t){i.destroying||1===e.columns(i.columns).count()&&(l.text(i._columnText(e,i)),l.active(e.column(i.columns).visible()))}),this.active(e.column(i.columns).visible())},destroy:function(n,o,t){n.off("column-visibility.dt"+t.namespace).off("column-reorder.dt"+t.namespace)},_columnText:function(n,o){var t=n.column(o.columns).index(),e=n.settings()[0].aoColumns[t].sTitle;return e=(e=e||n.column(t).header().innerHTML).replace(/\n/g," ").replace(//gi," ").replace(//g,"").replace(//g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),o.columnText?o.columnText(n,t,e):e}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(o,n,t){t._visOriginal=o.columns().indexes().map(function(n){return o.column(n).visible()}).toArray()},action:function(n,o,t,e){o.columns().every(function(n){n=o.colReorder&&o.colReorder.transpose?o.colReorder.transpose(n,"toOriginal"):n;this.visible(e._visOriginal[n])})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,o,t,e){o.columns(e.show).visible(!0,!1),o.columns(e.hide).visible(!1,!1),o.columns.adjust()},show:[],hide:[]}});export default DataTable; \ No newline at end of file +import $ from"jquery";import DataTable from"datatables.net";import Buttons from"datatables.net-buttons";$.extend(DataTable.ext.buttons,{colvis:function(e,i){var l=null,n={extend:"collection",init:function(n,o){l=o},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}]};return e.on("column-reorder.dt"+i.namespace,function(n,o,t){e.button(null,e.button(null,l).node()).collectionRebuild([{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}])}),n},columnsToggle:function(n,o){return n.columns(o.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:o.columnText}}).toArray()},columnToggle:function(n,o){return{extend:"columnVisibility",columns:o.columns,columnText:o.columnText}},columnsVisibility:function(n,o){return n.columns(o.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:o.visibility,columnText:o.columnText}}).toArray()},columnVisibility:{columns:void 0,text:function(n,o,t){return t._columnText(n,t)},className:"buttons-columnVisibility",action:function(n,o,t,e){var o=o.columns(e.columns),i=o.visible();o.visible(void 0!==e.visibility?e.visibility:!(i.length&&i[0]))},init:function(e,n,i){var l=this;n.attr("data-cv-idx",i.columns),e.on("column-visibility.dt"+i.namespace,function(n,o){o.bDestroying||o.nTable!=e.settings()[0].nTable||l.active(e.column(i.columns).visible())}).on("column-reorder.dt"+i.namespace,function(n,o,t){i.destroying||1===e.columns(i.columns).count()&&(l.text(i._columnText(e,i)),l.active(e.column(i.columns).visible()))}),this.active(e.column(i.columns).visible())},destroy:function(n,o,t){n.off("column-visibility.dt"+t.namespace).off("column-reorder.dt"+t.namespace)},_columnText:function(n,o){var t=n.column(o.columns).index(),e=n.settings()[0].aoColumns[t].sTitle;return e=(e=e||n.column(t).header().innerHTML).replace(/\n/g," ").replace(//gi," ").replace(//g,"").replace(//g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),o.columnText?o.columnText(n,t,e):e}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(o,n,t){t._visOriginal=o.columns().indexes().map(function(n){return o.column(n).visible()}).toArray()},action:function(n,o,t,e){o.columns().every(function(n){n=o.colReorder&&o.colReorder.transpose?o.colReorder.transpose(n,"toOriginal"):n;this.visible(e._visOriginal[n])})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,o,t,e){o.columns(e.show).visible(!0,!1),o.columns(e.hide).visible(!1,!1),o.columns.adjust()},show:[],hide:[]}});export default DataTable; \ No newline at end of file diff --git a/js/buttons.colVis.mjs b/js/buttons.colVis.mjs index 1f7ec58..0ca9e6b 100644 --- a/js/buttons.colVis.mjs +++ b/js/buttons.colVis.mjs @@ -5,7 +5,7 @@ import $ from 'jquery'; import DataTable from 'datatables.net'; -import 'datatables.net-buttons'; +import Buttons from 'datatables.net-buttons'; diff --git a/js/buttons.html5.js b/js/buttons.html5.js index edf07cd..137afff 100644 --- a/js/buttons.html5.js +++ b/js/buttons.html5.js @@ -32,11 +32,10 @@ require('datatables.net')(root, $); } - if ( ! $.fn.dataTable ) { + if ( ! $.fn.dataTable.Buttons ) { require('datatables.net-buttons')(root, $); } - return factory( $, root, root.document, jszip, pdfmake ); }; } diff --git a/js/buttons.html5.min.js b/js/buttons.html5.min.js index 46637b5..2744d6b 100644 --- a/js/buttons.html5.min.js +++ b/js/buttons.html5.min.js @@ -5,4 +5,4 @@ * FileSaver.js (1.3.3) - MIT license * Copyright © 2016 Eli Grey - http://eligrey.com */ -!function(n){"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(t){return n(t,window,document)}):"object"==typeof exports?module.exports=function(t,e,o,l){return t=t||window,(e=e||("undefined"!=typeof window?require("jquery"):require("jquery")(t))).fn.dataTable||require("datatables.net")(t,e),e.fn.dataTable||require("datatables.net-buttons")(t,e),n(e,t,t.document)}:n(jQuery,window,document)}(function(C,T,y,t,e,k){"use strict";var o,l,n=C.fn.dataTable;function S(){return o||T.JSZip}function s(){return l||T.pdfMake}n.Buttons.pdfMake=function(t){if(!t)return s();l=t},n.Buttons.jszip=function(t){if(!t)return S();o=t};function N(t){var e="Sheet1";return e=t.sheetName?t.sheetName.replace(/[\[\]\*\/\\\?\:]/g,""):e}function u(t,e){for(var o=c(e),l=t.buttons.exportData(e.exportOptions),n=e.fieldBoundary,r=e.fieldSeparator,a=new RegExp(n,"g"),d=e.escapeChar!==k?e.escapeChar:"\\",p=function(t){for(var e="",o=0,l=t.length;o',"xl/_rels/workbook.xml.rels":'',"[Content_Types].xml":'',"xl/workbook.xml":'',"xl/worksheets/sheet1.xml":'',"xl/styles.xml":''},R=[{match:/^\-?\d+\.\d%$/,style:60,fmt:function(t){return t/100}},{match:/^\-?\d+\.?\d*%$/,style:56,fmt:function(t){return t/100}},{match:/^\-?\$[\d,]+.?\d*$/,style:57},{match:/^\-?£[\d,]+.?\d*$/,style:58},{match:/^\-?€[\d,]+.?\d*$/,style:59},{match:/^\-?\d+$/,style:65},{match:/^\-?\d+\.\d{2}$/,style:66},{match:/^\([\d,]+\)$/,style:61,fmt:function(t){return-1*t.replace(/[\(\)]/g,"")}},{match:/^\([\d,]+\.\d{2}\)$/,style:62,fmt:function(t){return-1*t.replace(/[\(\)]/g,"")}},{match:/^\-?[\d,]+$/,style:63},{match:/^\-?[\d,]+\.\d{2}$/,style:64},{match:/^[\d]{4}\-[01][\d]\-[0123][\d]$/,style:67,fmt:function(t){return Math.round(25569+Date.parse(t)/864e5)}}];return n.ext.buttons.copyHtml5={className:"buttons-copy buttons-html5",text:function(t){return t.i18n("buttons.copy","Copy")},action:function(t,e,o,l){this.processing(!0);var n=this,r=u(e,l),a=e.buttons.exportInfo(l),d=c(l),p=r.str,i=C("
").css({height:1,width:1,overflow:"hidden",position:"fixed",top:0,left:0}),d=(a.title&&(p=a.title+d+d+p),a.messageTop&&(p=a.messageTop+d+d+p),a.messageBottom&&(p=p+d+d+a.messageBottom),l.customize&&(p=l.customize(p,l,e)),C("