UNPKG

2.35 kBJavaScriptView Raw
1/**
2 * @author zhixin wen <wenzhixin2010@gmail.com>
3 * https://github.com/wenzhixin/bootstrap-table/
4 * theme: https://github.com/jgthms/bulma/
5 */
6
7($ => {
8 $.extend($.fn.bootstrapTable.defaults, {
9 classes: 'table highlight',
10 buttonsPrefix: '',
11 buttonsClass: 'waves-effect waves-light btn',
12 iconsPrefix: 'material-icons',
13 icons: {
14 paginationSwitchDown: 'grid_on',
15 paginationSwitchUp: 'grid_off',
16 refresh: 'refresh',
17 toggleOff: 'tablet',
18 toggleOn: 'tablet_android',
19 columns: 'view_list',
20 detailOpen: 'add',
21 detailClose: 'remove',
22 fullscreen: 'fullscreen'
23 }
24 })
25
26 $.BootstrapTable = class extends $.BootstrapTable {
27 initConstants () {
28 super.initConstants()
29
30 this.constants.theme = 'materialize'
31
32 this.constants.classes.buttonsGroup = ''
33 this.constants.classes.buttonsDropdown = ''
34 this.constants.classes.input = 'input-field'
35 this.constants.classes.input = ''
36 this.constants.classes.paginationDropdown = ''
37
38 this.constants.html.toobarDropdow = ['<ul id="toolbar-dropdown" class="dropdown-content">', '</ul>']
39 this.constants.html.toobarDropdowItem = '<li><label>%s</label></li>'
40 this.constants.html.pageDropdown = ['<ul id="page-list-dropdown" class="dropdown-content">', '</ul>']
41 this.constants.html.pageDropdownItem = '<li><a class="%s" href="#">%s</a></li>'
42 this.constants.html.dropdownCaret = '<i class="material-icons">arrow_drop_down</i>'
43 this.constants.html.pagination = ['<ul class="pagination%s">', '</ul>'],
44 this.constants.html.paginationItem = '<li class="waves-effect page-item%s"><a href="#">%s</a></li>'
45 this.constants.html.icon = '<i class="%s">%s</i>'
46 }
47
48 initToolbar () {
49 super.initToolbar()
50
51 if (this.options.showColumns) {
52 this.$toolbar.find('.dropdown-toggle')
53 .attr('data-target', 'toolbar-dropdown')
54 .dropdown({
55 alignment: 'right',
56 constrainWidth: false,
57 closeOnClick: false
58 })
59 }
60 }
61
62 initPagination () {
63 super.initPagination()
64
65 if (this.pagination && !this.options.onlyInfoPagination) {
66 this.$pagination.find('.dropdown-toggle')
67 .attr('data-target', 'page-list-dropdown')
68 .dropdown()
69 }
70 }
71 }
72})(jQuery)