bootstrap-table-rails 1.17.1 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bootstrap-table-rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-locale-all.js +321 -3
  4. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.css +10 -2
  5. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.js +517 -248
  6. data/vendor/assets/javascripts/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js +26 -5
  7. data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js +61 -12
  8. data/vendor/assets/javascripts/bootstrap-table/extensions/cookie/bootstrap-table-cookie.js +45 -5
  9. data/vendor/assets/javascripts/bootstrap-table/extensions/copy-rows/bootstrap-table-copy-rows.js +78 -14
  10. data/vendor/assets/javascripts/bootstrap-table/extensions/custom-view/bootstrap-table-custom-view.js +59 -448
  11. data/vendor/assets/javascripts/bootstrap-table/extensions/export/bootstrap-table-export.js +83 -22
  12. data/vendor/assets/javascripts/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.js +65 -11
  13. data/vendor/assets/javascripts/bootstrap-table/extensions/group-by-v2/bootstrap-table-group-by.css +3 -2
  14. data/vendor/assets/javascripts/bootstrap-table/extensions/group-by-v2/bootstrap-table-group-by.js +179 -501
  15. data/vendor/assets/javascripts/bootstrap-table/extensions/key-events/bootstrap-table-key-events.js +2 -1
  16. data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-sort/bootstrap-table-multiple-sort.js +65 -437
  17. data/vendor/assets/javascripts/bootstrap-table/extensions/print/bootstrap-table-print.js +74 -17
  18. data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.js +17 -4
  19. data/vendor/assets/javascripts/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.js +71 -18
  20. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-af-ZA.js +6 -0
  21. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ar-SA.js +6 -0
  22. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-bg-BG.js +6 -0
  23. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ca-ES.js +6 -0
  24. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-cs-CZ.js +6 -0
  25. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-da-DK.js +6 -0
  26. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-de-DE.js +9 -3
  27. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-el-GR.js +6 -0
  28. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-en-US.js +6 -0
  29. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-AR.js +6 -0
  30. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CL.js +6 -0
  31. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CR.js +6 -0
  32. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-ES.js +6 -0
  33. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-MX.js +6 -0
  34. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-NI.js +6 -0
  35. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-SP.js +6 -0
  36. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-et-EE.js +6 -0
  37. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-eu-EU.js +6 -0
  38. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fa-IR.js +6 -0
  39. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fi-FI.js +6 -0
  40. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-BE.js +6 -0
  41. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-CH.js +6 -0
  42. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-FR.js +6 -0
  43. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-LU.js +6 -0
  44. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-he-IL.js +6 -0
  45. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hr-HR.js +6 -0
  46. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hu-HU.js +6 -0
  47. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-id-ID.js +6 -0
  48. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-it-IT.js +6 -0
  49. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ja-JP.js +6 -0
  50. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ka-GE.js +6 -0
  51. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ko-KR.js +6 -0
  52. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ms-MY.js +6 -0
  53. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nb-NO.js +6 -0
  54. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-BE.js +6 -0
  55. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-NL.js +6 -0
  56. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pl-PL.js +6 -0
  57. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-BR.js +6 -0
  58. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-PT.js +6 -0
  59. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ro-RO.js +6 -0
  60. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ru-RU.js +6 -0
  61. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sk-SK.js +6 -0
  62. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Cyrl-RS.js +6 -0
  63. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Latn-RS.js +6 -0
  64. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sv-SE.js +6 -0
  65. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-th-TH.js +6 -0
  66. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-tr-TR.js +6 -0
  67. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uk-UA.js +6 -0
  68. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ur-PK.js +6 -0
  69. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uz-Latn-UZ.js +6 -0
  70. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-vi-VN.js +6 -0
  71. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-CN.js +6 -0
  72. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-TW.js +6 -0
  73. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/bootstrap-table.css +9 -1
  74. data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.css +9 -1
  75. data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.js +1 -1
  76. data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.css +9 -1
  77. data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.js +1 -1
  78. data/vendor/assets/javascripts/bootstrap-table/themes/materialize/bootstrap-table-materialize.css +9 -1
  79. data/vendor/assets/javascripts/bootstrap-table/themes/semantic/bootstrap-table-semantic.css +9 -1
  80. metadata +1 -1
@@ -1549,6 +1549,7 @@
1549
1549
  // 搜索name=general这种形式的字符串(&是分隔符)
1550
1550
  var pattern = "".concat(key, "=([^&]*)");
1551
1551
  var targetStr = "".concat(key, "=").concat(val);
1552
+ if (val === undefined) continue;
1552
1553
  /*
1553
1554
  * 如果目标url中包含了key键, 我们需要将它替换成我们自己的val
1554
1555
  * 不然就直接添加好了.
@@ -1569,6 +1570,20 @@
1569
1570
 
1570
1571
  return url;
1571
1572
  }
1573
+ /*
1574
+ * function: _updateHistoryState
1575
+ * var _prefix = this.options.addrPrefix || ''
1576
+ * var table = this
1577
+ * _updateHistoryState( table,_prefix)
1578
+ * returns void
1579
+ */
1580
+
1581
+
1582
+ function _updateHistoryState(table, _prefix) {
1583
+ var params = {};
1584
+ params["".concat(_prefix, "page")] = table.options.pageNumber, params["".concat(_prefix, "size")] = table.options.pageSize, params["".concat(_prefix, "order")] = table.options.sortOrder, params["".concat(_prefix, "sort")] = table.options.sortName, params["".concat(_prefix, "search")] = table.options.searchText;
1585
+ window.history.pushState({}, '', _buildUrl(params));
1586
+ }
1572
1587
 
1573
1588
  $.extend($.fn.bootstrapTable.defaults, {
1574
1589
  addrbar: false,
@@ -1592,7 +1607,7 @@
1592
1607
  var _this = this,
1593
1608
  _get2;
1594
1609
 
1595
- if (this.options.pagination && this.options.sidePagination === 'server' && this.options.addrbar) {
1610
+ if (this.options.pagination && this.options.addrbar) {
1596
1611
  // 标志位, 初始加载后关闭
1597
1612
  this.addrbarInit = true;
1598
1613
  this.options.pageNumber = +this.getDefaultOptionValue('pageNumber', 'page');
@@ -1604,21 +1619,27 @@
1604
1619
  var _prefix = this.options.addrPrefix || '';
1605
1620
 
1606
1621
  var _onLoadSuccess = this.options.onLoadSuccess;
1622
+ var _onPageChange = this.options.onPageChange;
1607
1623
 
1608
1624
  this.options.onLoadSuccess = function (data) {
1609
1625
  if (_this.addrbarInit) {
1610
1626
  _this.addrbarInit = false;
1611
1627
  } else {
1612
- var params = {};
1613
- params["".concat(_prefix, "page")] = _this.options.pageNumber, params["".concat(_prefix, "size")] = _this.options.pageSize, params["".concat(_prefix, "order")] = _this.options.sortOrder, params["".concat(_prefix, "sort")] = _this.options.sortName, params["".concat(_prefix, "search")] = _this.options.searchText; // h5提供的修改浏览器地址栏的方法
1614
-
1615
- window.history.pushState({}, '', _buildUrl(params));
1628
+ _updateHistoryState(_this, _prefix);
1616
1629
  }
1617
1630
 
1618
1631
  if (_onLoadSuccess) {
1619
1632
  _onLoadSuccess.call(_this, data);
1620
1633
  }
1621
1634
  };
1635
+
1636
+ this.options.onPageChange = function (number, size) {
1637
+ _updateHistoryState(_this, _prefix);
1638
+
1639
+ if (_onPageChange) {
1640
+ _onPageChange.call(_this, number, size);
1641
+ }
1642
+ };
1622
1643
  }
1623
1644
 
1624
1645
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -885,6 +885,56 @@
885
885
  // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
886
886
  addToUnscopables(FIND);
887
887
 
888
+ var nativeAssign = Object.assign;
889
+ var defineProperty = Object.defineProperty;
890
+
891
+ // `Object.assign` method
892
+ // https://tc39.github.io/ecma262/#sec-object.assign
893
+ var objectAssign = !nativeAssign || fails(function () {
894
+ // should have correct order of operations (Edge bug)
895
+ if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
896
+ enumerable: true,
897
+ get: function () {
898
+ defineProperty(this, 'b', {
899
+ value: 3,
900
+ enumerable: false
901
+ });
902
+ }
903
+ }), { b: 2 })).b !== 1) return true;
904
+ // should work with symbols and should have deterministic property order (V8 bug)
905
+ var A = {};
906
+ var B = {};
907
+ // eslint-disable-next-line no-undef
908
+ var symbol = Symbol();
909
+ var alphabet = 'abcdefghijklmnopqrst';
910
+ A[symbol] = 7;
911
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
912
+ return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
913
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
914
+ var T = toObject(target);
915
+ var argumentsLength = arguments.length;
916
+ var index = 1;
917
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
918
+ var propertyIsEnumerable = objectPropertyIsEnumerable.f;
919
+ while (argumentsLength > index) {
920
+ var S = indexedObject(arguments[index++]);
921
+ var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
922
+ var length = keys.length;
923
+ var j = 0;
924
+ var key;
925
+ while (length > j) {
926
+ key = keys[j++];
927
+ if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
928
+ }
929
+ } return T;
930
+ } : nativeAssign;
931
+
932
+ // `Object.assign` method
933
+ // https://tc39.github.io/ecma262/#sec-object.assign
934
+ _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
935
+ assign: objectAssign
936
+ });
937
+
888
938
  function _classCallCheck(instance, Constructor) {
889
939
  if (!(instance instanceof Constructor)) {
890
940
  throw new TypeError("Cannot call a class as a function");
@@ -1048,21 +1098,20 @@
1048
1098
  value: function initToolbar() {
1049
1099
  var _get3;
1050
1100
 
1101
+ if (this.options.autoRefresh) {
1102
+ this.buttons = Object.assign(this.buttons, {
1103
+ autoRefresh: {
1104
+ 'html': "\n <button class=\"auto-refresh ".concat(this.constants.buttonsClass, "\n ").concat(this.options.autoRefreshStatus ? " ".concat(this.constants.classes.buttonActive) : '', "\"\n type=\"button\" name=\"autoRefresh\" title=\"").concat(this.options.formatAutoRefresh(), "\">\n ").concat(this.options.showButtonIcons ? Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.autoRefresh) : '', "\n ").concat(this.options.showButtonText ? this.options.formatAutoRefresh() : '', "\n </button>\n "),
1105
+ 'event': this.toggleAutoRefresh
1106
+ }
1107
+ });
1108
+ }
1109
+
1051
1110
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1052
1111
  args[_key2] = arguments[_key2];
1053
1112
  }
1054
1113
 
1055
1114
  (_get3 = _get(_getPrototypeOf(_class.prototype), "initToolbar", this)).call.apply(_get3, [this].concat(args));
1056
-
1057
- if (this.options.autoRefresh) {
1058
- var $btnGroup = this.$toolbar.find('>.columns');
1059
- var $btnAutoRefresh = $btnGroup.find('.auto-refresh');
1060
-
1061
- if (!$btnAutoRefresh.length) {
1062
- $btnAutoRefresh = $("\n <button class=\"auto-refresh ".concat(this.constants.buttonsClass, "\n ").concat(this.options.autoRefreshStatus ? " ".concat(this.constants.classes.buttonActive) : '', "\"\n type=\"button\" title=\"").concat(this.options.formatAutoRefresh(), "\">\n ").concat(this.options.showButtonIcons ? Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.autoRefresh) : '', "\n ").concat(this.options.showButtonText ? this.options.formatAutoRefresh() : '', "\n </button>\n ")).appendTo($btnGroup);
1063
- $btnAutoRefresh.on('click', $.proxy(this.toggleAutoRefresh, this));
1064
- }
1065
- }
1066
1115
  }
1067
1116
  }, {
1068
1117
  key: "toggleAutoRefresh",
@@ -1072,14 +1121,14 @@
1072
1121
  if (this.options.autoRefresh) {
1073
1122
  if (this.options.autoRefreshStatus) {
1074
1123
  clearInterval(this.options.autoRefreshFunction);
1075
- this.$toolbar.find('>.columns').find('.auto-refresh').removeClass(this.constants.classes.buttonActive);
1124
+ this.$toolbar.find('>.columns .auto-refresh').removeClass(this.constants.classes.buttonActive);
1076
1125
  } else {
1077
1126
  this.options.autoRefreshFunction = setInterval(function () {
1078
1127
  _this2.refresh({
1079
1128
  silent: _this2.options.autoRefreshSilent
1080
1129
  });
1081
1130
  }, this.options.autoRefreshInterval * 1000);
1082
- this.$toolbar.find('>.columns').find('.auto-refresh').addClass(this.constants.classes.buttonActive);
1131
+ this.$toolbar.find('>.columns .auto-refresh').addClass(this.constants.classes.buttonActive);
1083
1132
  }
1084
1133
 
1085
1134
  this.options.autoRefreshStatus = !this.options.autoRefreshStatus;
@@ -1504,6 +1504,25 @@
1504
1504
  }
1505
1505
  });
1506
1506
 
1507
+ var $map = arrayIteration.map;
1508
+
1509
+
1510
+
1511
+ var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('map');
1512
+ // FF49- issue
1513
+ var USES_TO_LENGTH$1 = HAS_SPECIES_SUPPORT$1 && !fails(function () {
1514
+ [].map.call({ length: -1, 0: 1 }, function (it) { throw it; });
1515
+ });
1516
+
1517
+ // `Array.prototype.map` method
1518
+ // https://tc39.github.io/ecma262/#sec-array.prototype.map
1519
+ // with adding support of @@species
1520
+ _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$1 }, {
1521
+ map: function map(callbackfn /* , thisArg */) {
1522
+ return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1523
+ }
1524
+ });
1525
+
1507
1526
  var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1508
1527
  var test = {};
1509
1528
 
@@ -2419,7 +2438,7 @@
2419
2438
 
2420
2439
  switch (that.options.cookieStorage) {
2421
2440
  case 'cookieStorage':
2422
- document.cookie = [cookieName, '=', encodeURIComponent(cookieValue), "; expires=".concat(UtilsCookie.calculateExpiration(that.options.cookieExpire)), that.options.cookiePath ? "; path=".concat(that.options.cookiePath) : '', that.options.cookieDomain ? "; domain=".concat(that.options.cookieDomain) : '', that.options.cookieSecure ? '; secure' : ''].join('');
2441
+ document.cookie = [cookieName, '=', encodeURIComponent(cookieValue), "; expires=".concat(UtilsCookie.calculateExpiration(that.options.cookieExpire)), that.options.cookiePath ? "; path=".concat(that.options.cookiePath) : '', that.options.cookieDomain ? "; domain=".concat(that.options.cookieDomain) : '', that.options.cookieSecure ? '; secure' : '', ';SameSite=' + that.options.cookieSameSite].join('');
2423
2442
  break;
2424
2443
 
2425
2444
  case 'localStorage':
@@ -2621,6 +2640,7 @@
2621
2640
  cookiePath: null,
2622
2641
  cookieDomain: null,
2623
2642
  cookieSecure: null,
2643
+ cookieSameSite: 'Lax',
2624
2644
  cookieIdTable: '',
2625
2645
  cookiesEnabled: ['bs.table.sortOrder', 'bs.table.sortName', 'bs.table.pageNumber', 'bs.table.pageList', 'bs.table.columns', 'bs.table.searchText', 'bs.table.filterControl', 'bs.table.filterBy', 'bs.table.reorderColumns'],
2626
2646
  cookieStorage: 'cookieStorage',
@@ -2812,7 +2832,9 @@
2812
2832
 
2813
2833
  (_get9 = _get(_getPrototypeOf(_class.prototype), "_toggleColumn", this)).call.apply(_get9, [this].concat(args));
2814
2834
 
2815
- UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns, JSON.stringify(this.getVisibleColumns()));
2835
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns, JSON.stringify(this.getVisibleColumns().map(function (column) {
2836
+ return column.field;
2837
+ })));
2816
2838
  }
2817
2839
  }, {
2818
2840
  key: "_toggleAllColumns",
@@ -2825,7 +2847,9 @@
2825
2847
 
2826
2848
  (_get10 = _get(_getPrototypeOf(_class.prototype), "_toggleAllColumns", this)).call.apply(_get10, [this].concat(args));
2827
2849
 
2828
- UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns, JSON.stringify(this.getVisibleColumns()));
2850
+ UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns, JSON.stringify(this.getVisibleColumns().map(function (column) {
2851
+ return column.field;
2852
+ })));
2829
2853
  }
2830
2854
  }, {
2831
2855
  key: "selectPage",
@@ -2881,6 +2905,8 @@
2881
2905
  }, {
2882
2906
  key: "initCookie",
2883
2907
  value: function initCookie() {
2908
+ var _this = this;
2909
+
2884
2910
  if (!this.options.cookie) {
2885
2911
  return;
2886
2912
  }
@@ -2930,8 +2956,22 @@
2930
2956
  try {
2931
2957
  var _loop = function _loop() {
2932
2958
  var column = _step.value;
2933
- column.visible = columnsCookie.filter(function (c) {
2934
- return c.field === column.field;
2959
+ column.visible = columnsCookie.filter(function (columnField) {
2960
+ if (_this.isSelectionColumn(column)) {
2961
+ return true;
2962
+ }
2963
+ /**
2964
+ * This is needed for the old saved cookies or the table will show no columns!
2965
+ * It can be removed in 2-3 Versions Later!!
2966
+ * TODO: Remove this part some versions later e.g. 1.17.3
2967
+ */
2968
+
2969
+
2970
+ if (columnField instanceof Object) {
2971
+ return columnField.field === column.field;
2972
+ }
2973
+
2974
+ return columnField === column.field;
2935
2975
  }).length > 0 || !column.switchable;
2936
2976
  };
2937
2977
 
@@ -906,6 +906,56 @@
906
906
  }
907
907
  });
908
908
 
909
+ var nativeAssign = Object.assign;
910
+ var defineProperty = Object.defineProperty;
911
+
912
+ // `Object.assign` method
913
+ // https://tc39.github.io/ecma262/#sec-object.assign
914
+ var objectAssign = !nativeAssign || fails(function () {
915
+ // should have correct order of operations (Edge bug)
916
+ if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
917
+ enumerable: true,
918
+ get: function () {
919
+ defineProperty(this, 'b', {
920
+ value: 3,
921
+ enumerable: false
922
+ });
923
+ }
924
+ }), { b: 2 })).b !== 1) return true;
925
+ // should work with symbols and should have deterministic property order (V8 bug)
926
+ var A = {};
927
+ var B = {};
928
+ // eslint-disable-next-line no-undef
929
+ var symbol = Symbol();
930
+ var alphabet = 'abcdefghijklmnopqrst';
931
+ A[symbol] = 7;
932
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
933
+ return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
934
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
935
+ var T = toObject(target);
936
+ var argumentsLength = arguments.length;
937
+ var index = 1;
938
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
939
+ var propertyIsEnumerable = objectPropertyIsEnumerable.f;
940
+ while (argumentsLength > index) {
941
+ var S = indexedObject(arguments[index++]);
942
+ var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
943
+ var length = keys.length;
944
+ var j = 0;
945
+ var key;
946
+ while (length > j) {
947
+ key = keys[j++];
948
+ if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
949
+ }
950
+ } return T;
951
+ } : nativeAssign;
952
+
953
+ // `Object.assign` method
954
+ // https://tc39.github.io/ecma262/#sec-object.assign
955
+ _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
956
+ assign: objectAssign
957
+ });
958
+
909
959
  function _classCallCheck(instance, Constructor) {
910
960
  if (!(instance instanceof Constructor)) {
911
961
  throw new TypeError("Cannot call a class as a function");
@@ -1011,6 +1061,12 @@
1011
1061
  */
1012
1062
 
1013
1063
  var Utils = $.fn.bootstrapTable.utils;
1064
+ $.extend($.fn.bootstrapTable.locales, {
1065
+ formatCopyRows: function formatCopyRows() {
1066
+ return 'Copy Rows';
1067
+ }
1068
+ });
1069
+ $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
1014
1070
  $.extend($.fn.bootstrapTable.defaults.icons, {
1015
1071
  copy: {
1016
1072
  bootstrap3: 'glyphicon-copy icon-pencil',
@@ -1056,8 +1112,21 @@
1056
1112
  _createClass(_class, [{
1057
1113
  key: "initToolbar",
1058
1114
  value: function initToolbar() {
1059
- var _get2,
1060
- _this = this;
1115
+ var _get2;
1116
+
1117
+ if (this.options.showCopyRows && this.header.stateField) {
1118
+ this.buttons = Object.assign(this.buttons, {
1119
+ copyRows: {
1120
+ 'text': this.options.formatCopyRows(),
1121
+ 'icon': this.options.icons.copy,
1122
+ 'event': this.copyColumnsToClipboard,
1123
+ 'attributes': {
1124
+ 'aria-label': this.options.formatCopyRows(),
1125
+ 'title': this.options.formatCopyRows()
1126
+ }
1127
+ }
1128
+ });
1129
+ }
1061
1130
 
1062
1131
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1063
1132
  args[_key] = arguments[_key];
@@ -1065,33 +1134,28 @@
1065
1134
 
1066
1135
  (_get2 = _get(_getPrototypeOf(_class.prototype), "initToolbar", this)).call.apply(_get2, [this].concat(args));
1067
1136
 
1068
- var $btnGroup = this.$toolbar.find('>.columns');
1137
+ this.$copyButton = this.$toolbar.find('>.columns [name="copyRows"]');
1069
1138
 
1070
1139
  if (this.options.showCopyRows && this.header.stateField) {
1071
- this.$copyButton = $("\n <button class=\"".concat(this.constants.buttonsClass, "\">\n ").concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.copy), "\n </button>\n "));
1072
- $btnGroup.append(this.$copyButton);
1073
- this.$copyButton.click(function () {
1074
- _this.copyColumnsToClipboard();
1075
- });
1076
1140
  this.updateCopyButton();
1077
1141
  }
1078
1142
  }
1079
1143
  }, {
1080
1144
  key: "copyColumnsToClipboard",
1081
1145
  value: function copyColumnsToClipboard() {
1082
- var _this2 = this;
1146
+ var _this = this;
1083
1147
 
1084
1148
  var rows = [];
1085
1149
  $.each(this.getSelections(), function (index, row) {
1086
1150
  var cols = [];
1087
- $.each(_this2.options.columns[0], function (indy, column) {
1088
- if (column.field !== _this2.header.stateField && (!_this2.options.copyWithHidden || _this2.options.copyWithHidden && column.visible)) {
1151
+ $.each(_this.options.columns[0], function (indy, column) {
1152
+ if (column.field !== _this.header.stateField && (!_this.options.copyWithHidden || _this.options.copyWithHidden && column.visible)) {
1089
1153
  if (row[column.field] !== null) {
1090
- cols.push(Utils.calculateObjectValue(column, _this2.header.formatters[indy], [row[column.field], row, index], row[column.field]));
1154
+ cols.push(Utils.calculateObjectValue(column, _this.header.formatters[indy], [row[column.field], row, index], row[column.field]));
1091
1155
  }
1092
1156
  }
1093
1157
  });
1094
- rows.push(cols.join(_this2.options.copyDelimiter));
1158
+ rows.push(cols.join(_this.options.copyDelimiter));
1095
1159
  });
1096
1160
  copyText(rows.join(this.options.copyNewline));
1097
1161
  }
@@ -1105,7 +1169,7 @@
1105
1169
  }, {
1106
1170
  key: "updateCopyButton",
1107
1171
  value: function updateCopyButton() {
1108
- if (this.options.showCopyRows) {
1172
+ if (this.options.showCopyRows && this.header.stateField && this.$copyButton) {
1109
1173
  this.$copyButton.prop('disabled', !this.getSelections().length);
1110
1174
  }
1111
1175
  }