diff --git a/api/average().js b/api/average().js index e9c8688..4063a1b 100644 --- a/api/average().js +++ b/api/average().js @@ -16,7 +16,7 @@ } }; - if (typeof window !== 'undefined') { + if (typeof window === 'undefined') { module.exports = function (root, $) { if ( ! root ) { // CommonJS environments without a window global must pass a diff --git a/api/average().min.js b/api/average().min.js index 0ee91f3..9e2079d 100644 --- a/api/average().min.js +++ b/api/average().min.js @@ -1,2 +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}); \ No newline at end of file +!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}); \ No newline at end of file diff --git a/api/average().min.mjs b/api/average().min.mjs index 9eba582..0a75c31 100644 --- a/api/average().min.mjs +++ b/api/average().min.mjs @@ -1,2 +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; \ No newline at end of file +import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("average()",function(){var e=this.flatten();return e.reduce(function(e,t){return+e+ +t},0)/e.length});export default DataTable; \ No newline at end of file diff --git a/api/average().mjs b/api/average().mjs index da6deb1..2e50bd4 100644 --- a/api/average().mjs +++ b/api/average().mjs @@ -1,8 +1,11 @@ /*! © SpryMedia Ltd - datatables.net/license */ -import $ from 'jquery'; +import jQuery from 'jquery'; import DataTable from 'datatables.net'; +// Allow reassignment of the $ variable +let $ = jQuery; + /** * 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 diff --git a/api/column().searchable().d.ts b/api/column().searchable().d.ts new file mode 100644 index 0000000..c3d78d5 --- /dev/null +++ b/api/column().searchable().d.ts @@ -0,0 +1,12 @@ +/*! © SpryMedia Ltd - datatables.net/license */ +declare module 'datatables.net' { + interface ApiColumnMethods { + /** Get searchable flag for selected column */ + searchable(): boolean; + } + interface ApiColumnsMethods { + /** Get searchable flag for selected columns */ + searchable(): Api; + } +} +export {}; diff --git a/api/column().searchable().js b/api/column().searchable().js new file mode 100644 index 0000000..adf514d --- /dev/null +++ b/api/column().searchable().js @@ -0,0 +1,76 @@ +/*! © 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 plug-in provides a way to determine the searchable state of one or more + * columns, as was configured by the `-init columns.searchable` option. + * + * @name columns().order() + * @summary Apply multi-column ordering through the columns() API method. + * @author [Allan Jardine](http://sprymedia.co.uk) + * @requires DataTables 1.10+ + * + * @returns {boolean|DataTables.Api} Searchable flag + * + * @example + * // Get the searchable flag for all columns + * table.columns().searchable().toArray() + * + * @example + * // Get the searchable flag for column index 0 + * table.column(0).searchable() + */ +DataTable.Api.registerPlural('columns().searchable()', 'column().searchable()', function (selector, opts) { + return this.iterator('column', function (settings, column) { + return settings.aoColumns[column].bSearchable; + }, 1); +}); + + +return DataTable; +})); diff --git a/api/column().searchable().min.js b/api/column().searchable().min.js new file mode 100644 index 0000000..da5caa6 --- /dev/null +++ b/api/column().searchable().min.js @@ -0,0 +1,2 @@ +/*! © SpryMedia Ltd - datatables.net/license */ +!function(t){var o,u;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),u=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),u(e,n),t(n,0,e.document)}:(u(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.registerPlural("columns().searchable()","column().searchable()",function(e,n){return this.iterator("column",function(e,n){return e.aoColumns[n].bSearchable},1)}),e}); \ No newline at end of file diff --git a/api/column().searchable().min.mjs b/api/column().searchable().min.mjs new file mode 100644 index 0000000..f709057 --- /dev/null +++ b/api/column().searchable().min.mjs @@ -0,0 +1,2 @@ +/*! © SpryMedia Ltd - datatables.net/license */ +import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.registerPlural("columns().searchable()","column().searchable()",function(a,e){return this.iterator("column",function(a,e){return a.aoColumns[e].bSearchable},1)});export default DataTable; \ No newline at end of file diff --git a/api/column().searchable().mjs b/api/column().searchable().mjs new file mode 100644 index 0000000..56e5705 --- /dev/null +++ b/api/column().searchable().mjs @@ -0,0 +1,35 @@ +/*! © SpryMedia Ltd - datatables.net/license */ + +import jQuery from 'jquery'; +import DataTable from 'datatables.net'; + +// Allow reassignment of the $ variable +let $ = jQuery; + +/** + * The plug-in provides a way to determine the searchable state of one or more + * columns, as was configured by the `-init columns.searchable` option. + * + * @name columns().order() + * @summary Apply multi-column ordering through the columns() API method. + * @author [Allan Jardine](http://sprymedia.co.uk) + * @requires DataTables 1.10+ + * + * @returns {boolean|DataTables.Api} Searchable flag + * + * @example + * // Get the searchable flag for all columns + * table.columns().searchable().toArray() + * + * @example + * // Get the searchable flag for column index 0 + * table.column(0).searchable() + */ +DataTable.Api.registerPlural('columns().searchable()', 'column().searchable()', function (selector, opts) { + return this.iterator('column', function (settings, column) { + return settings.aoColumns[column].bSearchable; + }, 1); +}); + + +export default DataTable; diff --git a/api/column().title().js b/api/column().title().js index e8b78da..4915a84 100644 --- a/api/column().title().js +++ b/api/column().title().js @@ -16,7 +16,7 @@ } }; - if (typeof window !== 'undefined') { + if (typeof window === 'undefined') { module.exports = function (root, $) { if ( ! root ) { // CommonJS environments without a window global must pass a diff --git a/api/column().title().min.js b/api/column().title().min.js index 516c12f..875f1b8 100644 --- a/api/column().title().min.js +++ b/api/column().title().min.js @@ -1,2 +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}); \ No newline at end of file +!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}); \ No newline at end of file diff --git a/api/column().title().min.mjs b/api/column().title().min.mjs index 8236572..40b8473 100644 --- a/api/column().title().min.mjs +++ b/api/column().title().min.mjs @@ -1,2 +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; \ No newline at end of file +import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("column().title()",function(){var t=this.header();return $(t).text().trim()});export default DataTable; \ No newline at end of file diff --git a/api/column().title().mjs b/api/column().title().mjs index ce064c1..aa8d70b 100644 --- a/api/column().title().mjs +++ b/api/column().title().mjs @@ -1,8 +1,11 @@ /*! © Alejandro Navarro - datatables.net/license */ -import $ from 'jquery'; +import jQuery from 'jquery'; import DataTable from 'datatables.net'; +// Allow reassignment of the $ variable +let $ = jQuery; + /** * This plug-in will read the text from the header cell of a column, returning * that value. diff --git a/api/columns().order().js b/api/columns().order().js index 0b3b012..215252f 100644 --- a/api/columns().order().js +++ b/api/columns().order().js @@ -16,7 +16,7 @@ } }; - if (typeof window !== 'undefined') { + if (typeof window === 'undefined') { module.exports = function (root, $) { if ( ! root ) { // CommonJS environments without a window global must pass a diff --git a/api/columns().order().min.js b/api/columns().order().min.js index a95bede..6b4ce97 100644 --- a/api/columns().order().min.js +++ b/api/columns().order().min.js @@ -1,2 +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=e.start&&t=e.start&&t=t.start&&a=e.start&&t; + } +} + +DataTable.Api.registerPlural( + 'columns().searchable()', + 'column().searchable()', + function ( selector, opts ) { + return this.iterator( 'column', function ( settings, column ) { + return settings.aoColumns[column].bSearchable; + }, 1 ); + } +); + \ No newline at end of file diff --git a/api/sum().js b/api/sum().js index 331e77c..f1cf4bf 100644 --- a/api/sum().js +++ b/api/sum().js @@ -16,7 +16,7 @@ } }; - if (typeof window !== 'undefined') { + if (typeof window === 'undefined') { module.exports = function (root, $) { if ( ! root ) { // CommonJS environments without a window global must pass a diff --git a/api/sum().min.js b/api/sum().min.js index c1205e0..086fd98 100644 --- a/api/sum().min.js +++ b/api/sum().min.js @@ -1,2 +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}); \ No newline at end of file +!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}); \ No newline at end of file diff --git a/api/sum().min.mjs b/api/sum().min.mjs index 46fe2f0..58c4c60 100644 --- a/api/sum().min.mjs +++ b/api/sum().min.mjs @@ -1,2 +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; \ No newline at end of file +import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.Api.register("sum()",function(){return this.flatten().reduce(function(e,t){return(e="string"==typeof e?+e.replace(/[^\d.-]/g,""):e)+(t="string"==typeof t?+t.replace(/[^\d.-]/g,""):t)},0)});export default DataTable; \ No newline at end of file diff --git a/api/sum().mjs b/api/sum().mjs index 97057c8..dca1fd4 100644 --- a/api/sum().mjs +++ b/api/sum().mjs @@ -1,8 +1,11 @@ /*! © SpryMedia Ltd - datatables.net/license */ -import $ from 'jquery'; +import jQuery from 'jquery'; import DataTable from 'datatables.net'; +// Allow reassignment of the $ variable +let $ = jQuery; + /** * 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 diff --git a/make.sh b/make.sh index 9c015a9..a48a17d 100755 --- a/make.sh +++ b/make.sh @@ -92,9 +92,9 @@ DT_BUILT="${DT_SRC}/built/DataTables" PLUGINS="${DT_SRC}/extensions/Plugins" -# for file in $PLUGINS/api/src/*.ts; do -# ts_plugin $file -# done +for file in $PLUGINS/api/src/*.ts; do + ts_plugin $file +done # for file in $PLUGINS/buttons/src/*.ts; do # ts_plugin $file @@ -108,17 +108,17 @@ PLUGINS="${DT_SRC}/extensions/Plugins" # ts_plugin $file # done -for file in $PLUGINS/sorting/src/*.ts; do - ts_plugin $file -done +# for file in $PLUGINS/sorting/src/*.ts; do +# ts_plugin $file +# done -for file in $PLUGINS/type-detection/src/*.ts; do - ts_plugin $file -done +# for file in $PLUGINS/type-detection/src/*.ts; do +# ts_plugin $file +# done -for file in $PLUGINS/filtering/type-based/src/*.ts; do - ts_plugin $file -done +# for file in $PLUGINS/filtering/type-based/src/*.ts; do +# ts_plugin $file +# done # echo_section " Languages" # for file in $PLUGINS/i18n/*.json; do