1/*! Bulma 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-bm', '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-bm')(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 field is-grouped' 60 }, 61 button: { 62 className: 'button is-light', 63 active: 'is-active', 64 disabled: 'is-disabled' 65 }, 66 collection: { 67 action: { 68 tag: 'div', 69 className: 'dropdown-content', 70 dropHtml: '' 71 }, 72 button: { 73 tag: 'a', 74 className: 'dt-button dropdown-item', 75 active: 'dt-button-active', 76 disabled: 'is-disabled', 77 spacer: { 78 className: 'dropdown-divider', 79 tag: 'hr' 80 } 81 }, 82 closeButton: false, 83 container: { 84 className: 'dt-button-collection dropdown-menu', 85 content: { 86 className: 'dropdown-content' 87 } 88 } 89 }, 90 split: { 91 action: { 92 tag: 'button', 93 className: 'dt-button-split-drop-button button is-light', 94 closeButton: false 95 }, 96 dropdown: { 97 tag: 'button', 98 dropHtml: '<i class="fa fa-angle-down" aria-hidden="true"></i>', 99 className: 'button is-light', 100 closeButton: false, 101 align: 'split-left', 102 splitAlignClass: 'dt-button-split-left' 103 }, 104 wrapper: { 105 tag: 'div', 106 className: 'dt-button-split dropdown-trigger buttons has-addons', 107 closeButton: false 108 } 109 } 110 }, 111 buttonCreated: function (config, button) { 112 // For collections 113 if (config.buttons) { 114 // Wrap the dropdown content in a menu element 115 config._collection = $('<div class="dropdown-menu"/>').append(config._collection); 116 117 // And add the collection dropdown icon 118 $(button).append( 119 '<span class="icon is-small">' + 120 '<i class="fa fa-angle-down" aria-hidden="true"></i>' + 121 '</span>' 122 ); 123 } 124 125 return button; 126 } 127}); 128 129 130return DataTable; 131})); 132