bootstrap-table-rails 1.12.2 → 1.13.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -12
  3. data/lib/bootstrap-table-rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-locale-all.js +2534 -1841
  5. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.css +202 -283
  6. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.js +3114 -2555
  7. data/vendor/assets/javascripts/bootstrap-table/extensions/accent-neutralise/bootstrap-table-accent-neutralise.js +247 -152
  8. data/vendor/assets/javascripts/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js +271 -0
  9. data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js +77 -68
  10. data/vendor/assets/javascripts/bootstrap-table/extensions/cookie/bootstrap-table-cookie.js +452 -315
  11. data/vendor/assets/javascripts/bootstrap-table/extensions/copy-rows/bootstrap-table-copy-rows.js +105 -86
  12. data/vendor/assets/javascripts/bootstrap-table/extensions/defer-url/bootstrap-table-defer-url.js +44 -27
  13. data/vendor/assets/javascripts/bootstrap-table/extensions/editable/bootstrap-table-editable.js +229 -115
  14. data/vendor/assets/javascripts/bootstrap-table/extensions/export/bootstrap-table-export.js +319 -162
  15. data/vendor/assets/javascripts/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.js +733 -566
  16. data/vendor/assets/javascripts/bootstrap-table/extensions/group-by-v2/bootstrap-table-group-by.js +175 -167
  17. data/vendor/assets/javascripts/bootstrap-table/extensions/group-by/bootstrap-table-group-by.js +227 -213
  18. data/vendor/assets/javascripts/bootstrap-table/extensions/i18n-enhance/bootstrap-table-i18n-enhance.js +44 -29
  19. data/vendor/assets/javascripts/bootstrap-table/extensions/key-events/bootstrap-table-key-events.js +92 -70
  20. data/vendor/assets/javascripts/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js +134 -118
  21. data/vendor/assets/javascripts/bootstrap-table/extensions/multi-column-toggle/bootstrap-table-multi-toggle.js +92 -75
  22. data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-search/bootstrap-table-multiple-search.js +72 -58
  23. data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-selection-row/bootstrap-table-multiple-selection-row.js +129 -113
  24. data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-sort/bootstrap-table-multiple-sort.js +362 -349
  25. data/vendor/assets/javascripts/bootstrap-table/extensions/natural-sorting/bootstrap-table-natural-sorting.js +66 -50
  26. data/vendor/assets/javascripts/bootstrap-table/extensions/{page-jumpto/bootstrap-table-jumpto.css → page-jump-to/bootstrap-table-page-jump-to.css} +0 -0
  27. data/vendor/assets/javascripts/bootstrap-table/extensions/page-jump-to/bootstrap-table-page-jump-to.js +58 -0
  28. data/vendor/assets/javascripts/bootstrap-table/extensions/pipeline/bootstrap-table-pipeline.js +341 -0
  29. data/vendor/assets/javascripts/bootstrap-table/extensions/print/bootstrap-table-print.js +122 -126
  30. data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-columns/bootstrap-table-reorder-columns.js +183 -167
  31. data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js +124 -110
  32. data/vendor/assets/javascripts/bootstrap-table/extensions/resizable/bootstrap-table-resizable.js +66 -55
  33. data/vendor/assets/javascripts/bootstrap-table/extensions/select2-filter/bootstrap-table-select2-filter.js +281 -272
  34. data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.css +13 -13
  35. data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.js +182 -106
  36. data/vendor/assets/javascripts/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.js +324 -162
  37. data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.js +127 -115
  38. data/vendor/assets/javascripts/bootstrap-table/extensions/treegrid/bootstrap-table-treegrid.js +106 -96
  39. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-af-ZA.js +48 -35
  40. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ar-SA.js +49 -35
  41. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ca-ES.js +52 -39
  42. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-cs-CZ.js +52 -39
  43. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-da-DK.js +60 -32
  44. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-de-DE.js +61 -48
  45. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-el-GR.js +36 -23
  46. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-en-US.js +57 -44
  47. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-AR.js +39 -26
  48. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CL.js +54 -41
  49. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CR.js +48 -35
  50. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-ES.js +103 -38
  51. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-MX.js +59 -46
  52. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-NI.js +48 -35
  53. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-SP.js +49 -36
  54. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-et-EE.js +51 -38
  55. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-eu-EU.js +51 -38
  56. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fa-IR.js +51 -38
  57. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fi-FI.js +62 -0
  58. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-BE.js +36 -23
  59. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-FR.js +103 -90
  60. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-he-IL.js +51 -38
  61. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hr-HR.js +52 -39
  62. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hu-HU.js +51 -38
  63. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-id-ID.js +57 -44
  64. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-it-IT.js +59 -47
  65. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ja-JP.js +51 -38
  66. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ka-GE.js +49 -36
  67. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ko-KR.js +45 -32
  68. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ms-MY.js +51 -38
  69. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nb-NO.js +45 -32
  70. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-NL.js +60 -47
  71. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pl-PL.js +45 -32
  72. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-BR.js +49 -36
  73. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-PT.js +51 -38
  74. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ro-RO.js +51 -38
  75. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ru-RU.js +82 -68
  76. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sk-SK.js +57 -44
  77. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sv-SE.js +45 -32
  78. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-th-TH.js +45 -32
  79. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-tr-TR.js +49 -36
  80. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uk-UA.js +82 -69
  81. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ur-PK.js +45 -32
  82. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uz-Latn-UZ.js +57 -44
  83. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-vi-VN.js +36 -23
  84. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-CN.js +54 -41
  85. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-TW.js +48 -35
  86. metadata +6 -8
  87. data/vendor/assets/javascripts/bootstrap-table/extensions/angular/bootstrap-table-angular.js +0 -107
  88. data/vendor/assets/javascripts/bootstrap-table/extensions/click-edit-row/bootstrap-table-click-edit-row.css +0 -21
  89. data/vendor/assets/javascripts/bootstrap-table/extensions/click-edit-row/bootstrap-table-click-edit-row.js +0 -142
  90. data/vendor/assets/javascripts/bootstrap-table/extensions/filter/bootstrap-table-filter.js +0 -67
  91. data/vendor/assets/javascripts/bootstrap-table/extensions/flat-json/bootstrap-table-flat-json.js +0 -62
  92. data/vendor/assets/javascripts/bootstrap-table/extensions/page-jumpto/bootstrap-table-jumpto.js +0 -50
@@ -1,22 +1,22 @@
1
1
  /**
2
2
  * @author vincent loh <vincent.ml@gmail.com>
3
- * @version: v1.0.0
4
- * https://github.com/vinzloh/bootstrap-table/
5
- * Sticky header for bootstrap-table
3
+ * @update zhixin wen <wenzhixin2010@gmail.com>
6
4
  */
7
5
 
8
6
  .fix-sticky {
9
- position: fixed;
10
- z-index: 100;
7
+ position: fixed !important;
8
+ overflow: hidden;
9
+ z-index: 100;
11
10
  }
12
- .fix-sticky thead {
13
- background: #fff;
11
+
12
+ .fix-sticky table thead {
13
+ background: #fff;
14
+ }
15
+
16
+ .fix-sticky table thead.thead-light {
17
+ background: #e9ecef;
14
18
  }
15
19
 
16
- .fix-sticky thead th,
17
- .fix-sticky thead th:first-child {
18
- border-left: 0;
19
- border-right: 0;
20
- border-bottom: 1px solid #eee;
21
- border-radius: 0;
20
+ .fix-sticky table thead.thead-light {
21
+ background: #212529;
22
22
  }
@@ -1,118 +1,194 @@
1
- /**
2
- * @author vincent loh <vincent.ml@gmail.com>
3
- * @version: v1.1.0
4
- * https://github.com/vinzloh/bootstrap-table/
5
- * Sticky header for bootstrap-table
6
- * @update J Manuel Corona <jmcg92@gmail.com>
7
- */
8
-
9
- (function ($) {
10
- 'use strict';
11
-
12
- var sprintf = $.fn.bootstrapTable.utils.sprintf;
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.bootstrapTableStickyHeader = 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
+ * @author vincent loh <vincent.ml@gmail.com>
91
+ * @update J Manuel Corona <jmcg92@gmail.com>
92
+ * @update zhixin wen <wenzhixin2010@gmail.com>
93
+ */
94
+
95
+ (function ($) {
96
+ var Utils = $.fn.bootstrapTable.utils;
97
+
13
98
  $.extend($.fn.bootstrapTable.defaults, {
14
- stickyHeader: false
99
+ stickyHeader: false,
100
+ stickyHeaderOffsetY: 0
15
101
  });
16
-
17
- var bootstrapVersion = 3;
18
- try {
19
- bootstrapVersion = parseInt($.fn.dropdown.Constructor.VERSION, 10);
20
- } catch (e) { }
21
- var hidden_class = bootstrapVersion > 3 ? 'd-none' : 'hidden';
22
102
 
23
- var BootstrapTable = $.fn.bootstrapTable.Constructor,
24
- _initHeader = BootstrapTable.prototype.initHeader;
103
+ var hiddenClass = Utils.bootstrapVersion === 4 ? 'd-none' : 'hidden';
104
+
105
+ $.BootstrapTable = function (_$$BootstrapTable) {
106
+ _inherits(_class, _$$BootstrapTable);
107
+
108
+ function _class() {
109
+ _classCallCheck(this, _class);
110
+
111
+ return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
112
+ }
25
113
 
26
- BootstrapTable.prototype.initHeader = function () {
27
- var that = this;
28
- _initHeader.apply(this, Array.prototype.slice.apply(arguments));
114
+ _createClass(_class, [{
115
+ key: 'initHeader',
116
+ value: function initHeader() {
117
+ var _get2,
118
+ _this2 = this;
29
119
 
30
- if (!this.options.stickyHeader) {
120
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
121
+ args[_key] = arguments[_key];
122
+ }
123
+
124
+ (_get2 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initHeader', this)).call.apply(_get2, [this].concat(args));
125
+
126
+ if (!this.options.stickyHeader) {
31
127
  return;
32
- }
128
+ }
129
+
130
+ this.$el.before('<div class="sticky-header-container"></div>');
131
+ this.$el.before('<div class="sticky_anchor_begin"></div>');
132
+ this.$el.after('<div class="sticky_anchor_end"></div>');
133
+ this.$header.addClass('sticky-header');
33
134
 
34
- var table = this.$tableBody.find('table'),
35
- table_id = table.attr('id'),
36
- header_id = table.attr('id') + '-sticky-header',
37
- sticky_header_container_id = header_id +'-sticky-header-container',
38
- anchor_begin_id = header_id +'_sticky_anchor_begin',
39
- anchor_end_id = header_id +'_sticky_anchor_end';
40
- // add begin and end anchors to track table position
41
-
42
- table.before(sprintf('<div id="%s" class="%s"></div>', sticky_header_container_id, hidden_class));
43
- table.before(sprintf('<div id="%s"></div>', anchor_begin_id));
44
- table.after(sprintf('<div id="%s"></div>', anchor_end_id));
45
-
46
- table.find('thead').attr('id', header_id);
47
-
48
- // clone header just once, to be used as sticky header
49
- // deep clone header. using source header affects tbody>td width
50
- this.$stickyHeader = $($('#'+header_id).clone(true, true));
51
- // avoid id conflict
52
- this.$stickyHeader.removeAttr('id');
53
-
54
- // render sticky on window scroll or resize
55
- $(window).on('resize.'+table_id, table, render_sticky_header);
56
- $(window).on('scroll.'+table_id, table, render_sticky_header);
57
- // render sticky when table scroll left-right
58
- table.closest('.fixed-table-container').find('.fixed-table-body').on('scroll.'+table_id, table, match_position_x);
59
-
60
- this.$el.on('all.bs.table', function (e) {
61
- that.$stickyHeader = $($('#'+header_id).clone(true, true));
62
- that.$stickyHeader.removeAttr('id');
63
- });
64
-
65
- function render_sticky_header(event) {
66
- var table = event.data;
67
- var table_header_id = table.find('thead').attr('id');
68
- // console.log('render_sticky_header for > '+table_header_id);
69
- if (table.length < 1 || $('#'+table_id).length < 1){
70
- // turn off window listeners
71
- $(window).off('resize.'+table_id);
72
- $(window).off('scroll.'+table_id);
73
- table.closest('.fixed-table-container').find('.fixed-table-body').off('scroll.'+table_id);
74
- return;
75
- }
76
- // get header height
77
- var header_height = '0';
78
- if (that.options.stickyHeaderOffsetY) header_height = that.options.stickyHeaderOffsetY.replace('px','');
79
- // window scroll top
80
- var t = $(window).scrollTop();
81
- // top anchor scroll position, minus header height
82
- var e = $("#"+anchor_begin_id).offset().top - header_height;
83
- // bottom anchor scroll position, minus header height, minus sticky height
84
- var e_end = $("#"+anchor_end_id).offset().top - header_height - $('#'+table_header_id).css('height').replace('px','');
85
- // show sticky when top anchor touches header, and when bottom anchor not exceeded
86
- if (t > e && t <= e_end) {
87
- // ensure clone and source column widths are the same
88
- $.each( that.$stickyHeader.find('tr').eq(0).find('th'), function (index, item) {
89
- $(item).css('min-width', $('#'+table_header_id+' tr').eq(0).find('th').eq(index).css('width'));
90
- });
91
- // match bootstrap table style
92
- $("#"+sticky_header_container_id).removeClass(hidden_class).addClass("fix-sticky fixed-table-container") ;
93
- // stick it in position
94
- $("#"+sticky_header_container_id).css('top', header_height + 'px');
95
- // create scrollable container for header
96
- var scrollable_div = $('<div style="position:absolute;width:100%;overflow-x:hidden;" />');
97
- // append cloned header to dom
98
- $("#"+sticky_header_container_id).html(scrollable_div.append(that.$stickyHeader));
99
- // match clone and source header positions when left-right scroll
100
- match_position_x(event);
101
- } else {
102
- // hide sticky
103
- $("#"+sticky_header_container_id).removeClass("fix-sticky").addClass(hidden_class);
104
- }
135
+ // clone header just once, to be used as sticky header
136
+ // deep clone header, using source header affects tbody>td width
137
+ this.$stickyContainer = this.$tableBody.find('.sticky-header-container');
138
+ this.$stickyBegin = this.$tableBody.find('.sticky_anchor_begin');
139
+ this.$stickyEnd = this.$tableBody.find('.sticky_anchor_end');
140
+ this.$stickyHeader = this.$header.clone(true, true);
105
141
 
142
+ // render sticky on window scroll or resize
143
+ $(window).on('resize.sticky-header-table', function () {
144
+ return _this2.renderStickyHeader();
145
+ });
146
+ $(window).on('scroll.sticky-header-table', function () {
147
+ return _this2.renderStickyHeader();
148
+ });
149
+ this.$tableBody.off('scroll').on('scroll', function () {
150
+ return _this2.matchPositionX();
151
+ });
106
152
  }
107
- function match_position_x(event){
108
- var table = event.data;
109
- var table_header_id = table.find('thead').attr('id');
153
+ }, {
154
+ key: 'renderStickyHeader',
155
+ value: function renderStickyHeader() {
156
+ var _this3 = this;
157
+
158
+ var top = $(window).scrollTop();
159
+ // top anchor scroll position, minus header height
160
+ var start = this.$stickyBegin.offset().top - this.options.stickyHeaderOffsetY;
161
+ // bottom anchor scroll position, minus header height, minus sticky height
162
+ var end = this.$stickyEnd.offset().top - this.options.stickyHeaderOffsetY - this.$header.height();
163
+ // show sticky when top anchor touches header, and when bottom anchor not exceeded
164
+ if (top > start && top <= end) {
165
+ // ensure clone and source column widths are the same
166
+ this.$stickyHeader.find('tr:eq(0)').find('th').each(function (index, el) {
167
+ $(el).css('min-width', _this3.$header.find('tr:eq(0)').find('th').eq(index).css('width'));
168
+ });
169
+ // match bootstrap table style
170
+ this.$stickyContainer.removeClass(hiddenClass).addClass('fix-sticky fixed-table-container');
171
+ // stick it in position
172
+ this.$stickyContainer.css('top', this.options.stickyHeaderOffsetY + 'px');
173
+ // create scrollable container for header
174
+ this.$stickyTable = $('<table/>');
175
+ this.$stickyTable.addClass(this.options.classes);
176
+ // append cloned header to dom
177
+ this.$stickyContainer.html(this.$stickyTable.append(this.$stickyHeader));
110
178
  // match clone and source header positions when left-right scroll
111
- $("#"+sticky_header_container_id).css(
112
- 'width', +table.closest('.fixed-table-body').css('width').replace('px', '') + 1
113
- );
114
- $("#"+sticky_header_container_id+" thead").parent().scrollLeft(Math.abs($('#'+table_header_id).position().left));
179
+ this.matchPositionX();
180
+ } else {
181
+ this.$stickyContainer.removeClass('fix-sticky').addClass(hiddenClass);
182
+ }
115
183
  }
116
- };
184
+ }, {
185
+ key: 'matchPositionX',
186
+ value: function matchPositionX() {
187
+ this.$stickyContainer.scrollLeft(this.$tableBody.scrollLeft());
188
+ }
189
+ }]);
117
190
 
118
- })(jQuery);
191
+ return _class;
192
+ }($.BootstrapTable);
193
+ })(jQuery);
194
+ });
@@ -1,211 +1,373 @@
1
- /**
2
- * @author: aperez <aperez@datadec.es>
3
- * @version: v2.0.0
4
- *
5
- * @update Dennis Hernández <http://djhvscf.github.io/Blog>
6
- */
7
-
8
- !function($) {
9
- 'use strict';
10
-
11
- var firstLoad = false;
12
-
13
- var sprintf = $.fn.bootstrapTable.utils.sprintf;
14
-
15
- var showAvdSearch = function(pColumns, searchTitle, searchText, that) {
16
- if (!$("#avdSearchModal" + "_" + that.options.idTable).hasClass("modal")) {
17
- var vModal = sprintf("<div id=\"avdSearchModal%s\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"mySmallModalLabel\" aria-hidden=\"true\">", "_" + that.options.idTable);
18
- vModal += "<div class=\"modal-dialog modal-xs\">";
19
- vModal += " <div class=\"modal-content\">";
20
- vModal += " <div class=\"modal-header\">";
21
- vModal += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\" >&times;</button>";
22
- vModal += sprintf(" <h4 class=\"modal-title\">%s</h4>", searchTitle);
23
- vModal += " </div>";
24
- vModal += " <div class=\"modal-body modal-body-custom\">";
25
- vModal += sprintf(" <div class=\"container-fluid\" id=\"avdSearchModalContent%s\" style=\"padding-right: 0px;padding-left: 0px;\" >", "_" + that.options.idTable);
26
- vModal += " </div>";
27
- vModal += " </div>";
28
- vModal += " </div>";
29
- vModal += " </div>";
30
- vModal += "</div>";
31
-
32
- $("body").append($(vModal));
33
-
34
- var vFormAvd = createFormAvd(pColumns, searchText, that),
35
- timeoutId = 0;;
36
-
37
- $('#avdSearchModalContent' + "_" + that.options.idTable).append(vFormAvd.join(''));
38
-
39
- $('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) {
40
- clearTimeout(timeoutId);
41
- timeoutId = setTimeout(function () {
42
- that.onColumnAdvancedSearch(event);
43
- }, that.options.searchTimeOut);
44
- });
45
-
46
- $("#btnCloseAvd" + "_" + that.options.idTable).click(function() {
47
- $("#avdSearchModal" + "_" + that.options.idTable).modal('hide');
48
- });
49
-
50
- $("#avdSearchModal" + "_" + that.options.idTable).modal();
51
- } else {
52
- $("#avdSearchModal" + "_" + that.options.idTable).modal();
53
- }
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: {}
54
9
  };
55
-
56
- var createFormAvd = function(pColumns, searchText, that) {
57
- var htmlForm = [];
58
- htmlForm.push(sprintf('<form class="form-horizontal" id="%s" action="%s" >', that.options.idForm, that.options.actionForm));
59
- for (var i in pColumns) {
60
- var vObjCol = pColumns[i];
61
- if (!vObjCol.checkbox && vObjCol.visible && vObjCol.searchable) {
62
- htmlForm.push('<div class="form-group">');
63
- htmlForm.push(sprintf('<label class="col-sm-4 control-label">%s</label>', vObjCol.title));
64
- htmlForm.push('<div class="col-sm-6">');
65
- htmlForm.push(sprintf('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">', vObjCol.field, vObjCol.title, vObjCol.field));
66
- htmlForm.push('</div>');
67
- htmlForm.push('</div>');
68
- }
10
+ factory();
11
+ global.bootstrapTableToolbar = mod.exports;
12
+ }
13
+ })(this, function () {
14
+ 'use strict';
15
+
16
+ var _slicedToArray = function () {
17
+ function sliceIterator(arr, i) {
18
+ var _arr = [];
19
+ var _n = true;
20
+ var _d = false;
21
+ var _e = undefined;
22
+
23
+ try {
24
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
25
+ _arr.push(_s.value);
26
+
27
+ if (i && _arr.length === i) break;
69
28
  }
70
-
71
- htmlForm.push('<div class="form-group">');
72
- htmlForm.push('<div class="col-sm-offset-9 col-sm-3">');
73
- htmlForm.push(sprintf('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>', "_" + that.options.idTable, searchText));
74
- htmlForm.push('</div>');
75
- htmlForm.push('</div>');
76
- htmlForm.push('</form>');
77
-
78
- return htmlForm;
29
+ } catch (err) {
30
+ _d = true;
31
+ _e = err;
32
+ } finally {
33
+ try {
34
+ if (!_n && _i["return"]) _i["return"]();
35
+ } finally {
36
+ if (_d) throw _e;
37
+ }
38
+ }
39
+
40
+ return _arr;
41
+ }
42
+
43
+ return function (arr, i) {
44
+ if (Array.isArray(arr)) {
45
+ return arr;
46
+ } else if (Symbol.iterator in Object(arr)) {
47
+ return sliceIterator(arr, i);
48
+ } else {
49
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
50
+ }
51
+ };
52
+ }();
53
+
54
+ function _classCallCheck(instance, Constructor) {
55
+ if (!(instance instanceof Constructor)) {
56
+ throw new TypeError("Cannot call a class as a function");
57
+ }
58
+ }
59
+
60
+ var _createClass = function () {
61
+ function defineProperties(target, props) {
62
+ for (var i = 0; i < props.length; i++) {
63
+ var descriptor = props[i];
64
+ descriptor.enumerable = descriptor.enumerable || false;
65
+ descriptor.configurable = true;
66
+ if ("value" in descriptor) descriptor.writable = true;
67
+ Object.defineProperty(target, descriptor.key, descriptor);
68
+ }
69
+ }
70
+
71
+ return function (Constructor, protoProps, staticProps) {
72
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
73
+ if (staticProps) defineProperties(Constructor, staticProps);
74
+ return Constructor;
79
75
  };
76
+ }();
77
+
78
+ function _possibleConstructorReturn(self, call) {
79
+ if (!self) {
80
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
81
+ }
82
+
83
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
84
+ }
85
+
86
+ var _get = function get(object, property, receiver) {
87
+ if (object === null) object = Function.prototype;
88
+ var desc = Object.getOwnPropertyDescriptor(object, property);
89
+
90
+ if (desc === undefined) {
91
+ var parent = Object.getPrototypeOf(object);
92
+
93
+ if (parent === null) {
94
+ return undefined;
95
+ } else {
96
+ return get(parent, property, receiver);
97
+ }
98
+ } else if ("value" in desc) {
99
+ return desc.value;
100
+ } else {
101
+ var getter = desc.get;
102
+
103
+ if (getter === undefined) {
104
+ return undefined;
105
+ }
106
+
107
+ return getter.call(receiver);
108
+ }
109
+ };
110
+
111
+ function _inherits(subClass, superClass) {
112
+ if (typeof superClass !== "function" && superClass !== null) {
113
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
114
+ }
115
+
116
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
117
+ constructor: {
118
+ value: subClass,
119
+ enumerable: false,
120
+ writable: true,
121
+ configurable: true
122
+ }
123
+ });
124
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
125
+ }
126
+
127
+ /**
128
+ * @author: aperez <aperez@datadec.es>
129
+ * @version: v2.0.0
130
+ *
131
+ * @update Dennis Hernández <http://djhvscf.github.io/Blog>
132
+ * @update zhixin wen <wenzhixin2010@gmail.com>
133
+ */
134
+
135
+ (function ($) {
136
+ var Utils = $.fn.bootstrapTable.utils;
137
+
138
+ var bootstrap = {
139
+ 3: {
140
+ icons: {
141
+ advancedSearchIcon: 'glyphicon-chevron-down'
142
+ },
143
+ html: {
144
+ modalHeader: '\n <div class="modal-header">\n <button type="button" class="close" data-dismiss="modal" aria-label="Close">\n <span aria-hidden="true">&times;</span>\n </button>\n <h4 class="modal-title">%s</h4>\n </div>\n '
145
+ }
146
+ },
147
+ 4: {
148
+ icons: {
149
+ advancedSearchIcon: 'fa-chevron-down'
150
+ },
151
+ html: {
152
+ modalHeader: '\n <div class="modal-header">\n <h4 class="modal-title">%s</h4>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close">\n <span aria-hidden="true">&times;</span>\n </button>\n </div>\n '
153
+ }
154
+ }
155
+ }[Utils.bootstrapVersion];
80
156
 
81
157
  $.extend($.fn.bootstrapTable.defaults, {
82
- advancedSearch: false,
83
- idForm: 'advancedSearch',
84
- actionForm: '',
85
- idTable: undefined,
86
- onColumnAdvancedSearch: function (field, text) {
87
- return false;
88
- }
158
+ advancedSearch: false,
159
+ idForm: 'advancedSearch',
160
+ actionForm: '',
161
+ idTable: undefined,
162
+ onColumnAdvancedSearch: function onColumnAdvancedSearch(field, text) {
163
+ return false;
164
+ }
89
165
  });
90
166
 
91
167
  $.extend($.fn.bootstrapTable.defaults.icons, {
92
- advancedSearchIcon: 'glyphicon-chevron-down'
168
+ advancedSearchIcon: bootstrap.icons.advancedSearchIcon
93
169
  });
94
170
 
95
171
  $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
96
- 'column-advanced-search.bs.table': 'onColumnAdvancedSearch'
172
+ 'column-advanced-search.bs.table': 'onColumnAdvancedSearch'
97
173
  });
98
174
 
99
175
  $.extend($.fn.bootstrapTable.locales, {
100
- formatAdvancedSearch: function() {
101
- return 'Advanced search';
102
- },
103
- formatAdvancedCloseButton: function() {
104
- return "Close";
105
- }
176
+ formatAdvancedSearch: function formatAdvancedSearch() {
177
+ return 'Advanced search';
178
+ },
179
+ formatAdvancedCloseButton: function formatAdvancedCloseButton() {
180
+ return 'Close';
181
+ }
106
182
  });
107
183
 
108
184
  $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
109
185
 
110
- var BootstrapTable = $.fn.bootstrapTable.Constructor,
111
- _initToolbar = BootstrapTable.prototype.initToolbar,
112
- _load = BootstrapTable.prototype.load,
113
- _initSearch = BootstrapTable.prototype.initSearch;
186
+ $.BootstrapTable = function (_$$BootstrapTable) {
187
+ _inherits(_class, _$$BootstrapTable);
114
188
 
115
- BootstrapTable.prototype.initToolbar = function() {
116
- _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
189
+ function _class() {
190
+ _classCallCheck(this, _class);
117
191
 
118
- if (!this.options.search) {
119
- return;
120
- }
192
+ return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
193
+ }
121
194
 
122
- if (!this.options.advancedSearch) {
123
- return;
124
- }
195
+ _createClass(_class, [{
196
+ key: 'initToolbar',
197
+ value: function initToolbar() {
198
+ var _this2 = this;
199
+
200
+ var o = this.options;
201
+
202
+ this.showToolbar = this.showToolbar || o.search && o.advancedSearch && o.idTable;
203
+
204
+ _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initToolbar', this).call(this);
125
205
 
126
- if (!this.options.idTable) {
206
+ if (!o.search || !o.advancedSearch || !o.idTable) {
127
207
  return;
208
+ }
209
+
210
+ this.$toolbar.find('>.btn-group').append('\n <button class="btn btn-default' + Utils.sprintf(' btn-%s', o.buttonsClass) + Utils.sprintf(' btn-%s', o.iconSize) + '"\n type="button"\n name="advancedSearch"\n aria-label="advanced search"\n title="' + o.formatAdvancedSearch() + '">\n <i class="' + o.iconsPrefix + ' ' + o.icons.advancedSearchIcon + '"></i>\n </button>\n ');
211
+
212
+ this.$toolbar.find('button[name="advancedSearch"]').off('click').on('click', function () {
213
+ return _this2.showAvdSearch();
214
+ });
128
215
  }
216
+ }, {
217
+ key: 'showAvdSearch',
218
+ value: function showAvdSearch() {
219
+ var _this3 = this;
129
220
 
130
- var that = this,
131
- html = [];
221
+ var o = this.options;
132
222
 
133
- html.push(sprintf('<div class="columns columns-%s btn-group pull-%s" role="group">', this.options.buttonsAlign, this.options.buttonsAlign));
134
- html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="advancedSearch" aria-label="advanced search" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatAdvancedSearch()));
135
- html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.advancedSearchIcon))
136
- html.push('</button></div>');
223
+ if (!$('#avdSearchModal_' + o.idTable).hasClass('modal')) {
224
+ $('body').append('\n <div id="avdSearchModal_' + o.idTable + '" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">\n <div class="modal-dialog modal-xs">\n <div class="modal-content">\n ' + Utils.sprintf(bootstrap.html.modalHeader, o.formatAdvancedSearch()) + '\n <div class="modal-body modal-body-custom">\n <div class="container-fluid" id="avdSearchModalContent_' + o.idTable + '"\n style="padding-right: 0px; padding-left: 0px;" >\n </div>\n </div>\n <div class="modal-footer">\n <button type="button" id="btnCloseAvd_' + o.idTable + '" class="btn btn-' + o.buttonsClass + '">\n ' + o.formatAdvancedCloseButton() + '\n </button>\n </div>\n </div>\n </div>\n </div>\n ');
137
225
 
138
- that.$toolbar.prepend(html.join(''));
226
+ var timeoutId = 0;
139
227
 
140
- that.$toolbar.find('button[name="advancedSearch"]')
141
- .off('click').on('click', function() {
142
- showAvdSearch(that.columns, that.options.formatAdvancedSearch(), that.options.formatAdvancedCloseButton(), that);
228
+ $('#avdSearchModalContent_' + o.idTable).append(this.createFormAvd().join(''));
229
+
230
+ $('#' + o.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (e) {
231
+ if (o.sidePagination === 'server') {
232
+ _this3.onColumnAdvancedSearch(e);
233
+ } else {
234
+ clearTimeout(timeoutId);
235
+ timeoutId = setTimeout(function () {
236
+ _this3.onColumnAdvancedSearch(e);
237
+ }, o.searchTimeOut);
238
+ }
143
239
  });
144
- };
145
240
 
146
- BootstrapTable.prototype.load = function(data) {
147
- _load.apply(this, Array.prototype.slice.apply(arguments));
241
+ $('#btnCloseAvd_' + o.idTable).click(function () {
242
+ $('#avdSearchModal_' + o.idTable).modal('hide');
243
+ if (o.sidePagination === 'server') {
244
+ _this3.options.pageNumber = 1;
245
+ _this3.updatePagination();
246
+ _this3.trigger('column-advanced-search', _this3.filterColumnsPartial);
247
+ }
248
+ });
148
249
 
149
- if (!this.options.advancedSearch) {
150
- return;
250
+ $('#avdSearchModal_' + o.idTable).modal();
251
+ } else {
252
+ $('#avdSearchModal_' + o.idTable).modal();
253
+ }
151
254
  }
152
-
153
- if (typeof this.options.idTable === 'undefined') {
154
- return;
155
- } else {
156
- if (!firstLoad) {
157
- var height = parseInt($(".bootstrap-table").height());
158
- height += 10;
159
- $("#" + this.options.idTable).bootstrapTable("resetView", {height: height});
160
- firstLoad = true;
255
+ }, {
256
+ key: 'createFormAvd',
257
+ value: function createFormAvd() {
258
+ var o = this.options;
259
+ var html = ['<form class="form-horizontal" id="' + o.idForm + '" action="' + o.actionForm + '">'];
260
+
261
+ var _iteratorNormalCompletion = true;
262
+ var _didIteratorError = false;
263
+ var _iteratorError = undefined;
264
+
265
+ try {
266
+ for (var _iterator = this.columns[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
267
+ var column = _step.value;
268
+
269
+ if (!column.checkbox && column.visible && column.searchable) {
270
+ html.push('\n <div class="form-group row">\n <label class="col-sm-4 control-label">' + column.title + '</label>\n <div class="col-sm-6">\n <input type="text" class="form-control input-md" name="' + column.field + '" placeholder="' + column.title + '" id="' + column.field + '">\n </div>\n </div>\n ');
271
+ }
272
+ }
273
+ } catch (err) {
274
+ _didIteratorError = true;
275
+ _iteratorError = err;
276
+ } finally {
277
+ try {
278
+ if (!_iteratorNormalCompletion && _iterator.return) {
279
+ _iterator.return();
280
+ }
281
+ } finally {
282
+ if (_didIteratorError) {
283
+ throw _iteratorError;
284
+ }
161
285
  }
286
+ }
287
+
288
+ html.push('</form>');
289
+
290
+ return html;
162
291
  }
163
- };
292
+ }, {
293
+ key: 'initSearch',
294
+ value: function initSearch() {
295
+ var _this4 = this;
164
296
 
165
- BootstrapTable.prototype.initSearch = function () {
166
- _initSearch.apply(this, Array.prototype.slice.apply(arguments));
297
+ _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initSearch', this).call(this);
167
298
 
168
- if (!this.options.advancedSearch) {
299
+ if (!this.options.advancedSearch || this.options.sidePagination === 'server') {
169
300
  return;
170
- }
301
+ }
302
+
303
+ var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
304
+
305
+ this.data = fp ? $.grep(this.data, function (item, i) {
306
+ var _iteratorNormalCompletion2 = true;
307
+ var _didIteratorError2 = false;
308
+ var _iteratorError2 = undefined;
309
+
310
+ try {
311
+ for (var _iterator2 = Object.entries(fp)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
312
+ var _ref = _step2.value;
171
313
 
172
- var that = this;
173
- var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
314
+ var _ref2 = _slicedToArray(_ref, 2);
174
315
 
175
- this.data = fp ? $.grep(this.data, function (item, i) {
176
- for (var key in fp) {
177
- var fval = fp[key].toLowerCase();
316
+ var key = _ref2[0];
317
+ var v = _ref2[1];
318
+
319
+ var fval = v.toLowerCase();
178
320
  var value = item[key];
179
- value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
180
- that.header.formatters[$.inArray(key, that.header.fields)],
181
- [value, item, i], value);
182
-
183
- if (!($.inArray(key, that.header.fields) !== -1 &&
184
- (typeof value === 'string' || typeof value === 'number') &&
185
- (value + '').toLowerCase().indexOf(fval) !== -1)) {
186
- return false;
321
+ var index = _this4.header.fields.indexOf(key);
322
+ value = Utils.calculateObjectValue(_this4.header, _this4.header.formatters[index], [value, item, i], value);
323
+
324
+ if (!(index !== -1 && (typeof value === 'string' || typeof value === 'number') && ('' + value).toLowerCase().includes(fval))) {
325
+ return false;
326
+ }
327
+ }
328
+ } catch (err) {
329
+ _didIteratorError2 = true;
330
+ _iteratorError2 = err;
331
+ } finally {
332
+ try {
333
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
334
+ _iterator2.return();
187
335
  }
336
+ } finally {
337
+ if (_didIteratorError2) {
338
+ throw _iteratorError2;
339
+ }
340
+ }
188
341
  }
189
- return true;
190
- }) : this.data;
191
- };
192
342
 
193
- BootstrapTable.prototype.onColumnAdvancedSearch = function (event) {
194
- var text = $.trim($(event.currentTarget).val());
195
- var $field = $(event.currentTarget)[0].id;
343
+ return true;
344
+ }) : this.data;
345
+ }
346
+ }, {
347
+ key: 'onColumnAdvancedSearch',
348
+ value: function onColumnAdvancedSearch(e) {
349
+ var text = $.trim($(e.currentTarget).val());
350
+ var $field = $(e.currentTarget)[0].id;
196
351
 
197
- if ($.isEmptyObject(this.filterColumnsPartial)) {
352
+ if ($.isEmptyObject(this.filterColumnsPartial)) {
198
353
  this.filterColumnsPartial = {};
199
- }
200
- if (text) {
354
+ }
355
+ if (text) {
201
356
  this.filterColumnsPartial[$field] = text;
202
- } else {
357
+ } else {
203
358
  delete this.filterColumnsPartial[$field];
359
+ }
360
+
361
+ if (this.options.sidePagination !== 'server') {
362
+ this.options.pageNumber = 1;
363
+ this.onSearch(e);
364
+ this.updatePagination();
365
+ this.trigger('column-advanced-search', $field, text);
366
+ }
204
367
  }
368
+ }]);
205
369
 
206
- this.options.pageNumber = 1;
207
- this.onSearch(event);
208
- this.updatePagination();
209
- this.trigger('column-advanced-search', $field, text);
210
- };
211
- }(jQuery);
370
+ return _class;
371
+ }($.BootstrapTable);
372
+ })(jQuery);
373
+ });