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
data/vendor/assets/javascripts/bootstrap-table/extensions/copy-rows/bootstrap-table-copy-rows.js
CHANGED
@@ -1,102 +1,121 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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.bootstrapTableCopyRows = 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 calculateObjectValue = $.fn.bootstrapTable.utils.calculateObjectValue,
|
25
|
+
sprintf = $.fn.bootstrapTable.utils.sprintf;
|
26
|
+
|
27
|
+
var copytext = function copytext(text) {
|
28
|
+
var textField = document.createElement('textarea');
|
29
|
+
$(textField).html(text);
|
30
|
+
document.body.appendChild(textField);
|
31
|
+
textField.select();
|
32
|
+
|
33
|
+
try {
|
34
|
+
document.execCommand('copy');
|
35
|
+
} catch (e) {
|
36
|
+
console.log("Oops, unable to copy");
|
37
|
+
}
|
38
|
+
$(textField).remove();
|
39
|
+
};
|
26
40
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
41
|
+
$.extend($.fn.bootstrapTable.defaults, {
|
42
|
+
copyBtn: false,
|
43
|
+
copyWHiddenBtn: false,
|
44
|
+
copyDelemeter: ", "
|
45
|
+
});
|
32
46
|
|
33
|
-
|
47
|
+
$.fn.bootstrapTable.methods.push('copyColumnsToClipboard', 'copyColumnsToClipboardWithHidden');
|
34
48
|
|
35
|
-
|
36
|
-
|
49
|
+
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
50
|
+
_initToolbar = BootstrapTable.prototype.initToolbar;
|
37
51
|
|
38
|
-
|
52
|
+
BootstrapTable.prototype.initToolbar = function () {
|
39
53
|
|
40
|
-
|
54
|
+
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
41
55
|
|
42
|
-
|
43
|
-
|
56
|
+
var that = this,
|
57
|
+
$btnGroup = this.$toolbar.find('>.btn-group');
|
44
58
|
|
45
|
-
|
59
|
+
if (this.options.clickToSelect || this.options.singleSelect) {
|
46
60
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
61
|
+
if (this.options.copyBtn) {
|
62
|
+
var copybtn = "<button class='btn btn-default' id='copyBtn'><span class='glyphicon glyphicon-copy icon-pencil'></span></button>";
|
63
|
+
$btnGroup.append(copybtn);
|
64
|
+
$btnGroup.find('#copyBtn').click(function () {
|
65
|
+
that.copyColumnsToClipboard();
|
66
|
+
});
|
67
|
+
}
|
52
68
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
69
|
+
if (this.options.copyWHiddenBtn) {
|
70
|
+
var copyhiddenbtn = "<button class='btn btn-default' id='copyWHiddenBtn'><span class='badge'><span class='glyphicon glyphicon-copy icon-pencil'></span></span></button>";
|
71
|
+
$btnGroup.append(copyhiddenbtn);
|
72
|
+
$btnGroup.find('#copyWHiddenBtn').click(function () {
|
73
|
+
that.copyColumnsToClipboardWithHidden();
|
74
|
+
});
|
75
|
+
}
|
57
76
|
}
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
77
|
+
};
|
78
|
+
|
79
|
+
BootstrapTable.prototype.copyColumnsToClipboard = function () {
|
80
|
+
var that = this,
|
81
|
+
ret = "",
|
82
|
+
delimet = this.options.copyDelemeter;
|
83
|
+
|
84
|
+
$.each(that.getSelections(), function (index, row) {
|
85
|
+
$.each(that.options.columns[0], function (indy, column) {
|
86
|
+
if (column.field !== "state" && column.field !== "RowNumber" && column.visible) {
|
87
|
+
if (row[column.field] !== null) {
|
88
|
+
ret += calculateObjectValue(column, that.header.formatters[indy], [row[column.field], row, index], row[column.field]);
|
89
|
+
}
|
90
|
+
ret += delimet;
|
71
91
|
}
|
72
|
-
|
73
|
-
}
|
74
|
-
});
|
75
|
-
|
76
|
-
ret += "\r\n";
|
77
|
-
});
|
92
|
+
});
|
78
93
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
BootstrapTable.prototype.copyColumnsToClipboardWithHidden = function () {
|
83
|
-
var that = this,
|
84
|
-
ret = "",
|
85
|
-
delimet = this.options.copyDelemeter;
|
94
|
+
ret += "\r\n";
|
95
|
+
});
|
86
96
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
97
|
+
copytext(ret);
|
98
|
+
};
|
99
|
+
|
100
|
+
BootstrapTable.prototype.copyColumnsToClipboardWithHidden = function () {
|
101
|
+
var that = this,
|
102
|
+
ret = "",
|
103
|
+
delimet = this.options.copyDelemeter;
|
104
|
+
|
105
|
+
$.each(that.getSelections(), function (index, row) {
|
106
|
+
$.each(that.options.columns[0], function (indy, column) {
|
107
|
+
if (column.field != "state" && column.field !== "RowNumber") {
|
108
|
+
if (row[column.field] !== null) {
|
109
|
+
ret += calculateObjectValue(column, that.header.formatters[indy], [row[column.field], row, index], row[column.field]);
|
110
|
+
}
|
111
|
+
ret += delimet;
|
92
112
|
}
|
93
|
-
|
94
|
-
}
|
95
|
-
});
|
113
|
+
});
|
96
114
|
|
97
|
-
|
98
|
-
|
115
|
+
ret += "\r\n";
|
116
|
+
});
|
99
117
|
|
100
|
-
|
101
|
-
|
102
|
-
}(jQuery);
|
118
|
+
copytext(ret);
|
119
|
+
};
|
120
|
+
}(jQuery);
|
121
|
+
});
|
data/vendor/assets/javascripts/bootstrap-table/extensions/defer-url/bootstrap-table-defer-url.js
CHANGED
@@ -1,32 +1,49 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
*/
|
15
|
-
|
16
|
-
(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.bootstrapTableDeferUrl = mod.exports;
|
12
|
+
}
|
13
|
+
})(this, function () {
|
17
14
|
'use strict';
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
/**
|
17
|
+
* When using server-side processing, the default mode of operation for
|
18
|
+
* bootstrap-table is to simply throw away any data that currently exists in the
|
19
|
+
* table and make a request to the server to get the first page of data to
|
20
|
+
* display. This is fine for an empty table, but if you already have the first
|
21
|
+
* page of data displayed in the plain HTML, it is a waste of resources. As
|
22
|
+
* such, you can use data-defer-url instead of data-url to allow you to instruct
|
23
|
+
* bootstrap-table to not make that initial request, rather it will use the data
|
24
|
+
* already on the page.
|
25
|
+
*
|
26
|
+
* @author: Ruben Suarez
|
27
|
+
* @webSite: http://rubensa.eu.org
|
28
|
+
* @version: v1.0.0
|
29
|
+
*/
|
22
30
|
|
23
|
-
|
31
|
+
(function ($) {
|
32
|
+
'use strict';
|
24
33
|
|
25
|
-
|
26
|
-
|
34
|
+
$.extend($.fn.bootstrapTable.defaults, {
|
35
|
+
deferUrl: undefined
|
36
|
+
});
|
27
37
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
38
|
+
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
39
|
+
_init = BootstrapTable.prototype.init;
|
40
|
+
|
41
|
+
BootstrapTable.prototype.init = function () {
|
42
|
+
_init.apply(this, Array.prototype.slice.apply(arguments));
|
43
|
+
|
44
|
+
if (this.options.deferUrl) {
|
45
|
+
this.options.url = this.options.deferUrl;
|
46
|
+
}
|
47
|
+
};
|
48
|
+
})(jQuery);
|
49
|
+
});
|
data/vendor/assets/javascripts/bootstrap-table/extensions/editable/bootstrap-table-editable.js
CHANGED
@@ -1,146 +1,260 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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.bootstrapTableEditable = 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;
|
5
64
|
|
6
|
-
(
|
65
|
+
if (getter === undefined) {
|
66
|
+
return undefined;
|
67
|
+
}
|
7
68
|
|
8
|
-
|
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 zhixin wen <wenzhixin2010@gmail.com>
|
91
|
+
* extensions: https://github.com/vitalets/x-editable
|
92
|
+
*/
|
93
|
+
|
94
|
+
(function ($) {
|
95
|
+
var Utils = $.fn.bootstrapTable.utils;
|
9
96
|
|
10
97
|
$.extend($.fn.bootstrapTable.defaults, {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
98
|
+
editable: true,
|
99
|
+
onEditableInit: function onEditableInit() {
|
100
|
+
return false;
|
101
|
+
},
|
102
|
+
onEditableSave: function onEditableSave(field, row, oldValue, $el) {
|
103
|
+
return false;
|
104
|
+
},
|
105
|
+
onEditableShown: function onEditableShown(field, row, $el, editable) {
|
106
|
+
return false;
|
107
|
+
},
|
108
|
+
onEditableHidden: function onEditableHidden(field, row, $el, reason) {
|
109
|
+
return false;
|
110
|
+
}
|
24
111
|
});
|
25
112
|
|
26
113
|
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
114
|
+
'editable-init.bs.table': 'onEditableInit',
|
115
|
+
'editable-save.bs.table': 'onEditableSave',
|
116
|
+
'editable-shown.bs.table': 'onEditableShown',
|
117
|
+
'editable-hidden.bs.table': 'onEditableHidden'
|
31
118
|
});
|
32
119
|
|
33
|
-
|
34
|
-
|
35
|
-
|
120
|
+
$.BootstrapTable = function (_$$BootstrapTable) {
|
121
|
+
_inherits(_class, _$$BootstrapTable);
|
122
|
+
|
123
|
+
function _class() {
|
124
|
+
_classCallCheck(this, _class);
|
125
|
+
|
126
|
+
return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
|
127
|
+
}
|
36
128
|
|
37
|
-
|
38
|
-
|
39
|
-
|
129
|
+
_createClass(_class, [{
|
130
|
+
key: 'initTable',
|
131
|
+
value: function initTable() {
|
132
|
+
var _this2 = this;
|
40
133
|
|
41
|
-
|
134
|
+
_get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initTable', this).call(this);
|
135
|
+
|
136
|
+
if (!this.options.editable) {
|
42
137
|
return;
|
43
|
-
|
138
|
+
}
|
44
139
|
|
45
|
-
|
140
|
+
$.each(this.columns, function (i, column) {
|
46
141
|
if (!column.editable) {
|
47
|
-
|
142
|
+
return;
|
48
143
|
}
|
49
144
|
|
50
|
-
var editableOptions = {}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
editableOptions[dataKey] = value;
|
62
|
-
}
|
145
|
+
var editableOptions = {};
|
146
|
+
var editableDataMarkup = [];
|
147
|
+
var editableDataPrefix = 'editable-';
|
148
|
+
var processDataOptions = function processDataOptions(key, value) {
|
149
|
+
// Replace camel case with dashes.
|
150
|
+
var dashKey = key.replace(/([A-Z])/g, function ($1) {
|
151
|
+
return '-' + $1.toLowerCase();
|
152
|
+
});
|
153
|
+
if (dashKey.indexOf(editableDataPrefix) === 0) {
|
154
|
+
editableOptions[dashKey.replace(editableDataPrefix, 'data-')] = value;
|
155
|
+
}
|
63
156
|
};
|
64
157
|
|
65
|
-
$.each(
|
158
|
+
$.each(_this2.options, processDataOptions);
|
66
159
|
|
67
|
-
column.formatter = column.formatter || function(value
|
68
|
-
|
160
|
+
column.formatter = column.formatter || function (value) {
|
161
|
+
return value;
|
69
162
|
};
|
70
163
|
column._formatter = column._formatter ? column._formatter : column.formatter;
|
71
|
-
column.formatter = function(value, row, index) {
|
72
|
-
|
73
|
-
|
74
|
-
$.each(column, processDataOptions);
|
75
|
-
|
76
|
-
$.each(editableOptions, function(key, value) {
|
77
|
-
editableDataMarkup.push(' ' + key + '="' + value + '"');
|
78
|
-
});
|
79
|
-
|
80
|
-
var _dont_edit_formatter = false;
|
81
|
-
if (column.editable.hasOwnProperty('noeditFormatter')) {
|
82
|
-
_dont_edit_formatter = column.editable.noeditFormatter(value, row, index);
|
83
|
-
}
|
84
|
-
|
85
|
-
if (_dont_edit_formatter === false) {
|
86
|
-
return ['<a href="javascript:void(0)"',
|
87
|
-
' data-name="' + column.field + '"',
|
88
|
-
' data-pk="' + row[that.options.idField] + '"',
|
89
|
-
' data-value="' + result + '"',
|
90
|
-
editableDataMarkup.join(''),
|
91
|
-
'>' + '</a>'
|
92
|
-
].join('');
|
93
|
-
} else {
|
94
|
-
return _dont_edit_formatter;
|
95
|
-
}
|
164
|
+
column.formatter = function (value, row, index) {
|
165
|
+
var result = Utils.calculateObjectValue(column, column._formatter, [value, row, index], value);
|
96
166
|
|
167
|
+
$.each(column, processDataOptions);
|
168
|
+
|
169
|
+
$.each(editableOptions, function (key, value) {
|
170
|
+
editableDataMarkup.push(' ' + key + '="' + value + '"');
|
171
|
+
});
|
172
|
+
|
173
|
+
var _dont_edit_formatter = false;
|
174
|
+
if (column.editable.hasOwnProperty('noeditFormatter')) {
|
175
|
+
_dont_edit_formatter = column.editable.noeditFormatter(value, row, index);
|
176
|
+
}
|
177
|
+
|
178
|
+
if (_dont_edit_formatter === false) {
|
179
|
+
return '<a href="javascript:void(0)"\n data-name="' + column.field + '"\n data-pk="' + row[_this2.options.idField] + '"\n data-value="' + result + '"\n ' + editableDataMarkup.join('') + '></a>';
|
180
|
+
}
|
181
|
+
return _dont_edit_formatter;
|
97
182
|
};
|
98
|
-
|
99
|
-
|
183
|
+
});
|
184
|
+
}
|
185
|
+
}, {
|
186
|
+
key: 'initBody',
|
187
|
+
value: function initBody(fixedScroll) {
|
188
|
+
var _this3 = this;
|
100
189
|
|
101
|
-
|
102
|
-
var that = this;
|
103
|
-
_initBody.apply(this, Array.prototype.slice.apply(arguments));
|
190
|
+
_get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initBody', this).call(this, fixedScroll);
|
104
191
|
|
105
|
-
|
192
|
+
if (!this.options.editable) {
|
106
193
|
return;
|
107
|
-
|
194
|
+
}
|
108
195
|
|
109
|
-
|
196
|
+
$.each(this.columns, function (i, column) {
|
110
197
|
if (!column.editable) {
|
111
|
-
|
198
|
+
return;
|
112
199
|
}
|
113
200
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
201
|
+
var data = _this3.getData();
|
202
|
+
var $field = _this3.$body.find('a[data-name="' + column.field + '"]');
|
203
|
+
|
204
|
+
$field.each(function (i, element) {
|
205
|
+
var $element = $(element);
|
206
|
+
var $tr = $element.closest('tr');
|
207
|
+
var index = $tr.data('index');
|
208
|
+
var row = data[index];
|
209
|
+
|
210
|
+
var editableOpts = Utils.calculateObjectValue(column, column.editable, [index, row, $element], {});
|
211
|
+
|
212
|
+
$element.editable(editableOpts);
|
213
|
+
});
|
214
|
+
|
215
|
+
$field.off('save').on('save', function (_ref, _ref2) {
|
216
|
+
var currentTarget = _ref.currentTarget;
|
217
|
+
var submitValue = _ref2.submitValue;
|
218
|
+
|
219
|
+
var $this = $(currentTarget);
|
220
|
+
var data = _this3.getData();
|
221
|
+
var index = $this.parents('tr[data-index]').data('index');
|
222
|
+
var row = data[index];
|
223
|
+
var oldValue = row[column.field];
|
224
|
+
|
225
|
+
$this.data('value', submitValue);
|
226
|
+
row[column.field] = submitValue;
|
227
|
+
_this3.trigger('editable-save', column.field, row, oldValue, $this);
|
228
|
+
_this3.resetFooter();
|
229
|
+
});
|
230
|
+
|
231
|
+
$field.off('shown').on('shown', function (_ref3, editable) {
|
232
|
+
var currentTarget = _ref3.currentTarget;
|
233
|
+
|
234
|
+
var $this = $(currentTarget);
|
235
|
+
var data = _this3.getData();
|
236
|
+
var index = $this.parents('tr[data-index]').data('index');
|
237
|
+
var row = data[index];
|
238
|
+
|
239
|
+
_this3.trigger('editable-shown', column.field, row, $this, editable);
|
240
|
+
});
|
241
|
+
|
242
|
+
$field.off('hidden').on('hidden', function (_ref4, reason) {
|
243
|
+
var currentTarget = _ref4.currentTarget;
|
244
|
+
|
245
|
+
var $this = $(currentTarget);
|
246
|
+
var data = _this3.getData();
|
247
|
+
var index = $this.parents('tr[data-index]').data('index');
|
248
|
+
var row = data[index];
|
249
|
+
|
250
|
+
_this3.trigger('editable-hidden', column.field, row, $this, reason);
|
251
|
+
});
|
252
|
+
});
|
253
|
+
this.trigger('editable-init');
|
254
|
+
}
|
255
|
+
}]);
|
145
256
|
|
146
|
-
|
257
|
+
return _class;
|
258
|
+
}($.BootstrapTable);
|
259
|
+
})(jQuery);
|
260
|
+
});
|