Plugins/features/mark.js/datatables.mark.min.js

7 lines
2.0 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*!***************************************************
* datatables.mark.js v3.0.0
* https://github.com/julmot/datatables.mark.js
* Copyright (c) 20162020, Julian Kühnel, SpryMedia Ltd
* Released under the MIT license https://git.io/voRZ7
*****************************************************/
!function(n){var i,s;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(i=require("jquery"),s=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||i(t),s(t,e),n(e,0,t.document)}:(s(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(a,t,e,n){"use strict";var i=a.fn.dataTable;class s{instance;options;intervalThreshold;intervalMs;constructor(t,e){if(!a.fn.mark||!a.fn.unmark)throw new Error("jquery.mark.js is necessary for datatables.mark.js");this.instance=t,this.options="object"==typeof e?e:{},this.intervalThreshold=49,this.intervalMs=300,this.initMarkListener()}initMarkListener(){let t="draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",e=(t+=" responsive-display.dt.dth",null);this.instance.on(t,()=>{this.instance.rows({filter:"applied",page:"current"}).nodes().length>this.intervalThreshold?(clearTimeout(e),e=setTimeout(()=>{this.mark()},this.intervalMs)):this.mark()}),this.instance.on("destroy",()=>{this.instance.off(t)}),this.mark()}mark(){const s=this.instance.search();var t=a(this.instance.table().body());t.unmark(this.options),this.instance.table().rows({search:"applied"}).data().length&&t.mark(s,this.options),this.instance.columns({search:"applied",page:"current"}).nodes().each((t,e)=>{const n=this.instance.column(e).search(),i=n||s;i&&t.forEach(t=>{a(t).unmark(this.options).mark(i,this.options)})})}}return a(e).on("init.dt.dth",(e,n)=>{if("dt"===e.namespace){e=new i.Api(n);let t=!1;e.init().mark?t=e.init().mark:i.defaults.mark&&(t=i.defaults.mark),t&&new s(e,t)}}),i});