UNPKG

datatables.net-buttons-zf

Version:

Buttons for DataTables with styling for [Foundation](https://get.foundation/)

116 lines (102 loc) 2.31 kB
/*! Buttons Foundation styling 4.0.1 for DataTables * Copyright (c) SpryMedia Ltd - datatables.net/license */ (function(factory){ if (typeof define === 'function' && define.amd) { // AMD define(['datatables.net-zf', 'datatables.net-buttons'], function (dt) { return factory(window, document, dt); }); } else if (typeof exports === 'object') { // CommonJS var cjsRequires = function (root) { if (! root.DataTable) { require('datatables.net-zf')(root); } if (! window.DataTable.Buttons) { require('datatables.net-buttons')(root); } }; if (typeof window === 'undefined') { module.exports = function (root) { if (! root) { // CommonJS environments without a window global must pass a // root. This will give an error otherwise root = window; } cjsRequires(root); return factory(root, root.document, root.DataTable); }; } else { cjsRequires(window); module.exports = factory(window, window.document, window.DataTable); } } else { // Browser factory(window, document, window.DataTable); } }(function(window, document, DataTable) { 'use strict'; var Dom = DataTable.Dom; var util = DataTable.util; util.object.assignDeep(DataTable.Buttons.defaults, { dom: { container: { tag: 'div', className: 'dt-buttons button-group' }, button: { tag: 'a', className: 'dt-button button small', active: 'secondary active' }, collection: { button: { tag: 'li', className: 'dt-button', active: 'dt-button-active-a', liner: { tag: 'a' } }, container: { tag: 'div', className: 'dt-button-collection', content: { tag: 'ul', className: 'dropdown menu is-dropdown-submenu' } } }, split: { action: { tag: 'button', className: 'button small' }, dropdown: { tag: 'button', className: 'button arrow-only' }, wrapper: { tag: 'div', className: 'button-group dt-button-split' } } } }); Dom.s(document).on('buttons-popover.dt', function () { var notButton = false; Dom.s('.dtsp-panesContainer').each(function (el) { if (!Dom.s(el).is('button')) { notButton = true; } }); if (notButton) { Dom.s('.dtsp-panesContainer').classRemove('button-group stacked'); } }); return DataTable; }));