You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plugins/features/searchFade/dataTables.searchFade.min.mjs

2 lines
1.3 KiB
JavaScript

/*! © SpryMedia Ltd - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;function _draw(e,a){a.empty(),a.append("Search: "),$('<input type="text" class="searchFadeInput'+e.settings()[0].sTableId+'">').appendTo(a)}DataTable.Api.register("searchFade()",function(){return this}),DataTable.Api.register("searchFade().node()",function(){return this.settings()[0].searchFadeNode}),DataTable.SearchFade=function(e){var d=new DataTable.Api(e),a=$('<div class="searchFade"/>');d.settings()[0].searchFadeNode=a,_draw(d,a),a.on("keyup redraw","input",function(){d.rows(":visible").every(function(e,a,t){var n=!0,r=$(".searchFadeInput"+d.settings()[0].sTableId).val();r.length&&(n=d.row(e).data().some(function(e){return null!=e.match(new RegExp(r,"i"))})),$(d.row(e).node()).toggleClass("notMatched",!n)})}),d.on("draw",function(){$("input",a).trigger("redraw")}),this.node=function(){return a}},DataTable.ext.feature.push({fnInit:function(e){return new DataTable.SearchFade(e).node()},cFeature:"F"}),DataTable.feature.register("searchFade",function(e){return new DataTable.SearchFade(e).node()}),$(document).on("init.dt",function(e,a){"dt"===e.namespace&&(a.oInit.searchFade||DataTable.defaults.searchFade)&&DataTable.SearchFade(a)});export default DataTable;