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,88 +1,105 @@
1
- /**
2
- * @author Homer Glascock <HopGlascock@gmail.com>
3
- * @version: v1.0.0
4
- */
5
-
6
- !function ($) {
7
- "use strict";
8
-
9
- var sprintf = $.fn.bootstrapTable.utils.sprintf;
10
-
11
- var reInit = function (self) {
12
- self.initHeader();
13
- self.initSearch();
14
- self.initPagination();
15
- self.initBody();
16
- };
17
-
18
- $.extend($.fn.bootstrapTable.defaults, {
19
- showToggleBtn: false,
20
- multiToggleDefaults: [], //column names go here
21
- });
22
-
23
- $.fn.bootstrapTable.methods.push('hideAllColumns', 'showAllColumns');
24
-
25
- var BootstrapTable = $.fn.bootstrapTable.Constructor,
26
- _initToolbar = BootstrapTable.prototype.initToolbar;
27
-
28
- BootstrapTable.prototype.initToolbar = function () {
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.bootstrapTableMultiToggle = mod.exports;
12
+ }
13
+ })(this, function () {
14
+ 'use strict';
15
+
16
+ /**
17
+ * @author Homer Glascock <HopGlascock@gmail.com>
18
+ * @version: v1.0.0
19
+ */
20
+
21
+ !function ($) {
22
+ "use strict";
23
+
24
+ var sprintf = $.fn.bootstrapTable.utils.sprintf;
25
+
26
+ var reInit = function reInit(self) {
27
+ self.initHeader();
28
+ self.initSearch();
29
+ self.initPagination();
30
+ self.initBody();
31
+ };
32
+
33
+ $.extend($.fn.bootstrapTable.defaults, {
34
+ showToggleBtn: false,
35
+ multiToggleDefaults: [] //column names go here
36
+ });
29
37
 
30
- _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
38
+ $.fn.bootstrapTable.methods.push('hideAllColumns', 'showAllColumns');
31
39
 
32
- var that = this,
33
- $btnGroup = this.$toolbar.find('>.btn-group');
40
+ var BootstrapTable = $.fn.bootstrapTable.Constructor,
41
+ _initToolbar = BootstrapTable.prototype.initToolbar;
34
42
 
35
- if (typeof this.options.multiToggleDefaults === 'string') {
36
- this.options.multiToggleDefaults = JSON.parse(this.options.multiToggleDefaults);
37
- }
43
+ BootstrapTable.prototype.initToolbar = function () {
38
44
 
39
- if (this.options.showToggleBtn && this.options.showColumns) {
40
- var showbtn = "<button class='btn btn-default hidden' id='showAllBtn'><span class='glyphicon glyphicon-resize-full icon-zoom-in'></span></button>",
41
- hidebtn = "<button class='btn btn-default' id='hideAllBtn'><span class='glyphicon glyphicon-resize-small icon-zoom-out'></span></button>";
45
+ _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
42
46
 
43
- $btnGroup.append(showbtn + hidebtn);
47
+ var that = this,
48
+ $btnGroup = this.$toolbar.find('>.btn-group');
44
49
 
45
- $btnGroup.find('#showAllBtn').click(function () { that.showAllColumns();
46
- $btnGroup.find('#hideAllBtn').toggleClass('hidden');
47
- $btnGroup.find('#showAllBtn').toggleClass('hidden');
48
- });
49
- $btnGroup.find('#hideAllBtn').click(function () { that.hideAllColumns();
50
- $btnGroup.find('#hideAllBtn').toggleClass('hidden');
51
- $btnGroup.find('#showAllBtn').toggleClass('hidden');
52
- });
53
- }
54
- };
55
-
56
- BootstrapTable.prototype.hideAllColumns = function () {
57
- var that = this,
58
- defaults = that.options.multiToggleDefaults;
50
+ if (typeof this.options.multiToggleDefaults === 'string') {
51
+ this.options.multiToggleDefaults = JSON.parse(this.options.multiToggleDefaults);
52
+ }
59
53
 
60
- $.each(this.columns, function (index, column) {
61
- //if its one of the defaults dont touch it
62
- if (defaults.indexOf(column.field) == -1 && column.switchable) {
63
- column.visible = false;
64
- var $items = that.$toolbar.find('.keep-open input').prop('disabled', false);
65
- $items.filter(sprintf('[value="%s"]', index)).prop('checked', false);
54
+ if (this.options.showToggleBtn && this.options.showColumns) {
55
+ var showbtn = "<button class='btn btn-default hidden' id='showAllBtn'><span class='glyphicon glyphicon-resize-full icon-zoom-in'></span></button>",
56
+ hidebtn = "<button class='btn btn-default' id='hideAllBtn'><span class='glyphicon glyphicon-resize-small icon-zoom-out'></span></button>";
57
+
58
+ $btnGroup.append(showbtn + hidebtn);
59
+
60
+ $btnGroup.find('#showAllBtn').click(function () {
61
+ that.showAllColumns();
62
+ $btnGroup.find('#hideAllBtn').toggleClass('hidden');
63
+ $btnGroup.find('#showAllBtn').toggleClass('hidden');
64
+ });
65
+ $btnGroup.find('#hideAllBtn').click(function () {
66
+ that.hideAllColumns();
67
+ $btnGroup.find('#hideAllBtn').toggleClass('hidden');
68
+ $btnGroup.find('#showAllBtn').toggleClass('hidden');
69
+ });
66
70
  }
67
- });
71
+ };
72
+
73
+ BootstrapTable.prototype.hideAllColumns = function () {
74
+ var that = this,
75
+ defaults = that.options.multiToggleDefaults;
76
+
77
+ $.each(this.columns, function (index, column) {
78
+ //if its one of the defaults dont touch it
79
+ if (defaults.indexOf(column.field) == -1 && column.switchable) {
80
+ column.visible = false;
81
+ var $items = that.$toolbar.find('.keep-open input').prop('disabled', false);
82
+ $items.filter(sprintf('[value="%s"]', index)).prop('checked', false);
83
+ }
84
+ });
68
85
 
69
- reInit(that);
70
- };
86
+ reInit(that);
87
+ };
71
88
 
72
- BootstrapTable.prototype.showAllColumns = function () {
73
- var that = this;
74
- $.each(this.columns, function (index, column) {
75
- if (column.switchable) {
76
- column.visible = true;
77
- }
89
+ BootstrapTable.prototype.showAllColumns = function () {
90
+ var that = this;
91
+ $.each(this.columns, function (index, column) {
92
+ if (column.switchable) {
93
+ column.visible = true;
94
+ }
78
95
 
79
- var $items = that.$toolbar.find('.keep-open input').prop('disabled', false);
80
- $items.filter(sprintf('[value="%s"]', index)).prop('checked', true);
81
- });
96
+ var $items = that.$toolbar.find('.keep-open input').prop('disabled', false);
97
+ $items.filter(sprintf('[value="%s"]', index)).prop('checked', true);
98
+ });
82
99
 
83
- reInit(that);
100
+ reInit(that);
84
101
 
85
- that.toggleColumn(0, that.columns[0].visible, false);
86
- };
87
-
88
- }(jQuery);
102
+ that.toggleColumn(0, that.columns[0].visible, false);
103
+ };
104
+ }(jQuery);
105
+ });
@@ -1,71 +1,85 @@
1
- /**
2
- * @author: Dennis Hernández
3
- * @webSite: http://djhvscf.github.io/Blog
4
- * @version: v1.0.0
5
- */
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.bootstrapTableMultipleSearch = mod.exports;
12
+ }
13
+ })(this, function () {
14
+ 'use strict';
6
15
 
7
- !function ($) {
16
+ /**
17
+ * @author: Dennis Hernández
18
+ * @webSite: http://djhvscf.github.io/Blog
19
+ * @version: v1.0.0
20
+ */
8
21
 
9
- 'use strict';
22
+ !function ($) {
10
23
 
11
- $.extend($.fn.bootstrapTable.defaults, {
12
- multipleSearch: false,
13
- delimeter: " "
14
- });
24
+ 'use strict';
15
25
 
16
- var BootstrapTable = $.fn.bootstrapTable.Constructor,
17
- _initSearch = BootstrapTable.prototype.initSearch;
26
+ $.extend($.fn.bootstrapTable.defaults, {
27
+ multipleSearch: false,
28
+ delimeter: " "
29
+ });
18
30
 
19
- BootstrapTable.prototype.initSearch = function () {
20
- if (this.options.multipleSearch) {
21
- if (this.searchText === undefined) {
22
- return;
23
- }
24
- var strArray = this.searchText.split(this.options.delimeter),
25
- that = this,
26
- f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns,
27
- dataFiltered = [];
31
+ var BootstrapTable = $.fn.bootstrapTable.Constructor,
32
+ _initSearch = BootstrapTable.prototype.initSearch;
28
33
 
29
- if (strArray.length === 1) {
30
- _initSearch.apply(this, Array.prototype.slice.apply(arguments));
31
- } else {
32
- for (var i = 0; i < strArray.length; i++) {
33
- var str = strArray[i].trim();
34
- dataFiltered = str ? $.grep(dataFiltered.length === 0 ? this.options.data : dataFiltered, function (item, i) {
35
- for (var key in item) {
36
- key = $.isNumeric(key) ? parseInt(key, 10) : key;
37
- var value = item[key],
38
- column = that.columns[that.fieldsColumnsIndex[key]],
39
- j = $.inArray(key, that.header.fields);
34
+ BootstrapTable.prototype.initSearch = function () {
35
+ if (this.options.multipleSearch) {
36
+ if (this.searchText === undefined) {
37
+ return;
38
+ }
39
+ var strArray = this.searchText.split(this.options.delimeter),
40
+ that = this,
41
+ f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns,
42
+ dataFiltered = [];
40
43
 
41
- // Fix #142: search use formated data
42
- if (column && column.searchFormatter) {
43
- value = $.fn.bootstrapTable.utils.calculateObjectValue(column,
44
- that.header.formatters[j], [value, item, i], value);
45
- }
44
+ if (strArray.length === 1) {
45
+ _initSearch.apply(this, Array.prototype.slice.apply(arguments));
46
+ } else {
47
+ for (var i = 0; i < strArray.length; i++) {
48
+ var str = strArray[i].trim();
49
+ dataFiltered = str ? $.grep(dataFiltered.length === 0 ? this.options.data : dataFiltered, function (item, i) {
50
+ for (var key in item) {
51
+ key = $.isNumeric(key) ? parseInt(key, 10) : key;
52
+ var value = item[key],
53
+ column = that.columns[that.fieldsColumnsIndex[key]],
54
+ j = $.inArray(key, that.header.fields);
46
55
 
47
- var index = $.inArray(key, that.header.fields);
48
- if (index !== -1 && that.header.searchables[index] && (typeof value === 'string' || typeof value === 'number')) {
49
- if (that.options.strictSearch) {
50
- if ((value + '').toLowerCase() === str) {
51
- return true;
52
- }
53
- } else {
54
- if ((value + '').toLowerCase().indexOf(str) !== -1) {
55
- return true;
56
+ // Fix #142: search use formated data
57
+ if (column && column.searchFormatter) {
58
+ value = $.fn.bootstrapTable.utils.calculateObjectValue(column, that.header.formatters[j], [value, item, i], value);
59
+ }
60
+
61
+ var index = $.inArray(key, that.header.fields);
62
+ if (index !== -1 && that.header.searchables[index] && (typeof value === 'string' || typeof value === 'number')) {
63
+ if (that.options.strictSearch) {
64
+ if ((value + '').toLowerCase() === str) {
65
+ return true;
66
+ }
67
+ } else {
68
+ if ((value + '').toLowerCase().indexOf(str) !== -1) {
69
+ return true;
70
+ }
56
71
  }
57
72
  }
58
73
  }
59
- }
60
- return false;
61
- }) : this.data;
62
- }
74
+ return false;
75
+ }) : this.data;
76
+ }
63
77
 
64
- this.data = dataFiltered;
78
+ this.data = dataFiltered;
79
+ }
80
+ } else {
81
+ _initSearch.apply(this, Array.prototype.slice.apply(arguments));
65
82
  }
66
- } else {
67
- _initSearch.apply(this, Array.prototype.slice.apply(arguments));
68
- }
69
- };
70
-
71
- }(jQuery);
83
+ };
84
+ }(jQuery);
85
+ });
@@ -1,127 +1,143 @@
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
- document.onselectstart = function() {
12
- return false;
13
- };
14
-
15
- var getTableObjectFromCurrentTarget = function (currentTarget) {
16
- currentTarget = $(currentTarget);
17
- return currentTarget.is("table") ? currentTarget : currentTarget.parents().find(".table");
18
- };
19
-
20
- var getRow = function (target) {
21
- target = $(target);
22
- return target.parent().parent();
23
- };
24
-
25
- var onRowClick = function (e) {
26
- var that = getTableObjectFromCurrentTarget(e.currentTarget);
27
-
28
- if (window.event.ctrlKey) {
29
- toggleRow(e.currentTarget, that, false, false);
30
- }
31
-
32
- if (window.event.button === 0) {
33
- if (!window.event.ctrlKey && !window.event.shiftKey) {
34
- clearAll(that);
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.bootstrapTableMultipleSelectionRow = mod.exports;
12
+ }
13
+ })(this, function () {
14
+ "use strict";
15
+
16
+ /**
17
+ * @author: Dennis Hernández
18
+ * @webSite: http://djhvscf.github.io/Blog
19
+ * @version: v1.0.0
20
+ */
21
+
22
+ !function ($) {
23
+
24
+ 'use strict';
25
+
26
+ document.onselectstart = function () {
27
+ return false;
28
+ };
29
+
30
+ var getTableObjectFromCurrentTarget = function getTableObjectFromCurrentTarget(currentTarget) {
31
+ currentTarget = $(currentTarget);
32
+ return currentTarget.is("table") ? currentTarget : currentTarget.parents().find(".table");
33
+ };
34
+
35
+ var getRow = function getRow(target) {
36
+ target = $(target);
37
+ return target.parent().parent();
38
+ };
39
+
40
+ var onRowClick = function onRowClick(e) {
41
+ var that = getTableObjectFromCurrentTarget(e.currentTarget);
42
+
43
+ if (window.event.ctrlKey) {
35
44
  toggleRow(e.currentTarget, that, false, false);
36
45
  }
37
46
 
38
- if (window.event.shiftKey) {
39
- selectRowsBetweenIndexes([that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow.rowIndex, e.currentTarget.rowIndex], that)
47
+ if (window.event.button === 0) {
48
+ if (!window.event.ctrlKey && !window.event.shiftKey) {
49
+ clearAll(that);
50
+ toggleRow(e.currentTarget, that, false, false);
51
+ }
52
+
53
+ if (window.event.shiftKey) {
54
+ selectRowsBetweenIndexes([that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow.rowIndex, e.currentTarget.rowIndex], that);
55
+ }
40
56
  }
41
- }
42
- };
43
-
44
- var onCheckboxChange = function (e) {
45
- var that = getTableObjectFromCurrentTarget(e.currentTarget);
46
- clearAll(that);
47
- toggleRow(getRow(e.currentTarget), that, false, false);
48
- };
49
-
50
- var toggleRow = function (row, that, clearAll, useShift) {
51
- if (clearAll) {
52
- row = $(row);
53
- that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow = undefined;
54
- row.removeClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
55
- that.bootstrapTable("uncheck", row.data("index"));
56
- } else {
57
- that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow = row;
58
- row = $(row);
59
- if (useShift) {
60
- row.addClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
61
- that.bootstrapTable("check", row.data("index"));
57
+ };
58
+
59
+ var onCheckboxChange = function onCheckboxChange(e) {
60
+ var that = getTableObjectFromCurrentTarget(e.currentTarget);
61
+ clearAll(that);
62
+ toggleRow(getRow(e.currentTarget), that, false, false);
63
+ };
64
+
65
+ var toggleRow = function toggleRow(row, that, clearAll, useShift) {
66
+ if (clearAll) {
67
+ row = $(row);
68
+ that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow = undefined;
69
+ row.removeClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
70
+ that.bootstrapTable("uncheck", row.data("index"));
62
71
  } else {
63
- if(row.hasClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass)) {
64
- row.removeClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass)
65
- that.bootstrapTable("uncheck", row.data("index"));
66
- } else {
72
+ that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow = row;
73
+ row = $(row);
74
+ if (useShift) {
67
75
  row.addClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
68
- that.bootstrapTable("check", row.data("index"));
76
+ that.bootstrapTable("check", row.data("index"));
77
+ } else {
78
+ if (row.hasClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass)) {
79
+ row.removeClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
80
+ that.bootstrapTable("uncheck", row.data("index"));
81
+ } else {
82
+ row.addClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
83
+ that.bootstrapTable("check", row.data("index"));
84
+ }
69
85
  }
70
86
  }
71
- }
72
- };
87
+ };
88
+
89
+ var selectRowsBetweenIndexes = function selectRowsBetweenIndexes(indexes, that) {
90
+ indexes.sort(function (a, b) {
91
+ return a - b;
92
+ });
93
+
94
+ for (var i = indexes[0]; i <= indexes[1]; i++) {
95
+ toggleRow(that.bootstrapTable("getOptions").multipleSelectRowRows[i - 1], that, false, true);
96
+ }
97
+ };
73
98
 
74
- var selectRowsBetweenIndexes = function (indexes, that) {
75
- indexes.sort(function(a, b) {
76
- return a - b;
99
+ var clearAll = function clearAll(that) {
100
+ for (var i = 0; i < that.bootstrapTable("getOptions").multipleSelectRowRows.length; i++) {
101
+ toggleRow(that.bootstrapTable("getOptions").multipleSelectRowRows[i], that, true, false);
102
+ }
103
+ };
104
+
105
+ $.extend($.fn.bootstrapTable.defaults, {
106
+ multipleSelectRow: false,
107
+ multipleSelectRowCssClass: 'multiple-select-row-selected',
108
+ //internal variables used by the extension
109
+ multipleSelectRowLastSelectedRow: undefined,
110
+ multipleSelectRowRows: []
77
111
  });
78
112
 
79
- for (var i = indexes[0]; i <= indexes[1]; i++) {
80
- toggleRow(that.bootstrapTable("getOptions").multipleSelectRowRows[i-1], that, false, true);
81
- }
82
- };
83
-
84
- var clearAll = function (that) {
85
- for (var i = 0; i < that.bootstrapTable("getOptions").multipleSelectRowRows.length; i++) {
86
- toggleRow(that.bootstrapTable("getOptions").multipleSelectRowRows[i], that, true, false);
87
- }
88
- };
89
-
90
- $.extend($.fn.bootstrapTable.defaults, {
91
- multipleSelectRow: false,
92
- multipleSelectRowCssClass: 'multiple-select-row-selected',
93
- //internal variables used by the extension
94
- multipleSelectRowLastSelectedRow: undefined,
95
- multipleSelectRowRows: []
96
- });
97
-
98
- var BootstrapTable = $.fn.bootstrapTable.Constructor,
99
- _init = BootstrapTable.prototype.init,
100
- _initBody = BootstrapTable.prototype.initBody;
101
-
102
- BootstrapTable.prototype.init = function () {
103
- if (this.options.multipleSelectRow) {
104
- var that = this;
105
-
106
- //Make sure that the internal variables have the correct value
107
- this.options.multipleSelectRowLastSelectedRow = undefined;
108
- this.options.multipleSelectRowRows = [];
109
-
110
- this.$el.on("post-body.bs.table", function (e) {
111
- setTimeout(function () {
112
- that.options.multipleSelectRowRows = that.$body.children();
113
- that.options.multipleSelectRowRows.click(onRowClick);
114
- that.options.multipleSelectRowRows.find("input[type=checkbox]").change(onCheckboxChange);
115
- }, 1);
116
- });
117
- }
113
+ var BootstrapTable = $.fn.bootstrapTable.Constructor,
114
+ _init = BootstrapTable.prototype.init,
115
+ _initBody = BootstrapTable.prototype.initBody;
116
+
117
+ BootstrapTable.prototype.init = function () {
118
+ if (this.options.multipleSelectRow) {
119
+ var that = this;
120
+
121
+ //Make sure that the internal variables have the correct value
122
+ this.options.multipleSelectRowLastSelectedRow = undefined;
123
+ this.options.multipleSelectRowRows = [];
124
+
125
+ this.$el.on("post-body.bs.table", function (e) {
126
+ setTimeout(function () {
127
+ that.options.multipleSelectRowRows = that.$body.children();
128
+ that.options.multipleSelectRowRows.click(onRowClick);
129
+ that.options.multipleSelectRowRows.find("input[type=checkbox]").change(onCheckboxChange);
130
+ }, 1);
131
+ });
132
+ }
118
133
 
119
- _init.apply(this, Array.prototype.slice.apply(arguments));
120
- };
134
+ _init.apply(this, Array.prototype.slice.apply(arguments));
135
+ };
121
136
 
122
- BootstrapTable.prototype.clearAllMultipleSelectionRow = function () {
123
- clearAll(this);
124
- };
137
+ BootstrapTable.prototype.clearAllMultipleSelectionRow = function () {
138
+ clearAll(this);
139
+ };
125
140
 
126
- $.fn.bootstrapTable.methods.push('clearAllMultipleSelectionRow');
127
- }(jQuery);
141
+ $.fn.bootstrapTable.methods.push('clearAllMultipleSelectionRow');
142
+ }(jQuery);
143
+ });