commit
25fc20a37a
@ -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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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);
|
||||||
|
});
|
@ -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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}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+"…</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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}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+"…</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, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"');
|
||||||
|
};
|
||||||
|
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 +
|
||||||
|
'…</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 {};
|
@ -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 {};
|
@ -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 {};
|
@ -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,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 {};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue