bootstrap-table-rails 1.15.5 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +143 -36
  3. data/lib/bootstrap-table-rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-locale-all.js +1012 -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 +75 -12
  8. data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.js +1617 -763
  9. data/vendor/assets/javascripts/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js +280 -93
  10. data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js +200 -78
  11. data/vendor/assets/javascripts/bootstrap-table/extensions/cookie/bootstrap-table-cookie.js +1349 -258
  12. data/vendor/assets/javascripts/bootstrap-table/extensions/copy-rows/bootstrap-table-copy-rows.js +216 -77
  13. data/vendor/assets/javascripts/bootstrap-table/extensions/custom-view/bootstrap-table-custom-view.js +1198 -0
  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 +458 -204
  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 +1420 -901
  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.css +3 -2
  23. data/vendor/assets/javascripts/bootstrap-table/extensions/group-by-v2/bootstrap-table-group-by.js +552 -487
  24. data/vendor/assets/javascripts/bootstrap-table/extensions/i18n-enhance/bootstrap-table-i18n-enhance.js +3 -3
  25. data/vendor/assets/javascripts/bootstrap-table/extensions/key-events/bootstrap-table-key-events.js +219 -74
  26. data/vendor/assets/javascripts/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js +143 -66
  27. data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-sort/bootstrap-table-multiple-sort.js +326 -462
  28. data/vendor/assets/javascripts/bootstrap-table/extensions/page-jump-to/bootstrap-table-page-jump-to.js +137 -65
  29. data/vendor/assets/javascripts/bootstrap-table/extensions/pipeline/bootstrap-table-pipeline.js +87 -42
  30. data/vendor/assets/javascripts/bootstrap-table/extensions/print/bootstrap-table-print.js +452 -155
  31. data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-columns/bootstrap-table-reorder-columns.js +643 -255
  32. data/vendor/assets/javascripts/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js +348 -136
  33. data/vendor/assets/javascripts/bootstrap-table/extensions/resizable/bootstrap-table-resizable.js +84 -44
  34. data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.css +0 -1
  35. data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.js +218 -76
  36. data/vendor/assets/javascripts/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.js +558 -217
  37. data/vendor/assets/javascripts/bootstrap-table/extensions/treegrid/bootstrap-table-treegrid.js +221 -115
  38. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-af-ZA.js +98 -42
  39. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ar-SA.js +98 -42
  40. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-bg-BG.js +777 -0
  41. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ca-ES.js +98 -42
  42. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-cs-CZ.js +98 -42
  43. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-da-DK.js +98 -42
  44. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-de-DE.js +98 -42
  45. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-el-GR.js +98 -42
  46. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-en-US.js +98 -42
  47. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-AR.js +120 -63
  48. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CL.js +98 -42
  49. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-CR.js +98 -42
  50. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-ES.js +98 -42
  51. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-MX.js +98 -42
  52. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-NI.js +98 -42
  53. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-es-SP.js +98 -42
  54. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-et-EE.js +98 -42
  55. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-eu-EU.js +98 -42
  56. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fa-IR.js +98 -42
  57. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fi-FI.js +98 -42
  58. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-BE.js +98 -42
  59. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-CH.js +98 -42
  60. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-FR.js +99 -43
  61. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-fr-LU.js +98 -42
  62. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-he-IL.js +98 -42
  63. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hr-HR.js +98 -42
  64. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-hu-HU.js +98 -42
  65. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-id-ID.js +98 -42
  66. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-it-IT.js +113 -57
  67. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ja-JP.js +98 -42
  68. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ka-GE.js +98 -42
  69. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ko-KR.js +98 -42
  70. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ms-MY.js +98 -42
  71. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nb-NO.js +98 -42
  72. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-BE.js +99 -43
  73. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-nl-NL.js +98 -42
  74. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pl-PL.js +98 -42
  75. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-BR.js +102 -45
  76. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-pt-PT.js +98 -42
  77. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ro-RO.js +98 -42
  78. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ru-RU.js +98 -42
  79. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sk-SK.js +98 -42
  80. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Cyrl-RS.js +98 -42
  81. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Latn-RS.js +98 -42
  82. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sv-SE.js +98 -42
  83. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-th-TH.js +98 -42
  84. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-tr-TR.js +98 -42
  85. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uk-UA.js +98 -42
  86. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-ur-PK.js +98 -42
  87. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-uz-Latn-UZ.js +98 -42
  88. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-vi-VN.js +98 -42
  89. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-CN.js +98 -42
  90. data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-zh-TW.js +98 -42
  91. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/bootstrap-table.css +776 -0
  92. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/bootstrap-table.js +1049 -0
  93. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/fonts/bootstrap-table.eot +0 -0
  94. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/fonts/bootstrap-table.svg +28 -0
  95. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/fonts/bootstrap-table.ttf +0 -0
  96. data/vendor/assets/javascripts/bootstrap-table/themes/bootstrap-table/fonts/bootstrap-table.woff +0 -0
  97. data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.css +89 -13
  98. data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.js +161 -63
  99. data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.css +88 -15
  100. data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.js +166 -65
  101. data/vendor/assets/javascripts/bootstrap-table/themes/materialize/bootstrap-table-materialize.css +83 -11
  102. data/vendor/assets/javascripts/bootstrap-table/themes/materialize/bootstrap-table-materialize.js +164 -66
  103. data/vendor/assets/javascripts/bootstrap-table/themes/semantic/bootstrap-table-semantic.css +89 -15
  104. data/vendor/assets/javascripts/bootstrap-table/themes/semantic/bootstrap-table-semantic.js +164 -66
  105. metadata +10 -5
  106. data/vendor/assets/javascripts/bootstrap-table/extensions/accent-neutralise/bootstrap-table-accent-neutralise.js +0 -1757
  107. data/vendor/assets/javascripts/bootstrap-table/extensions/cell-input/bootstrap-table-cell-input.css +0 -12
  108. data/vendor/assets/javascripts/bootstrap-table/extensions/cell-input/bootstrap-table-cell-input.js +0 -2087
  109. data/vendor/assets/javascripts/bootstrap-table/extensions/natural-sorting/bootstrap-table-natural-sorting.js +0 -1265
@@ -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,43 +945,54 @@
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;
948
+ var nativeAssign = Object.assign;
949
+ var defineProperty = Object.defineProperty;
950
+
951
+ // `Object.assign` method
952
+ // https://tc39.github.io/ecma262/#sec-object.assign
953
+ var objectAssign = !nativeAssign || fails(function () {
954
+ // should have correct order of operations (Edge bug)
955
+ if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
956
+ enumerable: true,
957
+ get: function () {
958
+ defineProperty(this, 'b', {
959
+ value: 3,
960
+ enumerable: false
961
+ });
962
+ }
963
+ }), { b: 2 })).b !== 1) return true;
964
+ // should work with symbols and should have deterministic property order (V8 bug)
965
+ var A = {};
966
+ var B = {};
967
+ // eslint-disable-next-line no-undef
968
+ var symbol = Symbol();
969
+ var alphabet = 'abcdefghijklmnopqrst';
970
+ A[symbol] = 7;
971
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
972
+ return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
973
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
974
+ var T = toObject(target);
975
+ var argumentsLength = arguments.length;
976
+ var index = 1;
977
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
978
+ var propertyIsEnumerable = objectPropertyIsEnumerable.f;
979
+ while (argumentsLength > index) {
980
+ var S = indexedObject(arguments[index++]);
981
+ var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
982
+ var length = keys.length;
983
+ var j = 0;
984
+ var key;
985
+ while (length > j) {
986
+ key = keys[j++];
987
+ if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
988
+ }
989
+ } return T;
990
+ } : nativeAssign;
846
991
 
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
- }
992
+ // `Object.assign` method
993
+ // https://tc39.github.io/ecma262/#sec-object.assign
994
+ _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
995
+ assign: objectAssign
855
996
  });
856
997
 
857
998
  var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
@@ -865,6 +1006,13 @@
865
1006
  });
866
1007
 
867
1008
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1009
+ var test = {};
1010
+
1011
+ test[TO_STRING_TAG] = 'z';
1012
+
1013
+ var toStringTagSupport = String(test) === '[object z]';
1014
+
1015
+ var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
868
1016
  // ES3 wrong here
869
1017
  var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
870
1018
 
@@ -876,36 +1024,79 @@
876
1024
  };
877
1025
 
878
1026
  // getting tag from ES6+ `Object.prototype.toString`
879
- var classof = function (it) {
1027
+ var classof = toStringTagSupport ? classofRaw : function (it) {
880
1028
  var O, tag, result;
881
1029
  return it === undefined ? 'Undefined' : it === null ? 'Null'
882
1030
  // @@toStringTag case
883
- : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
1031
+ : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
884
1032
  // builtinTag case
885
1033
  : CORRECT_ARGUMENTS ? classofRaw(O)
886
1034
  // ES3 arguments fallback
887
1035
  : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
888
1036
  };
889
1037
 
890
- var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
891
- var test$1 = {};
892
-
893
- test$1[TO_STRING_TAG$1] = 'z';
894
-
895
1038
  // `Object.prototype.toString` method implementation
896
1039
  // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
897
- var objectToString = String(test$1) !== '[object z]' ? function toString() {
1040
+ var objectToString = toStringTagSupport ? {}.toString : function toString() {
898
1041
  return '[object ' + classof(this) + ']';
899
- } : test$1.toString;
900
-
901
- var ObjectPrototype = Object.prototype;
1042
+ };
902
1043
 
903
1044
  // `Object.prototype.toString` method
904
1045
  // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
905
- if (objectToString !== ObjectPrototype.toString) {
906
- redefine(ObjectPrototype, 'toString', objectToString, { unsafe: true });
1046
+ if (!toStringTagSupport) {
1047
+ redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
907
1048
  }
908
1049
 
1050
+ // a string of all valid unicode whitespaces
1051
+ // eslint-disable-next-line max-len
1052
+ 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';
1053
+
1054
+ var whitespace = '[' + whitespaces + ']';
1055
+ var ltrim = RegExp('^' + whitespace + whitespace + '*');
1056
+ var rtrim = RegExp(whitespace + whitespace + '*$');
1057
+
1058
+ // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1059
+ var createMethod$2 = function (TYPE) {
1060
+ return function ($this) {
1061
+ var string = String(requireObjectCoercible($this));
1062
+ if (TYPE & 1) string = string.replace(ltrim, '');
1063
+ if (TYPE & 2) string = string.replace(rtrim, '');
1064
+ return string;
1065
+ };
1066
+ };
1067
+
1068
+ var stringTrim = {
1069
+ // `String.prototype.{ trimLeft, trimStart }` methods
1070
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
1071
+ start: createMethod$2(1),
1072
+ // `String.prototype.{ trimRight, trimEnd }` methods
1073
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
1074
+ end: createMethod$2(2),
1075
+ // `String.prototype.trim` method
1076
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1077
+ trim: createMethod$2(3)
1078
+ };
1079
+
1080
+ var trim = stringTrim.trim;
1081
+
1082
+
1083
+ var nativeParseInt = global_1.parseInt;
1084
+ var hex = /^[+-]?0[Xx]/;
1085
+ var FORCED$1 = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;
1086
+
1087
+ // `parseInt` method
1088
+ // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1089
+ var _parseInt = FORCED$1 ? function parseInt(string, radix) {
1090
+ var S = trim(String(string));
1091
+ return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
1092
+ } : nativeParseInt;
1093
+
1094
+ // `parseInt` method
1095
+ // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1096
+ _export({ global: true, forced: parseInt != _parseInt }, {
1097
+ parseInt: _parseInt
1098
+ });
1099
+
909
1100
  // `RegExp.prototype.flags` getter implementation
910
1101
  // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
911
1102
  var regexpFlags = function () {
@@ -920,64 +1111,31 @@
920
1111
  return result;
921
1112
  };
922
1113
 
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 });
1114
+ // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
1115
+ // so we use an intermediate function.
1116
+ function RE(s, f) {
1117
+ return RegExp(s, f);
941
1118
  }
942
1119
 
943
- var MATCH = wellKnownSymbol('match');
1120
+ var UNSUPPORTED_Y = fails(function () {
1121
+ // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1122
+ var re = RE('a', 'y');
1123
+ re.lastIndex = 2;
1124
+ return re.exec('abcd') != null;
1125
+ });
944
1126
 
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
- };
1127
+ var BROKEN_CARET = fails(function () {
1128
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
1129
+ var re = RE('^r', 'gy');
1130
+ re.lastIndex = 2;
1131
+ return re.exec('str') != null;
1132
+ });
951
1133
 
952
- var notARegexp = function (it) {
953
- if (isRegexp(it)) {
954
- throw TypeError("The method doesn't accept regular expressions");
955
- } return it;
1134
+ var regexpStickyHelpers = {
1135
+ UNSUPPORTED_Y: UNSUPPORTED_Y,
1136
+ BROKEN_CARET: BROKEN_CARET
956
1137
  };
957
1138
 
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
1139
  var nativeExec = RegExp.prototype.exec;
982
1140
  // This always refers to the native implementation, because the
983
1141
  // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
@@ -994,41 +1152,384 @@
994
1152
  return re1.lastIndex !== 0 || re2.lastIndex !== 0;
995
1153
  })();
996
1154
 
1155
+ var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
1156
+
997
1157
  // nonparticipating capturing group, copied from es5-shim's String#split patch.
998
1158
  var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
999
1159
 
1000
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
1160
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
1001
1161
 
1002
1162
  if (PATCH) {
1003
1163
  patchedExec = function exec(str) {
1004
1164
  var re = this;
1005
1165
  var lastIndex, reCopy, match, i;
1166
+ var sticky = UNSUPPORTED_Y$1 && re.sticky;
1167
+ var flags = regexpFlags.call(re);
1168
+ var source = re.source;
1169
+ var charsAdded = 0;
1170
+ var strCopy = str;
1171
+
1172
+ if (sticky) {
1173
+ flags = flags.replace('y', '');
1174
+ if (flags.indexOf('g') === -1) {
1175
+ flags += 'g';
1176
+ }
1177
+
1178
+ strCopy = String(str).slice(re.lastIndex);
1179
+ // Support anchored sticky behavior.
1180
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
1181
+ source = '(?: ' + source + ')';
1182
+ strCopy = ' ' + strCopy;
1183
+ charsAdded++;
1184
+ }
1185
+ // ^(? + rx + ) is needed, in combination with some str slicing, to
1186
+ // simulate the 'y' flag.
1187
+ reCopy = new RegExp('^(?:' + source + ')', flags);
1188
+ }
1006
1189
 
1007
1190
  if (NPCG_INCLUDED) {
1008
- reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
1191
+ reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
1009
1192
  }
1010
1193
  if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1011
1194
 
1012
- match = nativeExec.call(re, str);
1195
+ match = nativeExec.call(sticky ? reCopy : re, strCopy);
1196
+
1197
+ if (sticky) {
1198
+ if (match) {
1199
+ match.input = match.input.slice(charsAdded);
1200
+ match[0] = match[0].slice(charsAdded);
1201
+ match.index = re.lastIndex;
1202
+ re.lastIndex += match[0].length;
1203
+ } else re.lastIndex = 0;
1204
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
1205
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1206
+ }
1207
+ if (NPCG_INCLUDED && match && match.length > 1) {
1208
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
1209
+ // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
1210
+ nativeReplace.call(match[0], reCopy, function () {
1211
+ for (i = 1; i < arguments.length - 2; i++) {
1212
+ if (arguments[i] === undefined) match[i] = undefined;
1213
+ }
1214
+ });
1215
+ }
1216
+
1217
+ return match;
1218
+ };
1219
+ }
1220
+
1221
+ var regexpExec = patchedExec;
1222
+
1223
+ _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
1224
+ exec: regexpExec
1225
+ });
1226
+
1227
+ var TO_STRING = 'toString';
1228
+ var RegExpPrototype = RegExp.prototype;
1229
+ var nativeToString = RegExpPrototype[TO_STRING];
1230
+
1231
+ var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
1232
+ // FF44- RegExp#toString has a wrong name
1233
+ var INCORRECT_NAME = nativeToString.name != TO_STRING;
1234
+
1235
+ // `RegExp.prototype.toString` method
1236
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
1237
+ if (NOT_GENERIC || INCORRECT_NAME) {
1238
+ redefine(RegExp.prototype, TO_STRING, function toString() {
1239
+ var R = anObject(this);
1240
+ var p = String(R.source);
1241
+ var rf = R.flags;
1242
+ var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
1243
+ return '/' + p + '/' + f;
1244
+ }, { unsafe: true });
1245
+ }
1246
+
1247
+ var MATCH = wellKnownSymbol('match');
1248
+
1249
+ // `IsRegExp` abstract operation
1250
+ // https://tc39.github.io/ecma262/#sec-isregexp
1251
+ var isRegexp = function (it) {
1252
+ var isRegExp;
1253
+ return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
1254
+ };
1255
+
1256
+ var notARegexp = function (it) {
1257
+ if (isRegexp(it)) {
1258
+ throw TypeError("The method doesn't accept regular expressions");
1259
+ } return it;
1260
+ };
1261
+
1262
+ var MATCH$1 = wellKnownSymbol('match');
1263
+
1264
+ var correctIsRegexpLogic = function (METHOD_NAME) {
1265
+ var regexp = /./;
1266
+ try {
1267
+ '/./'[METHOD_NAME](regexp);
1268
+ } catch (e) {
1269
+ try {
1270
+ regexp[MATCH$1] = false;
1271
+ return '/./'[METHOD_NAME](regexp);
1272
+ } catch (f) { /* empty */ }
1273
+ } return false;
1274
+ };
1275
+
1276
+ // `String.prototype.includes` method
1277
+ // https://tc39.github.io/ecma262/#sec-string.prototype.includes
1278
+ _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
1279
+ includes: function includes(searchString /* , position = 0 */) {
1280
+ return !!~String(requireObjectCoercible(this))
1281
+ .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
1282
+ }
1283
+ });
1284
+
1285
+ var non = '\u200B\u0085\u180E';
1286
+
1287
+ // check that a method works with the correct list
1288
+ // of whitespaces and has a correct name
1289
+ var forcedStringTrimMethod = function (METHOD_NAME) {
1290
+ return fails(function () {
1291
+ return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
1292
+ });
1293
+ };
1294
+
1295
+ var $trim = stringTrim.trim;
1296
+
1297
+
1298
+ // `String.prototype.trim` method
1299
+ // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1300
+ _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
1301
+ trim: function trim() {
1302
+ return $trim(this);
1303
+ }
1304
+ });
1305
+
1306
+ // iterable DOM collections
1307
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1308
+ var domIterables = {
1309
+ CSSRuleList: 0,
1310
+ CSSStyleDeclaration: 0,
1311
+ CSSValueList: 0,
1312
+ ClientRectList: 0,
1313
+ DOMRectList: 0,
1314
+ DOMStringList: 0,
1315
+ DOMTokenList: 1,
1316
+ DataTransferItemList: 0,
1317
+ FileList: 0,
1318
+ HTMLAllCollection: 0,
1319
+ HTMLCollection: 0,
1320
+ HTMLFormElement: 0,
1321
+ HTMLSelectElement: 0,
1322
+ MediaList: 0,
1323
+ MimeTypeArray: 0,
1324
+ NamedNodeMap: 0,
1325
+ NodeList: 1,
1326
+ PaintRequestList: 0,
1327
+ Plugin: 0,
1328
+ PluginArray: 0,
1329
+ SVGLengthList: 0,
1330
+ SVGNumberList: 0,
1331
+ SVGPathSegList: 0,
1332
+ SVGPointList: 0,
1333
+ SVGStringList: 0,
1334
+ SVGTransformList: 0,
1335
+ SourceBufferList: 0,
1336
+ StyleSheetList: 0,
1337
+ TextTrackCueList: 0,
1338
+ TextTrackList: 0,
1339
+ TouchList: 0
1340
+ };
1341
+
1342
+ var $forEach = arrayIteration.forEach;
1343
+
1344
+
1345
+ // `Array.prototype.forEach` method implementation
1346
+ // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1347
+ var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
1348
+ return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1349
+ } : [].forEach;
1350
+
1351
+ for (var COLLECTION_NAME in domIterables) {
1352
+ var Collection = global_1[COLLECTION_NAME];
1353
+ var CollectionPrototype = Collection && Collection.prototype;
1354
+ // some Chrome versions have non-configurable methods on DOMTokenList
1355
+ if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
1356
+ createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
1357
+ } catch (error) {
1358
+ CollectionPrototype.forEach = arrayForEach;
1359
+ }
1360
+ }
1361
+
1362
+ function _typeof(obj) {
1363
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1364
+ _typeof = function (obj) {
1365
+ return typeof obj;
1366
+ };
1367
+ } else {
1368
+ _typeof = function (obj) {
1369
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1370
+ };
1371
+ }
1372
+
1373
+ return _typeof(obj);
1374
+ }
1375
+
1376
+ function _classCallCheck(instance, Constructor) {
1377
+ if (!(instance instanceof Constructor)) {
1378
+ throw new TypeError("Cannot call a class as a function");
1379
+ }
1380
+ }
1381
+
1382
+ function _defineProperties(target, props) {
1383
+ for (var i = 0; i < props.length; i++) {
1384
+ var descriptor = props[i];
1385
+ descriptor.enumerable = descriptor.enumerable || false;
1386
+ descriptor.configurable = true;
1387
+ if ("value" in descriptor) descriptor.writable = true;
1388
+ Object.defineProperty(target, descriptor.key, descriptor);
1389
+ }
1390
+ }
1391
+
1392
+ function _createClass(Constructor, protoProps, staticProps) {
1393
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1394
+ if (staticProps) _defineProperties(Constructor, staticProps);
1395
+ return Constructor;
1396
+ }
1397
+
1398
+ function _inherits(subClass, superClass) {
1399
+ if (typeof superClass !== "function" && superClass !== null) {
1400
+ throw new TypeError("Super expression must either be null or a function");
1401
+ }
1402
+
1403
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1404
+ constructor: {
1405
+ value: subClass,
1406
+ writable: true,
1407
+ configurable: true
1408
+ }
1409
+ });
1410
+ if (superClass) _setPrototypeOf(subClass, superClass);
1411
+ }
1412
+
1413
+ function _getPrototypeOf(o) {
1414
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
1415
+ return o.__proto__ || Object.getPrototypeOf(o);
1416
+ };
1417
+ return _getPrototypeOf(o);
1418
+ }
1419
+
1420
+ function _setPrototypeOf(o, p) {
1421
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
1422
+ o.__proto__ = p;
1423
+ return o;
1424
+ };
1425
+
1426
+ return _setPrototypeOf(o, p);
1427
+ }
1428
+
1429
+ function _assertThisInitialized(self) {
1430
+ if (self === void 0) {
1431
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1432
+ }
1433
+
1434
+ return self;
1435
+ }
1436
+
1437
+ function _possibleConstructorReturn(self, call) {
1438
+ if (call && (typeof call === "object" || typeof call === "function")) {
1439
+ return call;
1440
+ }
1441
+
1442
+ return _assertThisInitialized(self);
1443
+ }
1444
+
1445
+ function _superPropBase(object, property) {
1446
+ while (!Object.prototype.hasOwnProperty.call(object, property)) {
1447
+ object = _getPrototypeOf(object);
1448
+ if (object === null) break;
1449
+ }
1450
+
1451
+ return object;
1452
+ }
1453
+
1454
+ function _get(target, property, receiver) {
1455
+ if (typeof Reflect !== "undefined" && Reflect.get) {
1456
+ _get = Reflect.get;
1457
+ } else {
1458
+ _get = function _get(target, property, receiver) {
1459
+ var base = _superPropBase(target, property);
1460
+
1461
+ if (!base) return;
1462
+ var desc = Object.getOwnPropertyDescriptor(base, property);
1463
+
1464
+ if (desc.get) {
1465
+ return desc.get.call(receiver);
1466
+ }
1467
+
1468
+ return desc.value;
1469
+ };
1470
+ }
1471
+
1472
+ return _get(target, property, receiver || target);
1473
+ }
1474
+
1475
+ function _toConsumableArray(arr) {
1476
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
1477
+ }
1478
+
1479
+ function _arrayWithoutHoles(arr) {
1480
+ if (Array.isArray(arr)) {
1481
+ for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
1482
+
1483
+ return arr2;
1484
+ }
1485
+ }
1486
+
1487
+ function _iterableToArray(iter) {
1488
+ if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
1489
+ }
1490
+
1491
+ function _nonIterableSpread() {
1492
+ throw new TypeError("Invalid attempt to spread non-iterable instance");
1493
+ }
1494
+
1495
+ var nativeJoin = [].join;
1496
+
1497
+ var ES3_STRINGS = indexedObject != Object;
1498
+ var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
1499
+
1500
+ // `Array.prototype.join` method
1501
+ // https://tc39.github.io/ecma262/#sec-array.prototype.join
1502
+ _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
1503
+ join: function join(separator) {
1504
+ return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
1505
+ }
1506
+ });
1507
+
1508
+ var test$1 = [];
1509
+ var nativeSort = test$1.sort;
1013
1510
 
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
- }
1511
+ // IE8-
1512
+ var FAILS_ON_UNDEFINED = fails(function () {
1513
+ test$1.sort(undefined);
1514
+ });
1515
+ // V8 bug
1516
+ var FAILS_ON_NULL = fails(function () {
1517
+ test$1.sort(null);
1518
+ });
1519
+ // Old WebKit
1520
+ var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
1026
1521
 
1027
- return match;
1028
- };
1029
- }
1522
+ var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
1030
1523
 
1031
- var regexpExec = patchedExec;
1524
+ // `Array.prototype.sort` method
1525
+ // https://tc39.github.io/ecma262/#sec-array.prototype.sort
1526
+ _export({ target: 'Array', proto: true, forced: FORCED$2 }, {
1527
+ sort: function sort(comparefn) {
1528
+ return comparefn === undefined
1529
+ ? nativeSort.call(toObject(this))
1530
+ : nativeSort.call(toObject(this), aFunction$1(comparefn));
1531
+ }
1532
+ });
1032
1533
 
1033
1534
  var SPECIES$2 = wellKnownSymbol('species');
1034
1535
 
@@ -1045,6 +1546,12 @@
1045
1546
  return ''.replace(re, '$<a>') !== '7';
1046
1547
  });
1047
1548
 
1549
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
1550
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
1551
+ var REPLACE_KEEPS_$0 = (function () {
1552
+ return 'a'.replace(/./, '$0') === '$0';
1553
+ })();
1554
+
1048
1555
  // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
1049
1556
  // Weex JS has frozen built-in prototypes, so use try / catch wrapper
1050
1557
  var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
@@ -1069,15 +1576,22 @@
1069
1576
  // Symbol-named RegExp methods call .exec
1070
1577
  var execCalled = false;
1071
1578
  var re = /a/;
1072
- re.exec = function () { execCalled = true; return null; };
1073
1579
 
1074
1580
  if (KEY === 'split') {
1581
+ // We can't use real regex here since it causes deoptimization
1582
+ // and serious performance degradation in V8
1583
+ // https://github.com/zloirock/core-js/issues/306
1584
+ re = {};
1075
1585
  // RegExp[@@split] doesn't call the regex's exec method, but first creates
1076
1586
  // a new one. We need to return the patched regex when creating the new one.
1077
1587
  re.constructor = {};
1078
1588
  re.constructor[SPECIES$2] = function () { return re; };
1589
+ re.flags = '';
1590
+ re[SYMBOL] = /./[SYMBOL];
1079
1591
  }
1080
1592
 
1593
+ re.exec = function () { execCalled = true; return null; };
1594
+
1081
1595
  re[SYMBOL]('');
1082
1596
  return !execCalled;
1083
1597
  });
@@ -1085,7 +1599,7 @@
1085
1599
  if (
1086
1600
  !DELEGATES_TO_SYMBOL ||
1087
1601
  !DELEGATES_TO_EXEC ||
1088
- (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
1602
+ (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) ||
1089
1603
  (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
1090
1604
  ) {
1091
1605
  var nativeRegExpMethod = /./[SYMBOL];
@@ -1100,7 +1614,7 @@
1100
1614
  return { done: true, value: nativeMethod.call(str, regexp, arg2) };
1101
1615
  }
1102
1616
  return { done: false };
1103
- });
1617
+ }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 });
1104
1618
  var stringMethod = methods[0];
1105
1619
  var regexMethod = methods[1];
1106
1620
 
@@ -1113,12 +1627,13 @@
1113
1627
  // 21.2.5.9 RegExp.prototype[@@search](string)
1114
1628
  : function (string) { return regexMethod.call(string, this); }
1115
1629
  );
1116
- if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
1117
1630
  }
1631
+
1632
+ if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
1118
1633
  };
1119
1634
 
1120
1635
  // `String.prototype.{ codePointAt, at }` methods implementation
1121
- var createMethod$2 = function (CONVERT_TO_STRING) {
1636
+ var createMethod$3 = function (CONVERT_TO_STRING) {
1122
1637
  return function ($this, pos) {
1123
1638
  var S = String(requireObjectCoercible($this));
1124
1639
  var position = toInteger(pos);
@@ -1136,10 +1651,10 @@
1136
1651
  var stringMultibyte = {
1137
1652
  // `String.prototype.codePointAt` method
1138
1653
  // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
1139
- codeAt: createMethod$2(false),
1654
+ codeAt: createMethod$3(false),
1140
1655
  // `String.prototype.at` method
1141
1656
  // https://github.com/mathiasbynens/String.prototype.at
1142
- charAt: createMethod$2(true)
1657
+ charAt: createMethod$3(true)
1143
1658
  };
1144
1659
 
1145
1660
  var charAt = stringMultibyte.charAt;
@@ -1217,7 +1732,7 @@
1217
1732
  };
1218
1733
 
1219
1734
  // @@replace logic
1220
- fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
1735
+ fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
1221
1736
  return [
1222
1737
  // `String.prototype.replace` method
1223
1738
  // https://tc39.github.io/ecma262/#sec-string.prototype.replace
@@ -1231,8 +1746,10 @@
1231
1746
  // `RegExp.prototype[@@replace]` method
1232
1747
  // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
1233
1748
  function (regexp, replaceValue) {
1234
- var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
1235
- if (res.done) return res.value;
1749
+ if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) {
1750
+ var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
1751
+ if (res.done) return res.value;
1752
+ }
1236
1753
 
1237
1754
  var rx = anObject(regexp);
1238
1755
  var S = String(this);
@@ -1456,742 +1973,615 @@
1456
1973
  ];
1457
1974
  }, !SUPPORTS_Y);
1458
1975
 
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;
1976
+ var Utils = $.fn.bootstrapTable.utils;
1977
+ var searchControls = 'select, input:not([type="checkbox"]):not([type="radio"])';
1978
+ function getOptionsFromSelectControl(selectControl) {
1979
+ return selectControl.get(selectControl.length - 1).options;
1656
1980
  }
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
- };
1981
+ function getControlContainer(that) {
1982
+ if (that.options.filterControlContainer) {
1983
+ return $("".concat(that.options.filterControlContainer));
1674
1984
  }
1675
1985
 
1676
- return _get(target, property, receiver || target);
1986
+ return that.$header;
1677
1987
  }
1988
+ function getSearchControls(that) {
1989
+ return getControlContainer(that).find(searchControls);
1990
+ }
1991
+ function hideUnusedSelectOptions(selectControl, uniqueValues) {
1992
+ var options = getOptionsFromSelectControl(selectControl);
1678
1993
 
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
- }
1994
+ for (var i = 0; i < options.length; i++) {
1995
+ if (options[i].value !== '') {
1996
+ if (!uniqueValues.hasOwnProperty(options[i].value)) {
1997
+ selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
1998
+ } else {
1999
+ selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
1700
2000
  }
1701
2001
  }
1702
- },
1703
- addOptionToSelectControl: function addOptionToSelectControl(selectControl, _value, text, selected) {
1704
- var value = $.trim(_value);
1705
- var $selectControl = $(selectControl.get(selectControl.length - 1));
2002
+ }
2003
+ }
2004
+ function existOptionInSelectControl(selectControl, value) {
2005
+ var options = getOptionsFromSelectControl(selectControl);
1706
2006
 
1707
- if (!UtilsFilterControl.existOptionInSelectControl(selectControl, value)) {
1708
- var option = $($('<option></option>').attr('value', value).text($('<div />').html(text).text()));
2007
+ for (var i = 0; i < options.length; i++) {
2008
+ if (options[i].value === value.toString()) {
2009
+ // The value is not valid to add
2010
+ return true;
2011
+ }
2012
+ } // If we get here, the value is valid to add
1709
2013
 
1710
- if (value === selected) {
1711
- option.attr('selected', true);
1712
- }
1713
2014
 
1714
- $selectControl.append(option);
2015
+ return false;
2016
+ }
2017
+ function addOptionToSelectControl(selectControl, _value, text, selected) {
2018
+ var value = _value === undefined || _value === null ? '' : _value.toString().trim();
2019
+ var $selectControl = $(selectControl.get(selectControl.length - 1));
2020
+
2021
+ if (!existOptionInSelectControl(selectControl, value)) {
2022
+ var option = $("<option value=\"".concat(value, "\">").concat(text, "</option>"));
2023
+
2024
+ if (value === selected) {
2025
+ option.attr('selected', true);
1715
2026
  }
1716
- },
1717
- sortSelectControl: function sortSelectControl(selectControl, orderBy) {
1718
- var $selectControl = $(selectControl.get(selectControl.length - 1));
1719
- var $opts = $selectControl.find('option:gt(0)');
2027
+
2028
+ $selectControl.append(option);
2029
+ }
2030
+ }
2031
+ function sortSelectControl(selectControl, orderBy) {
2032
+ var $selectControl = $(selectControl.get(selectControl.length - 1));
2033
+ var $opts = $selectControl.find('option:gt(0)');
2034
+
2035
+ if (orderBy !== 'server') {
1720
2036
  $opts.sort(function (a, b) {
1721
2037
  return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1);
1722
2038
  });
1723
- $selectControl.find('option:gt(0)').remove();
1724
- $selectControl.append($opts);
1725
- },
1726
- existOptionInSelectControl: function existOptionInSelectControl(selectControl, value) {
1727
- var options = UtilsFilterControl.getOptionsFromSelectControl(selectControl);
2039
+ }
1728
2040
 
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;
2041
+ $selectControl.find('option:gt(0)').remove();
2042
+ $selectControl.append($opts);
2043
+ }
2044
+ function fixHeaderCSS(_ref) {
2045
+ var $tableHeader = _ref.$tableHeader;
2046
+ $tableHeader.css('height', '89px');
2047
+ }
2048
+ function getElementClass($element) {
2049
+ return $element.attr('class').replace('form-control', '').replace('focus-temp', '').replace('search-input', '').trim();
2050
+ }
2051
+ function getCursorPosition(el) {
2052
+ if (Utils.isIEBrowser()) {
2053
+ if ($(el).is('input[type=text]')) {
2054
+ var pos = 0;
2055
+
2056
+ if ('selectionStart' in el) {
2057
+ pos = el.selectionStart;
2058
+ } else if ('selection' in document) {
2059
+ el.focus();
2060
+ var Sel = document.selection.createRange();
2061
+ var SelLength = document.selection.createRange().text.length;
2062
+ Sel.moveStart('character', -el.value.length);
2063
+ pos = Sel.text.length - SelLength;
1733
2064
  }
1734
- } // If we get here, the value is valid to add
1735
-
1736
2065
 
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;
2066
+ return pos;
1751
2067
  }
1752
2068
 
1753
- return header;
1754
- },
1755
- getCurrentSearchControls: function getCurrentSearchControls(_ref3) {
1756
- var options = _ref3.options;
1757
- var searchControls = 'select, input';
2069
+ return -1;
2070
+ }
1758
2071
 
1759
- if (options.height) {
1760
- searchControls = 'table select, table input';
2072
+ return -1;
2073
+ }
2074
+ function setCursorPosition(el) {
2075
+ $(el).val(el.value);
2076
+ }
2077
+ function copyValues(that) {
2078
+ var searchControls = getSearchControls(that);
2079
+ that.options.valuesFilterControl = [];
2080
+ searchControls.each(function () {
2081
+ var $field = $(this);
2082
+
2083
+ if (that.options.height) {
2084
+ var fieldClass = getElementClass($field);
2085
+ $field = $(".fixed-table-header .".concat(fieldClass));
1761
2086
  }
1762
2087
 
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;
2088
+ that.options.valuesFilterControl.push({
2089
+ field: $field.closest('[data-field]').data('field'),
2090
+ value: $field.val(),
2091
+ position: getCursorPosition($field.get(0)),
2092
+ hasFocus: $field.is(':focus')
2093
+ });
2094
+ });
2095
+ }
2096
+ function setValues(that) {
2097
+ var field = null;
2098
+ var result = [];
2099
+ var searchControls = getSearchControls(that);
2100
+
2101
+ if (that.options.valuesFilterControl.length > 0) {
2102
+ // Callback to apply after settings fields values
2103
+ var fieldToFocusCallback = null;
2104
+ searchControls.each(function (index, ele) {
2105
+ var $this = $(this);
2106
+ field = $this.closest('[data-field]').data('field');
2107
+ result = that.options.valuesFilterControl.filter(function (valueObj) {
2108
+ return valueObj.field === field;
2109
+ });
2110
+
2111
+ if (result.length > 0) {
2112
+ if ($this.is('[type=radio]')) {
2113
+ return;
1778
2114
  }
1779
2115
 
1780
- return pos;
2116
+ $this.val(result[0].value);
2117
+
2118
+ if (result[0].hasFocus && result[0].value !== '') {
2119
+ // set callback if the field had the focus.
2120
+ fieldToFocusCallback = function (fieldToFocus, carretPosition) {
2121
+ // Closure here to capture the field and cursor position
2122
+ var closedCallback = function closedCallback() {
2123
+ fieldToFocus.focus();
2124
+ setCursorPosition(fieldToFocus);
2125
+ };
2126
+
2127
+ return closedCallback;
2128
+ }($this.get(0), result[0].position);
2129
+ }
1781
2130
  }
2131
+ }); // Callback call.
1782
2132
 
1783
- return -1;
2133
+ if (fieldToFocusCallback !== null) {
2134
+ fieldToFocusCallback();
1784
2135
  }
2136
+ }
2137
+ }
2138
+ function collectBootstrapCookies() {
2139
+ var cookies = [];
2140
+ var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
2141
+ var foundLocalStorage = localStorage;
1785
2142
 
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
- });
2143
+ if (foundCookies) {
2144
+ $.each(foundCookies, function (i, _cookie) {
2145
+ var cookie = _cookie;
2146
+
2147
+ if (/./.test(cookie)) {
2148
+ cookie = cookie.split('.').pop();
2149
+ }
1818
2150
 
1819
- if (result.length > 0) {
1820
- $(this).val(result[0].value);
2151
+ if ($.inArray(cookie, cookies) === -1) {
2152
+ cookies.push(cookie);
2153
+ }
2154
+ });
2155
+ }
1821
2156
 
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
- };
2157
+ if (foundLocalStorage) {
2158
+ for (var i = 0; i < foundLocalStorage.length; i++) {
2159
+ var cookie = foundLocalStorage.key(i);
1830
2160
 
1831
- return closedCallback;
1832
- }($(this).get(0), result[0].position);
1833
- }
1834
- }
1835
- }); // Callback call.
2161
+ if (/./.test(cookie)) {
2162
+ cookie = cookie.split('.').pop();
2163
+ }
1836
2164
 
1837
- if (fieldToFocusCallback !== null) {
1838
- fieldToFocusCallback();
2165
+ if (!cookies.includes(cookie)) {
2166
+ cookies.push(cookie);
1839
2167
  }
1840
2168
  }
1841
- },
1842
- collectBootstrapCookies: function collectBootstrapCookies() {
1843
- var cookies = [];
1844
- var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
2169
+ }
2170
+
2171
+ return cookies;
2172
+ }
2173
+ function escapeID(id) {
2174
+ // eslint-disable-next-line no-useless-escape
2175
+ return String(id).replace(/([:.\[\],])/g, '\\$1');
2176
+ }
2177
+ function isColumnSearchableViaSelect(_ref2) {
2178
+ var filterControl = _ref2.filterControl,
2179
+ searchable = _ref2.searchable;
2180
+ return filterControl && filterControl.toLowerCase() === 'select' && searchable;
2181
+ }
2182
+ function isFilterDataNotGiven(_ref3) {
2183
+ var filterData = _ref3.filterData;
2184
+ return filterData === undefined || filterData.toLowerCase() === 'column';
2185
+ }
2186
+ function hasSelectControlElement(selectControl) {
2187
+ return selectControl && selectControl.length > 0;
2188
+ }
2189
+ function initFilterSelectControls(that) {
2190
+ var data = that.data;
2191
+ var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
2192
+ $.each(that.header.fields, function (j, field) {
2193
+ var column = that.columns[that.fieldsColumnsIndex[field]];
2194
+ var selectControl = getControlContainer(that).find("select.bootstrap-table-filter-control-".concat(escapeID(column.field)));
2195
+
2196
+ if (isColumnSearchableViaSelect(column) && isFilterDataNotGiven(column) && hasSelectControlElement(selectControl)) {
2197
+ if (selectControl.get(selectControl.length - 1).options.length === 0) {
2198
+ // Added the default option
2199
+ addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
2200
+ }
1845
2201
 
1846
- if (foundCookies) {
1847
- $.each(foundCookies, function (i, _cookie) {
1848
- var cookie = _cookie;
2202
+ var uniqueValues = {};
1849
2203
 
1850
- if (/./.test(cookie)) {
1851
- cookie = cookie.split('.').pop();
2204
+ for (var i = 0; i < z; i++) {
2205
+ // Added a new value
2206
+ var fieldValue = data[i][field];
2207
+ var formatter = that.options.editable && column.editable ? column._formatter : that.header.formatters[j];
2208
+ var formattedValue = Utils.calculateObjectValue(that.header, formatter, [fieldValue, data[i], i], fieldValue);
2209
+
2210
+ if (column.filterDataCollector) {
2211
+ formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
1852
2212
  }
1853
2213
 
1854
- if ($.inArray(cookie, cookies) === -1) {
1855
- cookies.push(cookie);
2214
+ if (column.searchFormatter) {
2215
+ fieldValue = formattedValue;
1856
2216
  }
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 = that.$tableBody.find(".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);
2217
+
2218
+ uniqueValues[formattedValue] = fieldValue;
2219
+
2220
+ if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
2221
+ formattedValue.forEach(function (value) {
2222
+ addOptionToSelectControl(selectControl, value, value, column.filterDefault);
2223
+ });
2224
+ continue;
1888
2225
  }
1889
2226
 
1890
- var uniqueValues = {};
2227
+ for (var key in uniqueValues) {
2228
+ addOptionToSelectControl(selectControl, uniqueValues[key], key, column.filterDefault);
2229
+ }
2230
+ }
1891
2231
 
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);
2232
+ sortSelectControl(selectControl, column.filterOrderBy);
1896
2233
 
1897
- if (column.filterDataCollector) {
1898
- formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
1899
- }
2234
+ if (that.options.hideUnusedSelectOptions) {
2235
+ hideUnusedSelectOptions(selectControl, uniqueValues);
2236
+ }
2237
+ }
2238
+ });
2239
+ }
2240
+ function getFilterDataMethod(objFilterDataMethod, searchTerm) {
2241
+ var keys = Object.keys(objFilterDataMethod);
1900
2242
 
1901
- if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
1902
- formattedValue.forEach(function (value) {
1903
- UtilsFilterControl.addOptionToSelectControl(selectControl, value, value, column.filterDefault);
1904
- });
1905
- continue;
1906
- }
2243
+ for (var i = 0; i < keys.length; i++) {
2244
+ if (keys[i] === searchTerm) {
2245
+ return objFilterDataMethod[searchTerm];
2246
+ }
2247
+ }
1907
2248
 
1908
- UtilsFilterControl.addOptionToSelectControl(selectControl, formattedValue, formattedValue, column.filterDefault);
1909
- }
2249
+ return null;
2250
+ }
2251
+ function createControls(that, header) {
2252
+ var addedFilterControl = false;
2253
+ var html;
2254
+ $.each(that.columns, function (_, column) {
2255
+ html = [];
2256
+
2257
+ if (!column.visible) {
2258
+ return;
2259
+ }
1910
2260
 
1911
- UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2261
+ if (!column.filterControl && !that.options.filterControlContainer) {
2262
+ html.push('<div class="no-filter-control"></div>');
2263
+ } else if (that.options.filterControlContainer) {
2264
+ var $filterControls = $(".bootstrap-table-filter-control-".concat(column.field));
2265
+ $.each($filterControls, function (_, filterControl) {
2266
+ var $filterControl = $(filterControl);
1912
2267
 
1913
- if (that.options.hideUnusedSelectOptions) {
1914
- UtilsFilterControl.hideUnusedSelectOptions(selectControl, uniqueValues);
2268
+ if (!$filterControl.is('[type=radio]')) {
2269
+ var placeholder = column.filterControlPlaceholder ? column.filterControlPlaceholder : '';
2270
+ $filterControl.attr('placeholder', placeholder).val(column.filterDefault);
1915
2271
  }
1916
- }
1917
- });
1918
- that.trigger('created-controls');
1919
- },
1920
- getFilterDataMethod: function getFilterDataMethod(objFilterDataMethod, searchTerm) {
1921
- var keys = Object.keys(objFilterDataMethod);
1922
2272
 
1923
- for (var i = 0; i < keys.length; i++) {
1924
- if (keys[i] === searchTerm) {
1925
- return objFilterDataMethod[searchTerm];
2273
+ $filterControl.attr('data-field', column.field);
2274
+ });
2275
+ addedFilterControl = true;
2276
+ } else {
2277
+ var nameControl = column.filterControl.toLowerCase();
2278
+ html.push('<div class="filter-control">');
2279
+ addedFilterControl = true;
2280
+
2281
+ if (column.searchable && that.options.filterTemplate[nameControl]) {
2282
+ html.push(that.options.filterTemplate[nameControl](that, column.field, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
1926
2283
  }
1927
2284
  }
1928
2285
 
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;
2286
+ if (!column.filterControl && '' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
2287
+ if ($.isEmptyObject(that.filterColumnsPartial)) {
2288
+ that.filterColumnsPartial = {};
1941
2289
  }
1942
2290
 
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));
2291
+ that.filterColumnsPartial[column.field] = column.filterDefault;
2292
+ }
1953
2293
 
1954
- if ('' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
1955
- if ($.isEmptyObject(that.filterColumnsPartial)) {
1956
- that.filterColumnsPartial = {};
1957
- }
2294
+ $.each(header.find('th'), function (i, th) {
2295
+ var $th = $(th);
1958
2296
 
1959
- that.filterColumnsPartial[column.field] = column.filterDefault;
1960
- }
1961
- }
2297
+ if ($th.data('field') === column.field) {
2298
+ $th.find('.fht-cell').append(html.join(''));
2299
+ return false;
1962
2300
  }
2301
+ });
1963
2302
 
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
- });
2303
+ if (column.filterData && column.filterData.toLowerCase() !== 'column') {
2304
+ var filterDataType = getFilterDataMethod(
2305
+ /* eslint-disable no-use-before-define */
2306
+ filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
2307
+ var filterDataSource;
2308
+ var selectControl;
2309
+
2310
+ if (filterDataType) {
2311
+ filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
2312
+ selectControl = header.find(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
2313
+ addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
2314
+ filterDataType(filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault);
2315
+ } else {
2316
+ 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"}');
2317
+ }
2318
+ }
2319
+ });
1972
2320
 
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 = that.$tableBody.find(".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
- }
2321
+ if (addedFilterControl) {
2322
+ header.off('keyup', 'input').on('keyup', 'input', function (_ref4, obj) {
2323
+ var currentTarget = _ref4.currentTarget,
2324
+ keyCode = _ref4.keyCode;
2325
+ syncControls(that); // Simulate enter key action from clear button
1988
2326
 
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
- }
2327
+ keyCode = obj ? obj.keyCode : keyCode;
2002
2328
 
2003
- UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2004
- }
2005
- });
2006
- break;
2329
+ if (that.options.searchOnEnterKey && keyCode !== 13) {
2330
+ return;
2331
+ }
2007
2332
 
2008
- case 'var':
2009
- variableValues = window[filterDataSource]; // eslint-disable-next-line guard-for-in
2333
+ if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
2334
+ return;
2335
+ }
2010
2336
 
2011
- for (key in variableValues) {
2012
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], column.filterDefault);
2013
- }
2337
+ var $currentTarget = $(currentTarget);
2014
2338
 
2015
- UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2016
- break;
2339
+ if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
2340
+ return;
2341
+ }
2017
2342
 
2018
- case 'jso':
2019
- variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
2343
+ clearTimeout(currentTarget.timeoutId || 0);
2344
+ currentTarget.timeoutId = setTimeout(function () {
2345
+ that.onColumnSearch({
2346
+ currentTarget: currentTarget,
2347
+ keyCode: keyCode
2348
+ });
2349
+ }, that.options.searchTimeOut);
2350
+ });
2351
+ header.off('change', 'select:not(".ms-offscreen")').on('change', 'select:not(".ms-offscreen")', function (_ref5) {
2352
+ var currentTarget = _ref5.currentTarget,
2353
+ keyCode = _ref5.keyCode;
2354
+ syncControls(that);
2355
+ var $select = $(currentTarget);
2356
+ var value = $select.val();
2357
+
2358
+ if (value && value.length > 0 && value.trim()) {
2359
+ $select.find('option[selected]').removeAttr('selected');
2360
+ $select.find('option[value="' + value + '"]').attr('selected', true);
2361
+ } else {
2362
+ $select.find('option[selected]').removeAttr('selected');
2363
+ }
2020
2364
 
2021
- for (key in variableValues) {
2022
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], column.filterDefault);
2023
- }
2365
+ clearTimeout(currentTarget.timeoutId || 0);
2366
+ currentTarget.timeoutId = setTimeout(function () {
2367
+ that.onColumnSearch({
2368
+ currentTarget: currentTarget,
2369
+ keyCode: keyCode
2370
+ });
2371
+ }, that.options.searchTimeOut);
2372
+ });
2373
+ header.off('mouseup', 'input:not([type=radio])').on('mouseup', 'input:not([type=radio])', function (_ref6) {
2374
+ var currentTarget = _ref6.currentTarget,
2375
+ keyCode = _ref6.keyCode;
2376
+ var $input = $(currentTarget);
2377
+ var oldValue = $input.val();
2024
2378
 
2025
- UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2026
- break;
2027
- }
2379
+ if (oldValue === '') {
2380
+ return;
2028
2381
  }
2029
- });
2030
2382
 
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;
2383
+ setTimeout(function () {
2384
+ syncControls(that);
2385
+ var newValue = $input.val();
2035
2386
 
2036
- if (that.options.searchOnEnterKey && event.keyCode !== 13) {
2037
- return;
2387
+ if (newValue === '') {
2388
+ clearTimeout(currentTarget.timeoutId || 0);
2389
+ currentTarget.timeoutId = setTimeout(function () {
2390
+ that.onColumnSearch({
2391
+ currentTarget: currentTarget,
2392
+ keyCode: keyCode
2393
+ });
2394
+ }, that.options.searchTimeOut);
2038
2395
  }
2396
+ }, 1);
2397
+ });
2398
+ header.off('change', 'input[type=radio]').on('change', 'input[type=radio]', function (_ref7) {
2399
+ var currentTarget = _ref7.currentTarget,
2400
+ keyCode = _ref7.keyCode;
2401
+ clearTimeout(currentTarget.timeoutId || 0);
2402
+ currentTarget.timeoutId = setTimeout(function () {
2403
+ syncControls(that);
2404
+ that.onColumnSearch({
2405
+ currentTarget: currentTarget,
2406
+ keyCode: keyCode
2407
+ });
2408
+ }, that.options.searchTimeOut);
2409
+ });
2039
2410
 
2040
- if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
2041
- return;
2411
+ if (header.find('.date-filter-control').length > 0) {
2412
+ $.each(that.columns, function (i, _ref8) {
2413
+ var filterControl = _ref8.filterControl,
2414
+ field = _ref8.field,
2415
+ filterDatepickerOptions = _ref8.filterDatepickerOptions;
2416
+
2417
+ if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
2418
+ header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field)).datepicker(filterDatepickerOptions).on('changeDate', function (_ref9) {
2419
+ var currentTarget = _ref9.currentTarget,
2420
+ keyCode = _ref9.keyCode;
2421
+ clearTimeout(currentTarget.timeoutId || 0);
2422
+ currentTarget.timeoutId = setTimeout(function () {
2423
+ syncControls(that);
2424
+ that.onColumnSearch({
2425
+ currentTarget: currentTarget,
2426
+ keyCode: keyCode
2427
+ });
2428
+ }, that.options.searchTimeOut);
2429
+ });
2042
2430
  }
2431
+ });
2432
+ }
2043
2433
 
2044
- var $currentTarget = $(event.currentTarget);
2045
-
2046
- if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
2047
- return;
2048
- }
2434
+ if (that.options.sidePagination !== 'server' && !that.options.height) {
2435
+ that.triggerSearch();
2436
+ }
2049
2437
 
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
- }
2438
+ if (!that.options.filterControlVisible) {
2439
+ header.find('.filter-control, .no-filter-control').hide();
2440
+ }
2441
+ } else {
2442
+ header.find('.filter-control, .no-filter-control').hide();
2443
+ }
2059
2444
 
2060
- if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
2061
- return;
2062
- }
2445
+ that.trigger('created-controls');
2446
+ }
2447
+ function getDirectionOfSelectOptions(_alignment) {
2448
+ var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
2063
2449
 
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();
2450
+ switch (alignment) {
2451
+ case 'left':
2452
+ return 'ltr';
2072
2453
 
2073
- if (oldValue === '') {
2074
- return;
2075
- }
2454
+ case 'right':
2455
+ return 'rtl';
2076
2456
 
2077
- setTimeout(function () {
2078
- var newValue = $input.val();
2457
+ case 'auto':
2458
+ return 'auto';
2079
2459
 
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);
2460
+ default:
2461
+ return 'ltr';
2462
+ }
2463
+ }
2464
+ function syncControls(that) {
2465
+ if (that.options.height) {
2466
+ var controlsTableHeader = that.$tableHeader.find(searchControls);
2467
+ that.$header.find(searchControls).each(function (_, control) {
2468
+ var $control = $(control);
2469
+ var controlClass = getElementClass($control);
2470
+ var foundControl = controlsTableHeader.filter(function (_, ele) {
2471
+ var eleClass = getElementClass($(ele));
2472
+ return controlClass === eleClass;
2087
2473
  });
2088
2474
 
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
- });
2475
+ if (foundControl.length === 0) {
2476
+ return;
2104
2477
  }
2105
2478
 
2106
- if (that.options.sidePagination !== 'server') {
2107
- header.find('[class*=\'bootstrap-table-filter-control\']').each(function (k, input) {
2108
- $(input).trigger('change');
2109
- });
2479
+ if ($control.is('select')) {
2480
+ $control.find('option:selected').removeAttr('selected');
2481
+ $control.find("option[value='".concat(foundControl.val(), "']")).attr('selected', true);
2482
+ } else {
2483
+ $control.val(foundControl.val());
2110
2484
  }
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';
2485
+ });
2486
+ }
2487
+ }
2488
+ var filterDataMethods = {
2489
+ func: function func(filterDataSource, selectControl, filterOrderBy, selected) {
2490
+ var variableValues = window[filterDataSource].apply();
2121
2491
 
2122
- case 'right':
2123
- return 'rtl';
2492
+ for (var key in variableValues) {
2493
+ addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2494
+ }
2124
2495
 
2125
- case 'auto':
2126
- return 'auto';
2496
+ sortSelectControl(selectControl, filterOrderBy);
2497
+ },
2498
+ obj: function obj(filterDataSource, selectControl, filterOrderBy, selected) {
2499
+ var objectKeys = filterDataSource.split('.');
2500
+ var variableName = objectKeys.shift();
2501
+ var variableValues = window[variableName];
2502
+
2503
+ if (objectKeys.length > 0) {
2504
+ objectKeys.forEach(function (key) {
2505
+ variableValues = variableValues[key];
2506
+ });
2507
+ }
2127
2508
 
2128
- default:
2129
- return 'ltr';
2509
+ for (var key in variableValues) {
2510
+ addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2130
2511
  }
2131
- }
2132
- };
2133
- var filterDataMethods = {
2512
+
2513
+ sortSelectControl(selectControl, filterOrderBy);
2514
+ },
2134
2515
  var: function _var(filterDataSource, selectControl, filterOrderBy, selected) {
2135
- var variableValues = window[filterDataSource]; // eslint-disable-next-line guard-for-in
2516
+ var variableValues = window[filterDataSource];
2517
+ var isArray = Array.isArray(variableValues);
2136
2518
 
2137
2519
  for (var key in variableValues) {
2138
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2520
+ if (isArray) {
2521
+ addOptionToSelectControl(selectControl, variableValues[key], variableValues[key], selected);
2522
+ } else {
2523
+ addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2524
+ }
2139
2525
  }
2140
2526
 
2141
- UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
2527
+ sortSelectControl(selectControl, filterOrderBy);
2142
2528
  },
2143
2529
  url: function url(filterDataSource, selectControl, filterOrderBy, selected) {
2144
2530
  $.ajax({
2145
2531
  url: filterDataSource,
2146
2532
  dataType: 'json',
2147
2533
  success: function success(data) {
2148
- // eslint-disable-next-line guard-for-in
2149
2534
  for (var key in data) {
2150
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, data[key], selected);
2535
+ addOptionToSelectControl(selectControl, key, data[key], selected);
2151
2536
  }
2152
2537
 
2153
- UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
2538
+ sortSelectControl(selectControl, filterOrderBy);
2154
2539
  }
2155
2540
  });
2156
2541
  },
2157
2542
  json: function json(filterDataSource, selectControl, filterOrderBy, selected) {
2158
- var variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
2543
+ var variableValues = JSON.parse(filterDataSource);
2159
2544
 
2160
2545
  for (var key in variableValues) {
2161
- UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2546
+ addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2162
2547
  }
2163
2548
 
2164
- UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
2549
+ sortSelectControl(selectControl, filterOrderBy);
2165
2550
  }
2166
2551
  };
2552
+
2553
+ var Utils$1 = $.fn.bootstrapTable.utils;
2167
2554
  $.extend($.fn.bootstrapTable.defaults, {
2168
2555
  filterControl: false,
2556
+ filterControlVisible: true,
2169
2557
  onColumnSearch: function onColumnSearch(field, text) {
2170
2558
  return false;
2171
2559
  },
2172
2560
  onCreatedControls: function onCreatedControls() {
2173
- return true;
2561
+ return false;
2174
2562
  },
2175
2563
  alignmentSelectControlOptions: undefined,
2176
2564
  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);
2565
+ input: function input(that, field, placeholder, value) {
2566
+ return Utils$1.sprintf('<input type="search" 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
2567
  },
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));
2568
+ select: function select(_ref, field) {
2569
+ var options = _ref.options;
2570
+ return Utils$1.sprintf('<select class="form-control bootstrap-table-filter-control-%s" style="width: 100%;" dir="%s"></select>', field, getDirectionOfSelectOptions(options.alignmentSelectControlOptions));
2183
2571
  },
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);
2572
+ datepicker: function datepicker(that, field, value) {
2573
+ 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
2574
  }
2187
2575
  },
2188
2576
  disableControlWhenSearch: false,
2189
2577
  searchOnEnterKey: false,
2578
+ showFilterControlSwitch: false,
2190
2579
  // internal variables
2191
2580
  valuesFilterControl: []
2192
2581
  });
2193
2582
  $.extend($.fn.bootstrapTable.columnDefaults, {
2194
2583
  filterControl: undefined,
2584
+ // input, select, datepicker
2195
2585
  filterDataCollector: undefined,
2196
2586
  filterData: undefined,
2197
2587
  filterDatepickerOptions: undefined,
@@ -2209,7 +2599,26 @@
2209
2599
  $.extend($.fn.bootstrapTable.defaults.icons, {
2210
2600
  clear: {
2211
2601
  bootstrap3: 'glyphicon-trash icon-clear'
2212
- }[$.fn.bootstrapTable.theme] || 'fa-trash'
2602
+ }[$.fn.bootstrapTable.theme] || 'fa-trash',
2603
+ filterControlSwitchHide: {
2604
+ bootstrap3: 'glyphicon-zoom-out icon-zoom-out',
2605
+ materialize: 'zoom_out'
2606
+ }[$.fn.bootstrapTable.theme] || 'fa-search-minus',
2607
+ filterControlSwitchShow: {
2608
+ bootstrap3: 'glyphicon-zoom-in icon-zoom-in',
2609
+ materialize: 'zoom_in'
2610
+ }[$.fn.bootstrapTable.theme] || 'fa-search-plus'
2611
+ });
2612
+ $.extend($.fn.bootstrapTable.locales, {
2613
+ formatFilterControlSwitch: function formatFilterControlSwitch() {
2614
+ return 'Hide/Show controls';
2615
+ },
2616
+ formatFilterControlSwitchHide: function formatFilterControlSwitchHide() {
2617
+ return 'Hide controls';
2618
+ },
2619
+ formatFilterControlSwitchShow: function formatFilterControlSwitchShow() {
2620
+ return 'Show controls';
2621
+ }
2213
2622
  });
2214
2623
  $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
2215
2624
  $.extend($.fn.bootstrapTable.defaults, {
@@ -2219,6 +2628,7 @@
2219
2628
  });
2220
2629
  $.fn.bootstrapTable.methods.push('triggerSearch');
2221
2630
  $.fn.bootstrapTable.methods.push('clearFilterControl');
2631
+ $.fn.bootstrapTable.methods.push('toggleFilterControl');
2222
2632
 
2223
2633
  $.BootstrapTable =
2224
2634
  /*#__PURE__*/
@@ -2238,35 +2648,36 @@
2238
2648
 
2239
2649
  // Make sure that the filterControl option is set
2240
2650
  if (this.options.filterControl) {
2241
- var that = this; // Make sure that the internal variables are set correctly
2242
-
2651
+ // Make sure that the internal variables are set correctly
2243
2652
  this.options.valuesFilterControl = [];
2244
2653
  this.$el.on('reset-view.bs.table', function () {
2245
2654
  // Create controls on $tableHeader if the height is set
2246
- if (!that.options.height) {
2655
+ if (!_this.options.height) {
2247
2656
  return;
2248
2657
  } // Avoid recreate the controls
2249
2658
 
2250
2659
 
2251
- if (that.$tableHeader.find('select').length > 0 || that.$tableHeader.find('input').length > 0) {
2660
+ var $controlContainer = getControlContainer(_this);
2661
+
2662
+ if ($controlContainer.find('select').length > 0 || $controlContainer.find('input:not([type="checkbox"]):not([type="radio"])').length > 0) {
2252
2663
  return;
2253
2664
  }
2254
2665
 
2255
- UtilsFilterControl.createControls(that, that.$tableHeader);
2666
+ createControls(_this, $controlContainer);
2256
2667
  }).on('post-header.bs.table', function () {
2257
- UtilsFilterControl.setValues(that);
2668
+ setValues(_this);
2258
2669
  }).on('post-body.bs.table', function () {
2259
- if (that.options.height) {
2260
- UtilsFilterControl.fixHeaderCSS(that);
2670
+ if (_this.options.height && !_this.options.filterControlContainer) {
2671
+ fixHeaderCSS(_this);
2261
2672
  }
2262
2673
 
2263
2674
  _this.$tableLoading.css('top', _this.$header.outerHeight() + 1);
2264
2675
  }).on('column-switch.bs.table', function () {
2265
- UtilsFilterControl.setValues(that);
2676
+ setValues(_this);
2266
2677
  }).on('load-success.bs.table', function () {
2267
- that.EnableControls(true);
2678
+ _this.enableControls(true);
2268
2679
  }).on('load-error.bs.table', function () {
2269
- that.EnableControls(true);
2680
+ _this.enableControls(true);
2270
2681
  });
2271
2682
  }
2272
2683
 
@@ -2277,80 +2688,154 @@
2277
2688
  value: function initHeader() {
2278
2689
  _get(_getPrototypeOf(_class.prototype), "initHeader", this).call(this);
2279
2690
 
2280
- if (!this.options.filterControl) {
2691
+ if (!this.options.filterControl || this.options.height) {
2281
2692
  return;
2282
2693
  }
2283
2694
 
2284
- UtilsFilterControl.createControls(this, this.$header);
2695
+ createControls(this, getControlContainer(this));
2285
2696
  }
2286
2697
  }, {
2287
2698
  key: "initBody",
2288
2699
  value: function initBody() {
2289
2700
  _get(_getPrototypeOf(_class.prototype), "initBody", this).call(this);
2290
2701
 
2291
- UtilsFilterControl.initFilterSelectControls(this);
2702
+ syncControls(this);
2703
+ initFilterSelectControls(this);
2292
2704
  }
2293
2705
  }, {
2294
2706
  key: "initSearch",
2295
2707
  value: function initSearch() {
2708
+ var _this2 = this;
2709
+
2296
2710
  var that = this;
2297
2711
  var fp = $.isEmptyObject(that.filterColumnsPartial) ? null : that.filterColumnsPartial;
2298
2712
 
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
- }
2713
+ _get(_getPrototypeOf(_class.prototype), "initSearch", this).call(this);
2306
2714
 
2307
- if (fp === null) {
2715
+ if (this.options.sidePagination === 'server' || fp === null) {
2308
2716
  return;
2309
2717
  } // Check partial column filter
2310
2718
 
2311
2719
 
2312
- that.data = fp ? that.options.data.filter(function (item, i) {
2720
+ that.data = fp ? that.data.filter(function (item, i) {
2313
2721
  var itemIsExpected = [];
2314
- Object.keys(item).forEach(function (x, index) {
2315
- var key = that.header.fields[index];
2722
+ var keys1 = Object.keys(item);
2723
+ var keys2 = Object.keys(fp);
2724
+ var keys = keys1.concat(keys2.filter(function (item) {
2725
+ return !keys1.includes(item);
2726
+ }));
2727
+ keys.forEach(function (key) {
2316
2728
  var thisColumn = that.columns[that.fieldsColumnsIndex[key]];
2317
2729
  var fval = (fp[key] || '').toLowerCase();
2318
- var value = Utils.getItemField(item, key, false);
2730
+ var value = Utils$1.getItemField(item, key, false);
2731
+ var tmpItemIsExpected;
2319
2732
 
2320
2733
  if (fval === '') {
2321
- itemIsExpected.push(true);
2734
+ tmpItemIsExpected = true;
2322
2735
  } else {
2323
- // Fix #142: search use formated data
2736
+ // Fix #142: search use formatted data
2324
2737
  if (thisColumn && thisColumn.searchFormatter) {
2325
2738
  value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(key, that.header.fields)], [value, item, i], value);
2326
2739
  }
2327
2740
 
2328
2741
  if ($.inArray(key, that.header.fields) !== -1) {
2329
2742
  if (value === undefined || value === null) {
2330
- itemIsExpected.push(false);
2743
+ tmpItemIsExpected = false;
2744
+ } else if (_typeof(value) === 'object') {
2745
+ value.forEach(function (objectValue) {
2746
+ if (tmpItemIsExpected) {
2747
+ return;
2748
+ }
2749
+
2750
+ if (_this2.options.searchAccentNeutralise) {
2751
+ objectValue = Utils$1.normalizeAccent(objectValue);
2752
+ }
2753
+
2754
+ tmpItemIsExpected = that.isValueExpected(fval, objectValue, thisColumn, key);
2755
+ });
2331
2756
  } 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));
2757
+ if (_this2.options.searchAccentNeutralise) {
2758
+ value = Utils$1.normalizeAccent(value);
2338
2759
  }
2760
+
2761
+ tmpItemIsExpected = that.isValueExpected(fval, value, thisColumn, key);
2339
2762
  }
2340
2763
  }
2341
2764
  }
2765
+
2766
+ itemIsExpected.push(tmpItemIsExpected);
2342
2767
  });
2343
2768
  return !itemIsExpected.includes(false);
2344
2769
  }) : that.data;
2770
+ that.unsortedData = _toConsumableArray(that.data);
2771
+ }
2772
+ }, {
2773
+ key: "isValueExpected",
2774
+ value: function isValueExpected(searchValue, value, column, key) {
2775
+ var tmpItemIsExpected = false;
2776
+
2777
+ if (column.filterStrictSearch) {
2778
+ tmpItemIsExpected = value.toString().toLowerCase() === searchValue.toString().toLowerCase();
2779
+ } else if (column.filterStartsWithSearch) {
2780
+ tmpItemIsExpected = "".concat(value).toLowerCase().indexOf(searchValue) === 0;
2781
+ } else {
2782
+ tmpItemIsExpected = "".concat(value).toLowerCase().includes(searchValue);
2783
+ }
2784
+
2785
+ var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
2786
+ var matches = largerSmallerEqualsRegex.exec(searchValue);
2787
+
2788
+ if (matches) {
2789
+ var operator = matches[1] || "".concat(matches[5], "l");
2790
+ var comparisonValue = matches[2] || matches[3];
2791
+ var int = parseInt(value, 10);
2792
+ var comparisonInt = parseInt(comparisonValue, 10);
2793
+
2794
+ switch (operator) {
2795
+ case '>':
2796
+ case '<l':
2797
+ tmpItemIsExpected = int > comparisonInt;
2798
+ break;
2799
+
2800
+ case '<':
2801
+ case '>l':
2802
+ tmpItemIsExpected = int < comparisonInt;
2803
+ break;
2804
+
2805
+ case '<=':
2806
+ case '=<':
2807
+ case '>=l':
2808
+ case '=>l':
2809
+ tmpItemIsExpected = int <= comparisonInt;
2810
+ break;
2811
+
2812
+ case '>=':
2813
+ case '=>':
2814
+ case '<=l':
2815
+ case '=<l':
2816
+ tmpItemIsExpected = int >= comparisonInt;
2817
+ break;
2818
+ }
2819
+ }
2820
+
2821
+ if (column.filterCustomSearch) {
2822
+ var customSearchResult = Utils$1.calculateObjectValue(this, column.filterCustomSearch, [searchValue, value, key, this.options.data], true);
2823
+
2824
+ if (customSearchResult !== null) {
2825
+ tmpItemIsExpected = customSearchResult;
2826
+ }
2827
+ }
2828
+
2829
+ return tmpItemIsExpected;
2345
2830
  }
2346
2831
  }, {
2347
2832
  key: "initColumnSearch",
2348
2833
  value: function initColumnSearch(filterColumnsDefaults) {
2349
- UtilsFilterControl.copyValues(this);
2834
+ copyValues(this);
2350
2835
 
2351
2836
  if (filterColumnsDefaults) {
2352
2837
  this.filterColumnsPartial = filterColumnsDefaults;
2353
- this.updatePagination(); // eslint-disable-next-line guard-for-in
2838
+ this.updatePagination();
2354
2839
 
2355
2840
  for (var filter in filterColumnsDefaults) {
2356
2841
  this.trigger('column-search', filter, filterColumnsDefaults[filter]);
@@ -2359,14 +2844,18 @@
2359
2844
  }
2360
2845
  }, {
2361
2846
  key: "onColumnSearch",
2362
- value: function onColumnSearch(event) {
2363
- if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
2847
+ value: function onColumnSearch(_ref2) {
2848
+ var currentTarget = _ref2.currentTarget,
2849
+ keyCode = _ref2.keyCode;
2850
+
2851
+ if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
2364
2852
  return;
2365
2853
  }
2366
2854
 
2367
- UtilsFilterControl.copyValues(this);
2368
- var text = $.trim($(event.currentTarget).val());
2369
- var $field = $(event.currentTarget).closest('[data-field]').data('field');
2855
+ copyValues(this);
2856
+ var text = $.trim($(currentTarget).val());
2857
+ var $field = $(currentTarget).closest('[data-field]').data('field');
2858
+ this.trigger('column-search', $field, text);
2370
2859
 
2371
2860
  if ($.isEmptyObject(this.filterColumnsPartial)) {
2372
2861
  this.filterColumnsPartial = {};
@@ -2379,36 +2868,51 @@
2379
2868
  }
2380
2869
 
2381
2870
  this.options.pageNumber = 1;
2382
- this.EnableControls(false);
2383
- this.onSearch(event, false);
2384
- this.trigger('column-search', $field, text);
2871
+ this.enableControls(false);
2872
+ this.onSearch({
2873
+ currentTarget: currentTarget
2874
+ }, false);
2385
2875
  }
2386
2876
  }, {
2387
2877
  key: "initToolbar",
2388
2878
  value: function initToolbar() {
2879
+ this.showToolbar = this.showToolbar || this.options.showFilterControlSwitch;
2389
2880
  this.showSearchClearButton = this.options.filterControl && this.options.showSearchClearButton;
2390
2881
 
2882
+ if (this.options.showFilterControlSwitch) {
2883
+ this.buttons = Object.assign(this.buttons, {
2884
+ filterControlSwitch: {
2885
+ 'text': this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow(),
2886
+ 'icon': this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow,
2887
+ 'event': this.toggleFilterControl,
2888
+ 'attributes': {
2889
+ 'aria-label': this.options.formatFilterControlSwitch(),
2890
+ 'title': this.options.formatFilterControlSwitch()
2891
+ }
2892
+ }
2893
+ });
2894
+ }
2895
+
2391
2896
  _get(_getPrototypeOf(_class.prototype), "initToolbar", this).call(this);
2392
2897
  }
2393
2898
  }, {
2394
2899
  key: "resetSearch",
2395
- value: function resetSearch() {
2900
+ value: function resetSearch(text) {
2396
2901
  if (this.options.filterControl && this.options.showSearchClearButton) {
2397
2902
  this.clearFilterControl();
2398
2903
  }
2399
2904
 
2400
- _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this);
2905
+ _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this, text);
2401
2906
  }
2402
2907
  }, {
2403
2908
  key: "clearFilterControl",
2404
2909
  value: function clearFilterControl() {
2405
2910
  if (this.options.filterControl) {
2406
2911
  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));
2411
- var search = that.$toolbar.find('.search input');
2912
+ var cookies = collectBootstrapCookies();
2913
+ var table = this.$el.closest('table');
2914
+ var controls = getSearchControls(that);
2915
+ var search = Utils$1.getSearchInput(this);
2412
2916
  var hasValues = false;
2413
2917
  var timeoutId = 0;
2414
2918
  $.each(that.options.valuesFilterControl, function (i, item) {
@@ -2418,7 +2922,7 @@
2418
2922
  $.each(that.options.filterControls, function (i, item) {
2419
2923
  item.text = '';
2420
2924
  });
2421
- UtilsFilterControl.setValues(that); // clear cookies once the filters are clean
2925
+ setValues(that); // clear cookies once the filters are clean
2422
2926
 
2423
2927
  clearTimeout(timeoutId);
2424
2928
  timeoutId = setTimeout(function () {
@@ -2453,7 +2957,7 @@
2453
2957
 
2454
2958
 
2455
2959
  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')));
2960
+ var sorter = this.$header.find(Utils$1.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')));
2457
2961
 
2458
2962
  if (sorter.length > 0) {
2459
2963
  that.onSort({
@@ -2468,9 +2972,8 @@
2468
2972
  }, {
2469
2973
  key: "triggerSearch",
2470
2974
  value: function triggerSearch() {
2471
- var header = UtilsFilterControl.getCurrentHeader(this);
2472
- var searchControls = UtilsFilterControl.getCurrentSearchControls(this);
2473
- header.find(searchControls).each(function () {
2975
+ var searchControls = getSearchControls(this);
2976
+ searchControls.each(function () {
2474
2977
  var el = $(this);
2475
2978
 
2476
2979
  if (el.is('select')) {
@@ -2481,22 +2984,38 @@
2481
2984
  });
2482
2985
  }
2483
2986
  }, {
2484
- key: "EnableControls",
2485
- value: function EnableControls(enable) {
2987
+ key: "enableControls",
2988
+ value: function enableControls(enable) {
2486
2989
  if (this.options.disableControlWhenSearch && this.options.sidePagination === 'server') {
2487
- var header = UtilsFilterControl.getCurrentHeader(this);
2488
- var searchControls = UtilsFilterControl.getCurrentSearchControls(this);
2990
+ var searchControls = getSearchControls(this);
2489
2991
 
2490
2992
  if (!enable) {
2491
- header.find(searchControls).prop('disabled', 'disabled');
2993
+ searchControls.prop('disabled', 'disabled');
2492
2994
  } else {
2493
- header.find(searchControls).removeProp('disabled');
2995
+ searchControls.removeProp('disabled');
2494
2996
  }
2495
2997
  }
2496
2998
  }
2999
+ }, {
3000
+ key: "toggleFilterControl",
3001
+ value: function toggleFilterControl() {
3002
+ this.options.filterControlVisible = !this.options.filterControlVisible;
3003
+ var $filterControls = getControlContainer(this).find('.filter-control, .no-filter-control');
3004
+
3005
+ if (this.options.filterControlVisible) {
3006
+ $filterControls.show();
3007
+ } else {
3008
+ $filterControls.hide();
3009
+ this.clearFilterControl();
3010
+ }
3011
+
3012
+ var icon = this.options.showButtonIcons ? this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow : '';
3013
+ var text = this.options.showButtonText ? this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow() : '';
3014
+ this.$toolbar.find('>.columns').find('.filter-control-switch').html(Utils$1.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
3015
+ }
2497
3016
  }]);
2498
3017
 
2499
3018
  return _class;
2500
3019
  }($.BootstrapTable);
2501
3020
 
2502
- }));
3021
+ })));