datatables.net-bs
Advanced tools
Comparing version 1.13.10 to 2.0.0
@@ -46,3 +46,3 @@ /*! DataTables Bootstrap 3 integration | ||
} | ||
}(function( $, window, document, undefined ) { | ||
}(function( $, window, document ) { | ||
'use strict'; | ||
@@ -64,6 +64,2 @@ var DataTable = $.fn.dataTable; | ||
$.extend( true, DataTable.defaults, { | ||
dom: | ||
"<'row'<'col-sm-6'l><'col-sm-6'f>>" + | ||
"<'row'<'col-sm-12'tr>>" + | ||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", | ||
renderer: 'bootstrap' | ||
@@ -74,126 +70,78 @@ } ); | ||
/* Default class modification */ | ||
$.extend( DataTable.ext.classes, { | ||
sWrapper: "dataTables_wrapper form-inline dt-bootstrap", | ||
sFilterInput: "form-control input-sm", | ||
sLengthSelect: "form-control input-sm", | ||
sProcessing: "dataTables_processing panel panel-default" | ||
$.extend( true, DataTable.ext.classes, { | ||
container: "dt-container form-inline dt-bootstrap", | ||
search: { | ||
input: "form-control input-sm" | ||
}, | ||
length: { | ||
select: "form-control input-sm" | ||
}, | ||
processing: { | ||
container: "dt-processing panel panel-default" | ||
} | ||
} ); | ||
/* Bootstrap paging button renderer */ | ||
DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) { | ||
var api = new DataTable.Api( settings ); | ||
var classes = settings.oClasses; | ||
var lang = settings.oLanguage.oPaginate; | ||
var aria = settings.oLanguage.oAria.paginate || {}; | ||
var btnDisplay, btnClass; | ||
DataTable.ext.renderer.pagingButton.bootstrap = function (settings, buttonType, content, active, disabled) { | ||
var btnClasses = ['dt-paging-button', 'page-item']; | ||
var attach = function( container, buttons ) { | ||
var i, ien, node, button; | ||
var clickHandler = function ( e ) { | ||
e.preventDefault(); | ||
if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) { | ||
api.page( e.data.action ).draw( 'page' ); | ||
} | ||
}; | ||
if (active) { | ||
btnClasses.push('active'); | ||
} | ||
for ( i=0, ien=buttons.length ; i<ien ; i++ ) { | ||
button = buttons[i]; | ||
if (disabled) { | ||
btnClasses.push('disabled') | ||
} | ||
if ( Array.isArray( button ) ) { | ||
attach( container, button ); | ||
} | ||
else { | ||
btnDisplay = ''; | ||
btnClass = ''; | ||
var li = $('<li>').addClass(btnClasses.join(' ')); | ||
var a = $('<a>', { | ||
'href': disabled ? null : '#', | ||
'class': 'page-link' | ||
}) | ||
.html(content) | ||
.appendTo(li); | ||
switch ( button ) { | ||
case 'ellipsis': | ||
btnDisplay = '…'; | ||
btnClass = 'disabled'; | ||
break; | ||
return { | ||
display: li, | ||
clicker: a | ||
}; | ||
}; | ||
case 'first': | ||
btnDisplay = lang.sFirst; | ||
btnClass = button + (page > 0 ? | ||
'' : ' disabled'); | ||
break; | ||
DataTable.ext.renderer.pagingContainer.bootstrap = function (settings, buttonEls) { | ||
return $('<ul/>').addClass('pagination').append(buttonEls); | ||
}; | ||
case 'previous': | ||
btnDisplay = lang.sPrevious; | ||
btnClass = button + (page > 0 ? | ||
'' : ' disabled'); | ||
break; | ||
DataTable.ext.renderer.layout.bootstrap = function ( settings, container, items ) { | ||
var row = $( '<div/>', { | ||
"class": 'row' | ||
} ) | ||
.appendTo( container ); | ||
case 'next': | ||
btnDisplay = lang.sNext; | ||
btnClass = button + (page < pages-1 ? | ||
'' : ' disabled'); | ||
break; | ||
$.each( items, function (key, val) { | ||
var klass = ''; | ||
if ( key === 'start' ) { | ||
klass += 'col-sm-6 text-left'; | ||
} | ||
else if ( key === 'end' ) { | ||
klass += 'col-sm-6 text-right'; | ||
case 'last': | ||
btnDisplay = lang.sLast; | ||
btnClass = button + (page < pages-1 ? | ||
'' : ' disabled'); | ||
break; | ||
default: | ||
btnDisplay = button + 1; | ||
btnClass = page === button ? | ||
'active' : ''; | ||
break; | ||
} | ||
if ( btnDisplay ) { | ||
var disabled = btnClass.indexOf('disabled') !== -1; | ||
node = $('<li>', { | ||
'class': classes.sPageButton+' '+btnClass, | ||
'id': idx === 0 && typeof button === 'string' ? | ||
settings.sTableId +'_'+ button : | ||
null | ||
} ) | ||
.append( $('<a>', { | ||
'href': disabled ? null : '#', | ||
'aria-controls': settings.sTableId, | ||
'aria-disabled': disabled ? 'true' : null, | ||
'aria-label': aria[ button ], | ||
'role': 'link', | ||
'aria-current': btnClass === 'active' ? 'page' : null, | ||
'data-dt-idx': button, | ||
'tabindex': disabled ? -1 : settings.iTabIndex | ||
} ) | ||
.html( btnDisplay ) | ||
) | ||
.appendTo( container ); | ||
settings.oApi._fnBindAction( | ||
node, {action: button}, clickHandler | ||
); | ||
} | ||
// If no left element, we need to offset this one | ||
if (row.find('.col-sm-6').length === 0) { | ||
klass += ' col-sm-offset-6'; | ||
} | ||
} | ||
}; | ||
else if ( key === 'full' ) { | ||
klass += 'col-sm-12'; | ||
if ( ! val.table ) { | ||
klass += ' text-center'; | ||
} | ||
} | ||
// IE9 throws an 'unknown error' if document.activeElement is used | ||
// inside an iframe or frame. | ||
var activeEl; | ||
try { | ||
// Because this approach is destroying and recreating the paging | ||
// elements, focus is lost on the select button which is bad for | ||
// accessibility. So we want to restore focus once the draw has | ||
// completed | ||
activeEl = $(host).find(document.activeElement).data('dt-idx'); | ||
} | ||
catch (e) {} | ||
attach( | ||
$(host).empty().html('<ul class="pagination"/>').children('ul'), | ||
buttons | ||
); | ||
if ( activeEl !== undefined ) { | ||
$(host).find( '[data-dt-idx='+activeEl+']' ).trigger('focus'); | ||
} | ||
$( '<div/>', { | ||
id: val.id || null, | ||
"class": klass+' '+(val.className || '') | ||
} ) | ||
.append( val.contents ) | ||
.appendTo( row ); | ||
} ); | ||
}; | ||
@@ -200,0 +148,0 @@ |
/*! DataTables Bootstrap 3 integration | ||
* ©2011-2015 SpryMedia Ltd - datatables.net/license | ||
*/ | ||
!function(t){var n,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(n=require("jquery"),i=function(e,a){a.fn.dataTable||require("datatables.net")(e,a)},"undefined"==typeof window?module.exports=function(e,a){return e=e||window,a=a||n(e),i(e,a),t(a,0,e.document)}:(i(window,n),module.exports=t(n,window,window.document))):t(jQuery,window,document)}(function(x,e,n,i){"use strict";var r=x.fn.dataTable;return x.extend(!0,r.defaults,{dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",renderer:"bootstrap"}),x.extend(r.ext.classes,{sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm",sProcessing:"dataTables_processing panel panel-default"}),r.ext.renderer.pageButton.bootstrap=function(s,e,d,a,l,c){function u(e,a){for(var t,n,i=function(e){e.preventDefault(),x(e.currentTarget).hasClass("disabled")||b.page()==e.data.action||b.page(e.data.action).draw("page")},r=0,o=a.length;r<o;r++)if(t=a[r],Array.isArray(t))u(e,t);else{switch(f=p="",t){case"ellipsis":p="…",f="disabled";break;case"first":p=g.sFirst,f=t+(0<l?"":" disabled");break;case"previous":p=g.sPrevious,f=t+(0<l?"":" disabled");break;case"next":p=g.sNext,f=t+(l<c-1?"":" disabled");break;case"last":p=g.sLast,f=t+(l<c-1?"":" disabled");break;default:p=t+1,f=l===t?"active":""}p&&(n=-1!==f.indexOf("disabled"),n=x("<li>",{class:m.sPageButton+" "+f,id:0===d&&"string"==typeof t?s.sTableId+"_"+t:null}).append(x("<a>",{href:n?null:"#","aria-controls":s.sTableId,"aria-disabled":n?"true":null,"aria-label":w[t],role:"link","aria-current":"active"===f?"page":null,"data-dt-idx":t,tabindex:n?-1:s.iTabIndex}).html(p)).appendTo(e),s.oApi._fnBindAction(n,{action:t},i))}}var p,f,t,b=new r.Api(s),m=s.oClasses,g=s.oLanguage.oPaginate,w=s.oLanguage.oAria.paginate||{};try{t=x(e).find(n.activeElement).data("dt-idx")}catch(e){}u(x(e).empty().html('<ul class="pagination"/>').children("ul"),a),t!==i&&x(e).find("[data-dt-idx="+t+"]").trigger("focus")},r}); | ||
!function(n){var o,a;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?(o=require("jquery"),a=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||o(e),a(e,t),n(t,0,e.document)}:(a(window,o),module.exports=n(o,window,window.document))):n(jQuery,window,document)}(function(i,e,t){"use strict";var n=i.fn.dataTable;return i.extend(!0,n.defaults,{renderer:"bootstrap"}),i.extend(!0,n.ext.classes,{container:"dt-container form-inline dt-bootstrap",search:{input:"form-control input-sm"},length:{select:"form-control input-sm"},processing:{container:"dt-processing panel panel-default"}}),n.ext.renderer.pagingButton.bootstrap=function(e,t,n,o,a){var r=["dt-paging-button","page-item"],o=(o&&r.push("active"),a&&r.push("disabled"),i("<li>").addClass(r.join(" ")));return{display:o,clicker:i("<a>",{href:a?null:"#",class:"page-link"}).html(n).appendTo(o)}},n.ext.renderer.pagingContainer.bootstrap=function(e,t){return i("<ul/>").addClass("pagination").append(t)},n.ext.renderer.layout.bootstrap=function(e,t,n){var o=i("<div/>",{class:"row"}).appendTo(t);i.each(n,function(e,t){var n="";"start"===e?n+="col-sm-6 text-left":"end"===e?(n+="col-sm-6 text-right",0===o.find(".col-sm-6").length&&(n+=" col-sm-offset-6")):"full"===e&&(n+="col-sm-12",t.table||(n+=" text-center")),i("<div/>",{id:t.id||null,class:n+" "+(t.className||"")}).append(t.contents).appendTo(o)})},n}); |
@@ -8,3 +8,3 @@ { | ||
"types": "./types/dataTables.bootstrap.d.ts", | ||
"version": "1.13.10", | ||
"version": "2.0.0", | ||
"files": [ | ||
@@ -14,4 +14,3 @@ "css/**/*.css", | ||
"js/**/*.mjs", | ||
"types/**/*.d.ts", | ||
"images/*" | ||
"types/**/*.d.ts" | ||
], | ||
@@ -27,3 +26,3 @@ "keywords": [ | ||
"dependencies": { | ||
"datatables.net": "1.13.10", | ||
"datatables.net": "2.0.0", | ||
"jquery": ">=1.7" | ||
@@ -30,0 +29,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
41871
10
737
+ Addeddatatables.net@2.0.0(transitive)
- Removeddatatables.net@1.13.10(transitive)
Updateddatatables.net@2.0.0