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,84 +1,93 @@
1
- /**
2
- * @author: Alec Fenichel
3
- * @webSite: https://fenichelar.com
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.bootstrapTableAutoRefresh = mod.exports;
12
+ }
13
+ })(this, function () {
14
+ 'use strict';
6
15
 
7
- (function ($) {
16
+ /**
17
+ * @author: Alec Fenichel
18
+ * @webSite: https://fenichelar.com
19
+ * @version: v1.0.0
20
+ */
8
21
 
9
- 'use strict';
22
+ (function ($) {
10
23
 
11
- $.extend($.fn.bootstrapTable.defaults, {
12
- autoRefresh: false,
13
- autoRefreshInterval: 60,
14
- autoRefreshSilent: true,
15
- autoRefreshStatus: true,
16
- autoRefreshFunction: null
17
- });
24
+ 'use strict';
18
25
 
19
- $.extend($.fn.bootstrapTable.defaults.icons, {
20
- autoRefresh: 'glyphicon-time icon-time'
21
- });
26
+ $.extend($.fn.bootstrapTable.defaults, {
27
+ autoRefresh: false,
28
+ autoRefreshInterval: 60,
29
+ autoRefreshSilent: true,
30
+ autoRefreshStatus: true,
31
+ autoRefreshFunction: null
32
+ });
22
33
 
23
- $.extend($.fn.bootstrapTable.locales, {
24
- formatAutoRefresh: function() {
25
- return 'Auto Refresh';
26
- }
27
- });
34
+ $.extend($.fn.bootstrapTable.defaults.icons, {
35
+ autoRefresh: $.fn.bootstrapTable.utils.bootstrapVersion === 4 ? 'fa-clock' : 'glyphicon-time icon-time'
36
+ });
28
37
 
29
- $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
38
+ $.extend($.fn.bootstrapTable.locales, {
39
+ formatAutoRefresh: function formatAutoRefresh() {
40
+ return 'Auto Refresh';
41
+ }
42
+ });
30
43
 
31
- var BootstrapTable = $.fn.bootstrapTable.Constructor;
32
- var _init = BootstrapTable.prototype.init;
33
- var _initToolbar = BootstrapTable.prototype.initToolbar;
34
- var sprintf = $.fn.bootstrapTable.utils.sprintf;
44
+ $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
35
45
 
36
- BootstrapTable.prototype.init = function () {
37
- _init.apply(this, Array.prototype.slice.apply(arguments));
46
+ var BootstrapTable = $.fn.bootstrapTable.Constructor;
47
+ var _init = BootstrapTable.prototype.init;
48
+ var _initToolbar = BootstrapTable.prototype.initToolbar;
49
+ var sprintf = $.fn.bootstrapTable.utils.sprintf;
38
50
 
39
- if (this.options.autoRefresh && this.options.autoRefreshStatus) {
40
- var that = this;
41
- this.options.autoRefreshFunction = setInterval(function () {
42
- that.refresh({silent: that.options.autoRefreshSilent});
43
- }, this.options.autoRefreshInterval*1000);
44
- }
45
- };
51
+ BootstrapTable.prototype.init = function () {
52
+ _init.apply(this, Array.prototype.slice.apply(arguments));
53
+
54
+ if (this.options.autoRefresh && this.options.autoRefreshStatus) {
55
+ var that = this;
56
+ this.options.autoRefreshFunction = setInterval(function () {
57
+ that.refresh({ silent: that.options.autoRefreshSilent });
58
+ }, this.options.autoRefreshInterval * 1000);
59
+ }
60
+ };
46
61
 
47
- BootstrapTable.prototype.initToolbar = function() {
48
- _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
62
+ BootstrapTable.prototype.initToolbar = function () {
63
+ _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
49
64
 
50
- if (this.options.autoRefresh) {
51
- var $btnGroup = this.$toolbar.find('>.btn-group');
52
- var $btnAutoRefresh = $btnGroup.find('.auto-refresh');
65
+ if (this.options.autoRefresh) {
66
+ var $btnGroup = this.$toolbar.find('>.btn-group');
67
+ var $btnAutoRefresh = $btnGroup.find('.auto-refresh');
53
68
 
54
- if (!$btnAutoRefresh.length) {
55
- $btnAutoRefresh = $([
56
- sprintf('<button class="btn btn-default auto-refresh %s" ', this.options.autoRefreshStatus ? 'enabled' : ''),
57
- 'type="button" ',
58
- sprintf('title="%s">', this.options.formatAutoRefresh()),
59
- sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.autoRefresh),
60
- '</button>'
61
- ].join('')).appendTo($btnGroup);
69
+ if (!$btnAutoRefresh.length) {
70
+ $btnAutoRefresh = $([sprintf('<button class="btn btn-default auto-refresh %s" ', this.options.autoRefreshStatus ? 'enabled' : ''), 'type="button" ', sprintf('title="%s">', this.options.formatAutoRefresh()), sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.autoRefresh), '</button>'].join('')).appendTo($btnGroup);
62
71
 
63
- $btnAutoRefresh.on('click', $.proxy(this.toggleAutoRefresh, this));
72
+ $btnAutoRefresh.on('click', $.proxy(this.toggleAutoRefresh, this));
73
+ }
64
74
  }
65
- }
66
- };
75
+ };
67
76
 
68
- BootstrapTable.prototype.toggleAutoRefresh = function() {
69
- if (this.options.autoRefresh) {
70
- if (this.options.autoRefreshStatus) {
71
- clearInterval(this.options.autoRefreshFunction);
72
- this.$toolbar.find('>.btn-group').find('.auto-refresh').removeClass('enabled');
73
- } else {
74
- var that = this;
75
- this.options.autoRefreshFunction = setInterval(function () {
76
- that.refresh({silent: that.options.autoRefreshSilent});
77
- }, this.options.autoRefreshInterval*1000);
78
- this.$toolbar.find('>.btn-group').find('.auto-refresh').addClass('enabled');
77
+ BootstrapTable.prototype.toggleAutoRefresh = function () {
78
+ if (this.options.autoRefresh) {
79
+ if (this.options.autoRefreshStatus) {
80
+ clearInterval(this.options.autoRefreshFunction);
81
+ this.$toolbar.find('>.btn-group').find('.auto-refresh').removeClass('enabled');
82
+ } else {
83
+ var that = this;
84
+ this.options.autoRefreshFunction = setInterval(function () {
85
+ that.refresh({ silent: that.options.autoRefreshSilent });
86
+ }, this.options.autoRefreshInterval * 1000);
87
+ this.$toolbar.find('>.btn-group').find('.auto-refresh').addClass('enabled');
88
+ }
89
+ this.options.autoRefreshStatus = !this.options.autoRefreshStatus;
79
90
  }
80
- this.options.autoRefreshStatus = !this.options.autoRefreshStatus;
81
- }
82
- };
83
-
84
- })(jQuery);
91
+ };
92
+ })(jQuery);
93
+ });
@@ -1,413 +1,550 @@
1
- /**
2
- * @author: Dennis Hernández
3
- * @webSite: http://djhvscf.github.io/Blog
4
- * @version: v1.2.3
5
- *
6
- * @update zhixin wen <wenzhixin2010@gmail.com>
7
- */
8
-
9
- (function ($) {
10
- 'use strict';
11
-
12
- var cookieIds = {
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.bootstrapTableCookie = 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: Dennis Hernández
91
+ * @webSite: http://djhvscf.github.io/Blog
92
+ * @update zhixin wen <wenzhixin2010@gmail.com>
93
+ */
94
+
95
+ (function ($) {
96
+ var UtilsCookie = {
97
+ cookieIds: {
13
98
  sortOrder: 'bs.table.sortOrder',
14
99
  sortName: 'bs.table.sortName',
15
100
  pageNumber: 'bs.table.pageNumber',
16
101
  pageList: 'bs.table.pageList',
17
102
  columns: 'bs.table.columns',
18
103
  searchText: 'bs.table.searchText',
19
- filterControl: 'bs.table.filterControl'
20
- };
21
-
22
- var getCurrentHeader = function (that) {
104
+ filterControl: 'bs.table.filterControl',
105
+ filterBy: 'bs.table.filterBy'
106
+ },
107
+ getCurrentHeader: function getCurrentHeader(that) {
23
108
  var header = that.$header;
24
109
  if (that.options.height) {
25
- header = that.$tableHeader;
110
+ header = that.$tableHeader;
26
111
  }
27
112
 
28
113
  return header;
29
- };
30
-
31
- var getCurrentSearchControls = function (that) {
114
+ },
115
+ getCurrentSearchControls: function getCurrentSearchControls(that) {
32
116
  var searchControls = 'select, input';
33
117
  if (that.options.height) {
34
- searchControls = 'table select, table input';
118
+ searchControls = 'table select, table input';
35
119
  }
36
120
 
37
121
  return searchControls;
38
- };
39
-
40
- var cookieEnabled = function () {
41
- return !!(navigator.cookieEnabled);
42
- };
43
-
44
- var inArrayCookiesEnabled = function (cookieName, cookiesEnabled) {
122
+ },
123
+ cookieEnabled: function cookieEnabled() {
124
+ return !!navigator.cookieEnabled;
125
+ },
126
+ inArrayCookiesEnabled: function inArrayCookiesEnabled(cookieName, cookiesEnabled) {
45
127
  var index = -1;
46
128
 
47
129
  for (var i = 0; i < cookiesEnabled.length; i++) {
48
- if (cookieName.toLowerCase() === cookiesEnabled[i].toLowerCase()) {
49
- index = i;
50
- break;
51
- }
130
+ if (cookieName.toLowerCase() === cookiesEnabled[i].toLowerCase()) {
131
+ index = i;
132
+ break;
133
+ }
52
134
  }
53
135
 
54
136
  return index;
55
- };
56
-
57
- var setCookie = function (that, cookieName, cookieValue) {
58
- if ((!that.options.cookie) || (!cookieEnabled()) || (that.options.cookieIdTable === '')) {
59
- return;
137
+ },
138
+ setCookie: function setCookie(that, cookieName, cookieValue) {
139
+ if (!that.options.cookie || !UtilsCookie.cookieEnabled() || that.options.cookieIdTable === '') {
140
+ return;
60
141
  }
61
142
 
62
- if (inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
63
- return;
143
+ if (UtilsCookie.inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
144
+ return;
64
145
  }
65
146
 
66
147
  cookieName = that.options.cookieIdTable + '.' + cookieName;
67
148
 
68
- switch(that.options.cookieStorage) {
69
- case 'cookieStorage':
70
- document.cookie = [
71
- cookieName, '=', cookieValue,
72
- '; expires=' + calculateExpiration(that.options.cookieExpire),
73
- that.options.cookiePath ? '; path=' + that.options.cookiePath : '',
74
- that.options.cookieDomain ? '; domain=' + that.options.cookieDomain : '',
75
- that.options.cookieSecure ? '; secure' : ''
76
- ].join('');
77
- case 'localStorage':
78
- localStorage.setItem(cookieName, cookieValue);
79
- break;
80
- case 'sessionStorage':
81
- sessionStorage.setItem(cookieName, cookieValue);
82
- break;
83
- default:
84
- return false;
149
+ switch (that.options.cookieStorage) {
150
+ case 'cookieStorage':
151
+ document.cookie = [cookieName, '=', encodeURIComponent(cookieValue), '; expires=' + UtilsCookie.calculateExpiration(that.options.cookieExpire), that.options.cookiePath ? '; path=' + that.options.cookiePath : '', that.options.cookieDomain ? '; domain=' + that.options.cookieDomain : '', that.options.cookieSecure ? '; secure' : ''].join('');
152
+ break;
153
+ case 'localStorage':
154
+ localStorage.setItem(cookieName, cookieValue);
155
+ break;
156
+ case 'sessionStorage':
157
+ sessionStorage.setItem(cookieName, cookieValue);
158
+ break;
159
+ default:
160
+ return false;
85
161
  }
86
162
 
87
163
  return true;
88
- };
89
-
90
- var getCookie = function (that, tableName, cookieName) {
164
+ },
165
+ getCookie: function getCookie(that, tableName, cookieName) {
91
166
  if (!cookieName) {
92
- return null;
167
+ return null;
93
168
  }
94
169
 
95
- if (inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
96
- return null;
170
+ if (UtilsCookie.inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
171
+ return null;
97
172
  }
98
173
 
99
174
  cookieName = tableName + '.' + cookieName;
100
175
 
101
- switch(that.options.cookieStorage) {
102
- case 'cookieStorage':
103
- var value = '; ' + document.cookie;
104
- var parts = value.split('; ' + cookieName + '=');
105
- return parts.length === 2 ? parts.pop().split(';').shift() : null;
106
- case 'localStorage':
107
- return localStorage.getItem(cookieName);
108
- case 'sessionStorage':
109
- return sessionStorage.getItem(cookieName);
110
- default:
111
- return null;
176
+ switch (that.options.cookieStorage) {
177
+ case 'cookieStorage':
178
+ var value = '; ' + document.cookie;
179
+ var parts = value.split('; ' + cookieName + '=');
180
+ return parts.length === 2 ? decodeURIComponent(parts.pop().split(';').shift()) : null;
181
+ case 'localStorage':
182
+ return localStorage.getItem(cookieName);
183
+ case 'sessionStorage':
184
+ return sessionStorage.getItem(cookieName);
185
+ default:
186
+ return null;
112
187
  }
113
- };
114
-
115
- var deleteCookie = function (that, tableName, cookieName) {
188
+ },
189
+ deleteCookie: function deleteCookie(that, tableName, cookieName) {
116
190
  cookieName = tableName + '.' + cookieName;
117
191
 
118
- switch(that.options.cookieStorage) {
119
- case 'cookieStorage':
120
- document.cookie = [
121
- encodeURIComponent(cookieName), '=',
122
- '; expires=Thu, 01 Jan 1970 00:00:00 GMT',
123
- that.options.cookiePath ? '; path=' + that.options.cookiePath : '',
124
- that.options.cookieDomain ? '; domain=' + that.options.cookieDomain : '',
125
- ].join('');
126
- break;
127
- case 'localStorage':
128
- localStorage.removeItem(cookieName);
129
- break;
130
- case 'sessionStorage':
131
- sessionStorage.removeItem(cookieName);
132
- break;
133
-
192
+ switch (that.options.cookieStorage) {
193
+ case 'cookieStorage':
194
+ document.cookie = [encodeURIComponent(cookieName), '=', '; expires=Thu, 01 Jan 1970 00:00:00 GMT', that.options.cookiePath ? '; path=' + that.options.cookiePath : '', that.options.cookieDomain ? '; domain=' + that.options.cookieDomain : ''].join('');
195
+ break;
196
+ case 'localStorage':
197
+ localStorage.removeItem(cookieName);
198
+ break;
199
+ case 'sessionStorage':
200
+ sessionStorage.removeItem(cookieName);
201
+ break;
202
+ default:
203
+ return false;
134
204
  }
135
205
  return true;
136
- };
137
-
138
- var calculateExpiration = function(cookieExpire) {
139
- var time = cookieExpire.replace(/[0-9]*/, ''); //s,mi,h,d,m,y
140
- cookieExpire = cookieExpire.replace(/[A-Za-z]{1,2}/, ''); //number
206
+ },
207
+ calculateExpiration: function calculateExpiration(cookieExpire) {
208
+ var time = cookieExpire.replace(/[0-9]*/, ''); // s,mi,h,d,m,y
209
+ cookieExpire = cookieExpire.replace(/[A-Za-z]{1,2}/, ''); // number
141
210
 
142
211
  switch (time.toLowerCase()) {
143
- case 's':
144
- cookieExpire = +cookieExpire;
145
- break;
146
- case 'mi':
147
- cookieExpire = cookieExpire * 60;
148
- break;
149
- case 'h':
150
- cookieExpire = cookieExpire * 60 * 60;
151
- break;
152
- case 'd':
153
- cookieExpire = cookieExpire * 24 * 60 * 60;
154
- break;
155
- case 'm':
156
- cookieExpire = cookieExpire * 30 * 24 * 60 * 60;
157
- break;
158
- case 'y':
159
- cookieExpire = cookieExpire * 365 * 24 * 60 * 60;
160
- break;
161
- default:
162
- cookieExpire = undefined;
163
- break;
212
+ case 's':
213
+ cookieExpire = +cookieExpire;
214
+ break;
215
+ case 'mi':
216
+ cookieExpire *= 60;
217
+ break;
218
+ case 'h':
219
+ cookieExpire = cookieExpire * 60 * 60;
220
+ break;
221
+ case 'd':
222
+ cookieExpire = cookieExpire * 24 * 60 * 60;
223
+ break;
224
+ case 'm':
225
+ cookieExpire = cookieExpire * 30 * 24 * 60 * 60;
226
+ break;
227
+ case 'y':
228
+ cookieExpire = cookieExpire * 365 * 24 * 60 * 60;
229
+ break;
230
+ default:
231
+ cookieExpire = undefined;
232
+ break;
164
233
  }
165
234
  if (!cookieExpire) {
166
- return '';
235
+ return '';
167
236
  }
168
237
  var d = new Date();
169
238
  d.setTime(d.getTime() + cookieExpire * 1000);
170
239
  return d.toGMTString();
171
- };
172
-
173
- var initCookieFilters = function (bootstrapTable) {
240
+ },
241
+ initCookieFilters: function initCookieFilters(bootstrapTable) {
174
242
  setTimeout(function () {
175
- var parsedCookieFilters = JSON.parse(getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, cookieIds.filterControl));
176
-
177
- if (!bootstrapTable.options.filterControlValuesLoaded && parsedCookieFilters) {
178
-
179
- var cachedFilters = {},
180
- header = getCurrentHeader(bootstrapTable),
181
- searchControls = getCurrentSearchControls(bootstrapTable),
182
-
183
- applyCookieFilters = function (element, filteredCookies) {
184
- $(filteredCookies).each(function (i, cookie) {
185
- if (cookie.text !== '') {
186
- $(element).val(cookie.text);
187
- cachedFilters[cookie.field] = cookie.text;
188
- }
189
- });
190
- };
191
-
192
- header.find(searchControls).each(function () {
193
- var field = $(this).closest('[data-field]').data('field'),
194
- filteredCookies = $.grep(parsedCookieFilters, function (cookie) {
195
- return cookie.field === field;
196
- });
197
-
198
- applyCookieFilters(this, filteredCookies);
199
- });
243
+ var parsedCookieFilters = JSON.parse(UtilsCookie.getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, UtilsCookie.cookieIds.filterControl));
200
244
 
201
- bootstrapTable.initColumnSearch(cachedFilters);
202
- bootstrapTable.options.filterControlValuesLoaded = true;
203
- bootstrapTable.initServer();
204
- }
245
+ if (!bootstrapTable.options.filterControlValuesLoaded && parsedCookieFilters) {
246
+
247
+ var cachedFilters = {};
248
+ var header = UtilsCookie.getCurrentHeader(bootstrapTable);
249
+ var searchControls = UtilsCookie.getCurrentSearchControls(bootstrapTable);
250
+
251
+ var applyCookieFilters = function applyCookieFilters(element, filteredCookies) {
252
+ $(filteredCookies).each(function (i, cookie) {
253
+ if (cookie.text !== '') {
254
+ $(element).val(cookie.text);
255
+ cachedFilters[cookie.field] = cookie.text;
256
+ }
257
+ });
258
+ };
259
+
260
+ header.find(searchControls).each(function () {
261
+ var field = $(this).closest('[data-field]').data('field');
262
+ var filteredCookies = parsedCookieFilters.filter(function (cookie) {
263
+ return cookie.field === field;
264
+ });
265
+
266
+ applyCookieFilters(this, filteredCookies);
267
+ });
268
+
269
+ bootstrapTable.initColumnSearch(cachedFilters);
270
+ bootstrapTable.options.filterControlValuesLoaded = true;
271
+ bootstrapTable.initServer();
272
+ }
205
273
  }, 250);
274
+ }
206
275
  };
207
276
 
208
277
  $.extend($.fn.bootstrapTable.defaults, {
209
- cookie: false,
210
- cookieExpire: '2h',
211
- cookiePath: null,
212
- cookieDomain: null,
213
- cookieSecure: null,
214
- cookieIdTable: '',
215
- cookiesEnabled: [
216
- 'bs.table.sortOrder', 'bs.table.sortName',
217
- 'bs.table.pageNumber', 'bs.table.pageList',
218
- 'bs.table.columns', 'bs.table.searchText',
219
- 'bs.table.filterControl'
220
- ],
221
- cookieStorage: 'cookieStorage', //localStorage, sessionStorage
222
- //internal variable
223
- filterControls: [],
224
- filterControlValuesLoaded: false
278
+ cookie: false,
279
+ cookieExpire: '2h',
280
+ cookiePath: null,
281
+ cookieDomain: null,
282
+ cookieSecure: null,
283
+ cookieIdTable: '',
284
+ cookiesEnabled: ['bs.table.sortOrder', 'bs.table.sortName', 'bs.table.pageNumber', 'bs.table.pageList', 'bs.table.columns', 'bs.table.searchText', 'bs.table.filterControl', 'bs.table.filterBy'],
285
+ cookieStorage: 'cookieStorage', // localStorage, sessionStorage
286
+ // internal variable
287
+ filterControls: [],
288
+ filterControlValuesLoaded: false
225
289
  });
226
290
 
227
291
  $.fn.bootstrapTable.methods.push('getCookies');
228
292
  $.fn.bootstrapTable.methods.push('deleteCookie');
229
293
 
230
294
  $.extend($.fn.bootstrapTable.utils, {
231
- setCookie: setCookie,
232
- getCookie: getCookie
295
+ setCookie: UtilsCookie.setCookie,
296
+ getCookie: UtilsCookie.getCookie
233
297
  });
234
298
 
235
- var BootstrapTable = $.fn.bootstrapTable.Constructor,
236
- _init = BootstrapTable.prototype.init,
237
- _initTable = BootstrapTable.prototype.initTable,
238
- _initServer = BootstrapTable.prototype.initServer,
239
- _onSort = BootstrapTable.prototype.onSort,
240
- _onPageNumber = BootstrapTable.prototype.onPageNumber,
241
- _onPageListChange = BootstrapTable.prototype.onPageListChange,
242
- _onPagePre = BootstrapTable.prototype.onPagePre,
243
- _onPageNext = BootstrapTable.prototype.onPageNext,
244
- _toggleColumn = BootstrapTable.prototype.toggleColumn,
245
- _selectPage = BootstrapTable.prototype.selectPage,
246
- _onSearch = BootstrapTable.prototype.onSearch;
247
-
248
- BootstrapTable.prototype.init = function () {
249
- this.options.filterControls = [];
250
- this.options.filterControlValuesLoaded = false;
251
-
252
- this.options.cookiesEnabled = typeof this.options.cookiesEnabled === 'string' ?
253
- this.options.cookiesEnabled.replace('[', '').replace(']', '')
254
- .replace(/ /g, '').toLowerCase().split(',') :
255
- this.options.cookiesEnabled;
256
-
257
- if (this.options.filterControl) {
299
+ $.BootstrapTable = function (_$$BootstrapTable) {
300
+ _inherits(_class, _$$BootstrapTable);
301
+
302
+ function _class() {
303
+ _classCallCheck(this, _class);
304
+
305
+ return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
306
+ }
307
+
308
+ _createClass(_class, [{
309
+ key: 'init',
310
+ value: function init() {
311
+ // FilterBy logic
312
+ var filterByCookie = JSON.parse(UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.filterBy));
313
+ this.filterColumns = filterByCookie ? filterByCookie : {};
314
+
315
+ // FilterControl logic
316
+ this.options.filterControls = [];
317
+ this.options.filterControlValuesLoaded = false;
318
+
319
+ this.options.cookiesEnabled = typeof this.options.cookiesEnabled === 'string' ? this.options.cookiesEnabled.replace('[', '').replace(']', '').replace(/ /g, '').toLowerCase().split(',') : this.options.cookiesEnabled;
320
+
321
+ if (this.options.filterControl) {
258
322
  var that = this;
259
323
  this.$el.on('column-search.bs.table', function (e, field, text) {
260
- var isNewField = true;
261
-
262
- for (var i = 0; i < that.options.filterControls.length; i++) {
263
- if (that.options.filterControls[i].field === field) {
264
- that.options.filterControls[i].text = text;
265
- isNewField = false;
266
- break;
267
- }
268
- }
269
- if (isNewField) {
270
- that.options.filterControls.push({
271
- field: field,
272
- text: text
273
- });
324
+ var isNewField = true;
325
+
326
+ for (var i = 0; i < that.options.filterControls.length; i++) {
327
+ if (that.options.filterControls[i].field === field) {
328
+ that.options.filterControls[i].text = text;
329
+ isNewField = false;
330
+ break;
274
331
  }
332
+ }
333
+ if (isNewField) {
334
+ that.options.filterControls.push({
335
+ field: field,
336
+ text: text
337
+ });
338
+ }
275
339
 
276
- setCookie(that, cookieIds.filterControl, JSON.stringify(that.options.filterControls));
277
- }).on('post-body.bs.table', initCookieFilters(that));
340
+ UtilsCookie.setCookie(that, UtilsCookie.cookieIds.filterControl, JSON.stringify(that.options.filterControls));
341
+ }).on('created-controls.bs.table', UtilsCookie.initCookieFilters(that));
342
+ }
343
+ _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'init', this).call(this);
278
344
  }
279
- _init.apply(this, Array.prototype.slice.apply(arguments));
280
- };
345
+ }, {
346
+ key: 'initServer',
347
+ value: function initServer() {
348
+ var _get2;
349
+
350
+ if (this.options.cookie && this.options.filterControl && !this.options.filterControlValuesLoaded) {
351
+ var cookie = JSON.parse(UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.filterControl));
352
+ if (cookie) {
353
+ return;
354
+ }
355
+ }
281
356
 
282
- BootstrapTable.prototype.initServer = function () {
283
- var bootstrapTable = this;
284
- if (bootstrapTable.options.cookie && bootstrapTable.options.filterControl && !bootstrapTable.options.filterControlValuesLoaded) {
285
- var cookie = JSON.parse(getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, cookieIds.filterControl));
286
- if (cookie)
287
- return;
357
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
358
+ args[_key] = arguments[_key];
359
+ }
360
+
361
+ (_get2 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initServer', this)).call.apply(_get2, [this].concat(args));
288
362
  }
289
- _initServer.apply(this, Array.prototype.slice.apply(arguments));
290
- };
363
+ }, {
364
+ key: 'initTable',
365
+ value: function initTable() {
366
+ var _get3;
291
367
 
368
+ for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
369
+ args[_key2] = arguments[_key2];
370
+ }
292
371
 
293
- BootstrapTable.prototype.initTable = function () {
294
- _initTable.apply(this, Array.prototype.slice.apply(arguments));
295
- this.initCookie();
296
- };
297
-
298
- BootstrapTable.prototype.initCookie = function () {
299
- if (!this.options.cookie) {
300
- return;
372
+ (_get3 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initTable', this)).call.apply(_get3, [this].concat(args));
373
+ this.initCookie();
301
374
  }
302
-
303
- if ((this.options.cookieIdTable === '') || (this.options.cookieExpire === '') || (!cookieEnabled())) {
304
- console.error("Configuration error. Please review the cookieIdTable, cookieExpire properties, if those properties are ok, then this browser does not support the cookies");
305
- this.options.cookie = false; //Make sure that the cookie extension is disabled
306
- return;
375
+ }, {
376
+ key: 'onSort',
377
+ value: function onSort() {
378
+ var _get4;
379
+
380
+ for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
381
+ args[_key3] = arguments[_key3];
382
+ }
383
+
384
+ (_get4 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'onSort', this)).call.apply(_get4, [this].concat(args));
385
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortOrder, this.options.sortOrder);
386
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortName, this.options.sortName);
307
387
  }
388
+ }, {
389
+ key: 'onPageNumber',
390
+ value: function onPageNumber() {
391
+ var _get5;
308
392
 
309
- var sortOrderCookie = getCookie(this, this.options.cookieIdTable, cookieIds.sortOrder),
310
- sortOrderNameCookie = getCookie(this, this.options.cookieIdTable, cookieIds.sortName),
311
- pageNumberCookie = getCookie(this, this.options.cookieIdTable, cookieIds.pageNumber),
312
- pageListCookie = getCookie(this, this.options.cookieIdTable, cookieIds.pageList),
313
- columnsCookie = JSON.parse(getCookie(this, this.options.cookieIdTable, cookieIds.columns)),
314
- searchTextCookie = getCookie(this, this.options.cookieIdTable, cookieIds.searchText);
315
-
316
- //sortOrder
317
- this.options.sortOrder = sortOrderCookie ? sortOrderCookie : this.options.sortOrder;
318
- //sortName
319
- this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : this.options.sortName;
320
- //pageNumber
321
- this.options.pageNumber = pageNumberCookie ? +pageNumberCookie : this.options.pageNumber;
322
- //pageSize
323
- this.options.pageSize = pageListCookie ? pageListCookie === this.options.formatAllRows() ? pageListCookie : +pageListCookie : this.options.pageSize;
324
- //searchText
325
- this.options.searchText = searchTextCookie ? searchTextCookie : '';
326
-
327
- if (columnsCookie) {
328
- $.each(this.columns, function (i, column) {
329
- column.visible = $.inArray(column.field, columnsCookie) !== -1;
330
- });
393
+ for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
394
+ args[_key4] = arguments[_key4];
395
+ }
396
+
397
+ (_get5 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'onPageNumber', this)).call.apply(_get5, [this].concat(args));
398
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
331
399
  }
332
- };
400
+ }, {
401
+ key: 'onPageListChange',
402
+ value: function onPageListChange() {
403
+ var _get6;
404
+
405
+ for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
406
+ args[_key5] = arguments[_key5];
407
+ }
408
+
409
+ (_get6 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'onPageListChange', this)).call.apply(_get6, [this].concat(args));
410
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageList, this.options.pageSize);
411
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
412
+ }
413
+ }, {
414
+ key: 'onPagePre',
415
+ value: function onPagePre() {
416
+ var _get7;
333
417
 
334
- BootstrapTable.prototype.onSort = function () {
335
- _onSort.apply(this, Array.prototype.slice.apply(arguments));
336
- setCookie(this, cookieIds.sortOrder, this.options.sortOrder);
337
- setCookie(this, cookieIds.sortName, this.options.sortName);
338
- };
418
+ for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
419
+ args[_key6] = arguments[_key6];
420
+ }
339
421
 
340
- BootstrapTable.prototype.onPageNumber = function () {
341
- _onPageNumber.apply(this, Array.prototype.slice.apply(arguments));
342
- setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
343
- return false;
344
- };
422
+ (_get7 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'onPagePre', this)).call.apply(_get7, [this].concat(args));
423
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
424
+ }
425
+ }, {
426
+ key: 'onPageNext',
427
+ value: function onPageNext() {
428
+ var _get8;
345
429
 
346
- BootstrapTable.prototype.onPageListChange = function () {
347
- _onPageListChange.apply(this, Array.prototype.slice.apply(arguments));
348
- setCookie(this, cookieIds.pageList, this.options.pageSize);
349
- setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
350
- return false;
351
- };
430
+ for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
431
+ args[_key7] = arguments[_key7];
432
+ }
352
433
 
353
- BootstrapTable.prototype.onPagePre = function () {
354
- _onPagePre.apply(this, Array.prototype.slice.apply(arguments));
355
- setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
356
- return false;
357
- };
434
+ (_get8 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'onPageNext', this)).call.apply(_get8, [this].concat(args));
435
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
436
+ }
437
+ }, {
438
+ key: 'toggleColumn',
439
+ value: function toggleColumn() {
440
+ var _get9;
358
441
 
359
- BootstrapTable.prototype.onPageNext = function () {
360
- _onPageNext.apply(this, Array.prototype.slice.apply(arguments));
361
- setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
362
- return false;
363
- };
442
+ for (var _len8 = arguments.length, args = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
443
+ args[_key8] = arguments[_key8];
444
+ }
364
445
 
365
- BootstrapTable.prototype.toggleColumn = function () {
366
- _toggleColumn.apply(this, Array.prototype.slice.apply(arguments));
446
+ (_get9 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'toggleColumn', this)).call.apply(_get9, [this].concat(args));
367
447
 
368
- var visibleColumns = [];
448
+ var visibleColumns = [];
369
449
 
370
- $.each(this.columns, function (i, column) {
450
+ $.each(this.columns, function (i, column) {
371
451
  if (column.visible) {
372
- visibleColumns.push(column.field);
452
+ visibleColumns.push(column.field);
373
453
  }
374
- });
375
-
376
- setCookie(this, cookieIds.columns, JSON.stringify(visibleColumns));
377
- };
454
+ });
378
455
 
379
- BootstrapTable.prototype.selectPage = function (page) {
380
- _selectPage.apply(this, Array.prototype.slice.apply(arguments));
381
- setCookie(this, cookieIds.pageNumber, page);
382
- };
456
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns, JSON.stringify(visibleColumns));
457
+ }
458
+ }, {
459
+ key: 'selectPage',
460
+ value: function selectPage(page) {
461
+ _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'selectPage', this).call(this, page);
462
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, page);
463
+ }
464
+ }, {
465
+ key: 'onSearch',
466
+ value: function onSearch(event) {
467
+ _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'onSearch', this).call(this, event);
468
+
469
+ if ($(event.currentTarget).parent().hasClass('search')) {
470
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.searchText, this.searchText);
471
+ }
472
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
473
+ }
474
+ }, {
475
+ key: 'filterBy',
476
+ value: function filterBy() {
477
+ var _get10;
383
478
 
384
- BootstrapTable.prototype.onSearch = function () {
385
- var target = Array.prototype.slice.apply(arguments);
386
- _onSearch.apply(this, target);
479
+ for (var _len9 = arguments.length, args = Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
480
+ args[_key9] = arguments[_key9];
481
+ }
387
482
 
388
- if ($(target[0].currentTarget).parent().hasClass('search')) {
389
- setCookie(this, cookieIds.searchText, this.searchText);
483
+ (_get10 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'filterBy', this)).call.apply(_get10, [this].concat(args));
484
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.filterBy, JSON.stringify(this.filterColumns));
390
485
  }
391
- setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
392
- };
486
+ }, {
487
+ key: 'initCookie',
488
+ value: function initCookie() {
489
+ if (!this.options.cookie) {
490
+ return;
491
+ }
393
492
 
394
- BootstrapTable.prototype.getCookies = function () {
395
- var bootstrapTable = this;
396
- var cookies = {};
397
- $.each(cookieIds, function(key, value) {
398
- cookies[key] = getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, value);
493
+ if (this.options.cookieIdTable === '' || this.options.cookieExpire === '' || !UtilsCookie.cookieEnabled()) {
494
+ console.error('Configuration error. Please review the cookieIdTable and the cookieExpire property. If the properties are correct, then this browser does not support cookies.');
495
+ this.options.cookie = false; // Make sure that the cookie extension is disabled
496
+ return;
497
+ }
498
+
499
+ var sortOrderCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortOrder);
500
+ var sortOrderNameCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortName);
501
+ var pageNumberCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.pageNumber);
502
+ var pageListCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.pageList);
503
+ var columnsCookie = JSON.parse(UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.columns));
504
+ var searchTextCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.searchText);
505
+
506
+ // sortOrder
507
+ this.options.sortOrder = sortOrderCookie ? sortOrderCookie : this.options.sortOrder;
508
+ // sortName
509
+ this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : this.options.sortName;
510
+ // pageNumber
511
+ this.options.pageNumber = pageNumberCookie ? +pageNumberCookie : this.options.pageNumber;
512
+ // pageSize
513
+ this.options.pageSize = pageListCookie ? pageListCookie === this.options.formatAllRows() ? pageListCookie : +pageListCookie : this.options.pageSize;
514
+ // searchText
515
+ this.options.searchText = searchTextCookie ? searchTextCookie : '';
516
+
517
+ if (columnsCookie) {
518
+ $.each(this.columns, function (i, column) {
519
+ column.visible = $.inArray(column.field, columnsCookie) !== -1;
520
+ });
521
+ }
522
+ }
523
+ }, {
524
+ key: 'getCookies',
525
+ value: function getCookies() {
526
+ var bootstrapTable = this;
527
+ var cookies = {};
528
+ $.each(UtilsCookie.cookieIds, function (key, value) {
529
+ cookies[key] = UtilsCookie.getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, value);
399
530
  if (key === 'columns') {
400
- cookies[key] = JSON.parse(cookies[key]);
531
+ cookies[key] = JSON.parse(cookies[key]);
401
532
  }
402
- });
403
- return cookies;
404
- };
405
-
406
- BootstrapTable.prototype.deleteCookie = function (cookieName) {
407
- if ((cookieName === '') || (!cookieEnabled())) {
533
+ });
534
+ return cookies;
535
+ }
536
+ }, {
537
+ key: 'deleteCookie',
538
+ value: function deleteCookie(cookieName) {
539
+ if (cookieName === '' || !UtilsCookie.cookieEnabled()) {
408
540
  return;
541
+ }
542
+
543
+ UtilsCookie.deleteCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds[cookieName]);
409
544
  }
545
+ }]);
410
546
 
411
- deleteCookie(this, this.options.cookieIdTable, cookieIds[cookieName]);
412
- };
413
- })(jQuery);
547
+ return _class;
548
+ }($.BootstrapTable);
549
+ })(jQuery);
550
+ });