bootstrap-table-rails 1.11.1.1 → 1.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +152 -98
- data/lib/bootstrap-table-rails/version.rb +1 -1
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-locale-all.js +5196 -0
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-vue.esm.js +1809 -0
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-vue.js +1817 -0
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.css +296 -0
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.js +6924 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/accent-neutralise/bootstrap-table-accent-neutralise.js +1757 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js +1485 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.css +3 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js +1020 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/cell-input/bootstrap-table-cell-input.css +12 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/cell-input/bootstrap-table-cell-input.js +2087 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/cookie/bootstrap-table-cookie.js +1934 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/copy-rows/bootstrap-table-copy-rows.js +1042 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/defer-url/bootstrap-table-defer-url.js +779 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/editable/bootstrap-table-editable.js +1451 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/export/bootstrap-table-export.js +2494 -0
- data/vendor/assets/{stylesheets/extensions → javascripts/bootstrap-table/extensions/filter-control}/bootstrap-table-filter-control.css +3 -3
- data/vendor/assets/javascripts/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.js +2502 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.css +27 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.js +1378 -0
- data/vendor/assets/{stylesheets/extensions → javascripts/bootstrap-table/extensions/group-by}/bootstrap-table-group-by.css +0 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/group-by/bootstrap-table-group-by.js +257 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/group-by-v2/bootstrap-table-group-by.css +7 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/group-by-v2/bootstrap-table-group-by.js +1478 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/i18n-enhance/bootstrap-table-i18n-enhance.js +125 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/key-events/bootstrap-table-key-events.js +1243 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js +1162 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/multi-column-toggle/bootstrap-table-multi-toggle.js +105 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-search/bootstrap-table-multiple-search.js +85 -0
- data/vendor/assets/{stylesheets/extensions → javascripts/bootstrap-table/extensions/multiple-selection-row}/bootstrap-table-multiple-selection-row.css +0 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-selection-row/bootstrap-table-multiple-selection-row.js +143 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-sort/bootstrap-table-multiple-sort.js +1905 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/natural-sorting/bootstrap-table-natural-sorting.js +1265 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/page-jump-to/bootstrap-table-page-jump-to.css +11 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/page-jump-to/bootstrap-table-page-jump-to.js +971 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/pipeline/bootstrap-table-pipeline.js +1128 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/print/bootstrap-table-print.js +1960 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-columns/bootstrap-table-reorder-columns.js +1015 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.css +14 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js +774 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/resizable/bootstrap-table-resizable.js +676 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/select2-filter/bootstrap-table-select2-filter.js +341 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.css +22 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.js +1019 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.js +2297 -0
- data/vendor/assets/{stylesheets/extensions → javascripts/bootstrap-table/extensions/tree-column}/bootstrap-table-tree-column.css +0 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.js +142 -0
- data/vendor/assets/javascripts/bootstrap-table/extensions/treegrid/bootstrap-table-treegrid.js +1817 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-af-ZA.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ar-SA.js +722 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ca-ES.js +722 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-cs-CZ.js +722 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-da-DK.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-de-DE.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-el-GR.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-en-US.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-AR.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CL.js +722 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CR.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-ES.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-MX.js +723 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-NI.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-SP.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-et-EE.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-eu-EU.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fa-IR.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fi-FI.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-BE.js +722 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-CH.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-FR.js +723 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-LU.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-he-IL.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hr-HR.js +722 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hu-HU.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-id-ID.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-it-IT.js +723 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ja-JP.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ka-GE.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ko-KR.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ms-MY.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nb-NO.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-BE.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-NL.js +722 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pl-PL.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-BR.js +723 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-PT.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ro-RO.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ru-RU.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sk-SK.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sv-SE.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-th-TH.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-tr-TR.js +722 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uk-UA.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ur-PK.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uz-Latn-UZ.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-vi-VN.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-CN.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-TW.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.css +352 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.js +943 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.css +329 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.js +950 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/materialize/bootstrap-table-materialize.css +326 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/materialize/bootstrap-table-materialize.js +946 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/semantic/bootstrap-table-semantic.css +336 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/semantic/bootstrap-table-semantic.js +920 -0
- metadata +112 -96
- data/vendor/assets/images/icon.png +0 -0
- data/vendor/assets/javascripts/bootstrap-table-locale-all.js +0 -1698
- data/vendor/assets/javascripts/bootstrap-table.js +0 -3094
- data/vendor/assets/javascripts/extensions/bootstrap-table-accent-neutralise.js +0 -182
- data/vendor/assets/javascripts/extensions/bootstrap-table-angular.js +0 -107
- data/vendor/assets/javascripts/extensions/bootstrap-table-auto-refresh.js +0 -84
- data/vendor/assets/javascripts/extensions/bootstrap-table-click-edit-row.js +0 -142
- data/vendor/assets/javascripts/extensions/bootstrap-table-cookie.js +0 -434
- data/vendor/assets/javascripts/extensions/bootstrap-table-copy-rows.js +0 -102
- data/vendor/assets/javascripts/extensions/bootstrap-table-editable.js +0 -146
- data/vendor/assets/javascripts/extensions/bootstrap-table-export.js +0 -131
- data/vendor/assets/javascripts/extensions/bootstrap-table-filter-control.js +0 -697
- data/vendor/assets/javascripts/extensions/bootstrap-table-filter.js +0 -67
- data/vendor/assets/javascripts/extensions/bootstrap-table-flat-json.js +0 -62
- data/vendor/assets/javascripts/extensions/bootstrap-table-group-by-v2.js +0 -226
- data/vendor/assets/javascripts/extensions/bootstrap-table-group-by.js +0 -243
- data/vendor/assets/javascripts/extensions/bootstrap-table-i18n-enhance.js +0 -34
- data/vendor/assets/javascripts/extensions/bootstrap-table-key-events.js +0 -80
- data/vendor/assets/javascripts/extensions/bootstrap-table-mobile.js +0 -136
- data/vendor/assets/javascripts/extensions/bootstrap-table-multi-toggle.js +0 -88
- data/vendor/assets/javascripts/extensions/bootstrap-table-multiple-search.js +0 -71
- data/vendor/assets/javascripts/extensions/bootstrap-table-multiple-selection-row.js +0 -127
- data/vendor/assets/javascripts/extensions/bootstrap-table-multiple-sort.js +0 -393
- data/vendor/assets/javascripts/extensions/bootstrap-table-natural-sorting.js +0 -67
- data/vendor/assets/javascripts/extensions/bootstrap-table-print.js +0 -133
- data/vendor/assets/javascripts/extensions/bootstrap-table-reorder-columns.js +0 -181
- data/vendor/assets/javascripts/extensions/bootstrap-table-reorder-rows.js +0 -118
- data/vendor/assets/javascripts/extensions/bootstrap-table-resizable.js +0 -74
- data/vendor/assets/javascripts/extensions/bootstrap-table-select2-filter.js +0 -303
- data/vendor/assets/javascripts/extensions/bootstrap-table-sticky-header.js +0 -111
- data/vendor/assets/javascripts/extensions/bootstrap-table-toolbar.js +0 -211
- data/vendor/assets/javascripts/extensions/bootstrap-table-tree-column.js +0 -130
- data/vendor/assets/javascripts/locale/README.md +0 -179
- data/vendor/assets/javascripts/locale/bootstrap-table-af-ZA.js +0 -40
- data/vendor/assets/javascripts/locale/bootstrap-table-ar-SA.js +0 -40
- data/vendor/assets/javascripts/locale/bootstrap-table-ca-ES.js +0 -44
- data/vendor/assets/javascripts/locale/bootstrap-table-cs-CZ.js +0 -44
- data/vendor/assets/javascripts/locale/bootstrap-table-da-DK.js +0 -37
- data/vendor/assets/javascripts/locale/bootstrap-table-de-DE.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-el-GR.js +0 -28
- data/vendor/assets/javascripts/locale/bootstrap-table-en-US.js +0 -49
- data/vendor/assets/javascripts/locale/bootstrap-table-en-US.js.template +0 -49
- data/vendor/assets/javascripts/locale/bootstrap-table-es-AR.js +0 -31
- data/vendor/assets/javascripts/locale/bootstrap-table-es-CL.js +0 -44
- data/vendor/assets/javascripts/locale/bootstrap-table-es-CR.js +0 -40
- data/vendor/assets/javascripts/locale/bootstrap-table-es-ES.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-es-MX.js +0 -32
- data/vendor/assets/javascripts/locale/bootstrap-table-es-NI.js +0 -40
- data/vendor/assets/javascripts/locale/bootstrap-table-es-SP.js +0 -40
- data/vendor/assets/javascripts/locale/bootstrap-table-et-EE.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-fa-IR.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-fr-BE.js +0 -28
- data/vendor/assets/javascripts/locale/bootstrap-table-fr-FR.js +0 -41
- data/vendor/assets/javascripts/locale/bootstrap-table-he-IL.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-hr-HR.js +0 -44
- data/vendor/assets/javascripts/locale/bootstrap-table-hu-HU.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-id-ID.js +0 -49
- data/vendor/assets/javascripts/locale/bootstrap-table-it-IT.js +0 -52
- data/vendor/assets/javascripts/locale/bootstrap-table-ja-JP.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-ka-GE.js +0 -40
- data/vendor/assets/javascripts/locale/bootstrap-table-ko-KR.js +0 -37
- data/vendor/assets/javascripts/locale/bootstrap-table-ms-MY.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-nb-NO.js +0 -37
- data/vendor/assets/javascripts/locale/bootstrap-table-nl-NL.js +0 -52
- data/vendor/assets/javascripts/locale/bootstrap-table-pl-PL.js +0 -37
- data/vendor/assets/javascripts/locale/bootstrap-table-pt-BR.js +0 -41
- data/vendor/assets/javascripts/locale/bootstrap-table-pt-PT.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-ro-RO.js +0 -43
- data/vendor/assets/javascripts/locale/bootstrap-table-ru-RU.js +0 -72
- data/vendor/assets/javascripts/locale/bootstrap-table-sk-SK.js +0 -37
- data/vendor/assets/javascripts/locale/bootstrap-table-sv-SE.js +0 -37
- data/vendor/assets/javascripts/locale/bootstrap-table-th-TH.js +0 -37
- data/vendor/assets/javascripts/locale/bootstrap-table-tr-TR.js +0 -41
- data/vendor/assets/javascripts/locale/bootstrap-table-uk-UA.js +0 -73
- data/vendor/assets/javascripts/locale/bootstrap-table-ur-PK.js +0 -37
- data/vendor/assets/javascripts/locale/bootstrap-table-uz-Latn-UZ.js +0 -49
- data/vendor/assets/javascripts/locale/bootstrap-table-vi-VN.js +0 -28
- data/vendor/assets/javascripts/locale/bootstrap-table-zh-CN.js +0 -46
- data/vendor/assets/javascripts/locale/bootstrap-table-zh-TW.js +0 -40
- data/vendor/assets/stylesheets/bootstrap-table.css +0 -313
- data/vendor/assets/stylesheets/extensions/bootstrap-table-auto-refresh.css +0 -3
- data/vendor/assets/stylesheets/extensions/bootstrap-table-click-edit-row.css +0 -21
- data/vendor/assets/stylesheets/extensions/bootstrap-table-group-by-v2.css +0 -7
- data/vendor/assets/stylesheets/extensions/bootstrap-table-reorder-rows.css +0 -14
- data/vendor/assets/stylesheets/extensions/bootstrap-table-sticky-header.css +0 -22
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
if (typeof define === "function" && define.amd) {
|
|
3
|
+
define([], factory);
|
|
4
|
+
} else if (typeof exports !== "undefined") {
|
|
5
|
+
factory();
|
|
6
|
+
} else {
|
|
7
|
+
var mod = {
|
|
8
|
+
exports: {}
|
|
9
|
+
};
|
|
10
|
+
factory();
|
|
11
|
+
global.bootstrapTableMultiToggle = mod.exports;
|
|
12
|
+
}
|
|
13
|
+
})(this, function () {
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @author Homer Glascock <HopGlascock@gmail.com>
|
|
18
|
+
* @version: v1.0.0
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
!function ($) {
|
|
22
|
+
"use strict";
|
|
23
|
+
|
|
24
|
+
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
|
25
|
+
|
|
26
|
+
var reInit = function reInit(self) {
|
|
27
|
+
self.initHeader();
|
|
28
|
+
self.initSearch();
|
|
29
|
+
self.initPagination();
|
|
30
|
+
self.initBody();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
$.extend($.fn.bootstrapTable.defaults, {
|
|
34
|
+
showToggleBtn: false,
|
|
35
|
+
multiToggleDefaults: [] //column names go here
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
$.fn.bootstrapTable.methods.push('hideAllColumns', 'showAllColumns');
|
|
39
|
+
|
|
40
|
+
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
|
41
|
+
_initToolbar = BootstrapTable.prototype.initToolbar;
|
|
42
|
+
|
|
43
|
+
BootstrapTable.prototype.initToolbar = function () {
|
|
44
|
+
|
|
45
|
+
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
|
46
|
+
|
|
47
|
+
var that = this,
|
|
48
|
+
$btnGroup = this.$toolbar.find('>.btn-group');
|
|
49
|
+
|
|
50
|
+
if (typeof this.options.multiToggleDefaults === 'string') {
|
|
51
|
+
this.options.multiToggleDefaults = JSON.parse(this.options.multiToggleDefaults);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (this.options.showToggleBtn && this.options.showColumns) {
|
|
55
|
+
var showbtn = "<button class='btn btn-default hidden' id='showAllBtn'><span class='glyphicon glyphicon-resize-full icon-zoom-in'></span></button>",
|
|
56
|
+
hidebtn = "<button class='btn btn-default' id='hideAllBtn'><span class='glyphicon glyphicon-resize-small icon-zoom-out'></span></button>";
|
|
57
|
+
|
|
58
|
+
$btnGroup.append(showbtn + hidebtn);
|
|
59
|
+
|
|
60
|
+
$btnGroup.find('#showAllBtn').click(function () {
|
|
61
|
+
that.showAllColumns();
|
|
62
|
+
$btnGroup.find('#hideAllBtn').toggleClass('hidden');
|
|
63
|
+
$btnGroup.find('#showAllBtn').toggleClass('hidden');
|
|
64
|
+
});
|
|
65
|
+
$btnGroup.find('#hideAllBtn').click(function () {
|
|
66
|
+
that.hideAllColumns();
|
|
67
|
+
$btnGroup.find('#hideAllBtn').toggleClass('hidden');
|
|
68
|
+
$btnGroup.find('#showAllBtn').toggleClass('hidden');
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
BootstrapTable.prototype.hideAllColumns = function () {
|
|
74
|
+
var that = this,
|
|
75
|
+
defaults = that.options.multiToggleDefaults;
|
|
76
|
+
|
|
77
|
+
$.each(this.columns, function (index, column) {
|
|
78
|
+
//if its one of the defaults dont touch it
|
|
79
|
+
if (defaults.indexOf(column.field) == -1 && column.switchable) {
|
|
80
|
+
column.visible = false;
|
|
81
|
+
var $items = that.$toolbar.find('.keep-open input').prop('disabled', false);
|
|
82
|
+
$items.filter(sprintf('[value="%s"]', index)).prop('checked', false);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
reInit(that);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
BootstrapTable.prototype.showAllColumns = function () {
|
|
90
|
+
var that = this;
|
|
91
|
+
$.each(this.columns, function (index, column) {
|
|
92
|
+
if (column.switchable) {
|
|
93
|
+
column.visible = true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
var $items = that.$toolbar.find('.keep-open input').prop('disabled', false);
|
|
97
|
+
$items.filter(sprintf('[value="%s"]', index)).prop('checked', true);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
reInit(that);
|
|
101
|
+
|
|
102
|
+
that.toggleColumn(0, that.columns[0].visible, false);
|
|
103
|
+
};
|
|
104
|
+
}(jQuery);
|
|
105
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
if (typeof define === "function" && define.amd) {
|
|
3
|
+
define([], factory);
|
|
4
|
+
} else if (typeof exports !== "undefined") {
|
|
5
|
+
factory();
|
|
6
|
+
} else {
|
|
7
|
+
var mod = {
|
|
8
|
+
exports: {}
|
|
9
|
+
};
|
|
10
|
+
factory();
|
|
11
|
+
global.bootstrapTableMultipleSearch = mod.exports;
|
|
12
|
+
}
|
|
13
|
+
})(this, function () {
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @author: Dennis Hernández
|
|
18
|
+
* @webSite: http://djhvscf.github.io/Blog
|
|
19
|
+
* @version: v1.0.0
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
!function ($) {
|
|
23
|
+
|
|
24
|
+
'use strict';
|
|
25
|
+
|
|
26
|
+
$.extend($.fn.bootstrapTable.defaults, {
|
|
27
|
+
multipleSearch: false,
|
|
28
|
+
delimeter: " "
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
|
32
|
+
_initSearch = BootstrapTable.prototype.initSearch;
|
|
33
|
+
|
|
34
|
+
BootstrapTable.prototype.initSearch = function () {
|
|
35
|
+
if (this.options.multipleSearch) {
|
|
36
|
+
if (this.searchText === undefined) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
var strArray = this.searchText.split(this.options.delimeter),
|
|
40
|
+
that = this,
|
|
41
|
+
f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns,
|
|
42
|
+
dataFiltered = [];
|
|
43
|
+
|
|
44
|
+
if (strArray.length === 1) {
|
|
45
|
+
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
|
|
46
|
+
} else {
|
|
47
|
+
for (var i = 0; i < strArray.length; i++) {
|
|
48
|
+
var str = strArray[i].trim();
|
|
49
|
+
dataFiltered = str ? $.grep(dataFiltered.length === 0 ? this.options.data : dataFiltered, function (item, i) {
|
|
50
|
+
for (var key in item) {
|
|
51
|
+
key = $.isNumeric(key) ? parseInt(key, 10) : key;
|
|
52
|
+
var value = item[key],
|
|
53
|
+
column = that.columns[that.fieldsColumnsIndex[key]],
|
|
54
|
+
j = $.inArray(key, that.header.fields);
|
|
55
|
+
|
|
56
|
+
// Fix #142: search use formated data
|
|
57
|
+
if (column && column.searchFormatter) {
|
|
58
|
+
value = $.fn.bootstrapTable.utils.calculateObjectValue(column, that.header.formatters[j], [value, item, i], value);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var index = $.inArray(key, that.header.fields);
|
|
62
|
+
if (index !== -1 && that.header.searchables[index] && (typeof value === 'string' || typeof value === 'number')) {
|
|
63
|
+
if (that.options.strictSearch) {
|
|
64
|
+
if ((value + '').toLowerCase() === str) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
if ((value + '').toLowerCase().indexOf(str) !== -1) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}) : this.data;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.data = dataFiltered;
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}(jQuery);
|
|
85
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
if (typeof define === "function" && define.amd) {
|
|
3
|
+
define([], factory);
|
|
4
|
+
} else if (typeof exports !== "undefined") {
|
|
5
|
+
factory();
|
|
6
|
+
} else {
|
|
7
|
+
var mod = {
|
|
8
|
+
exports: {}
|
|
9
|
+
};
|
|
10
|
+
factory();
|
|
11
|
+
global.bootstrapTableMultipleSelectionRow = mod.exports;
|
|
12
|
+
}
|
|
13
|
+
})(this, function () {
|
|
14
|
+
"use strict";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @author: Dennis Hernández
|
|
18
|
+
* @webSite: http://djhvscf.github.io/Blog
|
|
19
|
+
* @version: v1.0.0
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
!function ($) {
|
|
23
|
+
|
|
24
|
+
'use strict';
|
|
25
|
+
|
|
26
|
+
document.onselectstart = function () {
|
|
27
|
+
return false;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var getTableObjectFromCurrentTarget = function getTableObjectFromCurrentTarget(currentTarget) {
|
|
31
|
+
currentTarget = $(currentTarget);
|
|
32
|
+
return currentTarget.is("table") ? currentTarget : currentTarget.parents().find(".table");
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var getRow = function getRow(target) {
|
|
36
|
+
target = $(target);
|
|
37
|
+
return target.parent().parent();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var onRowClick = function onRowClick(e) {
|
|
41
|
+
var that = getTableObjectFromCurrentTarget(e.currentTarget);
|
|
42
|
+
|
|
43
|
+
if (window.event.ctrlKey) {
|
|
44
|
+
toggleRow(e.currentTarget, that, false, false);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (window.event.button === 0) {
|
|
48
|
+
if (!window.event.ctrlKey && !window.event.shiftKey) {
|
|
49
|
+
clearAll(that);
|
|
50
|
+
toggleRow(e.currentTarget, that, false, false);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (window.event.shiftKey) {
|
|
54
|
+
selectRowsBetweenIndexes([that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow.rowIndex, e.currentTarget.rowIndex], that);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
var onCheckboxChange = function onCheckboxChange(e) {
|
|
60
|
+
var that = getTableObjectFromCurrentTarget(e.currentTarget);
|
|
61
|
+
clearAll(that);
|
|
62
|
+
toggleRow(getRow(e.currentTarget), that, false, false);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var toggleRow = function toggleRow(row, that, clearAll, useShift) {
|
|
66
|
+
if (clearAll) {
|
|
67
|
+
row = $(row);
|
|
68
|
+
that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow = undefined;
|
|
69
|
+
row.removeClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
|
|
70
|
+
that.bootstrapTable("uncheck", row.data("index"));
|
|
71
|
+
} else {
|
|
72
|
+
that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow = row;
|
|
73
|
+
row = $(row);
|
|
74
|
+
if (useShift) {
|
|
75
|
+
row.addClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
|
|
76
|
+
that.bootstrapTable("check", row.data("index"));
|
|
77
|
+
} else {
|
|
78
|
+
if (row.hasClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass)) {
|
|
79
|
+
row.removeClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
|
|
80
|
+
that.bootstrapTable("uncheck", row.data("index"));
|
|
81
|
+
} else {
|
|
82
|
+
row.addClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
|
|
83
|
+
that.bootstrapTable("check", row.data("index"));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var selectRowsBetweenIndexes = function selectRowsBetweenIndexes(indexes, that) {
|
|
90
|
+
indexes.sort(function (a, b) {
|
|
91
|
+
return a - b;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
for (var i = indexes[0]; i <= indexes[1]; i++) {
|
|
95
|
+
toggleRow(that.bootstrapTable("getOptions").multipleSelectRowRows[i - 1], that, false, true);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var clearAll = function clearAll(that) {
|
|
100
|
+
for (var i = 0; i < that.bootstrapTable("getOptions").multipleSelectRowRows.length; i++) {
|
|
101
|
+
toggleRow(that.bootstrapTable("getOptions").multipleSelectRowRows[i], that, true, false);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
$.extend($.fn.bootstrapTable.defaults, {
|
|
106
|
+
multipleSelectRow: false,
|
|
107
|
+
multipleSelectRowCssClass: 'multiple-select-row-selected',
|
|
108
|
+
//internal variables used by the extension
|
|
109
|
+
multipleSelectRowLastSelectedRow: undefined,
|
|
110
|
+
multipleSelectRowRows: []
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
|
114
|
+
_init = BootstrapTable.prototype.init,
|
|
115
|
+
_initBody = BootstrapTable.prototype.initBody;
|
|
116
|
+
|
|
117
|
+
BootstrapTable.prototype.init = function () {
|
|
118
|
+
if (this.options.multipleSelectRow) {
|
|
119
|
+
var that = this;
|
|
120
|
+
|
|
121
|
+
//Make sure that the internal variables have the correct value
|
|
122
|
+
this.options.multipleSelectRowLastSelectedRow = undefined;
|
|
123
|
+
this.options.multipleSelectRowRows = [];
|
|
124
|
+
|
|
125
|
+
this.$el.on("post-body.bs.table", function (e) {
|
|
126
|
+
setTimeout(function () {
|
|
127
|
+
that.options.multipleSelectRowRows = that.$body.children();
|
|
128
|
+
that.options.multipleSelectRowRows.click(onRowClick);
|
|
129
|
+
that.options.multipleSelectRowRows.find("input[type=checkbox]").change(onCheckboxChange);
|
|
130
|
+
}, 1);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
_init.apply(this, Array.prototype.slice.apply(arguments));
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
BootstrapTable.prototype.clearAllMultipleSelectionRow = function () {
|
|
138
|
+
clearAll(this);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
$.fn.bootstrapTable.methods.push('clearAllMultipleSelectionRow');
|
|
142
|
+
}(jQuery);
|
|
143
|
+
});
|
|
@@ -0,0 +1,1905 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['jquery'], factory) :
|
|
4
|
+
(global = global || self, factory(global.jQuery));
|
|
5
|
+
}(this, function ($) { 'use strict';
|
|
6
|
+
|
|
7
|
+
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
|
8
|
+
|
|
9
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
10
|
+
|
|
11
|
+
function createCommonjsModule(fn, module) {
|
|
12
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var O = 'object';
|
|
16
|
+
var check = function (it) {
|
|
17
|
+
return it && it.Math == Math && it;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
21
|
+
var global_1 =
|
|
22
|
+
// eslint-disable-next-line no-undef
|
|
23
|
+
check(typeof globalThis == O && globalThis) ||
|
|
24
|
+
check(typeof window == O && window) ||
|
|
25
|
+
check(typeof self == O && self) ||
|
|
26
|
+
check(typeof commonjsGlobal == O && commonjsGlobal) ||
|
|
27
|
+
// eslint-disable-next-line no-new-func
|
|
28
|
+
Function('return this')();
|
|
29
|
+
|
|
30
|
+
var fails = function (exec) {
|
|
31
|
+
try {
|
|
32
|
+
return !!exec();
|
|
33
|
+
} catch (error) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Thank's IE8 for his funny defineProperty
|
|
39
|
+
var descriptors = !fails(function () {
|
|
40
|
+
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
|
|
44
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
45
|
+
|
|
46
|
+
// Nashorn ~ JDK8 bug
|
|
47
|
+
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
|
|
48
|
+
|
|
49
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
50
|
+
// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
|
|
51
|
+
var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
52
|
+
var descriptor = getOwnPropertyDescriptor(this, V);
|
|
53
|
+
return !!descriptor && descriptor.enumerable;
|
|
54
|
+
} : nativePropertyIsEnumerable;
|
|
55
|
+
|
|
56
|
+
var objectPropertyIsEnumerable = {
|
|
57
|
+
f: f
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var createPropertyDescriptor = function (bitmap, value) {
|
|
61
|
+
return {
|
|
62
|
+
enumerable: !(bitmap & 1),
|
|
63
|
+
configurable: !(bitmap & 2),
|
|
64
|
+
writable: !(bitmap & 4),
|
|
65
|
+
value: value
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var toString = {}.toString;
|
|
70
|
+
|
|
71
|
+
var classofRaw = function (it) {
|
|
72
|
+
return toString.call(it).slice(8, -1);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var split = ''.split;
|
|
76
|
+
|
|
77
|
+
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
78
|
+
var indexedObject = fails(function () {
|
|
79
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
80
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
81
|
+
return !Object('z').propertyIsEnumerable(0);
|
|
82
|
+
}) ? function (it) {
|
|
83
|
+
return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
|
|
84
|
+
} : Object;
|
|
85
|
+
|
|
86
|
+
// `RequireObjectCoercible` abstract operation
|
|
87
|
+
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
|
|
88
|
+
var requireObjectCoercible = function (it) {
|
|
89
|
+
if (it == undefined) throw TypeError("Can't call method on " + it);
|
|
90
|
+
return it;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// toObject with fallback for non-array-like ES3 strings
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
var toIndexedObject = function (it) {
|
|
98
|
+
return indexedObject(requireObjectCoercible(it));
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
var isObject = function (it) {
|
|
102
|
+
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// `ToPrimitive` abstract operation
|
|
106
|
+
// https://tc39.github.io/ecma262/#sec-toprimitive
|
|
107
|
+
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
|
108
|
+
// and the second argument - flag - preferred type is a string
|
|
109
|
+
var toPrimitive = function (input, PREFERRED_STRING) {
|
|
110
|
+
if (!isObject(input)) return input;
|
|
111
|
+
var fn, val;
|
|
112
|
+
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
|
113
|
+
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
|
|
114
|
+
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
|
115
|
+
throw TypeError("Can't convert object to primitive value");
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
var hasOwnProperty = {}.hasOwnProperty;
|
|
119
|
+
|
|
120
|
+
var has = function (it, key) {
|
|
121
|
+
return hasOwnProperty.call(it, key);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
var document = global_1.document;
|
|
125
|
+
// typeof document.createElement is 'object' in old IE
|
|
126
|
+
var EXISTS = isObject(document) && isObject(document.createElement);
|
|
127
|
+
|
|
128
|
+
var documentCreateElement = function (it) {
|
|
129
|
+
return EXISTS ? document.createElement(it) : {};
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Thank's IE8 for his funny defineProperty
|
|
133
|
+
var ie8DomDefine = !descriptors && !fails(function () {
|
|
134
|
+
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
135
|
+
get: function () { return 7; }
|
|
136
|
+
}).a != 7;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
140
|
+
|
|
141
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
142
|
+
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
|
|
143
|
+
var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
|
144
|
+
O = toIndexedObject(O);
|
|
145
|
+
P = toPrimitive(P, true);
|
|
146
|
+
if (ie8DomDefine) try {
|
|
147
|
+
return nativeGetOwnPropertyDescriptor(O, P);
|
|
148
|
+
} catch (error) { /* empty */ }
|
|
149
|
+
if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
var objectGetOwnPropertyDescriptor = {
|
|
153
|
+
f: f$1
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
var anObject = function (it) {
|
|
157
|
+
if (!isObject(it)) {
|
|
158
|
+
throw TypeError(String(it) + ' is not an object');
|
|
159
|
+
} return it;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
var nativeDefineProperty = Object.defineProperty;
|
|
163
|
+
|
|
164
|
+
// `Object.defineProperty` method
|
|
165
|
+
// https://tc39.github.io/ecma262/#sec-object.defineproperty
|
|
166
|
+
var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
|
167
|
+
anObject(O);
|
|
168
|
+
P = toPrimitive(P, true);
|
|
169
|
+
anObject(Attributes);
|
|
170
|
+
if (ie8DomDefine) try {
|
|
171
|
+
return nativeDefineProperty(O, P, Attributes);
|
|
172
|
+
} catch (error) { /* empty */ }
|
|
173
|
+
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
|
174
|
+
if ('value' in Attributes) O[P] = Attributes.value;
|
|
175
|
+
return O;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
var objectDefineProperty = {
|
|
179
|
+
f: f$2
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
var hide = descriptors ? function (object, key, value) {
|
|
183
|
+
return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
|
184
|
+
} : function (object, key, value) {
|
|
185
|
+
object[key] = value;
|
|
186
|
+
return object;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
var setGlobal = function (key, value) {
|
|
190
|
+
try {
|
|
191
|
+
hide(global_1, key, value);
|
|
192
|
+
} catch (error) {
|
|
193
|
+
global_1[key] = value;
|
|
194
|
+
} return value;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
var shared = createCommonjsModule(function (module) {
|
|
198
|
+
var SHARED = '__core-js_shared__';
|
|
199
|
+
var store = global_1[SHARED] || setGlobal(SHARED, {});
|
|
200
|
+
|
|
201
|
+
(module.exports = function (key, value) {
|
|
202
|
+
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
203
|
+
})('versions', []).push({
|
|
204
|
+
version: '3.1.3',
|
|
205
|
+
mode: 'global',
|
|
206
|
+
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
var functionToString = shared('native-function-to-string', Function.toString);
|
|
211
|
+
|
|
212
|
+
var WeakMap = global_1.WeakMap;
|
|
213
|
+
|
|
214
|
+
var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
|
|
215
|
+
|
|
216
|
+
var id = 0;
|
|
217
|
+
var postfix = Math.random();
|
|
218
|
+
|
|
219
|
+
var uid = function (key) {
|
|
220
|
+
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
var keys = shared('keys');
|
|
224
|
+
|
|
225
|
+
var sharedKey = function (key) {
|
|
226
|
+
return keys[key] || (keys[key] = uid(key));
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
var hiddenKeys = {};
|
|
230
|
+
|
|
231
|
+
var WeakMap$1 = global_1.WeakMap;
|
|
232
|
+
var set, get, has$1;
|
|
233
|
+
|
|
234
|
+
var enforce = function (it) {
|
|
235
|
+
return has$1(it) ? get(it) : set(it, {});
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
var getterFor = function (TYPE) {
|
|
239
|
+
return function (it) {
|
|
240
|
+
var state;
|
|
241
|
+
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
|
242
|
+
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
|
243
|
+
} return state;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
if (nativeWeakMap) {
|
|
248
|
+
var store = new WeakMap$1();
|
|
249
|
+
var wmget = store.get;
|
|
250
|
+
var wmhas = store.has;
|
|
251
|
+
var wmset = store.set;
|
|
252
|
+
set = function (it, metadata) {
|
|
253
|
+
wmset.call(store, it, metadata);
|
|
254
|
+
return metadata;
|
|
255
|
+
};
|
|
256
|
+
get = function (it) {
|
|
257
|
+
return wmget.call(store, it) || {};
|
|
258
|
+
};
|
|
259
|
+
has$1 = function (it) {
|
|
260
|
+
return wmhas.call(store, it);
|
|
261
|
+
};
|
|
262
|
+
} else {
|
|
263
|
+
var STATE = sharedKey('state');
|
|
264
|
+
hiddenKeys[STATE] = true;
|
|
265
|
+
set = function (it, metadata) {
|
|
266
|
+
hide(it, STATE, metadata);
|
|
267
|
+
return metadata;
|
|
268
|
+
};
|
|
269
|
+
get = function (it) {
|
|
270
|
+
return has(it, STATE) ? it[STATE] : {};
|
|
271
|
+
};
|
|
272
|
+
has$1 = function (it) {
|
|
273
|
+
return has(it, STATE);
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
var internalState = {
|
|
278
|
+
set: set,
|
|
279
|
+
get: get,
|
|
280
|
+
has: has$1,
|
|
281
|
+
enforce: enforce,
|
|
282
|
+
getterFor: getterFor
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
var redefine = createCommonjsModule(function (module) {
|
|
286
|
+
var getInternalState = internalState.get;
|
|
287
|
+
var enforceInternalState = internalState.enforce;
|
|
288
|
+
var TEMPLATE = String(functionToString).split('toString');
|
|
289
|
+
|
|
290
|
+
shared('inspectSource', function (it) {
|
|
291
|
+
return functionToString.call(it);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
(module.exports = function (O, key, value, options) {
|
|
295
|
+
var unsafe = options ? !!options.unsafe : false;
|
|
296
|
+
var simple = options ? !!options.enumerable : false;
|
|
297
|
+
var noTargetGet = options ? !!options.noTargetGet : false;
|
|
298
|
+
if (typeof value == 'function') {
|
|
299
|
+
if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
|
|
300
|
+
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
|
|
301
|
+
}
|
|
302
|
+
if (O === global_1) {
|
|
303
|
+
if (simple) O[key] = value;
|
|
304
|
+
else setGlobal(key, value);
|
|
305
|
+
return;
|
|
306
|
+
} else if (!unsafe) {
|
|
307
|
+
delete O[key];
|
|
308
|
+
} else if (!noTargetGet && O[key]) {
|
|
309
|
+
simple = true;
|
|
310
|
+
}
|
|
311
|
+
if (simple) O[key] = value;
|
|
312
|
+
else hide(O, key, value);
|
|
313
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
314
|
+
})(Function.prototype, 'toString', function toString() {
|
|
315
|
+
return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
var path = global_1;
|
|
320
|
+
|
|
321
|
+
var aFunction = function (variable) {
|
|
322
|
+
return typeof variable == 'function' ? variable : undefined;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
var getBuiltIn = function (namespace, method) {
|
|
326
|
+
return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
|
|
327
|
+
: path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
var ceil = Math.ceil;
|
|
331
|
+
var floor = Math.floor;
|
|
332
|
+
|
|
333
|
+
// `ToInteger` abstract operation
|
|
334
|
+
// https://tc39.github.io/ecma262/#sec-tointeger
|
|
335
|
+
var toInteger = function (argument) {
|
|
336
|
+
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
var min = Math.min;
|
|
340
|
+
|
|
341
|
+
// `ToLength` abstract operation
|
|
342
|
+
// https://tc39.github.io/ecma262/#sec-tolength
|
|
343
|
+
var toLength = function (argument) {
|
|
344
|
+
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
var max = Math.max;
|
|
348
|
+
var min$1 = Math.min;
|
|
349
|
+
|
|
350
|
+
// Helper for a popular repeating case of the spec:
|
|
351
|
+
// Let integer be ? ToInteger(index).
|
|
352
|
+
// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
|
|
353
|
+
var toAbsoluteIndex = function (index, length) {
|
|
354
|
+
var integer = toInteger(index);
|
|
355
|
+
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
359
|
+
var createMethod = function (IS_INCLUDES) {
|
|
360
|
+
return function ($this, el, fromIndex) {
|
|
361
|
+
var O = toIndexedObject($this);
|
|
362
|
+
var length = toLength(O.length);
|
|
363
|
+
var index = toAbsoluteIndex(fromIndex, length);
|
|
364
|
+
var value;
|
|
365
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
366
|
+
// eslint-disable-next-line no-self-compare
|
|
367
|
+
if (IS_INCLUDES && el != el) while (length > index) {
|
|
368
|
+
value = O[index++];
|
|
369
|
+
// eslint-disable-next-line no-self-compare
|
|
370
|
+
if (value != value) return true;
|
|
371
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
372
|
+
} else for (;length > index; index++) {
|
|
373
|
+
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
374
|
+
} return !IS_INCLUDES && -1;
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
var arrayIncludes = {
|
|
379
|
+
// `Array.prototype.includes` method
|
|
380
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
|
|
381
|
+
includes: createMethod(true),
|
|
382
|
+
// `Array.prototype.indexOf` method
|
|
383
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
|
|
384
|
+
indexOf: createMethod(false)
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
var indexOf = arrayIncludes.indexOf;
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
var objectKeysInternal = function (object, names) {
|
|
391
|
+
var O = toIndexedObject(object);
|
|
392
|
+
var i = 0;
|
|
393
|
+
var result = [];
|
|
394
|
+
var key;
|
|
395
|
+
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
|
|
396
|
+
// Don't enum bug & hidden keys
|
|
397
|
+
while (names.length > i) if (has(O, key = names[i++])) {
|
|
398
|
+
~indexOf(result, key) || result.push(key);
|
|
399
|
+
}
|
|
400
|
+
return result;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
// IE8- don't enum bug keys
|
|
404
|
+
var enumBugKeys = [
|
|
405
|
+
'constructor',
|
|
406
|
+
'hasOwnProperty',
|
|
407
|
+
'isPrototypeOf',
|
|
408
|
+
'propertyIsEnumerable',
|
|
409
|
+
'toLocaleString',
|
|
410
|
+
'toString',
|
|
411
|
+
'valueOf'
|
|
412
|
+
];
|
|
413
|
+
|
|
414
|
+
var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
|
|
415
|
+
|
|
416
|
+
// `Object.getOwnPropertyNames` method
|
|
417
|
+
// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
|
|
418
|
+
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
419
|
+
return objectKeysInternal(O, hiddenKeys$1);
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
var objectGetOwnPropertyNames = {
|
|
423
|
+
f: f$3
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
var f$4 = Object.getOwnPropertySymbols;
|
|
427
|
+
|
|
428
|
+
var objectGetOwnPropertySymbols = {
|
|
429
|
+
f: f$4
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
// all object keys, includes non-enumerable and symbols
|
|
433
|
+
var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
434
|
+
var keys = objectGetOwnPropertyNames.f(anObject(it));
|
|
435
|
+
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
|
436
|
+
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
var copyConstructorProperties = function (target, source) {
|
|
440
|
+
var keys = ownKeys(source);
|
|
441
|
+
var defineProperty = objectDefineProperty.f;
|
|
442
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
443
|
+
for (var i = 0; i < keys.length; i++) {
|
|
444
|
+
var key = keys[i];
|
|
445
|
+
if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
var replacement = /#|\.prototype\./;
|
|
450
|
+
|
|
451
|
+
var isForced = function (feature, detection) {
|
|
452
|
+
var value = data[normalize(feature)];
|
|
453
|
+
return value == POLYFILL ? true
|
|
454
|
+
: value == NATIVE ? false
|
|
455
|
+
: typeof detection == 'function' ? fails(detection)
|
|
456
|
+
: !!detection;
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
var normalize = isForced.normalize = function (string) {
|
|
460
|
+
return String(string).replace(replacement, '.').toLowerCase();
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
var data = isForced.data = {};
|
|
464
|
+
var NATIVE = isForced.NATIVE = 'N';
|
|
465
|
+
var POLYFILL = isForced.POLYFILL = 'P';
|
|
466
|
+
|
|
467
|
+
var isForced_1 = isForced;
|
|
468
|
+
|
|
469
|
+
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
/*
|
|
477
|
+
options.target - name of the target object
|
|
478
|
+
options.global - target is the global object
|
|
479
|
+
options.stat - export as static methods of target
|
|
480
|
+
options.proto - export as prototype methods of target
|
|
481
|
+
options.real - real prototype method for the `pure` version
|
|
482
|
+
options.forced - export even if the native feature is available
|
|
483
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
484
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
485
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
486
|
+
options.sham - add a flag to not completely full polyfills
|
|
487
|
+
options.enumerable - export as enumerable property
|
|
488
|
+
options.noTargetGet - prevent calling a getter on target
|
|
489
|
+
*/
|
|
490
|
+
var _export = function (options, source) {
|
|
491
|
+
var TARGET = options.target;
|
|
492
|
+
var GLOBAL = options.global;
|
|
493
|
+
var STATIC = options.stat;
|
|
494
|
+
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
495
|
+
if (GLOBAL) {
|
|
496
|
+
target = global_1;
|
|
497
|
+
} else if (STATIC) {
|
|
498
|
+
target = global_1[TARGET] || setGlobal(TARGET, {});
|
|
499
|
+
} else {
|
|
500
|
+
target = (global_1[TARGET] || {}).prototype;
|
|
501
|
+
}
|
|
502
|
+
if (target) for (key in source) {
|
|
503
|
+
sourceProperty = source[key];
|
|
504
|
+
if (options.noTargetGet) {
|
|
505
|
+
descriptor = getOwnPropertyDescriptor$1(target, key);
|
|
506
|
+
targetProperty = descriptor && descriptor.value;
|
|
507
|
+
} else targetProperty = target[key];
|
|
508
|
+
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
509
|
+
// contained in target
|
|
510
|
+
if (!FORCED && targetProperty !== undefined) {
|
|
511
|
+
if (typeof sourceProperty === typeof targetProperty) continue;
|
|
512
|
+
copyConstructorProperties(sourceProperty, targetProperty);
|
|
513
|
+
}
|
|
514
|
+
// add a flag to not completely full polyfills
|
|
515
|
+
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
516
|
+
hide(sourceProperty, 'sham', true);
|
|
517
|
+
}
|
|
518
|
+
// extend global
|
|
519
|
+
redefine(target, key, sourceProperty, options);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
// `IsArray` abstract operation
|
|
524
|
+
// https://tc39.github.io/ecma262/#sec-isarray
|
|
525
|
+
var isArray = Array.isArray || function isArray(arg) {
|
|
526
|
+
return classofRaw(arg) == 'Array';
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
// `ToObject` abstract operation
|
|
530
|
+
// https://tc39.github.io/ecma262/#sec-toobject
|
|
531
|
+
var toObject = function (argument) {
|
|
532
|
+
return Object(requireObjectCoercible(argument));
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
var createProperty = function (object, key, value) {
|
|
536
|
+
var propertyKey = toPrimitive(key);
|
|
537
|
+
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
538
|
+
else object[propertyKey] = value;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
542
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
543
|
+
// eslint-disable-next-line no-undef
|
|
544
|
+
return !String(Symbol());
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
var Symbol$1 = global_1.Symbol;
|
|
548
|
+
var store$1 = shared('wks');
|
|
549
|
+
|
|
550
|
+
var wellKnownSymbol = function (name) {
|
|
551
|
+
return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
|
|
552
|
+
|| (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
var SPECIES = wellKnownSymbol('species');
|
|
556
|
+
|
|
557
|
+
// `ArraySpeciesCreate` abstract operation
|
|
558
|
+
// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
|
|
559
|
+
var arraySpeciesCreate = function (originalArray, length) {
|
|
560
|
+
var C;
|
|
561
|
+
if (isArray(originalArray)) {
|
|
562
|
+
C = originalArray.constructor;
|
|
563
|
+
// cross-realm fallback
|
|
564
|
+
if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
|
|
565
|
+
else if (isObject(C)) {
|
|
566
|
+
C = C[SPECIES];
|
|
567
|
+
if (C === null) C = undefined;
|
|
568
|
+
}
|
|
569
|
+
} return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
var SPECIES$1 = wellKnownSymbol('species');
|
|
573
|
+
|
|
574
|
+
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
575
|
+
return !fails(function () {
|
|
576
|
+
var array = [];
|
|
577
|
+
var constructor = array.constructor = {};
|
|
578
|
+
constructor[SPECIES$1] = function () {
|
|
579
|
+
return { foo: 1 };
|
|
580
|
+
};
|
|
581
|
+
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
582
|
+
});
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
586
|
+
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
587
|
+
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
588
|
+
|
|
589
|
+
var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () {
|
|
590
|
+
var array = [];
|
|
591
|
+
array[IS_CONCAT_SPREADABLE] = false;
|
|
592
|
+
return array.concat()[0] !== array;
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
596
|
+
|
|
597
|
+
var isConcatSpreadable = function (O) {
|
|
598
|
+
if (!isObject(O)) return false;
|
|
599
|
+
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
600
|
+
return spreadable !== undefined ? !!spreadable : isArray(O);
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
604
|
+
|
|
605
|
+
// `Array.prototype.concat` method
|
|
606
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.concat
|
|
607
|
+
// with adding support of @@isConcatSpreadable and @@species
|
|
608
|
+
_export({ target: 'Array', proto: true, forced: FORCED }, {
|
|
609
|
+
concat: function concat(arg) { // eslint-disable-line no-unused-vars
|
|
610
|
+
var O = toObject(this);
|
|
611
|
+
var A = arraySpeciesCreate(O, 0);
|
|
612
|
+
var n = 0;
|
|
613
|
+
var i, k, length, len, E;
|
|
614
|
+
for (i = -1, length = arguments.length; i < length; i++) {
|
|
615
|
+
E = i === -1 ? O : arguments[i];
|
|
616
|
+
if (isConcatSpreadable(E)) {
|
|
617
|
+
len = toLength(E.length);
|
|
618
|
+
if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
619
|
+
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
620
|
+
} else {
|
|
621
|
+
if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
622
|
+
createProperty(A, n++, E);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
A.length = n;
|
|
626
|
+
return A;
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
var aFunction$1 = function (it) {
|
|
631
|
+
if (typeof it != 'function') {
|
|
632
|
+
throw TypeError(String(it) + ' is not a function');
|
|
633
|
+
} return it;
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
// optional / simple context binding
|
|
637
|
+
var bindContext = function (fn, that, length) {
|
|
638
|
+
aFunction$1(fn);
|
|
639
|
+
if (that === undefined) return fn;
|
|
640
|
+
switch (length) {
|
|
641
|
+
case 0: return function () {
|
|
642
|
+
return fn.call(that);
|
|
643
|
+
};
|
|
644
|
+
case 1: return function (a) {
|
|
645
|
+
return fn.call(that, a);
|
|
646
|
+
};
|
|
647
|
+
case 2: return function (a, b) {
|
|
648
|
+
return fn.call(that, a, b);
|
|
649
|
+
};
|
|
650
|
+
case 3: return function (a, b, c) {
|
|
651
|
+
return fn.call(that, a, b, c);
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
return function (/* ...args */) {
|
|
655
|
+
return fn.apply(that, arguments);
|
|
656
|
+
};
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
var push = [].push;
|
|
660
|
+
|
|
661
|
+
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
|
|
662
|
+
var createMethod$1 = function (TYPE) {
|
|
663
|
+
var IS_MAP = TYPE == 1;
|
|
664
|
+
var IS_FILTER = TYPE == 2;
|
|
665
|
+
var IS_SOME = TYPE == 3;
|
|
666
|
+
var IS_EVERY = TYPE == 4;
|
|
667
|
+
var IS_FIND_INDEX = TYPE == 6;
|
|
668
|
+
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
|
669
|
+
return function ($this, callbackfn, that, specificCreate) {
|
|
670
|
+
var O = toObject($this);
|
|
671
|
+
var self = indexedObject(O);
|
|
672
|
+
var boundFunction = bindContext(callbackfn, that, 3);
|
|
673
|
+
var length = toLength(self.length);
|
|
674
|
+
var index = 0;
|
|
675
|
+
var create = specificCreate || arraySpeciesCreate;
|
|
676
|
+
var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
|
|
677
|
+
var value, result;
|
|
678
|
+
for (;length > index; index++) if (NO_HOLES || index in self) {
|
|
679
|
+
value = self[index];
|
|
680
|
+
result = boundFunction(value, index, O);
|
|
681
|
+
if (TYPE) {
|
|
682
|
+
if (IS_MAP) target[index] = result; // map
|
|
683
|
+
else if (result) switch (TYPE) {
|
|
684
|
+
case 3: return true; // some
|
|
685
|
+
case 5: return value; // find
|
|
686
|
+
case 6: return index; // findIndex
|
|
687
|
+
case 2: push.call(target, value); // filter
|
|
688
|
+
} else if (IS_EVERY) return false; // every
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
var arrayIteration = {
|
|
696
|
+
// `Array.prototype.forEach` method
|
|
697
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
|
|
698
|
+
forEach: createMethod$1(0),
|
|
699
|
+
// `Array.prototype.map` method
|
|
700
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.map
|
|
701
|
+
map: createMethod$1(1),
|
|
702
|
+
// `Array.prototype.filter` method
|
|
703
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.filter
|
|
704
|
+
filter: createMethod$1(2),
|
|
705
|
+
// `Array.prototype.some` method
|
|
706
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.some
|
|
707
|
+
some: createMethod$1(3),
|
|
708
|
+
// `Array.prototype.every` method
|
|
709
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.every
|
|
710
|
+
every: createMethod$1(4),
|
|
711
|
+
// `Array.prototype.find` method
|
|
712
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.find
|
|
713
|
+
find: createMethod$1(5),
|
|
714
|
+
// `Array.prototype.findIndex` method
|
|
715
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
|
|
716
|
+
findIndex: createMethod$1(6)
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
// `Object.keys` method
|
|
720
|
+
// https://tc39.github.io/ecma262/#sec-object.keys
|
|
721
|
+
var objectKeys = Object.keys || function keys(O) {
|
|
722
|
+
return objectKeysInternal(O, enumBugKeys);
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
// `Object.defineProperties` method
|
|
726
|
+
// https://tc39.github.io/ecma262/#sec-object.defineproperties
|
|
727
|
+
var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
728
|
+
anObject(O);
|
|
729
|
+
var keys = objectKeys(Properties);
|
|
730
|
+
var length = keys.length;
|
|
731
|
+
var index = 0;
|
|
732
|
+
var key;
|
|
733
|
+
while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
|
|
734
|
+
return O;
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
var html = getBuiltIn('document', 'documentElement');
|
|
738
|
+
|
|
739
|
+
var IE_PROTO = sharedKey('IE_PROTO');
|
|
740
|
+
|
|
741
|
+
var PROTOTYPE = 'prototype';
|
|
742
|
+
var Empty = function () { /* empty */ };
|
|
743
|
+
|
|
744
|
+
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
745
|
+
var createDict = function () {
|
|
746
|
+
// Thrash, waste and sodomy: IE GC bug
|
|
747
|
+
var iframe = documentCreateElement('iframe');
|
|
748
|
+
var length = enumBugKeys.length;
|
|
749
|
+
var lt = '<';
|
|
750
|
+
var script = 'script';
|
|
751
|
+
var gt = '>';
|
|
752
|
+
var js = 'java' + script + ':';
|
|
753
|
+
var iframeDocument;
|
|
754
|
+
iframe.style.display = 'none';
|
|
755
|
+
html.appendChild(iframe);
|
|
756
|
+
iframe.src = String(js);
|
|
757
|
+
iframeDocument = iframe.contentWindow.document;
|
|
758
|
+
iframeDocument.open();
|
|
759
|
+
iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
|
|
760
|
+
iframeDocument.close();
|
|
761
|
+
createDict = iframeDocument.F;
|
|
762
|
+
while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
|
|
763
|
+
return createDict();
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
// `Object.create` method
|
|
767
|
+
// https://tc39.github.io/ecma262/#sec-object.create
|
|
768
|
+
var objectCreate = Object.create || function create(O, Properties) {
|
|
769
|
+
var result;
|
|
770
|
+
if (O !== null) {
|
|
771
|
+
Empty[PROTOTYPE] = anObject(O);
|
|
772
|
+
result = new Empty();
|
|
773
|
+
Empty[PROTOTYPE] = null;
|
|
774
|
+
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
775
|
+
result[IE_PROTO] = O;
|
|
776
|
+
} else result = createDict();
|
|
777
|
+
return Properties === undefined ? result : objectDefineProperties(result, Properties);
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
hiddenKeys[IE_PROTO] = true;
|
|
781
|
+
|
|
782
|
+
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
783
|
+
var ArrayPrototype = Array.prototype;
|
|
784
|
+
|
|
785
|
+
// Array.prototype[@@unscopables]
|
|
786
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
|
787
|
+
if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
|
788
|
+
hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
// add a key to Array.prototype[@@unscopables]
|
|
792
|
+
var addToUnscopables = function (key) {
|
|
793
|
+
ArrayPrototype[UNSCOPABLES][key] = true;
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
var $find = arrayIteration.find;
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
var FIND = 'find';
|
|
800
|
+
var SKIPS_HOLES = true;
|
|
801
|
+
|
|
802
|
+
// Shouldn't skip holes
|
|
803
|
+
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
|
804
|
+
|
|
805
|
+
// `Array.prototype.find` method
|
|
806
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.find
|
|
807
|
+
_export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
|
808
|
+
find: function find(callbackfn /* , that = undefined */) {
|
|
809
|
+
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
|
|
813
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
|
814
|
+
addToUnscopables(FIND);
|
|
815
|
+
|
|
816
|
+
var sloppyArrayMethod = function (METHOD_NAME, argument) {
|
|
817
|
+
var method = [][METHOD_NAME];
|
|
818
|
+
return !method || !fails(function () {
|
|
819
|
+
// eslint-disable-next-line no-useless-call,no-throw-literal
|
|
820
|
+
method.call(null, argument || function () { throw 1; }, 1);
|
|
821
|
+
});
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
var nativeJoin = [].join;
|
|
825
|
+
|
|
826
|
+
var ES3_STRINGS = indexedObject != Object;
|
|
827
|
+
var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
|
|
828
|
+
|
|
829
|
+
// `Array.prototype.join` method
|
|
830
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.join
|
|
831
|
+
_export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
|
|
832
|
+
join: function join(separator) {
|
|
833
|
+
return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
var $map = arrayIteration.map;
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
// `Array.prototype.map` method
|
|
841
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.map
|
|
842
|
+
// with adding support of @@species
|
|
843
|
+
_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('map') }, {
|
|
844
|
+
map: function map(callbackfn /* , thisArg */) {
|
|
845
|
+
return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
var SPECIES$2 = wellKnownSymbol('species');
|
|
850
|
+
var nativeSlice = [].slice;
|
|
851
|
+
var max$1 = Math.max;
|
|
852
|
+
|
|
853
|
+
// `Array.prototype.slice` method
|
|
854
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.slice
|
|
855
|
+
// fallback for not array-like ES3 strings and DOM objects
|
|
856
|
+
_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
|
|
857
|
+
slice: function slice(start, end) {
|
|
858
|
+
var O = toIndexedObject(this);
|
|
859
|
+
var length = toLength(O.length);
|
|
860
|
+
var k = toAbsoluteIndex(start, length);
|
|
861
|
+
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
862
|
+
// inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
|
|
863
|
+
var Constructor, result, n;
|
|
864
|
+
if (isArray(O)) {
|
|
865
|
+
Constructor = O.constructor;
|
|
866
|
+
// cross-realm fallback
|
|
867
|
+
if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
|
|
868
|
+
Constructor = undefined;
|
|
869
|
+
} else if (isObject(Constructor)) {
|
|
870
|
+
Constructor = Constructor[SPECIES$2];
|
|
871
|
+
if (Constructor === null) Constructor = undefined;
|
|
872
|
+
}
|
|
873
|
+
if (Constructor === Array || Constructor === undefined) {
|
|
874
|
+
return nativeSlice.call(O, k, fin);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
|
|
878
|
+
for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
|
|
879
|
+
result.length = n;
|
|
880
|
+
return result;
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
var nativeSort = [].sort;
|
|
885
|
+
var test = [1, 2, 3];
|
|
886
|
+
|
|
887
|
+
// IE8-
|
|
888
|
+
var FAILS_ON_UNDEFINED = fails(function () {
|
|
889
|
+
test.sort(undefined);
|
|
890
|
+
});
|
|
891
|
+
// V8 bug
|
|
892
|
+
var FAILS_ON_NULL = fails(function () {
|
|
893
|
+
test.sort(null);
|
|
894
|
+
});
|
|
895
|
+
// Old WebKit
|
|
896
|
+
var SLOPPY_METHOD$1 = sloppyArrayMethod('sort');
|
|
897
|
+
|
|
898
|
+
var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$1;
|
|
899
|
+
|
|
900
|
+
// `Array.prototype.sort` method
|
|
901
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.sort
|
|
902
|
+
_export({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
903
|
+
sort: function sort(comparefn) {
|
|
904
|
+
return comparefn === undefined
|
|
905
|
+
? nativeSort.call(toObject(this))
|
|
906
|
+
: nativeSort.call(toObject(this), aFunction$1(comparefn));
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
|
|
910
|
+
var max$2 = Math.max;
|
|
911
|
+
var min$2 = Math.min;
|
|
912
|
+
var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
|
|
913
|
+
var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
|
|
914
|
+
|
|
915
|
+
// `Array.prototype.splice` method
|
|
916
|
+
// https://tc39.github.io/ecma262/#sec-array.prototype.splice
|
|
917
|
+
// with adding support of @@species
|
|
918
|
+
_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, {
|
|
919
|
+
splice: function splice(start, deleteCount /* , ...items */) {
|
|
920
|
+
var O = toObject(this);
|
|
921
|
+
var len = toLength(O.length);
|
|
922
|
+
var actualStart = toAbsoluteIndex(start, len);
|
|
923
|
+
var argumentsLength = arguments.length;
|
|
924
|
+
var insertCount, actualDeleteCount, A, k, from, to;
|
|
925
|
+
if (argumentsLength === 0) {
|
|
926
|
+
insertCount = actualDeleteCount = 0;
|
|
927
|
+
} else if (argumentsLength === 1) {
|
|
928
|
+
insertCount = 0;
|
|
929
|
+
actualDeleteCount = len - actualStart;
|
|
930
|
+
} else {
|
|
931
|
+
insertCount = argumentsLength - 2;
|
|
932
|
+
actualDeleteCount = min$2(max$2(toInteger(deleteCount), 0), len - actualStart);
|
|
933
|
+
}
|
|
934
|
+
if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) {
|
|
935
|
+
throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
|
|
936
|
+
}
|
|
937
|
+
A = arraySpeciesCreate(O, actualDeleteCount);
|
|
938
|
+
for (k = 0; k < actualDeleteCount; k++) {
|
|
939
|
+
from = actualStart + k;
|
|
940
|
+
if (from in O) createProperty(A, k, O[from]);
|
|
941
|
+
}
|
|
942
|
+
A.length = actualDeleteCount;
|
|
943
|
+
if (insertCount < actualDeleteCount) {
|
|
944
|
+
for (k = actualStart; k < len - actualDeleteCount; k++) {
|
|
945
|
+
from = k + actualDeleteCount;
|
|
946
|
+
to = k + insertCount;
|
|
947
|
+
if (from in O) O[to] = O[from];
|
|
948
|
+
else delete O[to];
|
|
949
|
+
}
|
|
950
|
+
for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
|
|
951
|
+
} else if (insertCount > actualDeleteCount) {
|
|
952
|
+
for (k = len - actualDeleteCount; k > actualStart; k--) {
|
|
953
|
+
from = k + actualDeleteCount - 1;
|
|
954
|
+
to = k + insertCount - 1;
|
|
955
|
+
if (from in O) O[to] = O[from];
|
|
956
|
+
else delete O[to];
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
for (k = 0; k < insertCount; k++) {
|
|
960
|
+
O[k + actualStart] = arguments[k + 2];
|
|
961
|
+
}
|
|
962
|
+
O.length = len - actualDeleteCount + insertCount;
|
|
963
|
+
return A;
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
968
|
+
// ES3 wrong here
|
|
969
|
+
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
970
|
+
|
|
971
|
+
// fallback for IE11 Script Access Denied error
|
|
972
|
+
var tryGet = function (it, key) {
|
|
973
|
+
try {
|
|
974
|
+
return it[key];
|
|
975
|
+
} catch (error) { /* empty */ }
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
979
|
+
var classof = function (it) {
|
|
980
|
+
var O, tag, result;
|
|
981
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
982
|
+
// @@toStringTag case
|
|
983
|
+
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
984
|
+
// builtinTag case
|
|
985
|
+
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
986
|
+
// ES3 arguments fallback
|
|
987
|
+
: (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
|
|
991
|
+
var test$1 = {};
|
|
992
|
+
|
|
993
|
+
test$1[TO_STRING_TAG$1] = 'z';
|
|
994
|
+
|
|
995
|
+
// `Object.prototype.toString` method implementation
|
|
996
|
+
// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
|
|
997
|
+
var objectToString = String(test$1) !== '[object z]' ? function toString() {
|
|
998
|
+
return '[object ' + classof(this) + ']';
|
|
999
|
+
} : test$1.toString;
|
|
1000
|
+
|
|
1001
|
+
var ObjectPrototype = Object.prototype;
|
|
1002
|
+
|
|
1003
|
+
// `Object.prototype.toString` method
|
|
1004
|
+
// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
|
|
1005
|
+
if (objectToString !== ObjectPrototype.toString) {
|
|
1006
|
+
redefine(ObjectPrototype, 'toString', objectToString, { unsafe: true });
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
// a string of all valid unicode whitespaces
|
|
1010
|
+
// eslint-disable-next-line max-len
|
|
1011
|
+
var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
1012
|
+
|
|
1013
|
+
var whitespace = '[' + whitespaces + ']';
|
|
1014
|
+
var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
|
1015
|
+
var rtrim = RegExp(whitespace + whitespace + '*$');
|
|
1016
|
+
|
|
1017
|
+
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
1018
|
+
var createMethod$2 = function (TYPE) {
|
|
1019
|
+
return function ($this) {
|
|
1020
|
+
var string = String(requireObjectCoercible($this));
|
|
1021
|
+
if (TYPE & 1) string = string.replace(ltrim, '');
|
|
1022
|
+
if (TYPE & 2) string = string.replace(rtrim, '');
|
|
1023
|
+
return string;
|
|
1024
|
+
};
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
var stringTrim = {
|
|
1028
|
+
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
1029
|
+
// https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
|
|
1030
|
+
start: createMethod$2(1),
|
|
1031
|
+
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
1032
|
+
// https://tc39.github.io/ecma262/#sec-string.prototype.trimend
|
|
1033
|
+
end: createMethod$2(2),
|
|
1034
|
+
// `String.prototype.trim` method
|
|
1035
|
+
// https://tc39.github.io/ecma262/#sec-string.prototype.trim
|
|
1036
|
+
trim: createMethod$2(3)
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
var trim = stringTrim.trim;
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
var nativeParseFloat = global_1.parseFloat;
|
|
1043
|
+
var FORCED$2 = 1 / nativeParseFloat(whitespaces + '-0') !== -Infinity;
|
|
1044
|
+
|
|
1045
|
+
// `parseFloat` method
|
|
1046
|
+
// https://tc39.github.io/ecma262/#sec-parsefloat-string
|
|
1047
|
+
var _parseFloat = FORCED$2 ? function parseFloat(string) {
|
|
1048
|
+
var trimmedString = trim(String(string));
|
|
1049
|
+
var result = nativeParseFloat(trimmedString);
|
|
1050
|
+
return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
|
|
1051
|
+
} : nativeParseFloat;
|
|
1052
|
+
|
|
1053
|
+
// `parseFloat` method
|
|
1054
|
+
// https://tc39.github.io/ecma262/#sec-parsefloat-string
|
|
1055
|
+
_export({ global: true, forced: parseFloat != _parseFloat }, {
|
|
1056
|
+
parseFloat: _parseFloat
|
|
1057
|
+
});
|
|
1058
|
+
|
|
1059
|
+
// `RegExp.prototype.flags` getter implementation
|
|
1060
|
+
// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
|
|
1061
|
+
var regexpFlags = function () {
|
|
1062
|
+
var that = anObject(this);
|
|
1063
|
+
var result = '';
|
|
1064
|
+
if (that.global) result += 'g';
|
|
1065
|
+
if (that.ignoreCase) result += 'i';
|
|
1066
|
+
if (that.multiline) result += 'm';
|
|
1067
|
+
if (that.dotAll) result += 's';
|
|
1068
|
+
if (that.unicode) result += 'u';
|
|
1069
|
+
if (that.sticky) result += 'y';
|
|
1070
|
+
return result;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
var TO_STRING = 'toString';
|
|
1074
|
+
var RegExpPrototype = RegExp.prototype;
|
|
1075
|
+
var nativeToString = RegExpPrototype[TO_STRING];
|
|
1076
|
+
|
|
1077
|
+
var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
|
|
1078
|
+
// FF44- RegExp#toString has a wrong name
|
|
1079
|
+
var INCORRECT_NAME = nativeToString.name != TO_STRING;
|
|
1080
|
+
|
|
1081
|
+
// `RegExp.prototype.toString` method
|
|
1082
|
+
// https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
|
|
1083
|
+
if (NOT_GENERIC || INCORRECT_NAME) {
|
|
1084
|
+
redefine(RegExp.prototype, TO_STRING, function toString() {
|
|
1085
|
+
var R = anObject(this);
|
|
1086
|
+
var p = String(R.source);
|
|
1087
|
+
var rf = R.flags;
|
|
1088
|
+
var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
|
|
1089
|
+
return '/' + p + '/' + f;
|
|
1090
|
+
}, { unsafe: true });
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
var nativeExec = RegExp.prototype.exec;
|
|
1094
|
+
// This always refers to the native implementation, because the
|
|
1095
|
+
// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
|
|
1096
|
+
// which loads this file before patching the method.
|
|
1097
|
+
var nativeReplace = String.prototype.replace;
|
|
1098
|
+
|
|
1099
|
+
var patchedExec = nativeExec;
|
|
1100
|
+
|
|
1101
|
+
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
1102
|
+
var re1 = /a/;
|
|
1103
|
+
var re2 = /b*/g;
|
|
1104
|
+
nativeExec.call(re1, 'a');
|
|
1105
|
+
nativeExec.call(re2, 'a');
|
|
1106
|
+
return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
|
1107
|
+
})();
|
|
1108
|
+
|
|
1109
|
+
// nonparticipating capturing group, copied from es5-shim's String#split patch.
|
|
1110
|
+
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
1111
|
+
|
|
1112
|
+
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
|
|
1113
|
+
|
|
1114
|
+
if (PATCH) {
|
|
1115
|
+
patchedExec = function exec(str) {
|
|
1116
|
+
var re = this;
|
|
1117
|
+
var lastIndex, reCopy, match, i;
|
|
1118
|
+
|
|
1119
|
+
if (NPCG_INCLUDED) {
|
|
1120
|
+
reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
|
|
1121
|
+
}
|
|
1122
|
+
if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
|
|
1123
|
+
|
|
1124
|
+
match = nativeExec.call(re, str);
|
|
1125
|
+
|
|
1126
|
+
if (UPDATES_LAST_INDEX_WRONG && match) {
|
|
1127
|
+
re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
|
|
1128
|
+
}
|
|
1129
|
+
if (NPCG_INCLUDED && match && match.length > 1) {
|
|
1130
|
+
// Fix browsers whose `exec` methods don't consistently return `undefined`
|
|
1131
|
+
// for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
|
|
1132
|
+
nativeReplace.call(match[0], reCopy, function () {
|
|
1133
|
+
for (i = 1; i < arguments.length - 2; i++) {
|
|
1134
|
+
if (arguments[i] === undefined) match[i] = undefined;
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
return match;
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
var regexpExec = patchedExec;
|
|
1144
|
+
|
|
1145
|
+
var SPECIES$3 = wellKnownSymbol('species');
|
|
1146
|
+
|
|
1147
|
+
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
|
|
1148
|
+
// #replace needs built-in support for named groups.
|
|
1149
|
+
// #match works fine because it just return the exec results, even if it has
|
|
1150
|
+
// a "grops" property.
|
|
1151
|
+
var re = /./;
|
|
1152
|
+
re.exec = function () {
|
|
1153
|
+
var result = [];
|
|
1154
|
+
result.groups = { a: '7' };
|
|
1155
|
+
return result;
|
|
1156
|
+
};
|
|
1157
|
+
return ''.replace(re, '$<a>') !== '7';
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
|
|
1161
|
+
// Weex JS has frozen built-in prototypes, so use try / catch wrapper
|
|
1162
|
+
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
|
|
1163
|
+
var re = /(?:)/;
|
|
1164
|
+
var originalExec = re.exec;
|
|
1165
|
+
re.exec = function () { return originalExec.apply(this, arguments); };
|
|
1166
|
+
var result = 'ab'.split(re);
|
|
1167
|
+
return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
|
|
1168
|
+
});
|
|
1169
|
+
|
|
1170
|
+
var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
|
|
1171
|
+
var SYMBOL = wellKnownSymbol(KEY);
|
|
1172
|
+
|
|
1173
|
+
var DELEGATES_TO_SYMBOL = !fails(function () {
|
|
1174
|
+
// String methods call symbol-named RegEp methods
|
|
1175
|
+
var O = {};
|
|
1176
|
+
O[SYMBOL] = function () { return 7; };
|
|
1177
|
+
return ''[KEY](O) != 7;
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
|
|
1181
|
+
// Symbol-named RegExp methods call .exec
|
|
1182
|
+
var execCalled = false;
|
|
1183
|
+
var re = /a/;
|
|
1184
|
+
re.exec = function () { execCalled = true; return null; };
|
|
1185
|
+
|
|
1186
|
+
if (KEY === 'split') {
|
|
1187
|
+
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
1188
|
+
// a new one. We need to return the patched regex when creating the new one.
|
|
1189
|
+
re.constructor = {};
|
|
1190
|
+
re.constructor[SPECIES$3] = function () { return re; };
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
re[SYMBOL]('');
|
|
1194
|
+
return !execCalled;
|
|
1195
|
+
});
|
|
1196
|
+
|
|
1197
|
+
if (
|
|
1198
|
+
!DELEGATES_TO_SYMBOL ||
|
|
1199
|
+
!DELEGATES_TO_EXEC ||
|
|
1200
|
+
(KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
|
|
1201
|
+
(KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
|
|
1202
|
+
) {
|
|
1203
|
+
var nativeRegExpMethod = /./[SYMBOL];
|
|
1204
|
+
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
1205
|
+
if (regexp.exec === regexpExec) {
|
|
1206
|
+
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
1207
|
+
// The native String method already delegates to @@method (this
|
|
1208
|
+
// polyfilled function), leasing to infinite recursion.
|
|
1209
|
+
// We avoid it by directly calling the native @@method method.
|
|
1210
|
+
return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
|
|
1211
|
+
}
|
|
1212
|
+
return { done: true, value: nativeMethod.call(str, regexp, arg2) };
|
|
1213
|
+
}
|
|
1214
|
+
return { done: false };
|
|
1215
|
+
});
|
|
1216
|
+
var stringMethod = methods[0];
|
|
1217
|
+
var regexMethod = methods[1];
|
|
1218
|
+
|
|
1219
|
+
redefine(String.prototype, KEY, stringMethod);
|
|
1220
|
+
redefine(RegExp.prototype, SYMBOL, length == 2
|
|
1221
|
+
// 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
|
|
1222
|
+
// 21.2.5.11 RegExp.prototype[@@split](string, limit)
|
|
1223
|
+
? function (string, arg) { return regexMethod.call(string, this, arg); }
|
|
1224
|
+
// 21.2.5.6 RegExp.prototype[@@match](string)
|
|
1225
|
+
// 21.2.5.9 RegExp.prototype[@@search](string)
|
|
1226
|
+
: function (string) { return regexMethod.call(string, this); }
|
|
1227
|
+
);
|
|
1228
|
+
if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
var MATCH = wellKnownSymbol('match');
|
|
1233
|
+
|
|
1234
|
+
// `IsRegExp` abstract operation
|
|
1235
|
+
// https://tc39.github.io/ecma262/#sec-isregexp
|
|
1236
|
+
var isRegexp = function (it) {
|
|
1237
|
+
var isRegExp;
|
|
1238
|
+
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
var SPECIES$4 = wellKnownSymbol('species');
|
|
1242
|
+
|
|
1243
|
+
// `SpeciesConstructor` abstract operation
|
|
1244
|
+
// https://tc39.github.io/ecma262/#sec-speciesconstructor
|
|
1245
|
+
var speciesConstructor = function (O, defaultConstructor) {
|
|
1246
|
+
var C = anObject(O).constructor;
|
|
1247
|
+
var S;
|
|
1248
|
+
return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
// `String.prototype.{ codePointAt, at }` methods implementation
|
|
1252
|
+
var createMethod$3 = function (CONVERT_TO_STRING) {
|
|
1253
|
+
return function ($this, pos) {
|
|
1254
|
+
var S = String(requireObjectCoercible($this));
|
|
1255
|
+
var position = toInteger(pos);
|
|
1256
|
+
var size = S.length;
|
|
1257
|
+
var first, second;
|
|
1258
|
+
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
1259
|
+
first = S.charCodeAt(position);
|
|
1260
|
+
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
1261
|
+
|| (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
|
|
1262
|
+
? CONVERT_TO_STRING ? S.charAt(position) : first
|
|
1263
|
+
: CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
1264
|
+
};
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
var stringMultibyte = {
|
|
1268
|
+
// `String.prototype.codePointAt` method
|
|
1269
|
+
// https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
|
|
1270
|
+
codeAt: createMethod$3(false),
|
|
1271
|
+
// `String.prototype.at` method
|
|
1272
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
|
1273
|
+
charAt: createMethod$3(true)
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1276
|
+
var charAt = stringMultibyte.charAt;
|
|
1277
|
+
|
|
1278
|
+
// `AdvanceStringIndex` abstract operation
|
|
1279
|
+
// https://tc39.github.io/ecma262/#sec-advancestringindex
|
|
1280
|
+
var advanceStringIndex = function (S, index, unicode) {
|
|
1281
|
+
return index + (unicode ? charAt(S, index).length : 1);
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1284
|
+
// `RegExpExec` abstract operation
|
|
1285
|
+
// https://tc39.github.io/ecma262/#sec-regexpexec
|
|
1286
|
+
var regexpExecAbstract = function (R, S) {
|
|
1287
|
+
var exec = R.exec;
|
|
1288
|
+
if (typeof exec === 'function') {
|
|
1289
|
+
var result = exec.call(R, S);
|
|
1290
|
+
if (typeof result !== 'object') {
|
|
1291
|
+
throw TypeError('RegExp exec method returned something other than an Object or null');
|
|
1292
|
+
}
|
|
1293
|
+
return result;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
if (classofRaw(R) !== 'RegExp') {
|
|
1297
|
+
throw TypeError('RegExp#exec called on incompatible receiver');
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
return regexpExec.call(R, S);
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
var arrayPush = [].push;
|
|
1304
|
+
var min$3 = Math.min;
|
|
1305
|
+
var MAX_UINT32 = 0xFFFFFFFF;
|
|
1306
|
+
|
|
1307
|
+
// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
|
|
1308
|
+
var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
|
|
1309
|
+
|
|
1310
|
+
// @@split logic
|
|
1311
|
+
fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
|
|
1312
|
+
var internalSplit;
|
|
1313
|
+
if (
|
|
1314
|
+
'abbc'.split(/(b)*/)[1] == 'c' ||
|
|
1315
|
+
'test'.split(/(?:)/, -1).length != 4 ||
|
|
1316
|
+
'ab'.split(/(?:ab)*/).length != 2 ||
|
|
1317
|
+
'.'.split(/(.?)(.?)/).length != 4 ||
|
|
1318
|
+
'.'.split(/()()/).length > 1 ||
|
|
1319
|
+
''.split(/.?/).length
|
|
1320
|
+
) {
|
|
1321
|
+
// based on es5-shim implementation, need to rework it
|
|
1322
|
+
internalSplit = function (separator, limit) {
|
|
1323
|
+
var string = String(requireObjectCoercible(this));
|
|
1324
|
+
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
|
1325
|
+
if (lim === 0) return [];
|
|
1326
|
+
if (separator === undefined) return [string];
|
|
1327
|
+
// If `separator` is not a regex, use native split
|
|
1328
|
+
if (!isRegexp(separator)) {
|
|
1329
|
+
return nativeSplit.call(string, separator, lim);
|
|
1330
|
+
}
|
|
1331
|
+
var output = [];
|
|
1332
|
+
var flags = (separator.ignoreCase ? 'i' : '') +
|
|
1333
|
+
(separator.multiline ? 'm' : '') +
|
|
1334
|
+
(separator.unicode ? 'u' : '') +
|
|
1335
|
+
(separator.sticky ? 'y' : '');
|
|
1336
|
+
var lastLastIndex = 0;
|
|
1337
|
+
// Make `global` and avoid `lastIndex` issues by working with a copy
|
|
1338
|
+
var separatorCopy = new RegExp(separator.source, flags + 'g');
|
|
1339
|
+
var match, lastIndex, lastLength;
|
|
1340
|
+
while (match = regexpExec.call(separatorCopy, string)) {
|
|
1341
|
+
lastIndex = separatorCopy.lastIndex;
|
|
1342
|
+
if (lastIndex > lastLastIndex) {
|
|
1343
|
+
output.push(string.slice(lastLastIndex, match.index));
|
|
1344
|
+
if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
|
|
1345
|
+
lastLength = match[0].length;
|
|
1346
|
+
lastLastIndex = lastIndex;
|
|
1347
|
+
if (output.length >= lim) break;
|
|
1348
|
+
}
|
|
1349
|
+
if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
|
|
1350
|
+
}
|
|
1351
|
+
if (lastLastIndex === string.length) {
|
|
1352
|
+
if (lastLength || !separatorCopy.test('')) output.push('');
|
|
1353
|
+
} else output.push(string.slice(lastLastIndex));
|
|
1354
|
+
return output.length > lim ? output.slice(0, lim) : output;
|
|
1355
|
+
};
|
|
1356
|
+
// Chakra, V8
|
|
1357
|
+
} else if ('0'.split(undefined, 0).length) {
|
|
1358
|
+
internalSplit = function (separator, limit) {
|
|
1359
|
+
return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
|
|
1360
|
+
};
|
|
1361
|
+
} else internalSplit = nativeSplit;
|
|
1362
|
+
|
|
1363
|
+
return [
|
|
1364
|
+
// `String.prototype.split` method
|
|
1365
|
+
// https://tc39.github.io/ecma262/#sec-string.prototype.split
|
|
1366
|
+
function split(separator, limit) {
|
|
1367
|
+
var O = requireObjectCoercible(this);
|
|
1368
|
+
var splitter = separator == undefined ? undefined : separator[SPLIT];
|
|
1369
|
+
return splitter !== undefined
|
|
1370
|
+
? splitter.call(separator, O, limit)
|
|
1371
|
+
: internalSplit.call(String(O), separator, limit);
|
|
1372
|
+
},
|
|
1373
|
+
// `RegExp.prototype[@@split]` method
|
|
1374
|
+
// https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
|
|
1375
|
+
//
|
|
1376
|
+
// NOTE: This cannot be properly polyfilled in engines that don't support
|
|
1377
|
+
// the 'y' flag.
|
|
1378
|
+
function (regexp, limit) {
|
|
1379
|
+
var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
|
|
1380
|
+
if (res.done) return res.value;
|
|
1381
|
+
|
|
1382
|
+
var rx = anObject(regexp);
|
|
1383
|
+
var S = String(this);
|
|
1384
|
+
var C = speciesConstructor(rx, RegExp);
|
|
1385
|
+
|
|
1386
|
+
var unicodeMatching = rx.unicode;
|
|
1387
|
+
var flags = (rx.ignoreCase ? 'i' : '') +
|
|
1388
|
+
(rx.multiline ? 'm' : '') +
|
|
1389
|
+
(rx.unicode ? 'u' : '') +
|
|
1390
|
+
(SUPPORTS_Y ? 'y' : 'g');
|
|
1391
|
+
|
|
1392
|
+
// ^(? + rx + ) is needed, in combination with some S slicing, to
|
|
1393
|
+
// simulate the 'y' flag.
|
|
1394
|
+
var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
|
|
1395
|
+
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
|
1396
|
+
if (lim === 0) return [];
|
|
1397
|
+
if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
|
|
1398
|
+
var p = 0;
|
|
1399
|
+
var q = 0;
|
|
1400
|
+
var A = [];
|
|
1401
|
+
while (q < S.length) {
|
|
1402
|
+
splitter.lastIndex = SUPPORTS_Y ? q : 0;
|
|
1403
|
+
var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
|
|
1404
|
+
var e;
|
|
1405
|
+
if (
|
|
1406
|
+
z === null ||
|
|
1407
|
+
(e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
|
|
1408
|
+
) {
|
|
1409
|
+
q = advanceStringIndex(S, q, unicodeMatching);
|
|
1410
|
+
} else {
|
|
1411
|
+
A.push(S.slice(p, q));
|
|
1412
|
+
if (A.length === lim) return A;
|
|
1413
|
+
for (var i = 1; i <= z.length - 1; i++) {
|
|
1414
|
+
A.push(z[i]);
|
|
1415
|
+
if (A.length === lim) return A;
|
|
1416
|
+
}
|
|
1417
|
+
q = p = e;
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
A.push(S.slice(p));
|
|
1421
|
+
return A;
|
|
1422
|
+
}
|
|
1423
|
+
];
|
|
1424
|
+
}, !SUPPORTS_Y);
|
|
1425
|
+
|
|
1426
|
+
function _typeof(obj) {
|
|
1427
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
1428
|
+
_typeof = function (obj) {
|
|
1429
|
+
return typeof obj;
|
|
1430
|
+
};
|
|
1431
|
+
} else {
|
|
1432
|
+
_typeof = function (obj) {
|
|
1433
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
return _typeof(obj);
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* @author Nadim Basalamah <dimbslmh@gmail.com>
|
|
1442
|
+
* @version: v1.1.0
|
|
1443
|
+
* https://github.com/dimbslmh/bootstrap-table/tree/master/src/extensions/multiple-sort/bootstrap-table-multiple-sort.js
|
|
1444
|
+
* Modification: ErwannNevou <https://github.com/ErwannNevou>
|
|
1445
|
+
*/
|
|
1446
|
+
|
|
1447
|
+
var isSingleSort = false;
|
|
1448
|
+
var Utils = $.fn.bootstrapTable.utils;
|
|
1449
|
+
var bootstrap = {
|
|
1450
|
+
bootstrap3: {
|
|
1451
|
+
icons: {
|
|
1452
|
+
plus: 'glyphicon-plus',
|
|
1453
|
+
minus: 'glyphicon-minus',
|
|
1454
|
+
sort: 'glyphicon-sort'
|
|
1455
|
+
},
|
|
1456
|
+
html: {
|
|
1457
|
+
multipleSortModal: "\n <div class=\"modal fade\" id=\"%s\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>\n <h4 class=\"modal-title\" id=\"%sLabel\">%s</h4>\n </div>\n <div class=\"modal-body\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\">\n <button id=\"add\" type=\"button\" class=\"btn btn-default\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn btn-default\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">%s</button>\n <button type=\"button\" class=\"btn btn-primary multi-sort-order-button\">%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
|
|
1458
|
+
multipleSortButton: '<button class="multi-sort btn btn-default" type="button" data-toggle="modal" data-target="#%s" title="%s">%s</button>',
|
|
1459
|
+
multipleSortSelect: '<select class="%s %s form-control">'
|
|
1460
|
+
}
|
|
1461
|
+
},
|
|
1462
|
+
bootstrap4: {
|
|
1463
|
+
icons: {
|
|
1464
|
+
'plus': 'fa-plus',
|
|
1465
|
+
'minus': 'fa-minus',
|
|
1466
|
+
'sort': 'fa-sort'
|
|
1467
|
+
},
|
|
1468
|
+
html: {
|
|
1469
|
+
multipleSortModal: "\n <div class=\"modal fade\" id=\"%s\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"%sLabel\">%s</h5>\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"btn btn-secondary\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn btn-secondary\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">%s</button>\n <button type=\"button\" class=\"btn btn-primary multi-sort-order-button\">%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
|
|
1470
|
+
multipleSortButton: '<button class="multi-sort btn btn-secondary" type="button" data-toggle="modal" data-target="#%s" title="%s">%s</button>',
|
|
1471
|
+
multipleSortSelect: '<select class="%s %s form-control">'
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1474
|
+
semantic: {
|
|
1475
|
+
icons: {
|
|
1476
|
+
'plus': 'fa-plus',
|
|
1477
|
+
'minus': 'fa-minus',
|
|
1478
|
+
'sort': 'fa-sort'
|
|
1479
|
+
},
|
|
1480
|
+
html: {
|
|
1481
|
+
multipleSortModal: "\n <div class=\"ui modal tiny\" id=\"%s\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <i class=\"close icon\"></i>\n <div class=\"header\" id=\"%sLabel\">\n %s\n </div>\n <div class=\"image content\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"ui button\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"ui button\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"actions\">\n <div class=\"ui button deny\">%s</div>\n <div class=\"ui button approve multi-sort-order-button\">%s</div>\n </div>\n </div>\n ",
|
|
1482
|
+
multipleSortButton: '<button class="multi-sort ui button" type="button" data-toggle="modal" data-target="#%s" title="%s">%s</button>',
|
|
1483
|
+
multipleSortSelect: '<select class="%s %s">'
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
materialize: {
|
|
1487
|
+
icons: {
|
|
1488
|
+
'plus': 'plus',
|
|
1489
|
+
'minus': 'minus',
|
|
1490
|
+
'sort': 'sort'
|
|
1491
|
+
},
|
|
1492
|
+
html: {
|
|
1493
|
+
multipleSortModal: "\n <div id=\"%s\" class=\"modal\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-content\" id=\"%sLabel\">\n <h4>%s</h4>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"waves-effect waves-light btn\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"waves-effect waves-light btn\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n <div class=\"modal-footer\">\n <a href=\"javascript:void(0)\" class=\"modal-close waves-effect waves-light btn\">%s</a>\n <a href=\"javascript:void(0)\" class=\"modal-close waves-effect waves-light btn multi-sort-order-button\">%s</a>\n </div>\n </div>\n </div>\n ",
|
|
1494
|
+
multipleSortButton: '<a href="#%s" class="multi-sort waves-effect waves-light btn modal-trigger" type="button" data-toggle="modal" title="%s">%s</a>',
|
|
1495
|
+
multipleSortSelect: '<select class="%s %s browser-default">'
|
|
1496
|
+
}
|
|
1497
|
+
},
|
|
1498
|
+
foundation: {
|
|
1499
|
+
icons: {
|
|
1500
|
+
'plus': 'fa-plus',
|
|
1501
|
+
'minus': 'fa-minus',
|
|
1502
|
+
'sort': 'fa-sort'
|
|
1503
|
+
},
|
|
1504
|
+
html: {
|
|
1505
|
+
multipleSortModal: "\n <div class=\"reveal\" id=\"%s\" data-reveal aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div id=\"%sLabel\">\n <h1>%s</h1>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"padding-bottom-2\">\n <button id=\"add\" type=\"button\" class=\"waves-effect waves-light button\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"waves-effect waves-light button\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n \n <button class=\"waves-effect waves-light button\" data-close aria-label=\"Close modal\" type=\"button\">\n <span aria-hidden=\"true\">%s</span>\n </button>\n <button class=\"waves-effect waves-light button multi-sort-order-button\" data-close aria-label=\"Order\" type=\"button\">\n <span aria-hidden=\"true\">%s</span>\n </button>\n </div>\n </div>\n ",
|
|
1506
|
+
multipleSortButton: '<button class="button multi-sort" data-open="%s" title="%s">%s</button>',
|
|
1507
|
+
multipleSortSelect: '<select class="%s %s browser-default">'
|
|
1508
|
+
}
|
|
1509
|
+
},
|
|
1510
|
+
bulma: {
|
|
1511
|
+
icons: {
|
|
1512
|
+
'plus': 'fa-plus',
|
|
1513
|
+
'minus': 'fa-minus',
|
|
1514
|
+
'sort': 'fa-sort'
|
|
1515
|
+
},
|
|
1516
|
+
html: {
|
|
1517
|
+
multipleSortModal: "\n <div class=\"modal\" id=\"%s\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-content\" id=\"%sLabel\">\n <div class=\"box\">\n <h2>%s</h2>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"padding-bottom-2\">\n <button id=\"add\" type=\"button\" class=\"waves-effect waves-light button\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"waves-effect waves-light button\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n <button type=\"button\" class=\"waves-effect waves-light button\" data-close>%s</button>\n <button type=\"button\" class=\"waves-effect waves-light button multi-sort-order-button\" data-close>%s</button>\n </div>\n </div>\n </div>\n ",
|
|
1518
|
+
multipleSortButton: '<button class="button multi-sort" data-target="%s" title="%s">%s</button>',
|
|
1519
|
+
multipleSortSelect: '<select class="%s %s browser-default">'
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}[$.fn.bootstrapTable.theme];
|
|
1523
|
+
$.extend($.fn.bootstrapTable.defaults.icons, bootstrap.icons);
|
|
1524
|
+
$.extend($.fn.bootstrapTable.defaults.html, bootstrap.html);
|
|
1525
|
+
|
|
1526
|
+
var showSortModal = function showSortModal(that) {
|
|
1527
|
+
var _selector = that.sortModalSelector;
|
|
1528
|
+
|
|
1529
|
+
var _id = "#".concat(_selector);
|
|
1530
|
+
|
|
1531
|
+
var o = that.options;
|
|
1532
|
+
|
|
1533
|
+
if (!$(_id).hasClass('modal')) {
|
|
1534
|
+
var sModal = Utils.sprintf(that.constants.html.multipleSortModal, _selector, _selector, _selector, that.options.formatMultipleSort(), Utils.sprintf(that.constants.html.icon, o.iconsPrefix, that.constants.icons.plus), that.options.formatAddLevel(), Utils.sprintf(that.constants.html.icon, o.iconsPrefix, that.constants.icons.minus), that.options.formatDeleteLevel(), that.options.formatColumn(), that.options.formatOrder(), that.options.formatCancel(), that.options.formatSort());
|
|
1535
|
+
$('body').append($(sModal));
|
|
1536
|
+
that.$sortModal = $(_id);
|
|
1537
|
+
var $rows = that.$sortModal.find('tbody > tr');
|
|
1538
|
+
that.$sortModal.off('click', '#add').on('click', '#add', function () {
|
|
1539
|
+
var total = that.$sortModal.find('.multi-sort-name:first option').length;
|
|
1540
|
+
var current = that.$sortModal.find('tbody tr').length;
|
|
1541
|
+
|
|
1542
|
+
if (current < total) {
|
|
1543
|
+
current++;
|
|
1544
|
+
that.addLevel();
|
|
1545
|
+
that.setButtonStates();
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
1548
|
+
that.$sortModal.off('click', '#delete').on('click', '#delete', function () {
|
|
1549
|
+
var total = that.$sortModal.find('.multi-sort-name:first option').length;
|
|
1550
|
+
var current = that.$sortModal.find('tbody tr').length;
|
|
1551
|
+
|
|
1552
|
+
if (current > 1 && current <= total) {
|
|
1553
|
+
current--;
|
|
1554
|
+
that.$sortModal.find('tbody tr:last').remove();
|
|
1555
|
+
that.setButtonStates();
|
|
1556
|
+
}
|
|
1557
|
+
});
|
|
1558
|
+
that.$sortModal.off('click', '.multi-sort-order-button').on('click', '.multi-sort-order-button', function () {
|
|
1559
|
+
var $rows = that.$sortModal.find('tbody > tr');
|
|
1560
|
+
var $alert = that.$sortModal.find('div.alert');
|
|
1561
|
+
var fields = [];
|
|
1562
|
+
var results = [];
|
|
1563
|
+
that.options.sortPriority = $.map($rows, function (row) {
|
|
1564
|
+
var $row = $(row);
|
|
1565
|
+
var name = $row.find('.multi-sort-name').val();
|
|
1566
|
+
var order = $row.find('.multi-sort-order').val();
|
|
1567
|
+
fields.push(name);
|
|
1568
|
+
return {
|
|
1569
|
+
sortName: name,
|
|
1570
|
+
sortOrder: order
|
|
1571
|
+
};
|
|
1572
|
+
});
|
|
1573
|
+
var sorted_fields = fields.sort();
|
|
1574
|
+
|
|
1575
|
+
for (var i = 0; i < fields.length - 1; i++) {
|
|
1576
|
+
if (sorted_fields[i + 1] === sorted_fields[i]) {
|
|
1577
|
+
results.push(sorted_fields[i]);
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
if (results.length > 0) {
|
|
1582
|
+
if ($alert.length === 0) {
|
|
1583
|
+
$alert = "<div class=\"alert alert-danger\" role=\"alert\"><strong>".concat(that.options.formatDuplicateAlertTitle(), "</strong> ").concat(that.options.formatDuplicateAlertDescription(), "</div>");
|
|
1584
|
+
$($alert).insertBefore(that.$sortModal.find('.bars'));
|
|
1585
|
+
}
|
|
1586
|
+
} else {
|
|
1587
|
+
if ($alert.length === 1) {
|
|
1588
|
+
$($alert).remove();
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
if ($.inArray($.fn.bootstrapTable.theme, ['bootstrap3', 'bootstrap4']) !== -1) {
|
|
1592
|
+
that.$sortModal.modal('hide');
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
that.options.sortName = '';
|
|
1596
|
+
|
|
1597
|
+
if (that.options.sidePagination === 'server') {
|
|
1598
|
+
var t = that.options.queryParams;
|
|
1599
|
+
|
|
1600
|
+
that.options.queryParams = function (params) {
|
|
1601
|
+
params.multiSort = that.options.sortPriority;
|
|
1602
|
+
return $.fn.bootstrapTable.utils.calculateObjectValue(that.options, t, [params]);
|
|
1603
|
+
};
|
|
1604
|
+
|
|
1605
|
+
isSingleSort = false;
|
|
1606
|
+
that.initServer(that.options.silentSort);
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
that.onMultipleSort();
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
|
|
1614
|
+
if (that.options.sortPriority === null || that.options.sortPriority.length === 0) {
|
|
1615
|
+
if (that.options.sortName) {
|
|
1616
|
+
that.options.sortPriority = [{
|
|
1617
|
+
sortName: that.options.sortName,
|
|
1618
|
+
sortOrder: that.options.sortOrder
|
|
1619
|
+
}];
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
if (that.options.sortPriority !== null && that.options.sortPriority.length > 0) {
|
|
1624
|
+
if ($rows.length < that.options.sortPriority.length && _typeof(that.options.sortPriority) === 'object') {
|
|
1625
|
+
for (var i = 0; i < that.options.sortPriority.length; i++) {
|
|
1626
|
+
that.addLevel(i, that.options.sortPriority[i]);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
} else {
|
|
1630
|
+
that.addLevel(0);
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
that.setButtonStates();
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
|
|
1637
|
+
$.fn.bootstrapTable.methods.push('multipleSort');
|
|
1638
|
+
$.extend($.fn.bootstrapTable.defaults, {
|
|
1639
|
+
showMultiSort: false,
|
|
1640
|
+
showMultiSortButton: true,
|
|
1641
|
+
sortPriority: null,
|
|
1642
|
+
onMultipleSort: function onMultipleSort() {
|
|
1643
|
+
return false;
|
|
1644
|
+
}
|
|
1645
|
+
});
|
|
1646
|
+
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
|
1647
|
+
'multiple-sort.bs.table': 'onMultipleSort'
|
|
1648
|
+
});
|
|
1649
|
+
$.extend($.fn.bootstrapTable.locales, {
|
|
1650
|
+
formatMultipleSort: function formatMultipleSort() {
|
|
1651
|
+
return 'Multiple Sort';
|
|
1652
|
+
},
|
|
1653
|
+
formatAddLevel: function formatAddLevel() {
|
|
1654
|
+
return 'Add Level';
|
|
1655
|
+
},
|
|
1656
|
+
formatDeleteLevel: function formatDeleteLevel() {
|
|
1657
|
+
return 'Delete Level';
|
|
1658
|
+
},
|
|
1659
|
+
formatColumn: function formatColumn() {
|
|
1660
|
+
return 'Column';
|
|
1661
|
+
},
|
|
1662
|
+
formatOrder: function formatOrder() {
|
|
1663
|
+
return 'Order';
|
|
1664
|
+
},
|
|
1665
|
+
formatSortBy: function formatSortBy() {
|
|
1666
|
+
return 'Sort by';
|
|
1667
|
+
},
|
|
1668
|
+
formatThenBy: function formatThenBy() {
|
|
1669
|
+
return 'Then by';
|
|
1670
|
+
},
|
|
1671
|
+
formatSort: function formatSort() {
|
|
1672
|
+
return 'Sort';
|
|
1673
|
+
},
|
|
1674
|
+
formatCancel: function formatCancel() {
|
|
1675
|
+
return 'Cancel';
|
|
1676
|
+
},
|
|
1677
|
+
formatDuplicateAlertTitle: function formatDuplicateAlertTitle() {
|
|
1678
|
+
return 'Duplicate(s) detected!';
|
|
1679
|
+
},
|
|
1680
|
+
formatDuplicateAlertDescription: function formatDuplicateAlertDescription() {
|
|
1681
|
+
return 'Please remove or change any duplicate column.';
|
|
1682
|
+
},
|
|
1683
|
+
formatSortOrders: function formatSortOrders() {
|
|
1684
|
+
return {
|
|
1685
|
+
asc: 'Ascending',
|
|
1686
|
+
desc: 'Descending'
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
});
|
|
1690
|
+
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
|
|
1691
|
+
var BootstrapTable = $.fn.bootstrapTable.Constructor;
|
|
1692
|
+
var _initToolbar = BootstrapTable.prototype.initToolbar;
|
|
1693
|
+
|
|
1694
|
+
BootstrapTable.prototype.initToolbar = function () {
|
|
1695
|
+
var _this = this;
|
|
1696
|
+
|
|
1697
|
+
this.showToolbar = this.showToolbar || this.options.showMultiSort;
|
|
1698
|
+
var that = this;
|
|
1699
|
+
var sortModalSelector = "sortModal_".concat(this.$el.attr('id'));
|
|
1700
|
+
var sortModalId = "#".concat(sortModalSelector);
|
|
1701
|
+
this.$sortModal = $(sortModalId);
|
|
1702
|
+
this.sortModalSelector = sortModalSelector;
|
|
1703
|
+
|
|
1704
|
+
if (that.options.sortPriority !== null) {
|
|
1705
|
+
that.onMultipleSort();
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1709
|
+
args[_key] = arguments[_key];
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
_initToolbar.apply(this, Array.prototype.slice.apply(args));
|
|
1713
|
+
|
|
1714
|
+
if (that.options.sidePagination === 'server' && !isSingleSort && that.options.sortPriority !== null) {
|
|
1715
|
+
var t = that.options.queryParams;
|
|
1716
|
+
|
|
1717
|
+
that.options.queryParams = function (params) {
|
|
1718
|
+
params.multiSort = that.options.sortPriority;
|
|
1719
|
+
return t(params);
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
if (this.options.showMultiSort) {
|
|
1724
|
+
var $btnGroup = this.$toolbar.find('>.' + that.constants.classes.buttonsGroup.split(' ').join('.')).first();
|
|
1725
|
+
var $multiSortBtn = this.$toolbar.find('div.multi-sort');
|
|
1726
|
+
var o = that.options;
|
|
1727
|
+
|
|
1728
|
+
if (!$multiSortBtn.length && this.options.showMultiSortButton) {
|
|
1729
|
+
$multiSortBtn = Utils.sprintf(that.constants.html.multipleSortButton, that.sortModalSelector, this.options.formatMultipleSort(), Utils.sprintf(that.constants.html.icon, o.iconsPrefix, o.icons.sort));
|
|
1730
|
+
$btnGroup.append($multiSortBtn);
|
|
1731
|
+
|
|
1732
|
+
if ($.fn.bootstrapTable.theme === 'semantic') {
|
|
1733
|
+
this.$toolbar.find('.multi-sort').on('click', function () {
|
|
1734
|
+
$(sortModalId).modal('show');
|
|
1735
|
+
});
|
|
1736
|
+
} else if ($.fn.bootstrapTable.theme === 'materialize') {
|
|
1737
|
+
this.$toolbar.find('.multi-sort').on('click', function () {
|
|
1738
|
+
$(sortModalId).modal();
|
|
1739
|
+
});
|
|
1740
|
+
} else if ($.fn.bootstrapTable.theme === 'foundation') {
|
|
1741
|
+
this.$toolbar.find('.multi-sort').on('click', function () {
|
|
1742
|
+
if (!_this.foundationModal) {
|
|
1743
|
+
// eslint-disable-next-line no-undef
|
|
1744
|
+
_this.foundationModal = new Foundation.Reveal($(sortModalId));
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
_this.foundationModal.open();
|
|
1748
|
+
});
|
|
1749
|
+
} else if ($.fn.bootstrapTable.theme === 'bulma') {
|
|
1750
|
+
this.$toolbar.find('.multi-sort').on('click', function () {
|
|
1751
|
+
$('html').toggleClass('is-clipped');
|
|
1752
|
+
$(sortModalId).toggleClass('is-active');
|
|
1753
|
+
$('button[data-close]').one('click', function () {
|
|
1754
|
+
$('html').toggleClass('is-clipped');
|
|
1755
|
+
$(sortModalId).toggleClass('is-active');
|
|
1756
|
+
});
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
showSortModal(that);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
this.$el.on('sort.bs.table', function () {
|
|
1764
|
+
isSingleSort = true;
|
|
1765
|
+
});
|
|
1766
|
+
this.$el.on('multiple-sort.bs.table', function () {
|
|
1767
|
+
isSingleSort = false;
|
|
1768
|
+
});
|
|
1769
|
+
this.$el.on('load-success.bs.table', function () {
|
|
1770
|
+
if (!isSingleSort && that.options.sortPriority !== null && _typeof(that.options.sortPriority) === 'object' && that.options.sidePagination !== 'server') {
|
|
1771
|
+
that.onMultipleSort();
|
|
1772
|
+
}
|
|
1773
|
+
});
|
|
1774
|
+
this.$el.on('column-switch.bs.table', function (field, checked) {
|
|
1775
|
+
for (var i = 0; i < that.options.sortPriority.length; i++) {
|
|
1776
|
+
if (that.options.sortPriority[i].sortName === checked) {
|
|
1777
|
+
that.options.sortPriority.splice(i, 1);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
that.assignSortableArrows();
|
|
1782
|
+
that.$sortModal.remove();
|
|
1783
|
+
showSortModal(that);
|
|
1784
|
+
});
|
|
1785
|
+
this.$el.on('reset-view.bs.table', function () {
|
|
1786
|
+
if (!isSingleSort && that.options.sortPriority !== null && _typeof(that.options.sortPriority) === 'object') {
|
|
1787
|
+
that.assignSortableArrows();
|
|
1788
|
+
}
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
|
|
1793
|
+
BootstrapTable.prototype.multipleSort = function () {
|
|
1794
|
+
var that = this;
|
|
1795
|
+
|
|
1796
|
+
if (!isSingleSort && that.options.sortPriority !== null && _typeof(that.options.sortPriority) === 'object' && that.options.sidePagination !== 'server') {
|
|
1797
|
+
that.onMultipleSort();
|
|
1798
|
+
}
|
|
1799
|
+
};
|
|
1800
|
+
|
|
1801
|
+
BootstrapTable.prototype.onMultipleSort = function () {
|
|
1802
|
+
var that = this;
|
|
1803
|
+
|
|
1804
|
+
var cmp = function cmp(x, y) {
|
|
1805
|
+
return x > y ? 1 : x < y ? -1 : 0;
|
|
1806
|
+
};
|
|
1807
|
+
|
|
1808
|
+
var arrayCmp = function arrayCmp(a, b) {
|
|
1809
|
+
var arr1 = [];
|
|
1810
|
+
var arr2 = [];
|
|
1811
|
+
|
|
1812
|
+
for (var i = 0; i < that.options.sortPriority.length; i++) {
|
|
1813
|
+
var order = that.options.sortPriority[i].sortOrder === 'desc' ? -1 : 1;
|
|
1814
|
+
var aa = a[that.options.sortPriority[i].sortName];
|
|
1815
|
+
var bb = b[that.options.sortPriority[i].sortName];
|
|
1816
|
+
|
|
1817
|
+
if (aa === undefined || aa === null) {
|
|
1818
|
+
aa = '';
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
if (bb === undefined || bb === null) {
|
|
1822
|
+
bb = '';
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
if ($.isNumeric(aa) && $.isNumeric(bb)) {
|
|
1826
|
+
aa = parseFloat(aa);
|
|
1827
|
+
bb = parseFloat(bb);
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
if (typeof aa !== 'string') {
|
|
1831
|
+
aa = aa.toString();
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
arr1.push(order * cmp(aa, bb));
|
|
1835
|
+
arr2.push(order * cmp(bb, aa));
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
return cmp(arr1, arr2);
|
|
1839
|
+
};
|
|
1840
|
+
|
|
1841
|
+
this.data.sort(function (a, b) {
|
|
1842
|
+
return arrayCmp(a, b);
|
|
1843
|
+
});
|
|
1844
|
+
this.initBody();
|
|
1845
|
+
this.assignSortableArrows();
|
|
1846
|
+
this.trigger('multiple-sort');
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
BootstrapTable.prototype.addLevel = function (index, sortPriority) {
|
|
1850
|
+
var text = index === 0 ? this.options.formatSortBy() : this.options.formatThenBy();
|
|
1851
|
+
this.$sortModal.find('tbody').append($('<tr>').append($('<td>').text(text)).append($('<td>').append($(Utils.sprintf(this.constants.html.multipleSortSelect, this.constants.classes.paginationDropdown, 'multi-sort-name')))).append($('<td>').append($(Utils.sprintf(this.constants.html.multipleSortSelect, this.constants.classes.paginationDropdown, 'multi-sort-order')))));
|
|
1852
|
+
var $multiSortName = this.$sortModal.find('.multi-sort-name').last();
|
|
1853
|
+
var $multiSortOrder = this.$sortModal.find('.multi-sort-order').last();
|
|
1854
|
+
$.each(this.columns, function (i, column) {
|
|
1855
|
+
if (column.sortable === false || column.visible === false) {
|
|
1856
|
+
return true;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
$multiSortName.append("<option value=\"".concat(column.field, "\">").concat(column.title, "</option>"));
|
|
1860
|
+
});
|
|
1861
|
+
$.each(this.options.formatSortOrders(), function (value, order) {
|
|
1862
|
+
$multiSortOrder.append("<option value=\"".concat(value, "\">").concat(order, "</option>"));
|
|
1863
|
+
});
|
|
1864
|
+
|
|
1865
|
+
if (sortPriority !== undefined) {
|
|
1866
|
+
$multiSortName.find("option[value=\"".concat(sortPriority.sortName, "\"]")).attr('selected', true);
|
|
1867
|
+
$multiSortOrder.find("option[value=\"".concat(sortPriority.sortOrder, "\"]")).attr('selected', true);
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
|
|
1871
|
+
BootstrapTable.prototype.assignSortableArrows = function () {
|
|
1872
|
+
var that = this;
|
|
1873
|
+
var headers = that.$header.find('th');
|
|
1874
|
+
|
|
1875
|
+
for (var i = 0; i < headers.length; i++) {
|
|
1876
|
+
for (var c = 0; c < that.options.sortPriority.length; c++) {
|
|
1877
|
+
if ($(headers[i]).data('field') === that.options.sortPriority[c].sortName) {
|
|
1878
|
+
$(headers[i]).find('.sortable').removeClass('desc asc').addClass(that.options.sortPriority[c].sortOrder);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
|
|
1884
|
+
BootstrapTable.prototype.setButtonStates = function () {
|
|
1885
|
+
var total = this.$sortModal.find('.multi-sort-name:first option').length;
|
|
1886
|
+
var current = this.$sortModal.find('tbody tr').length;
|
|
1887
|
+
|
|
1888
|
+
if (current === total) {
|
|
1889
|
+
this.$sortModal.find('#add').attr('disabled', 'disabled');
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
if (current > 1) {
|
|
1893
|
+
this.$sortModal.find('#delete').removeAttr('disabled');
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
if (current < total) {
|
|
1897
|
+
this.$sortModal.find('#add').removeAttr('disabled');
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
if (current === 1) {
|
|
1901
|
+
this.$sortModal.find('#delete').attr('disabled', 'disabled');
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
1904
|
+
|
|
1905
|
+
}));
|