Merge branch 'master' of github.com:DataTables/Plugins

pull/295/merge
Allan Jardine 2 years ago
commit 25fc20a37a

1
.gitignore vendored

@ -0,0 +1 @@
node_modules

@ -0,0 +1,12 @@
{
"arrowParens": "avoid",
"breakBeforeElse": true,
"indentChains": true,
"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,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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, * 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 * be it from a column, or a collection of cells. This method provides exactly
@ -20,13 +68,14 @@
* var table = $('#example').DataTable(); * var table = $('#example').DataTable();
* table.cells( 0, [3,4] ).data().average(); * table.cells( 0, [3,4] ).data().average();
*/ */
DataTable.Api.register('average()', function () {
jQuery.fn.dataTable.Api.register( 'average()', function () {
var data = this.flatten(); var data = this.flatten();
var sum = data.reduce(function (a, b) { 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); }, 0);
return sum / data.length; return sum / data.length;
}); });
return DataTable;
}));

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

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

@ -0,0 +1,37 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from 'jquery';
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,51 @@
/*! © Alejandro Navarro - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * This plug-in will read the text from the header cell of a column, returning
* that value. * that value.
@ -14,8 +62,11 @@
* var table = $('#example').DataTable(); * var table = $('#example').DataTable();
* table.column( 3 ).title(); * table.column( 3 ).title();
*/ */
DataTable.Api.register('column().title()', function () {
$.fn.dataTable.Api.register( 'column().title()', function () { var title = this.header();
var colheader = this.header(); return $(title).text().trim();
return $(colheader).text().trim();
}); });
return DataTable;
}));

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

@ -0,0 +1,2 @@
/*! © Alejandro Navarro - datatables.net/license */
import $ from"jquery";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 $ from 'jquery';
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,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * 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 * `dt-api column().order()` method, but there is no plural equivalent. While
@ -32,15 +80,16 @@
* // Multi-column sorting based on a name selector * // Multi-column sorting based on a name selector
* table.columns( [ 'sign_up_date:name', 'user_name:name' ] ).order( 'desc' ).draw(); * table.columns( [ 'sign_up_date:name', 'user_name:name' ] ).order( 'desc' ).draw();
*/ */
DataTable.Api.register('columns().order()', function (dir) {
$.fn.dataTable.Api.register( 'columns().order()', function ( dir ) {
return this.iterator('columns', function (settings, columns) { return this.iterator('columns', function (settings, columns) {
var a = []; var a = [];
for (var i = 0, ien = columns.length; i < ien; i++) { for (var i = 0, ien = columns.length; i < ien; i++) {
a.push([columns[i], Array.isArray(dir) ? dir[i] : dir]); a.push([columns[i], Array.isArray(dir) ? dir[i] : dir]);
} }
new DataTable.Api(settings).order(a);
new $.fn.dataTable.Api( settings ).order( a );
}); });
}); });
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var r,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(r=require("jquery"),o=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"!=typeof window?module.exports=function(e,n){return e=e||window,n=n||r(e),o(e,n),t(n,0,e.document)}:(o(window,r),module.exports=t(r,window,window.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 $ from"jquery";import DataTable from"datatables.net";DataTable.Api.register("columns().order()",function(i){return this.iterator("columns",function(r,a){for(var t=[],e=0,o=a.length;e<o;e++)t.push([a[e],Array.isArray(i)?i[e]:i]);new DataTable.Api(r).order(t)})});export default DataTable;

@ -0,0 +1,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from 'jquery';
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,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * 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 * (for example from an HTML source). Although you can set `dt-api order()` to
@ -19,8 +67,7 @@
* // Return table to the loaded data order * // Return table to the loaded data order
* table.order.neutral().draw(); * table.order.neutral().draw();
*/ */
DataTable.Api.register('order.neutral()', function () {
$.fn.dataTable.Api.register( 'order.neutral()', function () {
return this.iterator('table', function (s) { return this.iterator('table', function (s) {
s.aaSorting.length = 0; s.aaSorting.length = 0;
s.aiDisplay.sort(function (a, b) { s.aiDisplay.sort(function (a, b) {
@ -31,3 +78,7 @@ $.fn.dataTable.Api.register( 'order.neutral()', function () {
}); });
}); });
}); });
return DataTable;
}));

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

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from"jquery";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 $ from 'jquery';
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,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * 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 * piece of data (a user name for example). This plug-in provides exactly that
@ -14,7 +62,7 @@
* *
* @name page.JumpToData() * @name page.JumpToData()
* @summary Jump to a page by searching for data from a column * @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+ * @requires DataTables 1.10+
* *
* @param {*} data Data to search for * @param {*} data Data to search for
@ -25,14 +73,15 @@
* var table = $('#example').DataTable(); * var table = $('#example').DataTable();
* table.page.jumpToData( "Allan Jardine", 0 ); * table.page.jumpToData( "Allan Jardine", 0 );
*/ */
DataTable.Api.register('page.jumpToData()', function (data, column) {
jQuery.fn.dataTable.Api.register( 'page.jumpToData()', function ( data, column ) {
var pos = this.column(column, { order: 'current' }).data().indexOf(data); var pos = this.column(column, { order: 'current' }).data().indexOf(data);
if (pos >= 0) { if (pos >= 0) {
var page = Math.floor(pos / this.page.info().length); var page = Math.floor(pos / this.page.info().length);
this.page(page).draw(false); this.page(page).draw(false);
} }
return this; return this;
}); });
return DataTable;
}));

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

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from"jquery";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 $ from 'jquery';
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,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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. * Externally trigger the display of DataTables' "processing" indicator.
* *
@ -25,9 +73,12 @@
* table.processing( false ); * table.processing( false );
* }, 2000 ); * }, 2000 );
*/ */
DataTable.Api.register('processing()', function (show) {
jQuery.fn.dataTable.Api.register( 'processing()', function ( show ) {
return this.iterator('table', function (ctx) { return this.iterator('table', function (ctx) {
ctx.oApi._fnProcessingDisplay(ctx, show); ctx.oApi._fnProcessingDisplay(ctx, show);
}); });
}); });
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(t){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"!=typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),i(e,n),t(n,0,e.document)}:(i(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"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 $ from"jquery";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 $ from 'jquery';
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,51 @@
/*! © Edouard Labre - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * This plugin jumps to the right page of the DataTable to show the required row
* *
@ -20,7 +68,7 @@
* *
* table.row.add( new_row ).draw().show().draw(false); * 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(); var page_info = this.table().page.info();
// Get row index // Get row index
var new_row_index = this.index(); var new_row_index = this.index();
@ -29,7 +77,8 @@ $.fn.dataTable.Api.register('row().show()', function() {
.rows({ search: 'applied' })[0] .rows({ search: 'applied' })[0]
.indexOf(new_row_index); .indexOf(new_row_index);
// Already on right page ? // Already on right page ?
if ((row_position >= page_info.start && row_position < page_info.end) || row_position < 0) { if ((row_position >= page_info.start && row_position < page_info.end) ||
row_position < 0) {
// Return row object // Return row object
return this; return this;
} }
@ -40,3 +89,7 @@ $.fn.dataTable.Api.register('row().show()', function() {
// Return row object // Return row object
return this; return this;
}); });
return DataTable;
}));

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

@ -0,0 +1,51 @@
/*! © Edouard Labre - datatables.net/license */
import $ from 'jquery';
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,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * 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 * need the `-tag tr` element for a row which hasn't yet been drawn. This method can be used to
@ -14,9 +62,12 @@
* // Create nodes for all rows * // Create nodes for all rows
* table.rows().generate(); * table.rows().generate();
*/ */
DataTable.Api.register('rows().generate()', function () {
$.fn.dataTable.Api.register( 'rows().generate()', function () {
return this.iterator('row', function (context, index) { return this.iterator('row', function (context, index) {
context.oApi._fnCreateTr(context, index); context.oApi._fnCreateTr(context, index);
}); });
}); });
return DataTable;
}));

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

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

@ -0,0 +1,29 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from 'jquery';
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,60 @@
/*! © 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,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * 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 * and sum it, returning the summed value. The data can come from any data
@ -13,7 +61,7 @@
* *
* @name sum() * @name sum()
* @summary Sum the values in a data set. * @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+ * @requires DataTables 1.10+
* *
* @returns {Number} Summed value * @returns {Number} Summed value
@ -35,8 +83,7 @@
* } * }
* } ); * } );
*/ */
DataTable.Api.register('sum()', function () {
jQuery.fn.dataTable.Api.register( 'sum()', function ( ) {
return this.flatten().reduce(function (a, b) { return this.flatten().reduce(function (a, b) {
if (typeof a === 'string') { if (typeof a === 'string') {
a = a.replace(/[^\d.-]/g, '') * 1; a = a.replace(/[^\d.-]/g, '') * 1;
@ -44,8 +91,10 @@ jQuery.fn.dataTable.Api.register( 'sum()', function ( ) {
if (typeof b === 'string') { if (typeof b === 'string') {
b = b.replace(/[^\d.-]/g, '') * 1; b = b.replace(/[^\d.-]/g, '') * 1;
} }
return a + b; return a + b;
}, 0); }, 0);
}); });
return DataTable;
}));

2
api/sum().min.js vendored

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

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from"jquery";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 $ from 'jquery';
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,50 @@
/*! Download button for Buttons /*! © SpryMedia Ltd - datatables.net/license */
* 2018 SpryMedia Ltd - MIT licensed - datatables.net/license
*/ (function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/** /**
* @summary Download Button * @summary Download Button
@ -33,81 +77,74 @@
* ] * ]
* }); * });
*/ */
(function(window, document, $, undefined) {
function flattenJson(data, name, flattened) { function flattenJson(data, name, flattened) {
if (!flattened) { if (!flattened) {
flattened = {}; flattened = {};
} }
if (!name) { if (!name) {
name = ''; name = '';
} }
if ($.isPlainObject(data) || Array.isArray(data)) { if ($.isPlainObject(data) || Array.isArray(data)) {
$.each(data, function (idx, val) { $.each(data, function (idx, val) {
if (name === '') { if (name === '') {
flattenJson(val, idx, flattened); flattenJson(val, idx, flattened);
} else { }
flattenJson(val, name + '[' + idx + ']', flattened); else {
flattenJson(val, name + '[' + idx.toString() + ']', flattened);
} }
}); });
} else { }
else {
flattened[name] = data; flattened[name] = data;
} }
return flattened; return flattened;
} }
DataTable.ext.buttons.download = {
$.fn.dataTable.ext.buttons.download = {
text: 'Download', text: 'Download',
action: function (e, dt, node, config) { action: function (e, dt, node, config) {
// Gather information to be submitted // Gather information to be submitted
var data = {}; var data = {};
if (dt.page.info().serverSide) { if (dt.page.info().serverSide) {
$.extend(data, dt.ajax.params()); $.extend(data, dt.ajax.params());
} }
if (typeof config.data === 'function') { if (typeof config.data === 'function') {
config.data(data); config.data(data);
} else if (typeof config.data === 'object') { }
else if (typeof config.data === 'object') {
$.extend(data, config.data); $.extend(data, config.data);
} }
// Convert data to a flat structure for submission // Convert data to a flat structure for submission
var flattened = flattenJson(data); var flattened = flattenJson(data);
// Create an iframe // Create an iframe
var iframe = $('<iframe/>') var iframe = $('<iframe/>')
.css({ .css({
border: 'none', border: 'none',
height: 0, height: 0,
width: 0 width: 0,
}) })
.appendTo(document.body); .appendTo(document.body);
var contentDoc = iframe[0].contentWindow.document; var contentDoc = iframe[0].contentWindow.document;
contentDoc.open(); contentDoc.open();
contentDoc.close(); contentDoc.close();
var form = $('<form/>', contentDoc) var form = $('<form/>', contentDoc)
.attr('method', config.type) .attr('method', config.type)
.attr('action', config.url) .attr('action', config.url)
.appendTo(contentDoc.body); .appendTo(contentDoc.body);
$.each(flattened, function (name, val) { $.each(flattened, function (name, val) {
$('<input/>', contentDoc) $('<input/>', contentDoc)
.attr('type', 'text') .attr('type', 'text')
.attr('name', name) .attr('name', name.toString())
.attr('autocomplete', 'no') .attr('autocomplete', 'no')
.val(val) .val(val)
.appendTo(form); .appendTo(form);
}); });
form.submit(); form.submit();
}, },
url: '', url: '',
type: 'POST', type: 'POST',
data: {} data: {},
}; };
})(window, document, jQuery);
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
!function(n){var o,a;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(o=require("jquery"),a=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"!=typeof window?module.exports=function(t,e){return t=t||window,e=e||o(t),a(t,e),n(e,0,t.document)}:(a(window,o),module.exports=n(o,window,window.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 $ from"jquery";import DataTable from"datatables.net";function flattenJson(t,e,o){return o=o||{},e=e||"",$.isPlainObject(t)||Array.isArray(t)?$.each(t,function(t,a){flattenJson(a,""===e?t:e+"["+t.toString()+"]",o)}):o[e]=t,o}DataTable.ext.buttons.download={text:"Download",action:function(t,a,e,o){var n={},a=(a.page.info().serverSide&&$.extend(n,a.ajax.params()),"function"==typeof o.data?o.data(n):"object"==typeof o.data&&$.extend(n,o.data),flattenJson(n)),r=$("<iframe/>").css({border:"none",height:0,width:0}).appendTo(document.body)[0].contentWindow.document,d=(r.open(),r.close(),$("<form/>",r).attr("method",o.type).attr("action",o.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 $ from 'jquery';
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,122 @@
/*! © 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,51 @@
/*! © Fedonyuk Anton - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/** /**
* @name anchor * @name anchor
* @summary Renders the column data as HTML anchor (`a` tag) * @summary Renders the column data as HTML anchor (`a` tag)
@ -30,23 +78,18 @@
* }] * }]
* }); * });
*/ */
jQuery.fn.dataTable.render.anchor = function ( DataTable.render.anchor = function (type = 'link', attributes = {}, innerText = null) {
type = 'link',
attributes = {},
innerText = null
) {
return function (data, type, row, meta = {}) { return function (data, type, row, meta = {}) {
// restriction only for table display rendering // restriction only for table display rendering
if (type !== 'display') { if (type !== 'display') {
return data; return data;
} }
if (innerText === null) { if (innerText === null) {
innerText = data; innerText = data;
} }
var attrs = typeof attributes === 'function'
var attrs = attributes typeof 'function' ? attributes(data, row, meta) : attributes; ? attributes(data, row, meta)
: attributes;
if (!attrs.href) { if (!attrs.href) {
switch (type) { switch (type) {
case 'mail': case 'mail':
@ -56,17 +99,20 @@ jQuery.fn.dataTable.render.anchor = function (
attrs.href = 'tel:' + data.replace(/[^+\d]+/g, ''); attrs.href = 'tel:' + data.replace(/[^+\d]+/g, '');
break; break;
case 'link': case 'link':
case default: default:
try { try {
attrs.href = new URL(data); attrs.href = new URL(data);
} catch (e) { }
catch (e) {
attrs.href = data; attrs.href = data;
} }
} }
} }
var anchorEl = jQuery('<a/>'); 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(t){var r,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(r=require("jquery"),o=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"!=typeof window?module.exports=function(e,n){return e=e||window,n=n||r(e),o(e,n),t(n,0,e.document)}:(o(window,r),module.exports=t(r,window,window.document))):t(jQuery,window,document)}(function(e,n,t,r){"use strict";e=e.fn.dataTable;return e.render.anchor=function(e=0,u={},i=null){return function(n,e,t,r={}){if("display"!==e)return n;null===i&&(i=n);var o="function"==typeof u?u(n,t,r):u;if(!o.href)switch(e){case"mail":o.href="mailto:"+n;break;case"phone":o.href="tel:"+n.replace(/[^+\d]+/g,"");break;default:try{o.href=new URL(n)}catch(e){o.href=n}}return jQuery("<a/>").attr(o).text(i||"")[0].outerText}},e});

@ -0,0 +1,2 @@
/*! © Fedonyuk Anton - datatables.net/license */
import $ from"jquery";import DataTable from"datatables.net";DataTable.render.anchor=function(e=0,f={},l=null){return function(t,e,r,a={}){if("display"!==e)return t;null===l&&(l=t);var n="function"==typeof f?f(t,r,a):f;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(l||"")[0].outerText}};export default DataTable;

@ -0,0 +1,74 @@
/*! © Fedonyuk Anton - datatables.net/license */
import $ from 'jquery';
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,57 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * 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 * 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 * helper can be used to transform any source date / time format into something
@ -14,9 +67,9 @@
* *
* It accepts one, two or three parameters: * It accepts one, two or three parameters:
* *
* * `$.fn.dataTable.render.moment( to );` * * `DataTable.render.moment( to );`
* * `$.fn.dataTable.render.moment( from, to );` * * `DataTable.render.moment( from, to );`
* * `$.fn.dataTable.render.moment( from, to, locale );` * * `DataTable.render.moment( from, to, locale );`
* *
* Where: * Where:
* *
@ -36,7 +89,7 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 1, * targets: 1,
* render: $.fn.dataTable.render.moment( 'Do MMM YYYY' ) * render: DataTable.render.moment( 'Do MMM YYYY' )
* } ] * } ]
* } ); * } );
* *
@ -45,7 +98,7 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 2, * targets: 2,
* render: $.fn.dataTable.render.moment( 'X', 'Do MMM YY' ) * render: DataTable.render.moment( 'X', 'Do MMM YY' )
* } ] * } ]
* } ); * } );
* *
@ -54,60 +107,21 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 2, * 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' )
* } ] * } ]
* } ); * } );
*/ */
DataTable.render.moment = function (from, to, locale) {
// 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 ) {
// Argument shifting // Argument shifting
if (arguments.length === 1) { if (arguments.length === 1) {
to = from; to = from;
from = 'YYYY-MM-DD'; from = 'YYYY-MM-DD';
} }
return function (d, type, row) { return function (d, type, row) {
if (!d) { if (!d) {
return type === 'sort' || type === 'type' ? 0 : d; return type === 'sort' || type === 'type' ? 0 : d;
} }
var m = window.moment(d, from, locale, true); var m = window.moment(d, from, locale, true);
// Order and type get a number value from Moment, everything else // Order and type get a number value from Moment, everything else
// sees the rendered value // sees the rendered value
return m.format(type === 'sort' || type === 'type' ? 'x' : to); return m.format(type === 'sort' || type === 'type' ? 'x' : to);
@ -115,4 +129,5 @@ $.fn.dataTable.render.moment = function ( from, to, locale ) {
}; };
return DateTime;
})); }));

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

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

@ -0,0 +1,89 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from 'jquery';
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,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * 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 * potentially large data strings to be shown in a column that is restricted by
@ -33,7 +81,7 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 1, * targets: 1,
* render: $.fn.dataTable.render.ellipsis( 17, true ) * render: DataTable.render.ellipsis( 17, true )
* } ] * } ]
* } ); * } );
* *
@ -42,12 +90,11 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 2, * targets: 2,
* render: $.fn.dataTable.render.ellipsis( 10 ) * render: DataTable.render.ellipsis( 10 )
* } ] * } ]
* } ); * } );
*/ */
DataTable.render.ellipsis = function (cutoff, wordbreak, escapeHtml) {
jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml ) {
var esc = function (t) { var esc = function (t) {
return ('' + t) return ('' + t)
.replace(/&/g, '&amp;') .replace(/&/g, '&amp;')
@ -55,41 +102,41 @@ jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml )
.replace(/>/g, '&gt;') .replace(/>/g, '&gt;')
.replace(/"/g, '&quot;'); .replace(/"/g, '&quot;');
}; };
return function (d, type, row) { return function (d, type, row) {
// Order, search and type get the original data // Order, search and type get the original data
if (type !== 'display') { if (type !== 'display') {
return d; return d;
} }
if (typeof d !== 'number' && typeof d !== 'string') { if (typeof d !== 'number' && typeof d !== 'string') {
if (escapeHtml) { if (escapeHtml) {
return esc(d); return esc(d);
} }
return d; return d;
} }
d = d.toString(); // cast numbers d = d.toString(); // cast numbers
if (d.length <= cutoff) { if (d.length <= cutoff) {
if (escapeHtml) { if (escapeHtml) {
return esc(d); return esc(d);
} }
return d; return d;
} }
var shortened = d.substr(0, cutoff - 1); var shortened = d.substr(0, cutoff - 1);
// Find the last white space character in the string // Find the last white space character in the string
if (wordbreak) { if (wordbreak) {
shortened = shortened.replace(/\s([^\s]*)$/, ''); shortened = shortened.replace(/\s([^\s]*)$/, '');
} }
// Protect against uncontrolled HTML input // Protect against uncontrolled HTML input
if (escapeHtml) { if (escapeHtml) {
shortened = esc(shortened); shortened = esc(shortened);
} }
return ('<span class="ellipsis" title="' +
return '<span class="ellipsis" title="'+esc(d)+'">'+shortened+'&#8230;</span>'; esc(d) +
'">' +
shortened +
'&#8230;</span>');
}; };
}; };
return DataTable;
}));

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

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from"jquery";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 $ from 'jquery';
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,51 @@
/*! © Lokesh Babu - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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 * 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, * anchorText has to rendered. The data for the column is still fully searchable and sortable, based on the hyperLink value,
@ -17,7 +65,7 @@
* *
* @name hyperLink * @name hyperLink
* @summary Displays url data in hyperLink with custom plcaeholder * @summary Displays url data in hyperLink with custom plcaeholder
* @author [Lokesh Babu] * @author Lokesh Babu
* @requires DataTables 1.10+ * @requires DataTables 1.10+
* *
* *
@ -26,7 +74,7 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 1, * targets: 1,
* render: $.fn.dataTable.render.hyperLink() * render: DataTable.render.hyperLink()
* } ] * } ]
* } ); * } );
* *
@ -35,7 +83,7 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 2, * targets: 2,
* render: $.fn.dataTable.render.hyperLink( 'Download' ) * render: DataTable.render.hyperLink( 'Download' )
* } ] * } ]
* } ); * } );
* *
@ -45,7 +93,7 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 2, * targets: 2,
* render: $.fn.dataTable.render.hyperLink( 'Download', 'popup' ) * render: DataTable.render.hyperLink( 'Download', 'popup' )
* } ] * } ]
* } ); * } );
* *
@ -55,59 +103,43 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 2, * targets: 2,
* render: $.fn.dataTable.render.hyperLink( 'Download', 'popup' , 1000, 500) * render: DataTable.render.hyperLink( 'Download', 'popup' , 1000, 500)
* } ] * } ]
* } ); * } );
*/ */
DataTable.render.hyperLink = function (anchorText, location, width, height) {
jQuery.fn.dataTable.render.hyperLink = function ( var validateAndReturnDefaultIfFailed = function (item, defaultValue) {
anchorText, if (typeof item === 'number') {
location,
width,
height
) {
validateAndReturnDefaultIfFailed = function (item, defaultValue) {
if (typeof item === "number") {
return item; return item;
} }
if (typeof item === 'string') {
if (typeof item === "string") {
return parseInt(item) ? item : defaultValue; return parseInt(item) ? item : defaultValue;
} }
return defaultValue; return defaultValue;
}; };
var anchorText = anchorText || 'Click Here';
var anchorText = anchorText || "Click Here"; var location = location || 'newTab';
var location = location || "newTab"; var width = validateAndReturnDefaultIfFailed(width, 600);
var width = validateAndReturnDefaultIfFailed(width, "600"); var height = validateAndReturnDefaultIfFailed(height, 400);
var height = validateAndReturnDefaultIfFailed(height, "400");
return function (data, type, row) { return function (data, type, row) {
// restriction only for table display rendering // restriction only for table display rendering
if (type !== "display") { if (type !== 'display') {
return data; return data;
} }
var url = data; var url = data;
try { try {
url = new URL(data); url = new URL(data);
switch (location) { switch (location) {
case "newTab": case 'newTab':
return ( return ('<a title="' +
'<a title="' +
url + url +
'" href="' + '" href="' +
url + url +
'" target="_blank">' + '" target="_blank">' +
anchorText + anchorText +
"</a>" '</a>');
); case 'popup':
case "popup": return ('<a title="' +
return (
'<a title="' +
url + url +
'" href="' + '" href="' +
url + url +
@ -117,25 +149,27 @@ jQuery.fn.dataTable.render.hyperLink = function (
anchorText + anchorText +
"', 'width=" + "', 'width=" +
width + width +
",height=" + ',height=' +
height + height +
"'); return false;\">" + '\'); return false;">' +
anchorText + anchorText +
"</a>" '</a>');
);
default: default:
return ( return ('<a title="' +
'<a title="' +
url + url +
'" href="' + '" href="' +
url + url +
'" target="_blank">' + '" target="_blank">' +
anchorText + anchorText +
"</a>" '</a>');
);
} }
} catch (e) { }
catch (e) {
return url; return url;
} }
}; };
}; };
return DataTable;
}));

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

@ -0,0 +1,2 @@
/*! © Lokesh Babu - datatables.net/license */
import $ from"jquery";import DataTable from"datatables.net";DataTable.render.hyperLink=function(n,i,o,u){function e(e,r){return"number"==typeof e||"string"==typeof e&&parseInt(e)?e:r}n=n||"Click Here",i=i||"newTab",o=e(o,600),u=e(u,400);return function(e,r,t){if("display"!==r)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="+o+",height="+u+"'); 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 $ from 'jquery';
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,51 @@
/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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, * 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 * Edge, Chrome, Firefox and Safari 10+. Any browser that does not support the
@ -29,15 +77,15 @@
* *
* @example * @example
* // Number renderer - using the `columns.render` option: * // Number renderer - using the `columns.render` option:
* render: $.fn.dataTable.render.intlNumber() * render: DataTable.render.intlNumber()
* *
* @example * @example
* // Number renderer - with specified locale: * // Number renderer - with specified locale:
* render: $.fn.dataTable.render.intlNumber('de') * render: DataTable.render.intlNumber('de')
* *
* @example * @example
* // Number renderer - with specified locale and options: * // Number renderer - with specified locale and options:
* render: $.fn.dataTable.render.intlNumber('de', { * render: DataTable.render.intlNumber('de', {
* style: 'currency', * style: 'currency',
* currency: 'USD' * currency: 'USD'
* } ) * } )
@ -45,58 +93,45 @@
* *
* @example * @example
* // Date time renderer - using the `columns.render` option: * // Date time renderer - using the `columns.render` option:
* render: $.fn.dataTable.render.intlDateTime() * render: DataTable.render.intlDateTime()
* *
* @example * @example
* // Date time renderer - with specified locale: * // Date time renderer - with specified locale:
* render: $.fn.dataTable.render.intlDateTime('en-US') * render: DataTable.render.intlDateTime('en-US')
* *
* @example * @example
* // Date time renderer - with specified locale and options: * // Date time renderer - with specified locale and options:
* render: $.fn.dataTable.render.intlDateTime('de', { * render: DataTable.render.intlDateTime('de', {
* weekday: 'long' * weekday: 'long'
* } ) * } )
* *
*/ */
DataTable.render.intlDateTime = function (locale, options) {
// UMD if (window.Intl) {
(function( factory ) { var formatter = new Intl.DateTimeFormat(locale, options);
"use strict"; return function (data, type) {
var date;
if ( typeof define === 'function' && define.amd ) { if (typeof data === 'string') {
// AMD date = Date.parse(data);
define( ['jquery'], function ( $ ) {
return factory( $, window, document );
} );
} }
else if ( typeof exports === 'object' ) { else if (data instanceof Date) {
// CommonJS date = data;
module.exports = function (root, $) {
if ( ! root ) {
root = window;
} }
if (isNaN(date) || type === 'type' || type === 'sort') {
if ( ! $ ) { return data;
$ = typeof window !== 'undefined' ?
require('jquery') :
require('jquery')( root );
} }
return formatter.format(date);
return factory( $, root, root.document );
}; };
} }
else { else {
// Browser return function (d) {
factory( jQuery, window, document ); return d;
} };
} }
(function( $, window, document ) { };
DataTable.render.intlNumber = function (locale, options) {
$.fn.dataTable.render.intlNumber = function ( locale, options ) {
if (window.Intl) { if (window.Intl) {
var formatter = new Intl.NumberFormat(locale, options); var formatter = new Intl.NumberFormat(locale, options);
return function (d, type) { return function (d, type) {
if (type === 'display') { if (type === 'display') {
return formatter.format(d); return formatter.format(d);
@ -115,33 +150,5 @@ $.fn.dataTable.render.intlNumber = function ( locale, options ) {
}; };
$.fn.dataTable.render.intlDateTime = function ( locale, options ) { return DataTable;
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;
};
}
};
})); }));

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

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

@ -0,0 +1,110 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from 'jquery';
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,73 +1,87 @@
/** /*! © SpryMedia Ltd - datatables.net/license */
* 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(),
* ] )
* } ]
* } );
*/
// UMD
(function( factory ){ (function( factory ){
"use strict";
if ( typeof define === 'function' && define.amd ) { if ( typeof define === 'function' && define.amd ) {
// AMD // AMD
define( ['jquery'], function ( $ ) { define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document ); return factory( $, window, document );
} ); } );
} }
else if ( typeof exports === 'object' ) { else if ( typeof exports === 'object' ) {
// CommonJS // CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
module.exports = function (root, $) { module.exports = function (root, $) {
if ( ! root ) { if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window; root = window;
} }
if ( ! $ ) { if ( ! $ ) {
$ = typeof window !== 'undefined' ? $ = jq( root );
require('jquery') :
require('jquery')( root );
} }
cjsRequires( root, $ );
return factory( $, root, root.document ); return factory( $, root, root.document );
}; };
} }
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else { else {
// Browser // Browser
factory( jQuery, window, document ); factory( jQuery, window, document );
} }
} }(function( $, window, document, undefined ) {
(function( $, window, document ) { '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) { return function (d, type, row, meta) {
for (var r = 0; r < renderArray.length; r++) { for (var r = 0; r < renderArray.length; r++) {
if (typeof renderArray[r] === "function") { if (typeof renderArray[r] === 'function') {
d = renderArray[r](d, type, row, meta); 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); 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); d = renderArray[r]._(d, type, row, meta);
} }
} }
@ -76,4 +90,5 @@ $.fn.dataTable.render.multi = function (renderArray) {
}; };
return DataTable;
})); }));

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

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

@ -0,0 +1,50 @@
/*! © SpryMedia Ltd - datatables.net/license */
import $ from 'jquery';
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 @@
/*! © SpryMedia Ltd, Alireza Mohammadi Doost - datatables.net/license */
declare module 'datatables.net' {
interface DataTablesStaticRender {
/** Convert numbers to Farsi, English or Arabic. */
numberTo(string: 'fa' | 'en' | 'ar'): any;
}
}
export {};

@ -0,0 +1,97 @@
/*! © SpryMedia Ltd, Alireza Mohammadi Doost - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* Convert numbers to farsi, english, arabic.
* تبدیل عداد به فارسی, انگلیسی, عربی
*
* @name convertTo
* @summary convert numbers to farsi, english, arabic.
* @author Alireza Mohammadi Doost
*
* @example
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.numberTo('fa')
* } ]
* } );
*/
DataTable.render.numberTo = function (to = 'fa') {
let result = null;
const faNumbers = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
const enNumbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
const arNumbers = ['۰', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
return function (d, type, row) {
if (type !== 'display') {
return d;
}
if (!d && to === 'fa') {
return 'مقدار ورودی صحیح نمی‌باشد.';
}
else if (!d) {
return 'numbers is empty.';
}
switch (to) {
case 'fa':
result = d.toString().replace(/\d/g, x => faNumbers[x]);
break;
case 'en':
result = d.toString().replace(/\d/g, x => enNumbers[x]);
break;
case 'ar':
result = d.toString().replace(/\d/g, x => arNumbers[x]);
break;
}
return result;
};
};
return DataTable;
}));

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd, Alireza Mohammadi Doost - datatables.net/license */
!function(t){var r,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(r=require("jquery"),o=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"!=typeof window?module.exports=function(e,n){return e=e||window,n=n||r(e),o(e,n),t(n,0,e.document)}:(o(window,r),module.exports=t(r,window,window.document))):t(jQuery,window,document)}(function(e,n,t,r){"use strict";e=e.fn.dataTable;return e.render.numberTo=function(r="fa"){let o=null;const u=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],i=["0","1","2","3","4","5","6","7","8","9"],d=["۰","١","٢","٣","٤","٥","٦","٧","٨","٩"];return function(e,n,t){if("display"!==n)return e;if(!e&&"fa"===r)return"مقدار ورودی صحیح نمی‌باشد.";if(!e)return"numbers is empty.";switch(r){case"fa":o=e.toString().replace(/\d/g,e=>u[e]);break;case"en":o=e.toString().replace(/\d/g,e=>i[e]);break;case"ar":o=e.toString().replace(/\d/g,e=>d[e])}return o}},e});

@ -0,0 +1,2 @@
/*! © SpryMedia Ltd, Alireza Mohammadi Doost - datatables.net/license */
import $ from"jquery";import DataTable from"datatables.net";DataTable.render.numberTo=function(a="fa"){let n=null;const i=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],l=["0","1","2","3","4","5","6","7","8","9"],o=["۰","١","٢","٣","٤","٥","٦","٧","٨","٩"];return function(e,r,t){if("display"!==r)return e;if(!e&&"fa"===a)return"مقدار ورودی صحیح نمی‌باشد.";if(!e)return"numbers is empty.";switch(a){case"fa":n=e.toString().replace(/\d/g,e=>i[e]);break;case"en":n=e.toString().replace(/\d/g,e=>l[e]);break;case"ar":n=e.toString().replace(/\d/g,e=>o[e])}return n}};export default DataTable;

@ -0,0 +1,53 @@
/*! © SpryMedia Ltd, Alireza Mohammadi Doost - datatables.net/license */
import $ from 'jquery';
import DataTable from 'datatables.net';
/**
* Convert numbers to farsi, english, arabic.
* تبدیل عداد به فارسی, انگلیسی, عربی
*
* @name convertTo
* @summary convert numbers to farsi, english, arabic.
* @author Alireza Mohammadi Doost
*
* @example
* $('#example').DataTable( {
* columnDefs: [ {
* targets: 2,
* render: DataTable.render.numberTo('fa')
* } ]
* } );
*/
DataTable.render.numberTo = function (to = 'fa') {
let result = null;
const faNumbers = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
const enNumbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
const arNumbers = ['۰', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
return function (d, type, row) {
if (type !== 'display') {
return d;
}
if (!d && to === 'fa') {
return 'مقدار ورودی صحیح نمی‌باشد.';
}
else if (!d) {
return 'numbers is empty.';
}
switch (to) {
case 'fa':
result = d.toString().replace(/\d/g, x => faNumbers[x]);
break;
case 'en':
result = d.toString().replace(/\d/g, x => enNumbers[x]);
break;
case 'ar':
result = d.toString().replace(/\d/g, x => arNumbers[x]);
break;
}
return result;
};
};
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,51 @@
/*! © Drijkoningen Dirk - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window !== 'undefined') {
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 ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.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. * 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 * Values can either have the % sign or not and decimals get rounded to the
@ -36,7 +84,7 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 4, * 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 +93,11 @@
* $('#example').DataTable( { * $('#example').DataTable( {
* columnDefs: [ { * columnDefs: [ {
* targets: 2, * targets: 2,
* render: $.fn.dataTable.render.percentBar() * render: DataTable.render.percentBar()
* } ] * } ]
* } ); * } );
*/ */
DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRound, bType) {
jQuery.fn.dataTable.render.percentBar = function(pShape, cText, cBorder, cBar, cBack, vRound, bType) {
pShape = pShape || 'square'; pShape = pShape || 'square';
cText = cText || '#000'; cText = cText || '#000';
cBorder = cBorder || '#BCBCBC'; cBorder = cBorder || '#BCBCBC';
@ -60,21 +107,31 @@ jQuery.fn.dataTable.render.percentBar = function(pShape, cText, cBorder, cBar, c
bType = bType || 'ridge'; bType = bType || 'ridge';
//Bar templates //Bar templates
var styleRule1 = 'max-width:100px;height:12px;margin:0 auto;'; 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 styleRule2 = 'border:2px ' +
var styleRule3 = 'height:12px;line-height:12px;text-align:center;background-color:'+cBar+';padding:auto 6px;'; 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 //Square is default, make template round if pShape == round
if (pShape == 'round') { if (pShape == 'round') {
styleRule2 += 'border-radius:5px;'; styleRule2 += 'border-radius:5px;';
styleRule3 += 'border-top-left-radius:4px;border-bottom-left-radius:4px;'; styleRule3 += 'border-top-left-radius:4px;border-bottom-left-radius:4px;';
} }
return function (d, type, row) { return function (d, type, row) {
//Remove % if found in the value //Remove % if found in the value
//Round to the given parameter vRound //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% //Not allowed to go over 100%
if(s>100){s=100} if (s > 100) {
s = 100;
}
// Order, search and type gets numbers // Order, search and type gets numbers
if (type !== 'display') { if (type !== 'display') {
return s; return s;
@ -82,8 +139,21 @@ jQuery.fn.dataTable.render.percentBar = function(pShape, cText, cBorder, cBar, c
if (typeof d !== 'number' && typeof d !== 'string') { if (typeof d !== 'number' && typeof d !== 'string') {
return d; return d;
} }
//Return the code for the bar //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;
}));

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

Loading…
Cancel
Save