-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
23a882cf9560b54b7b15d32f8b5934f23739dc38 Updated: Make use of `DataTa…
…ble.use()` to get the bootstrap library (requires DT 2.1.9 and only relevent for Bootstrap 5 in ESM). Sync to source repo @23a882cf9560b54b7b15d32f8b5934f23739dc38
- Loading branch information
dtbuild
committed
Oct 24, 2024
1 parent
08965d7
commit aa9fd6a
Showing
5 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/*! Bootstrap 5 integration for DataTables' Responsive | ||
* © SpryMedia Ltd - datatables.net/license | ||
*/ | ||
import jQuery from"jquery";import DataTable from"datatables.net-bs5";import Responsive from"datatables.net-responsive";let $=jQuery;var modal,_display=DataTable.Responsive.display,_original=_display.modal,_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>'),_bs=window.bootstrap;DataTable.Responsive.bootstrap=function(a){_bs=a},_display.modal=function(n){return!modal&&_bs.Modal&&(modal=new _bs.Modal(_modal[0])),function(a,d,o,e){if(modal){var l,t,i=o();if(!1===i)return!1;if(d){if(!$.contains(document,_modal[0])||a.index()!==_modal.data("dtr-row-idx"))return null;_modal.find("div.modal-body").empty().append(i)}else n&&n.header&&(t=(l=_modal.find("div.modal-header")).find("button").detach(),l.empty().append('<h4 class="modal-title">'+n.header(a)+"</h4>").append(t)),_modal.find("div.modal-body").empty().append(i),_modal.data("dtr-row-idx",a.index()).one("hidden.bs.modal",e).appendTo("body"),modal.show();return!0}return _original(a,d,o,e)}};export default DataTable; | ||
import jQuery from"jquery";import DataTable from"datatables.net-bs5";import Responsive from"datatables.net-responsive";let $=jQuery;var modal,_display=DataTable.Responsive.display,_original=_display.modal,_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>'),_bs=window.bootstrap;function getBs(){var a=DataTable.use("bootstrap");if(a)return a;if(_bs)return _bs;throw new Error("No Bootstrap library. Set it with `DataTable.use(bootstrap);`")}DataTable.Responsive.bootstrap=function(a){_bs=a},_display.modal=function(r){var a;return!modal&&_bs.Modal&&(a=getBs(),modal=new a.Modal(_modal[0])),function(a,d,o,e){if(modal){var t,l,i=o();if(!1===i)return!1;if(d){if(!$.contains(document,_modal[0])||a.index()!==_modal.data("dtr-row-idx"))return null;_modal.find("div.modal-body").empty().append(i)}else r&&r.header&&(l=(t=_modal.find("div.modal-header")).find("button").detach(),t.empty().append('<h4 class="modal-title">'+r.header(a)+"</h4>").append(l)),_modal.find("div.modal-body").empty().append(i),_modal.data("dtr-row-idx",a.index()).one("hidden.bs.modal",e).appendTo("body"),modal.show();return!0}return _original(a,d,o,e)}};export default DataTable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters