|
|
|
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;$(document).on("init.dt",function(t,e){var n,s,o,l,a;"dt"===t.namespace&&(t=e.oInit.conditionalPageLength||DataTable.defaults.conditionalPageLength,a=e.aLengthMenu||DataTable.defaults.lengthMenu,a=(a=Array.isArray(a[0])?a[0]:a).filter(function(t){return 0<t}),n=Math.min.apply(Math,a),$.isPlainObject(t)||!0===t)&&(s=$.isPlainObject(t)?t:{},o=new DataTable.Api(e),l=500,void 0!==s.speed&&(l=s.speed),(a=function(t){var e=$(o.table().container()).find("div.dt-length"),a=o.page.info().pages,i=o.rows({search:"applied"}).count();t instanceof $.Event?a<=1&&i<=n?"fade"===s.style?e.stop().fadeTo(l,0):e.css("visibility","hidden"):"fade"===s.style?e.stop().fadeTo(l,1):e.css("visibility",""):a<=1&&i<=n&&("fade"===s.style?e.css("opacity",0):e.css("visibility","hidden")),s.conditionalOptions&&e.find("select option").each(function(t){parseInt($(this).attr("value"),10)>i?$(this).hide():$(this).show()})})(null),o.on("draw.dt",a))});export default DataTable;
|