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.
- checksums.yaml +4 -4
- data/README.md +10 -12
- data/lib/bootstrap-table-rails/version.rb +1 -1
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-locale-all.js +2534 -1841
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.css +202 -283
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.js +3114 -2555
- data/vendor/assets/javascripts/bootstrap-table/extensions/accent-neutralise/bootstrap-table-accent-neutralise.js +247 -152
- data/vendor/assets/javascripts/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js +271 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js +77 -68
- data/vendor/assets/javascripts/bootstrap-table/extensions/cookie/bootstrap-table-cookie.js +452 -315
- data/vendor/assets/javascripts/bootstrap-table/extensions/copy-rows/bootstrap-table-copy-rows.js +105 -86
- data/vendor/assets/javascripts/bootstrap-table/extensions/defer-url/bootstrap-table-defer-url.js +44 -27
- data/vendor/assets/javascripts/bootstrap-table/extensions/editable/bootstrap-table-editable.js +229 -115
- data/vendor/assets/javascripts/bootstrap-table/extensions/export/bootstrap-table-export.js +319 -162
- data/vendor/assets/javascripts/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.js +733 -566
- data/vendor/assets/javascripts/bootstrap-table/extensions/group-by-v2/bootstrap-table-group-by.js +175 -167
- data/vendor/assets/javascripts/bootstrap-table/extensions/group-by/bootstrap-table-group-by.js +227 -213
- data/vendor/assets/javascripts/bootstrap-table/extensions/i18n-enhance/bootstrap-table-i18n-enhance.js +44 -29
- data/vendor/assets/javascripts/bootstrap-table/extensions/key-events/bootstrap-table-key-events.js +92 -70
- data/vendor/assets/javascripts/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js +134 -118
- data/vendor/assets/javascripts/bootstrap-table/extensions/multi-column-toggle/bootstrap-table-multi-toggle.js +92 -75
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-search/bootstrap-table-multiple-search.js +72 -58
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-selection-row/bootstrap-table-multiple-selection-row.js +129 -113
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-sort/bootstrap-table-multiple-sort.js +362 -349
- data/vendor/assets/javascripts/bootstrap-table/extensions/natural-sorting/bootstrap-table-natural-sorting.js +66 -50
- data/vendor/assets/javascripts/bootstrap-table/extensions/{page-jumpto/bootstrap-table-jumpto.css → page-jump-to/bootstrap-table-page-jump-to.css} +0 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/page-jump-to/bootstrap-table-page-jump-to.js +58 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/pipeline/bootstrap-table-pipeline.js +341 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/print/bootstrap-table-print.js +122 -126
- data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-columns/bootstrap-table-reorder-columns.js +183 -167
- data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js +124 -110
- data/vendor/assets/javascripts/bootstrap-table/extensions/resizable/bootstrap-table-resizable.js +66 -55
- data/vendor/assets/javascripts/bootstrap-table/extensions/select2-filter/bootstrap-table-select2-filter.js +281 -272
- data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.css +13 -13
- data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.js +182 -106
- data/vendor/assets/javascripts/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.js +324 -162
- data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.js +127 -115
- data/vendor/assets/javascripts/bootstrap-table/extensions/treegrid/bootstrap-table-treegrid.js +106 -96
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-af-ZA.js +48 -35
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ar-SA.js +49 -35
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ca-ES.js +52 -39
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-cs-CZ.js +52 -39
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-da-DK.js +60 -32
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-de-DE.js +61 -48
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-el-GR.js +36 -23
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-en-US.js +57 -44
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-AR.js +39 -26
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CL.js +54 -41
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CR.js +48 -35
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-ES.js +103 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-MX.js +59 -46
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-NI.js +48 -35
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-SP.js +49 -36
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-et-EE.js +51 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-eu-EU.js +51 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fa-IR.js +51 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fi-FI.js +62 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-BE.js +36 -23
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-FR.js +103 -90
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-he-IL.js +51 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hr-HR.js +52 -39
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hu-HU.js +51 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-id-ID.js +57 -44
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-it-IT.js +59 -47
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ja-JP.js +51 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ka-GE.js +49 -36
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ko-KR.js +45 -32
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ms-MY.js +51 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nb-NO.js +45 -32
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-NL.js +60 -47
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pl-PL.js +45 -32
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-BR.js +49 -36
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-PT.js +51 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ro-RO.js +51 -38
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ru-RU.js +82 -68
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sk-SK.js +57 -44
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sv-SE.js +45 -32
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-th-TH.js +45 -32
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-tr-TR.js +49 -36
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uk-UA.js +82 -69
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ur-PK.js +45 -32
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uz-Latn-UZ.js +57 -44
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-vi-VN.js +36 -23
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-CN.js +54 -41
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-TW.js +48 -35
- metadata +6 -8
- data/vendor/assets/javascripts/bootstrap-table/extensions/angular/bootstrap-table-angular.js +0 -107
- data/vendor/assets/javascripts/bootstrap-table/extensions/click-edit-row/bootstrap-table-click-edit-row.css +0 -21
- data/vendor/assets/javascripts/bootstrap-table/extensions/click-edit-row/bootstrap-table-click-edit-row.js +0 -142
- data/vendor/assets/javascripts/bootstrap-table/extensions/filter/bootstrap-table-filter.js +0 -67
- data/vendor/assets/javascripts/bootstrap-table/extensions/flat-json/bootstrap-table-flat-json.js +0 -62
- data/vendor/assets/javascripts/bootstrap-table/extensions/page-jumpto/bootstrap-table-jumpto.js +0 -50
@@ -1,84 +1,93 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
-
|
16
|
+
/**
|
17
|
+
* @author: Alec Fenichel
|
18
|
+
* @webSite: https://fenichelar.com
|
19
|
+
* @version: v1.0.0
|
20
|
+
*/
|
8
21
|
|
9
|
-
|
22
|
+
(function ($) {
|
10
23
|
|
11
|
-
|
12
|
-
autoRefresh: false,
|
13
|
-
autoRefreshInterval: 60,
|
14
|
-
autoRefreshSilent: true,
|
15
|
-
autoRefreshStatus: true,
|
16
|
-
autoRefreshFunction: null
|
17
|
-
});
|
24
|
+
'use strict';
|
18
25
|
|
19
|
-
|
20
|
-
|
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
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
38
|
+
$.extend($.fn.bootstrapTable.locales, {
|
39
|
+
formatAutoRefresh: function formatAutoRefresh() {
|
40
|
+
return 'Auto Refresh';
|
41
|
+
}
|
42
|
+
});
|
30
43
|
|
31
|
-
|
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
|
-
|
37
|
-
_init
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
48
|
-
|
62
|
+
BootstrapTable.prototype.initToolbar = function () {
|
63
|
+
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
49
64
|
|
50
|
-
|
51
|
-
|
52
|
-
|
65
|
+
if (this.options.autoRefresh) {
|
66
|
+
var $btnGroup = this.$toolbar.find('>.btn-group');
|
67
|
+
var $btnAutoRefresh = $btnGroup.find('.auto-refresh');
|
53
68
|
|
54
|
-
|
55
|
-
|
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
|
-
|
72
|
+
$btnAutoRefresh.on('click', $.proxy(this.toggleAutoRefresh, this));
|
73
|
+
}
|
64
74
|
}
|
65
|
-
}
|
66
|
-
};
|
75
|
+
};
|
67
76
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
})(jQuery);
|
91
|
+
};
|
92
|
+
})(jQuery);
|
93
|
+
});
|
@@ -1,413 +1,550 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
118
|
+
searchControls = 'table select, table input';
|
35
119
|
}
|
36
120
|
|
37
121
|
return searchControls;
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
58
|
-
|
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
|
-
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
167
|
+
return null;
|
93
168
|
}
|
94
169
|
|
95
|
-
if (inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
|
96
|
-
|
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
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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
|
-
|
139
|
-
|
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
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
202
|
-
|
203
|
-
|
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
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
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
|
-
|
232
|
-
|
295
|
+
setCookie: UtilsCookie.setCookie,
|
296
|
+
getCookie: UtilsCookie.getCookie
|
233
297
|
});
|
234
298
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
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
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
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
|
-
|
277
|
-
}).on('
|
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
|
-
|
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
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
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
|
-
|
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
|
-
|
294
|
-
|
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
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
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
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
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
|
-
|
335
|
-
|
336
|
-
|
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
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
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
|
-
|
347
|
-
|
348
|
-
|
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
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
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
|
-
|
360
|
-
|
361
|
-
|
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
|
-
|
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
|
-
|
448
|
+
var visibleColumns = [];
|
369
449
|
|
370
|
-
|
450
|
+
$.each(this.columns, function (i, column) {
|
371
451
|
if (column.visible) {
|
372
|
-
|
452
|
+
visibleColumns.push(column.field);
|
373
453
|
}
|
374
|
-
|
375
|
-
|
376
|
-
setCookie(this, cookieIds.columns, JSON.stringify(visibleColumns));
|
377
|
-
};
|
454
|
+
});
|
378
455
|
|
379
|
-
|
380
|
-
|
381
|
-
|
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
|
-
|
385
|
-
|
386
|
-
|
479
|
+
for (var _len9 = arguments.length, args = Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
480
|
+
args[_key9] = arguments[_key9];
|
481
|
+
}
|
387
482
|
|
388
|
-
|
389
|
-
|
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
|
-
|
392
|
-
|
486
|
+
}, {
|
487
|
+
key: 'initCookie',
|
488
|
+
value: function initCookie() {
|
489
|
+
if (!this.options.cookie) {
|
490
|
+
return;
|
491
|
+
}
|
393
492
|
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
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
|
-
|
531
|
+
cookies[key] = JSON.parse(cookies[key]);
|
401
532
|
}
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
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
|
-
|
412
|
-
};
|
413
|
-
})(jQuery);
|
547
|
+
return _class;
|
548
|
+
}($.BootstrapTable);
|
549
|
+
})(jQuery);
|
550
|
+
});
|