1/*! Bootstrap integration for DataTables' Buttons 2 * © SpryMedia Ltd - datatables.net/license 3 */ 4 5(function( factory ){ 6 if ( typeof define === 'function' && define.amd ) { 7 // AMD 8 define( ['jquery', 'datatables.net-bs4', 'datatables.net-buttons'], function ( $ ) { 9 return factory( $, window, document ); 10 } ); 11 } 12 else if ( typeof exports === 'object' ) { 13 // CommonJS 14 var jq = require('jquery'); 15 var cjsRequires = function (root, $) { 16 if ( ! $.fn.dataTable ) { 17 require('datatables.net-bs4')(root, $); 18 } 19 20 if ( ! $.fn.dataTable.Buttons ) { 21 require('datatables.net-buttons')(root, $); 22 } 23 }; 24 25 if (typeof window === 'undefined') { 26 module.exports = function (root, $) { 27 if ( ! root ) { 28 // CommonJS environments without a window global must pass a 29 // root. This will give an error otherwise 30 root = window; 31 } 32 33 if ( ! $ ) { 34 $ = jq( root ); 35 } 36 37 cjsRequires( root, $ ); 38 return factory( $, root, root.document ); 39 }; 40 } 41 else { 42 cjsRequires( window, jq ); 43 module.exports = factory( jq, window, window.document ); 44 } 45 } 46 else { 47 // Browser 48 factory( jQuery, window, document ); 49 } 50}(function( $, window, document, undefined ) { 51'use strict'; 52var DataTable = $.fn.dataTable; 53 54 55 56$.extend(true, DataTable.Buttons.defaults, { 57 dom: { 58 container: { 59 className: 'dt-buttons btn-group flex-wrap' 60 }, 61 button: { 62 className: 'btn btn-secondary', 63 active: 'active' 64 }, 65 collection: { 66 action: { 67 dropHtml: '' 68 }, 69 container: { 70 tag: 'div', 71 className: 'dropdown-menu dt-button-collection' 72 }, 73 closeButton: false, 74 button: { 75 tag: 'a', 76 className: 'dt-button dropdown-item', 77 active: 'dt-button-active', 78 disabled: 'disabled', 79 spacer: { 80 className: 'dropdown-divider', 81 tag: 'hr' 82 } 83 } 84 }, 85 split: { 86 action: { 87 tag: 'a', 88 className: 'btn btn-secondary dt-button-split-drop-button', 89 closeButton: false 90 }, 91 dropdown: { 92 tag: 'button', 93 dropHtml: '', 94 className: 95 'btn btn-secondary dt-button-split-drop dropdown-toggle dropdown-toggle-split', 96 closeButton: false, 97 align: 'split-left', 98 splitAlignClass: 'dt-button-split-left' 99 }, 100 wrapper: { 101 tag: 'div', 102 className: 'dt-button-split btn-group', 103 closeButton: false 104 } 105 } 106 }, 107 buttonCreated: function (config, button) { 108 return config.buttons ? $('<div class="btn-group"/>').append(button) : button; 109 } 110}); 111 112DataTable.ext.buttons.collection.className += ' dropdown-toggle'; 113DataTable.ext.buttons.collection.rightAlignClassName = 'dropdown-menu-right'; 114 115 116return DataTable; 117})); 118