Working towards support for both UMD and ESM loadings for plug-ins

pull/389/merge
Allan Jardine 2 years ago
parent e5e803ec5f
commit 4fff59b4ae

@ -0,0 +1,10 @@
{
"arrowParens": "always",
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"useTabs": true
}

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface Api<T> {
/** Average the values in a data set. */
average(): Number;
}
}
export {};

@ -1,3 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* It can sometimes be useful to get the average of data in an API result set,
* be it from a column, or a collection of cells. This method provides exactly
@ -20,13 +54,14 @@
* var table = $('#example').DataTable();
* table.cells( 0, [3,4] ).data().average();
*/
jQuery.fn.dataTable.Api.register( 'average()', function () {
DataTable.Api.register('average()', function () {
var data = this.flatten();
var sum = data.reduce(function (a, b) {
return (a*1) + (b*1); // cast values in-case they are strings
return a * 1 + b * 1; // cast values in-case they are strings
}, 0);
return sum / data.length;
});
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,r){"use strict";e=e.fn.dataTable;return e.Api.register("average()",function(){var e=this.flatten();return e.reduce(function(e,t){return+e+ +t},0)/e.length}),e});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.Api.register("average()",function(){var t=this.flatten();return t.reduce(function(t,a){return+t+ +a},0)/t.length});export default DataTable;

@ -0,0 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* It can sometimes be useful to get the average of data in an API result set,
* be it from a column, or a collection of cells. This method provides exactly
* that ability.
*
* @name average()
* @summary Average the values in a data set.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @returns {Number} Calculated average
*
* @example
* // Average a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().average();
*
* @example
* // Average two cells
* var table = $('#example').DataTable();
* table.cells( 0, [3,4] ).data().average();
*/
DataTable.Api.register('average()', function () {
var data = this.flatten();
var sum = data.reduce(function (a, b) {
return a * 1 + b * 1; // cast values in-case they are strings
}, 0);
return sum / data.length;
});
export default DataTable;

@ -0,0 +1,8 @@
/*! © Alejandro Navarro - datatables.net/license */
declare module 'datatables.net' {
interface ApiColumnMethods {
/** Get the title of a column */
title(): string;
}
}
export {};

@ -1,3 +1,37 @@
/*! © Alejandro Navarro - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* This plug-in will read the text from the header cell of a column, returning
* that value.
@ -14,8 +48,11 @@
* var table = $('#example').DataTable();
* table.column( 3 ).title();
*/
$.fn.dataTable.Api.register( 'column().title()', function () {
var colheader = this.header();
return $(colheader).text().trim();
DataTable.Api.register('column().title()', function () {
var title = this.header();
return $(title).text().trim();
});
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © Alejandro Navarro - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(t,e,n,r){"use strict";var i=t.fn.dataTable;return i.Api.register("column().title()",function(){var e=this.header();return t(e).text().trim()}),i});

@ -0,0 +1,2 @@
/*! © Alejandro Navarro - datatables.net/license */
import DataTable from"datatables.net";DataTable.Api.register("column().title()",function(){var t=this.header();return $(t).text().trim()});export default DataTable;

@ -0,0 +1,28 @@
/*! © Alejandro Navarro - datatables.net/license */
import DataTable from 'datatables.net';
/**
* This plug-in will read the text from the header cell of a column, returning
* that value.
*
* @name column().title()
* @summary Get the title of a column
* @author Alejandro Navarro
* @requires DataTables 1.10+
*
* @returns {String} Column title
*
* @example
* // Read the title text of column index 3
* var table = $('#example').DataTable();
* table.column( 3 ).title();
*/
DataTable.Api.register('column().title()', function () {
var title = this.header();
return $(title).text().trim();
});
export default DataTable;

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface ApiColumnsMethods {
/** pply multi-column ordering through the columns() */
order(dir: 'asc' | 'desc'): Api<any>;
}
}
export {};

@ -1,3 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* The DataTables core library provides the ability to set the ordering via the
* `dt-api column().order()` method, but there is no plural equivalent. While
@ -32,15 +66,16 @@
* // Multi-column sorting based on a name selector
* table.columns( [ 'sign_up_date:name', 'user_name:name' ] ).order( 'desc' ).draw();
*/
$.fn.dataTable.Api.register( 'columns().order()', function ( dir ) {
DataTable.Api.register('columns().order()', function (dir) {
return this.iterator('columns', function (settings, columns) {
var a = [];
for (var i = 0, ien = columns.length; i < ien; i++) {
a.push([columns[i], Array.isArray(dir) ? dir[i] : dir]);
}
new $.fn.dataTable.Api( settings ).order( a );
new DataTable.Api(settings).order(a);
});
});
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?module.exports=function(e,n){return e=e||window,n.fn.dataTable||require("datatables.net")(e,n),t(n,0,e.document)}:t(jQuery,window,document)}(function(e,n,t,r){"use strict";var u=e.fn.dataTable;return u.Api.register("columns().order()",function(i){return this.iterator("columns",function(e,n){for(var t=[],r=0,o=n.length;r<o;r++)t.push([n[r],Array.isArray(i)?i[r]:i]);new u.Api(e).order(t)})}),u});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.Api.register("columns().order()",function(n){return this.iterator("columns",function(a,r){for(var t=[],e=0,o=r.length;e<o;e++)t.push([r[e],Array.isArray(n)?n[e]:n]);new DataTable.Api(a).order(t)})});export default DataTable;

@ -0,0 +1,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* The DataTables core library provides the ability to set the ordering via the
* `dt-api column().order()` method, but there is no plural equivalent. While
* multi-column ordering can be set using `dt-api order()` that method requires
* that column indexes be used.
*
* This plug-in provides the plural `columns().order()` method so you can set
* multi-column ordering, while retaining the benefits of the `dt-api columns()`
* selector options.
*
* @name columns().order()
* @summary Apply multi-column ordering through the columns() API method.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
* @param {string|array} dir The order to apply to the columns selected. This
* can be a string (`asc` or `desc`) which will be applied to all columns,
* or an array (again `asc` or `desc` as the elements in the array) which is
* the same length as the number of columns selected, and will be applied to
* the columns in sequence.
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Apply multi-column sorting with a common direction
* table.columns( [ 1, 2 ] ).order( 'desc' ).draw();
*
* @example
* // Multi-column sorting with individual direction for the columns
* table.columns( [ 1, 2 ] ).order( [ 'desc', 'asc' ] ).draw();
*
* @example
* // Multi-column sorting based on a name selector
* table.columns( [ 'sign_up_date:name', 'user_name:name' ] ).order( 'desc' ).draw();
*/
DataTable.Api.register('columns().order()', function (dir) {
return this.iterator('columns', function (settings, columns) {
var a = [];
for (var i = 0, ien = columns.length; i < ien; i++) {
a.push([columns[i], Array.isArray(dir) ? dir[i] : dir]);
}
new DataTable.Api(settings).order(a);
});
});
export default DataTable;

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface ApiOrder {
/** Change ordering of the table to its data load order */
neutral(): Api<any>;
}
}
export {};

@ -1,3 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* This function will restore the order in which data was read into a DataTable
* (for example from an HTML source). Although you can set `dt-api order()` to
@ -19,8 +53,7 @@
* // Return table to the loaded data order
* table.order.neutral().draw();
*/
$.fn.dataTable.Api.register( 'order.neutral()', function () {
DataTable.Api.register('order.neutral()', function () {
return this.iterator('table', function (s) {
s.aaSorting.length = 0;
s.aiDisplay.sort(function (a, b) {
@ -31,3 +64,7 @@ $.fn.dataTable.Api.register( 'order.neutral()', function () {
});
});
});
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(e){"function"==typeof define&&define.amd?define(["datatables.net"],function(t){return e(t,window,document)}):"object"==typeof exports?module.exports=function(t,n){return t=t||window,n.fn.dataTable||require("datatables.net")(t,n),e(n,0,t.document)}:e(jQuery,window,document)}(function(t,n,e,r){"use strict";t=t.fn.dataTable;return t.Api.register("order.neutral()",function(){return this.iterator("table",function(t){t.aaSorting.length=0,t.aiDisplay.sort(function(t,n){return t-n}),t.aiDisplayMaster.sort(function(t,n){return t-n})})}),t});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.Api.register("order.neutral()",function(){return this.iterator("table",function(t){t.aaSorting.length=0,t.aiDisplay.sort(function(t,a){return t-a}),t.aiDisplayMaster.sort(function(t,a){return t-a})})});export default DataTable;

@ -0,0 +1,40 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* This function will restore the order in which data was read into a DataTable
* (for example from an HTML source). Although you can set `dt-api order()` to
* be an empty array (`[]`) in order to prevent sorting during initialisation,
* it can sometimes be useful to restore the original order after sorting has
* already occurred - which is exactly what this function does.
*
* Please note that this plug-in can only be used for client-side processing
* tables (i.e. without `serverSide: true`).
*
* @name order.neutral()
* @summary Change ordering of the table to its data load order
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Return table to the loaded data order
* table.order.neutral().draw();
*/
DataTable.Api.register('order.neutral()', function () {
return this.iterator('table', function (s) {
s.aaSorting.length = 0;
s.aiDisplay.sort(function (a, b) {
return a - b;
});
s.aiDisplayMaster.sort(function (a, b) {
return a - b;
});
});
});
export default DataTable;

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface ApiPage {
/** Change ordering of the table to its data load order */
jumpToData(data: any): Api<any>;
}
}
export {};

@ -1,3 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* It can be quite useful to jump straight to a page which contains a certain
* piece of data (a user name for example). This plug-in provides exactly that
@ -14,7 +48,7 @@
*
* @name page.JumpToData()
* @summary Jump to a page by searching for data from a column
* @author [Allan Jardine](http://sprymedia.co.uk)
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @param {*} data Data to search for
@ -25,14 +59,15 @@
* var table = $('#example').DataTable();
* table.page.jumpToData( "Allan Jardine", 0 );
*/
jQuery.fn.dataTable.Api.register( 'page.jumpToData()', function ( data, column ) {
DataTable.Api.register('page.jumpToData()', function (data, column) {
var pos = this.column(column, { order: 'current' }).data().indexOf(data);
if (pos >= 0) {
var page = Math.floor(pos / this.page.info().length);
this.page(page).draw(false);
}
return this;
});
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,o){"use strict";e=e.fn.dataTable;return e.Api.register("page.jumpToData()",function(e,t){t=this.column(t,{order:"current"}).data().indexOf(e);return 0<=t&&(e=Math.floor(t/this.page.info().length),this.page(e).draw(!1)),this}),e});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.Api.register("page.jumpToData()",function(a,t){t=this.column(t,{order:"current"}).data().indexOf(a);return 0<=t&&(a=Math.floor(t/this.page.info().length),this.page(a).draw(!1)),this});export default DataTable;

@ -0,0 +1,43 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* It can be quite useful to jump straight to a page which contains a certain
* piece of data (a user name for example). This plug-in provides exactly that
* ability, searching for a given data parameter from a given column and
* immediately shifting the paging of the table to jump to that point.
*
* If multiple data points match the requested data, the paging will be shifted
* to show the first instance. If there are no matches, the paging will not
* change.
*
* Note that unlike the core DataTables API methods, this plug-in will
* automatically call `dt-api draw()` to redraw the table with the current page
* shown.
*
* @name page.JumpToData()
* @summary Jump to a page by searching for data from a column
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @param {*} data Data to search for
* @param {integer} column Column index
* @returns {Api} DataTables API instance
*
* @example
* var table = $('#example').DataTable();
* table.page.jumpToData( "Allan Jardine", 0 );
*/
DataTable.Api.register('page.jumpToData()', function (data, column) {
var pos = this.column(column, { order: 'current' }).data().indexOf(data);
if (pos >= 0) {
var page = Math.floor(pos / this.page.info().length);
this.page(page).draw(false);
}
return this;
});
export default DataTable;

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface Api<T> {
/** Show / hide the processing indicator. */
processing(boolean: any): Api<T>;
}
}
export {};

@ -1,3 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* Externally trigger the display of DataTables' "processing" indicator.
*
@ -25,9 +59,12 @@
* table.processing( false );
* }, 2000 );
*/
jQuery.fn.dataTable.Api.register( 'processing()', function ( show ) {
DataTable.Api.register('processing()', function (show) {
return this.iterator('table', function (ctx) {
ctx.oApi._fnProcessingDisplay(ctx, show);
});
});
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?module.exports=function(e,n){return e=e||window,n.fn.dataTable||require("datatables.net")(e,n),t(n,0,e.document)}:t(jQuery,window,document)}(function(e,n,t,i){"use strict";e=e.fn.dataTable;return e.Api.register("processing()",function(n){return this.iterator("table",function(e){e.oApi._fnProcessingDisplay(e,n)})}),e});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.Api.register("processing()",function(a){return this.iterator("table",function(t){t.oApi._fnProcessingDisplay(t,a)})});export default DataTable;

@ -0,0 +1,40 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* Externally trigger the display of DataTables' "processing" indicator.
*
* Please note that of DataTables 2.0.0 this functionality is now built into
* DataTables core and this plug-in is no longer required.
*
* @name processing()
* @summary Show / hide the processing indicator via the API
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
* @param {boolean} show `true` to show the processing indicator, `false` to
* hide it.
*
* @returns {DataTables.Api} Unmodified API instance
*
* @example
* // Show a processing indicator for two seconds on initialisation
* var table = $('#example').DataTable( {
* processing: true
* } );
*
* table.processing( true );
*
* setTimeout( function () {
* table.processing( false );
* }, 2000 );
*/
DataTable.Api.register('processing()', function (show) {
return this.iterator('table', function (ctx) {
ctx.oApi._fnProcessingDisplay(ctx, show);
});
});
export default DataTable;

@ -0,0 +1,8 @@
/*! © Edouard Labre - datatables.net/license */
declare module 'datatables.net' {
interface ApiRowMethods<T> {
/** See the row in datable by display the right pagination page */
show(): Api<T>;
}
}
export {};

@ -1,3 +1,37 @@
/*! © Edouard Labre - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* This plugin jumps to the right page of the DataTable to show the required row
*
@ -20,14 +54,12 @@
*
* table.row.add( new_row ).draw().show().draw(false);
*/
$.fn.dataTable.Api.register('row().show()', function() {
DataTable.Api.register('row().show()', function () {
var page_info = this.table().page.info();
// Get row index
var new_row_index = this.index();
// Row position
var row_position = this.table()
.rows({ search: 'applied' })[0]
.indexOf(new_row_index);
var row_position = this.table().rows({ search: 'applied' })[0].indexOf(new_row_index);
// Already on right page ?
if ((row_position >= page_info.start && row_position < page_info.end) || row_position < 0) {
// Return row object
@ -40,3 +72,7 @@ $.fn.dataTable.Api.register('row().show()', function() {
// Return row object
return this;
});
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © Edouard Labre - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,i){"use strict";e=e.fn.dataTable;return e.Api.register("row().show()",function(){var e=this.table().page.info(),t=this.index(),t=this.table().rows({search:"applied"})[0].indexOf(t);return t>=e.start&&t<e.end||t<0||(e=Math.floor(t/this.table().page.len()),this.table().page(e)),this}),e});

@ -0,0 +1,2 @@
/*! © Edouard Labre - datatables.net/license */
import DataTable from"datatables.net";DataTable.Api.register("row().show()",function(){var a=this.table().page.info(),t=this.index(),t=this.table().rows({search:"applied"})[0].indexOf(t);return t>=a.start&&t<a.end||t<0||(a=Math.floor(t/this.table().page.len()),this.table().page(a)),this});export default DataTable;

@ -0,0 +1,48 @@
/*! © Edouard Labre - datatables.net/license */
import DataTable from 'datatables.net';
/**
* This plugin jumps to the right page of the DataTable to show the required row
*
* @version 1.0
* @name row().show()
* @summary See the row in datable by display the right pagination page
* @author [Edouard Labre](http://www.edouardlabre.com)
*
* @param {void} a row must be selected
* @returns {DataTables.Api.Rows} DataTables Rows API instance
*
* @example
* // Add an element to a huge table and go to the right pagination page
* var table = $('#example').DataTable();
* var new_row = {
* DT_RowId: 'row_example',
* name: 'example',
* value: 'an example row'
* };
*
* table.row.add( new_row ).draw().show().draw(false);
*/
DataTable.Api.register('row().show()', function () {
var page_info = this.table().page.info();
// Get row index
var new_row_index = this.index();
// Row position
var row_position = this.table().rows({ search: 'applied' })[0].indexOf(new_row_index);
// Already on right page ?
if ((row_position >= page_info.start && row_position < page_info.end) || row_position < 0) {
// Return row object
return this;
}
// Find page number
var page_to_display = Math.floor(row_position / this.table().page.len());
// Go to that page
this.table().page(page_to_display);
// Return row object
return this;
});
export default DataTable;

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface ApiRowsMethods<T> {
/** Create tr elements for rows which have not yet had their nodes created. */
generate(): Api<T>;
}
}
export {};

@ -1,3 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* When using `-init deferRender` you might find that under a specific set of circumstances you
* need the `-tag tr` element for a row which hasn't yet been drawn. This method can be used to
@ -14,9 +48,12 @@
* // Create nodes for all rows
* table.rows().generate();
*/
$.fn.dataTable.Api.register( 'rows().generate()', function () {
DataTable.Api.register('rows().generate()', function () {
return this.iterator('row', function (context, index) {
context.oApi._fnCreateTr(context, index);
});
});
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,o){"use strict";e=e.fn.dataTable;return e.Api.register("rows().generate()",function(){return this.iterator("row",function(e,t){e.oApi._fnCreateTr(e,t)})}),e});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.Api.register("rows().generate()",function(){return this.iterator("row",function(t,a){t.oApi._fnCreateTr(t,a)})});export default DataTable;

@ -0,0 +1,29 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* When using `-init deferRender` you might find that under a specific set of circumstances you
* need the `-tag tr` element for a row which hasn't yet been drawn. This method can be used to
* create the nodes for the rows which haven't yet been drawn.
*
* @name rows().generate()
* @summary Create tr elements for rows which have not yet had their nodes created.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTable.Api} DataTables API instance
*
* @example
* // Create nodes for all rows
* table.rows().generate();
*/
DataTable.Api.register('rows().generate()', function () {
return this.iterator('row', function (context, index) {
context.oApi._fnCreateTr(context, index);
});
});
export default DataTable;

@ -0,0 +1,42 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* It can sometimes be useful to get the average of data in an API result set,
* be it from a column, or a collection of cells. This method provides exactly
* that ability.
*
* @name average()
* @summary Average the values in a data set.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @returns {Number} Calculated average
*
* @example
* // Average a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().average();
*
* @example
* // Average two cells
* var table = $('#example').DataTable();
* table.cells( 0, [3,4] ).data().average();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface Api<T> {
/** Average the values in a data set. */
average(): Number;
}
}
DataTable.Api.register<Number>('average()', function () {
var data = this.flatten();
var sum = data.reduce(function (a, b) {
return a * 1 + b * 1; // cast values in-case they are strings
}, 0);
return sum / data.length;
});

@ -0,0 +1,32 @@
/*! © Alejandro Navarro - datatables.net/license */
/**
* This plug-in will read the text from the header cell of a column, returning
* that value.
*
* @name column().title()
* @summary Get the title of a column
* @author Alejandro Navarro
* @requires DataTables 1.10+
*
* @returns {String} Column title
*
* @example
* // Read the title text of column index 3
* var table = $('#example').DataTable();
* table.column( 3 ).title();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiColumnMethods {
/** Get the title of a column */
title(): string;
}
}
DataTable.Api.register('column().title()', function () {
var title = this.header();
return $(title).text().trim();
});

@ -0,0 +1,57 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* The DataTables core library provides the ability to set the ordering via the
* `dt-api column().order()` method, but there is no plural equivalent. While
* multi-column ordering can be set using `dt-api order()` that method requires
* that column indexes be used.
*
* This plug-in provides the plural `columns().order()` method so you can set
* multi-column ordering, while retaining the benefits of the `dt-api columns()`
* selector options.
*
* @name columns().order()
* @summary Apply multi-column ordering through the columns() API method.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
* @param {string|array} dir The order to apply to the columns selected. This
* can be a string (`asc` or `desc`) which will be applied to all columns,
* or an array (again `asc` or `desc` as the elements in the array) which is
* the same length as the number of columns selected, and will be applied to
* the columns in sequence.
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Apply multi-column sorting with a common direction
* table.columns( [ 1, 2 ] ).order( 'desc' ).draw();
*
* @example
* // Multi-column sorting with individual direction for the columns
* table.columns( [ 1, 2 ] ).order( [ 'desc', 'asc' ] ).draw();
*
* @example
* // Multi-column sorting based on a name selector
* table.columns( [ 'sign_up_date:name', 'user_name:name' ] ).order( 'desc' ).draw();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiColumnsMethods {
/** pply multi-column ordering through the columns() */
order(dir: 'asc' | 'desc'): Api<any>;
}
}
DataTable.Api.register('columns().order()', function (dir) {
return this.iterator('columns', function (settings, columns) {
var a: [number, string][] = [];
for (var i = 0, ien = columns.length; i < ien; i++) {
a.push([columns[i], Array.isArray(dir) ? dir[i] : dir]);
}
new DataTable.Api(settings).order(a);
});
});

@ -0,0 +1,44 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* This function will restore the order in which data was read into a DataTable
* (for example from an HTML source). Although you can set `dt-api order()` to
* be an empty array (`[]`) in order to prevent sorting during initialisation,
* it can sometimes be useful to restore the original order after sorting has
* already occurred - which is exactly what this function does.
*
* Please note that this plug-in can only be used for client-side processing
* tables (i.e. without `serverSide: true`).
*
* @name order.neutral()
* @summary Change ordering of the table to its data load order
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTables.Api} DataTables API instance
*
* @example
* // Return table to the loaded data order
* table.order.neutral().draw();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiOrder {
/** Change ordering of the table to its data load order */
neutral(): Api<any>;
}
}
DataTable.Api.register('order.neutral()', function () {
return this.iterator('table', function (s) {
s.aaSorting.length = 0;
s.aiDisplay.sort(function (a, b) {
return a - b;
});
s.aiDisplayMaster.sort(function (a, b) {
return a - b;
});
});
});

@ -0,0 +1,49 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* It can be quite useful to jump straight to a page which contains a certain
* piece of data (a user name for example). This plug-in provides exactly that
* ability, searching for a given data parameter from a given column and
* immediately shifting the paging of the table to jump to that point.
*
* If multiple data points match the requested data, the paging will be shifted
* to show the first instance. If there are no matches, the paging will not
* change.
*
* Note that unlike the core DataTables API methods, this plug-in will
* automatically call `dt-api draw()` to redraw the table with the current page
* shown.
*
* @name page.JumpToData()
* @summary Jump to a page by searching for data from a column
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @param {*} data Data to search for
* @param {integer} column Column index
* @returns {Api} DataTables API instance
*
* @example
* var table = $('#example').DataTable();
* table.page.jumpToData( "Allan Jardine", 0 );
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiPage {
/** Change ordering of the table to its data load order */
jumpToData(data: any): Api<any>;
}
}
DataTable.Api.register('page.jumpToData()', function (data, column) {
var pos = this.column(column, { order: 'current' }).data().indexOf(data);
if (pos >= 0) {
var page = Math.floor(pos / this.page.info().length);
this.page(page).draw(false);
}
return this;
});

@ -0,0 +1,44 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* Externally trigger the display of DataTables' "processing" indicator.
*
* Please note that of DataTables 2.0.0 this functionality is now built into
* DataTables core and this plug-in is no longer required.
*
* @name processing()
* @summary Show / hide the processing indicator via the API
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
* @param {boolean} show `true` to show the processing indicator, `false` to
* hide it.
*
* @returns {DataTables.Api} Unmodified API instance
*
* @example
* // Show a processing indicator for two seconds on initialisation
* var table = $('#example').DataTable( {
* processing: true
* } );
*
* table.processing( true );
*
* setTimeout( function () {
* table.processing( false );
* }, 2000 );
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface Api<T> {
/** Show / hide the processing indicator. */
processing(boolean): Api<T>;
}
}
DataTable.Api.register('processing()', function (show) {
return this.iterator('table', function (ctx) {
ctx.oApi._fnProcessingDisplay(ctx, show);
});
});

@ -0,0 +1,55 @@
/*! © Edouard Labre - datatables.net/license */
/**
* This plugin jumps to the right page of the DataTable to show the required row
*
* @version 1.0
* @name row().show()
* @summary See the row in datable by display the right pagination page
* @author [Edouard Labre](http://www.edouardlabre.com)
*
* @param {void} a row must be selected
* @returns {DataTables.Api.Rows} DataTables Rows API instance
*
* @example
* // Add an element to a huge table and go to the right pagination page
* var table = $('#example').DataTable();
* var new_row = {
* DT_RowId: 'row_example',
* name: 'example',
* value: 'an example row'
* };
*
* table.row.add( new_row ).draw().show().draw(false);
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiRowMethods<T> {
/** See the row in datable by display the right pagination page */
show(): Api<T>;
}
}
DataTable.Api.register('row().show()', function () {
var page_info = this.table().page.info();
// Get row index
var new_row_index = this.index();
// Row position
var row_position = this.table().rows({ search: 'applied' })[0].indexOf(new_row_index);
// Already on right page ?
if ((row_position >= page_info.start && row_position < page_info.end) || row_position < 0) {
// Return row object
return this;
}
// Find page number
var page_to_display = Math.floor(row_position / this.table().page.len());
// Go to that page
this.table().page(page_to_display);
// Return row object
return this;
});

@ -0,0 +1,33 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* When using `-init deferRender` you might find that under a specific set of circumstances you
* need the `-tag tr` element for a row which hasn't yet been drawn. This method can be used to
* create the nodes for the rows which haven't yet been drawn.
*
* @name rows().generate()
* @summary Create tr elements for rows which have not yet had their nodes created.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {DataTable.Api} DataTables API instance
*
* @example
* // Create nodes for all rows
* table.rows().generate();
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface ApiRowsMethods<T> {
/** Create tr elements for rows which have not yet had their nodes created. */
generate(): Api<T>;
}
}
DataTable.Api.register('rows().generate()', function () {
return this.iterator('row', function (context, index) {
context.oApi._fnCreateTr(context, index);
});
});

@ -0,0 +1,61 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* Fairly simply, this plug-in will take the data from an API result set
* and sum it, returning the summed value. The data can come from any data
* source, including column data, cells or rows.
*
* Note that it will attempt to 'deformat' any string based data that is passed
* into it - i.e. it will strip any non-numeric characters in order to make a
* best effort attempt to sum all data types. This can be useful when working
* with formatting numbers such as currency. However the trade-off is that no
* error is thrown if non-numeric data is passed in. You should be aware of this
* in case unexpected values are returned - likely the input data is not what is
* expected.
*
* @name sum()
* @summary Sum the values in a data set.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {Number} Summed value
*
* @example
* // Simply get the sum of a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().sum();
*
* @example
* // Insert the sum of a column into the columns footer, for the visible
* // data on each draw
* $('#example').DataTable( {
* drawCallback: function () {
* var api = this.api();
* $( api.table().footer() ).html(
* api.column( 4, {page:'current'} ).data().sum()
* );
* }
* } );
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface Api<T> {
/** Sum the values in a data set. */
sum(): Number;
}
}
DataTable.Api.register('sum()', function () {
return this.flatten().reduce(function (a, b) {
if (typeof a === 'string') {
a = a.replace(/[^\d.-]/g, '') as any * 1;
}
if (typeof b === 'string') {
b = b.replace(/[^\d.-]/g, '') as any * 1;
}
return a + b;
}, 0);
});

8
api/sum().d.ts vendored

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface Api<T> {
/** Sum the values in a data set. */
sum(): Number;
}
}
export {};

@ -1,3 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* Fairly simply, this plug-in will take the data from an API result set
* and sum it, returning the summed value. The data can come from any data
@ -13,7 +47,7 @@
*
* @name sum()
* @summary Sum the values in a data set.
* @author [Allan Jardine](http://sprymedia.co.uk)
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {Number} Summed value
@ -35,8 +69,7 @@
* }
* } );
*/
jQuery.fn.dataTable.Api.register( 'sum()', function ( ) {
DataTable.Api.register('sum()', function () {
return this.flatten().reduce(function (a, b) {
if (typeof a === 'string') {
a = a.replace(/[^\d.-]/g, '') * 1;
@ -44,8 +77,10 @@ jQuery.fn.dataTable.Api.register( 'sum()', function ( ) {
if (typeof b === 'string') {
b = b.replace(/[^\d.-]/g, '') * 1;
}
return a + b;
}, 0);
});
return DataTable;
}));

2
api/sum().min.js vendored

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,r){"use strict";e=e.fn.dataTable;return e.Api.register("sum()",function(){return this.flatten().reduce(function(e,t){return(e="string"==typeof e?+e.replace(/[^\d.-]/g,""):e)+(t="string"==typeof t?+t.replace(/[^\d.-]/g,""):t)},0)}),e});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.Api.register("sum()",function(){return this.flatten().reduce(function(t,e){return(t="string"==typeof t?+t.replace(/[^\d.-]/g,""):t)+(e="string"==typeof e?+e.replace(/[^\d.-]/g,""):e)},0)});export default DataTable;

@ -0,0 +1,56 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* Fairly simply, this plug-in will take the data from an API result set
* and sum it, returning the summed value. The data can come from any data
* source, including column data, cells or rows.
*
* Note that it will attempt to 'deformat' any string based data that is passed
* into it - i.e. it will strip any non-numeric characters in order to make a
* best effort attempt to sum all data types. This can be useful when working
* with formatting numbers such as currency. However the trade-off is that no
* error is thrown if non-numeric data is passed in. You should be aware of this
* in case unexpected values are returned - likely the input data is not what is
* expected.
*
* @name sum()
* @summary Sum the values in a data set.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {Number} Summed value
*
* @example
* // Simply get the sum of a column
* var table = $('#example').DataTable();
* table.column( 3 ).data().sum();
*
* @example
* // Insert the sum of a column into the columns footer, for the visible
* // data on each draw
* $('#example').DataTable( {
* drawCallback: function () {
* var api = this.api();
* $( api.table().footer() ).html(
* api.column( 4, {page:'current'} ).data().sum()
* );
* }
* } );
*/
DataTable.Api.register('sum()', function () {
return this.flatten().reduce(function (a, b) {
if (typeof a === 'string') {
a = a.replace(/[^\d.-]/g, '') * 1;
}
if (typeof b === 'string') {
b = b.replace(/[^\d.-]/g, '') * 1;
}
return a + b;
}, 0);
});
export default DataTable;

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface Api<T> {
/** Average the values in a data set. */
average(): Number;
}
}
export {};

@ -1,6 +1,36 @@
/*! Download button for Buttons
* 2018 SpryMedia Ltd - MIT licensed - datatables.net/license
*/
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* @summary Download Button
@ -33,50 +63,44 @@
* ]
* });
*/
(function(window, document, $, undefined) {
function flattenJson(data, name, flattened) {
if (!flattened) {
flattened = {};
}
if (!name) {
name = '';
}
if ($.isPlainObject(data) || Array.isArray(data)) {
$.each(data, function (idx, val) {
if (name === '') {
flattenJson(val, idx, flattened);
} else {
flattenJson(val, name + '[' + idx + ']', flattened);
}
else {
flattenJson(val, name + '[' + idx.toString() + ']', flattened);
}
});
} else {
}
else {
flattened[name] = data;
}
return flattened;
}
$.fn.dataTable.ext.buttons.download = {
DataTable.ext.buttons.download = {
text: 'Download',
action: function (e, dt, node, config) {
// Gather information to be submitted
var data = {};
if (dt.page.info().serverSide) {
$.extend(data, dt.ajax.params());
}
if (typeof config.data === 'function') {
config.data(data);
} else if (typeof config.data === 'object') {
}
else if (typeof config.data === 'object') {
$.extend(data, config.data);
}
// Convert data to a flat structure for submission
var flattened = flattenJson(data);
// Create an iframe
var iframe = $('<iframe/>')
.css({
@ -85,29 +109,28 @@
width: 0
})
.appendTo(document.body);
var contentDoc = iframe[0].contentWindow.document;
contentDoc.open();
contentDoc.close();
var form = $('<form/>', contentDoc)
.attr('method', config.type)
.attr('action', config.url)
.appendTo(contentDoc.body);
$.each(flattened, function (name, val) {
$('<input/>', contentDoc)
.attr('type', 'text')
.attr('name', name)
.attr('name', name.toString())
.attr('autocomplete', 'no')
.val(val)
.appendTo(form);
});
form.submit();
},
url: '',
type: 'POST',
data: {}
};
})(window, document, jQuery);
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?module.exports=function(t,e){return t=t||window,e.fn.dataTable||require("datatables.net")(t,e),n(e,0,t.document)}:n(jQuery,window,document)}(function(i,t,u,e){"use strict";var n=i.fn.dataTable;return n.ext.buttons.download={text:"Download",action:function(t,e,n,o){var a={},e=(e.page.info().serverSide&&i.extend(a,e.ajax.params()),"function"==typeof o.data?o.data(a):"object"==typeof o.data&&i.extend(a,o.data),function n(t,o,a){return a=a||{},o=o||"",i.isPlainObject(t)||Array.isArray(t)?i.each(t,function(t,e){n(e,""===o?t:o+"["+t.toString()+"]",a)}):a[o]=t,a}(a)),d=i("<iframe/>").css({border:"none",height:0,width:0}).appendTo(u.body)[0].contentWindow.document,r=(d.open(),d.close(),i("<form/>",d).attr("method",o.type).attr("action",o.url).appendTo(d.body));i.each(e,function(t,e){i("<input/>",d).attr("type","text").attr("name",t.toString()).attr("autocomplete","no").val(e).appendTo(r)}),r.submit()},url:"",type:"POST",data:{}},n});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";function flattenJson(t,e,n){return n=n||{},e=e||"",$.isPlainObject(t)||Array.isArray(t)?$.each(t,function(t,a){flattenJson(a,""===e?t:e+"["+t.toString()+"]",n)}):n[e]=t,n}DataTable.ext.buttons.download={text:"Download",action:function(t,a,e,n){var o={},a=(a.page.info().serverSide&&$.extend(o,a.ajax.params()),"function"==typeof n.data?n.data(o):"object"==typeof n.data&&$.extend(o,n.data),flattenJson(o)),r=$("<iframe/>").css({border:"none",height:0,width:0}).appendTo(document.body)[0].contentWindow.document,d=(r.open(),r.close(),$("<form/>",r).attr("method",n.type).attr("action",n.url).appendTo(r.body));$.each(a,function(t,a){$("<input/>",r).attr("type","text").attr("name",t.toString()).attr("autocomplete","no").val(a).appendTo(d)}),d.submit()},url:"",type:"POST",data:{}};export default DataTable;

@ -0,0 +1,106 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* @summary Download Button
* @author SpryMedia Ltd (www.datatables.net)
* @copyright Copyright 2018 SpryMedia Ltd.
*
* License MIT - http://datatables.net/license/mit
*
* A button that can be used to trigger a server-side action, typically a
* download of a file generated by the server. If server-side processing
* is enabled in the host table it will automatically add the last parameters
* used for a table draw allowing the script to output a file with the same
* order / search applied as the main table.
*
* This is particularly useful when using server-side processing and wishing
* to allow user export of the data in a table. The default Buttons package
* will only export the data available on the client-side, while this button
* can be used to let the server generate the required file and then download
* it to the client-side.
*
* @example
* // Download button
* var table = $('#example').DataTable({
* dom: 'Bfrtip',
* buttons: [
* {
* extend: 'download',
* url: '/api/download'
* }
* ]
* });
*/
function flattenJson(data, name, flattened) {
if (!flattened) {
flattened = {};
}
if (!name) {
name = '';
}
if ($.isPlainObject(data) || Array.isArray(data)) {
$.each(data, function (idx, val) {
if (name === '') {
flattenJson(val, idx, flattened);
}
else {
flattenJson(val, name + '[' + idx.toString() + ']', flattened);
}
});
}
else {
flattened[name] = data;
}
return flattened;
}
DataTable.ext.buttons.download = {
text: 'Download',
action: function (e, dt, node, config) {
// Gather information to be submitted
var data = {};
if (dt.page.info().serverSide) {
$.extend(data, dt.ajax.params());
}
if (typeof config.data === 'function') {
config.data(data);
}
else if (typeof config.data === 'object') {
$.extend(data, config.data);
}
// Convert data to a flat structure for submission
var flattened = flattenJson(data);
// Create an iframe
var iframe = $('<iframe/>')
.css({
border: 'none',
height: 0,
width: 0
})
.appendTo(document.body);
var contentDoc = iframe[0].contentWindow.document;
contentDoc.open();
contentDoc.close();
var form = $('<form/>', contentDoc)
.attr('method', config.type)
.attr('action', config.url)
.appendTo(contentDoc.body);
$.each(flattened, function (name, val) {
$('<input/>', contentDoc)
.attr('type', 'text')
.attr('name', name.toString())
.attr('autocomplete', 'no')
.val(val)
.appendTo(form);
});
form.submit();
},
url: '',
type: 'POST',
data: {}
};
export default DataTable;

@ -0,0 +1,119 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* @summary Download Button
* @author SpryMedia Ltd (www.datatables.net)
* @copyright Copyright 2018 SpryMedia Ltd.
*
* License MIT - http://datatables.net/license/mit
*
* A button that can be used to trigger a server-side action, typically a
* download of a file generated by the server. If server-side processing
* is enabled in the host table it will automatically add the last parameters
* used for a table draw allowing the script to output a file with the same
* order / search applied as the main table.
*
* This is particularly useful when using server-side processing and wishing
* to allow user export of the data in a table. The default Buttons package
* will only export the data available on the client-side, while this button
* can be used to let the server generate the required file and then download
* it to the client-side.
*
* @example
* // Download button
* var table = $('#example').DataTable({
* dom: 'Bfrtip',
* buttons: [
* {
* extend: 'download',
* url: '/api/download'
* }
* ]
* });
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface Api<T> {
/** Average the values in a data set. */
average(): Number;
}
}
function flattenJson(data, name?, flattened?) {
if (!flattened) {
flattened = {};
}
if (!name) {
name = '';
}
if ($.isPlainObject(data) || Array.isArray(data)) {
$.each(data, function (idx, val) {
if (name === '') {
flattenJson(val, idx, flattened);
} else {
flattenJson(val, name + '[' + idx.toString() + ']', flattened);
}
});
} else {
flattened[name] = data;
}
return flattened;
}
DataTable.ext.buttons.download = {
text: 'Download',
action: function (e, dt, node, config) {
// Gather information to be submitted
var data = {};
if (dt.page.info().serverSide) {
$.extend(data, dt.ajax.params());
}
if (typeof config.data === 'function') {
config.data(data);
} else if (typeof config.data === 'object') {
$.extend(data, config.data);
}
// Convert data to a flat structure for submission
var flattened = flattenJson(data);
// Create an iframe
var iframe = $('<iframe/>')
.css({
border: 'none',
height: 0,
width: 0,
})
.appendTo(document.body);
var contentDoc = (iframe[0] as any).contentWindow.document;
contentDoc.open();
contentDoc.close();
var form = $('<form/>', contentDoc)
.attr('method', config.type)
.attr('action', config.url)
.appendTo(contentDoc.body);
$.each(flattened, function (name, val) {
$('<input/>', contentDoc)
.attr('type', 'text')
.attr('name', name.toString())
.attr('autocomplete', 'no')
.val(val)
.appendTo(form);
});
form.submit();
},
url: '',
type: 'POST',
data: {},
};

@ -0,0 +1,10 @@
/*! © Fedonyuk Anton - datatables.net/license */
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Renders the column data as HTML anchor (`a` tag) */
anchor(type: string, attribute: {
[key: string]: any;
}, innerText: string | null): any;
}
}
export {};

@ -1,3 +1,37 @@
/*! © Fedonyuk Anton - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* @name anchor
* @summary Renders the column data as HTML anchor (`a` tag)
@ -30,23 +64,18 @@
* }]
* });
*/
jQuery.fn.dataTable.render.anchor = function (
type = 'link',
attributes = {},
innerText = null
) {
DataTable.render.anchor = function (type = 'link', attributes = {}, innerText = null) {
return function (data, type, row, meta = {}) {
// restriction only for table display rendering
if (type !== 'display') {
return data;
}
if (innerText === null) {
innerText = data;
}
var attrs = attributes typeof 'function' ? attributes(data, row, meta) : attributes;
var attrs = typeof attributes === 'function'
? attributes(data, row, meta)
: attributes;
if (!attrs.href) {
switch (type) {
case 'mail':
@ -56,17 +85,20 @@ jQuery.fn.dataTable.render.anchor = function (
attrs.href = 'tel:' + data.replace(/[^+\d]+/g, '');
break;
case 'link':
case default:
default:
try {
attrs.href = new URL(data);
} catch (e) {
}
catch (e) {
attrs.href = data;
}
}
}
var anchorEl = jQuery('<a/>');
return anchorEl.attr(attrs).text(innerText)[0].outerText;
return anchorEl.attr(attrs).text(innerText || '')[0].outerText;
};
};
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © Fedonyuk Anton - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,r){"use strict";e=e.fn.dataTable;return e.render.anchor=function(e=0,u={},o=null){return function(t,e,n,r={}){if("display"!==e)return t;null===o&&(o=t);var a="function"==typeof u?u(t,n,r):u;if(!a.href)switch(e){case"mail":a.href="mailto:"+t;break;case"phone":a.href="tel:"+t.replace(/[^+\d]+/g,"");break;default:try{a.href=new URL(t)}catch(e){a.href=t}}return jQuery("<a/>").attr(a).text(o||"")[0].outerText}},e});

@ -0,0 +1,2 @@
/*! © Fedonyuk Anton - datatables.net/license */
import DataTable from"datatables.net";DataTable.render.anchor=function(e=0,l={},f=null){return function(t,e,a,r={}){if("display"!==e)return t;null===f&&(f=t);var n="function"==typeof l?l(t,a,r):l;if(!n.href)switch(e){case"mail":n.href="mailto:"+t;break;case"phone":n.href="tel:"+t.replace(/[^+\d]+/g,"");break;default:try{n.href=new URL(t)}catch(e){n.href=t}}return jQuery("<a/>").attr(n).text(f||"")[0].outerText}};export default DataTable;

@ -0,0 +1,74 @@
/*! © Fedonyuk Anton - datatables.net/license */
import DataTable from 'datatables.net';
/**
* @name anchor
* @summary Renders the column data as HTML anchor (`a` tag)
* @author [Fedonyuk Anton](http://ensostudio.ru)
* @requires DataTables 1.10+
*
* @param {string} type The anchor type: 'link'(by default), 'phone' or 'email'
* @param {object|function} attributes The attributes of the anchor tag or the
* callback function returning the tag attributes, the callback syntax:
* `function (mixed data, object|array row, object meta): object`
* @param {string|null} innerText The inner text of the anchor tag or `null` to
* set text by column `data` (by default)
* @returns {string}
*
* @example
* // Display `<a href="..." target="_blank">...</a>`
* $('#example').DataTable({
* columnDefs: [{
* targets: 1,
* render: $.fn.dataTable.render.anchor()
* }]
* });
*
* @example
* // Display `<a href="mailto:..." class="link">...</a>`
* $('#example').DataTable({
* columnDefs: [{
* targets: 2,
* render: $.fn.dataTable.render.anchor('email', {'class': 'link'})
* }]
* });
*/
DataTable.render.anchor = function (type = 'link', attributes = {}, innerText = null) {
return function (data, type, row, meta = {}) {
// restriction only for table display rendering
if (type !== 'display') {
return data;
}
if (innerText === null) {
innerText = data;
}
var attrs = typeof attributes === 'function'
? attributes(data, row, meta)
: attributes;
if (!attrs.href) {
switch (type) {
case 'mail':
attrs.href = 'mailto:' + data;
break;
case 'phone':
attrs.href = 'tel:' + data.replace(/[^+\d]+/g, '');
break;
case 'link':
default:
try {
attrs.href = new URL(data);
}
catch (e) {
attrs.href = data;
}
}
}
var anchorEl = jQuery('<a/>');
return anchorEl.attr(attrs).text(innerText || '')[0].outerText;
};
};
export default DataTable;

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Convert date / time source data into one suitable for display */
moment(from: string, to?: string, locale?: string): any;
}
}
export {};

@ -1,4 +1,43 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* NOTE - As of DataTables 1.12, DataTables has a built in date / time renderer
* which should be used in place of this renderer. See
* [the manual](https://datatables.net/manual/data/renderers#Date-and-time-helpers)
* for details.
*
* Date / time formats often from back from server APIs in a format that you
* don't wish to display to your end users (ISO8601 for example). This rendering
* helper can be used to transform any source date / time format into something
@ -14,9 +53,9 @@
*
* It accepts one, two or three parameters:
*
* * `$.fn.dataTable.render.moment( to );`
* * `$.fn.dataTable.render.moment( from, to );`
* * `$.fn.dataTable.render.moment( from, to, locale );`
* * `DataTable.render.moment( to );`
* * `DataTable.render.moment( from, to );`
* * `DataTable.render.moment( from, to, locale );`
*
* Where:
*
@ -36,7 +75,7 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: $.fn.dataTable.render.moment( 'Do MMM YYYY' )
* render: DataTable.render.moment( 'Do MMM YYYY' )
* } ]
* } );
*
@ -45,7 +84,7 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: $.fn.dataTable.render.moment( 'X', 'Do MMM YY' )
* render: DataTable.render.moment( 'X', 'Do MMM YY' )
* } ]
* } );
*
@ -54,60 +93,21 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: $.fn.dataTable.render.moment( 'YYYY/MM/DD', 'Do MMM YY', 'fr' )
* render: DataTable.render.moment( 'YYYY/MM/DD', 'Do MMM YY', 'fr' )
* } ]
* } );
*/
// UMD
(function( factory ) {
"use strict";
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
root = window;
}
if ( ! $ ) {
$ = typeof window !== 'undefined' ?
require('jquery') :
require('jquery')( root );
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}
(function( $, window, document ) {
$.fn.dataTable.render.moment = function ( from, to, locale ) {
DataTable.render.moment = function (from, to, locale) {
// Argument shifting
if (arguments.length === 1) {
to = from;
from = 'YYYY-MM-DD';
}
return function (d, type, row) {
if (!d) {
return type === 'sort' || type === 'type' ? 0 : d;
}
var m = window.moment(d, from, locale, true);
// Order and type get a number value from Moment, everything else
// sees the rendered value
return m.format(type === 'sort' || type === 'type' ? 'x' : to);
@ -115,4 +115,5 @@ $.fn.dataTable.render.moment = function ( from, to, locale ) {
};
return DateTime;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,e,e.document)}:n(jQuery,window,document)}(function(e,d,t,n){"use strict";return e.fn.dataTable.render.moment=function(o,r,u){return 1===arguments.length&&(r=o,o="YYYY-MM-DD"),function(e,t,n){return e?d.moment(e,o,u,!0).format("sort"===t||"type"===t?"x":r):"sort"===t||"type"===t?0:e}},DateTime});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.render.moment=function(n,r,o){return 1===arguments.length&&(r=n,n="YYYY-MM-DD"),function(t,e,a){return t?window.moment(t,n,o,!0).format("sort"===e||"type"===e?"x":r):"sort"===e||"type"===e?0:t}};export default DateTime;

@ -0,0 +1,89 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* NOTE - As of DataTables 1.12, DataTables has a built in date / time renderer
* which should be used in place of this renderer. See
* [the manual](https://datatables.net/manual/data/renderers#Date-and-time-helpers)
* for details.
*
* Date / time formats often from back from server APIs in a format that you
* don't wish to display to your end users (ISO8601 for example). This rendering
* helper can be used to transform any source date / time format into something
* which can be easily understood by your users when reading the table, and also
* by DataTables for sorting the table.
*
* The [MomentJS library](http://momentjs.com/) is used to accomplish this and
* you simply need to tell it which format to transfer from, to and specify a
* locale if required.
*
* This function should be used with the `dt-init columns.render` configuration
* option of DataTables.
*
* It accepts one, two or three parameters:
*
* * `DataTable.render.moment( to );`
* * `DataTable.render.moment( from, to );`
* * `DataTable.render.moment( from, to, locale );`
*
* Where:
*
* * `to` - the format that will be displayed to the end user
* * `from` - the format that is supplied in the data (the default is ISO8601 -
* `YYYY-MM-DD`)
* * `locale` - the locale which MomentJS should use - the default is `en`
* (English).
*
* @name datetime
* @summary Convert date / time source data into one suitable for display
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+, Moment.js 1.7+
*
* @example
* // Convert ISO8601 dates into a simple human readable format
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: DataTable.render.moment( 'Do MMM YYYY' )
* } ]
* } );
*
* @example
* // Specify a source format - in this case a unix timestamp
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.moment( 'X', 'Do MMM YY' )
* } ]
* } );
*
* @example
* // Specify a source format and locale
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.moment( 'YYYY/MM/DD', 'Do MMM YY', 'fr' )
* } ]
* } );
*/
DataTable.render.moment = function (from, to, locale) {
// Argument shifting
if (arguments.length === 1) {
to = from;
from = 'YYYY-MM-DD';
}
return function (d, type, row) {
if (!d) {
return type === 'sort' || type === 'type' ? 0 : d;
}
var m = window.moment(d, from, locale, true);
// Order and type get a number value from Moment, everything else
// sees the rendered value
return m.format(type === 'sort' || type === 'type' ? 'x' : to);
};
};
export default DateTime;

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Restrict output data to a particular length, showing anything longer with ellipsis */
ellipsis(cutoff: number, wordbreak?: boolean, escapeHtml?: boolean): any;
}
}
export {};

@ -1,3 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* This data rendering helper method can be useful for cases where you have
* potentially large data strings to be shown in a column that is restricted by
@ -33,7 +67,7 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: $.fn.dataTable.render.ellipsis( 17, true )
* render: DataTable.render.ellipsis( 17, true )
* } ]
* } );
*
@ -42,12 +76,11 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: $.fn.dataTable.render.ellipsis( 10 )
* render: DataTable.render.ellipsis( 10 )
* } ]
* } );
*/
jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml ) {
DataTable.render.ellipsis = function (cutoff, wordbreak, escapeHtml) {
var esc = function (t) {
return ('' + t)
.replace(/&/g, '&amp;')
@ -55,41 +88,41 @@ jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml )
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};
return function (d, type, row) {
// Order, search and type get the original data
if (type !== 'display') {
return d;
}
if (typeof d !== 'number' && typeof d !== 'string') {
if (escapeHtml) {
return esc(d);
}
return d;
}
d = d.toString(); // cast numbers
if (d.length <= cutoff) {
if (escapeHtml) {
return esc(d);
}
return d;
}
var shortened = d.substr(0, cutoff - 1);
// Find the last white space character in the string
if (wordbreak) {
shortened = shortened.replace(/\s([^\s]*)$/, '');
}
// Protect against uncontrolled HTML input
if (escapeHtml) {
shortened = esc(shortened);
}
return '<span class="ellipsis" title="'+esc(d)+'">'+shortened+'&#8230;</span>';
return ('<span class="ellipsis" title="' +
esc(d) +
'">' +
shortened +
'&#8230;</span>');
};
};
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,r){"use strict";e=e.fn.dataTable;return e.render.ellipsis=function(r,i,o){function u(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}return function(e,t,n){return"display"!==t?e:"number"!=typeof e&&"string"!=typeof e||(e=e.toString()).length<=r?o?u(e):e:(t=e.substr(0,r-1),i&&(t=t.replace(/\s([^\s]*)$/,"")),o&&(t=u(t)),'<span class="ellipsis" title="'+u(e)+'">'+t+"&#8230;</span>")}},e});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.render.ellipsis=function(r,l,n){function p(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}return function(e,t,a){return"display"!==t?e:"number"!=typeof e&&"string"!=typeof e||(e=e.toString()).length<=r?n?p(e):e:(t=e.substr(0,r-1),l&&(t=t.replace(/\s([^\s]*)$/,"")),n&&(t=p(t)),'<span class="ellipsis" title="'+p(e)+'">'+t+"&#8230;</span>")}};export default DataTable;

@ -0,0 +1,98 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* This data rendering helper method can be useful for cases where you have
* potentially large data strings to be shown in a column that is restricted by
* width. The data for the column is still fully searchable and sortable, but if
* it is longer than a give number of characters, it will be truncated and
* shown with ellipsis. A browser provided tooltip will show the full string
* to the end user on mouse hover of the cell.
*
* This function should be used with the `dt-init columns.render` configuration
* option of DataTables.
*
* It accepts three parameters:
*
* 1. `-type integer` - The number of characters to restrict the displayed data
* to.
* 2. `-type boolean` (optional - default `false`) - Indicate if the truncation
* of the string should not occur in the middle of a word (`true`) or if it
* can (`false`). This can allow the display of strings to look nicer, at the
* expense of showing less characters.
* 2. `-type boolean` (optional - default `false`) - Escape HTML entities
* (`true`) or not (`false` - default).
*
* @name ellipsis
* @summary Restrict output data to a particular length, showing anything
* longer with ellipsis and a browser provided tooltip on hover.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {Number} Calculated average
*
* @example
* // Restrict a column to 17 characters, don't split words
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: DataTable.render.ellipsis( 17, true )
* } ]
* } );
*
* @example
* // Restrict a column to 10 characters, do split words
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.ellipsis( 10 )
* } ]
* } );
*/
DataTable.render.ellipsis = function (cutoff, wordbreak, escapeHtml) {
var esc = function (t) {
return ('' + t)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};
return function (d, type, row) {
// Order, search and type get the original data
if (type !== 'display') {
return d;
}
if (typeof d !== 'number' && typeof d !== 'string') {
if (escapeHtml) {
return esc(d);
}
return d;
}
d = d.toString(); // cast numbers
if (d.length <= cutoff) {
if (escapeHtml) {
return esc(d);
}
return d;
}
var shortened = d.substr(0, cutoff - 1);
// Find the last white space character in the string
if (wordbreak) {
shortened = shortened.replace(/\s([^\s]*)$/, '');
}
// Protect against uncontrolled HTML input
if (escapeHtml) {
shortened = esc(shortened);
}
return ('<span class="ellipsis" title="' +
esc(d) +
'">' +
shortened +
'&#8230;</span>');
};
};
export default DataTable;

@ -0,0 +1,8 @@
/*! © Lokesh Babu - datatables.net/license */
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Displays url data in hyperLink with custom plcaeholder */
hyperLink(anchorText: 'newTab' | 'popup' | string, location: string, width: number, height: number): any;
}
}
export {};

@ -1,3 +1,37 @@
/*! © Lokesh Babu - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* This data rendering helper method can be useful when a hyperLink with custom
* anchorText has to rendered. The data for the column is still fully searchable and sortable, based on the hyperLink value,
@ -17,7 +51,7 @@
*
* @name hyperLink
* @summary Displays url data in hyperLink with custom plcaeholder
* @author [Lokesh Babu]
* @author Lokesh Babu
* @requires DataTables 1.10+
*
*
@ -26,7 +60,7 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: $.fn.dataTable.render.hyperLink()
* render: DataTable.render.hyperLink()
* } ]
* } );
*
@ -35,7 +69,7 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: $.fn.dataTable.render.hyperLink( 'Download' )
* render: DataTable.render.hyperLink( 'Download' )
* } ]
* } );
*
@ -45,7 +79,7 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: $.fn.dataTable.render.hyperLink( 'Download', 'popup' )
* render: DataTable.render.hyperLink( 'Download', 'popup' )
* } ]
* } );
*
@ -55,59 +89,43 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: $.fn.dataTable.render.hyperLink( 'Download', 'popup' , 1000, 500)
* render: DataTable.render.hyperLink( 'Download', 'popup' , 1000, 500)
* } ]
* } );
*/
jQuery.fn.dataTable.render.hyperLink = function (
anchorText,
location,
width,
height
) {
validateAndReturnDefaultIfFailed = function (item, defaultValue) {
if (typeof item === "number") {
DataTable.render.hyperLink = function (anchorText, location, width, height) {
var validateAndReturnDefaultIfFailed = function (item, defaultValue) {
if (typeof item === 'number') {
return item;
}
if (typeof item === "string") {
if (typeof item === 'string') {
return parseInt(item) ? item : defaultValue;
}
return defaultValue;
};
var anchorText = anchorText || "Click Here";
var location = location || "newTab";
var width = validateAndReturnDefaultIfFailed(width, "600");
var height = validateAndReturnDefaultIfFailed(height, "400");
var anchorText = anchorText || 'Click Here';
var location = location || 'newTab';
var width = validateAndReturnDefaultIfFailed(width, 600);
var height = validateAndReturnDefaultIfFailed(height, 400);
return function (data, type, row) {
// restriction only for table display rendering
if (type !== "display") {
if (type !== 'display') {
return data;
}
var url = data;
try {
url = new URL(data);
switch (location) {
case "newTab":
return (
'<a title="' +
case 'newTab':
return ('<a title="' +
url +
'" href="' +
url +
'" target="_blank">' +
anchorText +
"</a>"
);
case "popup":
return (
'<a title="' +
'</a>');
case 'popup':
return ('<a title="' +
url +
'" href="' +
url +
@ -117,25 +135,27 @@ jQuery.fn.dataTable.render.hyperLink = function (
anchorText +
"', 'width=" +
width +
",height=" +
',height=' +
height +
"'); return false;\">" +
'\'); return false;">' +
anchorText +
"</a>"
);
'</a>');
default:
return (
'<a title="' +
return ('<a title="' +
url +
'" href="' +
url +
'" target="_blank">' +
anchorText +
"</a>"
);
'</a>');
}
}
} catch (e) {
catch (e) {
return url;
}
};
};
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © Lokesh Babu - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,r){"use strict";e=e.fn.dataTable;return e.render.hyperLink=function(a,o,u,i){function e(e,t){return"number"==typeof e||"string"==typeof e&&parseInt(e)?e:t}a=a||"Click Here",o=o||"newTab",u=e(u,600),i=e(i,400);return function(e,t,n){if("display"!==t)return e;var r=e;try{switch(r=new URL(e),o){case"newTab":return'<a title="'+r+'" href="'+r+'" target="_blank">'+a+"</a>";case"popup":return'<a title="'+r+'" href="'+r+'" target="popup" rel="noopener noreferrer" onclick="window.open(\''+r+"', '"+a+"', 'width="+u+",height="+i+"'); return false;\">"+a+"</a>";default:return'<a title="'+r+'" href="'+r+'" target="_blank">'+a+"</a>"}}catch(e){return r}}},e});

@ -0,0 +1,2 @@
/*! © Lokesh Babu - datatables.net/license */
import DataTable from"datatables.net";DataTable.render.hyperLink=function(n,i,l,o){function e(e,t){return"number"==typeof e||"string"==typeof e&&parseInt(e)?e:t}n=n||"Click Here",i=i||"newTab",l=e(l,600),o=e(o,400);return function(e,t,r){if("display"!==t)return e;var a=e;try{switch(a=new URL(e),i){case"newTab":return'<a title="'+a+'" href="'+a+'" target="_blank">'+n+"</a>";case"popup":return'<a title="'+a+'" href="'+a+'" target="popup" rel="noopener noreferrer" onclick="window.open(\''+a+"', '"+n+"', 'width="+l+",height="+o+"'); return false;\">"+n+"</a>";default:return'<a title="'+a+'" href="'+a+'" target="_blank">'+n+"</a>"}}catch(e){return a}}};export default DataTable;

@ -0,0 +1,131 @@
/*! © Lokesh Babu - datatables.net/license */
import DataTable from 'datatables.net';
/**
* This data rendering helper method can be useful when a hyperLink with custom
* anchorText has to rendered. The data for the column is still fully searchable and sortable, based on the hyperLink value,
* and sortable, based on the hyperLink value, but during display in webpage is rendered with custom placeholder
*
* It accepts four parameters:
*
* 1. 'anchorText' - type string - (optional - default `Click Here`) - The custom placeholder to display
* 2. 'location' - type string - (optional - default `newTab`)
* takes two values 'newTab' and 'popup'
* 3. 'width' - type integer - (optional - default `600`)
* The custom width of popup to display.
* Value is utilised on when 'location' is given as 'popup'.
* 4. 'height' - type integer - (optional - default `400`)
* The custom heigth of popup to display.
* Value is utilised on when 'location' is given as 'popup'.
*
* @name hyperLink
* @summary Displays url data in hyperLink with custom plcaeholder
* @author Lokesh Babu
* @requires DataTables 1.10+
*
*
* @example
* // Display the hyperlink with 'Click Here', which open hyperlink in new Tab or new Window based on Browser setting
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: DataTable.render.hyperLink()
* } ]
* } );
*
* @example
* // Display the hyperlink with 'Download', which open hyperlink in new Tab or new Window based on Browser setting
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.hyperLink( 'Download' )
* } ]
* } );
*
* @example
* // Display the hyperlink with 'Download', which open hyperlink in popup
* // with size 600as width and 400 as height
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.hyperLink( 'Download', 'popup' )
* } ]
* } );
*
* @example
* // Display the hyperlink with 'Download', which open hyperlink in popup
* // with size 1000 width and 500 as height
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.hyperLink( 'Download', 'popup' , 1000, 500)
* } ]
* } );
*/
DataTable.render.hyperLink = function (anchorText, location, width, height) {
var validateAndReturnDefaultIfFailed = function (item, defaultValue) {
if (typeof item === 'number') {
return item;
}
if (typeof item === 'string') {
return parseInt(item) ? item : defaultValue;
}
return defaultValue;
};
var anchorText = anchorText || 'Click Here';
var location = location || 'newTab';
var width = validateAndReturnDefaultIfFailed(width, 600);
var height = validateAndReturnDefaultIfFailed(height, 400);
return function (data, type, row) {
// restriction only for table display rendering
if (type !== 'display') {
return data;
}
var url = data;
try {
url = new URL(data);
switch (location) {
case 'newTab':
return ('<a title="' +
url +
'" href="' +
url +
'" target="_blank">' +
anchorText +
'</a>');
case 'popup':
return ('<a title="' +
url +
'" href="' +
url +
'" target="popup" rel="noopener noreferrer" onclick="window.open(\'' +
url +
"', '" +
anchorText +
"', 'width=" +
width +
',height=' +
height +
'\'); return false;">' +
anchorText +
'</a>');
default:
return ('<a title="' +
url +
'" href="' +
url +
'" target="_blank">' +
anchorText +
'</a>');
}
}
catch (e) {
return url;
}
};
};
export default DataTable;

@ -0,0 +1,10 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Use the Intl Javascript API to render dates and times */
intlDateTime(locale: string, options: Intl.DateTimeFormatOptions): any;
/** Use the Intl Javascript API to render numbers */
intlNumber(locale: string, options: Intl.NumberFormatOptions): any;
}
}
export {};

@ -1,3 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* Rendering methods using the Javascript Intl API. This is supported by IE11,
* Edge, Chrome, Firefox and Safari 10+. Any browser that does not support the
@ -29,15 +63,15 @@
*
* @example
* // Number renderer - using the `columns.render` option:
* render: $.fn.dataTable.render.intlNumber()
* render: DataTable.render.intlNumber()
*
* @example
* // Number renderer - with specified locale:
* render: $.fn.dataTable.render.intlNumber('de')
* render: DataTable.render.intlNumber('de')
*
* @example
* // Number renderer - with specified locale and options:
* render: $.fn.dataTable.render.intlNumber('de', {
* render: DataTable.render.intlNumber('de', {
* style: 'currency',
* currency: 'USD'
* } )
@ -45,58 +79,45 @@
*
* @example
* // Date time renderer - using the `columns.render` option:
* render: $.fn.dataTable.render.intlDateTime()
* render: DataTable.render.intlDateTime()
*
* @example
* // Date time renderer - with specified locale:
* render: $.fn.dataTable.render.intlDateTime('en-US')
* render: DataTable.render.intlDateTime('en-US')
*
* @example
* // Date time renderer - with specified locale and options:
* render: $.fn.dataTable.render.intlDateTime('de', {
* render: DataTable.render.intlDateTime('de', {
* weekday: 'long'
* } )
*
*/
// UMD
(function( factory ) {
"use strict";
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery'], function ( $ ) {
return factory( $, window, document );
} );
DataTable.render.intlDateTime = function (locale, options) {
if (window.Intl) {
var formatter = new Intl.DateTimeFormat(locale, options);
return function (data, type) {
var date;
if (typeof data === 'string') {
date = Date.parse(data);
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
root = window;
else if (data instanceof Date) {
date = data;
}
if ( ! $ ) {
$ = typeof window !== 'undefined' ?
require('jquery') :
require('jquery')( root );
if (isNaN(date) || type === 'type' || type === 'sort') {
return data;
}
return factory( $, root, root.document );
return formatter.format(date);
};
}
else {
// Browser
factory( jQuery, window, document );
}
return function (d) {
return d;
};
}
(function( $, window, document ) {
$.fn.dataTable.render.intlNumber = function ( locale, options ) {
};
DataTable.render.intlNumber = function (locale, options) {
if (window.Intl) {
var formatter = new Intl.NumberFormat(locale, options);
return function (d, type) {
if (type === 'display') {
return formatter.format(d);
@ -115,33 +136,5 @@ $.fn.dataTable.render.intlNumber = function ( locale, options ) {
};
$.fn.dataTable.render.intlDateTime = function ( locale, options ) {
if ( window.Intl ) {
var formatter = new Intl.DateTimeFormat( locale, options );
return function ( data, type ) {
var date;
if ( typeof data === 'string' ) {
date = Date.parse( data );
}
else if ( data instanceof Date ) {
date = data;
}
if ( isNaN( date ) || type === 'type' || type === 'sort' ) {
return data;
}
return formatter.format( date );
};
}
else {
return function ( d ) {
return d;
};
}
};
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(e){"function"==typeof define&&define.amd?define(["datatables.net"],function(t){return e(t,window,document)}):"object"==typeof exports?module.exports=function(t,n){return t=t||window,n.fn.dataTable||require("datatables.net")(t,n),e(n,t,t.document)}:e(jQuery,window,document)}(function(t,o,n,e){"use strict";t=t.fn.dataTable;return t.render.intlDateTime=function(t,n){var r;return o.Intl?(r=new Intl.DateTimeFormat(t,n),function(t,n){var e;return"string"==typeof t?e=Date.parse(t):t instanceof Date&&(e=t),isNaN(e)||"type"===n||"sort"===n?t:r.format(e)}):function(t){return t}},t.render.intlNumber=function(t,n){var e;return o.Intl?(e=new Intl.NumberFormat(t,n),function(t,n){return"display"===n?e.format(t):"filter"===n?t+" "+e.format(t):t}):function(t){return t}},t});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.render.intlDateTime=function(t,n){var r;return window.Intl?(r=new Intl.DateTimeFormat(t,n),function(t,n){var e;return"string"==typeof t?e=Date.parse(t):t instanceof Date&&(e=t),isNaN(e)||"type"===n||"sort"===n?t:r.format(e)}):function(t){return t}},DataTable.render.intlNumber=function(t,n){var e;return window.Intl?(e=new Intl.NumberFormat(t,n),function(t,n){return"display"===n?e.format(t):"filter"===n?t+" "+e.format(t):t}):function(t){return t}};export default DataTable;

@ -0,0 +1,110 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* Rendering methods using the Javascript Intl API. This is supported by IE11,
* Edge, Chrome, Firefox and Safari 10+. Any browser that does not support the
* Intl will simply show the unformatted data to the end user.
*
* The great advantage of using these methods is that your table's data will
* automatically be shown to your end user formatted for their locale. For
* example a date might be formatted as "m/d/yyyy" in the US, while in France
* it would show as "dd/mm/yyyy".
*
* Two rendering methods are available:
*
* * `intlNumber` which will format numbers.
* * `intlDateTime` which formats date times.
*
* Both optionally takes two arguments:
*
* 1. [Optional] Locale or array of locales
* 2. [Optional] Formatter options
*
* For the supported options please see the MDN documentation for
* [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat) and
* [NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat).
*
* @name intl
* @summary Use the Intl Javascript API to render dates and numbers
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @example
* // Number renderer - using the `columns.render` option:
* render: DataTable.render.intlNumber()
*
* @example
* // Number renderer - with specified locale:
* render: DataTable.render.intlNumber('de')
*
* @example
* // Number renderer - with specified locale and options:
* render: DataTable.render.intlNumber('de', {
* style: 'currency',
* currency: 'USD'
* } )
*
*
* @example
* // Date time renderer - using the `columns.render` option:
* render: DataTable.render.intlDateTime()
*
* @example
* // Date time renderer - with specified locale:
* render: DataTable.render.intlDateTime('en-US')
*
* @example
* // Date time renderer - with specified locale and options:
* render: DataTable.render.intlDateTime('de', {
* weekday: 'long'
* } )
*
*/
DataTable.render.intlDateTime = function (locale, options) {
if (window.Intl) {
var formatter = new Intl.DateTimeFormat(locale, options);
return function (data, type) {
var date;
if (typeof data === 'string') {
date = Date.parse(data);
}
else if (data instanceof Date) {
date = data;
}
if (isNaN(date) || type === 'type' || type === 'sort') {
return data;
}
return formatter.format(date);
};
}
else {
return function (d) {
return d;
};
}
};
DataTable.render.intlNumber = function (locale, options) {
if (window.Intl) {
var formatter = new Intl.NumberFormat(locale, options);
return function (d, type) {
if (type === 'display') {
return formatter.format(d);
}
else if (type === 'filter') {
return d + ' ' + formatter.format(d);
}
return d;
};
}
else {
return function (d) {
return d;
};
}
};
export default DataTable;

@ -0,0 +1,8 @@
/*! © SpryMedia Ltd - datatables.net/license */
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Use multiple renderers */
multi(renderers: any[]): any;
}
}
export {};

@ -1,38 +1,9 @@
/**
* This renderer doesn't format the output itself, but rather allows multiple
* renderers to be easily called, which will render the content in sequence.
*
* Pass the renderers you wish to chain together as elements in an array to
* this function. Important - you should pass the renderer as if you were
* going to give it to the `render` property directly (i.e. if it is just a
* simple function, don't execute it).
*
* @name multi
* @summary Use multiple renderers
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @example
* // Convert dates using moment renderer and ensure they are HTML safe
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: $.fn.dataTable.render.multi( [
* $.fn.dataTable.render.moment( 'Do MMM YYYY' ),
* $.fn.dataTable.render.text(),
* ] )
* } ]
* } );
*/
/*! © SpryMedia Ltd - datatables.net/license */
// UMD
(function( factory ){
"use strict";
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery'], function ( $ ) {
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
@ -40,13 +11,13 @@
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = typeof window !== 'undefined' ?
require('jquery') :
require('jquery')( root );
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
@ -56,18 +27,47 @@
// Browser
factory( jQuery, window, document );
}
}
(function( $, window, document ) {
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
$.fn.dataTable.render.multi = function (renderArray) {
/**
* This renderer doesn't format the output itself, but rather allows multiple
* renderers to be easily called, which will render the content in sequence.
*
* Pass the renderers you wish to chain together as elements in an array to
* this function. Important - you should pass the renderer as if you were
* going to give it to the `render` property directly (i.e. if it is just a
* simple function, don't execute it).
*
* @name multi
* @summary Use multiple renderers
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @example
* // Convert dates using moment renderer and ensure they are HTML safe
* new DataTable( '#myTable', {
* columnDefs: [ {
* targets: 1,
* render: DataTable.render.multi( [
* DataTable.render.moment( 'Do MMM YYYY' ),
* DataTable.render.text(),
* ] )
* } ]
* } );
*/
DataTable.render.multi = function (renderArray) {
return function (d, type, row, meta) {
for (var r = 0; r < renderArray.length; r++) {
if (typeof renderArray[r] === "function") {
d = renderArray[r](d, type, row, meta);
} else if (typeof renderArray[r][type] === "function") {
}
else if (typeof renderArray[r][type] === "function") {
d = renderArray[r][type](d, type, row, meta);
} else if (typeof renderArray[r]._ === "function") {
}
else if (typeof renderArray[r]._ === "function") {
d = renderArray[r]._(d, type, row, meta);
}
}
@ -76,4 +76,5 @@ $.fn.dataTable.render.multi = function (renderArray) {
};
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(e){"function"==typeof define&&define.amd?define(["datatables.net"],function(n){return e(n,window,document)}):"object"==typeof exports?module.exports=function(n,t){return n=n||window,t.fn.dataTable||require("datatables.net")(n,t),e(t,0,n.document)}:e(jQuery,window,document)}(function(n,t,e,o){"use strict";n=n.fn.dataTable;return n.render.multi=function(f){return function(n,t,e,o){for(var u=0;u<f.length;u++)"function"==typeof f[u]?n=f[u](n,t,e,o):"function"==typeof f[u][t]?n=f[u][t](n,t,e,o):"function"==typeof f[u]._&&(n=f[u]._(n,t,e,o));return n}},n});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from"datatables.net";DataTable.render.multi=function(f){return function(t,e,n,a){for(var o=0;o<f.length;o++)"function"==typeof f[o]?t=f[o](t,e,n,a):"function"==typeof f[o][e]?t=f[o][e](t,e,n,a):"function"==typeof f[o]._&&(t=f[o]._(t,e,n,a));return t}};export default DataTable;

@ -0,0 +1,50 @@
/*! © SpryMedia Ltd - datatables.net/license */
import DataTable from 'datatables.net';
/**
* This renderer doesn't format the output itself, but rather allows multiple
* renderers to be easily called, which will render the content in sequence.
*
* Pass the renderers you wish to chain together as elements in an array to
* this function. Important - you should pass the renderer as if you were
* going to give it to the `render` property directly (i.e. if it is just a
* simple function, don't execute it).
*
* @name multi
* @summary Use multiple renderers
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @example
* // Convert dates using moment renderer and ensure they are HTML safe
* new DataTable( '#myTable', {
* columnDefs: [ {
* targets: 1,
* render: DataTable.render.multi( [
* DataTable.render.moment( 'Do MMM YYYY' ),
* DataTable.render.text(),
* ] )
* } ]
* } );
*/
DataTable.render.multi = function (renderArray) {
return function (d, type, row, meta) {
for (var r = 0; r < renderArray.length; r++) {
if (typeof renderArray[r] === "function") {
d = renderArray[r](d, type, row, meta);
}
else if (typeof renderArray[r][type] === "function") {
d = renderArray[r][type](d, type, row, meta);
}
else if (typeof renderArray[r]._ === "function") {
d = renderArray[r]._(d, type, row, meta);
}
}
return d;
};
};
export default DataTable;

@ -0,0 +1,8 @@
/*! © Drijkoningen Dirk - datatables.net/license */
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Display percentage value as a bar */
percentBar(pShape: string, cText: string, cBorder: string, cBar: string, cBack: string, vRound: number, bType: string): any;
}
}
export {};

@ -1,3 +1,37 @@
/*! © Drijkoningen Dirk - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* This data rendering helper method will convert percentage values into a bar.
* Values can either have the % sign or not and decimals get rounded to the
@ -36,7 +70,7 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 4,
* render: $.fn.dataTable.render.percentBar( 'round','#FFF', '#269ABC', '#31B0D5', '#286090', 1, 'groove' )
* render: DataTable.render.percentBar( 'round','#FFF', '#269ABC', '#31B0D5', '#286090', 1, 'groove' )
* } ]
* } );
*
@ -45,12 +79,11 @@
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: $.fn.dataTable.render.percentBar()
* render: DataTable.render.percentBar()
* } ]
* } );
*/
jQuery.fn.dataTable.render.percentBar = function(pShape, cText, cBorder, cBar, cBack, vRound, bType) {
DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRound, bType) {
pShape = pShape || 'square';
cText = cText || '#000';
cBorder = cBorder || '#BCBCBC';
@ -60,21 +93,31 @@ jQuery.fn.dataTable.render.percentBar = function(pShape, cText, cBorder, cBar, c
bType = bType || 'ridge';
//Bar templates
var styleRule1 = 'max-width:100px;height:12px;margin:0 auto;';
var styleRule2 = 'border:2px '+bType+' '+cBorder+';line-height:12px;font-size:14px;color:'+cText+';background:'+cBack+';position:relative;';
var styleRule3 = 'height:12px;line-height:12px;text-align:center;background-color:'+cBar+';padding:auto 6px;';
var styleRule2 = 'border:2px ' +
bType +
' ' +
cBorder +
';line-height:12px;font-size:14px;color:' +
cText +
';background:' +
cBack +
';position:relative;';
var styleRule3 = 'height:12px;line-height:12px;text-align:center;background-color:' +
cBar +
';padding:auto 6px;';
//Square is default, make template round if pShape == round
if (pShape == 'round') {
styleRule2 += 'border-radius:5px;';
styleRule3 += 'border-top-left-radius:4px;border-bottom-left-radius:4px;';
}
return function (d, type, row) {
//Remove % if found in the value
//Round to the given parameter vRound
s = parseFloat(d.toString().replace(/\s%|%/g,'')).toFixed(vRound);
var s = parseFloat(d.toString().replace(/\s%|%/g, '')).toFixed(vRound);
//Not allowed to go over 100%
if(s>100){s=100}
if (s > 100) {
s = 100;
}
// Order, search and type gets numbers
if (type !== 'display') {
return s;
@ -82,8 +125,21 @@ jQuery.fn.dataTable.render.percentBar = function(pShape, cText, cBorder, cBar, c
if (typeof d !== 'number' && typeof d !== 'string') {
return d;
}
//Return the code for the bar
return '<div style="'+styleRule1+'"><div style="'+styleRule2+'"><div style="'+styleRule3+'width:'+s+ '%;"></div><div style="width:100%;text-align:center;position:absolute;left:0;top:0;">'+s+'%</div></div></div>';
return ('<div style="' +
styleRule1 +
'"><div style="' +
styleRule2 +
'"><div style="' +
styleRule3 +
'width:' +
s +
'%;"></div><div style="width:100%;text-align:center;position:absolute;left:0;top:0;">' +
s +
'%</div></div></div>');
};
};
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © Drijkoningen Dirk - datatables.net/license */
!function(n){"function"==typeof define&&define.amd?define(["datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t.fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(e,t,n,i){"use strict";e=e.fn.dataTable;return e.render.percentBar=function(e,t,n,i,r,o,d){o=o||0;var a="border:2px "+(d=d||"ridge")+" "+(n=n||"#BCBCBC")+";line-height:12px;font-size:14px;color:"+(t=t||"#000")+";background:"+(r=r||"#E6E6E6")+";position:relative;",u="height:12px;line-height:12px;text-align:center;background-color:"+(i=i||"#5FD868")+";padding:auto 6px;";return"round"==(e=e||"square")&&(a+="border-radius:5px;",u+="border-top-left-radius:4px;border-bottom-left-radius:4px;"),function(e,t,n){var i=parseFloat(e.toString().replace(/\s%|%/g,"")).toFixed(o);return 100<i&&(i=100),"display"!==t?i:"number"!=typeof e&&"string"!=typeof e?e:'<div style="max-width:100px;height:12px;margin:0 auto;"><div style="'+a+'"><div style="'+u+"width:"+i+'%;"></div><div style="width:100%;text-align:center;position:absolute;left:0;top:0;">'+i+"%</div></div></div>"}},e});

@ -0,0 +1,2 @@
/*! © Drijkoningen Dirk - datatables.net/license */
import DataTable from"datatables.net";DataTable.render.percentBar=function(t,e,r,i,a,o,d){o=o||0;var n="border:2px "+(d=d||"ridge")+" "+(r=r||"#BCBCBC")+";line-height:12px;font-size:14px;color:"+(e=e||"#000")+";background:"+(a=a||"#E6E6E6")+";position:relative;",p="height:12px;line-height:12px;text-align:center;background-color:"+(i=i||"#5FD868")+";padding:auto 6px;";return"round"==(t=t||"square")&&(n+="border-radius:5px;",p+="border-top-left-radius:4px;border-bottom-left-radius:4px;"),function(t,e,r){var i=parseFloat(t.toString().replace(/\s%|%/g,"")).toFixed(o);return 100<i&&(i=100),"display"!==e?i:"number"!=typeof t&&"string"!=typeof t?t:'<div style="max-width:100px;height:12px;margin:0 auto;"><div style="'+n+'"><div style="'+p+"width:"+i+'%;"></div><div style="width:100%;text-align:center;position:absolute;left:0;top:0;">'+i+"%</div></div></div>"}};export default DataTable;

@ -0,0 +1,115 @@
/*! © Drijkoningen Dirk - datatables.net/license */
import DataTable from 'datatables.net';
/**
* This data rendering helper method will convert percentage values into a bar.
* Values can either have the % sign or not and decimals get rounded to the
* given value. The percentage will have a max value of 100%.
*
* This function should be used with the `dt-init columns.render` configuration
* option of DataTables.
*
* v1.1 Changelog
* - Added a seventh border type parameter.
* - All parameters are now optional.
* - Improved styling.
* - Bug fix: Text is always centered now.
*
* It accepts seven parameters:
*
* 1. `-type string` square as default or round for a rounded bar.
* 2. `-type string` A hex color for the text.
* 3. `-type string` A hex color for the border.
* 4. `-type string` A hex color for the bar.
* 5. `-type string` A hex color for the background.
* 6. `-type integer` A number used to round the value.
* 7. `-type string` A border style, default=ridge (solid, outset, groove, ridge)
*
* DEMO : http://codepen.io/RedJokingInn/pen/jrkZQN
*
* @name percentBar
* @summary Display percentage value as a bar
* @author [Drijkoningen Dirk](RedJokingInn)
* @requires DataTables 1.10+
*
* @returns {String} Html code for bar
*
* @example
* // Display rounded bars with white text, medium blue border, light blue bar, dark blue background, rounded to one decimal.
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 4,
* render: DataTable.render.percentBar( 'round','#FFF', '#269ABC', '#31B0D5', '#286090', 1, 'groove' )
* } ]
* } );
*
* @example
* // All default values used. Square bars with black text, gray ridged border, light green bar, light gray background, rounded to integer.
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.percentBar()
* } ]
* } );
*/
DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRound, bType) {
pShape = pShape || 'square';
cText = cText || '#000';
cBorder = cBorder || '#BCBCBC';
cBar = cBar || '#5FD868';
cBack = cBack || '#E6E6E6';
vRound = vRound || 0;
bType = bType || 'ridge';
//Bar templates
var styleRule1 = 'max-width:100px;height:12px;margin:0 auto;';
var styleRule2 = 'border:2px ' +
bType +
' ' +
cBorder +
';line-height:12px;font-size:14px;color:' +
cText +
';background:' +
cBack +
';position:relative;';
var styleRule3 = 'height:12px;line-height:12px;text-align:center;background-color:' +
cBar +
';padding:auto 6px;';
//Square is default, make template round if pShape == round
if (pShape == 'round') {
styleRule2 += 'border-radius:5px;';
styleRule3 += 'border-top-left-radius:4px;border-bottom-left-radius:4px;';
}
return function (d, type, row) {
//Remove % if found in the value
//Round to the given parameter vRound
var s = parseFloat(d.toString().replace(/\s%|%/g, '')).toFixed(vRound);
//Not allowed to go over 100%
if (s > 100) {
s = 100;
}
// Order, search and type gets numbers
if (type !== 'display') {
return s;
}
if (typeof d !== 'number' && typeof d !== 'string') {
return d;
}
//Return the code for the bar
return ('<div style="' +
styleRule1 +
'"><div style="' +
styleRule2 +
'"><div style="' +
styleRule3 +
'width:' +
s +
'%;"></div><div style="width:100%;text-align:center;position:absolute;left:0;top:0;">' +
s +
'%</div></div></div>');
};
};
export default DataTable;

@ -0,0 +1,92 @@
/*! © Fedonyuk Anton - datatables.net/license */
/**
* @name anchor
* @summary Renders the column data as HTML anchor (`a` tag)
* @author [Fedonyuk Anton](http://ensostudio.ru)
* @requires DataTables 1.10+
*
* @param {string} type The anchor type: 'link'(by default), 'phone' or 'email'
* @param {object|function} attributes The attributes of the anchor tag or the
* callback function returning the tag attributes, the callback syntax:
* `function (mixed data, object|array row, object meta): object`
* @param {string|null} innerText The inner text of the anchor tag or `null` to
* set text by column `data` (by default)
* @returns {string}
*
* @example
* // Display `<a href="..." target="_blank">...</a>`
* $('#example').DataTable({
* columnDefs: [{
* targets: 1,
* render: $.fn.dataTable.render.anchor()
* }]
* });
*
* @example
* // Display `<a href="mailto:..." class="link">...</a>`
* $('#example').DataTable({
* columnDefs: [{
* targets: 2,
* render: $.fn.dataTable.render.anchor('email', {'class': 'link'})
* }]
* });
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Renders the column data as HTML anchor (`a` tag) */
anchor(
type: string,
attribute: { [key: string]: any },
innerText: string | null
);
}
}
DataTable.render.anchor = function (
type = 'link',
attributes = {},
innerText = null
) {
return function (data, type, row, meta = {}) {
// restriction only for table display rendering
if (type !== 'display') {
return data;
}
if (innerText === null) {
innerText = data;
}
var attrs =
typeof attributes === 'function'
? attributes(data, row, meta)
: attributes;
if (!attrs.href) {
switch (type) {
case 'mail':
attrs.href = 'mailto:' + data;
break;
case 'phone':
attrs.href = 'tel:' + data.replace(/[^+\d]+/g, '');
break;
case 'link':
default:
try {
attrs.href = new URL(data);
} catch (e) {
attrs.href = data;
}
}
}
var anchorEl = jQuery('<a/>');
return anchorEl.attr(attrs).text(innerText || '')[0].outerText;
};
};

@ -0,0 +1,96 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* NOTE - As of DataTables 1.12, DataTables has a built in date / time renderer
* which should be used in place of this renderer. See
* [the manual](https://datatables.net/manual/data/renderers#Date-and-time-helpers)
* for details.
*
* Date / time formats often from back from server APIs in a format that you
* don't wish to display to your end users (ISO8601 for example). This rendering
* helper can be used to transform any source date / time format into something
* which can be easily understood by your users when reading the table, and also
* by DataTables for sorting the table.
*
* The [MomentJS library](http://momentjs.com/) is used to accomplish this and
* you simply need to tell it which format to transfer from, to and specify a
* locale if required.
*
* This function should be used with the `dt-init columns.render` configuration
* option of DataTables.
*
* It accepts one, two or three parameters:
*
* * `DataTable.render.moment( to );`
* * `DataTable.render.moment( from, to );`
* * `DataTable.render.moment( from, to, locale );`
*
* Where:
*
* * `to` - the format that will be displayed to the end user
* * `from` - the format that is supplied in the data (the default is ISO8601 -
* `YYYY-MM-DD`)
* * `locale` - the locale which MomentJS should use - the default is `en`
* (English).
*
* @name datetime
* @summary Convert date / time source data into one suitable for display
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+, Moment.js 1.7+
*
* @example
* // Convert ISO8601 dates into a simple human readable format
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: DataTable.render.moment( 'Do MMM YYYY' )
* } ]
* } );
*
* @example
* // Specify a source format - in this case a unix timestamp
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.moment( 'X', 'Do MMM YY' )
* } ]
* } );
*
* @example
* // Specify a source format and locale
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.moment( 'YYYY/MM/DD', 'Do MMM YY', 'fr' )
* } ]
* } );
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Convert date / time source data into one suitable for display */
moment(from: string, to?: string, locale?: string);
}
}
DataTable.render.moment = function (from, to?, locale?) {
// Argument shifting
if (arguments.length === 1) {
to = from;
from = 'YYYY-MM-DD';
}
return function (d, type, row) {
if (!d) {
return type === 'sort' || type === 'type' ? 0 : d;
}
var m = (window as any).moment(d, from, locale, true);
// Order and type get a number value from Moment, everything else
// sees the rendered value
return m.format(type === 'sort' || type === 'type' ? 'x' : to);
};
};

@ -0,0 +1,112 @@
/*! © SpryMedia Ltd - datatables.net/license */
/**
* This data rendering helper method can be useful for cases where you have
* potentially large data strings to be shown in a column that is restricted by
* width. The data for the column is still fully searchable and sortable, but if
* it is longer than a give number of characters, it will be truncated and
* shown with ellipsis. A browser provided tooltip will show the full string
* to the end user on mouse hover of the cell.
*
* This function should be used with the `dt-init columns.render` configuration
* option of DataTables.
*
* It accepts three parameters:
*
* 1. `-type integer` - The number of characters to restrict the displayed data
* to.
* 2. `-type boolean` (optional - default `false`) - Indicate if the truncation
* of the string should not occur in the middle of a word (`true`) or if it
* can (`false`). This can allow the display of strings to look nicer, at the
* expense of showing less characters.
* 2. `-type boolean` (optional - default `false`) - Escape HTML entities
* (`true`) or not (`false` - default).
*
* @name ellipsis
* @summary Restrict output data to a particular length, showing anything
* longer with ellipsis and a browser provided tooltip on hover.
* @author [Allan Jardine](http://datatables.net)
* @requires DataTables 1.10+
*
* @returns {Number} Calculated average
*
* @example
* // Restrict a column to 17 characters, don't split words
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: DataTable.render.ellipsis( 17, true )
* } ]
* } );
*
* @example
* // Restrict a column to 10 characters, do split words
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.ellipsis( 10 )
* } ]
* } );
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Restrict output data to a particular length, showing anything longer with ellipsis */
ellipsis(cutoff: number, wordbreak?: boolean, escapeHtml?: boolean);
}
}
DataTable.render.ellipsis = function (cutoff, wordbreak, escapeHtml) {
var esc = function (t) {
return ('' + t)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};
return function (d, type, row) {
// Order, search and type get the original data
if (type !== 'display') {
return d;
}
if (typeof d !== 'number' && typeof d !== 'string') {
if (escapeHtml) {
return esc(d);
}
return d;
}
d = d.toString(); // cast numbers
if (d.length <= cutoff) {
if (escapeHtml) {
return esc(d);
}
return d;
}
var shortened = d.substr(0, cutoff - 1);
// Find the last white space character in the string
if (wordbreak) {
shortened = shortened.replace(/\s([^\s]*)$/, '');
}
// Protect against uncontrolled HTML input
if (escapeHtml) {
shortened = esc(shortened);
}
return (
'<span class="ellipsis" title="' +
esc(d) +
'">' +
shortened +
'&#8230;</span>'
);
};
};

@ -0,0 +1,155 @@
/*! © Lokesh Babu - datatables.net/license */
/**
* This data rendering helper method can be useful when a hyperLink with custom
* anchorText has to rendered. The data for the column is still fully searchable and sortable, based on the hyperLink value,
* and sortable, based on the hyperLink value, but during display in webpage is rendered with custom placeholder
*
* It accepts four parameters:
*
* 1. 'anchorText' - type string - (optional - default `Click Here`) - The custom placeholder to display
* 2. 'location' - type string - (optional - default `newTab`)
* takes two values 'newTab' and 'popup'
* 3. 'width' - type integer - (optional - default `600`)
* The custom width of popup to display.
* Value is utilised on when 'location' is given as 'popup'.
* 4. 'height' - type integer - (optional - default `400`)
* The custom heigth of popup to display.
* Value is utilised on when 'location' is given as 'popup'.
*
* @name hyperLink
* @summary Displays url data in hyperLink with custom plcaeholder
* @author Lokesh Babu
* @requires DataTables 1.10+
*
*
* @example
* // Display the hyperlink with 'Click Here', which open hyperlink in new Tab or new Window based on Browser setting
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 1,
* render: DataTable.render.hyperLink()
* } ]
* } );
*
* @example
* // Display the hyperlink with 'Download', which open hyperlink in new Tab or new Window based on Browser setting
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.hyperLink( 'Download' )
* } ]
* } );
*
* @example
* // Display the hyperlink with 'Download', which open hyperlink in popup
* // with size 600as width and 400 as height
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.hyperLink( 'Download', 'popup' )
* } ]
* } );
*
* @example
* // Display the hyperlink with 'Download', which open hyperlink in popup
* // with size 1000 width and 500 as height
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.hyperLink( 'Download', 'popup' , 1000, 500)
* } ]
* } );
*/
import DataTable from 'datatables.net';
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Displays url data in hyperLink with custom plcaeholder */
hyperLink(
anchorText: 'newTab' | 'popup' | string,
location: string,
width: number,
height: number
);
}
}
DataTable.render.hyperLink = function (anchorText, location, width, height) {
var validateAndReturnDefaultIfFailed: (item, defaultValue) => number =
function (item, defaultValue) {
if (typeof item === 'number') {
return item;
}
if (typeof item === 'string') {
return parseInt(item) ? item : defaultValue;
}
return defaultValue;
};
var anchorText = anchorText || 'Click Here';
var location = location || 'newTab';
var width = validateAndReturnDefaultIfFailed(width, 600);
var height = validateAndReturnDefaultIfFailed(height, 400);
return function (data, type, row) {
// restriction only for table display rendering
if (type !== 'display') {
return data;
}
var url = data;
try {
url = new URL(data);
switch (location) {
case 'newTab':
return (
'<a title="' +
url +
'" href="' +
url +
'" target="_blank">' +
anchorText +
'</a>'
);
case 'popup':
return (
'<a title="' +
url +
'" href="' +
url +
'" target="popup" rel="noopener noreferrer" onclick="window.open(\'' +
url +
"', '" +
anchorText +
"', 'width=" +
width +
',height=' +
height +
'\'); return false;">' +
anchorText +
'</a>'
);
default:
return (
'<a title="' +
url +
'" href="' +
url +
'" target="_blank">' +
anchorText +
'</a>'
);
}
} catch (e) {
return url;
}
};
};

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save