UNPKG

@coreui/coreui-datatables

Version:

DataTables for CoreUI with styling for [CoreUI 3](https://coreui.io/)

1 lines 2.05 kB
!function(a){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return a(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e||(e=window),t&&t.fn.dataTable||(t=require("datatables.net")(e,t).$),a(t,e,e.document)}:a(jQuery,window,document)}(function(h,e,n,s){"use strict";var c=h.fn.dataTable;return h.extend(!0,c.defaults,{dom:"<'c-row'<'c-col-sm-12 c-col-md-6'l><'c-col-sm-12 c-col-md-6'f>><'c-row'<'c-col-sm-12'tr>><'c-row'<'c-col-sm-12 c-col-md-5'i><'c-col-sm-12 c-col-md-7'p>>",renderer:"bootstrap"}),h.extend(c.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"c-form-control c-form-control-sm",sLengthSelect:"c-custom-select c-custom-select-sm c-form-control c-form-control-sm",sProcessing:"dataTables_processing c-card",sPageButton:"paginate_button c-page-item"}),c.ext.renderer.pageButton.bootstrap=function(r,e,d,t,i,l){var u,p,a,f=new c.Api(r),m=r.oClasses,b=r.oLanguage.oPaginate,g=r.oLanguage.oAria.paginate||{},x=0,w=function(e,t){function a(e){e.preventDefault(),h(e.currentTarget).hasClass("disabled")||f.page()==e.data.action||f.page(e.data.action).draw("page")}var n,s,c,o;for(n=0,s=t.length;n<s;n++)if(o=t[n],h.isArray(o))w(e,o);else{switch(p=u="",o){case"ellipsis":u="&#x2026;",p="disabled";break;case"first":u=b.sFirst,p=o+(0<i?"":" disabled");break;case"previous":u=b.sPrevious,p=o+(0<i?"":" disabled");break;case"next":u=b.sNext,p=o+(i<l-1?"":" disabled");break;case"last":u=b.sLast,p=o+(i<l-1?"":" disabled");break;default:u=o+1,p=i===o?"active":""}u&&(c=h("<li>",{class:m.sPageButton+" "+p,id:0===d&&"string"==typeof o?r.sTableId+"_"+o:null}).append(h("<a>",{href:"#","aria-controls":r.sTableId,"aria-label":g[o],"data-dt-idx":x,tabindex:r.iTabIndex,class:"c-page-link"}).html(u)).appendTo(e),r.oApi._fnBindAction(c,{action:o},a),x++)}};try{a=h(e).find(n.activeElement).data("dt-idx")}catch(e){}w(h(e).empty().html('<ul class="c-pagination c-justify-content-end"/>').children("ul"),t),a!==s&&h(e).find("[data-dt-idx="+a+"]").focus()},c});