/** * @author zhixin wen * https://github.com/wenzhixin/bootstrap-table/ * theme: https://github.com/jgthms/bulma/ */ $.extend($.fn.bootstrapTable.defaults, { classes: 'table is-bordered is-hoverable', buttonsPrefix: '', buttonsClass: 'button' }) $.fn.bootstrapTable.theme = 'bulma' $.BootstrapTable = class extends $.BootstrapTable { initConstants () { super.initConstants() this.constants.classes.buttonsGroup = 'buttons has-addons' this.constants.classes.buttonsDropdown = 'button dropdown is-right' this.constants.classes.input = 'input' this.constants.classes.paginationDropdown = 'ui dropdown' this.constants.classes.dropup = 'is-up' this.constants.classes.dropdownActive = 'is-active' this.constants.classes.paginationActive = 'is-current' this.constants.classes.buttonActive = 'is-active' this.constants.html.toolbarDropdown = [''] this.constants.html.toolbarDropdownItem = '' this.constants.html.toolbarDropdownSeparator = '' this.constants.html.pageDropdown = [''] this.constants.html.pageDropdownItem = '%s' this.constants.html.dropdownCaret = '' this.constants.html.pagination = [''] this.constants.html.paginationItem = '
  • %s
  • ' this.constants.html.searchInput = '

    ' this.constants.html.inputGroup = '
    %s%s
    ' this.constants.html.searchButton = '

    ' this.constants.html.searchClearButton = '

    ' } initToolbar () { super.initToolbar() this.handleToolbar() } handleToolbar () { if (this.$toolbar.find('.dropdown').length) { this._initDropdown() } } initPagination () { super.initPagination() if (this.options.pagination && this.paginationParts.includes('pageSize')) { this._initDropdown() } } _initDropdown () { const $dropdowns = this.$container.find('.dropdown:not(.is-hoverable)') $dropdowns.off('click').on('click', e => { const $this = $(e.currentTarget) e.stopPropagation() $dropdowns.not($this).removeClass('is-active') $this.toggleClass('is-active') }) $(document).off('click.bs.dropdown.bulma').on('click.bs.dropdown.bulma', () => { $dropdowns.removeClass('is-active') }) } }