datatables.net-responsive-bs5
Advanced tools
Comparing version
@@ -25,3 +25,3 @@ /*! Bootstrap 5 integration for DataTables' Responsive | ||
if (typeof window !== 'undefined') { | ||
if (typeof window === 'undefined') { | ||
module.exports = function (root, $) { | ||
@@ -60,12 +60,12 @@ if ( ! root ) { | ||
var _modal = $( | ||
'<div class="modal fade dtr-bs-modal" role="dialog">'+ | ||
'<div class="modal-dialog" role="document">'+ | ||
'<div class="modal-content">'+ | ||
'<div class="modal-header">'+ | ||
'<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>'+ | ||
'</div>'+ | ||
'<div class="modal-body"/>'+ | ||
'</div>'+ | ||
'</div>'+ | ||
'</div>' | ||
'<div class="modal fade dtr-bs-modal" role="dialog">' + | ||
'<div class="modal-dialog" role="document">' + | ||
'<div class="modal-content">' + | ||
'<div class="modal-header">' + | ||
'<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>' + | ||
'</div>' + | ||
'<div class="modal-body"/>' + | ||
'</div>' + | ||
'</div>' + | ||
'</div>' | ||
); | ||
@@ -81,31 +81,31 @@ var modal; | ||
_bs = bs; | ||
} | ||
}; | ||
_display.modal = function ( options ) { | ||
if (! modal) { | ||
_display.modal = function (options) { | ||
if (!modal) { | ||
modal = new _bs.Modal(_modal[0]); | ||
} | ||
return function ( row, update, render ) { | ||
if ( ! $.fn.modal ) { | ||
_original( row, update, render ); | ||
return function (row, update, render, closeCallback) { | ||
if (!$.fn.modal) { | ||
return _original(row, update, render, closeCallback); | ||
} | ||
else { | ||
if ( ! update ) { | ||
if ( options && options.header ) { | ||
if (!update) { | ||
if (options && options.header) { | ||
var header = _modal.find('div.modal-header'); | ||
var button = header.find('button').detach(); | ||
header | ||
.empty() | ||
.append( '<h4 class="modal-title">'+options.header( row )+'</h4>' ) | ||
.append( button ); | ||
.append('<h4 class="modal-title">' + options.header(row) + '</h4>') | ||
.append(button); | ||
} | ||
_modal.find( 'div.modal-body' ) | ||
.empty() | ||
.append( render() ); | ||
_modal.find('div.modal-body').empty().append(render()); | ||
_modal | ||
.appendTo( 'body' ) | ||
.data('dtr-row-idx', row.index()) | ||
.one('hidden.bs.modal', closeCallback) | ||
.appendTo('body') | ||
.modal(); | ||
@@ -115,2 +115,13 @@ | ||
} | ||
else { | ||
if ($.contains(document, _modal[0]) && row.index() === _modal.data('dtr-row-idx')) { | ||
_modal.find('div.modal-body').empty().append(render()); | ||
} | ||
else { | ||
// Modal not shown for this row - do nothing | ||
return null; | ||
} | ||
} | ||
return true; | ||
} | ||
@@ -117,0 +128,0 @@ }; |
/*! Bootstrap 5 integration for DataTables' Responsive | ||
* © SpryMedia Ltd - datatables.net/license | ||
*/ | ||
!function(o){var a,n;"function"==typeof define&&define.amd?define(["jquery","datatables.net-bs5","datatables.net-responsive"],function(e){return o(e,window,document)}):"object"==typeof exports?(a=require("jquery"),n=function(e,d){d.fn.dataTable||require("datatables.net-bs5")(e,d),d.fn.dataTable.Responsive||require("datatables.net-responsive")(e,d)},"undefined"!=typeof window?module.exports=function(e,d){return e=e||window,d=d||a(e),n(e,d),o(d,e,e.document)}:(n(window,a),module.exports=o(a,window,window.document))):o(jQuery,window,document)}(function(i,e,d,o){"use strict";var s,a=i.fn.dataTable,n=a.Responsive.display,l=n.modal,r=i('<div class="modal fade dtr-bs-modal" role="dialog"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"/></div></div></div>'),u=e.bootstrap;return a.Responsive.bootstrap=function(e){u=e},n.modal=function(t){return s=s||new u.Modal(r[0]),function(e,d,o){var a,n;i.fn.modal?d||(t&&t.header&&(n=(a=r.find("div.modal-header")).find("button").detach(),a.empty().append('<h4 class="modal-title">'+t.header(e)+"</h4>").append(n)),r.find("div.modal-body").empty().append(o()),r.appendTo("body").modal(),s.show()):l(e,d,o)}},a}); | ||
!function(n){var o,a;"function"==typeof define&&define.amd?define(["jquery","datatables.net-bs5","datatables.net-responsive"],function(e){return n(e,window,document)}):"object"==typeof exports?(o=require("jquery"),a=function(e,d){d.fn.dataTable||require("datatables.net-bs5")(e,d),d.fn.dataTable.Responsive||require("datatables.net-responsive")(e,d)},"undefined"==typeof window?module.exports=function(e,d){return e=e||window,d=d||o(e),a(e,d),n(d,e,e.document)}:(a(window,o),module.exports=n(o,window,window.document))):n(jQuery,window,document)}(function(s,e,l,d){"use strict";var r,n=s.fn.dataTable,o=n.Responsive.display,u=o.modal,f=s('<div class="modal fade dtr-bs-modal" role="dialog"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"/></div></div></div>'),a=e.bootstrap;return n.Responsive.bootstrap=function(e){a=e},o.modal=function(i){return r=r||new a.Modal(f[0]),function(e,d,n,o){if(s.fn.modal){if(d){if(!s.contains(l,f[0])||e.index()!==f.data("dtr-row-idx"))return null;f.find("div.modal-body").empty().append(n())}else{var a,t;i&&i.header&&(t=(a=f.find("div.modal-header")).find("button").detach(),a.empty().append('<h4 class="modal-title">'+i.header(e)+"</h4>").append(t)),f.find("div.modal-body").empty().append(n()),f.data("dtr-row-idx",e.index()).one("hidden.bs.modal",o).appendTo("body").modal(),r.show()}return!0}return u(e,d,n,o)}},n}); |
@@ -7,4 +7,4 @@ { | ||
"style": "css/responsive.bootstrap5.css", | ||
"types": "./types/types.d.ts", | ||
"version": "2.4.1", | ||
"types": "./types/responsive.bootstrap5.d.ts", | ||
"version": "2.5.0", | ||
"files": [ | ||
@@ -27,4 +27,4 @@ "css/**/*.css", | ||
"dependencies": { | ||
"datatables.net-responsive": ">=2.3.0", | ||
"datatables.net-bs5": ">=1.12.1", | ||
"datatables.net-responsive": ">=2.4.1", | ||
"datatables.net-bs5": ">=1.13.4", | ||
"jquery": ">=1.7" | ||
@@ -31,0 +31,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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
-50%22202
-20.11%10
-9.09%370
-34.4%