bootstrap-table-rails 1.8.2 → 1.8.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +68 -29
  3. data/bootstrap-table-rails-1.8.2.gem +0 -0
  4. data/lib/bootstrap-table-rails/version.rb +1 -1
  5. data/vendor/assets/javascripts/bootstrap-table-all.js +5177 -9
  6. data/vendor/assets/javascripts/bootstrap-table-locale-all.js +1500 -6
  7. data/vendor/assets/javascripts/bootstrap-table.js +2506 -8
  8. data/vendor/assets/javascripts/extensions/bootstrap-table-angular.js +105 -7
  9. data/vendor/assets/javascripts/extensions/bootstrap-table-cookie.js +318 -7
  10. data/vendor/assets/javascripts/extensions/bootstrap-table-editable.js +107 -7
  11. data/vendor/assets/javascripts/extensions/bootstrap-table-export.js +103 -7
  12. data/vendor/assets/javascripts/extensions/bootstrap-table-filter-control.js +458 -7
  13. data/vendor/assets/javascripts/extensions/bootstrap-table-filter.js +67 -7
  14. data/vendor/assets/javascripts/extensions/bootstrap-table-flat-json.js +62 -7
  15. data/vendor/assets/javascripts/extensions/bootstrap-table-group-by.js +228 -0
  16. data/vendor/assets/javascripts/extensions/bootstrap-table-key-events.js +80 -7
  17. data/vendor/assets/javascripts/extensions/bootstrap-table-mobile.js +142 -7
  18. data/vendor/assets/javascripts/extensions/bootstrap-table-multiple-sort.js +378 -7
  19. data/vendor/assets/javascripts/extensions/bootstrap-table-natural-sorting.js +47 -7
  20. data/vendor/assets/javascripts/extensions/bootstrap-table-reorder-columns.js +130 -7
  21. data/vendor/assets/javascripts/extensions/bootstrap-table-reorder-rows.js +115 -7
  22. data/vendor/assets/javascripts/extensions/bootstrap-table-resizable.js +74 -7
  23. data/vendor/assets/javascripts/extensions/bootstrap-table-toolbar.js +245 -7
  24. data/vendor/assets/javascripts/locale/bootstrap-table-ar-SA.js +40 -0
  25. data/vendor/assets/javascripts/locale/bootstrap-table-ca-ES.js +43 -0
  26. data/vendor/assets/javascripts/locale/bootstrap-table-cs-CZ.js +44 -0
  27. data/vendor/assets/javascripts/locale/bootstrap-table-da-DK.js +37 -0
  28. data/vendor/assets/javascripts/locale/bootstrap-table-de-DE.js +37 -0
  29. data/vendor/assets/javascripts/locale/bootstrap-table-el-GR.js +28 -0
  30. data/vendor/assets/javascripts/locale/bootstrap-table-en-US.js +43 -0
  31. data/vendor/assets/javascripts/locale/bootstrap-table-es-AR.js +31 -0
  32. data/vendor/assets/javascripts/locale/bootstrap-table-es-CR.js +40 -0
  33. data/vendor/assets/javascripts/locale/bootstrap-table-es-ES.js +43 -0
  34. data/vendor/assets/javascripts/locale/bootstrap-table-es-MX.js +32 -0
  35. data/vendor/assets/javascripts/locale/bootstrap-table-es-NI.js +40 -0
  36. data/vendor/assets/javascripts/locale/bootstrap-table-es-SP.js +40 -0
  37. data/vendor/assets/javascripts/locale/bootstrap-table-fa-IR.js +43 -0
  38. data/vendor/assets/javascripts/locale/bootstrap-table-fr-BE.js +28 -0
  39. data/vendor/assets/javascripts/locale/bootstrap-table-fr-FR.js +41 -0
  40. data/vendor/assets/javascripts/locale/bootstrap-table-hr-HR.js +44 -0
  41. data/vendor/assets/javascripts/locale/bootstrap-table-hu-HU.js +43 -0
  42. data/vendor/assets/javascripts/locale/bootstrap-table-it-IT.js +37 -0
  43. data/vendor/assets/javascripts/locale/bootstrap-table-ja-JP.js +40 -0
  44. data/vendor/assets/javascripts/locale/bootstrap-table-ka-GE.js +40 -0
  45. data/vendor/assets/javascripts/locale/bootstrap-table-ko-KR.js +37 -0
  46. data/vendor/assets/javascripts/locale/bootstrap-table-ms-MY.js +40 -0
  47. data/vendor/assets/javascripts/locale/bootstrap-table-nb-NO.js +37 -0
  48. data/vendor/assets/javascripts/locale/bootstrap-table-nl-NL.js +28 -0
  49. data/vendor/assets/javascripts/locale/bootstrap-table-pl-PL.js +37 -0
  50. data/vendor/assets/javascripts/locale/bootstrap-table-pt-BR.js +41 -0
  51. data/vendor/assets/javascripts/locale/bootstrap-table-pt-PT.js +28 -0
  52. data/vendor/assets/javascripts/locale/bootstrap-table-ro-RO.js +43 -0
  53. data/vendor/assets/javascripts/locale/bootstrap-table-ru-RU.js +36 -0
  54. data/vendor/assets/javascripts/locale/bootstrap-table-sk-SK.js +37 -0
  55. data/vendor/assets/javascripts/locale/bootstrap-table-sv-SE.js +37 -0
  56. data/vendor/assets/javascripts/locale/bootstrap-table-th-TH.js +37 -0
  57. data/vendor/assets/javascripts/locale/bootstrap-table-tr-TR.js +41 -0
  58. data/vendor/assets/javascripts/locale/bootstrap-table-uk-UA.js +37 -0
  59. data/vendor/assets/javascripts/locale/bootstrap-table-ur-PK.js +37 -0
  60. data/vendor/assets/javascripts/locale/bootstrap-table-vi-VN.js +28 -0
  61. data/vendor/assets/javascripts/locale/bootstrap-table-zh-CN.js +40 -0
  62. data/vendor/assets/javascripts/locale/bootstrap-table-zh-TW.js +40 -0
  63. data/vendor/assets/stylesheets/bootstrap-table.css +297 -1
  64. data/vendor/assets/stylesheets/extensions/bootstrap-table-group-by.css +53 -0
  65. metadata +44 -2
@@ -1,7 +1,47 @@
1
- /*
2
- * bootstrap-table - v1.8.1 - 2015-05-29
3
- * https://github.com/wenzhixin/bootstrap-table
4
- * Copyright (c) 2015 zhixin wen
5
- * Licensed MIT License
6
- */
7
- function alphanum(a,b){function c(a){for(var b,c,d=[],e=0,f=-1,g=0;b=(c=a.charAt(e++)).charCodeAt(0);){var h=46===b||b>=48&&57>=b;h!==g&&(d[++f]="",g=h),d[f]+=c}return d}var d=c(a),e=c(b);for(x=0;d[x]&&e[x];x++)if(d[x]!==e[x]){var f=Number(d[x]),g=Number(e[x]);return f==d[x]&&g==e[x]?f-g:d[x]>e[x]?1:-1}return d.length-e.length}
1
+ /**
2
+ * @author: Brian Huisman
3
+ * @webSite: http://www.greywyvern.com
4
+ * @version: v1.0.0
5
+ * JS function to allow natural sorting on bootstrap-table columns
6
+ * just add data-sorter="alphanum" to any th
7
+ *
8
+ * @update Dennis Hernández <http://djhvscf.github.io/Blog>
9
+ */
10
+
11
+ function alphanum(a, b) {
12
+ function chunkify(t) {
13
+ var tz = [],
14
+ x = 0,
15
+ y = -1,
16
+ n = 0,
17
+ i,
18
+ j;
19
+
20
+ while (i = (j = t.charAt(x++)).charCodeAt(0)) {
21
+ var m = (i === 46 || (i >= 48 && i <= 57));
22
+ if (m !== n) {
23
+ tz[++y] = "";
24
+ n = m;
25
+ }
26
+ tz[y] += j;
27
+ }
28
+ return tz;
29
+ }
30
+
31
+ var aa = chunkify(a);
32
+ var bb = chunkify(b);
33
+
34
+ for (x = 0; aa[x] && bb[x]; x++) {
35
+ if (aa[x] !== bb[x]) {
36
+ var c = Number(aa[x]),
37
+ d = Number(bb[x]);
38
+
39
+ if (c == aa[x] && d == bb[x]) {
40
+ return c - d;
41
+ } else {
42
+ return (aa[x] > bb[x]) ? 1 : -1;
43
+ }
44
+ }
45
+ }
46
+ return aa.length - bb.length;
47
+ }
@@ -1,7 +1,130 @@
1
- /*
2
- * bootstrap-table - v1.8.1 - 2015-05-29
3
- * https://github.com/wenzhixin/bootstrap-table
4
- * Copyright (c) 2015 zhixin wen
5
- * Licensed MIT License
6
- */
7
- !function(a){"use strict";var b=function(b,c){var d=-1;return a.each(b,function(a,b){return b.field===c?(d=a,!1):!0}),d};a.extend(a.fn.bootstrapTable.defaults,{reorderableColumns:!1,maxMovingRows:10,onReorderColumn:function(){return!1}}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"reorder-column.bs.table":"onReorderColumn"});var c=a.fn.bootstrapTable.Constructor,d=c.prototype.initHeader,e=c.prototype.toggleColumn,f=c.prototype.toggleView,g=c.prototype.resetView;c.prototype.initHeader=function(){d.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&this.makeRowsReorderable()},c.prototype.toggleColumn=function(){e.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&this.makeRowsReorderable()},c.prototype.toggleView=function(){f.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&(this.options.cardView||this.makeRowsReorderable())},c.prototype.resetView=function(){g.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&this.makeRowsReorderable()},c.prototype.makeRowsReorderable=function(){var c=this;try{a(this.$el).dragtable("destroy")}catch(d){}a(this.$el).dragtable({maxMovingRows:c.options.maxMovingRows,clickDelay:200,beforeStop:function(){var d=[],e=[],f=-1;c.$header.find("th").each(function(){d.push(a(this).data("field"))});for(var g=0;g<d.length;g++)f=b(c.options.columns,d[g]),-1!==f&&(e.push(c.options.columns[f]),c.options.columns.splice(f,1));c.options.columns=c.options.columns.concat(e),c.header.fields=d,c.resetView(),c.trigger("reorder-column",d)}})}}(jQuery);
1
+ /**
2
+ * @author: Dennis Hernández
3
+ * @webSite: http://djhvscf.github.io/Blog
4
+ * @version: v1.1.0
5
+ */
6
+
7
+ !function ($) {
8
+
9
+ 'use strict';
10
+
11
+ var getFieldIndex = function (columns, field) {
12
+ var index = -1;
13
+
14
+ $.each(columns, function (i, column) {
15
+ if (column.field === field) {
16
+ index = i;
17
+ return false;
18
+ }
19
+ return true;
20
+ });
21
+ return index;
22
+ };
23
+
24
+ $.extend($.fn.bootstrapTable.defaults, {
25
+ reorderableColumns: false,
26
+ maxMovingRows: 10,
27
+ onReorderColumn: function (headerFields) {
28
+ return false;
29
+ },
30
+ dragaccept: null
31
+ });
32
+
33
+ $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
34
+ 'reorder-column.bs.table': 'onReorderColumn'
35
+ });
36
+
37
+ var BootstrapTable = $.fn.bootstrapTable.Constructor,
38
+ _initHeader = BootstrapTable.prototype.initHeader,
39
+ _toggleColumn = BootstrapTable.prototype.toggleColumn,
40
+ _toggleView = BootstrapTable.prototype.toggleView,
41
+ _resetView = BootstrapTable.prototype.resetView;
42
+
43
+ BootstrapTable.prototype.initHeader = function () {
44
+ _initHeader.apply(this, Array.prototype.slice.apply(arguments));
45
+
46
+ if (!this.options.reorderableColumns) {
47
+ return;
48
+ }
49
+
50
+ this.makeRowsReorderable();
51
+ };
52
+
53
+ BootstrapTable.prototype.toggleColumn = function () {
54
+ _toggleColumn.apply(this, Array.prototype.slice.apply(arguments));
55
+
56
+ if (!this.options.reorderableColumns) {
57
+ return;
58
+ }
59
+
60
+ this.makeRowsReorderable();
61
+ };
62
+
63
+ BootstrapTable.prototype.toggleView = function () {
64
+ _toggleView.apply(this, Array.prototype.slice.apply(arguments));
65
+
66
+ if (!this.options.reorderableColumns) {
67
+ return;
68
+ }
69
+
70
+ if (this.options.cardView) {
71
+ return;
72
+ }
73
+
74
+ this.makeRowsReorderable();
75
+ };
76
+
77
+ BootstrapTable.prototype.resetView = function () {
78
+ _resetView.apply(this, Array.prototype.slice.apply(arguments));
79
+
80
+ if (!this.options.reorderableColumns) {
81
+ return;
82
+ }
83
+
84
+ this.makeRowsReorderable();
85
+ };
86
+
87
+ BootstrapTable.prototype.makeRowsReorderable = function () {
88
+ var that = this;
89
+ try {
90
+ $(this.$el).dragtable('destroy');
91
+ } catch (e) {}
92
+ $(this.$el).dragtable({
93
+ maxMovingRows: that.options.maxMovingRows,
94
+ dragaccept: that.options.dragaccept,
95
+ clickDelay:200,
96
+ beforeStop: function() {
97
+ var ths = [],
98
+ columns = [],
99
+ columnsHidden = [],
100
+ columnIndex = -1;
101
+ that.$header.find('th').each(function (i) {
102
+ ths.push($(this).data('field'));
103
+ });
104
+
105
+ //Exist columns not shown
106
+ if (ths.length < that.columns.length) {
107
+ columnsHidden = $.grep(that.columns, function (column) {
108
+ return !column.visible;
109
+ });
110
+ for (var i = 0; i < columnsHidden.length; i++) {
111
+ ths.push(columnsHidden[i].field);
112
+ }
113
+ }
114
+
115
+ for (var i = 0; i < ths.length; i++ ) {
116
+ columnIndex = getFieldIndex(that.columns, ths[i]);
117
+ if (columnIndex !== -1) {
118
+ columns.push(that.columns[columnIndex]);
119
+ that.columns.splice(columnIndex, 1);
120
+ }
121
+ }
122
+
123
+ that.columns = that.columns.concat(columns);
124
+ that.header.fields = ths;
125
+ that.resetView();
126
+ that.trigger('reorder-column', ths);
127
+ }
128
+ });
129
+ };
130
+ }(jQuery);
@@ -1,7 +1,115 @@
1
- /*
2
- * bootstrap-table - v1.8.1 - 2015-05-29
3
- * https://github.com/wenzhixin/bootstrap-table
4
- * Copyright (c) 2015 zhixin wen
5
- * Licensed MIT License
6
- */
7
- !function(a){"use strict";var b=function(a,b){return{id:"customId_"+b}};a.extend(a.fn.bootstrapTable.defaults,{reorderableRows:!1,onDragStyle:null,onDropStyle:null,onDragClass:"reorder_rows_onDragClass",dragHandle:null,useRowAttrFunc:!1,onReorderRowsDrag:function(){return!1},onReorderRowsDrop:function(){return!1},onReorderRow:function(){return!1}}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"reorder-row.bs.table":"onReorderRow"});var c=a.fn.bootstrapTable.Constructor,d=c.prototype.init,e=c.prototype.initSearch;c.prototype.init=function(){if(d.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableRows){var a=this;this.options.useRowAttrFunc&&(this.options.rowAttributes=b);var c=this.options.onPostBody;this.options.onPostBody=function(){setTimeout(function(){a.makeRowsReorderable(),c.apply()},1)}}},c.prototype.initSearch=function(){e.apply(this,Array.prototype.slice.apply(arguments)),!this.options.reorderableRows},c.prototype.makeRowsReorderable=function(){if(!this.options.cardView){var a=this;this.$el.tableDnD({onDragStyle:a.options.onDragStyle,onDropStyle:a.options.onDropStyle,onDragClass:a.options.onDragClass,onDrop:a.onDrop,onDragStart:a.options.onReorderRowsDrag,dragHandle:a.options.dragHandle})}},c.prototype.onDrop=function(b,c){for(var d=a(b),e=d.data("bootstrap.table"),f=d.data("bootstrap.table").options,c=null,g=[],h=0;h<b.tBodies[0].rows.length;h++)c=a(b.tBodies[0].rows[h]),g.push(f.data[c.data("index")]),c.data("index",h).attr("data-index",h);f.data=g,f.onReorderRowsDrop.apply(b,c),e.trigger("reorder-row",g)}}(jQuery);
1
+ /**
2
+ * @author: Dennis Hernández
3
+ * @webSite: http://djhvscf.github.io/Blog
4
+ * @version: v1.0.0
5
+ */
6
+
7
+ !function ($) {
8
+
9
+ 'use strict';
10
+
11
+ var isSearch = false;
12
+
13
+ var rowAttr = function (row, index) {
14
+ return {
15
+ id: 'customId_' + index
16
+ };
17
+ };
18
+
19
+ $.extend($.fn.bootstrapTable.defaults, {
20
+ reorderableRows: false,
21
+ onDragStyle: null,
22
+ onDropStyle: null,
23
+ onDragClass: "reorder_rows_onDragClass",
24
+ dragHandle: null,
25
+ useRowAttrFunc: false,
26
+ onReorderRowsDrag: function (table, row) {
27
+ return false;
28
+ },
29
+ onReorderRowsDrop: function (table, row) {
30
+ return false;
31
+ },
32
+ onReorderRow: function (newData) {
33
+ return false;
34
+ }
35
+ });
36
+
37
+ $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
38
+ 'reorder-row.bs.table': 'onReorderRow'
39
+ });
40
+
41
+ var BootstrapTable = $.fn.bootstrapTable.Constructor,
42
+ _init = BootstrapTable.prototype.init,
43
+ _initSearch = BootstrapTable.prototype.initSearch;
44
+
45
+ BootstrapTable.prototype.init = function () {
46
+
47
+ if (!this.options.reorderableRows) {
48
+ return;
49
+ }
50
+
51
+ var that = this;
52
+ if (this.options.useRowAttrFunc) {
53
+ this.options.rowAttributes = rowAttr;
54
+ }
55
+
56
+ var onPostBody = this.options.onPostBody;
57
+ this.options.onPostBody = function () {
58
+ setTimeout(function () {
59
+ that.makeRowsReorderable();
60
+ onPostBody.apply();
61
+ }, 1);
62
+ };
63
+
64
+ _init.apply(this, Array.prototype.slice.apply(arguments));
65
+ };
66
+
67
+ BootstrapTable.prototype.initSearch = function () {
68
+ _initSearch.apply(this, Array.prototype.slice.apply(arguments));
69
+
70
+ if (!this.options.reorderableRows) {
71
+ return;
72
+ }
73
+
74
+ //Known issue after search if you reorder the rows the data is not display properly
75
+ //isSearch = true;
76
+ };
77
+
78
+ BootstrapTable.prototype.makeRowsReorderable = function () {
79
+ if (this.options.cardView) {
80
+ return;
81
+ }
82
+
83
+ var that = this;
84
+ this.$el.tableDnD({
85
+ onDragStyle: that.options.onDragStyle,
86
+ onDropStyle: that.options.onDropStyle,
87
+ onDragClass: that.options.onDragClass,
88
+ onDrop: that.onDrop,
89
+ onDragStart: that.options.onReorderRowsDrag,
90
+ dragHandle: that.options.dragHandle
91
+ });
92
+ };
93
+
94
+ BootstrapTable.prototype.onDrop = function (table, droppedRow) {
95
+ var tableBs = $(table),
96
+ tableBsData = tableBs.data('bootstrap.table'),
97
+ tableBsOptions = tableBs.data('bootstrap.table').options,
98
+ row = null,
99
+ newData = [];
100
+
101
+ for (var i = 0; i < table.tBodies[0].rows.length; i++) {
102
+ row = $(table.tBodies[0].rows[i]);
103
+ newData.push(tableBsOptions.data[row.data('index')]);
104
+ row.data('index', i).attr('data-index', i);
105
+ }
106
+
107
+ tableBsOptions.data = newData;
108
+
109
+ //Call the user defined function
110
+ tableBsOptions.onReorderRowsDrop.apply(table, [table, droppedRow]);
111
+
112
+ //Call the event reorder-row
113
+ tableBsData.trigger('reorder-row', newData);
114
+ };
115
+ }(jQuery);
@@ -1,7 +1,74 @@
1
- /*
2
- * bootstrap-table - v1.8.1 - 2015-05-29
3
- * https://github.com/wenzhixin/bootstrap-table
4
- * Copyright (c) 2015 zhixin wen
5
- * Licensed MIT License
6
- */
7
- !function(a){"use strict";var b=function(a){a.$el.colResizable({disable:!0}),a.$el.colResizable({liveDrag:a.options.liveDrag,fixed:a.options.fixed,headerOnly:a.options.headerOnly,minWidth:a.options.minWidth,hoverCursor:a.options.hoverCursor,dragCursor:a.options.dragCursor,onResize:a.onResize,onDrag:a.options.onResizableDrag})};a.extend(a.fn.bootstrapTable.defaults,{resizable:!1,liveDrag:!1,fixed:!0,headerOnly:!1,minWidth:15,hoverCursor:"e-resize",dragCursor:"e-resize",onResizableResize:function(){return!1},onResizableDrag:function(){return!1}});var c=a.fn.bootstrapTable.Constructor,d=c.prototype.toggleView,e=c.prototype.resetView;c.prototype.toggleView=function(){d.apply(this,Array.prototype.slice.apply(arguments)),this.options.resizable&&this.options.cardView&&a(this.$el).colResizable({disable:!0})},c.prototype.resetView=function(){var a=this;e.apply(this,Array.prototype.slice.apply(arguments)),this.options.resizable&&setTimeout(function(){b(a)},100)},c.prototype.onResize=function(b){var c=a(b.currentTarget);c.bootstrapTable("resetView"),c.data("bootstrap.table").options.onResizableResize.apply(b)}}(jQuery);
1
+ /**
2
+ * @author: Dennis Hernández
3
+ * @webSite: http://djhvscf.github.io/Blog
4
+ * @version: v1.0.0
5
+ */
6
+
7
+ (function ($) {
8
+ 'use strict';
9
+
10
+ var initResizable = function (that) {
11
+ //Deletes the plugin to re-create it
12
+ that.$el.colResizable({disable: true});
13
+
14
+ //Creates the plugin
15
+ that.$el.colResizable({
16
+ liveDrag: that.options.liveDrag,
17
+ fixed: that.options.fixed,
18
+ headerOnly: that.options.headerOnly,
19
+ minWidth: that.options.minWidth,
20
+ hoverCursor: that.options.hoverCursor,
21
+ dragCursor: that.options.dragCursor,
22
+ onResize: that.onResize,
23
+ onDrag: that.options.onResizableDrag
24
+ });
25
+ };
26
+
27
+ $.extend($.fn.bootstrapTable.defaults, {
28
+ resizable: false,
29
+ liveDrag: false,
30
+ fixed: true,
31
+ headerOnly: false,
32
+ minWidth: 15,
33
+ hoverCursor: 'e-resize',
34
+ dragCursor: 'e-resize',
35
+ onResizableResize: function (e) {
36
+ return false;
37
+ },
38
+ onResizableDrag: function (e) {
39
+ return false;
40
+ }
41
+ });
42
+
43
+ var BootstrapTable = $.fn.bootstrapTable.Constructor,
44
+ _toggleView = BootstrapTable.prototype.toggleView,
45
+ _resetView = BootstrapTable.prototype.resetView;
46
+
47
+ BootstrapTable.prototype.toggleView = function () {
48
+ _toggleView.apply(this, Array.prototype.slice.apply(arguments));
49
+
50
+ if (this.options.resizable && this.options.cardView) {
51
+ //Deletes the plugin
52
+ $(this.$el).colResizable({disable: true});
53
+ }
54
+ };
55
+
56
+ BootstrapTable.prototype.resetView = function () {
57
+ var that = this;
58
+
59
+ _resetView.apply(this, Array.prototype.slice.apply(arguments));
60
+
61
+ if (this.options.resizable) {
62
+ // because in fitHeader function, we use setTimeout(func, 100);
63
+ setTimeout(function () {
64
+ initResizable(that);
65
+ }, 100);
66
+ }
67
+ };
68
+
69
+ BootstrapTable.prototype.onResize = function (e) {
70
+ var that = $(e.currentTarget);
71
+ that.bootstrapTable('resetView');
72
+ that.data('bootstrap.table').options.onResizableResize.apply(e);
73
+ }
74
+ })(jQuery);
@@ -1,7 +1,245 @@
1
- /*
2
- * bootstrap-table - v1.8.1 - 2015-05-29
3
- * https://github.com/wenzhixin/bootstrap-table
4
- * Copyright (c) 2015 zhixin wen
5
- * Licensed MIT License
6
- */
7
- !function(a){"use strict";var b=!1,c=function(a){var b=arguments,c=!0,d=1;return a=a.replace(/%s/g,function(){var a=b[d++];return"undefined"==typeof a?(c=!1,""):a}),c?a:""},d=function(b,c,d,e){if("string"==typeof c){var f=c.split(".");f.length>1?(c=window,a.each(f,function(a,b){c=c[b]})):c=window[c]}return"object"==typeof c?c:"function"==typeof c?c.apply(b,d):e},e=function(b,d,e,g){if(a("#avdSearchModal").hasClass("modal"))a("#avdSearchModal").modal();else{var h='<div id="avdSearchModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">';h+='<div class="modal-dialog modal-xs">',h+=' <div class="modal-content">',h+=' <div class="modal-header">',h+=' <button type="button" class="close" data-dismiss="modal" aria-hidden="true" >&times;</button>',h+=c(' <h4 class="modal-title">%s</h4>',d),h+=" </div>",h+=' <div class="modal-body modal-body-custom">',h+=' <div class="container-fluid" id="avdSearchModalContent" style="padding-right: 0px;padding-left: 0px;" >',h+=" </div>",h+=" </div>",h+=" </div>",h+=" </div>",h+="</div>",a("body").append(a(h));var i=f(b,e,g),j=0;a("#avdSearchModalContent").append(i.join("")),a("#"+g.options.idForm).off("keyup blur","input").on("keyup blur","input",function(a){clearTimeout(j),j=setTimeout(function(){g.onColumnAdvancedSearch(a)},g.options.searchTimeOut)}),a("#btnCloseAvd").click(function(){a("#avdSearchModal").modal("hide")}),a("#avdSearchModal").modal()}},f=function(a,b,d){var e=[];e.push(c('<form class="form-horizontal" id="%s" action="%s" >',d.options.idForm,d.options.actionForm));for(var f in a){var g=a[f];!g.checkbox&&g.visible&&g.searchable&&(e.push('<div class="form-group">'),e.push(c('<label class="col-sm-4 control-label">%s</label>',g.title)),e.push('<div class="col-sm-6">'),e.push(c('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">',g.field,g.title,g.field)),e.push("</div>"),e.push("</div>"))}return e.push('<div class="form-group">'),e.push('<div class="col-sm-offset-9 col-sm-3">'),e.push(c('<button type="button" id="btnCloseAvd" class="btn btn-default" >%s</button>',b)),e.push("</div>"),e.push("</div>"),e.push("</form>"),e};a.extend(a.fn.bootstrapTable.defaults,{advancedSearch:!1,idForm:"advancedSearch",actionForm:"",idTable:void 0,onColumnAdvancedSearch:function(){return!1}}),a.extend(a.fn.bootstrapTable.defaults.icons,{advancedSearchIcon:"glyphicon-chevron-down"}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"column-advanced-search.bs.table":"onColumnAdvancedSearch"}),a.extend(a.fn.bootstrapTable.locales,{formatAdvancedSearch:function(){return"Advanced search"},formatAdvancedCloseButton:function(){return"Close"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var g=a.fn.bootstrapTable.Constructor,h=g.prototype.initToolbar,i=g.prototype.load,j=g.prototype.initSearch;g.prototype.initToolbar=function(){if(h.apply(this,Array.prototype.slice.apply(arguments)),this.options.search&&this.options.advancedSearch){var a=this,b=[];b.push(c('<div class="columns columns-%s btn-group pull-%s" role="group">',this.options.buttonsAlign,this.options.buttonsAlign)),b.push(c('<button class="btn btn-default%s" type="button" name="advancedSearch" title="%s">',void 0===a.options.iconSize?"":" btn-"+a.options.iconSize,a.options.formatAdvancedSearch())),b.push(c('<i class="%s %s"></i>',a.options.iconsPrefix,a.options.icons.advancedSearchIcon)),b.push("</button></div>"),a.$toolbar.prepend(b.join("")),a.$toolbar.find('button[name="advancedSearch"]').off("click").on("click",function(){e(a.options.columns,a.options.formatAdvancedSearch(),a.options.formatAdvancedCloseButton(),a)})}},g.prototype.load=function(){if(i.apply(this,Array.prototype.slice.apply(arguments)),"undefined"!=typeof this.options.idTable&&!b){var c=parseInt(a(".bootstrap-table").height());c+=10,a("#"+this.options.idTable).bootstrapTable("resetView",{height:c}),b=!0}},g.prototype.initSearch=function(){j.apply(this,Array.prototype.slice.apply(arguments));var b=this,c=a.isEmptyObject(this.filterColumnsPartial)?null:this.filterColumnsPartial;this.data=c?a.grep(this.data,function(e,f){for(var g in c){var h=c[g].toLowerCase(),i=e[g];if(i=d(b.header,b.header.formatters[a.inArray(g,b.header.fields)],[i,e,f],i),-1===a.inArray(g,b.header.fields)||"string"!=typeof i&&"number"!=typeof i||-1===(i+"").toLowerCase().indexOf(h))return!1}return!0}):this.data},g.prototype.onColumnAdvancedSearch=function(b){var c=a.trim(a(b.currentTarget).val()),d=a(b.currentTarget)[0].id;a.isEmptyObject(this.filterColumnsPartial)&&(this.filterColumnsPartial={}),c?this.filterColumnsPartial[d]=c:delete this.filterColumnsPartial[d],this.options.pageNumber=1,this.onSearch(b),this.updatePagination(),this.trigger("column-advanced-search",d,c)}}(jQuery);
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 = function(str) {
14
+ var args = arguments,
15
+ flag = true,
16
+ i = 1;
17
+
18
+ str = str.replace(/%s/g, function() {
19
+ var arg = args[i++];
20
+
21
+ if (typeof arg === 'undefined') {
22
+ flag = false;
23
+ return '';
24
+ }
25
+ return arg;
26
+ });
27
+ return flag ? str : '';
28
+ };
29
+
30
+ var calculateObjectValue = function (self, name, args, defaultValue) {
31
+ if (typeof name === 'string') {
32
+ // support obj.func1.func2
33
+ var names = name.split('.');
34
+
35
+ if (names.length > 1) {
36
+ name = window;
37
+ $.each(names, function (i, f) {
38
+ name = name[f];
39
+ });
40
+ } else {
41
+ name = window[name];
42
+ }
43
+ }
44
+ if (typeof name === 'object') {
45
+ return name;
46
+ }
47
+ if (typeof name === 'function') {
48
+ return name.apply(self, args);
49
+ }
50
+ return defaultValue;
51
+ };
52
+
53
+ var showAvdSearch = function(pColumns, searchTitle, searchText, that) {
54
+ if (!$("#avdSearchModal").hasClass("modal")) {
55
+ var vModal = "<div id=\"avdSearchModal\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"mySmallModalLabel\" aria-hidden=\"true\">";
56
+ vModal += "<div class=\"modal-dialog modal-xs\">";
57
+ vModal += " <div class=\"modal-content\">";
58
+ vModal += " <div class=\"modal-header\">";
59
+ vModal += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\" >&times;</button>";
60
+ vModal += sprintf(" <h4 class=\"modal-title\">%s</h4>", searchTitle);
61
+ vModal += " </div>";
62
+ vModal += " <div class=\"modal-body modal-body-custom\">";
63
+ vModal += " <div class=\"container-fluid\" id=\"avdSearchModalContent\" style=\"padding-right: 0px;padding-left: 0px;\" >";
64
+ vModal += " </div>";
65
+ vModal += " </div>";
66
+ vModal += " </div>";
67
+ vModal += " </div>";
68
+ vModal += "</div>";
69
+
70
+ $("body").append($(vModal));
71
+
72
+ var vFormAvd = createFormAvd(pColumns, searchText, that),
73
+ timeoutId = 0;;
74
+
75
+ $('#avdSearchModalContent').append(vFormAvd.join(''));
76
+
77
+ $('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) {
78
+ clearTimeout(timeoutId);
79
+ timeoutId = setTimeout(function () {
80
+ that.onColumnAdvancedSearch(event);
81
+ }, that.options.searchTimeOut);
82
+ });
83
+
84
+ $("#btnCloseAvd").click(function() {
85
+ $("#avdSearchModal").modal('hide');
86
+ });
87
+
88
+ $("#avdSearchModal").modal();
89
+ } else {
90
+ $("#avdSearchModal").modal();
91
+ }
92
+ };
93
+
94
+ var createFormAvd = function(pColumns, searchText, that) {
95
+ var htmlForm = [];
96
+ htmlForm.push(sprintf('<form class="form-horizontal" id="%s" action="%s" >', that.options.idForm, that.options.actionForm));
97
+ for (var i in pColumns) {
98
+ var vObjCol = pColumns[i];
99
+ if (!vObjCol.checkbox && vObjCol.visible && vObjCol.searchable) {
100
+ htmlForm.push('<div class="form-group">');
101
+ htmlForm.push(sprintf('<label class="col-sm-4 control-label">%s</label>', vObjCol.title));
102
+ htmlForm.push('<div class="col-sm-6">');
103
+ htmlForm.push(sprintf('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">', vObjCol.field, vObjCol.title, vObjCol.field));
104
+ htmlForm.push('</div>');
105
+ htmlForm.push('</div>');
106
+ }
107
+ }
108
+
109
+ htmlForm.push('<div class="form-group">');
110
+ htmlForm.push('<div class="col-sm-offset-9 col-sm-3">');
111
+ htmlForm.push(sprintf('<button type="button" id="btnCloseAvd" class="btn btn-default" >%s</button>', searchText));
112
+ htmlForm.push('</div>');
113
+ htmlForm.push('</div>');
114
+ htmlForm.push('</form>');
115
+
116
+ return htmlForm;
117
+ };
118
+
119
+ $.extend($.fn.bootstrapTable.defaults, {
120
+ advancedSearch: false,
121
+ idForm: 'advancedSearch',
122
+ actionForm: '',
123
+ idTable: undefined,
124
+ onColumnAdvancedSearch: function (field, text) {
125
+ return false;
126
+ }
127
+ });
128
+
129
+ $.extend($.fn.bootstrapTable.defaults.icons, {
130
+ advancedSearchIcon: 'glyphicon-chevron-down'
131
+ });
132
+
133
+ $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
134
+ 'column-advanced-search.bs.table': 'onColumnAdvancedSearch'
135
+ });
136
+
137
+ $.extend($.fn.bootstrapTable.locales, {
138
+ formatAdvancedSearch: function() {
139
+ return 'Advanced search';
140
+ },
141
+ formatAdvancedCloseButton: function() {
142
+ return "Close";
143
+ }
144
+ });
145
+
146
+ $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
147
+
148
+ var BootstrapTable = $.fn.bootstrapTable.Constructor,
149
+ _initToolbar = BootstrapTable.prototype.initToolbar,
150
+ _load = BootstrapTable.prototype.load,
151
+ _initSearch = BootstrapTable.prototype.initSearch;
152
+
153
+ BootstrapTable.prototype.initToolbar = function() {
154
+ _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
155
+
156
+ if (!this.options.search) {
157
+ return;
158
+ }
159
+
160
+ if (!this.options.advancedSearch) {
161
+ return;
162
+ }
163
+
164
+ var that = this,
165
+ html = [];
166
+
167
+ html.push(sprintf('<div class="columns columns-%s btn-group pull-%s" role="group">', this.options.buttonsAlign, this.options.buttonsAlign));
168
+ html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="advancedSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatAdvancedSearch()));
169
+ html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.advancedSearchIcon))
170
+ html.push('</button></div>');
171
+
172
+ that.$toolbar.prepend(html.join(''));
173
+
174
+ that.$toolbar.find('button[name="advancedSearch"]')
175
+ .off('click').on('click', function() {
176
+ showAvdSearch(that.columns, that.options.formatAdvancedSearch(), that.options.formatAdvancedCloseButton(), that);
177
+ });
178
+ };
179
+
180
+ BootstrapTable.prototype.load = function(data) {
181
+ _load.apply(this, Array.prototype.slice.apply(arguments));
182
+
183
+ if (!this.options.advancedSearch) {
184
+ return;
185
+ }
186
+
187
+ if (typeof this.options.idTable === 'undefined') {
188
+ return;
189
+ } else {
190
+ if (!firstLoad) {
191
+ var height = parseInt($(".bootstrap-table").height());
192
+ height += 10;
193
+ $("#" + this.options.idTable).bootstrapTable("resetView", {height: height});
194
+ firstLoad = true;
195
+ }
196
+ }
197
+ };
198
+
199
+ BootstrapTable.prototype.initSearch = function () {
200
+ _initSearch.apply(this, Array.prototype.slice.apply(arguments));
201
+
202
+ if (!this.options.advancedSearch) {
203
+ return;
204
+ }
205
+
206
+ var that = this;
207
+ var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
208
+
209
+ this.data = fp ? $.grep(this.data, function (item, i) {
210
+ for (var key in fp) {
211
+ var fval = fp[key].toLowerCase();
212
+ var value = item[key];
213
+ value = calculateObjectValue(that.header,
214
+ that.header.formatters[$.inArray(key, that.header.fields)],
215
+ [value, item, i], value);
216
+
217
+ if (!($.inArray(key, that.header.fields) !== -1 &&
218
+ (typeof value === 'string' || typeof value === 'number') &&
219
+ (value + '').toLowerCase().indexOf(fval) !== -1)) {
220
+ return false;
221
+ }
222
+ }
223
+ return true;
224
+ }) : this.data;
225
+ };
226
+
227
+ BootstrapTable.prototype.onColumnAdvancedSearch = function (event) {
228
+ var text = $.trim($(event.currentTarget).val());
229
+ var $field = $(event.currentTarget)[0].id;
230
+
231
+ if ($.isEmptyObject(this.filterColumnsPartial)) {
232
+ this.filterColumnsPartial = {};
233
+ }
234
+ if (text) {
235
+ this.filterColumnsPartial[$field] = text;
236
+ } else {
237
+ delete this.filterColumnsPartial[$field];
238
+ }
239
+
240
+ this.options.pageNumber = 1;
241
+ this.onSearch(event);
242
+ this.updatePagination();
243
+ this.trigger('column-advanced-search', $field, text);
244
+ };
245
+ }(jQuery);