1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | ($ => {
|
8 | $.extend($.fn.bootstrapTable.defaults, {
|
9 | classes: 'table is-bordered is-hoverable',
|
10 | buttonsPrefix: '',
|
11 | buttonsClass: 'button'
|
12 | })
|
13 |
|
14 | $.BootstrapTable = class extends $.BootstrapTable {
|
15 | initConstants () {
|
16 | super.initConstants()
|
17 |
|
18 | this.constants.theme = 'bulma'
|
19 |
|
20 | this.constants.classes.buttonsGroup = 'buttons has-addons'
|
21 | this.constants.classes.buttonsDropdown = 'button dropdown is-right'
|
22 | this.constants.classes.input = 'input'
|
23 | this.constants.classes.paginationDropdown = 'ui dropdown'
|
24 | this.constants.classes.dropup = 'is-up'
|
25 | this.constants.classes.dropdownActive = 'is-active'
|
26 | this.constants.classes.paginationActive = 'is-current'
|
27 |
|
28 | this.constants.html.toobarDropdow = ['<div class="dropdown-menu"><div class="dropdown-content">', '</div></div>']
|
29 | this.constants.html.toobarDropdowItem = '<label class="dropdown-item">%s</label>'
|
30 | this.constants.html.pageDropdown = ['<div class="dropdown-menu"><div class="dropdown-content">', '</div></div>']
|
31 | this.constants.html.pageDropdownItem = '<a class="dropdown-item %s" href="#">%s</a>'
|
32 | this.constants.html.dropdownCaret = '<span class="icon is-small"><i class="fas fa-angle-down" aria-hidden="true"></i></span>'
|
33 | this.constants.html.pagination = ['<ul class="pagination%s">', '</ul>'],
|
34 | this.constants.html.paginationItem = '<li><a class="page-item pagination-link%s" href="#">%s</a></li>'
|
35 | }
|
36 |
|
37 | initToolbar () {
|
38 | super.initToolbar()
|
39 | if (this.options.showColumns) {
|
40 | this._initDropdown()
|
41 | }
|
42 | }
|
43 |
|
44 | initPagination () {
|
45 | super.initPagination()
|
46 | if (this.options.pagination && !this.options.onlyInfoPagination) {
|
47 | this._initDropdown()
|
48 | }
|
49 | }
|
50 |
|
51 | _initDropdown ($el) {
|
52 | const $dropdowns = this.$container.find('.dropdown:not(.is-hoverable)')
|
53 |
|
54 | $dropdowns.off('click').on('click', e => {
|
55 | e.stopPropagation()
|
56 | $(e.currentTarget).toggleClass('is-active')
|
57 | })
|
58 |
|
59 | $(document).off('click.bs.dropdown.bulma').on('click.bs.dropdown.bulma', () => {
|
60 | $dropdowns.removeClass('is-active')
|
61 | })
|
62 | }
|
63 | }
|
64 | })(jQuery)
|