bootstrap-table-rails 1.15.4 → 1.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +147 -54
  3. data/lib/bootstrap-table-rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-locale-all.js +876 -83
  5. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-vue.esm.js +684 -208
  6. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-vue.js +686 -210
  7. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.css +66 -11
  8. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.js +1347 -727
  9. data/vendor/assets/javascripts/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js +254 -88
  10. data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js +139 -66
  11. data/vendor/assets/javascripts/bootstrap-table/extensions/cookie/bootstrap-table-cookie.js +1309 -258
  12. data/vendor/assets/javascripts/bootstrap-table/extensions/copy-rows/bootstrap-table-copy-rows.js +139 -64
  13. data/vendor/assets/javascripts/bootstrap-table/extensions/{accent-neutralise/bootstrap-table-accent-neutralise.js → custom-view/bootstrap-table-custom-view.js} +582 -752
  14. data/vendor/assets/javascripts/bootstrap-table/extensions/defer-url/bootstrap-table-defer-url.js +83 -42
  15. data/vendor/assets/javascripts/bootstrap-table/extensions/editable/bootstrap-table-editable.js +1219 -208
  16. data/vendor/assets/javascripts/bootstrap-table/extensions/export/bootstrap-table-export.js +409 -210
  17. data/vendor/assets/javascripts/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.css +1 -1
  18. data/vendor/assets/javascripts/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.js +1369 -904
  19. data/vendor/assets/javascripts/bootstrap-table/extensions/filter-control/utils.js +2361 -0
  20. data/vendor/assets/javascripts/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.css +12 -14
  21. data/vendor/assets/javascripts/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.js +589 -423
  22. data/vendor/assets/javascripts/bootstrap-table/extensions/group-by-v2/bootstrap-table-group-by.js +494 -107
  23. data/vendor/assets/javascripts/bootstrap-table/extensions/i18n-enhance/bootstrap-table-i18n-enhance.js +3 -3
  24. data/vendor/assets/javascripts/bootstrap-table/extensions/key-events/bootstrap-table-key-events.js +217 -73
  25. data/vendor/assets/javascripts/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js +143 -66
  26. data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-sort/bootstrap-table-multiple-sort.js +374 -138
  27. data/vendor/assets/javascripts/bootstrap-table/extensions/page-jump-to/bootstrap-table-page-jump-to.js +137 -65
  28. data/vendor/assets/javascripts/bootstrap-table/extensions/pipeline/bootstrap-table-pipeline.js +87 -42
  29. data/vendor/assets/javascripts/bootstrap-table/extensions/print/bootstrap-table-print.js +388 -148
  30. data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-columns/bootstrap-table-reorder-columns.js +643 -255
  31. data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js +348 -136
  32. data/vendor/assets/javascripts/bootstrap-table/extensions/resizable/bootstrap-table-resizable.js +84 -44
  33. data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.css +0 -1
  34. data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.js +209 -76
  35. data/vendor/assets/javascripts/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.js +490 -202
  36. data/vendor/assets/javascripts/bootstrap-table/extensions/treegrid/bootstrap-table-treegrid.js +221 -115
  37. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-af-ZA.js +92 -42
  38. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ar-SA.js +92 -42
  39. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-bg-BG.js +771 -0
  40. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ca-ES.js +92 -42
  41. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-cs-CZ.js +92 -42
  42. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-da-DK.js +92 -42
  43. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-de-DE.js +92 -42
  44. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-el-GR.js +92 -42
  45. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-en-US.js +92 -42
  46. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-AR.js +114 -63
  47. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CL.js +92 -42
  48. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CR.js +92 -42
  49. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-ES.js +92 -42
  50. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-MX.js +92 -42
  51. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-NI.js +92 -42
  52. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-SP.js +92 -42
  53. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-et-EE.js +92 -42
  54. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-eu-EU.js +92 -42
  55. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fa-IR.js +92 -42
  56. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fi-FI.js +92 -42
  57. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-BE.js +92 -42
  58. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-CH.js +92 -42
  59. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-FR.js +93 -43
  60. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-LU.js +92 -42
  61. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-he-IL.js +92 -42
  62. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hr-HR.js +92 -42
  63. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hu-HU.js +92 -42
  64. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-id-ID.js +92 -42
  65. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-it-IT.js +107 -57
  66. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ja-JP.js +92 -42
  67. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ka-GE.js +92 -42
  68. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ko-KR.js +92 -42
  69. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ms-MY.js +92 -42
  70. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nb-NO.js +92 -42
  71. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-BE.js +93 -43
  72. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-NL.js +92 -42
  73. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pl-PL.js +92 -42
  74. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-BR.js +96 -45
  75. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-PT.js +92 -42
  76. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ro-RO.js +92 -42
  77. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ru-RU.js +92 -42
  78. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sk-SK.js +92 -42
  79. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Cyrl-RS.js +771 -0
  80. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Latn-RS.js +771 -0
  81. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sv-SE.js +92 -42
  82. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-th-TH.js +92 -42
  83. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-tr-TR.js +92 -42
  84. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uk-UA.js +92 -42
  85. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ur-PK.js +92 -42
  86. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uz-Latn-UZ.js +92 -42
  87. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-vi-VN.js +92 -42
  88. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-CN.js +92 -42
  89. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-TW.js +92 -42
  90. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/bootstrap-table.css +768 -0
  91. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/bootstrap-table.js +1049 -0
  92. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/fonts/bootstrap-table.eot +0 -0
  93. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/fonts/bootstrap-table.svg +28 -0
  94. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/fonts/bootstrap-table.ttf +0 -0
  95. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/fonts/bootstrap-table.woff +0 -0
  96. data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.css +80 -12
  97. data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.js +161 -63
  98. data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.css +79 -14
  99. data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.js +166 -65
  100. data/vendor/assets/javascripts/bootstrap-table/themes/materialize/bootstrap-table-materialize.css +74 -10
  101. data/vendor/assets/javascripts/bootstrap-table/themes/materialize/bootstrap-table-materialize.js +165 -67
  102. data/vendor/assets/javascripts/bootstrap-table/themes/semantic/bootstrap-table-semantic.css +80 -14
  103. data/vendor/assets/javascripts/bootstrap-table/themes/semantic/bootstrap-table-semantic.js +165 -67
  104. metadata +13 -16
  105. data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.css +0 -3
  106. data/vendor/assets/javascripts/bootstrap-table/extensions/cell-input/bootstrap-table-cell-input.css +0 -12
  107. data/vendor/assets/javascripts/bootstrap-table/extensions/cell-input/bootstrap-table-cell-input.js +0 -2087
  108. data/vendor/assets/javascripts/bootstrap-table/extensions/group-by/bootstrap-table-group-by.css +0 -53
  109. data/vendor/assets/javascripts/bootstrap-table/extensions/group-by/bootstrap-table-group-by.js +0 -257
  110. data/vendor/assets/javascripts/bootstrap-table/extensions/multi-column-toggle/bootstrap-table-multi-toggle.js +0 -105
  111. data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-search/bootstrap-table-multiple-search.js +0 -85
  112. data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-selection-row/bootstrap-table-multiple-selection-row.css +0 -17
  113. data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-selection-row/bootstrap-table-multiple-selection-row.js +0 -143
  114. data/vendor/assets/javascripts/bootstrap-table/extensions/natural-sorting/bootstrap-table-natural-sorting.js +0 -1265
  115. data/vendor/assets/javascripts/bootstrap-table/extensions/select2-filter/bootstrap-table-select2-filter.js +0 -341
  116. data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.css +0 -1
  117. data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.js +0 -142
@@ -2,9 +2,9 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
3
3
  typeof define === 'function' && define.amd ? define(['jquery'], factory) :
4
4
  (global = global || self, factory(global.jQuery));
5
- }(this, function ($) { 'use strict';
5
+ }(this, (function ($) { 'use strict';
6
6
 
7
- $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
7
+ $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
8
8
 
9
9
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
10
 
@@ -12,7 +12,6 @@
12
12
  return module = { exports: {} }, fn(module, module.exports), module.exports;
13
13
  }
14
14
 
15
- var O = 'object';
16
15
  var check = function (it) {
17
16
  return it && it.Math == Math && it;
18
17
  };
@@ -20,10 +19,10 @@
20
19
  // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
21
20
  var global_1 =
22
21
  // 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) ||
22
+ check(typeof globalThis == 'object' && globalThis) ||
23
+ check(typeof window == 'object' && window) ||
24
+ check(typeof self == 'object' && self) ||
25
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
27
26
  // eslint-disable-next-line no-new-func
28
27
  Function('return this')();
29
28
 
@@ -179,7 +178,7 @@
179
178
  f: f$2
180
179
  };
181
180
 
182
- var hide = descriptors ? function (object, key, value) {
181
+ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
183
182
  return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
184
183
  } : function (object, key, value) {
185
184
  object[key] = value;
@@ -188,31 +187,42 @@
188
187
 
189
188
  var setGlobal = function (key, value) {
190
189
  try {
191
- hide(global_1, key, value);
190
+ createNonEnumerableProperty(global_1, key, value);
192
191
  } catch (error) {
193
192
  global_1[key] = value;
194
193
  } return value;
195
194
  };
196
195
 
197
- var shared = createCommonjsModule(function (module) {
198
196
  var SHARED = '__core-js_shared__';
199
197
  var store = global_1[SHARED] || setGlobal(SHARED, {});
200
198
 
199
+ var sharedStore = store;
200
+
201
+ var functionToString = Function.toString;
202
+
203
+ // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
204
+ if (typeof sharedStore.inspectSource != 'function') {
205
+ sharedStore.inspectSource = function (it) {
206
+ return functionToString.call(it);
207
+ };
208
+ }
209
+
210
+ var inspectSource = sharedStore.inspectSource;
211
+
212
+ var WeakMap = global_1.WeakMap;
213
+
214
+ var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
215
+
216
+ var shared = createCommonjsModule(function (module) {
201
217
  (module.exports = function (key, value) {
202
- return store[key] || (store[key] = value !== undefined ? value : {});
218
+ return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
203
219
  })('versions', []).push({
204
- version: '3.1.3',
220
+ version: '3.6.0',
205
221
  mode: 'global',
206
222
  copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
207
223
  });
208
224
  });
209
225
 
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
226
  var id = 0;
217
227
  var postfix = Math.random();
218
228
 
@@ -245,25 +255,25 @@
245
255
  };
246
256
 
247
257
  if (nativeWeakMap) {
248
- var store = new WeakMap$1();
249
- var wmget = store.get;
250
- var wmhas = store.has;
251
- var wmset = store.set;
258
+ var store$1 = new WeakMap$1();
259
+ var wmget = store$1.get;
260
+ var wmhas = store$1.has;
261
+ var wmset = store$1.set;
252
262
  set = function (it, metadata) {
253
- wmset.call(store, it, metadata);
263
+ wmset.call(store$1, it, metadata);
254
264
  return metadata;
255
265
  };
256
266
  get = function (it) {
257
- return wmget.call(store, it) || {};
267
+ return wmget.call(store$1, it) || {};
258
268
  };
259
269
  has$1 = function (it) {
260
- return wmhas.call(store, it);
270
+ return wmhas.call(store$1, it);
261
271
  };
262
272
  } else {
263
273
  var STATE = sharedKey('state');
264
274
  hiddenKeys[STATE] = true;
265
275
  set = function (it, metadata) {
266
- hide(it, STATE, metadata);
276
+ createNonEnumerableProperty(it, STATE, metadata);
267
277
  return metadata;
268
278
  };
269
279
  get = function (it) {
@@ -285,18 +295,14 @@
285
295
  var redefine = createCommonjsModule(function (module) {
286
296
  var getInternalState = internalState.get;
287
297
  var enforceInternalState = internalState.enforce;
288
- var TEMPLATE = String(functionToString).split('toString');
289
-
290
- shared('inspectSource', function (it) {
291
- return functionToString.call(it);
292
- });
298
+ var TEMPLATE = String(String).split('String');
293
299
 
294
300
  (module.exports = function (O, key, value, options) {
295
301
  var unsafe = options ? !!options.unsafe : false;
296
302
  var simple = options ? !!options.enumerable : false;
297
303
  var noTargetGet = options ? !!options.noTargetGet : false;
298
304
  if (typeof value == 'function') {
299
- if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
305
+ if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
300
306
  enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
301
307
  }
302
308
  if (O === global_1) {
@@ -309,10 +315,10 @@
309
315
  simple = true;
310
316
  }
311
317
  if (simple) O[key] = value;
312
- else hide(O, key, value);
318
+ else createNonEnumerableProperty(O, key, value);
313
319
  // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
314
320
  })(Function.prototype, 'toString', function toString() {
315
- return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
321
+ return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
316
322
  });
317
323
  });
318
324
 
@@ -349,7 +355,7 @@
349
355
 
350
356
  // Helper for a popular repeating case of the spec:
351
357
  // Let integer be ? ToInteger(index).
352
- // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
358
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
353
359
  var toAbsoluteIndex = function (index, length) {
354
360
  var integer = toInteger(index);
355
361
  return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
@@ -513,40 +519,17 @@
513
519
  }
514
520
  // add a flag to not completely full polyfills
515
521
  if (options.sham || (targetProperty && targetProperty.sham)) {
516
- hide(sourceProperty, 'sham', true);
522
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
517
523
  }
518
524
  // extend global
519
525
  redefine(target, key, sourceProperty, options);
520
526
  }
521
527
  };
522
528
 
523
- var aFunction$1 = function (it) {
524
- if (typeof it != 'function') {
525
- throw TypeError(String(it) + ' is not a function');
526
- } return it;
527
- };
528
-
529
- // optional / simple context binding
530
- var bindContext = function (fn, that, length) {
531
- aFunction$1(fn);
532
- if (that === undefined) return fn;
533
- switch (length) {
534
- case 0: return function () {
535
- return fn.call(that);
536
- };
537
- case 1: return function (a) {
538
- return fn.call(that, a);
539
- };
540
- case 2: return function (a, b) {
541
- return fn.call(that, a, b);
542
- };
543
- case 3: return function (a, b, c) {
544
- return fn.call(that, a, b, c);
545
- };
546
- }
547
- return function (/* ...args */) {
548
- return fn.apply(that, arguments);
549
- };
529
+ // `IsArray` abstract operation
530
+ // https://tc39.github.io/ecma262/#sec-isarray
531
+ var isArray = Array.isArray || function isArray(arg) {
532
+ return classofRaw(arg) == 'Array';
550
533
  };
551
534
 
552
535
  // `ToObject` abstract operation
@@ -555,10 +538,10 @@
555
538
  return Object(requireObjectCoercible(argument));
556
539
  };
557
540
 
558
- // `IsArray` abstract operation
559
- // https://tc39.github.io/ecma262/#sec-isarray
560
- var isArray = Array.isArray || function isArray(arg) {
561
- return classofRaw(arg) == 'Array';
541
+ var createProperty = function (object, key, value) {
542
+ var propertyKey = toPrimitive(key);
543
+ if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
544
+ else object[propertyKey] = value;
562
545
  };
563
546
 
564
547
  var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
@@ -567,12 +550,21 @@
567
550
  return !String(Symbol());
568
551
  });
569
552
 
553
+ var useSymbolAsUid = nativeSymbol
554
+ // eslint-disable-next-line no-undef
555
+ && !Symbol.sham
556
+ // eslint-disable-next-line no-undef
557
+ && typeof Symbol() == 'symbol';
558
+
559
+ var WellKnownSymbolsStore = shared('wks');
570
560
  var Symbol$1 = global_1.Symbol;
571
- var store$1 = shared('wks');
561
+ var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : uid;
572
562
 
573
563
  var wellKnownSymbol = function (name) {
574
- return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
575
- || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
564
+ if (!has(WellKnownSymbolsStore, name)) {
565
+ if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
566
+ else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
567
+ } return WellKnownSymbolsStore[name];
576
568
  };
577
569
 
578
570
  var SPECIES = wellKnownSymbol('species');
@@ -592,6 +584,119 @@
592
584
  } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
593
585
  };
594
586
 
587
+ var userAgent = getBuiltIn('navigator', 'userAgent') || '';
588
+
589
+ var process = global_1.process;
590
+ var versions = process && process.versions;
591
+ var v8 = versions && versions.v8;
592
+ var match, version;
593
+
594
+ if (v8) {
595
+ match = v8.split('.');
596
+ version = match[0] + match[1];
597
+ } else if (userAgent) {
598
+ match = userAgent.match(/Edge\/(\d+)/);
599
+ if (!match || match[1] >= 74) {
600
+ match = userAgent.match(/Chrome\/(\d+)/);
601
+ if (match) version = match[1];
602
+ }
603
+ }
604
+
605
+ var v8Version = version && +version;
606
+
607
+ var SPECIES$1 = wellKnownSymbol('species');
608
+
609
+ var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
610
+ // We can't use this feature detection in V8 since it causes
611
+ // deoptimization and serious performance degradation
612
+ // https://github.com/zloirock/core-js/issues/677
613
+ return v8Version >= 51 || !fails(function () {
614
+ var array = [];
615
+ var constructor = array.constructor = {};
616
+ constructor[SPECIES$1] = function () {
617
+ return { foo: 1 };
618
+ };
619
+ return array[METHOD_NAME](Boolean).foo !== 1;
620
+ });
621
+ };
622
+
623
+ var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
624
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
625
+ var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
626
+
627
+ // We can't use this feature detection in V8 since it causes
628
+ // deoptimization and serious performance degradation
629
+ // https://github.com/zloirock/core-js/issues/679
630
+ var IS_CONCAT_SPREADABLE_SUPPORT = v8Version >= 51 || !fails(function () {
631
+ var array = [];
632
+ array[IS_CONCAT_SPREADABLE] = false;
633
+ return array.concat()[0] !== array;
634
+ });
635
+
636
+ var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
637
+
638
+ var isConcatSpreadable = function (O) {
639
+ if (!isObject(O)) return false;
640
+ var spreadable = O[IS_CONCAT_SPREADABLE];
641
+ return spreadable !== undefined ? !!spreadable : isArray(O);
642
+ };
643
+
644
+ var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
645
+
646
+ // `Array.prototype.concat` method
647
+ // https://tc39.github.io/ecma262/#sec-array.prototype.concat
648
+ // with adding support of @@isConcatSpreadable and @@species
649
+ _export({ target: 'Array', proto: true, forced: FORCED }, {
650
+ concat: function concat(arg) { // eslint-disable-line no-unused-vars
651
+ var O = toObject(this);
652
+ var A = arraySpeciesCreate(O, 0);
653
+ var n = 0;
654
+ var i, k, length, len, E;
655
+ for (i = -1, length = arguments.length; i < length; i++) {
656
+ E = i === -1 ? O : arguments[i];
657
+ if (isConcatSpreadable(E)) {
658
+ len = toLength(E.length);
659
+ if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
660
+ for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
661
+ } else {
662
+ if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
663
+ createProperty(A, n++, E);
664
+ }
665
+ }
666
+ A.length = n;
667
+ return A;
668
+ }
669
+ });
670
+
671
+ var aFunction$1 = function (it) {
672
+ if (typeof it != 'function') {
673
+ throw TypeError(String(it) + ' is not a function');
674
+ } return it;
675
+ };
676
+
677
+ // optional / simple context binding
678
+ var bindContext = function (fn, that, length) {
679
+ aFunction$1(fn);
680
+ if (that === undefined) return fn;
681
+ switch (length) {
682
+ case 0: return function () {
683
+ return fn.call(that);
684
+ };
685
+ case 1: return function (a) {
686
+ return fn.call(that, a);
687
+ };
688
+ case 2: return function (a, b) {
689
+ return fn.call(that, a, b);
690
+ };
691
+ case 3: return function (a, b, c) {
692
+ return fn.call(that, a, b, c);
693
+ };
694
+ }
695
+ return function (/* ...args */) {
696
+ return fn.apply(that, arguments);
697
+ };
698
+ };
699
+
595
700
  var push = [].push;
596
701
 
597
702
  // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
@@ -652,26 +757,20 @@
652
757
  findIndex: createMethod$1(6)
653
758
  };
654
759
 
655
- var SPECIES$1 = wellKnownSymbol('species');
760
+ var $filter = arrayIteration.filter;
656
761
 
657
- var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
658
- return !fails(function () {
659
- var array = [];
660
- var constructor = array.constructor = {};
661
- constructor[SPECIES$1] = function () {
662
- return { foo: 1 };
663
- };
664
- return array[METHOD_NAME](Boolean).foo !== 1;
665
- });
666
- };
667
762
 
668
- var $filter = arrayIteration.filter;
669
763
 
764
+ var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
765
+ // Edge 14- issue
766
+ var USES_TO_LENGTH = HAS_SPECIES_SUPPORT && !fails(function () {
767
+ [].filter.call({ length: -1, 0: 1 }, function (it) { throw it; });
768
+ });
670
769
 
671
770
  // `Array.prototype.filter` method
672
771
  // https://tc39.github.io/ecma262/#sec-array.prototype.filter
673
772
  // with adding support of @@species
674
- _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
773
+ _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
675
774
  filter: function filter(callbackfn /* , thisArg */) {
676
775
  return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
677
776
  }
@@ -697,56 +796,87 @@
697
796
 
698
797
  var html = getBuiltIn('document', 'documentElement');
699
798
 
799
+ var GT = '>';
800
+ var LT = '<';
801
+ var PROTOTYPE = 'prototype';
802
+ var SCRIPT = 'script';
700
803
  var IE_PROTO = sharedKey('IE_PROTO');
701
804
 
702
- var PROTOTYPE = 'prototype';
703
- var Empty = function () { /* empty */ };
805
+ var EmptyConstructor = function () { /* empty */ };
806
+
807
+ var scriptTag = function (content) {
808
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
809
+ };
810
+
811
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
812
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
813
+ activeXDocument.write(scriptTag(''));
814
+ activeXDocument.close();
815
+ var temp = activeXDocument.parentWindow.Object;
816
+ activeXDocument = null; // avoid memory leak
817
+ return temp;
818
+ };
704
819
 
705
820
  // Create object with fake `null` prototype: use iframe Object with cleared prototype
706
- var createDict = function () {
821
+ var NullProtoObjectViaIFrame = function () {
707
822
  // Thrash, waste and sodomy: IE GC bug
708
823
  var iframe = documentCreateElement('iframe');
709
- var length = enumBugKeys.length;
710
- var lt = '<';
711
- var script = 'script';
712
- var gt = '>';
713
- var js = 'java' + script + ':';
824
+ var JS = 'java' + SCRIPT + ':';
714
825
  var iframeDocument;
715
826
  iframe.style.display = 'none';
716
827
  html.appendChild(iframe);
717
- iframe.src = String(js);
828
+ // https://github.com/zloirock/core-js/issues/475
829
+ iframe.src = String(JS);
718
830
  iframeDocument = iframe.contentWindow.document;
719
831
  iframeDocument.open();
720
- iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
832
+ iframeDocument.write(scriptTag('document.F=Object'));
721
833
  iframeDocument.close();
722
- createDict = iframeDocument.F;
723
- while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
724
- return createDict();
834
+ return iframeDocument.F;
725
835
  };
726
836
 
837
+ // Check for document.domain and active x support
838
+ // No need to use active x approach when document.domain is not set
839
+ // see https://github.com/es-shims/es5-shim/issues/150
840
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
841
+ // avoid IE GC bug
842
+ var activeXDocument;
843
+ var NullProtoObject = function () {
844
+ try {
845
+ /* global ActiveXObject */
846
+ activeXDocument = document.domain && new ActiveXObject('htmlfile');
847
+ } catch (error) { /* ignore */ }
848
+ NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
849
+ var length = enumBugKeys.length;
850
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
851
+ return NullProtoObject();
852
+ };
853
+
854
+ hiddenKeys[IE_PROTO] = true;
855
+
727
856
  // `Object.create` method
728
857
  // https://tc39.github.io/ecma262/#sec-object.create
729
858
  var objectCreate = Object.create || function create(O, Properties) {
730
859
  var result;
731
860
  if (O !== null) {
732
- Empty[PROTOTYPE] = anObject(O);
733
- result = new Empty();
734
- Empty[PROTOTYPE] = null;
861
+ EmptyConstructor[PROTOTYPE] = anObject(O);
862
+ result = new EmptyConstructor();
863
+ EmptyConstructor[PROTOTYPE] = null;
735
864
  // add "__proto__" for Object.getPrototypeOf polyfill
736
865
  result[IE_PROTO] = O;
737
- } else result = createDict();
866
+ } else result = NullProtoObject();
738
867
  return Properties === undefined ? result : objectDefineProperties(result, Properties);
739
868
  };
740
869
 
741
- hiddenKeys[IE_PROTO] = true;
742
-
743
870
  var UNSCOPABLES = wellKnownSymbol('unscopables');
744
871
  var ArrayPrototype = Array.prototype;
745
872
 
746
873
  // Array.prototype[@@unscopables]
747
874
  // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
748
875
  if (ArrayPrototype[UNSCOPABLES] == undefined) {
749
- hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
876
+ objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
877
+ configurable: true,
878
+ value: objectCreate(null)
879
+ });
750
880
  }
751
881
 
752
882
  // add a key to Array.prototype[@@unscopables]
@@ -815,45 +945,6 @@
815
945
  }
816
946
  });
817
947
 
818
- var nativeJoin = [].join;
819
-
820
- var ES3_STRINGS = indexedObject != Object;
821
- var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
822
-
823
- // `Array.prototype.join` method
824
- // https://tc39.github.io/ecma262/#sec-array.prototype.join
825
- _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
826
- join: function join(separator) {
827
- return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
828
- }
829
- });
830
-
831
- var nativeSort = [].sort;
832
- var test = [1, 2, 3];
833
-
834
- // IE8-
835
- var FAILS_ON_UNDEFINED = fails(function () {
836
- test.sort(undefined);
837
- });
838
- // V8 bug
839
- var FAILS_ON_NULL = fails(function () {
840
- test.sort(null);
841
- });
842
- // Old WebKit
843
- var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
844
-
845
- var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
846
-
847
- // `Array.prototype.sort` method
848
- // https://tc39.github.io/ecma262/#sec-array.prototype.sort
849
- _export({ target: 'Array', proto: true, forced: FORCED }, {
850
- sort: function sort(comparefn) {
851
- return comparefn === undefined
852
- ? nativeSort.call(toObject(this))
853
- : nativeSort.call(toObject(this), aFunction$1(comparefn));
854
- }
855
- });
856
-
857
948
  var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
858
949
 
859
950
  // `Object.keys` method
@@ -865,6 +956,13 @@
865
956
  });
866
957
 
867
958
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
959
+ var test = {};
960
+
961
+ test[TO_STRING_TAG] = 'z';
962
+
963
+ var toStringTagSupport = String(test) === '[object z]';
964
+
965
+ var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
868
966
  // ES3 wrong here
869
967
  var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
870
968
 
@@ -876,36 +974,79 @@
876
974
  };
877
975
 
878
976
  // getting tag from ES6+ `Object.prototype.toString`
879
- var classof = function (it) {
977
+ var classof = toStringTagSupport ? classofRaw : function (it) {
880
978
  var O, tag, result;
881
979
  return it === undefined ? 'Undefined' : it === null ? 'Null'
882
980
  // @@toStringTag case
883
- : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
981
+ : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
884
982
  // builtinTag case
885
983
  : CORRECT_ARGUMENTS ? classofRaw(O)
886
984
  // ES3 arguments fallback
887
985
  : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
888
986
  };
889
987
 
890
- var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
891
- var test$1 = {};
892
-
893
- test$1[TO_STRING_TAG$1] = 'z';
894
-
895
988
  // `Object.prototype.toString` method implementation
896
989
  // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
897
- var objectToString = String(test$1) !== '[object z]' ? function toString() {
990
+ var objectToString = toStringTagSupport ? {}.toString : function toString() {
898
991
  return '[object ' + classof(this) + ']';
899
- } : test$1.toString;
900
-
901
- var ObjectPrototype = Object.prototype;
992
+ };
902
993
 
903
994
  // `Object.prototype.toString` method
904
995
  // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
905
- if (objectToString !== ObjectPrototype.toString) {
906
- redefine(ObjectPrototype, 'toString', objectToString, { unsafe: true });
996
+ if (!toStringTagSupport) {
997
+ redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
907
998
  }
908
999
 
1000
+ // a string of all valid unicode whitespaces
1001
+ // eslint-disable-next-line max-len
1002
+ 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';
1003
+
1004
+ var whitespace = '[' + whitespaces + ']';
1005
+ var ltrim = RegExp('^' + whitespace + whitespace + '*');
1006
+ var rtrim = RegExp(whitespace + whitespace + '*$');
1007
+
1008
+ // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1009
+ var createMethod$2 = function (TYPE) {
1010
+ return function ($this) {
1011
+ var string = String(requireObjectCoercible($this));
1012
+ if (TYPE & 1) string = string.replace(ltrim, '');
1013
+ if (TYPE & 2) string = string.replace(rtrim, '');
1014
+ return string;
1015
+ };
1016
+ };
1017
+
1018
+ var stringTrim = {
1019
+ // `String.prototype.{ trimLeft, trimStart }` methods
1020
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
1021
+ start: createMethod$2(1),
1022
+ // `String.prototype.{ trimRight, trimEnd }` methods
1023
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
1024
+ end: createMethod$2(2),
1025
+ // `String.prototype.trim` method
1026
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1027
+ trim: createMethod$2(3)
1028
+ };
1029
+
1030
+ var trim = stringTrim.trim;
1031
+
1032
+
1033
+ var nativeParseInt = global_1.parseInt;
1034
+ var hex = /^[+-]?0[Xx]/;
1035
+ var FORCED$1 = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;
1036
+
1037
+ // `parseInt` method
1038
+ // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1039
+ var _parseInt = FORCED$1 ? function parseInt(string, radix) {
1040
+ var S = trim(String(string));
1041
+ return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
1042
+ } : nativeParseInt;
1043
+
1044
+ // `parseInt` method
1045
+ // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1046
+ _export({ global: true, forced: parseInt != _parseInt }, {
1047
+ parseInt: _parseInt
1048
+ });
1049
+
909
1050
  // `RegExp.prototype.flags` getter implementation
910
1051
  // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
911
1052
  var regexpFlags = function () {
@@ -920,64 +1061,31 @@
920
1061
  return result;
921
1062
  };
922
1063
 
923
- var TO_STRING = 'toString';
924
- var RegExpPrototype = RegExp.prototype;
925
- var nativeToString = RegExpPrototype[TO_STRING];
926
-
927
- var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
928
- // FF44- RegExp#toString has a wrong name
929
- var INCORRECT_NAME = nativeToString.name != TO_STRING;
930
-
931
- // `RegExp.prototype.toString` method
932
- // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
933
- if (NOT_GENERIC || INCORRECT_NAME) {
934
- redefine(RegExp.prototype, TO_STRING, function toString() {
935
- var R = anObject(this);
936
- var p = String(R.source);
937
- var rf = R.flags;
938
- var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
939
- return '/' + p + '/' + f;
940
- }, { unsafe: true });
1064
+ // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
1065
+ // so we use an intermediate function.
1066
+ function RE(s, f) {
1067
+ return RegExp(s, f);
941
1068
  }
942
1069
 
943
- var MATCH = wellKnownSymbol('match');
1070
+ var UNSUPPORTED_Y = fails(function () {
1071
+ // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1072
+ var re = RE('a', 'y');
1073
+ re.lastIndex = 2;
1074
+ return re.exec('abcd') != null;
1075
+ });
944
1076
 
945
- // `IsRegExp` abstract operation
946
- // https://tc39.github.io/ecma262/#sec-isregexp
947
- var isRegexp = function (it) {
948
- var isRegExp;
949
- return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
950
- };
1077
+ var BROKEN_CARET = fails(function () {
1078
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
1079
+ var re = RE('^r', 'gy');
1080
+ re.lastIndex = 2;
1081
+ return re.exec('str') != null;
1082
+ });
951
1083
 
952
- var notARegexp = function (it) {
953
- if (isRegexp(it)) {
954
- throw TypeError("The method doesn't accept regular expressions");
955
- } return it;
1084
+ var regexpStickyHelpers = {
1085
+ UNSUPPORTED_Y: UNSUPPORTED_Y,
1086
+ BROKEN_CARET: BROKEN_CARET
956
1087
  };
957
1088
 
958
- var MATCH$1 = wellKnownSymbol('match');
959
-
960
- var correctIsRegexpLogic = function (METHOD_NAME) {
961
- var regexp = /./;
962
- try {
963
- '/./'[METHOD_NAME](regexp);
964
- } catch (e) {
965
- try {
966
- regexp[MATCH$1] = false;
967
- return '/./'[METHOD_NAME](regexp);
968
- } catch (f) { /* empty */ }
969
- } return false;
970
- };
971
-
972
- // `String.prototype.includes` method
973
- // https://tc39.github.io/ecma262/#sec-string.prototype.includes
974
- _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
975
- includes: function includes(searchString /* , position = 0 */) {
976
- return !!~String(requireObjectCoercible(this))
977
- .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
978
- }
979
- });
980
-
981
1089
  var nativeExec = RegExp.prototype.exec;
982
1090
  // This always refers to the native implementation, because the
983
1091
  // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
@@ -994,41 +1102,384 @@
994
1102
  return re1.lastIndex !== 0 || re2.lastIndex !== 0;
995
1103
  })();
996
1104
 
1105
+ var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
1106
+
997
1107
  // nonparticipating capturing group, copied from es5-shim's String#split patch.
998
1108
  var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
999
1109
 
1000
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
1110
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
1001
1111
 
1002
1112
  if (PATCH) {
1003
1113
  patchedExec = function exec(str) {
1004
1114
  var re = this;
1005
1115
  var lastIndex, reCopy, match, i;
1116
+ var sticky = UNSUPPORTED_Y$1 && re.sticky;
1117
+ var flags = regexpFlags.call(re);
1118
+ var source = re.source;
1119
+ var charsAdded = 0;
1120
+ var strCopy = str;
1121
+
1122
+ if (sticky) {
1123
+ flags = flags.replace('y', '');
1124
+ if (flags.indexOf('g') === -1) {
1125
+ flags += 'g';
1126
+ }
1127
+
1128
+ strCopy = String(str).slice(re.lastIndex);
1129
+ // Support anchored sticky behavior.
1130
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
1131
+ source = '(?: ' + source + ')';
1132
+ strCopy = ' ' + strCopy;
1133
+ charsAdded++;
1134
+ }
1135
+ // ^(? + rx + ) is needed, in combination with some str slicing, to
1136
+ // simulate the 'y' flag.
1137
+ reCopy = new RegExp('^(?:' + source + ')', flags);
1138
+ }
1006
1139
 
1007
1140
  if (NPCG_INCLUDED) {
1008
- reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
1141
+ reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
1009
1142
  }
1010
1143
  if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1011
1144
 
1012
- match = nativeExec.call(re, str);
1145
+ match = nativeExec.call(sticky ? reCopy : re, strCopy);
1146
+
1147
+ if (sticky) {
1148
+ if (match) {
1149
+ match.input = match.input.slice(charsAdded);
1150
+ match[0] = match[0].slice(charsAdded);
1151
+ match.index = re.lastIndex;
1152
+ re.lastIndex += match[0].length;
1153
+ } else re.lastIndex = 0;
1154
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
1155
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1156
+ }
1157
+ if (NPCG_INCLUDED && match && match.length > 1) {
1158
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
1159
+ // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
1160
+ nativeReplace.call(match[0], reCopy, function () {
1161
+ for (i = 1; i < arguments.length - 2; i++) {
1162
+ if (arguments[i] === undefined) match[i] = undefined;
1163
+ }
1164
+ });
1165
+ }
1166
+
1167
+ return match;
1168
+ };
1169
+ }
1170
+
1171
+ var regexpExec = patchedExec;
1172
+
1173
+ _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
1174
+ exec: regexpExec
1175
+ });
1176
+
1177
+ var TO_STRING = 'toString';
1178
+ var RegExpPrototype = RegExp.prototype;
1179
+ var nativeToString = RegExpPrototype[TO_STRING];
1180
+
1181
+ var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
1182
+ // FF44- RegExp#toString has a wrong name
1183
+ var INCORRECT_NAME = nativeToString.name != TO_STRING;
1184
+
1185
+ // `RegExp.prototype.toString` method
1186
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
1187
+ if (NOT_GENERIC || INCORRECT_NAME) {
1188
+ redefine(RegExp.prototype, TO_STRING, function toString() {
1189
+ var R = anObject(this);
1190
+ var p = String(R.source);
1191
+ var rf = R.flags;
1192
+ var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
1193
+ return '/' + p + '/' + f;
1194
+ }, { unsafe: true });
1195
+ }
1196
+
1197
+ var MATCH = wellKnownSymbol('match');
1198
+
1199
+ // `IsRegExp` abstract operation
1200
+ // https://tc39.github.io/ecma262/#sec-isregexp
1201
+ var isRegexp = function (it) {
1202
+ var isRegExp;
1203
+ return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
1204
+ };
1205
+
1206
+ var notARegexp = function (it) {
1207
+ if (isRegexp(it)) {
1208
+ throw TypeError("The method doesn't accept regular expressions");
1209
+ } return it;
1210
+ };
1211
+
1212
+ var MATCH$1 = wellKnownSymbol('match');
1213
+
1214
+ var correctIsRegexpLogic = function (METHOD_NAME) {
1215
+ var regexp = /./;
1216
+ try {
1217
+ '/./'[METHOD_NAME](regexp);
1218
+ } catch (e) {
1219
+ try {
1220
+ regexp[MATCH$1] = false;
1221
+ return '/./'[METHOD_NAME](regexp);
1222
+ } catch (f) { /* empty */ }
1223
+ } return false;
1224
+ };
1225
+
1226
+ // `String.prototype.includes` method
1227
+ // https://tc39.github.io/ecma262/#sec-string.prototype.includes
1228
+ _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
1229
+ includes: function includes(searchString /* , position = 0 */) {
1230
+ return !!~String(requireObjectCoercible(this))
1231
+ .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
1232
+ }
1233
+ });
1234
+
1235
+ var non = '\u200B\u0085\u180E';
1236
+
1237
+ // check that a method works with the correct list
1238
+ // of whitespaces and has a correct name
1239
+ var forcedStringTrimMethod = function (METHOD_NAME) {
1240
+ return fails(function () {
1241
+ return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
1242
+ });
1243
+ };
1244
+
1245
+ var $trim = stringTrim.trim;
1246
+
1247
+
1248
+ // `String.prototype.trim` method
1249
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1250
+ _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
1251
+ trim: function trim() {
1252
+ return $trim(this);
1253
+ }
1254
+ });
1255
+
1256
+ // iterable DOM collections
1257
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1258
+ var domIterables = {
1259
+ CSSRuleList: 0,
1260
+ CSSStyleDeclaration: 0,
1261
+ CSSValueList: 0,
1262
+ ClientRectList: 0,
1263
+ DOMRectList: 0,
1264
+ DOMStringList: 0,
1265
+ DOMTokenList: 1,
1266
+ DataTransferItemList: 0,
1267
+ FileList: 0,
1268
+ HTMLAllCollection: 0,
1269
+ HTMLCollection: 0,
1270
+ HTMLFormElement: 0,
1271
+ HTMLSelectElement: 0,
1272
+ MediaList: 0,
1273
+ MimeTypeArray: 0,
1274
+ NamedNodeMap: 0,
1275
+ NodeList: 1,
1276
+ PaintRequestList: 0,
1277
+ Plugin: 0,
1278
+ PluginArray: 0,
1279
+ SVGLengthList: 0,
1280
+ SVGNumberList: 0,
1281
+ SVGPathSegList: 0,
1282
+ SVGPointList: 0,
1283
+ SVGStringList: 0,
1284
+ SVGTransformList: 0,
1285
+ SourceBufferList: 0,
1286
+ StyleSheetList: 0,
1287
+ TextTrackCueList: 0,
1288
+ TextTrackList: 0,
1289
+ TouchList: 0
1290
+ };
1291
+
1292
+ var $forEach = arrayIteration.forEach;
1293
+
1294
+
1295
+ // `Array.prototype.forEach` method implementation
1296
+ // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1297
+ var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
1298
+ return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1299
+ } : [].forEach;
1300
+
1301
+ for (var COLLECTION_NAME in domIterables) {
1302
+ var Collection = global_1[COLLECTION_NAME];
1303
+ var CollectionPrototype = Collection && Collection.prototype;
1304
+ // some Chrome versions have non-configurable methods on DOMTokenList
1305
+ if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
1306
+ createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
1307
+ } catch (error) {
1308
+ CollectionPrototype.forEach = arrayForEach;
1309
+ }
1310
+ }
1311
+
1312
+ function _typeof(obj) {
1313
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1314
+ _typeof = function (obj) {
1315
+ return typeof obj;
1316
+ };
1317
+ } else {
1318
+ _typeof = function (obj) {
1319
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1320
+ };
1321
+ }
1322
+
1323
+ return _typeof(obj);
1324
+ }
1325
+
1326
+ function _classCallCheck(instance, Constructor) {
1327
+ if (!(instance instanceof Constructor)) {
1328
+ throw new TypeError("Cannot call a class as a function");
1329
+ }
1330
+ }
1331
+
1332
+ function _defineProperties(target, props) {
1333
+ for (var i = 0; i < props.length; i++) {
1334
+ var descriptor = props[i];
1335
+ descriptor.enumerable = descriptor.enumerable || false;
1336
+ descriptor.configurable = true;
1337
+ if ("value" in descriptor) descriptor.writable = true;
1338
+ Object.defineProperty(target, descriptor.key, descriptor);
1339
+ }
1340
+ }
1341
+
1342
+ function _createClass(Constructor, protoProps, staticProps) {
1343
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1344
+ if (staticProps) _defineProperties(Constructor, staticProps);
1345
+ return Constructor;
1346
+ }
1347
+
1348
+ function _inherits(subClass, superClass) {
1349
+ if (typeof superClass !== "function" && superClass !== null) {
1350
+ throw new TypeError("Super expression must either be null or a function");
1351
+ }
1352
+
1353
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1354
+ constructor: {
1355
+ value: subClass,
1356
+ writable: true,
1357
+ configurable: true
1358
+ }
1359
+ });
1360
+ if (superClass) _setPrototypeOf(subClass, superClass);
1361
+ }
1362
+
1363
+ function _getPrototypeOf(o) {
1364
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
1365
+ return o.__proto__ || Object.getPrototypeOf(o);
1366
+ };
1367
+ return _getPrototypeOf(o);
1368
+ }
1369
+
1370
+ function _setPrototypeOf(o, p) {
1371
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
1372
+ o.__proto__ = p;
1373
+ return o;
1374
+ };
1375
+
1376
+ return _setPrototypeOf(o, p);
1377
+ }
1378
+
1379
+ function _assertThisInitialized(self) {
1380
+ if (self === void 0) {
1381
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1382
+ }
1383
+
1384
+ return self;
1385
+ }
1386
+
1387
+ function _possibleConstructorReturn(self, call) {
1388
+ if (call && (typeof call === "object" || typeof call === "function")) {
1389
+ return call;
1390
+ }
1391
+
1392
+ return _assertThisInitialized(self);
1393
+ }
1394
+
1395
+ function _superPropBase(object, property) {
1396
+ while (!Object.prototype.hasOwnProperty.call(object, property)) {
1397
+ object = _getPrototypeOf(object);
1398
+ if (object === null) break;
1399
+ }
1400
+
1401
+ return object;
1402
+ }
1403
+
1404
+ function _get(target, property, receiver) {
1405
+ if (typeof Reflect !== "undefined" && Reflect.get) {
1406
+ _get = Reflect.get;
1407
+ } else {
1408
+ _get = function _get(target, property, receiver) {
1409
+ var base = _superPropBase(target, property);
1410
+
1411
+ if (!base) return;
1412
+ var desc = Object.getOwnPropertyDescriptor(base, property);
1413
+
1414
+ if (desc.get) {
1415
+ return desc.get.call(receiver);
1416
+ }
1417
+
1418
+ return desc.value;
1419
+ };
1420
+ }
1421
+
1422
+ return _get(target, property, receiver || target);
1423
+ }
1424
+
1425
+ function _toConsumableArray(arr) {
1426
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
1427
+ }
1428
+
1429
+ function _arrayWithoutHoles(arr) {
1430
+ if (Array.isArray(arr)) {
1431
+ for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
1432
+
1433
+ return arr2;
1434
+ }
1435
+ }
1436
+
1437
+ function _iterableToArray(iter) {
1438
+ if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
1439
+ }
1440
+
1441
+ function _nonIterableSpread() {
1442
+ throw new TypeError("Invalid attempt to spread non-iterable instance");
1443
+ }
1444
+
1445
+ var nativeJoin = [].join;
1446
+
1447
+ var ES3_STRINGS = indexedObject != Object;
1448
+ var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
1449
+
1450
+ // `Array.prototype.join` method
1451
+ // https://tc39.github.io/ecma262/#sec-array.prototype.join
1452
+ _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
1453
+ join: function join(separator) {
1454
+ return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
1455
+ }
1456
+ });
1457
+
1458
+ var test$1 = [];
1459
+ var nativeSort = test$1.sort;
1013
1460
 
1014
- if (UPDATES_LAST_INDEX_WRONG && match) {
1015
- re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1016
- }
1017
- if (NPCG_INCLUDED && match && match.length > 1) {
1018
- // Fix browsers whose `exec` methods don't consistently return `undefined`
1019
- // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
1020
- nativeReplace.call(match[0], reCopy, function () {
1021
- for (i = 1; i < arguments.length - 2; i++) {
1022
- if (arguments[i] === undefined) match[i] = undefined;
1023
- }
1024
- });
1025
- }
1461
+ // IE8-
1462
+ var FAILS_ON_UNDEFINED = fails(function () {
1463
+ test$1.sort(undefined);
1464
+ });
1465
+ // V8 bug
1466
+ var FAILS_ON_NULL = fails(function () {
1467
+ test$1.sort(null);
1468
+ });
1469
+ // Old WebKit
1470
+ var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
1026
1471
 
1027
- return match;
1028
- };
1029
- }
1472
+ var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
1030
1473
 
1031
- var regexpExec = patchedExec;
1474
+ // `Array.prototype.sort` method
1475
+ // https://tc39.github.io/ecma262/#sec-array.prototype.sort
1476
+ _export({ target: 'Array', proto: true, forced: FORCED$2 }, {
1477
+ sort: function sort(comparefn) {
1478
+ return comparefn === undefined
1479
+ ? nativeSort.call(toObject(this))
1480
+ : nativeSort.call(toObject(this), aFunction$1(comparefn));
1481
+ }
1482
+ });
1032
1483
 
1033
1484
  var SPECIES$2 = wellKnownSymbol('species');
1034
1485
 
@@ -1045,6 +1496,12 @@
1045
1496
  return ''.replace(re, '$<a>') !== '7';
1046
1497
  });
1047
1498
 
1499
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
1500
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
1501
+ var REPLACE_KEEPS_$0 = (function () {
1502
+ return 'a'.replace(/./, '$0') === '$0';
1503
+ })();
1504
+
1048
1505
  // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
1049
1506
  // Weex JS has frozen built-in prototypes, so use try / catch wrapper
1050
1507
  var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
@@ -1069,15 +1526,22 @@
1069
1526
  // Symbol-named RegExp methods call .exec
1070
1527
  var execCalled = false;
1071
1528
  var re = /a/;
1072
- re.exec = function () { execCalled = true; return null; };
1073
1529
 
1074
1530
  if (KEY === 'split') {
1531
+ // We can't use real regex here since it causes deoptimization
1532
+ // and serious performance degradation in V8
1533
+ // https://github.com/zloirock/core-js/issues/306
1534
+ re = {};
1075
1535
  // RegExp[@@split] doesn't call the regex's exec method, but first creates
1076
1536
  // a new one. We need to return the patched regex when creating the new one.
1077
1537
  re.constructor = {};
1078
1538
  re.constructor[SPECIES$2] = function () { return re; };
1539
+ re.flags = '';
1540
+ re[SYMBOL] = /./[SYMBOL];
1079
1541
  }
1080
1542
 
1543
+ re.exec = function () { execCalled = true; return null; };
1544
+
1081
1545
  re[SYMBOL]('');
1082
1546
  return !execCalled;
1083
1547
  });
@@ -1085,7 +1549,7 @@
1085
1549
  if (
1086
1550
  !DELEGATES_TO_SYMBOL ||
1087
1551
  !DELEGATES_TO_EXEC ||
1088
- (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
1552
+ (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) ||
1089
1553
  (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
1090
1554
  ) {
1091
1555
  var nativeRegExpMethod = /./[SYMBOL];
@@ -1100,7 +1564,7 @@
1100
1564
  return { done: true, value: nativeMethod.call(str, regexp, arg2) };
1101
1565
  }
1102
1566
  return { done: false };
1103
- });
1567
+ }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 });
1104
1568
  var stringMethod = methods[0];
1105
1569
  var regexMethod = methods[1];
1106
1570
 
@@ -1113,12 +1577,13 @@
1113
1577
  // 21.2.5.9 RegExp.prototype[@@search](string)
1114
1578
  : function (string) { return regexMethod.call(string, this); }
1115
1579
  );
1116
- if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
1117
1580
  }
1581
+
1582
+ if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
1118
1583
  };
1119
1584
 
1120
1585
  // `String.prototype.{ codePointAt, at }` methods implementation
1121
- var createMethod$2 = function (CONVERT_TO_STRING) {
1586
+ var createMethod$3 = function (CONVERT_TO_STRING) {
1122
1587
  return function ($this, pos) {
1123
1588
  var S = String(requireObjectCoercible($this));
1124
1589
  var position = toInteger(pos);
@@ -1136,10 +1601,10 @@
1136
1601
  var stringMultibyte = {
1137
1602
  // `String.prototype.codePointAt` method
1138
1603
  // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
1139
- codeAt: createMethod$2(false),
1604
+ codeAt: createMethod$3(false),
1140
1605
  // `String.prototype.at` method
1141
1606
  // https://github.com/mathiasbynens/String.prototype.at
1142
- charAt: createMethod$2(true)
1607
+ charAt: createMethod$3(true)
1143
1608
  };
1144
1609
 
1145
1610
  var charAt = stringMultibyte.charAt;
@@ -1217,7 +1682,7 @@
1217
1682
  };
1218
1683
 
1219
1684
  // @@replace logic
1220
- fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
1685
+ fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
1221
1686
  return [
1222
1687
  // `String.prototype.replace` method
1223
1688
  // https://tc39.github.io/ecma262/#sec-string.prototype.replace
@@ -1231,8 +1696,10 @@
1231
1696
  // `RegExp.prototype[@@replace]` method
1232
1697
  // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
1233
1698
  function (regexp, replaceValue) {
1234
- var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
1235
- if (res.done) return res.value;
1699
+ if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) {
1700
+ var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
1701
+ if (res.done) return res.value;
1702
+ }
1236
1703
 
1237
1704
  var rx = anObject(regexp);
1238
1705
  var S = String(this);
@@ -1456,742 +1923,615 @@
1456
1923
  ];
1457
1924
  }, !SUPPORTS_Y);
1458
1925
 
1459
- // a string of all valid unicode whitespaces
1460
- // eslint-disable-next-line max-len
1461
- 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';
1462
-
1463
- var whitespace = '[' + whitespaces + ']';
1464
- var ltrim = RegExp('^' + whitespace + whitespace + '*');
1465
- var rtrim = RegExp(whitespace + whitespace + '*$');
1466
-
1467
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1468
- var createMethod$3 = function (TYPE) {
1469
- return function ($this) {
1470
- var string = String(requireObjectCoercible($this));
1471
- if (TYPE & 1) string = string.replace(ltrim, '');
1472
- if (TYPE & 2) string = string.replace(rtrim, '');
1473
- return string;
1474
- };
1475
- };
1476
-
1477
- var stringTrim = {
1478
- // `String.prototype.{ trimLeft, trimStart }` methods
1479
- // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
1480
- start: createMethod$3(1),
1481
- // `String.prototype.{ trimRight, trimEnd }` methods
1482
- // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
1483
- end: createMethod$3(2),
1484
- // `String.prototype.trim` method
1485
- // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1486
- trim: createMethod$3(3)
1487
- };
1488
-
1489
- var non = '\u200B\u0085\u180E';
1490
-
1491
- // check that a method works with the correct list
1492
- // of whitespaces and has a correct name
1493
- var forcedStringTrimMethod = function (METHOD_NAME) {
1494
- return fails(function () {
1495
- return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
1496
- });
1497
- };
1498
-
1499
- var $trim = stringTrim.trim;
1500
-
1501
-
1502
- // `String.prototype.trim` method
1503
- // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1504
- _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
1505
- trim: function trim() {
1506
- return $trim(this);
1507
- }
1508
- });
1509
-
1510
- // iterable DOM collections
1511
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1512
- var domIterables = {
1513
- CSSRuleList: 0,
1514
- CSSStyleDeclaration: 0,
1515
- CSSValueList: 0,
1516
- ClientRectList: 0,
1517
- DOMRectList: 0,
1518
- DOMStringList: 0,
1519
- DOMTokenList: 1,
1520
- DataTransferItemList: 0,
1521
- FileList: 0,
1522
- HTMLAllCollection: 0,
1523
- HTMLCollection: 0,
1524
- HTMLFormElement: 0,
1525
- HTMLSelectElement: 0,
1526
- MediaList: 0,
1527
- MimeTypeArray: 0,
1528
- NamedNodeMap: 0,
1529
- NodeList: 1,
1530
- PaintRequestList: 0,
1531
- Plugin: 0,
1532
- PluginArray: 0,
1533
- SVGLengthList: 0,
1534
- SVGNumberList: 0,
1535
- SVGPathSegList: 0,
1536
- SVGPointList: 0,
1537
- SVGStringList: 0,
1538
- SVGTransformList: 0,
1539
- SourceBufferList: 0,
1540
- StyleSheetList: 0,
1541
- TextTrackCueList: 0,
1542
- TextTrackList: 0,
1543
- TouchList: 0
1544
- };
1545
-
1546
- var $forEach = arrayIteration.forEach;
1547
-
1548
-
1549
- // `Array.prototype.forEach` method implementation
1550
- // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1551
- var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
1552
- return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1553
- } : [].forEach;
1554
-
1555
- for (var COLLECTION_NAME in domIterables) {
1556
- var Collection = global_1[COLLECTION_NAME];
1557
- var CollectionPrototype = Collection && Collection.prototype;
1558
- // some Chrome versions have non-configurable methods on DOMTokenList
1559
- if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
1560
- hide(CollectionPrototype, 'forEach', arrayForEach);
1561
- } catch (error) {
1562
- CollectionPrototype.forEach = arrayForEach;
1563
- }
1564
- }
1565
-
1566
- function _typeof(obj) {
1567
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1568
- _typeof = function (obj) {
1569
- return typeof obj;
1570
- };
1571
- } else {
1572
- _typeof = function (obj) {
1573
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1574
- };
1575
- }
1576
-
1577
- return _typeof(obj);
1578
- }
1579
-
1580
- function _classCallCheck(instance, Constructor) {
1581
- if (!(instance instanceof Constructor)) {
1582
- throw new TypeError("Cannot call a class as a function");
1583
- }
1584
- }
1585
-
1586
- function _defineProperties(target, props) {
1587
- for (var i = 0; i < props.length; i++) {
1588
- var descriptor = props[i];
1589
- descriptor.enumerable = descriptor.enumerable || false;
1590
- descriptor.configurable = true;
1591
- if ("value" in descriptor) descriptor.writable = true;
1592
- Object.defineProperty(target, descriptor.key, descriptor);
1593
- }
1594
- }
1595
-
1596
- function _createClass(Constructor, protoProps, staticProps) {
1597
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1598
- if (staticProps) _defineProperties(Constructor, staticProps);
1599
- return Constructor;
1600
- }
1601
-
1602
- function _inherits(subClass, superClass) {
1603
- if (typeof superClass !== "function" && superClass !== null) {
1604
- throw new TypeError("Super expression must either be null or a function");
1605
- }
1606
-
1607
- subClass.prototype = Object.create(superClass && superClass.prototype, {
1608
- constructor: {
1609
- value: subClass,
1610
- writable: true,
1611
- configurable: true
1612
- }
1613
- });
1614
- if (superClass) _setPrototypeOf(subClass, superClass);
1615
- }
1616
-
1617
- function _getPrototypeOf(o) {
1618
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
1619
- return o.__proto__ || Object.getPrototypeOf(o);
1620
- };
1621
- return _getPrototypeOf(o);
1622
- }
1623
-
1624
- function _setPrototypeOf(o, p) {
1625
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
1626
- o.__proto__ = p;
1627
- return o;
1628
- };
1629
-
1630
- return _setPrototypeOf(o, p);
1631
- }
1632
-
1633
- function _assertThisInitialized(self) {
1634
- if (self === void 0) {
1635
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1636
- }
1637
-
1638
- return self;
1639
- }
1640
-
1641
- function _possibleConstructorReturn(self, call) {
1642
- if (call && (typeof call === "object" || typeof call === "function")) {
1643
- return call;
1644
- }
1645
-
1646
- return _assertThisInitialized(self);
1647
- }
1648
-
1649
- function _superPropBase(object, property) {
1650
- while (!Object.prototype.hasOwnProperty.call(object, property)) {
1651
- object = _getPrototypeOf(object);
1652
- if (object === null) break;
1653
- }
1654
-
1655
- return object;
1656
- }
1657
-
1658
- function _get(target, property, receiver) {
1659
- if (typeof Reflect !== "undefined" && Reflect.get) {
1660
- _get = Reflect.get;
1661
- } else {
1662
- _get = function _get(target, property, receiver) {
1663
- var base = _superPropBase(target, property);
1664
-
1665
- if (!base) return;
1666
- var desc = Object.getOwnPropertyDescriptor(base, property);
1667
-
1668
- if (desc.get) {
1669
- return desc.get.call(receiver);
1670
- }
1671
-
1672
- return desc.value;
1673
- };
1926
+ var Utils = $.fn.bootstrapTable.utils;
1927
+ var searchControls = 'select, input:not([type="checkbox"]):not([type="radio"])';
1928
+ function getOptionsFromSelectControl(selectControl) {
1929
+ return selectControl.get(selectControl.length - 1).options;
1930
+ }
1931
+ function getControlContainer(that) {
1932
+ if (that.options.filterControlContainer) {
1933
+ return $("".concat(that.options.filterControlContainer));
1674
1934
  }
1675
1935
 
1676
- return _get(target, property, receiver || target);
1936
+ return that.$header;
1677
1937
  }
1938
+ function getSearchControls(that) {
1939
+ return getControlContainer(that).find(searchControls);
1940
+ }
1941
+ function hideUnusedSelectOptions(selectControl, uniqueValues) {
1942
+ var options = getOptionsFromSelectControl(selectControl);
1678
1943
 
1679
- /**
1680
- * @author: Dennis Hernández
1681
- * @webSite: http://djhvscf.github.io/Blog
1682
- * @version: v2.2.0
1683
- */
1684
-
1685
- var Utils = $.fn.bootstrapTable.utils;
1686
- var UtilsFilterControl = {
1687
- getOptionsFromSelectControl: function getOptionsFromSelectControl(selectControl) {
1688
- return selectControl.get(selectControl.length - 1).options;
1689
- },
1690
- hideUnusedSelectOptions: function hideUnusedSelectOptions(selectControl, uniqueValues) {
1691
- var options = UtilsFilterControl.getOptionsFromSelectControl(selectControl);
1692
-
1693
- for (var i = 0; i < options.length; i++) {
1694
- if (options[i].value !== '') {
1695
- if (!uniqueValues.hasOwnProperty(options[i].value)) {
1696
- selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
1697
- } else {
1698
- selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
1699
- }
1944
+ for (var i = 0; i < options.length; i++) {
1945
+ if (options[i].value !== '') {
1946
+ if (!uniqueValues.hasOwnProperty(options[i].value)) {
1947
+ selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
1948
+ } else {
1949
+ selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
1700
1950
  }
1701
1951
  }
1702
- },
1703
- addOptionToSelectControl: function addOptionToSelectControl(selectControl, _value, text, selected) {
1704
- var value = $.trim(_value);
1705
- var $selectControl = $(selectControl.get(selectControl.length - 1));
1952
+ }
1953
+ }
1954
+ function existOptionInSelectControl(selectControl, value) {
1955
+ var options = getOptionsFromSelectControl(selectControl);
1956
+
1957
+ for (var i = 0; i < options.length; i++) {
1958
+ if (options[i].value === value.toString()) {
1959
+ // The value is not valid to add
1960
+ return true;
1961
+ }
1962
+ } // If we get here, the value is valid to add
1706
1963
 
1707
- if (!UtilsFilterControl.existOptionInSelectControl(selectControl, value)) {
1708
- var option = $($('<option></option>').attr('value', value).text($('<div />').html(text).text()));
1709
1964
 
1710
- if (value === selected) {
1711
- option.attr('selected', true);
1712
- }
1965
+ return false;
1966
+ }
1967
+ function addOptionToSelectControl(selectControl, _value, text, selected) {
1968
+ var value = _value === undefined || _value === null ? '' : _value.toString().trim();
1969
+ var $selectControl = $(selectControl.get(selectControl.length - 1));
1970
+
1971
+ if (!existOptionInSelectControl(selectControl, value)) {
1972
+ var option = $("<option value=\"".concat(value, "\">").concat(text, "</option>"));
1713
1973
 
1714
- $selectControl.append(option);
1974
+ if (value === selected) {
1975
+ option.attr('selected', true);
1715
1976
  }
1716
- },
1717
- sortSelectControl: function sortSelectControl(selectControl, orderBy) {
1718
- var $selectControl = $(selectControl.get(selectControl.length - 1));
1719
- var $opts = $selectControl.find('option:gt(0)');
1977
+
1978
+ $selectControl.append(option);
1979
+ }
1980
+ }
1981
+ function sortSelectControl(selectControl, orderBy) {
1982
+ var $selectControl = $(selectControl.get(selectControl.length - 1));
1983
+ var $opts = $selectControl.find('option:gt(0)');
1984
+
1985
+ if (orderBy !== 'server') {
1720
1986
  $opts.sort(function (a, b) {
1721
1987
  return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1);
1722
1988
  });
1723
- $selectControl.find('option:gt(0)').remove();
1724
- $selectControl.append($opts);
1725
- },
1726
- existOptionInSelectControl: function existOptionInSelectControl(selectControl, value) {
1727
- var options = UtilsFilterControl.getOptionsFromSelectControl(selectControl);
1989
+ }
1728
1990
 
1729
- for (var i = 0; i < options.length; i++) {
1730
- if (options[i].value === value.toString()) {
1731
- // The value is not valid to add
1732
- return true;
1991
+ $selectControl.find('option:gt(0)').remove();
1992
+ $selectControl.append($opts);
1993
+ }
1994
+ function fixHeaderCSS(_ref) {
1995
+ var $tableHeader = _ref.$tableHeader;
1996
+ $tableHeader.css('height', '89px');
1997
+ }
1998
+ function getElementClass($element) {
1999
+ return $element.attr('class').replace('form-control', '').replace('focus-temp', '').replace('search-input', '').trim();
2000
+ }
2001
+ function getCursorPosition(el) {
2002
+ if (Utils.isIEBrowser()) {
2003
+ if ($(el).is('input[type=text]')) {
2004
+ var pos = 0;
2005
+
2006
+ if ('selectionStart' in el) {
2007
+ pos = el.selectionStart;
2008
+ } else if ('selection' in document) {
2009
+ el.focus();
2010
+ var Sel = document.selection.createRange();
2011
+ var SelLength = document.selection.createRange().text.length;
2012
+ Sel.moveStart('character', -el.value.length);
2013
+ pos = Sel.text.length - SelLength;
1733
2014
  }
1734
- } // If we get here, the value is valid to add
1735
2015
 
1736
-
1737
- return false;
1738
- },
1739
- fixHeaderCSS: function fixHeaderCSS(_ref) {
1740
- var $tableHeader = _ref.$tableHeader;
1741
- $tableHeader.css('height', '77px');
1742
- },
1743
- getCurrentHeader: function getCurrentHeader(_ref2) {
1744
- var $header = _ref2.$header,
1745
- options = _ref2.options,
1746
- $tableHeader = _ref2.$tableHeader;
1747
- var header = $header;
1748
-
1749
- if (options.height) {
1750
- header = $tableHeader;
2016
+ return pos;
1751
2017
  }
1752
2018
 
1753
- return header;
1754
- },
1755
- getCurrentSearchControls: function getCurrentSearchControls(_ref3) {
1756
- var options = _ref3.options;
1757
- var searchControls = 'select, input';
2019
+ return -1;
2020
+ }
1758
2021
 
1759
- if (options.height) {
1760
- searchControls = 'table select, table input';
2022
+ return -1;
2023
+ }
2024
+ function setCursorPosition(el) {
2025
+ $(el).val(el.value);
2026
+ }
2027
+ function copyValues(that) {
2028
+ var searchControls = getSearchControls(that);
2029
+ that.options.valuesFilterControl = [];
2030
+ searchControls.each(function () {
2031
+ var $field = $(this);
2032
+
2033
+ if (that.options.height) {
2034
+ var fieldClass = getElementClass($field);
2035
+ $field = $(".fixed-table-header .".concat(fieldClass));
1761
2036
  }
1762
2037
 
1763
- return searchControls;
1764
- },
1765
- getCursorPosition: function getCursorPosition(el) {
1766
- if (Utils.isIEBrowser()) {
1767
- if ($(el).is('input[type=text]')) {
1768
- var pos = 0;
1769
-
1770
- if ('selectionStart' in el) {
1771
- pos = el.selectionStart;
1772
- } else if ('selection' in document) {
1773
- el.focus();
1774
- var Sel = document.selection.createRange();
1775
- var SelLength = document.selection.createRange().text.length;
1776
- Sel.moveStart('character', -el.value.length);
1777
- pos = Sel.text.length - SelLength;
2038
+ that.options.valuesFilterControl.push({
2039
+ field: $field.closest('[data-field]').data('field'),
2040
+ value: $field.val(),
2041
+ position: getCursorPosition($field.get(0)),
2042
+ hasFocus: $field.is(':focus')
2043
+ });
2044
+ });
2045
+ }
2046
+ function setValues(that) {
2047
+ var field = null;
2048
+ var result = [];
2049
+ var searchControls = getSearchControls(that);
2050
+
2051
+ if (that.options.valuesFilterControl.length > 0) {
2052
+ // Callback to apply after settings fields values
2053
+ var fieldToFocusCallback = null;
2054
+ searchControls.each(function (index, ele) {
2055
+ var $this = $(this);
2056
+ field = $this.closest('[data-field]').data('field');
2057
+ result = that.options.valuesFilterControl.filter(function (valueObj) {
2058
+ return valueObj.field === field;
2059
+ });
2060
+
2061
+ if (result.length > 0) {
2062
+ if ($this.is('[type=radio]')) {
2063
+ return;
1778
2064
  }
1779
2065
 
1780
- return pos;
2066
+ $this.val(result[0].value);
2067
+
2068
+ if (result[0].hasFocus && result[0].value !== '') {
2069
+ // set callback if the field had the focus.
2070
+ fieldToFocusCallback = function (fieldToFocus, carretPosition) {
2071
+ // Closure here to capture the field and cursor position
2072
+ var closedCallback = function closedCallback() {
2073
+ fieldToFocus.focus();
2074
+ setCursorPosition(fieldToFocus);
2075
+ };
2076
+
2077
+ return closedCallback;
2078
+ }($this.get(0), result[0].position);
2079
+ }
1781
2080
  }
2081
+ }); // Callback call.
1782
2082
 
1783
- return -1;
2083
+ if (fieldToFocusCallback !== null) {
2084
+ fieldToFocusCallback();
1784
2085
  }
2086
+ }
2087
+ }
2088
+ function collectBootstrapCookies() {
2089
+ var cookies = [];
2090
+ var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
2091
+ var foundLocalStorage = localStorage;
1785
2092
 
1786
- return -1;
1787
- },
1788
- setCursorPosition: function setCursorPosition(el) {
1789
- $(el).val(el.value);
1790
- },
1791
- copyValues: function copyValues(that) {
1792
- var header = UtilsFilterControl.getCurrentHeader(that);
1793
- var searchControls = UtilsFilterControl.getCurrentSearchControls(that);
1794
- that.options.valuesFilterControl = [];
1795
- header.find(searchControls).each(function () {
1796
- that.options.valuesFilterControl.push({
1797
- field: $(this).closest('[data-field]').data('field'),
1798
- value: $(this).val(),
1799
- position: UtilsFilterControl.getCursorPosition($(this).get(0)),
1800
- hasFocus: $(this).is(':focus')
1801
- });
1802
- });
1803
- },
1804
- setValues: function setValues(that) {
1805
- var field = null;
1806
- var result = [];
1807
- var header = UtilsFilterControl.getCurrentHeader(that);
1808
- var searchControls = UtilsFilterControl.getCurrentSearchControls(that);
1809
-
1810
- if (that.options.valuesFilterControl.length > 0) {
1811
- // Callback to apply after settings fields values
1812
- var fieldToFocusCallback = null;
1813
- header.find(searchControls).each(function (index, ele) {
1814
- field = $(this).closest('[data-field]').data('field');
1815
- result = that.options.valuesFilterControl.filter(function (valueObj) {
1816
- return valueObj.field === field;
1817
- });
2093
+ if (foundCookies) {
2094
+ $.each(foundCookies, function (i, _cookie) {
2095
+ var cookie = _cookie;
1818
2096
 
1819
- if (result.length > 0) {
1820
- $(this).val(result[0].value);
2097
+ if (/./.test(cookie)) {
2098
+ cookie = cookie.split('.').pop();
2099
+ }
1821
2100
 
1822
- if (result[0].hasFocus) {
1823
- // set callback if the field had the focus.
1824
- fieldToFocusCallback = function (fieldToFocus, carretPosition) {
1825
- // Closure here to capture the field and cursor position
1826
- var closedCallback = function closedCallback() {
1827
- fieldToFocus.focus();
1828
- UtilsFilterControl.setCursorPosition(fieldToFocus, carretPosition);
1829
- };
2101
+ if ($.inArray(cookie, cookies) === -1) {
2102
+ cookies.push(cookie);
2103
+ }
2104
+ });
2105
+ }
1830
2106
 
1831
- return closedCallback;
1832
- }($(this).get(0), result[0].position);
1833
- }
1834
- }
1835
- }); // Callback call.
2107
+ if (foundLocalStorage) {
2108
+ for (var i = 0; i < foundLocalStorage.length; i++) {
2109
+ var cookie = foundLocalStorage.key(i);
1836
2110
 
1837
- if (fieldToFocusCallback !== null) {
1838
- fieldToFocusCallback();
2111
+ if (/./.test(cookie)) {
2112
+ cookie = cookie.split('.').pop();
2113
+ }
2114
+
2115
+ if (!cookies.includes(cookie)) {
2116
+ cookies.push(cookie);
1839
2117
  }
1840
2118
  }
1841
- },
1842
- collectBootstrapCookies: function collectBootstrapCookies() {
1843
- var cookies = [];
1844
- var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
2119
+ }
2120
+
2121
+ return cookies;
2122
+ }
2123
+ function escapeID(id) {
2124
+ // eslint-disable-next-line no-useless-escape
2125
+ return String(id).replace(/([:.\[\],])/g, '\\$1');
2126
+ }
2127
+ function isColumnSearchableViaSelect(_ref2) {
2128
+ var filterControl = _ref2.filterControl,
2129
+ searchable = _ref2.searchable;
2130
+ return filterControl && filterControl.toLowerCase() === 'select' && searchable;
2131
+ }
2132
+ function isFilterDataNotGiven(_ref3) {
2133
+ var filterData = _ref3.filterData;
2134
+ return filterData === undefined || filterData.toLowerCase() === 'column';
2135
+ }
2136
+ function hasSelectControlElement(selectControl) {
2137
+ return selectControl && selectControl.length > 0;
2138
+ }
2139
+ function initFilterSelectControls(that) {
2140
+ var data = that.data;
2141
+ var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
2142
+ $.each(that.header.fields, function (j, field) {
2143
+ var column = that.columns[that.fieldsColumnsIndex[field]];
2144
+ var selectControl = getControlContainer(that).find("select.bootstrap-table-filter-control-".concat(escapeID(column.field)));
2145
+
2146
+ if (isColumnSearchableViaSelect(column) && isFilterDataNotGiven(column) && hasSelectControlElement(selectControl)) {
2147
+ if (selectControl.get(selectControl.length - 1).options.length === 0) {
2148
+ // Added the default option
2149
+ addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
2150
+ }
2151
+
2152
+ var uniqueValues = {};
1845
2153
 
1846
- if (foundCookies) {
1847
- $.each(foundCookies, function (i, _cookie) {
1848
- var cookie = _cookie;
2154
+ for (var i = 0; i < z; i++) {
2155
+ // Added a new value
2156
+ var fieldValue = data[i][field];
2157
+ var formatter = that.options.editable && column.editable ? column._formatter : that.header.formatters[j];
2158
+ var formattedValue = Utils.calculateObjectValue(that.header, formatter, [fieldValue, data[i], i], fieldValue);
1849
2159
 
1850
- if (/./.test(cookie)) {
1851
- cookie = cookie.split('.').pop();
2160
+ if (column.filterDataCollector) {
2161
+ formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
1852
2162
  }
1853
2163
 
1854
- if ($.inArray(cookie, cookies) === -1) {
1855
- cookies.push(cookie);
2164
+ if (column.searchFormatter) {
2165
+ fieldValue = formattedValue;
1856
2166
  }
1857
- });
1858
- return cookies;
1859
- }
1860
- },
1861
- escapeID: function escapeID(id) {
1862
- return String(id).replace(/(:|\.|\[|\]|,)/g, '\\$1');
1863
- },
1864
- isColumnSearchableViaSelect: function isColumnSearchableViaSelect(_ref4) {
1865
- var filterControl = _ref4.filterControl,
1866
- searchable = _ref4.searchable;
1867
- return filterControl && filterControl.toLowerCase() === 'select' && searchable;
1868
- },
1869
- isFilterDataNotGiven: function isFilterDataNotGiven(_ref5) {
1870
- var filterData = _ref5.filterData;
1871
- return filterData === undefined || filterData.toLowerCase() === 'column';
1872
- },
1873
- hasSelectControlElement: function hasSelectControlElement(selectControl) {
1874
- return selectControl && selectControl.length > 0;
1875
- },
1876
- initFilterSelectControls: function initFilterSelectControls(that) {
1877
- var data = that.data;
1878
- var itemsPerPage = that.pageTo < that.options.data.length ? that.options.data.length : that.pageTo;
1879
- var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
1880
- $.each(that.header.fields, function (j, field) {
1881
- var column = that.columns[that.fieldsColumnsIndex[field]];
1882
- var selectControl = $(".bootstrap-table-filter-control-".concat(UtilsFilterControl.escapeID(column.field)));
1883
-
1884
- if (UtilsFilterControl.isColumnSearchableViaSelect(column) && UtilsFilterControl.isFilterDataNotGiven(column) && UtilsFilterControl.hasSelectControlElement(selectControl)) {
1885
- if (selectControl.get(selectControl.length - 1).options.length === 0) {
1886
- // Added the default option
1887
- UtilsFilterControl.addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
2167
+
2168
+ uniqueValues[formattedValue] = fieldValue;
2169
+
2170
+ if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
2171
+ formattedValue.forEach(function (value) {
2172
+ addOptionToSelectControl(selectControl, value, value, column.filterDefault);
2173
+ });
2174
+ continue;
1888
2175
  }
1889
2176
 
1890
- var uniqueValues = {};
2177
+ for (var key in uniqueValues) {
2178
+ addOptionToSelectControl(selectControl, uniqueValues[key], key, column.filterDefault);
2179
+ }
2180
+ }
1891
2181
 
1892
- for (var i = 0; i < z; i++) {
1893
- // Added a new value
1894
- var fieldValue = data[i][field];
1895
- var formattedValue = Utils.calculateObjectValue(that.header, that.header.formatters[j], [fieldValue, data[i], i], fieldValue);
2182
+ sortSelectControl(selectControl, column.filterOrderBy);
1896
2183
 
1897
- if (column.filterDataCollector) {
1898
- formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
1899
- }
2184
+ if (that.options.hideUnusedSelectOptions) {
2185
+ hideUnusedSelectOptions(selectControl, uniqueValues);
2186
+ }
2187
+ }
2188
+ });
2189
+ }
2190
+ function getFilterDataMethod(objFilterDataMethod, searchTerm) {
2191
+ var keys = Object.keys(objFilterDataMethod);
1900
2192
 
1901
- if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
1902
- formattedValue.forEach(function (value) {
1903
- UtilsFilterControl.addOptionToSelectControl(selectControl, value, value, column.filterDefault);
1904
- });
1905
- continue;
1906
- }
2193
+ for (var i = 0; i < keys.length; i++) {
2194
+ if (keys[i] === searchTerm) {
2195
+ return objFilterDataMethod[searchTerm];
2196
+ }
2197
+ }
1907
2198
 
1908
- UtilsFilterControl.addOptionToSelectControl(selectControl, formattedValue, formattedValue, column.filterDefault);
1909
- }
2199
+ return null;
2200
+ }
2201
+ function createControls(that, header) {
2202
+ var addedFilterControl = false;
2203
+ var html;
2204
+ $.each(that.columns, function (_, column) {
2205
+ html = [];
2206
+
2207
+ if (!column.visible) {
2208
+ return;
2209
+ }
1910
2210
 
1911
- UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2211
+ if (!column.filterControl && !that.options.filterControlContainer) {
2212
+ html.push('<div class="no-filter-control"></div>');
2213
+ } else if (that.options.filterControlContainer) {
2214
+ var $filterControls = $(".bootstrap-table-filter-control-".concat(column.field));
2215
+ $.each($filterControls, function (_, filterControl) {
2216
+ var $filterControl = $(filterControl);
1912
2217
 
1913
- if (that.options.hideUnusedSelectOptions) {
1914
- UtilsFilterControl.hideUnusedSelectOptions(selectControl, uniqueValues);
2218
+ if (!$filterControl.is('[type=radio]')) {
2219
+ var placeholder = column.filterControlPlaceholder ? column.filterControlPlaceholder : '';
2220
+ $filterControl.attr('placeholder', placeholder).val(column.filterDefault);
1915
2221
  }
1916
- }
1917
- });
1918
- that.trigger('created-controls');
1919
- },
1920
- getFilterDataMethod: function getFilterDataMethod(objFilterDataMethod, searchTerm) {
1921
- var keys = Object.keys(objFilterDataMethod);
1922
2222
 
1923
- for (var i = 0; i < keys.length; i++) {
1924
- if (keys[i] === searchTerm) {
1925
- return objFilterDataMethod[searchTerm];
2223
+ $filterControl.attr('data-field', column.field);
2224
+ });
2225
+ addedFilterControl = true;
2226
+ } else {
2227
+ var nameControl = column.filterControl.toLowerCase();
2228
+ html.push('<div class="filter-control">');
2229
+ addedFilterControl = true;
2230
+
2231
+ if (column.searchable && that.options.filterTemplate[nameControl]) {
2232
+ html.push(that.options.filterTemplate[nameControl](that, column.field, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
1926
2233
  }
1927
2234
  }
1928
2235
 
1929
- return null;
1930
- },
1931
- createControls: function createControls(that, header) {
1932
- var addedFilterControl = false;
1933
- var isVisible;
1934
- var html;
1935
- $.each(that.columns, function (i, column) {
1936
- isVisible = 'hidden';
1937
- html = [];
1938
-
1939
- if (!column.visible) {
1940
- return;
2236
+ if (!column.filterControl && '' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
2237
+ if ($.isEmptyObject(that.filterColumnsPartial)) {
2238
+ that.filterColumnsPartial = {};
1941
2239
  }
1942
2240
 
1943
- if (!column.filterControl) {
1944
- html.push('<div class="no-filter-control"></div>');
1945
- } else {
1946
- html.push('<div class="filter-control">');
1947
- var nameControl = column.filterControl.toLowerCase();
1948
-
1949
- if (column.searchable && that.options.filterTemplate[nameControl]) {
1950
- addedFilterControl = true;
1951
- isVisible = 'visible';
1952
- html.push(that.options.filterTemplate[nameControl](that, column.field, isVisible, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
2241
+ that.filterColumnsPartial[column.field] = column.filterDefault;
2242
+ }
1953
2243
 
1954
- if ('' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
1955
- if ($.isEmptyObject(that.filterColumnsPartial)) {
1956
- that.filterColumnsPartial = {};
1957
- }
2244
+ $.each(header.find('th'), function (i, th) {
2245
+ var $th = $(th);
1958
2246
 
1959
- that.filterColumnsPartial[column.field] = column.filterDefault;
1960
- }
1961
- }
2247
+ if ($th.data('field') === column.field) {
2248
+ $th.find('.fht-cell').append(html.join(''));
2249
+ return false;
1962
2250
  }
2251
+ });
1963
2252
 
1964
- $.each(header.children().children(), function (i, tr) {
1965
- var $tr = $(tr);
1966
-
1967
- if ($tr.data('field') === column.field) {
1968
- $tr.find('.fht-cell').append(html.join(''));
1969
- return false;
1970
- }
1971
- });
2253
+ if (column.filterData && column.filterData.toLowerCase() !== 'column') {
2254
+ var filterDataType = getFilterDataMethod(
2255
+ /* eslint-disable no-use-before-define */
2256
+ filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
2257
+ var filterDataSource;
2258
+ var selectControl;
2259
+
2260
+ if (filterDataType) {
2261
+ filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
2262
+ selectControl = header.find(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
2263
+ addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
2264
+ filterDataType(filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault);
2265
+ } else {
2266
+ throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, obj, json, url, func.' + ' Use like this: var: {key: "value"}');
2267
+ }
2268
+ }
2269
+ });
1972
2270
 
1973
- if (column.filterData !== undefined && column.filterData.toLowerCase() !== 'column') {
1974
- var filterDataType = UtilsFilterControl.getFilterDataMethod(
1975
- /* eslint-disable no-use-before-define */
1976
- filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
1977
- var filterDataSource;
1978
- var selectControl;
1979
-
1980
- if (filterDataType !== null) {
1981
- filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
1982
- selectControl = $(".bootstrap-table-filter-control-".concat(UtilsFilterControl.escapeID(column.field)));
1983
- UtilsFilterControl.addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
1984
- filterDataType(filterDataSource, selectControl, column.filterDefault);
1985
- } else {
1986
- throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, json, url.' + ' Use like this: var: {key: "value"}');
1987
- }
2271
+ if (addedFilterControl) {
2272
+ header.off('keyup', 'input').on('keyup', 'input', function (_ref4, obj) {
2273
+ var currentTarget = _ref4.currentTarget,
2274
+ keyCode = _ref4.keyCode;
2275
+ syncControls(that); // Simulate enter key action from clear button
1988
2276
 
1989
- var variableValues;
1990
- var key; // eslint-disable-next-line default-case
1991
-
1992
- switch (filterDataType) {
1993
- case 'url':
1994
- $.ajax({
1995
- url: filterDataSource,
1996
- dataType: 'json',
1997
- success: function success(data) {
1998
- // eslint-disable-next-line guard-for-in
1999
- for (var _key in data) {
2000
- UtilsFilterControl.addOptionToSelectControl(selectControl, _key, data[_key], column.filterDefault);
2001
- }
2277
+ keyCode = obj ? obj.keyCode : keyCode;
2002
2278
 
2003
- UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2004
- }
2005
- });
2006
- break;
2279
+ if (that.options.searchOnEnterKey && keyCode !== 13) {
2280
+ return;
2281
+ }
2007
2282
 
2008
- case 'var':
2009
- variableValues = window[filterDataSource]; // eslint-disable-next-line guard-for-in
2283
+ if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
2284
+ return;
2285
+ }
2010
2286
 
2011
- for (key in variableValues) {
2012
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], column.filterDefault);
2013
- }
2287
+ var $currentTarget = $(currentTarget);
2014
2288
 
2015
- UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2016
- break;
2289
+ if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
2290
+ return;
2291
+ }
2017
2292
 
2018
- case 'jso':
2019
- variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
2293
+ clearTimeout(currentTarget.timeoutId || 0);
2294
+ currentTarget.timeoutId = setTimeout(function () {
2295
+ that.onColumnSearch({
2296
+ currentTarget: currentTarget,
2297
+ keyCode: keyCode
2298
+ });
2299
+ }, that.options.searchTimeOut);
2300
+ });
2301
+ header.off('change', 'select:not(".ms-offscreen")').on('change', 'select:not(".ms-offscreen")', function (_ref5) {
2302
+ var currentTarget = _ref5.currentTarget,
2303
+ keyCode = _ref5.keyCode;
2304
+ syncControls(that);
2305
+ var $select = $(currentTarget);
2306
+ var value = $select.val();
2307
+
2308
+ if (value && value.length > 0 && value.trim()) {
2309
+ $select.find('option[selected]').removeAttr('selected');
2310
+ $select.find('option[value="' + value + '"]').attr('selected', true);
2311
+ } else {
2312
+ $select.find('option[selected]').removeAttr('selected');
2313
+ }
2020
2314
 
2021
- for (key in variableValues) {
2022
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], column.filterDefault);
2023
- }
2315
+ clearTimeout(currentTarget.timeoutId || 0);
2316
+ currentTarget.timeoutId = setTimeout(function () {
2317
+ that.onColumnSearch({
2318
+ currentTarget: currentTarget,
2319
+ keyCode: keyCode
2320
+ });
2321
+ }, that.options.searchTimeOut);
2322
+ });
2323
+ header.off('mouseup', 'input:not([type=radio])').on('mouseup', 'input:not([type=radio])', function (_ref6) {
2324
+ var currentTarget = _ref6.currentTarget,
2325
+ keyCode = _ref6.keyCode;
2326
+ var $input = $(currentTarget);
2327
+ var oldValue = $input.val();
2024
2328
 
2025
- UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2026
- break;
2027
- }
2329
+ if (oldValue === '') {
2330
+ return;
2028
2331
  }
2029
- });
2030
2332
 
2031
- if (addedFilterControl) {
2032
- header.off('keyup', 'input').on('keyup', 'input', function (event, obj) {
2033
- // Simulate enter key action from clear button
2034
- event.keyCode = obj ? obj.keyCode : event.keyCode;
2333
+ setTimeout(function () {
2334
+ syncControls(that);
2335
+ var newValue = $input.val();
2035
2336
 
2036
- if (that.options.searchOnEnterKey && event.keyCode !== 13) {
2037
- return;
2337
+ if (newValue === '') {
2338
+ clearTimeout(currentTarget.timeoutId || 0);
2339
+ currentTarget.timeoutId = setTimeout(function () {
2340
+ that.onColumnSearch({
2341
+ currentTarget: currentTarget,
2342
+ keyCode: keyCode
2343
+ });
2344
+ }, that.options.searchTimeOut);
2038
2345
  }
2346
+ }, 1);
2347
+ });
2348
+ header.off('change', 'input[type=radio]').on('change', 'input[type=radio]', function (_ref7) {
2349
+ var currentTarget = _ref7.currentTarget,
2350
+ keyCode = _ref7.keyCode;
2351
+ clearTimeout(currentTarget.timeoutId || 0);
2352
+ currentTarget.timeoutId = setTimeout(function () {
2353
+ syncControls(that);
2354
+ that.onColumnSearch({
2355
+ currentTarget: currentTarget,
2356
+ keyCode: keyCode
2357
+ });
2358
+ }, that.options.searchTimeOut);
2359
+ });
2039
2360
 
2040
- if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
2041
- return;
2361
+ if (header.find('.date-filter-control').length > 0) {
2362
+ $.each(that.columns, function (i, _ref8) {
2363
+ var filterControl = _ref8.filterControl,
2364
+ field = _ref8.field,
2365
+ filterDatepickerOptions = _ref8.filterDatepickerOptions;
2366
+
2367
+ if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
2368
+ header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field)).datepicker(filterDatepickerOptions).on('changeDate', function (_ref9) {
2369
+ var currentTarget = _ref9.currentTarget,
2370
+ keyCode = _ref9.keyCode;
2371
+ clearTimeout(currentTarget.timeoutId || 0);
2372
+ currentTarget.timeoutId = setTimeout(function () {
2373
+ syncControls(that);
2374
+ that.onColumnSearch({
2375
+ currentTarget: currentTarget,
2376
+ keyCode: keyCode
2377
+ });
2378
+ }, that.options.searchTimeOut);
2379
+ });
2042
2380
  }
2381
+ });
2382
+ }
2043
2383
 
2044
- var $currentTarget = $(event.currentTarget);
2045
-
2046
- if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
2047
- return;
2048
- }
2384
+ if (that.options.sidePagination !== 'server' && !that.options.height) {
2385
+ that.triggerSearch();
2386
+ }
2049
2387
 
2050
- clearTimeout(event.currentTarget.timeoutId || 0);
2051
- event.currentTarget.timeoutId = setTimeout(function () {
2052
- that.onColumnSearch(event);
2053
- }, that.options.searchTimeOut);
2054
- });
2055
- header.off('change', 'select').on('change', 'select', function (event) {
2056
- if (that.options.searchOnEnterKey && event.keyCode !== 13) {
2057
- return;
2058
- }
2388
+ if (!that.options.filterControlVisible) {
2389
+ header.find('.filter-control, .no-filter-control').hide();
2390
+ }
2391
+ } else {
2392
+ header.find('.filter-control, .no-filter-control').hide();
2393
+ }
2059
2394
 
2060
- if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
2061
- return;
2062
- }
2395
+ that.trigger('created-controls');
2396
+ }
2397
+ function getDirectionOfSelectOptions(_alignment) {
2398
+ var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
2063
2399
 
2064
- clearTimeout(event.currentTarget.timeoutId || 0);
2065
- event.currentTarget.timeoutId = setTimeout(function () {
2066
- that.onColumnSearch(event);
2067
- }, that.options.searchTimeOut);
2068
- });
2069
- header.off('mouseup', 'input').on('mouseup', 'input', function (event) {
2070
- var $input = $(this);
2071
- var oldValue = $input.val();
2400
+ switch (alignment) {
2401
+ case 'left':
2402
+ return 'ltr';
2072
2403
 
2073
- if (oldValue === '') {
2074
- return;
2075
- }
2404
+ case 'right':
2405
+ return 'rtl';
2076
2406
 
2077
- setTimeout(function () {
2078
- var newValue = $input.val();
2407
+ case 'auto':
2408
+ return 'auto';
2079
2409
 
2080
- if (newValue === '') {
2081
- clearTimeout(event.currentTarget.timeoutId || 0);
2082
- event.currentTarget.timeoutId = setTimeout(function () {
2083
- that.onColumnSearch(event);
2084
- }, that.options.searchTimeOut);
2085
- }
2086
- }, 1);
2410
+ default:
2411
+ return 'ltr';
2412
+ }
2413
+ }
2414
+ function syncControls(that) {
2415
+ if (that.options.height) {
2416
+ var controlsTableHeader = that.$tableHeader.find(searchControls);
2417
+ that.$header.find(searchControls).each(function (_, control) {
2418
+ var $control = $(control);
2419
+ var controlClass = getElementClass($control);
2420
+ var foundControl = controlsTableHeader.filter(function (_, ele) {
2421
+ var eleClass = getElementClass($(ele));
2422
+ return controlClass === eleClass;
2087
2423
  });
2088
2424
 
2089
- if (header.find('.date-filter-control').length > 0) {
2090
- $.each(that.columns, function (i, _ref6) {
2091
- var filterControl = _ref6.filterControl,
2092
- field = _ref6.field,
2093
- filterDatepickerOptions = _ref6.filterDatepickerOptions;
2094
-
2095
- if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
2096
- header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field)).datepicker(filterDatepickerOptions).on('changeDate', function (event) {
2097
- clearTimeout(event.currentTarget.timeoutId || 0);
2098
- event.currentTarget.timeoutId = setTimeout(function () {
2099
- that.onColumnSearch(event);
2100
- }, that.options.searchTimeOut);
2101
- });
2102
- }
2103
- });
2425
+ if (foundControl.length === 0) {
2426
+ return;
2104
2427
  }
2105
2428
 
2106
- if (that.options.sidePagination !== 'server') {
2107
- header.find('[class*=\'bootstrap-table-filter-control\']').each(function (k, input) {
2108
- $(input).trigger('change');
2109
- });
2429
+ if ($control.is('select')) {
2430
+ $control.find('option:selected').removeAttr('selected');
2431
+ $control.find("option[value='".concat(foundControl.val(), "']")).attr('selected', true);
2432
+ } else {
2433
+ $control.val(foundControl.val());
2110
2434
  }
2111
- } else {
2112
- header.find('.filterControl').hide();
2113
- }
2114
- },
2115
- getDirectionOfSelectOptions: function getDirectionOfSelectOptions(_alignment) {
2116
- var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
2117
-
2118
- switch (alignment) {
2119
- case 'left':
2120
- return 'ltr';
2435
+ });
2436
+ }
2437
+ }
2438
+ var filterDataMethods = {
2439
+ func: function func(filterDataSource, selectControl, filterOrderBy, selected) {
2440
+ var variableValues = window[filterDataSource].apply();
2121
2441
 
2122
- case 'right':
2123
- return 'rtl';
2442
+ for (var key in variableValues) {
2443
+ addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2444
+ }
2124
2445
 
2125
- case 'auto':
2126
- return 'auto';
2446
+ sortSelectControl(selectControl, filterOrderBy);
2447
+ },
2448
+ obj: function obj(filterDataSource, selectControl, filterOrderBy, selected) {
2449
+ var objectKeys = filterDataSource.split('.');
2450
+ var variableName = objectKeys.shift();
2451
+ var variableValues = window[variableName];
2452
+
2453
+ if (objectKeys.length > 0) {
2454
+ objectKeys.forEach(function (key) {
2455
+ variableValues = variableValues[key];
2456
+ });
2457
+ }
2127
2458
 
2128
- default:
2129
- return 'ltr';
2459
+ for (var key in variableValues) {
2460
+ addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2130
2461
  }
2131
- }
2132
- };
2133
- var filterDataMethods = {
2462
+
2463
+ sortSelectControl(selectControl, filterOrderBy);
2464
+ },
2134
2465
  var: function _var(filterDataSource, selectControl, filterOrderBy, selected) {
2135
- var variableValues = window[filterDataSource]; // eslint-disable-next-line guard-for-in
2466
+ var variableValues = window[filterDataSource];
2467
+ var isArray = Array.isArray(variableValues);
2136
2468
 
2137
2469
  for (var key in variableValues) {
2138
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2470
+ if (isArray) {
2471
+ addOptionToSelectControl(selectControl, variableValues[key], variableValues[key], selected);
2472
+ } else {
2473
+ addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2474
+ }
2139
2475
  }
2140
2476
 
2141
- UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
2477
+ sortSelectControl(selectControl, filterOrderBy);
2142
2478
  },
2143
2479
  url: function url(filterDataSource, selectControl, filterOrderBy, selected) {
2144
2480
  $.ajax({
2145
2481
  url: filterDataSource,
2146
2482
  dataType: 'json',
2147
2483
  success: function success(data) {
2148
- // eslint-disable-next-line guard-for-in
2149
2484
  for (var key in data) {
2150
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, data[key], selected);
2485
+ addOptionToSelectControl(selectControl, key, data[key], selected);
2151
2486
  }
2152
2487
 
2153
- UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
2488
+ sortSelectControl(selectControl, filterOrderBy);
2154
2489
  }
2155
2490
  });
2156
2491
  },
2157
2492
  json: function json(filterDataSource, selectControl, filterOrderBy, selected) {
2158
- var variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
2493
+ var variableValues = JSON.parse(filterDataSource);
2159
2494
 
2160
2495
  for (var key in variableValues) {
2161
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2496
+ addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2162
2497
  }
2163
2498
 
2164
- UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
2499
+ sortSelectControl(selectControl, filterOrderBy);
2165
2500
  }
2166
2501
  };
2502
+
2503
+ var Utils$1 = $.fn.bootstrapTable.utils;
2167
2504
  $.extend($.fn.bootstrapTable.defaults, {
2168
2505
  filterControl: false,
2506
+ filterControlVisible: true,
2169
2507
  onColumnSearch: function onColumnSearch(field, text) {
2170
2508
  return false;
2171
2509
  },
2172
2510
  onCreatedControls: function onCreatedControls() {
2173
- return true;
2511
+ return false;
2174
2512
  },
2175
2513
  alignmentSelectControlOptions: undefined,
2176
2514
  filterTemplate: {
2177
- input: function input(that, field, isVisible, placeholder, value) {
2178
- return Utils.sprintf('<input type="text" class="form-control bootstrap-table-filter-control-%s" style="width: 100%; visibility: %s" placeholder="%s" value="%s">', field, isVisible, 'undefined' === typeof placeholder ? '' : placeholder, 'undefined' === typeof value ? '' : value);
2515
+ input: function input(that, field, placeholder, value) {
2516
+ return Utils$1.sprintf('<input type="text" class="form-control bootstrap-table-filter-control-%s search-input" style="width: 100%;" placeholder="%s" value="%s">', field, 'undefined' === typeof placeholder ? '' : placeholder, 'undefined' === typeof value ? '' : value);
2179
2517
  },
2180
- select: function select(_ref7, field, isVisible) {
2181
- var options = _ref7.options;
2182
- return Utils.sprintf('<select class="form-control bootstrap-table-filter-control-%s" style="width: 100%; visibility: %s" dir="%s"></select>', field, isVisible, UtilsFilterControl.getDirectionOfSelectOptions(options.alignmentSelectControlOptions));
2518
+ select: function select(_ref, field) {
2519
+ var options = _ref.options;
2520
+ return Utils$1.sprintf('<select class="form-control bootstrap-table-filter-control-%s" style="width: 100%;" dir="%s"></select>', field, getDirectionOfSelectOptions(options.alignmentSelectControlOptions));
2183
2521
  },
2184
- datepicker: function datepicker(that, field, isVisible, value) {
2185
- return Utils.sprintf('<input type="text" class="form-control date-filter-control bootstrap-table-filter-control-%s" style="width: 100%; visibility: %s" value="%s">', field, isVisible, 'undefined' === typeof value ? '' : value);
2522
+ datepicker: function datepicker(that, field, value) {
2523
+ return Utils$1.sprintf('<input type="text" class="form-control date-filter-control bootstrap-table-filter-control-%s" style="width: 100%;" value="%s">', field, 'undefined' === typeof value ? '' : value);
2186
2524
  }
2187
2525
  },
2188
2526
  disableControlWhenSearch: false,
2189
2527
  searchOnEnterKey: false,
2528
+ showFilterControlSwitch: false,
2190
2529
  // internal variables
2191
2530
  valuesFilterControl: []
2192
2531
  });
2193
2532
  $.extend($.fn.bootstrapTable.columnDefaults, {
2194
2533
  filterControl: undefined,
2534
+ // input, select, datepicker
2195
2535
  filterDataCollector: undefined,
2196
2536
  filterData: undefined,
2197
2537
  filterDatepickerOptions: undefined,
@@ -2209,7 +2549,26 @@
2209
2549
  $.extend($.fn.bootstrapTable.defaults.icons, {
2210
2550
  clear: {
2211
2551
  bootstrap3: 'glyphicon-trash icon-clear'
2212
- }[$.fn.bootstrapTable.theme] || 'fa-trash'
2552
+ }[$.fn.bootstrapTable.theme] || 'fa-trash',
2553
+ filterControlSwitchHide: {
2554
+ bootstrap3: 'glyphicon-zoom-out icon-zoom-out',
2555
+ materialize: 'zoom_out'
2556
+ }[$.fn.bootstrapTable.theme] || 'fa-search-minus',
2557
+ filterControlSwitchShow: {
2558
+ bootstrap3: 'glyphicon-zoom-in icon-zoom-in',
2559
+ materialize: 'zoom_in'
2560
+ }[$.fn.bootstrapTable.theme] || 'fa-search-plus'
2561
+ });
2562
+ $.extend($.fn.bootstrapTable.locales, {
2563
+ formatFilterControlSwitch: function formatFilterControlSwitch() {
2564
+ return 'Hide/Show controls';
2565
+ },
2566
+ formatFilterControlSwitchHide: function formatFilterControlSwitchHide() {
2567
+ return 'Hide controls';
2568
+ },
2569
+ formatFilterControlSwitchShow: function formatFilterControlSwitchShow() {
2570
+ return 'Show controls';
2571
+ }
2213
2572
  });
2214
2573
  $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
2215
2574
  $.extend($.fn.bootstrapTable.defaults, {
@@ -2219,6 +2578,7 @@
2219
2578
  });
2220
2579
  $.fn.bootstrapTable.methods.push('triggerSearch');
2221
2580
  $.fn.bootstrapTable.methods.push('clearFilterControl');
2581
+ $.fn.bootstrapTable.methods.push('toggleFilterControl');
2222
2582
 
2223
2583
  $.BootstrapTable =
2224
2584
  /*#__PURE__*/
@@ -2238,35 +2598,36 @@
2238
2598
 
2239
2599
  // Make sure that the filterControl option is set
2240
2600
  if (this.options.filterControl) {
2241
- var that = this; // Make sure that the internal variables are set correctly
2242
-
2601
+ // Make sure that the internal variables are set correctly
2243
2602
  this.options.valuesFilterControl = [];
2244
2603
  this.$el.on('reset-view.bs.table', function () {
2245
2604
  // Create controls on $tableHeader if the height is set
2246
- if (!that.options.height) {
2605
+ if (!_this.options.height) {
2247
2606
  return;
2248
2607
  } // Avoid recreate the controls
2249
2608
 
2250
2609
 
2251
- if (that.$tableHeader.find('select').length > 0 || that.$tableHeader.find('input').length > 0) {
2610
+ var $controlContainer = getControlContainer(_this);
2611
+
2612
+ if ($controlContainer.find('select').length > 0 || $controlContainer.find('input:not([type="checkbox"]):not([type="radio"])').length > 0) {
2252
2613
  return;
2253
2614
  }
2254
2615
 
2255
- UtilsFilterControl.createControls(that, that.$tableHeader);
2616
+ createControls(_this, $controlContainer);
2256
2617
  }).on('post-header.bs.table', function () {
2257
- UtilsFilterControl.setValues(that);
2618
+ setValues(_this);
2258
2619
  }).on('post-body.bs.table', function () {
2259
- if (that.options.height) {
2260
- UtilsFilterControl.fixHeaderCSS(that);
2620
+ if (_this.options.height && !_this.options.filterControlContainer) {
2621
+ fixHeaderCSS(_this);
2261
2622
  }
2262
2623
 
2263
2624
  _this.$tableLoading.css('top', _this.$header.outerHeight() + 1);
2264
2625
  }).on('column-switch.bs.table', function () {
2265
- UtilsFilterControl.setValues(that);
2626
+ setValues(_this);
2266
2627
  }).on('load-success.bs.table', function () {
2267
- that.EnableControls(true);
2628
+ _this.enableControls(true);
2268
2629
  }).on('load-error.bs.table', function () {
2269
- that.EnableControls(true);
2630
+ _this.enableControls(true);
2270
2631
  });
2271
2632
  }
2272
2633
 
@@ -2277,80 +2638,154 @@
2277
2638
  value: function initHeader() {
2278
2639
  _get(_getPrototypeOf(_class.prototype), "initHeader", this).call(this);
2279
2640
 
2280
- if (!this.options.filterControl) {
2641
+ if (!this.options.filterControl || this.options.height) {
2281
2642
  return;
2282
2643
  }
2283
2644
 
2284
- UtilsFilterControl.createControls(this, this.$header);
2645
+ createControls(this, getControlContainer(this));
2285
2646
  }
2286
2647
  }, {
2287
2648
  key: "initBody",
2288
2649
  value: function initBody() {
2289
2650
  _get(_getPrototypeOf(_class.prototype), "initBody", this).call(this);
2290
2651
 
2291
- UtilsFilterControl.initFilterSelectControls(this);
2652
+ syncControls(this);
2653
+ initFilterSelectControls(this);
2292
2654
  }
2293
2655
  }, {
2294
2656
  key: "initSearch",
2295
2657
  value: function initSearch() {
2658
+ var _this2 = this;
2659
+
2296
2660
  var that = this;
2297
2661
  var fp = $.isEmptyObject(that.filterColumnsPartial) ? null : that.filterColumnsPartial;
2298
2662
 
2299
- if (fp === null || Object.keys(fp).length <= 1) {
2300
- _get(_getPrototypeOf(_class.prototype), "initSearch", this).call(this);
2301
- }
2302
-
2303
- if (this.options.sidePagination === 'server') {
2304
- return;
2305
- }
2663
+ _get(_getPrototypeOf(_class.prototype), "initSearch", this).call(this);
2306
2664
 
2307
- if (fp === null) {
2665
+ if (this.options.sidePagination === 'server' || fp === null) {
2308
2666
  return;
2309
2667
  } // Check partial column filter
2310
2668
 
2311
2669
 
2312
- that.data = fp ? that.options.data.filter(function (item, i) {
2670
+ that.data = fp ? that.data.filter(function (item, i) {
2313
2671
  var itemIsExpected = [];
2314
- Object.keys(item).forEach(function (x, index) {
2315
- var key = that.header.fields[index];
2672
+ var keys1 = Object.keys(item);
2673
+ var keys2 = Object.keys(fp);
2674
+ var keys = keys1.concat(keys2.filter(function (item) {
2675
+ return !keys1.includes(item);
2676
+ }));
2677
+ keys.forEach(function (key) {
2316
2678
  var thisColumn = that.columns[that.fieldsColumnsIndex[key]];
2317
2679
  var fval = (fp[key] || '').toLowerCase();
2318
- var value = Utils.getItemField(item, key, false);
2680
+ var value = Utils$1.getItemField(item, key, false);
2681
+ var tmpItemIsExpected;
2319
2682
 
2320
2683
  if (fval === '') {
2321
- itemIsExpected.push(true);
2684
+ tmpItemIsExpected = true;
2322
2685
  } else {
2323
- // Fix #142: search use formated data
2686
+ // Fix #142: search use formatted data
2324
2687
  if (thisColumn && thisColumn.searchFormatter) {
2325
2688
  value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(key, that.header.fields)], [value, item, i], value);
2326
2689
  }
2327
2690
 
2328
2691
  if ($.inArray(key, that.header.fields) !== -1) {
2329
2692
  if (value === undefined || value === null) {
2330
- itemIsExpected.push(false);
2693
+ tmpItemIsExpected = false;
2694
+ } else if (_typeof(value) === 'object') {
2695
+ value.forEach(function (objectValue) {
2696
+ if (tmpItemIsExpected) {
2697
+ return;
2698
+ }
2699
+
2700
+ if (_this2.options.searchAccentNeutralise) {
2701
+ objectValue = Utils$1.normalizeAccent(objectValue);
2702
+ }
2703
+
2704
+ tmpItemIsExpected = that.isValueExpected(fval, objectValue, thisColumn, key);
2705
+ });
2331
2706
  } else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
2332
- if (thisColumn.filterStrictSearch) {
2333
- itemIsExpected.push(value.toString().toLowerCase() === fval.toString().toLowerCase());
2334
- } else if (thisColumn.filterStartsWithSearch) {
2335
- itemIsExpected.push("".concat(value).toLowerCase().indexOf(fval) === 0);
2336
- } else {
2337
- itemIsExpected.push("".concat(value).toLowerCase().includes(fval));
2707
+ if (_this2.options.searchAccentNeutralise) {
2708
+ value = Utils$1.normalizeAccent(value);
2338
2709
  }
2710
+
2711
+ tmpItemIsExpected = that.isValueExpected(fval, value, thisColumn, key);
2339
2712
  }
2340
2713
  }
2341
2714
  }
2715
+
2716
+ itemIsExpected.push(tmpItemIsExpected);
2342
2717
  });
2343
2718
  return !itemIsExpected.includes(false);
2344
2719
  }) : that.data;
2720
+ that.unsortedData = _toConsumableArray(that.data);
2721
+ }
2722
+ }, {
2723
+ key: "isValueExpected",
2724
+ value: function isValueExpected(searchValue, value, column, key) {
2725
+ var tmpItemIsExpected = false;
2726
+
2727
+ if (column.filterStrictSearch) {
2728
+ tmpItemIsExpected = value.toString().toLowerCase() === searchValue.toString().toLowerCase();
2729
+ } else if (column.filterStartsWithSearch) {
2730
+ tmpItemIsExpected = "".concat(value).toLowerCase().indexOf(searchValue) === 0;
2731
+ } else {
2732
+ tmpItemIsExpected = "".concat(value).toLowerCase().includes(searchValue);
2733
+ }
2734
+
2735
+ var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
2736
+ var matches = largerSmallerEqualsRegex.exec(searchValue);
2737
+
2738
+ if (matches) {
2739
+ var operator = matches[1] || "".concat(matches[5], "l");
2740
+ var comparisonValue = matches[2] || matches[3];
2741
+ var int = parseInt(value, 10);
2742
+ var comparisonInt = parseInt(comparisonValue, 10);
2743
+
2744
+ switch (operator) {
2745
+ case '>':
2746
+ case '<l':
2747
+ tmpItemIsExpected = int > comparisonInt;
2748
+ break;
2749
+
2750
+ case '<':
2751
+ case '>l':
2752
+ tmpItemIsExpected = int < comparisonInt;
2753
+ break;
2754
+
2755
+ case '<=':
2756
+ case '=<':
2757
+ case '>=l':
2758
+ case '=>l':
2759
+ tmpItemIsExpected = int <= comparisonInt;
2760
+ break;
2761
+
2762
+ case '>=':
2763
+ case '=>':
2764
+ case '<=l':
2765
+ case '=<l':
2766
+ tmpItemIsExpected = int >= comparisonInt;
2767
+ break;
2768
+ }
2769
+ }
2770
+
2771
+ if (column.filterCustomSearch) {
2772
+ var customSearchResult = Utils$1.calculateObjectValue(this, column.filterCustomSearch, [searchValue, value, key, this.options.data], true);
2773
+
2774
+ if (customSearchResult !== null) {
2775
+ tmpItemIsExpected = customSearchResult;
2776
+ }
2777
+ }
2778
+
2779
+ return tmpItemIsExpected;
2345
2780
  }
2346
2781
  }, {
2347
2782
  key: "initColumnSearch",
2348
2783
  value: function initColumnSearch(filterColumnsDefaults) {
2349
- UtilsFilterControl.copyValues(this);
2784
+ copyValues(this);
2350
2785
 
2351
2786
  if (filterColumnsDefaults) {
2352
2787
  this.filterColumnsPartial = filterColumnsDefaults;
2353
- this.updatePagination(); // eslint-disable-next-line guard-for-in
2788
+ this.updatePagination();
2354
2789
 
2355
2790
  for (var filter in filterColumnsDefaults) {
2356
2791
  this.trigger('column-search', filter, filterColumnsDefaults[filter]);
@@ -2359,14 +2794,18 @@
2359
2794
  }
2360
2795
  }, {
2361
2796
  key: "onColumnSearch",
2362
- value: function onColumnSearch(event) {
2363
- if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
2797
+ value: function onColumnSearch(_ref2) {
2798
+ var currentTarget = _ref2.currentTarget,
2799
+ keyCode = _ref2.keyCode;
2800
+
2801
+ if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
2364
2802
  return;
2365
2803
  }
2366
2804
 
2367
- UtilsFilterControl.copyValues(this);
2368
- var text = $.trim($(event.currentTarget).val());
2369
- var $field = $(event.currentTarget).closest('[data-field]').data('field');
2805
+ copyValues(this);
2806
+ var text = $.trim($(currentTarget).val());
2807
+ var $field = $(currentTarget).closest('[data-field]').data('field');
2808
+ this.trigger('column-search', $field, text);
2370
2809
 
2371
2810
  if ($.isEmptyObject(this.filterColumnsPartial)) {
2372
2811
  this.filterColumnsPartial = {};
@@ -2379,35 +2818,46 @@
2379
2818
  }
2380
2819
 
2381
2820
  this.options.pageNumber = 1;
2382
- this.EnableControls(false);
2383
- this.onSearch(event, false);
2384
- this.trigger('column-search', $field, text);
2821
+ this.enableControls(false);
2822
+ this.onSearch({
2823
+ currentTarget: currentTarget
2824
+ }, false);
2385
2825
  }
2386
2826
  }, {
2387
2827
  key: "initToolbar",
2388
2828
  value: function initToolbar() {
2829
+ this.showToolbar = this.showToolbar || this.options.showFilterControlSwitch;
2389
2830
  this.showSearchClearButton = this.options.filterControl && this.options.showSearchClearButton;
2390
2831
 
2391
2832
  _get(_getPrototypeOf(_class.prototype), "initToolbar", this).call(this);
2833
+
2834
+ if (this.options.showFilterControlSwitch) {
2835
+ var $btnGroup = this.$toolbar.find('>.columns');
2836
+ var $btnFilterControlSwitch = $btnGroup.find('.filter-control-switch');
2837
+
2838
+ if (!$btnFilterControlSwitch.length) {
2839
+ $btnFilterControlSwitch = $("\n <button class=\"filter-control-switch ".concat(this.constants.buttonsClass, "\"\n type=\"button\" title=\"").concat(this.options.formatFilterControlSwitch(), "\">\n ").concat(this.options.showButtonIcons ? Utils$1.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow) : '', "\n ").concat(this.options.showButtonText ? this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow() : '', "\n </button>\n ")).appendTo($btnGroup);
2840
+ $btnFilterControlSwitch.on('click', $.proxy(this.toggleFilterControl, this));
2841
+ }
2842
+ }
2392
2843
  }
2393
2844
  }, {
2394
2845
  key: "resetSearch",
2395
- value: function resetSearch() {
2846
+ value: function resetSearch(text) {
2396
2847
  if (this.options.filterControl && this.options.showSearchClearButton) {
2397
2848
  this.clearFilterControl();
2398
2849
  }
2399
2850
 
2400
- _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this);
2851
+ _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this, text);
2401
2852
  }
2402
2853
  }, {
2403
2854
  key: "clearFilterControl",
2404
2855
  value: function clearFilterControl() {
2405
2856
  if (this.options.filterControl) {
2406
2857
  var that = this;
2407
- var cookies = UtilsFilterControl.collectBootstrapCookies();
2408
- var header = UtilsFilterControl.getCurrentHeader(that);
2409
- var table = header.closest('table');
2410
- var controls = header.find(UtilsFilterControl.getCurrentSearchControls(that));
2858
+ var cookies = collectBootstrapCookies();
2859
+ var table = this.$el.closest('table');
2860
+ var controls = getSearchControls(that);
2411
2861
  var search = that.$toolbar.find('.search input');
2412
2862
  var hasValues = false;
2413
2863
  var timeoutId = 0;
@@ -2418,7 +2868,7 @@
2418
2868
  $.each(that.options.filterControls, function (i, item) {
2419
2869
  item.text = '';
2420
2870
  });
2421
- UtilsFilterControl.setValues(that); // clear cookies once the filters are clean
2871
+ setValues(that); // clear cookies once the filters are clean
2422
2872
 
2423
2873
  clearTimeout(timeoutId);
2424
2874
  timeoutId = setTimeout(function () {
@@ -2453,7 +2903,7 @@
2453
2903
 
2454
2904
 
2455
2905
  if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
2456
- var sorter = header.find(Utils.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')));
2906
+ var sorter = this.$header.find(Utils$1.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')));
2457
2907
 
2458
2908
  if (sorter.length > 0) {
2459
2909
  that.onSort({
@@ -2468,9 +2918,8 @@
2468
2918
  }, {
2469
2919
  key: "triggerSearch",
2470
2920
  value: function triggerSearch() {
2471
- var header = UtilsFilterControl.getCurrentHeader(this);
2472
- var searchControls = UtilsFilterControl.getCurrentSearchControls(this);
2473
- header.find(searchControls).each(function () {
2921
+ var searchControls = getSearchControls(this);
2922
+ searchControls.each(function () {
2474
2923
  var el = $(this);
2475
2924
 
2476
2925
  if (el.is('select')) {
@@ -2481,22 +2930,38 @@
2481
2930
  });
2482
2931
  }
2483
2932
  }, {
2484
- key: "EnableControls",
2485
- value: function EnableControls(enable) {
2933
+ key: "enableControls",
2934
+ value: function enableControls(enable) {
2486
2935
  if (this.options.disableControlWhenSearch && this.options.sidePagination === 'server') {
2487
- var header = UtilsFilterControl.getCurrentHeader(this);
2488
- var searchControls = UtilsFilterControl.getCurrentSearchControls(this);
2936
+ var searchControls = getSearchControls(this);
2489
2937
 
2490
2938
  if (!enable) {
2491
- header.find(searchControls).prop('disabled', 'disabled');
2939
+ searchControls.prop('disabled', 'disabled');
2492
2940
  } else {
2493
- header.find(searchControls).removeProp('disabled');
2941
+ searchControls.removeProp('disabled');
2494
2942
  }
2495
2943
  }
2496
2944
  }
2945
+ }, {
2946
+ key: "toggleFilterControl",
2947
+ value: function toggleFilterControl() {
2948
+ this.options.filterControlVisible = !this.options.filterControlVisible;
2949
+ var $filterControls = getControlContainer(this).find('.filter-control, .no-filter-control');
2950
+
2951
+ if (this.options.filterControlVisible) {
2952
+ $filterControls.show();
2953
+ } else {
2954
+ $filterControls.hide();
2955
+ this.clearFilterControl();
2956
+ }
2957
+
2958
+ var icon = this.options.showButtonIcons ? this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow : '';
2959
+ var text = this.options.showButtonText ? this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow() : '';
2960
+ this.$toolbar.find('>.columns').find('.filter-control-switch').html(Utils$1.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
2961
+ }
2497
2962
  }]);
2498
2963
 
2499
2964
  return _class;
2500
2965
  }($.BootstrapTable);
2501
2966
 
2502
- }));
2967
+ })));