1 | (function (global, factory) {
|
2 | if (typeof define === "function" && define.amd) {
|
3 | define([], factory);
|
4 | } else if (typeof exports !== "undefined") {
|
5 | factory();
|
6 | } else {
|
7 | var mod = {
|
8 | exports: {}
|
9 | };
|
10 | factory();
|
11 | global.bootstrapTableBulma = mod.exports;
|
12 | }
|
13 | })(this, function () {
|
14 | 'use strict';
|
15 |
|
16 | function _classCallCheck(instance, Constructor) {
|
17 | if (!(instance instanceof Constructor)) {
|
18 | throw new TypeError("Cannot call a class as a function");
|
19 | }
|
20 | }
|
21 |
|
22 | var _createClass = function () {
|
23 | function defineProperties(target, props) {
|
24 | for (var i = 0; i < props.length; i++) {
|
25 | var descriptor = props[i];
|
26 | descriptor.enumerable = descriptor.enumerable || false;
|
27 | descriptor.configurable = true;
|
28 | if ("value" in descriptor) descriptor.writable = true;
|
29 | Object.defineProperty(target, descriptor.key, descriptor);
|
30 | }
|
31 | }
|
32 |
|
33 | return function (Constructor, protoProps, staticProps) {
|
34 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
35 | if (staticProps) defineProperties(Constructor, staticProps);
|
36 | return Constructor;
|
37 | };
|
38 | }();
|
39 |
|
40 | function _possibleConstructorReturn(self, call) {
|
41 | if (!self) {
|
42 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
43 | }
|
44 |
|
45 | return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
46 | }
|
47 |
|
48 | var _get = function get(object, property, receiver) {
|
49 | if (object === null) object = Function.prototype;
|
50 | var desc = Object.getOwnPropertyDescriptor(object, property);
|
51 |
|
52 | if (desc === undefined) {
|
53 | var parent = Object.getPrototypeOf(object);
|
54 |
|
55 | if (parent === null) {
|
56 | return undefined;
|
57 | } else {
|
58 | return get(parent, property, receiver);
|
59 | }
|
60 | } else if ("value" in desc) {
|
61 | return desc.value;
|
62 | } else {
|
63 | var getter = desc.get;
|
64 |
|
65 | if (getter === undefined) {
|
66 | return undefined;
|
67 | }
|
68 |
|
69 | return getter.call(receiver);
|
70 | }
|
71 | };
|
72 |
|
73 | function _inherits(subClass, superClass) {
|
74 | if (typeof superClass !== "function" && superClass !== null) {
|
75 | throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
76 | }
|
77 |
|
78 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
79 | constructor: {
|
80 | value: subClass,
|
81 | enumerable: false,
|
82 | writable: true,
|
83 | configurable: true
|
84 | }
|
85 | });
|
86 | if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
87 | }
|
88 |
|
89 | |
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | (function ($) {
|
96 | $.extend($.fn.bootstrapTable.defaults, {
|
97 | classes: 'table is-bordered is-hoverable',
|
98 | buttonsPrefix: '',
|
99 | buttonsClass: 'button'
|
100 | });
|
101 |
|
102 | $.BootstrapTable = function (_$$BootstrapTable) {
|
103 | _inherits(_class, _$$BootstrapTable);
|
104 |
|
105 | function _class() {
|
106 | _classCallCheck(this, _class);
|
107 |
|
108 | return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
|
109 | }
|
110 |
|
111 | _createClass(_class, [{
|
112 | key: 'initConstants',
|
113 | value: function initConstants() {
|
114 | _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initConstants', this).call(this);
|
115 |
|
116 | this.constants.theme = 'bulma';
|
117 |
|
118 | this.constants.classes.buttonsGroup = 'buttons has-addons';
|
119 | this.constants.classes.buttonsDropdown = 'button dropdown is-right';
|
120 | this.constants.classes.input = 'input';
|
121 | this.constants.classes.paginationDropdown = 'ui dropdown';
|
122 | this.constants.classes.dropup = 'is-up';
|
123 | this.constants.classes.dropdownActive = 'is-active';
|
124 | this.constants.classes.paginationActive = 'is-current';
|
125 |
|
126 | this.constants.html.toobarDropdow = ['<div class="dropdown-menu"><div class="dropdown-content">', '</div></div>'];
|
127 | this.constants.html.toobarDropdowItem = '<label class="dropdown-item">%s</label>';
|
128 | this.constants.html.pageDropdown = ['<div class="dropdown-menu"><div class="dropdown-content">', '</div></div>'];
|
129 | this.constants.html.pageDropdownItem = '<a class="dropdown-item %s" href="#">%s</a>';
|
130 | this.constants.html.dropdownCaret = '<span class="icon is-small"><i class="fas fa-angle-down" aria-hidden="true"></i></span>';
|
131 | this.constants.html.pagination = ['<ul class="pagination%s">', '</ul>'], this.constants.html.paginationItem = '<li><a class="page-item pagination-link%s" href="#">%s</a></li>';
|
132 | }
|
133 | }, {
|
134 | key: 'initToolbar',
|
135 | value: function initToolbar() {
|
136 | _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initToolbar', this).call(this);
|
137 | if (this.options.showColumns) {
|
138 | this._initDropdown();
|
139 | }
|
140 | }
|
141 | }, {
|
142 | key: 'initPagination',
|
143 | value: function initPagination() {
|
144 | _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initPagination', this).call(this);
|
145 | if (this.options.pagination && !this.options.onlyInfoPagination) {
|
146 | this._initDropdown();
|
147 | }
|
148 | }
|
149 | }, {
|
150 | key: '_initDropdown',
|
151 | value: function _initDropdown($el) {
|
152 | var $dropdowns = this.$container.find('.dropdown:not(.is-hoverable)');
|
153 |
|
154 | $dropdowns.off('click').on('click', function (e) {
|
155 | e.stopPropagation();
|
156 | $(e.currentTarget).toggleClass('is-active');
|
157 | });
|
158 |
|
159 | $(document).off('click.bs.dropdown.bulma').on('click.bs.dropdown.bulma', function () {
|
160 | $dropdowns.removeClass('is-active');
|
161 | });
|
162 | }
|
163 | }]);
|
164 |
|
165 | return _class;
|
166 | }($.BootstrapTable);
|
167 | })(jQuery);
|
168 | }); |
\ | No newline at end of file |