Update datatables.mark.js to v2.0.2

pull/493/head
Julian Kühnel 4 years ago
parent 8df683813c
commit bb726ed591

@ -1,7 +1,7 @@
/*!*************************************************** /*!***************************************************
* datatables.mark.js v2.0.1 * datatables.mark.js v2.0.2
* https://github.com/julmot/datatables.mark.js * https://github.com/julmot/datatables.mark.js
* Copyright (c) 20162017, Julian Motz * Copyright (c) 20162020, Julian Kühnel
* Released under the MIT license https://git.io/voRZ7 * Released under the MIT license https://git.io/voRZ7
*****************************************************/ *****************************************************/

@ -1,7 +1,7 @@
/*!*************************************************** /*!***************************************************
* datatables.mark.js v2.0.1 * datatables.mark.js v2.0.2
* https://github.com/julmot/datatables.mark.js * https://github.com/julmot/datatables.mark.js
* Copyright (c) 20162017, Julian Motz * Copyright (c) 20162020, Julian Kühnel
* Released under the MIT license https://git.io/voRZ7 * Released under the MIT license https://git.io/voRZ7
*****************************************************/ *****************************************************/
'use strict';((factory,window,document)=>{if(typeof exports==='object'){const jquery=require('jquery');require('datatables.net');require('mark.js/dist/jquery.mark.js');module.exports=factory(window,document,jquery);}else if(typeof define==='function'&&define.amd){define(['jquery','datatables.net','markjs'],jQuery=>{return factory(window,document,jQuery);});}else{factory(window,document,jQuery);}})((window,document,$)=>{class MarkDataTables{constructor(dtInstance,options){if(!$.fn.mark||!$.fn.unmark){throw new Error('jquery.mark.js is necessary for datatables.mark.js');}this.instance=dtInstance;this.options=typeof options==='object'?options:{};this.intervalThreshold=49;this.intervalMs=300;this.initMarkListener();}initMarkListener(){const ev='draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth';let intvl=null;this.instance.on(ev,()=>{const rows=this.instance.rows({filter:'applied',page:'current'}).nodes().length;if(rows>this.intervalThreshold){clearTimeout(intvl);intvl=setTimeout(()=>{this.mark();},this.intervalMs);}else{this.mark();}});this.instance.on('destroy',()=>{this.instance.off(ev);});this.mark();}mark(){const globalSearch=this.instance.search();$(this.instance.table().body()).unmark(this.options);this.instance.columns({search:'applied',page:'current'}).nodes().each((nodes,colIndex)=>{const columnSearch=this.instance.column(colIndex).search(),searchVal=columnSearch||globalSearch;if(searchVal){nodes.forEach(node=>{$(node).mark(searchVal,this.options);});}});}}$(document).on('init.dt.dth',(event,settings)=>{if(event.namespace!=='dt'){return;}const dtInstance=$.fn.dataTable.Api(settings);let options=null;if(dtInstance.init().mark){options=dtInstance.init().mark;}else if($.fn.dataTable.defaults.mark){options=$.fn.dataTable.defaults.mark;}if(options===null){return;}new MarkDataTables(dtInstance,options);});},window,document); 'use strict';((factory,window,document)=>{if(typeof exports==='object'){const jquery=require('jquery');require('datatables.net');require('mark.js/dist/jquery.mark.js');module.exports=factory(window,document,jquery);}else if(typeof define==='function'&&define.amd){define(['jquery','datatables.net','markjs'],jQuery=>{return factory(window,document,jQuery);});}else{factory(window,document,jQuery);}})((window,document,$)=>{class MarkDataTables{constructor(dtInstance,options){if(!$.fn.mark||!$.fn.unmark){throw new Error('jquery.mark.js is necessary for datatables.mark.js');}this.instance=dtInstance;this.options=typeof options==='object'?options:{};this.intervalThreshold=49;this.intervalMs=300;this.initMarkListener();}initMarkListener(){const ev='draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth';let intvl=null;this.instance.on(ev,()=>{const rows=this.instance.rows({filter:'applied',page:'current'}).nodes().length;if(rows>this.intervalThreshold){clearTimeout(intvl);intvl=setTimeout(()=>{this.mark();},this.intervalMs);}else{this.mark();}});this.instance.on('destroy',()=>{this.instance.off(ev);});this.mark();}mark(){const globalSearch=this.instance.search();$(this.instance.table().body()).unmark(this.options);this.instance.columns({search:'applied',page:'current'}).nodes().each((nodes,colIndex)=>{const columnSearch=this.instance.column(colIndex).search(),searchVal=columnSearch||globalSearch;if(searchVal){nodes.forEach(node=>{$(node).mark(searchVal,this.options);});}});}}$(document).on('init.dt.dth',(event,settings)=>{if(event.namespace!=='dt'){return;}const dtInstance=$.fn.dataTable.Api(settings);let options=null;if(dtInstance.init().mark){options=dtInstance.init().mark;}else if($.fn.dataTable.defaults.mark){options=$.fn.dataTable.defaults.mark;}if(options===null){return;}new MarkDataTables(dtInstance,options);});},window,document);

@ -1,7 +1,7 @@
/*!*************************************************** /*!***************************************************
* datatables.mark.js v2.0.1 * datatables.mark.js v2.0.2
* https://github.com/julmot/datatables.mark.js * https://github.com/julmot/datatables.mark.js
* Copyright (c) 20162017, Julian Motz * Copyright (c) 20162020, Julian Kühnel
* Released under the MIT license https://git.io/voRZ7 * Released under the MIT license https://git.io/voRZ7
*****************************************************/ *****************************************************/

@ -1,7 +1,7 @@
/*!*************************************************** /*!***************************************************
* datatables.mark.js v2.0.1 * datatables.mark.js v2.0.2
* https://github.com/julmot/datatables.mark.js * https://github.com/julmot/datatables.mark.js
* Copyright (c) 20162017, Julian Motz * Copyright (c) 20162020, Julian Kühnel
* Released under the MIT license https://git.io/voRZ7 * Released under the MIT license https://git.io/voRZ7
*****************************************************/ *****************************************************/
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t,n){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))){var r=require("jquery");require("datatables.net"),require("mark.js/dist/jquery.mark.js"),module.exports=e(t,n,r)}else"function"==typeof define&&define.amd?define(["jquery","datatables.net","markjs"],function(r){return e(t,n,r)}):e(t,n,jQuery)}(function(e,t,n){var r=function(){function e(t,r){if(_classCallCheck(this,e),!n.fn.mark||!n.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=t,this.options="object"===(void 0===r?"undefined":_typeof(r))?r:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}return _createClass(e,[{key:"initMarkListener",value:function(){var e=this,t="draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",n=null;this.instance.on(t,function(){e.instance.rows({filter:"applied",page:"current"}).nodes().length>e.intervalThreshold?(clearTimeout(n),n=setTimeout(function(){e.mark()},e.intervalMs)):e.mark()}),this.instance.on("destroy",function(){e.instance.off(t)}),this.mark()}},{key:"mark",value:function(){var e=this,t=this.instance.search();n(this.instance.table().body()).unmark(this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each(function(r,a){var i=e.instance.column(a).search()||t;i&&r.forEach(function(t){n(t).mark(i,e.options)})})}}]),e}();n(t).on("init.dt.dth",function(e,t){if("dt"===e.namespace){var a=n.fn.dataTable.Api(t),i=null;a.init().mark?i=a.init().mark:n.fn.dataTable.defaults.mark&&(i=n.fn.dataTable.defaults.mark),null!==i&&new r(a,i)}})},window,document); "use strict";var _createClass=function(){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}!function(t,e,n){var r;"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?(r=require("jquery"),require("datatables.net"),require("mark.js/dist/jquery.mark.js"),module.exports=t(0,n,r)):"function"==typeof define&&define.amd?define(["jquery","datatables.net","markjs"],function(e){return t(0,n,e)}):t(0,n,jQuery)}(function(e,t,i){var a=(_createClass(n,[{key:"initMarkListener",value:function(){var e=this,t="draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",n=null;this.instance.on(t,function(){e.instance.rows({filter:"applied",page:"current"}).nodes().length>e.intervalThreshold?(clearTimeout(n),n=setTimeout(function(){e.mark()},e.intervalMs)):e.mark()}),this.instance.on("destroy",function(){e.instance.off(t)}),this.mark()}},{key:"mark",value:function(){var r=this,a=this.instance.search();i(this.instance.table().body()).unmark(this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each(function(e,t){var n=r.instance.column(t).search()||a;n&&e.forEach(function(e){i(e).mark(n,r.options)})})}}]),n);function n(e,t){if(_classCallCheck(this,n),!i.fn.mark||!i.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=e,this.options="object"===(void 0===t?"undefined":_typeof(t))?t:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}i(t).on("init.dt.dth",function(e,t){var n,r;"dt"===e.namespace&&(r=null,(n=i.fn.dataTable.Api(t)).init().mark?r=n.init().mark:i.fn.dataTable.defaults.mark&&(r=i.fn.dataTable.defaults.mark),null!==r&&new a(n,r))})},window,document);
Loading…
Cancel
Save