UNPKG

252 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
3 typeof define === 'function' && define.amd ? define(['jquery'], factory) :
4 (global = global || self, global.BootstrapTable = factory(global.jQuery));
5}(this, (function ($) { 'use strict';
6
7 $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
8
9 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
11 function createCommonjsModule(fn, module) {
12 return module = { exports: {} }, fn(module, module.exports), module.exports;
13 }
14
15 var check = function (it) {
16 return it && it.Math == Math && it;
17 };
18
19 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
20 var global_1 =
21 // eslint-disable-next-line no-undef
22 check(typeof globalThis == 'object' && globalThis) ||
23 check(typeof window == 'object' && window) ||
24 check(typeof self == 'object' && self) ||
25 check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
26 // eslint-disable-next-line no-new-func
27 Function('return this')();
28
29 var fails = function (exec) {
30 try {
31 return !!exec();
32 } catch (error) {
33 return true;
34 }
35 };
36
37 // Thank's IE8 for his funny defineProperty
38 var descriptors = !fails(function () {
39 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
40 });
41
42 var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
43 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
44
45 // Nashorn ~ JDK8 bug
46 var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
47
48 // `Object.prototype.propertyIsEnumerable` method implementation
49 // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
50 var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
51 var descriptor = getOwnPropertyDescriptor(this, V);
52 return !!descriptor && descriptor.enumerable;
53 } : nativePropertyIsEnumerable;
54
55 var objectPropertyIsEnumerable = {
56 f: f
57 };
58
59 var createPropertyDescriptor = function (bitmap, value) {
60 return {
61 enumerable: !(bitmap & 1),
62 configurable: !(bitmap & 2),
63 writable: !(bitmap & 4),
64 value: value
65 };
66 };
67
68 var toString = {}.toString;
69
70 var classofRaw = function (it) {
71 return toString.call(it).slice(8, -1);
72 };
73
74 var split = ''.split;
75
76 // fallback for non-array-like ES3 and non-enumerable old V8 strings
77 var indexedObject = fails(function () {
78 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
79 // eslint-disable-next-line no-prototype-builtins
80 return !Object('z').propertyIsEnumerable(0);
81 }) ? function (it) {
82 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
83 } : Object;
84
85 // `RequireObjectCoercible` abstract operation
86 // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
87 var requireObjectCoercible = function (it) {
88 if (it == undefined) throw TypeError("Can't call method on " + it);
89 return it;
90 };
91
92 // toObject with fallback for non-array-like ES3 strings
93
94
95
96 var toIndexedObject = function (it) {
97 return indexedObject(requireObjectCoercible(it));
98 };
99
100 var isObject = function (it) {
101 return typeof it === 'object' ? it !== null : typeof it === 'function';
102 };
103
104 // `ToPrimitive` abstract operation
105 // https://tc39.github.io/ecma262/#sec-toprimitive
106 // instead of the ES6 spec version, we didn't implement @@toPrimitive case
107 // and the second argument - flag - preferred type is a string
108 var toPrimitive = function (input, PREFERRED_STRING) {
109 if (!isObject(input)) return input;
110 var fn, val;
111 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
112 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
113 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
114 throw TypeError("Can't convert object to primitive value");
115 };
116
117 var hasOwnProperty = {}.hasOwnProperty;
118
119 var has = function (it, key) {
120 return hasOwnProperty.call(it, key);
121 };
122
123 var document$1 = global_1.document;
124 // typeof document.createElement is 'object' in old IE
125 var EXISTS = isObject(document$1) && isObject(document$1.createElement);
126
127 var documentCreateElement = function (it) {
128 return EXISTS ? document$1.createElement(it) : {};
129 };
130
131 // Thank's IE8 for his funny defineProperty
132 var ie8DomDefine = !descriptors && !fails(function () {
133 return Object.defineProperty(documentCreateElement('div'), 'a', {
134 get: function () { return 7; }
135 }).a != 7;
136 });
137
138 var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
139
140 // `Object.getOwnPropertyDescriptor` method
141 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
142 var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
143 O = toIndexedObject(O);
144 P = toPrimitive(P, true);
145 if (ie8DomDefine) try {
146 return nativeGetOwnPropertyDescriptor(O, P);
147 } catch (error) { /* empty */ }
148 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
149 };
150
151 var objectGetOwnPropertyDescriptor = {
152 f: f$1
153 };
154
155 var anObject = function (it) {
156 if (!isObject(it)) {
157 throw TypeError(String(it) + ' is not an object');
158 } return it;
159 };
160
161 var nativeDefineProperty = Object.defineProperty;
162
163 // `Object.defineProperty` method
164 // https://tc39.github.io/ecma262/#sec-object.defineproperty
165 var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
166 anObject(O);
167 P = toPrimitive(P, true);
168 anObject(Attributes);
169 if (ie8DomDefine) try {
170 return nativeDefineProperty(O, P, Attributes);
171 } catch (error) { /* empty */ }
172 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
173 if ('value' in Attributes) O[P] = Attributes.value;
174 return O;
175 };
176
177 var objectDefineProperty = {
178 f: f$2
179 };
180
181 var createNonEnumerableProperty = descriptors ? function (object, key, value) {
182 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
183 } : function (object, key, value) {
184 object[key] = value;
185 return object;
186 };
187
188 var setGlobal = function (key, value) {
189 try {
190 createNonEnumerableProperty(global_1, key, value);
191 } catch (error) {
192 global_1[key] = value;
193 } return value;
194 };
195
196 var SHARED = '__core-js_shared__';
197 var store = global_1[SHARED] || setGlobal(SHARED, {});
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) {
217 (module.exports = function (key, value) {
218 return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
219 })('versions', []).push({
220 version: '3.6.0',
221 mode: 'global',
222 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
223 });
224 });
225
226 var id = 0;
227 var postfix = Math.random();
228
229 var uid = function (key) {
230 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
231 };
232
233 var keys = shared('keys');
234
235 var sharedKey = function (key) {
236 return keys[key] || (keys[key] = uid(key));
237 };
238
239 var hiddenKeys = {};
240
241 var WeakMap$1 = global_1.WeakMap;
242 var set, get, has$1;
243
244 var enforce = function (it) {
245 return has$1(it) ? get(it) : set(it, {});
246 };
247
248 var getterFor = function (TYPE) {
249 return function (it) {
250 var state;
251 if (!isObject(it) || (state = get(it)).type !== TYPE) {
252 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
253 } return state;
254 };
255 };
256
257 if (nativeWeakMap) {
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;
262 set = function (it, metadata) {
263 wmset.call(store$1, it, metadata);
264 return metadata;
265 };
266 get = function (it) {
267 return wmget.call(store$1, it) || {};
268 };
269 has$1 = function (it) {
270 return wmhas.call(store$1, it);
271 };
272 } else {
273 var STATE = sharedKey('state');
274 hiddenKeys[STATE] = true;
275 set = function (it, metadata) {
276 createNonEnumerableProperty(it, STATE, metadata);
277 return metadata;
278 };
279 get = function (it) {
280 return has(it, STATE) ? it[STATE] : {};
281 };
282 has$1 = function (it) {
283 return has(it, STATE);
284 };
285 }
286
287 var internalState = {
288 set: set,
289 get: get,
290 has: has$1,
291 enforce: enforce,
292 getterFor: getterFor
293 };
294
295 var redefine = createCommonjsModule(function (module) {
296 var getInternalState = internalState.get;
297 var enforceInternalState = internalState.enforce;
298 var TEMPLATE = String(String).split('String');
299
300 (module.exports = function (O, key, value, options) {
301 var unsafe = options ? !!options.unsafe : false;
302 var simple = options ? !!options.enumerable : false;
303 var noTargetGet = options ? !!options.noTargetGet : false;
304 if (typeof value == 'function') {
305 if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
306 enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
307 }
308 if (O === global_1) {
309 if (simple) O[key] = value;
310 else setGlobal(key, value);
311 return;
312 } else if (!unsafe) {
313 delete O[key];
314 } else if (!noTargetGet && O[key]) {
315 simple = true;
316 }
317 if (simple) O[key] = value;
318 else createNonEnumerableProperty(O, key, value);
319 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
320 })(Function.prototype, 'toString', function toString() {
321 return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
322 });
323 });
324
325 var path = global_1;
326
327 var aFunction = function (variable) {
328 return typeof variable == 'function' ? variable : undefined;
329 };
330
331 var getBuiltIn = function (namespace, method) {
332 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
333 : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
334 };
335
336 var ceil = Math.ceil;
337 var floor = Math.floor;
338
339 // `ToInteger` abstract operation
340 // https://tc39.github.io/ecma262/#sec-tointeger
341 var toInteger = function (argument) {
342 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
343 };
344
345 var min = Math.min;
346
347 // `ToLength` abstract operation
348 // https://tc39.github.io/ecma262/#sec-tolength
349 var toLength = function (argument) {
350 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
351 };
352
353 var max = Math.max;
354 var min$1 = Math.min;
355
356 // Helper for a popular repeating case of the spec:
357 // Let integer be ? ToInteger(index).
358 // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
359 var toAbsoluteIndex = function (index, length) {
360 var integer = toInteger(index);
361 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
362 };
363
364 // `Array.prototype.{ indexOf, includes }` methods implementation
365 var createMethod = function (IS_INCLUDES) {
366 return function ($this, el, fromIndex) {
367 var O = toIndexedObject($this);
368 var length = toLength(O.length);
369 var index = toAbsoluteIndex(fromIndex, length);
370 var value;
371 // Array#includes uses SameValueZero equality algorithm
372 // eslint-disable-next-line no-self-compare
373 if (IS_INCLUDES && el != el) while (length > index) {
374 value = O[index++];
375 // eslint-disable-next-line no-self-compare
376 if (value != value) return true;
377 // Array#indexOf ignores holes, Array#includes - not
378 } else for (;length > index; index++) {
379 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
380 } return !IS_INCLUDES && -1;
381 };
382 };
383
384 var arrayIncludes = {
385 // `Array.prototype.includes` method
386 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
387 includes: createMethod(true),
388 // `Array.prototype.indexOf` method
389 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
390 indexOf: createMethod(false)
391 };
392
393 var indexOf = arrayIncludes.indexOf;
394
395
396 var objectKeysInternal = function (object, names) {
397 var O = toIndexedObject(object);
398 var i = 0;
399 var result = [];
400 var key;
401 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
402 // Don't enum bug & hidden keys
403 while (names.length > i) if (has(O, key = names[i++])) {
404 ~indexOf(result, key) || result.push(key);
405 }
406 return result;
407 };
408
409 // IE8- don't enum bug keys
410 var enumBugKeys = [
411 'constructor',
412 'hasOwnProperty',
413 'isPrototypeOf',
414 'propertyIsEnumerable',
415 'toLocaleString',
416 'toString',
417 'valueOf'
418 ];
419
420 var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
421
422 // `Object.getOwnPropertyNames` method
423 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
424 var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
425 return objectKeysInternal(O, hiddenKeys$1);
426 };
427
428 var objectGetOwnPropertyNames = {
429 f: f$3
430 };
431
432 var f$4 = Object.getOwnPropertySymbols;
433
434 var objectGetOwnPropertySymbols = {
435 f: f$4
436 };
437
438 // all object keys, includes non-enumerable and symbols
439 var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
440 var keys = objectGetOwnPropertyNames.f(anObject(it));
441 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
442 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
443 };
444
445 var copyConstructorProperties = function (target, source) {
446 var keys = ownKeys(source);
447 var defineProperty = objectDefineProperty.f;
448 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
449 for (var i = 0; i < keys.length; i++) {
450 var key = keys[i];
451 if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
452 }
453 };
454
455 var replacement = /#|\.prototype\./;
456
457 var isForced = function (feature, detection) {
458 var value = data[normalize(feature)];
459 return value == POLYFILL ? true
460 : value == NATIVE ? false
461 : typeof detection == 'function' ? fails(detection)
462 : !!detection;
463 };
464
465 var normalize = isForced.normalize = function (string) {
466 return String(string).replace(replacement, '.').toLowerCase();
467 };
468
469 var data = isForced.data = {};
470 var NATIVE = isForced.NATIVE = 'N';
471 var POLYFILL = isForced.POLYFILL = 'P';
472
473 var isForced_1 = isForced;
474
475 var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
476
477
478
479
480
481
482 /*
483 options.target - name of the target object
484 options.global - target is the global object
485 options.stat - export as static methods of target
486 options.proto - export as prototype methods of target
487 options.real - real prototype method for the `pure` version
488 options.forced - export even if the native feature is available
489 options.bind - bind methods to the target, required for the `pure` version
490 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
491 options.unsafe - use the simple assignment of property instead of delete + defineProperty
492 options.sham - add a flag to not completely full polyfills
493 options.enumerable - export as enumerable property
494 options.noTargetGet - prevent calling a getter on target
495 */
496 var _export = function (options, source) {
497 var TARGET = options.target;
498 var GLOBAL = options.global;
499 var STATIC = options.stat;
500 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
501 if (GLOBAL) {
502 target = global_1;
503 } else if (STATIC) {
504 target = global_1[TARGET] || setGlobal(TARGET, {});
505 } else {
506 target = (global_1[TARGET] || {}).prototype;
507 }
508 if (target) for (key in source) {
509 sourceProperty = source[key];
510 if (options.noTargetGet) {
511 descriptor = getOwnPropertyDescriptor$1(target, key);
512 targetProperty = descriptor && descriptor.value;
513 } else targetProperty = target[key];
514 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
515 // contained in target
516 if (!FORCED && targetProperty !== undefined) {
517 if (typeof sourceProperty === typeof targetProperty) continue;
518 copyConstructorProperties(sourceProperty, targetProperty);
519 }
520 // add a flag to not completely full polyfills
521 if (options.sham || (targetProperty && targetProperty.sham)) {
522 createNonEnumerableProperty(sourceProperty, 'sham', true);
523 }
524 // extend global
525 redefine(target, key, sourceProperty, options);
526 }
527 };
528
529 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
530 // Chrome 38 Symbol has incorrect toString conversion
531 // eslint-disable-next-line no-undef
532 return !String(Symbol());
533 });
534
535 var useSymbolAsUid = nativeSymbol
536 // eslint-disable-next-line no-undef
537 && !Symbol.sham
538 // eslint-disable-next-line no-undef
539 && typeof Symbol() == 'symbol';
540
541 // `IsArray` abstract operation
542 // https://tc39.github.io/ecma262/#sec-isarray
543 var isArray = Array.isArray || function isArray(arg) {
544 return classofRaw(arg) == 'Array';
545 };
546
547 // `ToObject` abstract operation
548 // https://tc39.github.io/ecma262/#sec-toobject
549 var toObject = function (argument) {
550 return Object(requireObjectCoercible(argument));
551 };
552
553 // `Object.keys` method
554 // https://tc39.github.io/ecma262/#sec-object.keys
555 var objectKeys = Object.keys || function keys(O) {
556 return objectKeysInternal(O, enumBugKeys);
557 };
558
559 // `Object.defineProperties` method
560 // https://tc39.github.io/ecma262/#sec-object.defineproperties
561 var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
562 anObject(O);
563 var keys = objectKeys(Properties);
564 var length = keys.length;
565 var index = 0;
566 var key;
567 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
568 return O;
569 };
570
571 var html = getBuiltIn('document', 'documentElement');
572
573 var GT = '>';
574 var LT = '<';
575 var PROTOTYPE = 'prototype';
576 var SCRIPT = 'script';
577 var IE_PROTO = sharedKey('IE_PROTO');
578
579 var EmptyConstructor = function () { /* empty */ };
580
581 var scriptTag = function (content) {
582 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
583 };
584
585 // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
586 var NullProtoObjectViaActiveX = function (activeXDocument) {
587 activeXDocument.write(scriptTag(''));
588 activeXDocument.close();
589 var temp = activeXDocument.parentWindow.Object;
590 activeXDocument = null; // avoid memory leak
591 return temp;
592 };
593
594 // Create object with fake `null` prototype: use iframe Object with cleared prototype
595 var NullProtoObjectViaIFrame = function () {
596 // Thrash, waste and sodomy: IE GC bug
597 var iframe = documentCreateElement('iframe');
598 var JS = 'java' + SCRIPT + ':';
599 var iframeDocument;
600 iframe.style.display = 'none';
601 html.appendChild(iframe);
602 // https://github.com/zloirock/core-js/issues/475
603 iframe.src = String(JS);
604 iframeDocument = iframe.contentWindow.document;
605 iframeDocument.open();
606 iframeDocument.write(scriptTag('document.F=Object'));
607 iframeDocument.close();
608 return iframeDocument.F;
609 };
610
611 // Check for document.domain and active x support
612 // No need to use active x approach when document.domain is not set
613 // see https://github.com/es-shims/es5-shim/issues/150
614 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
615 // avoid IE GC bug
616 var activeXDocument;
617 var NullProtoObject = function () {
618 try {
619 /* global ActiveXObject */
620 activeXDocument = document.domain && new ActiveXObject('htmlfile');
621 } catch (error) { /* ignore */ }
622 NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
623 var length = enumBugKeys.length;
624 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
625 return NullProtoObject();
626 };
627
628 hiddenKeys[IE_PROTO] = true;
629
630 // `Object.create` method
631 // https://tc39.github.io/ecma262/#sec-object.create
632 var objectCreate = Object.create || function create(O, Properties) {
633 var result;
634 if (O !== null) {
635 EmptyConstructor[PROTOTYPE] = anObject(O);
636 result = new EmptyConstructor();
637 EmptyConstructor[PROTOTYPE] = null;
638 // add "__proto__" for Object.getPrototypeOf polyfill
639 result[IE_PROTO] = O;
640 } else result = NullProtoObject();
641 return Properties === undefined ? result : objectDefineProperties(result, Properties);
642 };
643
644 var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
645
646 var toString$1 = {}.toString;
647
648 var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
649 ? Object.getOwnPropertyNames(window) : [];
650
651 var getWindowNames = function (it) {
652 try {
653 return nativeGetOwnPropertyNames(it);
654 } catch (error) {
655 return windowNames.slice();
656 }
657 };
658
659 // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
660 var f$5 = function getOwnPropertyNames(it) {
661 return windowNames && toString$1.call(it) == '[object Window]'
662 ? getWindowNames(it)
663 : nativeGetOwnPropertyNames(toIndexedObject(it));
664 };
665
666 var objectGetOwnPropertyNamesExternal = {
667 f: f$5
668 };
669
670 var WellKnownSymbolsStore = shared('wks');
671 var Symbol$1 = global_1.Symbol;
672 var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : uid;
673
674 var wellKnownSymbol = function (name) {
675 if (!has(WellKnownSymbolsStore, name)) {
676 if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
677 else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
678 } return WellKnownSymbolsStore[name];
679 };
680
681 var f$6 = wellKnownSymbol;
682
683 var wrappedWellKnownSymbol = {
684 f: f$6
685 };
686
687 var defineProperty = objectDefineProperty.f;
688
689 var defineWellKnownSymbol = function (NAME) {
690 var Symbol = path.Symbol || (path.Symbol = {});
691 if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
692 value: wrappedWellKnownSymbol.f(NAME)
693 });
694 };
695
696 var defineProperty$1 = objectDefineProperty.f;
697
698
699
700 var TO_STRING_TAG = wellKnownSymbol('toStringTag');
701
702 var setToStringTag = function (it, TAG, STATIC) {
703 if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
704 defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG });
705 }
706 };
707
708 var aFunction$1 = function (it) {
709 if (typeof it != 'function') {
710 throw TypeError(String(it) + ' is not a function');
711 } return it;
712 };
713
714 // optional / simple context binding
715 var bindContext = function (fn, that, length) {
716 aFunction$1(fn);
717 if (that === undefined) return fn;
718 switch (length) {
719 case 0: return function () {
720 return fn.call(that);
721 };
722 case 1: return function (a) {
723 return fn.call(that, a);
724 };
725 case 2: return function (a, b) {
726 return fn.call(that, a, b);
727 };
728 case 3: return function (a, b, c) {
729 return fn.call(that, a, b, c);
730 };
731 }
732 return function (/* ...args */) {
733 return fn.apply(that, arguments);
734 };
735 };
736
737 var SPECIES = wellKnownSymbol('species');
738
739 // `ArraySpeciesCreate` abstract operation
740 // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
741 var arraySpeciesCreate = function (originalArray, length) {
742 var C;
743 if (isArray(originalArray)) {
744 C = originalArray.constructor;
745 // cross-realm fallback
746 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
747 else if (isObject(C)) {
748 C = C[SPECIES];
749 if (C === null) C = undefined;
750 }
751 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
752 };
753
754 var push = [].push;
755
756 // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
757 var createMethod$1 = function (TYPE) {
758 var IS_MAP = TYPE == 1;
759 var IS_FILTER = TYPE == 2;
760 var IS_SOME = TYPE == 3;
761 var IS_EVERY = TYPE == 4;
762 var IS_FIND_INDEX = TYPE == 6;
763 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
764 return function ($this, callbackfn, that, specificCreate) {
765 var O = toObject($this);
766 var self = indexedObject(O);
767 var boundFunction = bindContext(callbackfn, that, 3);
768 var length = toLength(self.length);
769 var index = 0;
770 var create = specificCreate || arraySpeciesCreate;
771 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
772 var value, result;
773 for (;length > index; index++) if (NO_HOLES || index in self) {
774 value = self[index];
775 result = boundFunction(value, index, O);
776 if (TYPE) {
777 if (IS_MAP) target[index] = result; // map
778 else if (result) switch (TYPE) {
779 case 3: return true; // some
780 case 5: return value; // find
781 case 6: return index; // findIndex
782 case 2: push.call(target, value); // filter
783 } else if (IS_EVERY) return false; // every
784 }
785 }
786 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
787 };
788 };
789
790 var arrayIteration = {
791 // `Array.prototype.forEach` method
792 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
793 forEach: createMethod$1(0),
794 // `Array.prototype.map` method
795 // https://tc39.github.io/ecma262/#sec-array.prototype.map
796 map: createMethod$1(1),
797 // `Array.prototype.filter` method
798 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
799 filter: createMethod$1(2),
800 // `Array.prototype.some` method
801 // https://tc39.github.io/ecma262/#sec-array.prototype.some
802 some: createMethod$1(3),
803 // `Array.prototype.every` method
804 // https://tc39.github.io/ecma262/#sec-array.prototype.every
805 every: createMethod$1(4),
806 // `Array.prototype.find` method
807 // https://tc39.github.io/ecma262/#sec-array.prototype.find
808 find: createMethod$1(5),
809 // `Array.prototype.findIndex` method
810 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
811 findIndex: createMethod$1(6)
812 };
813
814 var $forEach = arrayIteration.forEach;
815
816 var HIDDEN = sharedKey('hidden');
817 var SYMBOL = 'Symbol';
818 var PROTOTYPE$1 = 'prototype';
819 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
820 var setInternalState = internalState.set;
821 var getInternalState = internalState.getterFor(SYMBOL);
822 var ObjectPrototype = Object[PROTOTYPE$1];
823 var $Symbol = global_1.Symbol;
824 var $stringify = getBuiltIn('JSON', 'stringify');
825 var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
826 var nativeDefineProperty$1 = objectDefineProperty.f;
827 var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
828 var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
829 var AllSymbols = shared('symbols');
830 var ObjectPrototypeSymbols = shared('op-symbols');
831 var StringToSymbolRegistry = shared('string-to-symbol-registry');
832 var SymbolToStringRegistry = shared('symbol-to-string-registry');
833 var WellKnownSymbolsStore$1 = shared('wks');
834 var QObject = global_1.QObject;
835 // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
836 var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;
837
838 // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
839 var setSymbolDescriptor = descriptors && fails(function () {
840 return objectCreate(nativeDefineProperty$1({}, 'a', {
841 get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
842 })).a != 7;
843 }) ? function (O, P, Attributes) {
844 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);
845 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
846 nativeDefineProperty$1(O, P, Attributes);
847 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
848 nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);
849 }
850 } : nativeDefineProperty$1;
851
852 var wrap = function (tag, description) {
853 var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
854 setInternalState(symbol, {
855 type: SYMBOL,
856 tag: tag,
857 description: description
858 });
859 if (!descriptors) symbol.description = description;
860 return symbol;
861 };
862
863 var isSymbol = nativeSymbol && typeof $Symbol.iterator == 'symbol' ? function (it) {
864 return typeof it == 'symbol';
865 } : function (it) {
866 return Object(it) instanceof $Symbol;
867 };
868
869 var $defineProperty = function defineProperty(O, P, Attributes) {
870 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
871 anObject(O);
872 var key = toPrimitive(P, true);
873 anObject(Attributes);
874 if (has(AllSymbols, key)) {
875 if (!Attributes.enumerable) {
876 if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
877 O[HIDDEN][key] = true;
878 } else {
879 if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
880 Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
881 } return setSymbolDescriptor(O, key, Attributes);
882 } return nativeDefineProperty$1(O, key, Attributes);
883 };
884
885 var $defineProperties = function defineProperties(O, Properties) {
886 anObject(O);
887 var properties = toIndexedObject(Properties);
888 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
889 $forEach(keys, function (key) {
890 if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
891 });
892 return O;
893 };
894
895 var $create = function create(O, Properties) {
896 return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
897 };
898
899 var $propertyIsEnumerable = function propertyIsEnumerable(V) {
900 var P = toPrimitive(V, true);
901 var enumerable = nativePropertyIsEnumerable$1.call(this, P);
902 if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
903 return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
904 };
905
906 var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
907 var it = toIndexedObject(O);
908 var key = toPrimitive(P, true);
909 if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
910 var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
911 if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
912 descriptor.enumerable = true;
913 }
914 return descriptor;
915 };
916
917 var $getOwnPropertyNames = function getOwnPropertyNames(O) {
918 var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
919 var result = [];
920 $forEach(names, function (key) {
921 if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
922 });
923 return result;
924 };
925
926 var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
927 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
928 var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
929 var result = [];
930 $forEach(names, function (key) {
931 if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
932 result.push(AllSymbols[key]);
933 }
934 });
935 return result;
936 };
937
938 // `Symbol` constructor
939 // https://tc39.github.io/ecma262/#sec-symbol-constructor
940 if (!nativeSymbol) {
941 $Symbol = function Symbol() {
942 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
943 var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
944 var tag = uid(description);
945 var setter = function (value) {
946 if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
947 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
948 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
949 };
950 if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
951 return wrap(tag, description);
952 };
953
954 redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
955 return getInternalState(this).tag;
956 });
957
958 objectPropertyIsEnumerable.f = $propertyIsEnumerable;
959 objectDefineProperty.f = $defineProperty;
960 objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
961 objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
962 objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
963
964 if (descriptors) {
965 // https://github.com/tc39/proposal-Symbol-description
966 nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
967 configurable: true,
968 get: function description() {
969 return getInternalState(this).description;
970 }
971 });
972 {
973 redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
974 }
975 }
976 }
977
978 if (!useSymbolAsUid) {
979 wrappedWellKnownSymbol.f = function (name) {
980 return wrap(wellKnownSymbol(name), name);
981 };
982 }
983
984 _export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
985 Symbol: $Symbol
986 });
987
988 $forEach(objectKeys(WellKnownSymbolsStore$1), function (name) {
989 defineWellKnownSymbol(name);
990 });
991
992 _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {
993 // `Symbol.for` method
994 // https://tc39.github.io/ecma262/#sec-symbol.for
995 'for': function (key) {
996 var string = String(key);
997 if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
998 var symbol = $Symbol(string);
999 StringToSymbolRegistry[string] = symbol;
1000 SymbolToStringRegistry[symbol] = string;
1001 return symbol;
1002 },
1003 // `Symbol.keyFor` method
1004 // https://tc39.github.io/ecma262/#sec-symbol.keyfor
1005 keyFor: function keyFor(sym) {
1006 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
1007 if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
1008 },
1009 useSetter: function () { USE_SETTER = true; },
1010 useSimple: function () { USE_SETTER = false; }
1011 });
1012
1013 _export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {
1014 // `Object.create` method
1015 // https://tc39.github.io/ecma262/#sec-object.create
1016 create: $create,
1017 // `Object.defineProperty` method
1018 // https://tc39.github.io/ecma262/#sec-object.defineproperty
1019 defineProperty: $defineProperty,
1020 // `Object.defineProperties` method
1021 // https://tc39.github.io/ecma262/#sec-object.defineproperties
1022 defineProperties: $defineProperties,
1023 // `Object.getOwnPropertyDescriptor` method
1024 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
1025 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
1026 });
1027
1028 _export({ target: 'Object', stat: true, forced: !nativeSymbol }, {
1029 // `Object.getOwnPropertyNames` method
1030 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
1031 getOwnPropertyNames: $getOwnPropertyNames,
1032 // `Object.getOwnPropertySymbols` method
1033 // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
1034 getOwnPropertySymbols: $getOwnPropertySymbols
1035 });
1036
1037 // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
1038 // https://bugs.chromium.org/p/v8/issues/detail?id=3443
1039 _export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
1040 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
1041 return objectGetOwnPropertySymbols.f(toObject(it));
1042 }
1043 });
1044
1045 // `JSON.stringify` method behavior with symbols
1046 // https://tc39.github.io/ecma262/#sec-json.stringify
1047 if ($stringify) {
1048 var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {
1049 var symbol = $Symbol();
1050 // MS Edge converts symbol values to JSON as {}
1051 return $stringify([symbol]) != '[null]'
1052 // WebKit converts symbol values to JSON as null
1053 || $stringify({ a: symbol }) != '{}'
1054 // V8 throws on boxed symbols
1055 || $stringify(Object(symbol)) != '{}';
1056 });
1057
1058 _export({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
1059 // eslint-disable-next-line no-unused-vars
1060 stringify: function stringify(it, replacer, space) {
1061 var args = [it];
1062 var index = 1;
1063 var $replacer;
1064 while (arguments.length > index) args.push(arguments[index++]);
1065 $replacer = replacer;
1066 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
1067 if (!isArray(replacer)) replacer = function (key, value) {
1068 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
1069 if (!isSymbol(value)) return value;
1070 };
1071 args[1] = replacer;
1072 return $stringify.apply(null, args);
1073 }
1074 });
1075 }
1076
1077 // `Symbol.prototype[@@toPrimitive]` method
1078 // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
1079 if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) {
1080 createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
1081 }
1082 // `Symbol.prototype[@@toStringTag]` property
1083 // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
1084 setToStringTag($Symbol, SYMBOL);
1085
1086 hiddenKeys[HIDDEN] = true;
1087
1088 var defineProperty$2 = objectDefineProperty.f;
1089
1090
1091 var NativeSymbol = global_1.Symbol;
1092
1093 if (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
1094 // Safari 12 bug
1095 NativeSymbol().description !== undefined
1096 )) {
1097 var EmptyStringDescriptionStore = {};
1098 // wrap Symbol constructor for correct work with undefined description
1099 var SymbolWrapper = function Symbol() {
1100 var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
1101 var result = this instanceof SymbolWrapper
1102 ? new NativeSymbol(description)
1103 // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
1104 : description === undefined ? NativeSymbol() : NativeSymbol(description);
1105 if (description === '') EmptyStringDescriptionStore[result] = true;
1106 return result;
1107 };
1108 copyConstructorProperties(SymbolWrapper, NativeSymbol);
1109 var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
1110 symbolPrototype.constructor = SymbolWrapper;
1111
1112 var symbolToString = symbolPrototype.toString;
1113 var native = String(NativeSymbol('test')) == 'Symbol(test)';
1114 var regexp = /^Symbol\((.*)\)[^)]+$/;
1115 defineProperty$2(symbolPrototype, 'description', {
1116 configurable: true,
1117 get: function description() {
1118 var symbol = isObject(this) ? this.valueOf() : this;
1119 var string = symbolToString.call(symbol);
1120 if (has(EmptyStringDescriptionStore, symbol)) return '';
1121 var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
1122 return desc === '' ? undefined : desc;
1123 }
1124 });
1125
1126 _export({ global: true, forced: true }, {
1127 Symbol: SymbolWrapper
1128 });
1129 }
1130
1131 // `Symbol.iterator` well-known symbol
1132 // https://tc39.github.io/ecma262/#sec-symbol.iterator
1133 defineWellKnownSymbol('iterator');
1134
1135 var createProperty = function (object, key, value) {
1136 var propertyKey = toPrimitive(key);
1137 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
1138 else object[propertyKey] = value;
1139 };
1140
1141 var userAgent = getBuiltIn('navigator', 'userAgent') || '';
1142
1143 var process = global_1.process;
1144 var versions = process && process.versions;
1145 var v8 = versions && versions.v8;
1146 var match, version;
1147
1148 if (v8) {
1149 match = v8.split('.');
1150 version = match[0] + match[1];
1151 } else if (userAgent) {
1152 match = userAgent.match(/Edge\/(\d+)/);
1153 if (!match || match[1] >= 74) {
1154 match = userAgent.match(/Chrome\/(\d+)/);
1155 if (match) version = match[1];
1156 }
1157 }
1158
1159 var v8Version = version && +version;
1160
1161 var SPECIES$1 = wellKnownSymbol('species');
1162
1163 var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
1164 // We can't use this feature detection in V8 since it causes
1165 // deoptimization and serious performance degradation
1166 // https://github.com/zloirock/core-js/issues/677
1167 return v8Version >= 51 || !fails(function () {
1168 var array = [];
1169 var constructor = array.constructor = {};
1170 constructor[SPECIES$1] = function () {
1171 return { foo: 1 };
1172 };
1173 return array[METHOD_NAME](Boolean).foo !== 1;
1174 });
1175 };
1176
1177 var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
1178 var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
1179 var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
1180
1181 // We can't use this feature detection in V8 since it causes
1182 // deoptimization and serious performance degradation
1183 // https://github.com/zloirock/core-js/issues/679
1184 var IS_CONCAT_SPREADABLE_SUPPORT = v8Version >= 51 || !fails(function () {
1185 var array = [];
1186 array[IS_CONCAT_SPREADABLE] = false;
1187 return array.concat()[0] !== array;
1188 });
1189
1190 var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
1191
1192 var isConcatSpreadable = function (O) {
1193 if (!isObject(O)) return false;
1194 var spreadable = O[IS_CONCAT_SPREADABLE];
1195 return spreadable !== undefined ? !!spreadable : isArray(O);
1196 };
1197
1198 var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1199
1200 // `Array.prototype.concat` method
1201 // https://tc39.github.io/ecma262/#sec-array.prototype.concat
1202 // with adding support of @@isConcatSpreadable and @@species
1203 _export({ target: 'Array', proto: true, forced: FORCED }, {
1204 concat: function concat(arg) { // eslint-disable-line no-unused-vars
1205 var O = toObject(this);
1206 var A = arraySpeciesCreate(O, 0);
1207 var n = 0;
1208 var i, k, length, len, E;
1209 for (i = -1, length = arguments.length; i < length; i++) {
1210 E = i === -1 ? O : arguments[i];
1211 if (isConcatSpreadable(E)) {
1212 len = toLength(E.length);
1213 if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1214 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
1215 } else {
1216 if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1217 createProperty(A, n++, E);
1218 }
1219 }
1220 A.length = n;
1221 return A;
1222 }
1223 });
1224
1225 var $filter = arrayIteration.filter;
1226
1227
1228
1229 var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
1230 // Edge 14- issue
1231 var USES_TO_LENGTH = HAS_SPECIES_SUPPORT && !fails(function () {
1232 [].filter.call({ length: -1, 0: 1 }, function (it) { throw it; });
1233 });
1234
1235 // `Array.prototype.filter` method
1236 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
1237 // with adding support of @@species
1238 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
1239 filter: function filter(callbackfn /* , thisArg */) {
1240 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1241 }
1242 });
1243
1244 var UNSCOPABLES = wellKnownSymbol('unscopables');
1245 var ArrayPrototype = Array.prototype;
1246
1247 // Array.prototype[@@unscopables]
1248 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1249 if (ArrayPrototype[UNSCOPABLES] == undefined) {
1250 objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
1251 configurable: true,
1252 value: objectCreate(null)
1253 });
1254 }
1255
1256 // add a key to Array.prototype[@@unscopables]
1257 var addToUnscopables = function (key) {
1258 ArrayPrototype[UNSCOPABLES][key] = true;
1259 };
1260
1261 var $find = arrayIteration.find;
1262
1263
1264 var FIND = 'find';
1265 var SKIPS_HOLES = true;
1266
1267 // Shouldn't skip holes
1268 if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
1269
1270 // `Array.prototype.find` method
1271 // https://tc39.github.io/ecma262/#sec-array.prototype.find
1272 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
1273 find: function find(callbackfn /* , that = undefined */) {
1274 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1275 }
1276 });
1277
1278 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1279 addToUnscopables(FIND);
1280
1281 var $findIndex = arrayIteration.findIndex;
1282
1283
1284 var FIND_INDEX = 'findIndex';
1285 var SKIPS_HOLES$1 = true;
1286
1287 // Shouldn't skip holes
1288 if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES$1 = false; });
1289
1290 // `Array.prototype.findIndex` method
1291 // https://tc39.github.io/ecma262/#sec-array.prototype.findindex
1292 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, {
1293 findIndex: function findIndex(callbackfn /* , that = undefined */) {
1294 return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1295 }
1296 });
1297
1298 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1299 addToUnscopables(FIND_INDEX);
1300
1301 var $includes = arrayIncludes.includes;
1302
1303
1304 // `Array.prototype.includes` method
1305 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
1306 _export({ target: 'Array', proto: true }, {
1307 includes: function includes(el /* , fromIndex = 0 */) {
1308 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1309 }
1310 });
1311
1312 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1313 addToUnscopables('includes');
1314
1315 var sloppyArrayMethod = function (METHOD_NAME, argument) {
1316 var method = [][METHOD_NAME];
1317 return !method || !fails(function () {
1318 // eslint-disable-next-line no-useless-call,no-throw-literal
1319 method.call(null, argument || function () { throw 1; }, 1);
1320 });
1321 };
1322
1323 var $indexOf = arrayIncludes.indexOf;
1324
1325
1326 var nativeIndexOf = [].indexOf;
1327
1328 var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
1329 var SLOPPY_METHOD = sloppyArrayMethod('indexOf');
1330
1331 // `Array.prototype.indexOf` method
1332 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
1333 _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
1334 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
1335 return NEGATIVE_ZERO
1336 // convert -0 to +0
1337 ? nativeIndexOf.apply(this, arguments) || 0
1338 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
1339 }
1340 });
1341
1342 var correctPrototypeGetter = !fails(function () {
1343 function F() { /* empty */ }
1344 F.prototype.constructor = null;
1345 return Object.getPrototypeOf(new F()) !== F.prototype;
1346 });
1347
1348 var IE_PROTO$1 = sharedKey('IE_PROTO');
1349 var ObjectPrototype$1 = Object.prototype;
1350
1351 // `Object.getPrototypeOf` method
1352 // https://tc39.github.io/ecma262/#sec-object.getprototypeof
1353 var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
1354 O = toObject(O);
1355 if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
1356 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
1357 return O.constructor.prototype;
1358 } return O instanceof Object ? ObjectPrototype$1 : null;
1359 };
1360
1361 var ITERATOR = wellKnownSymbol('iterator');
1362 var BUGGY_SAFARI_ITERATORS = false;
1363
1364 var returnThis = function () { return this; };
1365
1366 // `%IteratorPrototype%` object
1367 // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
1368 var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
1369
1370 if ([].keys) {
1371 arrayIterator = [].keys();
1372 // Safari 8 has buggy iterators w/o `next`
1373 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
1374 else {
1375 PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
1376 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
1377 }
1378 }
1379
1380 if (IteratorPrototype == undefined) IteratorPrototype = {};
1381
1382 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
1383 if ( !has(IteratorPrototype, ITERATOR)) {
1384 createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
1385 }
1386
1387 var iteratorsCore = {
1388 IteratorPrototype: IteratorPrototype,
1389 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
1390 };
1391
1392 var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1393
1394 var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
1395 var TO_STRING_TAG = NAME + ' Iterator';
1396 IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
1397 setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
1398 return IteratorConstructor;
1399 };
1400
1401 var aPossiblePrototype = function (it) {
1402 if (!isObject(it) && it !== null) {
1403 throw TypeError("Can't set " + String(it) + ' as a prototype');
1404 } return it;
1405 };
1406
1407 // `Object.setPrototypeOf` method
1408 // https://tc39.github.io/ecma262/#sec-object.setprototypeof
1409 // Works with __proto__ only. Old v8 can't work with null proto objects.
1410 /* eslint-disable no-proto */
1411 var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1412 var CORRECT_SETTER = false;
1413 var test = {};
1414 var setter;
1415 try {
1416 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
1417 setter.call(test, []);
1418 CORRECT_SETTER = test instanceof Array;
1419 } catch (error) { /* empty */ }
1420 return function setPrototypeOf(O, proto) {
1421 anObject(O);
1422 aPossiblePrototype(proto);
1423 if (CORRECT_SETTER) setter.call(O, proto);
1424 else O.__proto__ = proto;
1425 return O;
1426 };
1427 }() : undefined);
1428
1429 var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
1430 var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
1431 var ITERATOR$1 = wellKnownSymbol('iterator');
1432 var KEYS = 'keys';
1433 var VALUES = 'values';
1434 var ENTRIES = 'entries';
1435
1436 var returnThis$1 = function () { return this; };
1437
1438 var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1439 createIteratorConstructor(IteratorConstructor, NAME, next);
1440
1441 var getIterationMethod = function (KIND) {
1442 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1443 if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
1444 switch (KIND) {
1445 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1446 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1447 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1448 } return function () { return new IteratorConstructor(this); };
1449 };
1450
1451 var TO_STRING_TAG = NAME + ' Iterator';
1452 var INCORRECT_VALUES_NAME = false;
1453 var IterablePrototype = Iterable.prototype;
1454 var nativeIterator = IterablePrototype[ITERATOR$1]
1455 || IterablePrototype['@@iterator']
1456 || DEFAULT && IterablePrototype[DEFAULT];
1457 var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
1458 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1459 var CurrentIteratorPrototype, methods, KEY;
1460
1461 // fix native
1462 if (anyNativeIterator) {
1463 CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
1464 if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
1465 if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
1466 if (objectSetPrototypeOf) {
1467 objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
1468 } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
1469 createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis$1);
1470 }
1471 }
1472 // Set @@toStringTag to native iterators
1473 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
1474 }
1475 }
1476
1477 // fix Array#{values, @@iterator}.name in V8 / FF
1478 if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1479 INCORRECT_VALUES_NAME = true;
1480 defaultIterator = function values() { return nativeIterator.call(this); };
1481 }
1482
1483 // define iterator
1484 if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
1485 createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
1486 }
1487
1488 // export additional methods
1489 if (DEFAULT) {
1490 methods = {
1491 values: getIterationMethod(VALUES),
1492 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1493 entries: getIterationMethod(ENTRIES)
1494 };
1495 if (FORCED) for (KEY in methods) {
1496 if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1497 redefine(IterablePrototype, KEY, methods[KEY]);
1498 }
1499 } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
1500 }
1501
1502 return methods;
1503 };
1504
1505 var ARRAY_ITERATOR = 'Array Iterator';
1506 var setInternalState$1 = internalState.set;
1507 var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);
1508
1509 // `Array.prototype.entries` method
1510 // https://tc39.github.io/ecma262/#sec-array.prototype.entries
1511 // `Array.prototype.keys` method
1512 // https://tc39.github.io/ecma262/#sec-array.prototype.keys
1513 // `Array.prototype.values` method
1514 // https://tc39.github.io/ecma262/#sec-array.prototype.values
1515 // `Array.prototype[@@iterator]` method
1516 // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
1517 // `CreateArrayIterator` internal method
1518 // https://tc39.github.io/ecma262/#sec-createarrayiterator
1519 var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1520 setInternalState$1(this, {
1521 type: ARRAY_ITERATOR,
1522 target: toIndexedObject(iterated), // target
1523 index: 0, // next index
1524 kind: kind // kind
1525 });
1526 // `%ArrayIteratorPrototype%.next` method
1527 // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
1528 }, function () {
1529 var state = getInternalState$1(this);
1530 var target = state.target;
1531 var kind = state.kind;
1532 var index = state.index++;
1533 if (!target || index >= target.length) {
1534 state.target = undefined;
1535 return { value: undefined, done: true };
1536 }
1537 if (kind == 'keys') return { value: index, done: false };
1538 if (kind == 'values') return { value: target[index], done: false };
1539 return { value: [index, target[index]], done: false };
1540 }, 'values');
1541
1542 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1543 addToUnscopables('keys');
1544 addToUnscopables('values');
1545 addToUnscopables('entries');
1546
1547 var nativeJoin = [].join;
1548
1549 var ES3_STRINGS = indexedObject != Object;
1550 var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
1551
1552 // `Array.prototype.join` method
1553 // https://tc39.github.io/ecma262/#sec-array.prototype.join
1554 _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
1555 join: function join(separator) {
1556 return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
1557 }
1558 });
1559
1560 var $map = arrayIteration.map;
1561
1562
1563
1564 var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('map');
1565 // FF49- issue
1566 var USES_TO_LENGTH$1 = HAS_SPECIES_SUPPORT$1 && !fails(function () {
1567 [].map.call({ length: -1, 0: 1 }, function (it) { throw it; });
1568 });
1569
1570 // `Array.prototype.map` method
1571 // https://tc39.github.io/ecma262/#sec-array.prototype.map
1572 // with adding support of @@species
1573 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$1 }, {
1574 map: function map(callbackfn /* , thisArg */) {
1575 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1576 }
1577 });
1578
1579 var nativeReverse = [].reverse;
1580 var test = [1, 2];
1581
1582 // `Array.prototype.reverse` method
1583 // https://tc39.github.io/ecma262/#sec-array.prototype.reverse
1584 // fix for Safari 12.0 bug
1585 // https://bugs.webkit.org/show_bug.cgi?id=188794
1586 _export({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
1587 reverse: function reverse() {
1588 // eslint-disable-next-line no-self-assign
1589 if (isArray(this)) this.length = this.length;
1590 return nativeReverse.call(this);
1591 }
1592 });
1593
1594 var SPECIES$2 = wellKnownSymbol('species');
1595 var nativeSlice = [].slice;
1596 var max$1 = Math.max;
1597
1598 // `Array.prototype.slice` method
1599 // https://tc39.github.io/ecma262/#sec-array.prototype.slice
1600 // fallback for not array-like ES3 strings and DOM objects
1601 _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
1602 slice: function slice(start, end) {
1603 var O = toIndexedObject(this);
1604 var length = toLength(O.length);
1605 var k = toAbsoluteIndex(start, length);
1606 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
1607 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
1608 var Constructor, result, n;
1609 if (isArray(O)) {
1610 Constructor = O.constructor;
1611 // cross-realm fallback
1612 if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
1613 Constructor = undefined;
1614 } else if (isObject(Constructor)) {
1615 Constructor = Constructor[SPECIES$2];
1616 if (Constructor === null) Constructor = undefined;
1617 }
1618 if (Constructor === Array || Constructor === undefined) {
1619 return nativeSlice.call(O, k, fin);
1620 }
1621 }
1622 result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
1623 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
1624 result.length = n;
1625 return result;
1626 }
1627 });
1628
1629 var test$1 = [];
1630 var nativeSort = test$1.sort;
1631
1632 // IE8-
1633 var FAILS_ON_UNDEFINED = fails(function () {
1634 test$1.sort(undefined);
1635 });
1636 // V8 bug
1637 var FAILS_ON_NULL = fails(function () {
1638 test$1.sort(null);
1639 });
1640 // Old WebKit
1641 var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
1642
1643 var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
1644
1645 // `Array.prototype.sort` method
1646 // https://tc39.github.io/ecma262/#sec-array.prototype.sort
1647 _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
1648 sort: function sort(comparefn) {
1649 return comparefn === undefined
1650 ? nativeSort.call(toObject(this))
1651 : nativeSort.call(toObject(this), aFunction$1(comparefn));
1652 }
1653 });
1654
1655 var max$2 = Math.max;
1656 var min$2 = Math.min;
1657 var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
1658 var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
1659
1660 // `Array.prototype.splice` method
1661 // https://tc39.github.io/ecma262/#sec-array.prototype.splice
1662 // with adding support of @@species
1663 _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, {
1664 splice: function splice(start, deleteCount /* , ...items */) {
1665 var O = toObject(this);
1666 var len = toLength(O.length);
1667 var actualStart = toAbsoluteIndex(start, len);
1668 var argumentsLength = arguments.length;
1669 var insertCount, actualDeleteCount, A, k, from, to;
1670 if (argumentsLength === 0) {
1671 insertCount = actualDeleteCount = 0;
1672 } else if (argumentsLength === 1) {
1673 insertCount = 0;
1674 actualDeleteCount = len - actualStart;
1675 } else {
1676 insertCount = argumentsLength - 2;
1677 actualDeleteCount = min$2(max$2(toInteger(deleteCount), 0), len - actualStart);
1678 }
1679 if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) {
1680 throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
1681 }
1682 A = arraySpeciesCreate(O, actualDeleteCount);
1683 for (k = 0; k < actualDeleteCount; k++) {
1684 from = actualStart + k;
1685 if (from in O) createProperty(A, k, O[from]);
1686 }
1687 A.length = actualDeleteCount;
1688 if (insertCount < actualDeleteCount) {
1689 for (k = actualStart; k < len - actualDeleteCount; k++) {
1690 from = k + actualDeleteCount;
1691 to = k + insertCount;
1692 if (from in O) O[to] = O[from];
1693 else delete O[to];
1694 }
1695 for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
1696 } else if (insertCount > actualDeleteCount) {
1697 for (k = len - actualDeleteCount; k > actualStart; k--) {
1698 from = k + actualDeleteCount - 1;
1699 to = k + insertCount - 1;
1700 if (from in O) O[to] = O[from];
1701 else delete O[to];
1702 }
1703 }
1704 for (k = 0; k < insertCount; k++) {
1705 O[k + actualStart] = arguments[k + 2];
1706 }
1707 O.length = len - actualDeleteCount + insertCount;
1708 return A;
1709 }
1710 });
1711
1712 // makes subclassing work correct for wrapped built-ins
1713 var inheritIfRequired = function ($this, dummy, Wrapper) {
1714 var NewTarget, NewTargetPrototype;
1715 if (
1716 // it can work only with native `setPrototypeOf`
1717 objectSetPrototypeOf &&
1718 // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
1719 typeof (NewTarget = dummy.constructor) == 'function' &&
1720 NewTarget !== Wrapper &&
1721 isObject(NewTargetPrototype = NewTarget.prototype) &&
1722 NewTargetPrototype !== Wrapper.prototype
1723 ) objectSetPrototypeOf($this, NewTargetPrototype);
1724 return $this;
1725 };
1726
1727 // a string of all valid unicode whitespaces
1728 // eslint-disable-next-line max-len
1729 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';
1730
1731 var whitespace = '[' + whitespaces + ']';
1732 var ltrim = RegExp('^' + whitespace + whitespace + '*');
1733 var rtrim = RegExp(whitespace + whitespace + '*$');
1734
1735 // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1736 var createMethod$2 = function (TYPE) {
1737 return function ($this) {
1738 var string = String(requireObjectCoercible($this));
1739 if (TYPE & 1) string = string.replace(ltrim, '');
1740 if (TYPE & 2) string = string.replace(rtrim, '');
1741 return string;
1742 };
1743 };
1744
1745 var stringTrim = {
1746 // `String.prototype.{ trimLeft, trimStart }` methods
1747 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
1748 start: createMethod$2(1),
1749 // `String.prototype.{ trimRight, trimEnd }` methods
1750 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
1751 end: createMethod$2(2),
1752 // `String.prototype.trim` method
1753 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1754 trim: createMethod$2(3)
1755 };
1756
1757 var getOwnPropertyNames = objectGetOwnPropertyNames.f;
1758 var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
1759 var defineProperty$3 = objectDefineProperty.f;
1760 var trim = stringTrim.trim;
1761
1762 var NUMBER = 'Number';
1763 var NativeNumber = global_1[NUMBER];
1764 var NumberPrototype = NativeNumber.prototype;
1765
1766 // Opera ~12 has broken Object#toString
1767 var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;
1768
1769 // `ToNumber` abstract operation
1770 // https://tc39.github.io/ecma262/#sec-tonumber
1771 var toNumber = function (argument) {
1772 var it = toPrimitive(argument, false);
1773 var first, third, radix, maxCode, digits, length, index, code;
1774 if (typeof it == 'string' && it.length > 2) {
1775 it = trim(it);
1776 first = it.charCodeAt(0);
1777 if (first === 43 || first === 45) {
1778 third = it.charCodeAt(2);
1779 if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
1780 } else if (first === 48) {
1781 switch (it.charCodeAt(1)) {
1782 case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
1783 case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
1784 default: return +it;
1785 }
1786 digits = it.slice(2);
1787 length = digits.length;
1788 for (index = 0; index < length; index++) {
1789 code = digits.charCodeAt(index);
1790 // parseInt parses a string to a first unavailable symbol
1791 // but ToNumber should return NaN if a string contains unavailable symbols
1792 if (code < 48 || code > maxCode) return NaN;
1793 } return parseInt(digits, radix);
1794 }
1795 } return +it;
1796 };
1797
1798 // `Number` constructor
1799 // https://tc39.github.io/ecma262/#sec-number-constructor
1800 if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
1801 var NumberWrapper = function Number(value) {
1802 var it = arguments.length < 1 ? 0 : value;
1803 var dummy = this;
1804 return dummy instanceof NumberWrapper
1805 // check on 1..constructor(foo) case
1806 && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)
1807 ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
1808 };
1809 for (var keys$1 = descriptors ? getOwnPropertyNames(NativeNumber) : (
1810 // ES3:
1811 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
1812 // ES2015 (in case, if modules with ES2015 Number statics required before):
1813 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
1814 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
1815 ).split(','), j = 0, key; keys$1.length > j; j++) {
1816 if (has(NativeNumber, key = keys$1[j]) && !has(NumberWrapper, key)) {
1817 defineProperty$3(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
1818 }
1819 }
1820 NumberWrapper.prototype = NumberPrototype;
1821 NumberPrototype.constructor = NumberWrapper;
1822 redefine(global_1, NUMBER, NumberWrapper);
1823 }
1824
1825 var nativeAssign = Object.assign;
1826 var defineProperty$4 = Object.defineProperty;
1827
1828 // `Object.assign` method
1829 // https://tc39.github.io/ecma262/#sec-object.assign
1830 var objectAssign = !nativeAssign || fails(function () {
1831 // should have correct order of operations (Edge bug)
1832 if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$4({}, 'a', {
1833 enumerable: true,
1834 get: function () {
1835 defineProperty$4(this, 'b', {
1836 value: 3,
1837 enumerable: false
1838 });
1839 }
1840 }), { b: 2 })).b !== 1) return true;
1841 // should work with symbols and should have deterministic property order (V8 bug)
1842 var A = {};
1843 var B = {};
1844 // eslint-disable-next-line no-undef
1845 var symbol = Symbol();
1846 var alphabet = 'abcdefghijklmnopqrst';
1847 A[symbol] = 7;
1848 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1849 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
1850 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
1851 var T = toObject(target);
1852 var argumentsLength = arguments.length;
1853 var index = 1;
1854 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
1855 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
1856 while (argumentsLength > index) {
1857 var S = indexedObject(arguments[index++]);
1858 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
1859 var length = keys.length;
1860 var j = 0;
1861 var key;
1862 while (length > j) {
1863 key = keys[j++];
1864 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
1865 }
1866 } return T;
1867 } : nativeAssign;
1868
1869 // `Object.assign` method
1870 // https://tc39.github.io/ecma262/#sec-object.assign
1871 _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
1872 assign: objectAssign
1873 });
1874
1875 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
1876
1877 // `Object.{ entries, values }` methods implementation
1878 var createMethod$3 = function (TO_ENTRIES) {
1879 return function (it) {
1880 var O = toIndexedObject(it);
1881 var keys = objectKeys(O);
1882 var length = keys.length;
1883 var i = 0;
1884 var result = [];
1885 var key;
1886 while (length > i) {
1887 key = keys[i++];
1888 if (!descriptors || propertyIsEnumerable.call(O, key)) {
1889 result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
1890 }
1891 }
1892 return result;
1893 };
1894 };
1895
1896 var objectToArray = {
1897 // `Object.entries` method
1898 // https://tc39.github.io/ecma262/#sec-object.entries
1899 entries: createMethod$3(true),
1900 // `Object.values` method
1901 // https://tc39.github.io/ecma262/#sec-object.values
1902 values: createMethod$3(false)
1903 };
1904
1905 var $entries = objectToArray.entries;
1906
1907 // `Object.entries` method
1908 // https://tc39.github.io/ecma262/#sec-object.entries
1909 _export({ target: 'Object', stat: true }, {
1910 entries: function entries(O) {
1911 return $entries(O);
1912 }
1913 });
1914
1915 var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1916 var test$2 = {};
1917
1918 test$2[TO_STRING_TAG$1] = 'z';
1919
1920 var toStringTagSupport = String(test$2) === '[object z]';
1921
1922 var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
1923 // ES3 wrong here
1924 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1925
1926 // fallback for IE11 Script Access Denied error
1927 var tryGet = function (it, key) {
1928 try {
1929 return it[key];
1930 } catch (error) { /* empty */ }
1931 };
1932
1933 // getting tag from ES6+ `Object.prototype.toString`
1934 var classof = toStringTagSupport ? classofRaw : function (it) {
1935 var O, tag, result;
1936 return it === undefined ? 'Undefined' : it === null ? 'Null'
1937 // @@toStringTag case
1938 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag
1939 // builtinTag case
1940 : CORRECT_ARGUMENTS ? classofRaw(O)
1941 // ES3 arguments fallback
1942 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
1943 };
1944
1945 // `Object.prototype.toString` method implementation
1946 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1947 var objectToString = toStringTagSupport ? {}.toString : function toString() {
1948 return '[object ' + classof(this) + ']';
1949 };
1950
1951 // `Object.prototype.toString` method
1952 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1953 if (!toStringTagSupport) {
1954 redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
1955 }
1956
1957 var trim$1 = stringTrim.trim;
1958
1959
1960 var nativeParseFloat = global_1.parseFloat;
1961 var FORCED$2 = 1 / nativeParseFloat(whitespaces + '-0') !== -Infinity;
1962
1963 // `parseFloat` method
1964 // https://tc39.github.io/ecma262/#sec-parsefloat-string
1965 var _parseFloat = FORCED$2 ? function parseFloat(string) {
1966 var trimmedString = trim$1(String(string));
1967 var result = nativeParseFloat(trimmedString);
1968 return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
1969 } : nativeParseFloat;
1970
1971 // `parseFloat` method
1972 // https://tc39.github.io/ecma262/#sec-parsefloat-string
1973 _export({ global: true, forced: parseFloat != _parseFloat }, {
1974 parseFloat: _parseFloat
1975 });
1976
1977 var trim$2 = stringTrim.trim;
1978
1979
1980 var nativeParseInt = global_1.parseInt;
1981 var hex = /^[+-]?0[Xx]/;
1982 var FORCED$3 = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;
1983
1984 // `parseInt` method
1985 // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1986 var _parseInt = FORCED$3 ? function parseInt(string, radix) {
1987 var S = trim$2(String(string));
1988 return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
1989 } : nativeParseInt;
1990
1991 // `parseInt` method
1992 // https://tc39.github.io/ecma262/#sec-parseint-string-radix
1993 _export({ global: true, forced: parseInt != _parseInt }, {
1994 parseInt: _parseInt
1995 });
1996
1997 // `RegExp.prototype.flags` getter implementation
1998 // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
1999 var regexpFlags = function () {
2000 var that = anObject(this);
2001 var result = '';
2002 if (that.global) result += 'g';
2003 if (that.ignoreCase) result += 'i';
2004 if (that.multiline) result += 'm';
2005 if (that.dotAll) result += 's';
2006 if (that.unicode) result += 'u';
2007 if (that.sticky) result += 'y';
2008 return result;
2009 };
2010
2011 // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
2012 // so we use an intermediate function.
2013 function RE(s, f) {
2014 return RegExp(s, f);
2015 }
2016
2017 var UNSUPPORTED_Y = fails(function () {
2018 // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
2019 var re = RE('a', 'y');
2020 re.lastIndex = 2;
2021 return re.exec('abcd') != null;
2022 });
2023
2024 var BROKEN_CARET = fails(function () {
2025 // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
2026 var re = RE('^r', 'gy');
2027 re.lastIndex = 2;
2028 return re.exec('str') != null;
2029 });
2030
2031 var regexpStickyHelpers = {
2032 UNSUPPORTED_Y: UNSUPPORTED_Y,
2033 BROKEN_CARET: BROKEN_CARET
2034 };
2035
2036 var nativeExec = RegExp.prototype.exec;
2037 // This always refers to the native implementation, because the
2038 // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
2039 // which loads this file before patching the method.
2040 var nativeReplace = String.prototype.replace;
2041
2042 var patchedExec = nativeExec;
2043
2044 var UPDATES_LAST_INDEX_WRONG = (function () {
2045 var re1 = /a/;
2046 var re2 = /b*/g;
2047 nativeExec.call(re1, 'a');
2048 nativeExec.call(re2, 'a');
2049 return re1.lastIndex !== 0 || re2.lastIndex !== 0;
2050 })();
2051
2052 var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
2053
2054 // nonparticipating capturing group, copied from es5-shim's String#split patch.
2055 var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
2056
2057 var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
2058
2059 if (PATCH) {
2060 patchedExec = function exec(str) {
2061 var re = this;
2062 var lastIndex, reCopy, match, i;
2063 var sticky = UNSUPPORTED_Y$1 && re.sticky;
2064 var flags = regexpFlags.call(re);
2065 var source = re.source;
2066 var charsAdded = 0;
2067 var strCopy = str;
2068
2069 if (sticky) {
2070 flags = flags.replace('y', '');
2071 if (flags.indexOf('g') === -1) {
2072 flags += 'g';
2073 }
2074
2075 strCopy = String(str).slice(re.lastIndex);
2076 // Support anchored sticky behavior.
2077 if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
2078 source = '(?: ' + source + ')';
2079 strCopy = ' ' + strCopy;
2080 charsAdded++;
2081 }
2082 // ^(? + rx + ) is needed, in combination with some str slicing, to
2083 // simulate the 'y' flag.
2084 reCopy = new RegExp('^(?:' + source + ')', flags);
2085 }
2086
2087 if (NPCG_INCLUDED) {
2088 reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
2089 }
2090 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
2091
2092 match = nativeExec.call(sticky ? reCopy : re, strCopy);
2093
2094 if (sticky) {
2095 if (match) {
2096 match.input = match.input.slice(charsAdded);
2097 match[0] = match[0].slice(charsAdded);
2098 match.index = re.lastIndex;
2099 re.lastIndex += match[0].length;
2100 } else re.lastIndex = 0;
2101 } else if (UPDATES_LAST_INDEX_WRONG && match) {
2102 re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
2103 }
2104 if (NPCG_INCLUDED && match && match.length > 1) {
2105 // Fix browsers whose `exec` methods don't consistently return `undefined`
2106 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
2107 nativeReplace.call(match[0], reCopy, function () {
2108 for (i = 1; i < arguments.length - 2; i++) {
2109 if (arguments[i] === undefined) match[i] = undefined;
2110 }
2111 });
2112 }
2113
2114 return match;
2115 };
2116 }
2117
2118 var regexpExec = patchedExec;
2119
2120 _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
2121 exec: regexpExec
2122 });
2123
2124 var TO_STRING = 'toString';
2125 var RegExpPrototype = RegExp.prototype;
2126 var nativeToString = RegExpPrototype[TO_STRING];
2127
2128 var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
2129 // FF44- RegExp#toString has a wrong name
2130 var INCORRECT_NAME = nativeToString.name != TO_STRING;
2131
2132 // `RegExp.prototype.toString` method
2133 // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
2134 if (NOT_GENERIC || INCORRECT_NAME) {
2135 redefine(RegExp.prototype, TO_STRING, function toString() {
2136 var R = anObject(this);
2137 var p = String(R.source);
2138 var rf = R.flags;
2139 var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
2140 return '/' + p + '/' + f;
2141 }, { unsafe: true });
2142 }
2143
2144 var MATCH = wellKnownSymbol('match');
2145
2146 // `IsRegExp` abstract operation
2147 // https://tc39.github.io/ecma262/#sec-isregexp
2148 var isRegexp = function (it) {
2149 var isRegExp;
2150 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
2151 };
2152
2153 var notARegexp = function (it) {
2154 if (isRegexp(it)) {
2155 throw TypeError("The method doesn't accept regular expressions");
2156 } return it;
2157 };
2158
2159 var MATCH$1 = wellKnownSymbol('match');
2160
2161 var correctIsRegexpLogic = function (METHOD_NAME) {
2162 var regexp = /./;
2163 try {
2164 '/./'[METHOD_NAME](regexp);
2165 } catch (e) {
2166 try {
2167 regexp[MATCH$1] = false;
2168 return '/./'[METHOD_NAME](regexp);
2169 } catch (f) { /* empty */ }
2170 } return false;
2171 };
2172
2173 // `String.prototype.includes` method
2174 // https://tc39.github.io/ecma262/#sec-string.prototype.includes
2175 _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
2176 includes: function includes(searchString /* , position = 0 */) {
2177 return !!~String(requireObjectCoercible(this))
2178 .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
2179 }
2180 });
2181
2182 // `String.prototype.{ codePointAt, at }` methods implementation
2183 var createMethod$4 = function (CONVERT_TO_STRING) {
2184 return function ($this, pos) {
2185 var S = String(requireObjectCoercible($this));
2186 var position = toInteger(pos);
2187 var size = S.length;
2188 var first, second;
2189 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
2190 first = S.charCodeAt(position);
2191 return first < 0xD800 || first > 0xDBFF || position + 1 === size
2192 || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
2193 ? CONVERT_TO_STRING ? S.charAt(position) : first
2194 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
2195 };
2196 };
2197
2198 var stringMultibyte = {
2199 // `String.prototype.codePointAt` method
2200 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
2201 codeAt: createMethod$4(false),
2202 // `String.prototype.at` method
2203 // https://github.com/mathiasbynens/String.prototype.at
2204 charAt: createMethod$4(true)
2205 };
2206
2207 var charAt = stringMultibyte.charAt;
2208
2209
2210
2211 var STRING_ITERATOR = 'String Iterator';
2212 var setInternalState$2 = internalState.set;
2213 var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
2214
2215 // `String.prototype[@@iterator]` method
2216 // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
2217 defineIterator(String, 'String', function (iterated) {
2218 setInternalState$2(this, {
2219 type: STRING_ITERATOR,
2220 string: String(iterated),
2221 index: 0
2222 });
2223 // `%StringIteratorPrototype%.next` method
2224 // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
2225 }, function next() {
2226 var state = getInternalState$2(this);
2227 var string = state.string;
2228 var index = state.index;
2229 var point;
2230 if (index >= string.length) return { value: undefined, done: true };
2231 point = charAt(string, index);
2232 state.index += point.length;
2233 return { value: point, done: false };
2234 });
2235
2236 var SPECIES$3 = wellKnownSymbol('species');
2237
2238 var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
2239 // #replace needs built-in support for named groups.
2240 // #match works fine because it just return the exec results, even if it has
2241 // a "grops" property.
2242 var re = /./;
2243 re.exec = function () {
2244 var result = [];
2245 result.groups = { a: '7' };
2246 return result;
2247 };
2248 return ''.replace(re, '$<a>') !== '7';
2249 });
2250
2251 // IE <= 11 replaces $0 with the whole match, as if it was $&
2252 // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
2253 var REPLACE_KEEPS_$0 = (function () {
2254 return 'a'.replace(/./, '$0') === '$0';
2255 })();
2256
2257 // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
2258 // Weex JS has frozen built-in prototypes, so use try / catch wrapper
2259 var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
2260 var re = /(?:)/;
2261 var originalExec = re.exec;
2262 re.exec = function () { return originalExec.apply(this, arguments); };
2263 var result = 'ab'.split(re);
2264 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
2265 });
2266
2267 var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
2268 var SYMBOL = wellKnownSymbol(KEY);
2269
2270 var DELEGATES_TO_SYMBOL = !fails(function () {
2271 // String methods call symbol-named RegEp methods
2272 var O = {};
2273 O[SYMBOL] = function () { return 7; };
2274 return ''[KEY](O) != 7;
2275 });
2276
2277 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
2278 // Symbol-named RegExp methods call .exec
2279 var execCalled = false;
2280 var re = /a/;
2281
2282 if (KEY === 'split') {
2283 // We can't use real regex here since it causes deoptimization
2284 // and serious performance degradation in V8
2285 // https://github.com/zloirock/core-js/issues/306
2286 re = {};
2287 // RegExp[@@split] doesn't call the regex's exec method, but first creates
2288 // a new one. We need to return the patched regex when creating the new one.
2289 re.constructor = {};
2290 re.constructor[SPECIES$3] = function () { return re; };
2291 re.flags = '';
2292 re[SYMBOL] = /./[SYMBOL];
2293 }
2294
2295 re.exec = function () { execCalled = true; return null; };
2296
2297 re[SYMBOL]('');
2298 return !execCalled;
2299 });
2300
2301 if (
2302 !DELEGATES_TO_SYMBOL ||
2303 !DELEGATES_TO_EXEC ||
2304 (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) ||
2305 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
2306 ) {
2307 var nativeRegExpMethod = /./[SYMBOL];
2308 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
2309 if (regexp.exec === regexpExec) {
2310 if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
2311 // The native String method already delegates to @@method (this
2312 // polyfilled function), leasing to infinite recursion.
2313 // We avoid it by directly calling the native @@method method.
2314 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
2315 }
2316 return { done: true, value: nativeMethod.call(str, regexp, arg2) };
2317 }
2318 return { done: false };
2319 }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 });
2320 var stringMethod = methods[0];
2321 var regexMethod = methods[1];
2322
2323 redefine(String.prototype, KEY, stringMethod);
2324 redefine(RegExp.prototype, SYMBOL, length == 2
2325 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
2326 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
2327 ? function (string, arg) { return regexMethod.call(string, this, arg); }
2328 // 21.2.5.6 RegExp.prototype[@@match](string)
2329 // 21.2.5.9 RegExp.prototype[@@search](string)
2330 : function (string) { return regexMethod.call(string, this); }
2331 );
2332 }
2333
2334 if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
2335 };
2336
2337 var charAt$1 = stringMultibyte.charAt;
2338
2339 // `AdvanceStringIndex` abstract operation
2340 // https://tc39.github.io/ecma262/#sec-advancestringindex
2341 var advanceStringIndex = function (S, index, unicode) {
2342 return index + (unicode ? charAt$1(S, index).length : 1);
2343 };
2344
2345 // `RegExpExec` abstract operation
2346 // https://tc39.github.io/ecma262/#sec-regexpexec
2347 var regexpExecAbstract = function (R, S) {
2348 var exec = R.exec;
2349 if (typeof exec === 'function') {
2350 var result = exec.call(R, S);
2351 if (typeof result !== 'object') {
2352 throw TypeError('RegExp exec method returned something other than an Object or null');
2353 }
2354 return result;
2355 }
2356
2357 if (classofRaw(R) !== 'RegExp') {
2358 throw TypeError('RegExp#exec called on incompatible receiver');
2359 }
2360
2361 return regexpExec.call(R, S);
2362 };
2363
2364 var max$3 = Math.max;
2365 var min$3 = Math.min;
2366 var floor$1 = Math.floor;
2367 var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
2368 var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
2369
2370 var maybeToString = function (it) {
2371 return it === undefined ? it : String(it);
2372 };
2373
2374 // @@replace logic
2375 fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
2376 return [
2377 // `String.prototype.replace` method
2378 // https://tc39.github.io/ecma262/#sec-string.prototype.replace
2379 function replace(searchValue, replaceValue) {
2380 var O = requireObjectCoercible(this);
2381 var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
2382 return replacer !== undefined
2383 ? replacer.call(searchValue, O, replaceValue)
2384 : nativeReplace.call(String(O), searchValue, replaceValue);
2385 },
2386 // `RegExp.prototype[@@replace]` method
2387 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
2388 function (regexp, replaceValue) {
2389 if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) {
2390 var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
2391 if (res.done) return res.value;
2392 }
2393
2394 var rx = anObject(regexp);
2395 var S = String(this);
2396
2397 var functionalReplace = typeof replaceValue === 'function';
2398 if (!functionalReplace) replaceValue = String(replaceValue);
2399
2400 var global = rx.global;
2401 if (global) {
2402 var fullUnicode = rx.unicode;
2403 rx.lastIndex = 0;
2404 }
2405 var results = [];
2406 while (true) {
2407 var result = regexpExecAbstract(rx, S);
2408 if (result === null) break;
2409
2410 results.push(result);
2411 if (!global) break;
2412
2413 var matchStr = String(result[0]);
2414 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
2415 }
2416
2417 var accumulatedResult = '';
2418 var nextSourcePosition = 0;
2419 for (var i = 0; i < results.length; i++) {
2420 result = results[i];
2421
2422 var matched = String(result[0]);
2423 var position = max$3(min$3(toInteger(result.index), S.length), 0);
2424 var captures = [];
2425 // NOTE: This is equivalent to
2426 // captures = result.slice(1).map(maybeToString)
2427 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
2428 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
2429 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
2430 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
2431 var namedCaptures = result.groups;
2432 if (functionalReplace) {
2433 var replacerArgs = [matched].concat(captures, position, S);
2434 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
2435 var replacement = String(replaceValue.apply(undefined, replacerArgs));
2436 } else {
2437 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
2438 }
2439 if (position >= nextSourcePosition) {
2440 accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
2441 nextSourcePosition = position + matched.length;
2442 }
2443 }
2444 return accumulatedResult + S.slice(nextSourcePosition);
2445 }
2446 ];
2447
2448 // https://tc39.github.io/ecma262/#sec-getsubstitution
2449 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
2450 var tailPos = position + matched.length;
2451 var m = captures.length;
2452 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
2453 if (namedCaptures !== undefined) {
2454 namedCaptures = toObject(namedCaptures);
2455 symbols = SUBSTITUTION_SYMBOLS;
2456 }
2457 return nativeReplace.call(replacement, symbols, function (match, ch) {
2458 var capture;
2459 switch (ch.charAt(0)) {
2460 case '$': return '$';
2461 case '&': return matched;
2462 case '`': return str.slice(0, position);
2463 case "'": return str.slice(tailPos);
2464 case '<':
2465 capture = namedCaptures[ch.slice(1, -1)];
2466 break;
2467 default: // \d\d?
2468 var n = +ch;
2469 if (n === 0) return match;
2470 if (n > m) {
2471 var f = floor$1(n / 10);
2472 if (f === 0) return match;
2473 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
2474 return match;
2475 }
2476 capture = captures[n - 1];
2477 }
2478 return capture === undefined ? '' : capture;
2479 });
2480 }
2481 });
2482
2483 // `SameValue` abstract operation
2484 // https://tc39.github.io/ecma262/#sec-samevalue
2485 var sameValue = Object.is || function is(x, y) {
2486 // eslint-disable-next-line no-self-compare
2487 return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
2488 };
2489
2490 // @@search logic
2491 fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
2492 return [
2493 // `String.prototype.search` method
2494 // https://tc39.github.io/ecma262/#sec-string.prototype.search
2495 function search(regexp) {
2496 var O = requireObjectCoercible(this);
2497 var searcher = regexp == undefined ? undefined : regexp[SEARCH];
2498 return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
2499 },
2500 // `RegExp.prototype[@@search]` method
2501 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
2502 function (regexp) {
2503 var res = maybeCallNative(nativeSearch, regexp, this);
2504 if (res.done) return res.value;
2505
2506 var rx = anObject(regexp);
2507 var S = String(this);
2508
2509 var previousLastIndex = rx.lastIndex;
2510 if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
2511 var result = regexpExecAbstract(rx, S);
2512 if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
2513 return result === null ? -1 : result.index;
2514 }
2515 ];
2516 });
2517
2518 var SPECIES$4 = wellKnownSymbol('species');
2519
2520 // `SpeciesConstructor` abstract operation
2521 // https://tc39.github.io/ecma262/#sec-speciesconstructor
2522 var speciesConstructor = function (O, defaultConstructor) {
2523 var C = anObject(O).constructor;
2524 var S;
2525 return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);
2526 };
2527
2528 var arrayPush = [].push;
2529 var min$4 = Math.min;
2530 var MAX_UINT32 = 0xFFFFFFFF;
2531
2532 // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
2533 var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
2534
2535 // @@split logic
2536 fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
2537 var internalSplit;
2538 if (
2539 'abbc'.split(/(b)*/)[1] == 'c' ||
2540 'test'.split(/(?:)/, -1).length != 4 ||
2541 'ab'.split(/(?:ab)*/).length != 2 ||
2542 '.'.split(/(.?)(.?)/).length != 4 ||
2543 '.'.split(/()()/).length > 1 ||
2544 ''.split(/.?/).length
2545 ) {
2546 // based on es5-shim implementation, need to rework it
2547 internalSplit = function (separator, limit) {
2548 var string = String(requireObjectCoercible(this));
2549 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2550 if (lim === 0) return [];
2551 if (separator === undefined) return [string];
2552 // If `separator` is not a regex, use native split
2553 if (!isRegexp(separator)) {
2554 return nativeSplit.call(string, separator, lim);
2555 }
2556 var output = [];
2557 var flags = (separator.ignoreCase ? 'i' : '') +
2558 (separator.multiline ? 'm' : '') +
2559 (separator.unicode ? 'u' : '') +
2560 (separator.sticky ? 'y' : '');
2561 var lastLastIndex = 0;
2562 // Make `global` and avoid `lastIndex` issues by working with a copy
2563 var separatorCopy = new RegExp(separator.source, flags + 'g');
2564 var match, lastIndex, lastLength;
2565 while (match = regexpExec.call(separatorCopy, string)) {
2566 lastIndex = separatorCopy.lastIndex;
2567 if (lastIndex > lastLastIndex) {
2568 output.push(string.slice(lastLastIndex, match.index));
2569 if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
2570 lastLength = match[0].length;
2571 lastLastIndex = lastIndex;
2572 if (output.length >= lim) break;
2573 }
2574 if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
2575 }
2576 if (lastLastIndex === string.length) {
2577 if (lastLength || !separatorCopy.test('')) output.push('');
2578 } else output.push(string.slice(lastLastIndex));
2579 return output.length > lim ? output.slice(0, lim) : output;
2580 };
2581 // Chakra, V8
2582 } else if ('0'.split(undefined, 0).length) {
2583 internalSplit = function (separator, limit) {
2584 return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
2585 };
2586 } else internalSplit = nativeSplit;
2587
2588 return [
2589 // `String.prototype.split` method
2590 // https://tc39.github.io/ecma262/#sec-string.prototype.split
2591 function split(separator, limit) {
2592 var O = requireObjectCoercible(this);
2593 var splitter = separator == undefined ? undefined : separator[SPLIT];
2594 return splitter !== undefined
2595 ? splitter.call(separator, O, limit)
2596 : internalSplit.call(String(O), separator, limit);
2597 },
2598 // `RegExp.prototype[@@split]` method
2599 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
2600 //
2601 // NOTE: This cannot be properly polyfilled in engines that don't support
2602 // the 'y' flag.
2603 function (regexp, limit) {
2604 var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
2605 if (res.done) return res.value;
2606
2607 var rx = anObject(regexp);
2608 var S = String(this);
2609 var C = speciesConstructor(rx, RegExp);
2610
2611 var unicodeMatching = rx.unicode;
2612 var flags = (rx.ignoreCase ? 'i' : '') +
2613 (rx.multiline ? 'm' : '') +
2614 (rx.unicode ? 'u' : '') +
2615 (SUPPORTS_Y ? 'y' : 'g');
2616
2617 // ^(? + rx + ) is needed, in combination with some S slicing, to
2618 // simulate the 'y' flag.
2619 var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
2620 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2621 if (lim === 0) return [];
2622 if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
2623 var p = 0;
2624 var q = 0;
2625 var A = [];
2626 while (q < S.length) {
2627 splitter.lastIndex = SUPPORTS_Y ? q : 0;
2628 var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
2629 var e;
2630 if (
2631 z === null ||
2632 (e = min$4(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
2633 ) {
2634 q = advanceStringIndex(S, q, unicodeMatching);
2635 } else {
2636 A.push(S.slice(p, q));
2637 if (A.length === lim) return A;
2638 for (var i = 1; i <= z.length - 1; i++) {
2639 A.push(z[i]);
2640 if (A.length === lim) return A;
2641 }
2642 q = p = e;
2643 }
2644 }
2645 A.push(S.slice(p));
2646 return A;
2647 }
2648 ];
2649 }, !SUPPORTS_Y);
2650
2651 var non = '\u200B\u0085\u180E';
2652
2653 // check that a method works with the correct list
2654 // of whitespaces and has a correct name
2655 var forcedStringTrimMethod = function (METHOD_NAME) {
2656 return fails(function () {
2657 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
2658 });
2659 };
2660
2661 var $trim = stringTrim.trim;
2662
2663
2664 // `String.prototype.trim` method
2665 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
2666 _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
2667 trim: function trim() {
2668 return $trim(this);
2669 }
2670 });
2671
2672 // iterable DOM collections
2673 // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2674 var domIterables = {
2675 CSSRuleList: 0,
2676 CSSStyleDeclaration: 0,
2677 CSSValueList: 0,
2678 ClientRectList: 0,
2679 DOMRectList: 0,
2680 DOMStringList: 0,
2681 DOMTokenList: 1,
2682 DataTransferItemList: 0,
2683 FileList: 0,
2684 HTMLAllCollection: 0,
2685 HTMLCollection: 0,
2686 HTMLFormElement: 0,
2687 HTMLSelectElement: 0,
2688 MediaList: 0,
2689 MimeTypeArray: 0,
2690 NamedNodeMap: 0,
2691 NodeList: 1,
2692 PaintRequestList: 0,
2693 Plugin: 0,
2694 PluginArray: 0,
2695 SVGLengthList: 0,
2696 SVGNumberList: 0,
2697 SVGPathSegList: 0,
2698 SVGPointList: 0,
2699 SVGStringList: 0,
2700 SVGTransformList: 0,
2701 SourceBufferList: 0,
2702 StyleSheetList: 0,
2703 TextTrackCueList: 0,
2704 TextTrackList: 0,
2705 TouchList: 0
2706 };
2707
2708 var $forEach$1 = arrayIteration.forEach;
2709
2710
2711 // `Array.prototype.forEach` method implementation
2712 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
2713 var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
2714 return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2715 } : [].forEach;
2716
2717 for (var COLLECTION_NAME in domIterables) {
2718 var Collection = global_1[COLLECTION_NAME];
2719 var CollectionPrototype = Collection && Collection.prototype;
2720 // some Chrome versions have non-configurable methods on DOMTokenList
2721 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
2722 createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
2723 } catch (error) {
2724 CollectionPrototype.forEach = arrayForEach;
2725 }
2726 }
2727
2728 var ITERATOR$2 = wellKnownSymbol('iterator');
2729 var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
2730 var ArrayValues = es_array_iterator.values;
2731
2732 for (var COLLECTION_NAME$1 in domIterables) {
2733 var Collection$1 = global_1[COLLECTION_NAME$1];
2734 var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
2735 if (CollectionPrototype$1) {
2736 // some Chrome versions have non-configurable methods on DOMTokenList
2737 if (CollectionPrototype$1[ITERATOR$2] !== ArrayValues) try {
2738 createNonEnumerableProperty(CollectionPrototype$1, ITERATOR$2, ArrayValues);
2739 } catch (error) {
2740 CollectionPrototype$1[ITERATOR$2] = ArrayValues;
2741 }
2742 if (!CollectionPrototype$1[TO_STRING_TAG$3]) {
2743 createNonEnumerableProperty(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1);
2744 }
2745 if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) {
2746 // some Chrome versions have non-configurable methods on DOMTokenList
2747 if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
2748 createNonEnumerableProperty(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);
2749 } catch (error) {
2750 CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];
2751 }
2752 }
2753 }
2754 }
2755
2756 function _typeof(obj) {
2757 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2758 _typeof = function (obj) {
2759 return typeof obj;
2760 };
2761 } else {
2762 _typeof = function (obj) {
2763 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2764 };
2765 }
2766
2767 return _typeof(obj);
2768 }
2769
2770 function _classCallCheck(instance, Constructor) {
2771 if (!(instance instanceof Constructor)) {
2772 throw new TypeError("Cannot call a class as a function");
2773 }
2774 }
2775
2776 function _defineProperties(target, props) {
2777 for (var i = 0; i < props.length; i++) {
2778 var descriptor = props[i];
2779 descriptor.enumerable = descriptor.enumerable || false;
2780 descriptor.configurable = true;
2781 if ("value" in descriptor) descriptor.writable = true;
2782 Object.defineProperty(target, descriptor.key, descriptor);
2783 }
2784 }
2785
2786 function _createClass(Constructor, protoProps, staticProps) {
2787 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2788 if (staticProps) _defineProperties(Constructor, staticProps);
2789 return Constructor;
2790 }
2791
2792 function _slicedToArray(arr, i) {
2793 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
2794 }
2795
2796 function _toConsumableArray(arr) {
2797 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
2798 }
2799
2800 function _arrayWithoutHoles(arr) {
2801 if (Array.isArray(arr)) {
2802 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
2803
2804 return arr2;
2805 }
2806 }
2807
2808 function _arrayWithHoles(arr) {
2809 if (Array.isArray(arr)) return arr;
2810 }
2811
2812 function _iterableToArray(iter) {
2813 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
2814 }
2815
2816 function _iterableToArrayLimit(arr, i) {
2817 if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
2818 return;
2819 }
2820
2821 var _arr = [];
2822 var _n = true;
2823 var _d = false;
2824 var _e = undefined;
2825
2826 try {
2827 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
2828 _arr.push(_s.value);
2829
2830 if (i && _arr.length === i) break;
2831 }
2832 } catch (err) {
2833 _d = true;
2834 _e = err;
2835 } finally {
2836 try {
2837 if (!_n && _i["return"] != null) _i["return"]();
2838 } finally {
2839 if (_d) throw _e;
2840 }
2841 }
2842
2843 return _arr;
2844 }
2845
2846 function _nonIterableSpread() {
2847 throw new TypeError("Invalid attempt to spread non-iterable instance");
2848 }
2849
2850 function _nonIterableRest() {
2851 throw new TypeError("Invalid attempt to destructure non-iterable instance");
2852 }
2853
2854 var VERSION = '1.16.0';
2855 var bootstrapVersion = 4;
2856
2857 try {
2858 var rawVersion = $.fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined.
2859 // It is undefined in older versions of Bootstrap (tested with 3.1.1).
2860
2861 if (rawVersion !== undefined) {
2862 bootstrapVersion = parseInt(rawVersion, 10);
2863 }
2864 } catch (e) {// ignore
2865 }
2866
2867 var CONSTANTS = {
2868 3: {
2869 iconsPrefix: 'glyphicon',
2870 icons: {
2871 paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
2872 paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
2873 refresh: 'glyphicon-refresh icon-refresh',
2874 toggleOff: 'glyphicon-list-alt icon-list-alt',
2875 toggleOn: 'glyphicon-list-alt icon-list-alt',
2876 columns: 'glyphicon-th icon-th',
2877 detailOpen: 'glyphicon-plus icon-plus',
2878 detailClose: 'glyphicon-minus icon-minus',
2879 fullscreen: 'glyphicon-fullscreen',
2880 search: 'glyphicon-search',
2881 clearSearch: 'glyphicon-trash'
2882 },
2883 classes: {
2884 buttonsPrefix: 'btn',
2885 buttons: 'default',
2886 buttonsGroup: 'btn-group',
2887 buttonsDropdown: 'btn-group',
2888 pull: 'pull',
2889 inputGroup: 'input-group',
2890 inputPrefix: 'input-',
2891 input: 'form-control',
2892 paginationDropdown: 'btn-group dropdown',
2893 dropup: 'dropup',
2894 dropdownActive: 'active',
2895 paginationActive: 'active',
2896 buttonActive: 'active'
2897 },
2898 html: {
2899 toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
2900 toolbarDropdownItem: '<li class="dropdown-item-marker" role="menuitem"><label>%s</label></li>',
2901 toolbarDropdownSeparator: '<li class="divider"></li>',
2902 pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
2903 pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
2904 dropdownCaret: '<span class="caret"></span>',
2905 pagination: ['<ul class="pagination%s">', '</ul>'],
2906 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
2907 icon: '<i class="%s %s"></i>',
2908 inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
2909 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
2910 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
2911 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
2912 }
2913 },
2914 4: {
2915 iconsPrefix: 'fa',
2916 icons: {
2917 paginationSwitchDown: 'fa-caret-square-down',
2918 paginationSwitchUp: 'fa-caret-square-up',
2919 refresh: 'fa-sync',
2920 toggleOff: 'fa-toggle-off',
2921 toggleOn: 'fa-toggle-on',
2922 columns: 'fa-th-list',
2923 detailOpen: 'fa-plus',
2924 detailClose: 'fa-minus',
2925 fullscreen: 'fa-arrows-alt',
2926 search: 'fa-search',
2927 clearSearch: 'fa-trash'
2928 },
2929 classes: {
2930 buttonsPrefix: 'btn',
2931 buttons: 'secondary',
2932 buttonsGroup: 'btn-group',
2933 buttonsDropdown: 'btn-group',
2934 pull: 'float',
2935 inputGroup: 'btn-group',
2936 inputPrefix: 'form-control-',
2937 input: 'form-control',
2938 paginationDropdown: 'btn-group dropdown',
2939 dropup: 'dropup',
2940 dropdownActive: 'active',
2941 paginationActive: 'active',
2942 buttonActive: 'active'
2943 },
2944 html: {
2945 toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
2946 toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
2947 pageDropdown: ['<div class="dropdown-menu">', '</div>'],
2948 pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
2949 toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
2950 dropdownCaret: '<span class="caret"></span>',
2951 pagination: ['<ul class="pagination%s">', '</ul>'],
2952 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
2953 icon: '<i class="%s %s"></i>',
2954 inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
2955 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
2956 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
2957 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
2958 }
2959 }
2960 }[bootstrapVersion];
2961 var DEFAULTS = {
2962 height: undefined,
2963 classes: 'table table-bordered table-hover',
2964 theadClasses: '',
2965 headerStyle: function headerStyle(column) {
2966 return {};
2967 },
2968 rowStyle: function rowStyle(row, index) {
2969 return {};
2970 },
2971 rowAttributes: function rowAttributes(row, index) {
2972 return {};
2973 },
2974 undefinedText: '-',
2975 locale: undefined,
2976 virtualScroll: false,
2977 virtualScrollItemHeight: undefined,
2978 sortable: true,
2979 sortClass: undefined,
2980 silentSort: true,
2981 sortName: undefined,
2982 sortOrder: 'asc',
2983 sortStable: false,
2984 rememberOrder: false,
2985 serverSort: true,
2986 customSort: undefined,
2987 columns: [[]],
2988 data: [],
2989 url: undefined,
2990 method: 'get',
2991 cache: true,
2992 contentType: 'application/json',
2993 dataType: 'json',
2994 ajax: undefined,
2995 ajaxOptions: {},
2996 queryParams: function queryParams(params) {
2997 return params;
2998 },
2999 queryParamsType: 'limit',
3000 // 'limit', undefined
3001 responseHandler: function responseHandler(res) {
3002 return res;
3003 },
3004 totalField: 'total',
3005 totalNotFilteredField: 'totalNotFiltered',
3006 dataField: 'rows',
3007 pagination: false,
3008 onlyInfoPagination: false,
3009 showExtendedPagination: false,
3010 paginationLoop: true,
3011 sidePagination: 'client',
3012 // client or server
3013 totalRows: 0,
3014 totalNotFiltered: 0,
3015 pageNumber: 1,
3016 pageSize: 10,
3017 pageList: [10, 25, 50, 100],
3018 paginationHAlign: 'right',
3019 // right, left
3020 paginationVAlign: 'bottom',
3021 // bottom, top, both
3022 paginationDetailHAlign: 'left',
3023 // right, left
3024 paginationPreText: '&lsaquo;',
3025 paginationNextText: '&rsaquo;',
3026 paginationSuccessivelySize: 5,
3027 // Maximum successively number of pages in a row
3028 paginationPagesBySide: 1,
3029 // Number of pages on each side (right, left) of the current page.
3030 paginationUseIntermediate: false,
3031 // Calculate intermediate pages for quick access
3032 search: false,
3033 searchOnEnterKey: false,
3034 strictSearch: false,
3035 visibleSearch: false,
3036 showButtonIcons: true,
3037 showButtonText: false,
3038 showSearchButton: false,
3039 showSearchClearButton: false,
3040 trimOnSearch: true,
3041 searchAlign: 'right',
3042 searchTimeOut: 500,
3043 searchText: '',
3044 customSearch: undefined,
3045 showHeader: true,
3046 showFooter: false,
3047 footerStyle: function footerStyle(column) {
3048 return {};
3049 },
3050 showColumns: false,
3051 showColumnsToggleAll: false,
3052 showColumnsSearch: false,
3053 minimumCountColumns: 1,
3054 showPaginationSwitch: false,
3055 showRefresh: false,
3056 showToggle: false,
3057 showFullscreen: false,
3058 smartDisplay: true,
3059 escape: false,
3060 filterOptions: {
3061 filterAlgorithm: 'and'
3062 },
3063 idField: undefined,
3064 selectItemName: 'btSelectItem',
3065 clickToSelect: false,
3066 ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) {
3067 var tagName = _ref.tagName;
3068 return ['A', 'BUTTON'].includes(tagName);
3069 },
3070 singleSelect: false,
3071 checkboxHeader: true,
3072 maintainMetaData: false,
3073 multipleSelectRow: false,
3074 uniqueId: undefined,
3075 cardView: false,
3076 detailView: false,
3077 detailViewIcon: true,
3078 detailViewByClick: false,
3079 detailFormatter: function detailFormatter(index, row) {
3080 return '';
3081 },
3082 detailFilter: function detailFilter(index, row) {
3083 return true;
3084 },
3085 toolbar: undefined,
3086 toolbarAlign: 'left',
3087 buttonsToolbar: undefined,
3088 buttonsAlign: 'right',
3089 buttonsOrder: ['paginationSwitch', 'refresh', 'toggle', 'fullscreen', 'columns'],
3090 buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
3091 buttonsClass: CONSTANTS.classes.buttons,
3092 icons: CONSTANTS.icons,
3093 html: CONSTANTS.html,
3094 iconSize: undefined,
3095 iconsPrefix: CONSTANTS.iconsPrefix,
3096 // glyphicon or fa(font-awesome)
3097 onAll: function onAll(name, args) {
3098 return false;
3099 },
3100 onClickCell: function onClickCell(field, value, row, $element) {
3101 return false;
3102 },
3103 onDblClickCell: function onDblClickCell(field, value, row, $element) {
3104 return false;
3105 },
3106 onClickRow: function onClickRow(item, $element) {
3107 return false;
3108 },
3109 onDblClickRow: function onDblClickRow(item, $element) {
3110 return false;
3111 },
3112 onSort: function onSort(name, order) {
3113 return false;
3114 },
3115 onCheck: function onCheck(row) {
3116 return false;
3117 },
3118 onUncheck: function onUncheck(row) {
3119 return false;
3120 },
3121 onCheckAll: function onCheckAll(rows) {
3122 return false;
3123 },
3124 onUncheckAll: function onUncheckAll(rows) {
3125 return false;
3126 },
3127 onCheckSome: function onCheckSome(rows) {
3128 return false;
3129 },
3130 onUncheckSome: function onUncheckSome(rows) {
3131 return false;
3132 },
3133 onLoadSuccess: function onLoadSuccess(data) {
3134 return false;
3135 },
3136 onLoadError: function onLoadError(status) {
3137 return false;
3138 },
3139 onColumnSwitch: function onColumnSwitch(field, checked) {
3140 return false;
3141 },
3142 onPageChange: function onPageChange(number, size) {
3143 return false;
3144 },
3145 onSearch: function onSearch(text) {
3146 return false;
3147 },
3148 onToggle: function onToggle(cardView) {
3149 return false;
3150 },
3151 onPreBody: function onPreBody(data) {
3152 return false;
3153 },
3154 onPostBody: function onPostBody() {
3155 return false;
3156 },
3157 onPostHeader: function onPostHeader() {
3158 return false;
3159 },
3160 onPostFooter: function onPostFooter() {
3161 return false;
3162 },
3163 onExpandRow: function onExpandRow(index, row, $detail) {
3164 return false;
3165 },
3166 onCollapseRow: function onCollapseRow(index, row) {
3167 return false;
3168 },
3169 onRefreshOptions: function onRefreshOptions(options) {
3170 return false;
3171 },
3172 onRefresh: function onRefresh(params) {
3173 return false;
3174 },
3175 onResetView: function onResetView() {
3176 return false;
3177 },
3178 onScrollBody: function onScrollBody() {
3179 return false;
3180 }
3181 };
3182 var EN = {
3183 formatLoadingMessage: function formatLoadingMessage() {
3184 return 'Loading, please wait';
3185 },
3186 formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
3187 return "".concat(pageNumber, " rows per page");
3188 },
3189 formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
3190 if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
3191 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)");
3192 }
3193
3194 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows");
3195 },
3196 formatSRPaginationPreText: function formatSRPaginationPreText() {
3197 return 'previous page';
3198 },
3199 formatSRPaginationPageText: function formatSRPaginationPageText(page) {
3200 return "to page ".concat(page);
3201 },
3202 formatSRPaginationNextText: function formatSRPaginationNextText() {
3203 return 'next page';
3204 },
3205 formatDetailPagination: function formatDetailPagination(totalRows) {
3206 return "Showing ".concat(totalRows, " rows");
3207 },
3208 formatSearch: function formatSearch() {
3209 return 'Search';
3210 },
3211 formatClearSearch: function formatClearSearch() {
3212 return 'Clear Search';
3213 },
3214 formatNoMatches: function formatNoMatches() {
3215 return 'No matching records found';
3216 },
3217 formatPaginationSwitch: function formatPaginationSwitch() {
3218 return 'Hide/Show pagination';
3219 },
3220 formatPaginationSwitchDown: function formatPaginationSwitchDown() {
3221 return 'Show pagination';
3222 },
3223 formatPaginationSwitchUp: function formatPaginationSwitchUp() {
3224 return 'Hide pagination';
3225 },
3226 formatRefresh: function formatRefresh() {
3227 return 'Refresh';
3228 },
3229 formatToggle: function formatToggle() {
3230 return 'Toggle';
3231 },
3232 formatToggleOn: function formatToggleOn() {
3233 return 'Show card view';
3234 },
3235 formatToggleOff: function formatToggleOff() {
3236 return 'Hide card view';
3237 },
3238 formatColumns: function formatColumns() {
3239 return 'Columns';
3240 },
3241 formatColumnsToggleAll: function formatColumnsToggleAll() {
3242 return 'Toggle all';
3243 },
3244 formatFullscreen: function formatFullscreen() {
3245 return 'Fullscreen';
3246 },
3247 formatAllRows: function formatAllRows() {
3248 return 'All';
3249 }
3250 };
3251 var COLUMN_DEFAULTS = {
3252 field: undefined,
3253 title: undefined,
3254 titleTooltip: undefined,
3255 'class': undefined,
3256 width: undefined,
3257 widthUnit: 'px',
3258 rowspan: undefined,
3259 colspan: undefined,
3260 align: undefined,
3261 // left, right, center
3262 halign: undefined,
3263 // left, right, center
3264 falign: undefined,
3265 // left, right, center
3266 valign: undefined,
3267 // top, middle, bottom
3268 cellStyle: undefined,
3269 radio: false,
3270 checkbox: false,
3271 checkboxEnabled: true,
3272 clickToSelect: true,
3273 showSelectTitle: false,
3274 sortable: false,
3275 sortName: undefined,
3276 order: 'asc',
3277 // asc, desc
3278 sorter: undefined,
3279 visible: true,
3280 switchable: true,
3281 cardVisible: true,
3282 searchable: true,
3283 formatter: undefined,
3284 footerFormatter: undefined,
3285 detailFormatter: undefined,
3286 searchFormatter: true,
3287 escape: false,
3288 events: undefined
3289 };
3290 var METHODS = ['getOptions', 'refreshOptions', 'getData', 'getSelections', 'getAllSelections', 'load', 'append', 'prepend', 'remove', 'removeAll', 'insertRow', 'updateRow', 'getRowByUniqueId', 'updateByUniqueId', 'removeByUniqueId', 'updateCell', 'updateCellByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', 'showColumn', 'hideColumn', 'getVisibleColumns', 'getHiddenColumns', 'showAllColumns', 'hideAllColumns', 'mergeCells', 'checkAll', 'uncheckAll', 'checkInvert', 'check', 'uncheck', 'checkBy', 'uncheckBy', 'refresh', 'destroy', 'resetView', 'showLoading', 'hideLoading', 'togglePagination', 'toggleFullscreen', 'toggleView', 'resetSearch', 'filterBy', 'scrollTo', 'getScrollPosition', 'selectPage', 'prevPage', 'nextPage', 'toggleDetailView', 'expandRow', 'collapseRow', 'expandAllRows', 'collapseAllRows', 'updateColumnTitle', 'updateFormatText'];
3291 var EVENTS = {
3292 'all.bs.table': 'onAll',
3293 'click-row.bs.table': 'onClickRow',
3294 'dbl-click-row.bs.table': 'onDblClickRow',
3295 'click-cell.bs.table': 'onClickCell',
3296 'dbl-click-cell.bs.table': 'onDblClickCell',
3297 'sort.bs.table': 'onSort',
3298 'check.bs.table': 'onCheck',
3299 'uncheck.bs.table': 'onUncheck',
3300 'check-all.bs.table': 'onCheckAll',
3301 'uncheck-all.bs.table': 'onUncheckAll',
3302 'check-some.bs.table': 'onCheckSome',
3303 'uncheck-some.bs.table': 'onUncheckSome',
3304 'load-success.bs.table': 'onLoadSuccess',
3305 'load-error.bs.table': 'onLoadError',
3306 'column-switch.bs.table': 'onColumnSwitch',
3307 'page-change.bs.table': 'onPageChange',
3308 'search.bs.table': 'onSearch',
3309 'toggle.bs.table': 'onToggle',
3310 'pre-body.bs.table': 'onPreBody',
3311 'post-body.bs.table': 'onPostBody',
3312 'post-header.bs.table': 'onPostHeader',
3313 'post-footer.bs.table': 'onPostFooter',
3314 'expand-row.bs.table': 'onExpandRow',
3315 'collapse-row.bs.table': 'onCollapseRow',
3316 'refresh-options.bs.table': 'onRefreshOptions',
3317 'reset-view.bs.table': 'onResetView',
3318 'refresh.bs.table': 'onRefresh',
3319 'scroll-body.bs.table': 'onScrollBody'
3320 };
3321 Object.assign(DEFAULTS, EN);
3322 var Constants = {
3323 VERSION: VERSION,
3324 THEME: "bootstrap".concat(bootstrapVersion),
3325 CONSTANTS: CONSTANTS,
3326 DEFAULTS: DEFAULTS,
3327 COLUMN_DEFAULTS: COLUMN_DEFAULTS,
3328 METHODS: METHODS,
3329 EVENTS: EVENTS,
3330 LOCALES: {
3331 en: EN,
3332 'en-US': EN
3333 }
3334 };
3335
3336 var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
3337
3338 // `Object.keys` method
3339 // https://tc39.github.io/ecma262/#sec-object.keys
3340 _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
3341 keys: function keys(it) {
3342 return objectKeys(toObject(it));
3343 }
3344 });
3345
3346 var Utils = {
3347 // it only does '%s', and return '' when arguments are undefined
3348 sprintf: function sprintf(_str) {
3349 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3350 args[_key - 1] = arguments[_key];
3351 }
3352
3353 var flag = true;
3354 var i = 0;
3355
3356 var str = _str.replace(/%s/g, function () {
3357 var arg = args[i++];
3358
3359 if (typeof arg === 'undefined') {
3360 flag = false;
3361 return '';
3362 }
3363
3364 return arg;
3365 });
3366
3367 return flag ? str : '';
3368 },
3369 isEmptyObject: function isEmptyObject() {
3370 var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3371 return Object.entries(obj).length === 0 && obj.constructor === Object;
3372 },
3373 isNumeric: function isNumeric(n) {
3374 return !isNaN(parseFloat(n)) && isFinite(n);
3375 },
3376 getFieldTitle: function getFieldTitle(list, value) {
3377 var _iteratorNormalCompletion = true;
3378 var _didIteratorError = false;
3379 var _iteratorError = undefined;
3380
3381 try {
3382 for (var _iterator = list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
3383 var item = _step.value;
3384
3385 if (item.field === value) {
3386 return item.title;
3387 }
3388 }
3389 } catch (err) {
3390 _didIteratorError = true;
3391 _iteratorError = err;
3392 } finally {
3393 try {
3394 if (!_iteratorNormalCompletion && _iterator.return != null) {
3395 _iterator.return();
3396 }
3397 } finally {
3398 if (_didIteratorError) {
3399 throw _iteratorError;
3400 }
3401 }
3402 }
3403
3404 return '';
3405 },
3406 setFieldIndex: function setFieldIndex(columns) {
3407 var totalCol = 0;
3408 var flag = [];
3409 var _iteratorNormalCompletion2 = true;
3410 var _didIteratorError2 = false;
3411 var _iteratorError2 = undefined;
3412
3413 try {
3414 for (var _iterator2 = columns[0][Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
3415 var column = _step2.value;
3416 totalCol += column.colspan || 1;
3417 }
3418 } catch (err) {
3419 _didIteratorError2 = true;
3420 _iteratorError2 = err;
3421 } finally {
3422 try {
3423 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
3424 _iterator2.return();
3425 }
3426 } finally {
3427 if (_didIteratorError2) {
3428 throw _iteratorError2;
3429 }
3430 }
3431 }
3432
3433 for (var i = 0; i < columns.length; i++) {
3434 flag[i] = [];
3435
3436 for (var j = 0; j < totalCol; j++) {
3437 flag[i][j] = false;
3438 }
3439 }
3440
3441 for (var _i = 0; _i < columns.length; _i++) {
3442 var _iteratorNormalCompletion3 = true;
3443 var _didIteratorError3 = false;
3444 var _iteratorError3 = undefined;
3445
3446 try {
3447 for (var _iterator3 = columns[_i][Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
3448 var r = _step3.value;
3449 var rowspan = r.rowspan || 1;
3450 var colspan = r.colspan || 1;
3451
3452 var index = flag[_i].indexOf(false);
3453
3454 r.colspanIndex = index;
3455
3456 if (colspan === 1) {
3457 r.fieldIndex = index; // when field is undefined, use index instead
3458
3459 if (typeof r.field === 'undefined') {
3460 r.field = index;
3461 }
3462 } else {
3463 r.colspanGroup = r.colspan;
3464 }
3465
3466 for (var k = 0; k < rowspan; k++) {
3467 flag[_i + k][index] = true;
3468 }
3469
3470 for (var _k = 0; _k < colspan; _k++) {
3471 flag[_i][index + _k] = true;
3472 }
3473 }
3474 } catch (err) {
3475 _didIteratorError3 = true;
3476 _iteratorError3 = err;
3477 } finally {
3478 try {
3479 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
3480 _iterator3.return();
3481 }
3482 } finally {
3483 if (_didIteratorError3) {
3484 throw _iteratorError3;
3485 }
3486 }
3487 }
3488 }
3489 },
3490 updateFieldGroup: function updateFieldGroup(columns) {
3491 var _ref;
3492
3493 var allColumns = (_ref = []).concat.apply(_ref, _toConsumableArray(columns));
3494
3495 var _iteratorNormalCompletion4 = true;
3496 var _didIteratorError4 = false;
3497 var _iteratorError4 = undefined;
3498
3499 try {
3500 for (var _iterator4 = columns[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
3501 var c = _step4.value;
3502 var _iteratorNormalCompletion5 = true;
3503 var _didIteratorError5 = false;
3504 var _iteratorError5 = undefined;
3505
3506 try {
3507 for (var _iterator5 = c[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
3508 var r = _step5.value;
3509
3510 if (r.colspanGroup > 1) {
3511 var colspan = 0;
3512
3513 var _loop = function _loop(i) {
3514 var column = allColumns.find(function (col) {
3515 return col.fieldIndex === i;
3516 });
3517
3518 if (column.visible) {
3519 colspan++;
3520 }
3521 };
3522
3523 for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) {
3524 _loop(i);
3525 }
3526
3527 r.colspan = colspan;
3528 r.visible = colspan > 0;
3529 }
3530 }
3531 } catch (err) {
3532 _didIteratorError5 = true;
3533 _iteratorError5 = err;
3534 } finally {
3535 try {
3536 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
3537 _iterator5.return();
3538 }
3539 } finally {
3540 if (_didIteratorError5) {
3541 throw _iteratorError5;
3542 }
3543 }
3544 }
3545 }
3546 } catch (err) {
3547 _didIteratorError4 = true;
3548 _iteratorError4 = err;
3549 } finally {
3550 try {
3551 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
3552 _iterator4.return();
3553 }
3554 } finally {
3555 if (_didIteratorError4) {
3556 throw _iteratorError4;
3557 }
3558 }
3559 }
3560 },
3561 getScrollBarWidth: function getScrollBarWidth() {
3562 if (this.cachedWidth === undefined) {
3563 var $inner = $('<div/>').addClass('fixed-table-scroll-inner');
3564 var $outer = $('<div/>').addClass('fixed-table-scroll-outer');
3565 $outer.append($inner);
3566 $('body').append($outer);
3567 var w1 = $inner[0].offsetWidth;
3568 $outer.css('overflow', 'scroll');
3569 var w2 = $inner[0].offsetWidth;
3570
3571 if (w1 === w2) {
3572 w2 = $outer[0].clientWidth;
3573 }
3574
3575 $outer.remove();
3576 this.cachedWidth = w1 - w2;
3577 }
3578
3579 return this.cachedWidth;
3580 },
3581 calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) {
3582 var func = name;
3583
3584 if (typeof name === 'string') {
3585 // support obj.func1.func2
3586 var names = name.split('.');
3587
3588 if (names.length > 1) {
3589 func = window;
3590 var _iteratorNormalCompletion6 = true;
3591 var _didIteratorError6 = false;
3592 var _iteratorError6 = undefined;
3593
3594 try {
3595 for (var _iterator6 = names[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
3596 var f = _step6.value;
3597 func = func[f];
3598 }
3599 } catch (err) {
3600 _didIteratorError6 = true;
3601 _iteratorError6 = err;
3602 } finally {
3603 try {
3604 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
3605 _iterator6.return();
3606 }
3607 } finally {
3608 if (_didIteratorError6) {
3609 throw _iteratorError6;
3610 }
3611 }
3612 }
3613 } else {
3614 func = window[name];
3615 }
3616 }
3617
3618 if (func !== null && _typeof(func) === 'object') {
3619 return func;
3620 }
3621
3622 if (typeof func === 'function') {
3623 return func.apply(self, args || []);
3624 }
3625
3626 if (!func && typeof name === 'string' && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) {
3627 return this.sprintf.apply(this, [name].concat(_toConsumableArray(args)));
3628 }
3629
3630 return defaultValue;
3631 },
3632 compareObjects: function compareObjects(objectA, objectB, compareLength) {
3633 var aKeys = Object.keys(objectA);
3634 var bKeys = Object.keys(objectB);
3635
3636 if (compareLength && aKeys.length !== bKeys.length) {
3637 return false;
3638 }
3639
3640 for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) {
3641 var key = _aKeys[_i2];
3642
3643 if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
3644 return false;
3645 }
3646 }
3647
3648 return true;
3649 },
3650 escapeHTML: function escapeHTML(text) {
3651 if (typeof text === 'string') {
3652 return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;').replace(/`/g, '&#x60;');
3653 }
3654
3655 return text;
3656 },
3657 getRealDataAttr: function getRealDataAttr(dataAttr) {
3658 for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) {
3659 var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
3660 attr = _Object$entries$_i[0],
3661 value = _Object$entries$_i[1];
3662
3663 var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
3664
3665 if (auxAttr !== attr) {
3666 dataAttr[auxAttr] = value;
3667 delete dataAttr[attr];
3668 }
3669 }
3670
3671 return dataAttr;
3672 },
3673 getItemField: function getItemField(item, field, escape) {
3674 var value = item;
3675
3676 if (typeof field !== 'string' || item.hasOwnProperty(field)) {
3677 return escape ? this.escapeHTML(item[field]) : item[field];
3678 }
3679
3680 var props = field.split('.');
3681 var _iteratorNormalCompletion7 = true;
3682 var _didIteratorError7 = false;
3683 var _iteratorError7 = undefined;
3684
3685 try {
3686 for (var _iterator7 = props[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
3687 var p = _step7.value;
3688 value = value && value[p];
3689 }
3690 } catch (err) {
3691 _didIteratorError7 = true;
3692 _iteratorError7 = err;
3693 } finally {
3694 try {
3695 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
3696 _iterator7.return();
3697 }
3698 } finally {
3699 if (_didIteratorError7) {
3700 throw _iteratorError7;
3701 }
3702 }
3703 }
3704
3705 return escape ? this.escapeHTML(value) : value;
3706 },
3707 isIEBrowser: function isIEBrowser() {
3708 return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent);
3709 },
3710 findIndex: function findIndex(items, item) {
3711 var _iteratorNormalCompletion8 = true;
3712 var _didIteratorError8 = false;
3713 var _iteratorError8 = undefined;
3714
3715 try {
3716 for (var _iterator8 = items[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
3717 var it = _step8.value;
3718
3719 if (JSON.stringify(it) === JSON.stringify(item)) {
3720 return items.indexOf(it);
3721 }
3722 }
3723 } catch (err) {
3724 _didIteratorError8 = true;
3725 _iteratorError8 = err;
3726 } finally {
3727 try {
3728 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
3729 _iterator8.return();
3730 }
3731 } finally {
3732 if (_didIteratorError8) {
3733 throw _iteratorError8;
3734 }
3735 }
3736 }
3737
3738 return -1;
3739 },
3740 trToData: function trToData(columns, $els) {
3741 var _this = this;
3742
3743 var data = [];
3744 var m = [];
3745 $els.each(function (y, el) {
3746 var row = {}; // save tr's id, class and data-* attributes
3747
3748 row._id = $(el).attr('id');
3749 row._class = $(el).attr('class');
3750 row._data = _this.getRealDataAttr($(el).data());
3751 $(el).find('>td,>th').each(function (_x, el) {
3752 var cspan = +$(el).attr('colspan') || 1;
3753 var rspan = +$(el).attr('rowspan') || 1;
3754 var x = _x; // skip already occupied cells in current row
3755
3756 for (; m[y] && m[y][x]; x++) {} // ignore
3757 // mark matrix elements occupied by current cell with true
3758
3759
3760 for (var tx = x; tx < x + cspan; tx++) {
3761 for (var ty = y; ty < y + rspan; ty++) {
3762 if (!m[ty]) {
3763 // fill missing rows
3764 m[ty] = [];
3765 }
3766
3767 m[ty][tx] = true;
3768 }
3769 }
3770
3771 var field = columns[x].field;
3772 row[field] = $(el).html().trim(); // save td's id, class and data-* attributes
3773
3774 row["_".concat(field, "_id")] = $(el).attr('id');
3775 row["_".concat(field, "_class")] = $(el).attr('class');
3776 row["_".concat(field, "_rowspan")] = $(el).attr('rowspan');
3777 row["_".concat(field, "_colspan")] = $(el).attr('colspan');
3778 row["_".concat(field, "_title")] = $(el).attr('title');
3779 row["_".concat(field, "_data")] = _this.getRealDataAttr($(el).data());
3780 });
3781 data.push(row);
3782 });
3783 return data;
3784 },
3785 sort: function sort(a, b, order, sortStable, aPosition, bPosition) {
3786 if (a === undefined || a === null) {
3787 a = '';
3788 }
3789
3790 if (b === undefined || b === null) {
3791 b = '';
3792 }
3793
3794 if (sortStable && a === b) {
3795 a = aPosition;
3796 b = bPosition;
3797 } // If both values are numeric, do a numeric comparison
3798
3799
3800 if (this.isNumeric(a) && this.isNumeric(b)) {
3801 // Convert numerical values form string to float.
3802 a = parseFloat(a);
3803 b = parseFloat(b);
3804
3805 if (a < b) {
3806 return order * -1;
3807 }
3808
3809 if (a > b) {
3810 return order;
3811 }
3812
3813 return 0;
3814 }
3815
3816 if (a === b) {
3817 return 0;
3818 } // If value is not a string, convert to string
3819
3820
3821 if (typeof a !== 'string') {
3822 a = a.toString();
3823 }
3824
3825 if (a.localeCompare(b) === -1) {
3826 return order * -1;
3827 }
3828
3829 return order;
3830 },
3831 getResizeEventName: function getResizeEventName() {
3832 var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
3833 id = id || "".concat(+new Date()).concat(~~(Math.random() * 1000000));
3834 return "resize.bootstrap-table-".concat(id);
3835 }
3836 };
3837
3838 var BLOCK_ROWS = 50;
3839 var CLUSTER_BLOCKS = 4;
3840
3841 var VirtualScroll =
3842 /*#__PURE__*/
3843 function () {
3844 function VirtualScroll(options) {
3845 var _this = this;
3846
3847 _classCallCheck(this, VirtualScroll);
3848
3849 this.rows = options.rows;
3850 this.scrollEl = options.scrollEl;
3851 this.contentEl = options.contentEl;
3852 this.callback = options.callback;
3853 this.itemHeight = options.itemHeight;
3854 this.cache = {};
3855 this.scrollTop = this.scrollEl.scrollTop;
3856 this.initDOM(this.rows, options.fixedScroll);
3857 this.scrollEl.scrollTop = this.scrollTop;
3858 this.lastCluster = 0;
3859
3860 var onScroll = function onScroll() {
3861 if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
3862 _this.initDOM(_this.rows);
3863
3864 _this.callback();
3865 }
3866 };
3867
3868 this.scrollEl.addEventListener('scroll', onScroll, false);
3869
3870 this.destroy = function () {
3871 _this.contentEl.innerHtml = '';
3872
3873 _this.scrollEl.removeEventListener('scroll', onScroll, false);
3874 };
3875 }
3876
3877 _createClass(VirtualScroll, [{
3878 key: "initDOM",
3879 value: function initDOM(rows, fixedScroll) {
3880 if (typeof this.clusterHeight === 'undefined') {
3881 this.cache.scrollTop = this.scrollEl.scrollTop;
3882 this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
3883 this.getRowsHeight(rows);
3884 }
3885
3886 var data = this.initData(rows, this.getNum(fixedScroll));
3887 var thisRows = data.rows.join('');
3888 var dataChanged = this.checkChanges('data', thisRows);
3889 var topOffsetChanged = this.checkChanges('top', data.topOffset);
3890 var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
3891 var html = [];
3892
3893 if (dataChanged && topOffsetChanged) {
3894 if (data.topOffset) {
3895 html.push(this.getExtra('top', data.topOffset));
3896 }
3897
3898 html.push(thisRows);
3899
3900 if (data.bottomOffset) {
3901 html.push(this.getExtra('bottom', data.bottomOffset));
3902 }
3903
3904 this.contentEl.innerHTML = html.join('');
3905
3906 if (fixedScroll) {
3907 this.contentEl.scrollTop = this.cache.scrollTop;
3908 }
3909 } else if (bottomOffsetChanged) {
3910 this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
3911 }
3912 }
3913 }, {
3914 key: "getRowsHeight",
3915 value: function getRowsHeight() {
3916 if (typeof this.itemHeight === 'undefined') {
3917 var nodes = this.contentEl.children;
3918 var node = nodes[Math.floor(nodes.length / 2)];
3919 this.itemHeight = node.offsetHeight;
3920 }
3921
3922 this.blockHeight = this.itemHeight * BLOCK_ROWS;
3923 this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS;
3924 this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS;
3925 }
3926 }, {
3927 key: "getNum",
3928 value: function getNum(fixedScroll) {
3929 this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop;
3930 return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
3931 }
3932 }, {
3933 key: "initData",
3934 value: function initData(rows, num) {
3935 if (rows.length < BLOCK_ROWS) {
3936 return {
3937 topOffset: 0,
3938 bottomOffset: 0,
3939 rowsAbove: 0,
3940 rows: rows
3941 };
3942 }
3943
3944 var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0);
3945 var end = start + this.clusterRows;
3946 var topOffset = Math.max(start * this.itemHeight, 0);
3947 var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
3948 var thisRows = [];
3949 var rowsAbove = start;
3950
3951 if (topOffset < 1) {
3952 rowsAbove++;
3953 }
3954
3955 for (var i = start; i < end; i++) {
3956 rows[i] && thisRows.push(rows[i]);
3957 }
3958
3959 return {
3960 topOffset: topOffset,
3961 bottomOffset: bottomOffset,
3962 rowsAbove: rowsAbove,
3963 rows: thisRows
3964 };
3965 }
3966 }, {
3967 key: "checkChanges",
3968 value: function checkChanges(type, value) {
3969 var changed = value !== this.cache[type];
3970 this.cache[type] = value;
3971 return changed;
3972 }
3973 }, {
3974 key: "getExtra",
3975 value: function getExtra(className, height) {
3976 var tag = document.createElement('tr');
3977 tag.className = "virtual-scroll-".concat(className);
3978
3979 if (height) {
3980 tag.style.height = "".concat(height, "px");
3981 }
3982
3983 return tag.outerHTML;
3984 }
3985 }]);
3986
3987 return VirtualScroll;
3988 }();
3989
3990 var BootstrapTable =
3991 /*#__PURE__*/
3992 function () {
3993 function BootstrapTable(el, options) {
3994 _classCallCheck(this, BootstrapTable);
3995
3996 this.options = options;
3997 this.$el = $(el);
3998 this.$el_ = this.$el.clone();
3999 this.timeoutId_ = 0;
4000 this.timeoutFooter_ = 0;
4001 this.init();
4002 }
4003
4004 _createClass(BootstrapTable, [{
4005 key: "init",
4006 value: function init() {
4007 this.initConstants();
4008 this.initLocale();
4009 this.initContainer();
4010 this.initTable();
4011 this.initHeader();
4012 this.initData();
4013 this.initHiddenRows();
4014 this.initToolbar();
4015 this.initPagination();
4016 this.initBody();
4017 this.initSearchText();
4018 this.initServer();
4019 }
4020 }, {
4021 key: "initConstants",
4022 value: function initConstants() {
4023 var opts = this.options;
4024 this.constants = Constants.CONSTANTS;
4025 this.constants.theme = $.fn.bootstrapTable.theme;
4026 var buttonsPrefix = opts.buttonsPrefix ? "".concat(opts.buttonsPrefix, "-") : '';
4027 this.constants.buttonsClass = [opts.buttonsPrefix, buttonsPrefix + opts.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), opts.iconSize)].join(' ').trim();
4028 }
4029 }, {
4030 key: "initLocale",
4031 value: function initLocale() {
4032 if (this.options.locale) {
4033 var locales = $.fn.bootstrapTable.locales;
4034 var parts = this.options.locale.split(/-|_/);
4035 parts[0] = parts[0].toLowerCase();
4036
4037 if (parts[1]) {
4038 parts[1] = parts[1].toUpperCase();
4039 }
4040
4041 if (locales[this.options.locale]) {
4042 $.extend(this.options, locales[this.options.locale]);
4043 } else if (locales[parts.join('-')]) {
4044 $.extend(this.options, locales[parts.join('-')]);
4045 } else if (locales[parts[0]]) {
4046 $.extend(this.options, locales[parts[0]]);
4047 }
4048 }
4049 }
4050 }, {
4051 key: "initContainer",
4052 value: function initContainer() {
4053 var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : '';
4054 var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : '';
4055 this.$container = $("\n <div class=\"bootstrap-table ".concat(this.constants.theme, "\">\n <div class=\"fixed-table-toolbar\"></div>\n ").concat(topPagination, "\n <div class=\"fixed-table-container\">\n <div class=\"fixed-table-header\"><table></table></div>\n <div class=\"fixed-table-body\">\n <div class=\"fixed-table-loading\">\n <span class=\"loading-wrap\">\n <span class=\"loading-text\">").concat(this.options.formatLoadingMessage(), "</span>\n <span class=\"animation-wrap\"><span class=\"animation-dot\"></span></span>\n </span>\n </div>\n </div>\n <div class=\"fixed-table-footer\"><table><thead><tr></tr></thead></table></div>\n </div>\n ").concat(bottomPagination, "\n </div>\n "));
4056 this.$container.insertAfter(this.$el);
4057 this.$tableContainer = this.$container.find('.fixed-table-container');
4058 this.$tableHeader = this.$container.find('.fixed-table-header');
4059 this.$tableBody = this.$container.find('.fixed-table-body');
4060 this.$tableLoading = this.$container.find('.fixed-table-loading');
4061 this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not
4062
4063 if (this.options.buttonsToolbar) {
4064 this.$toolbar = $('body').find(this.options.buttonsToolbar);
4065 } else {
4066 this.$toolbar = this.$container.find('.fixed-table-toolbar');
4067 }
4068
4069 this.$pagination = this.$container.find('.fixed-table-pagination');
4070 this.$tableBody.append(this.$el);
4071 this.$container.after('<div class="clearfix"></div>');
4072 this.$el.addClass(this.options.classes);
4073 this.$tableLoading.addClass(this.options.classes);
4074
4075 if (this.options.height) {
4076 this.$tableContainer.addClass('fixed-height');
4077
4078 if (this.options.showFooter) {
4079 this.$tableContainer.addClass('has-footer');
4080 }
4081
4082 if (this.options.classes.split(' ').includes('table-bordered')) {
4083 this.$tableBody.append('<div class="fixed-table-border"></div>');
4084 this.$tableBorder = this.$tableBody.find('.fixed-table-border');
4085 this.$tableLoading.addClass('fixed-table-border');
4086 }
4087
4088 this.$tableFooter = this.$container.find('.fixed-table-footer');
4089 }
4090 }
4091 }, {
4092 key: "initTable",
4093 value: function initTable() {
4094 var _this = this;
4095
4096 var columns = [];
4097 this.$header = this.$el.find('>thead');
4098
4099 if (!this.$header.length) {
4100 this.$header = $("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el);
4101 } else if (this.options.theadClasses) {
4102 this.$header.addClass(this.options.theadClasses);
4103 }
4104
4105 this.$header.find('tr').each(function (i, el) {
4106 var column = [];
4107 $(el).find('th').each(function (i, el) {
4108 // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not
4109 if (typeof $(el).data('field') !== 'undefined') {
4110 $(el).data('field', "".concat($(el).data('field')));
4111 }
4112
4113 column.push($.extend({}, {
4114 title: $(el).html(),
4115 'class': $(el).attr('class'),
4116 titleTooltip: $(el).attr('title'),
4117 rowspan: $(el).attr('rowspan') ? +$(el).attr('rowspan') : undefined,
4118 colspan: $(el).attr('colspan') ? +$(el).attr('colspan') : undefined
4119 }, $(el).data()));
4120 });
4121 columns.push(column);
4122 });
4123
4124 if (!Array.isArray(this.options.columns[0])) {
4125 this.options.columns = [this.options.columns];
4126 }
4127
4128 this.options.columns = $.extend(true, [], columns, this.options.columns);
4129 this.columns = [];
4130 this.fieldsColumnsIndex = [];
4131 Utils.setFieldIndex(this.options.columns);
4132 this.options.columns.forEach(function (columns, i) {
4133 columns.forEach(function (_column, j) {
4134 var column = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, _column);
4135
4136 if (typeof column.fieldIndex !== 'undefined') {
4137 _this.columns[column.fieldIndex] = column;
4138 _this.fieldsColumnsIndex[column.field] = column.fieldIndex;
4139 }
4140
4141 _this.options.columns[i][j] = column;
4142 });
4143 }); // if options.data is setting, do not process tbody and tfoot data
4144
4145 if (!this.options.data.length) {
4146 this.options.data = Utils.trToData(this.columns, this.$el.find('>tbody>tr'));
4147
4148 if (this.options.data.length) {
4149 this.fromHtml = true;
4150 }
4151 }
4152
4153 this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr'));
4154
4155 if (this.footerData) {
4156 this.$el.find('tfoot').html('<tr></tr>');
4157 }
4158
4159 if (!this.options.showFooter || this.options.cardView) {
4160 this.$tableFooter.hide();
4161 } else {
4162 this.$tableFooter.show();
4163 }
4164 }
4165 }, {
4166 key: "initHeader",
4167 value: function initHeader() {
4168 var _this2 = this;
4169
4170 var visibleColumns = {};
4171 var html = [];
4172 this.header = {
4173 fields: [],
4174 styles: [],
4175 classes: [],
4176 formatters: [],
4177 detailFormatters: [],
4178 events: [],
4179 sorters: [],
4180 sortNames: [],
4181 cellStyles: [],
4182 searchables: []
4183 };
4184 Utils.updateFieldGroup(this.options.columns);
4185 this.options.columns.forEach(function (columns, i) {
4186 html.push('<tr>');
4187
4188 if (i === 0 && !_this2.options.cardView && _this2.options.detailView && _this2.options.detailViewIcon) {
4189 html.push("<th class=\"detail\" rowspan=\"".concat(_this2.options.columns.length, "\">\n <div class=\"fht-cell\"></div>\n </th>\n "));
4190 }
4191
4192 columns.forEach(function (column, j) {
4193 var class_ = Utils.sprintf(' class="%s"', column['class']);
4194 var unitWidth = column.widthUnit;
4195 var width = parseFloat(column.width);
4196 var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
4197 var align = Utils.sprintf('text-align: %s; ', column.align);
4198 var style = Utils.sprintf('vertical-align: %s; ', column.valign);
4199 style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined);
4200
4201 if (typeof column.fieldIndex === 'undefined' && !column.visible) {
4202 return;
4203 }
4204
4205 var headerStyle = Utils.calculateObjectValue(null, _this2.options.headerStyle, [column]);
4206 var csses = [];
4207 var classes = '';
4208
4209 if (headerStyle && headerStyle.css) {
4210 for (var _i = 0, _Object$entries = Object.entries(headerStyle.css); _i < _Object$entries.length; _i++) {
4211 var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
4212 key = _Object$entries$_i[0],
4213 value = _Object$entries$_i[1];
4214
4215 csses.push("".concat(key, ": ").concat(value));
4216 }
4217 }
4218
4219 if (headerStyle && headerStyle.classes) {
4220 classes = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], headerStyle.classes].join(' ') : headerStyle.classes);
4221 }
4222
4223 if (typeof column.fieldIndex !== 'undefined') {
4224 _this2.header.fields[column.fieldIndex] = column.field;
4225 _this2.header.styles[column.fieldIndex] = align + style;
4226 _this2.header.classes[column.fieldIndex] = class_;
4227 _this2.header.formatters[column.fieldIndex] = column.formatter;
4228 _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter;
4229 _this2.header.events[column.fieldIndex] = column.events;
4230 _this2.header.sorters[column.fieldIndex] = column.sorter;
4231 _this2.header.sortNames[column.fieldIndex] = column.sortName;
4232 _this2.header.cellStyles[column.fieldIndex] = column.cellStyle;
4233 _this2.header.searchables[column.fieldIndex] = column.searchable;
4234
4235 if (!column.visible) {
4236 return;
4237 }
4238
4239 if (_this2.options.cardView && !column.cardVisible) {
4240 return;
4241 }
4242
4243 visibleColumns[column.field] = column;
4244 }
4245
4246 html.push("<th".concat(Utils.sprintf(' title="%s"', column.titleTooltip)), column.checkbox || column.radio ? Utils.sprintf(' class="bs-checkbox %s"', column['class'] || '') : classes || class_, Utils.sprintf(' style="%s"', halign + style + csses.join('; ')), Utils.sprintf(' rowspan="%s"', column.rowspan), Utils.sprintf(' colspan="%s"', column.colspan), Utils.sprintf(' data-field="%s"', column.field), // If `column` is not the first element of `this.options.columns[0]`, then className 'data-not-first-th' should be added.
4247 j === 0 && i > 0 ? ' data-not-first-th' : '', '>');
4248 html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? 'sortable both' : ''));
4249 var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title;
4250 var title = text;
4251
4252 if (column.checkbox) {
4253 text = '';
4254
4255 if (!_this2.options.singleSelect && _this2.options.checkboxHeader) {
4256 text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>';
4257 }
4258
4259 _this2.header.stateField = column.field;
4260 }
4261
4262 if (column.radio) {
4263 text = '';
4264 _this2.header.stateField = column.field;
4265 }
4266
4267 if (!text && column.showSelectTitle) {
4268 text += title;
4269 }
4270
4271 html.push(text);
4272 html.push('</div>');
4273 html.push('<div class="fht-cell"></div>');
4274 html.push('</div>');
4275 html.push('</th>');
4276 });
4277 html.push('</tr>');
4278 });
4279 this.$header.html(html.join(''));
4280 this.$header.find('th[data-field]').each(function (i, el) {
4281 $(el).data(visibleColumns[$(el).data('field')]);
4282 });
4283 this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) {
4284 var $this = $(e.currentTarget);
4285
4286 if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) {
4287 if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) {
4288 return false;
4289 }
4290 }
4291
4292 if (_this2.options.sortable && $this.parent().data().sortable) {
4293 _this2.onSort(e);
4294 }
4295 });
4296 this.$header.children().children().off('keypress').on('keypress', function (e) {
4297 if (_this2.options.sortable && $(e.currentTarget).data().sortable) {
4298 var code = e.keyCode || e.which;
4299
4300 if (code === 13) {
4301 // Enter keycode
4302 _this2.onSort(e);
4303 }
4304 }
4305 });
4306 var resizeEvent = Utils.getResizeEventName(this.$el.attr('id'));
4307 $(window).off(resizeEvent);
4308
4309 if (!this.options.showHeader || this.options.cardView) {
4310 this.$header.hide();
4311 this.$tableHeader.hide();
4312 this.$tableLoading.css('top', 0);
4313 } else {
4314 this.$header.show();
4315 this.$tableHeader.show();
4316 this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow
4317
4318 this.getCaret();
4319 $(window).on(resizeEvent, function () {
4320 return _this2.resetView();
4321 });
4322 }
4323
4324 this.$selectAll = this.$header.find('[name="btSelectAll"]');
4325 this.$selectAll.off('click').on('click', function (e) {
4326 e.stopPropagation();
4327 var checked = $(e.currentTarget).prop('checked');
4328
4329 _this2[checked ? 'checkAll' : 'uncheckAll']();
4330
4331 _this2.updateSelected();
4332 });
4333 }
4334 }, {
4335 key: "initData",
4336 value: function initData(data, type) {
4337 if (type === 'append') {
4338 this.options.data = this.options.data.concat(data);
4339 } else if (type === 'prepend') {
4340 this.options.data = [].concat(data).concat(this.options.data);
4341 } else {
4342 this.options.data = data || this.options.data;
4343 }
4344
4345 this.data = this.options.data;
4346
4347 if (this.options.sidePagination === 'server') {
4348 return;
4349 }
4350
4351 this.initSort();
4352 }
4353 }, {
4354 key: "initSort",
4355 value: function initSort() {
4356 var _this3 = this;
4357
4358 var name = this.options.sortName;
4359 var order = this.options.sortOrder === 'desc' ? -1 : 1;
4360 var index = this.header.fields.indexOf(this.options.sortName);
4361 var timeoutId = 0;
4362
4363 if (index !== -1) {
4364 if (this.options.sortStable) {
4365 this.data.forEach(function (row, i) {
4366 if (!row.hasOwnProperty('_position')) {
4367 row._position = i;
4368 }
4369 });
4370 }
4371
4372 if (this.options.customSort) {
4373 Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]);
4374 } else {
4375 this.data.sort(function (a, b) {
4376 if (_this3.header.sortNames[index]) {
4377 name = _this3.header.sortNames[index];
4378 }
4379
4380 var aa = Utils.getItemField(a, name, _this3.options.escape);
4381 var bb = Utils.getItemField(b, name, _this3.options.escape);
4382 var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]);
4383
4384 if (value !== undefined) {
4385 if (_this3.options.sortStable && value === 0) {
4386 return order * (a._position - b._position);
4387 }
4388
4389 return order * value;
4390 }
4391
4392 return Utils.sort(aa, bb, order, _this3.options.sortStable, a._position, b._position);
4393 });
4394 }
4395
4396 if (this.options.sortClass !== undefined) {
4397 clearTimeout(timeoutId);
4398 timeoutId = setTimeout(function () {
4399 _this3.$el.removeClass(_this3.options.sortClass);
4400
4401 var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index();
4402
4403 _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass);
4404 }, 250);
4405 }
4406 }
4407 }
4408 }, {
4409 key: "onSort",
4410 value: function onSort(_ref) {
4411 var type = _ref.type,
4412 currentTarget = _ref.currentTarget;
4413 var $this = type === 'keypress' ? $(currentTarget) : $(currentTarget).parent();
4414 var $this_ = this.$header.find('th').eq($this.index());
4415 this.$header.add(this.$header_).find('span.order').remove();
4416
4417 if (this.options.sortName === $this.data('field')) {
4418 this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc';
4419 } else {
4420 this.options.sortName = $this.data('field');
4421
4422 if (this.options.rememberOrder) {
4423 this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
4424 } else {
4425 this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order;
4426 }
4427 }
4428
4429 this.trigger('sort', this.options.sortName, this.options.sortOrder);
4430 $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow
4431
4432 this.getCaret();
4433
4434 if (this.options.sidePagination === 'server' && this.options.serverSort) {
4435 this.options.pageNumber = 1;
4436 this.initServer(this.options.silentSort);
4437 return;
4438 }
4439
4440 this.initSort();
4441 this.initBody();
4442 }
4443 }, {
4444 key: "initToolbar",
4445 value: function initToolbar() {
4446 var _this4 = this;
4447
4448 var opts = this.options;
4449 var html = [];
4450 var timeoutId = 0;
4451 var $keepOpen;
4452 var switchableCount = 0;
4453
4454 if (this.$toolbar.find('.bs-bars').children().length) {
4455 $('body').append($(opts.toolbar));
4456 }
4457
4458 this.$toolbar.html('');
4459
4460 if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') {
4461 $(Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($(opts.toolbar));
4462 } // showColumns, showToggle, showRefresh
4463
4464
4465 html = ["<div class=\"".concat(['columns', "columns-".concat(opts.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(opts.buttonsAlign)].join(' '), "\">")];
4466
4467 if (typeof opts.icons === 'string') {
4468 opts.icons = Utils.calculateObjectValue(null, opts.icons);
4469 }
4470
4471 var buttonsHtml = {
4472 paginationSwitch: "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"paginationSwitch\"\n aria-label=\"Pagination Switch\" title=\"").concat(opts.formatPaginationSwitch(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.paginationSwitchDown) : '', "\n ").concat(opts.showButtonText ? opts.formatPaginationSwitchUp() : '', "\n </button>"),
4473 refresh: "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"refresh\"\n aria-label=\"Refresh\" title=\"").concat(opts.formatRefresh(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.refresh) : '', "\n ").concat(opts.showButtonText ? opts.formatRefresh() : '', "\n </button>"),
4474 toggle: "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"toggle\"\n aria-label=\"Toggle\" title=\"").concat(opts.formatToggle(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.toggleOff) : '', "\n ").concat(opts.showButtonText ? opts.formatToggleOn() : '', "\n </button>"),
4475 fullscreen: "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"fullscreen\"\n aria-label=\"Fullscreen\" title=\"").concat(opts.formatFullscreen(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.fullscreen) : '', "\n ").concat(opts.showButtonText ? opts.formatFullscreen() : '', "\n </button>"),
4476 columns: function () {
4477 var html = [];
4478 html.push("<div class=\"keep-open ".concat(_this4.constants.classes.buttonsDropdown, "\" title=\"").concat(opts.formatColumns(), "\">\n <button class=\"").concat(_this4.constants.buttonsClass, " dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\"\n aria-label=\"Columns\" title=\"").concat(opts.formatColumns(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(_this4.constants.html.icon, opts.iconsPrefix, opts.icons.columns) : '', "\n ").concat(opts.showButtonText ? opts.formatColumns() : '', "\n ").concat(_this4.constants.html.dropdownCaret, "\n </button>\n ").concat(_this4.constants.html.toolbarDropdown[0]));
4479
4480 if (opts.showColumnsSearch) {
4481 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="text" class="%s" id="columnsSearch" placeholder="%s" autocomplete="off">', _this4.constants.classes.input, opts.formatSearch())));
4482 html.push(_this4.constants.html.toolbarDropdownSeparator);
4483 }
4484
4485 if (opts.showColumnsToggleAll) {
4486 var allFieldsVisible = _this4.getVisibleColumns().length === _this4.columns.filter(function (column) {
4487 return !_this4.isSelectionColumn(column);
4488 }).length;
4489
4490 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>', allFieldsVisible ? 'checked="checked"' : '', opts.formatColumnsToggleAll())));
4491 html.push(_this4.constants.html.toolbarDropdownSeparator);
4492 }
4493
4494 var visibleColumns = 0;
4495
4496 _this4.columns.forEach(function (column, i) {
4497 if (column.visible) {
4498 visibleColumns++;
4499 }
4500 });
4501
4502 _this4.columns.forEach(function (column, i) {
4503 if (_this4.isSelectionColumn(column)) {
4504 return;
4505 }
4506
4507 if (opts.cardView && !column.cardVisible) {
4508 return;
4509 }
4510
4511 var checked = column.visible ? ' checked="checked"' : '';
4512 var disabled = visibleColumns <= _this4.options.minimumCountColumns && checked ? ' disabled="disabled"' : '';
4513
4514 if (column.switchable) {
4515 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" data-field="%s" value="%s"%s%s> <span>%s</span>', column.field, i, checked, disabled, column.title)));
4516 switchableCount++;
4517 }
4518 });
4519
4520 html.push(_this4.constants.html.toolbarDropdown[1], '</div>');
4521 return html.join('');
4522 }()
4523 };
4524
4525 if (typeof opts.buttonsOrder === 'string') {
4526 opts.buttonsOrder = opts.buttonsOrder.replace(/\[|\]| |'/g, '').toLowerCase().split(',');
4527 }
4528
4529 var _iteratorNormalCompletion = true;
4530 var _didIteratorError = false;
4531 var _iteratorError = undefined;
4532
4533 try {
4534 for (var _iterator = opts.buttonsOrder[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
4535 var button = _step.value;
4536
4537 if (opts['show' + button.charAt(0).toUpperCase() + button.substring(1)]) {
4538 html.push(buttonsHtml[button]);
4539 }
4540 }
4541 } catch (err) {
4542 _didIteratorError = true;
4543 _iteratorError = err;
4544 } finally {
4545 try {
4546 if (!_iteratorNormalCompletion && _iterator.return != null) {
4547 _iterator.return();
4548 }
4549 } finally {
4550 if (_didIteratorError) {
4551 throw _iteratorError;
4552 }
4553 }
4554 }
4555
4556 html.push('</div>'); // Fix #188: this.showToolbar is for extensions
4557
4558 if (this.showToolbar || html.length > 2) {
4559 this.$toolbar.append(html.join(''));
4560 }
4561
4562 if (opts.showPaginationSwitch) {
4563 this.$toolbar.find('button[name="paginationSwitch"]').off('click').on('click', function () {
4564 return _this4.togglePagination();
4565 });
4566 }
4567
4568 if (opts.showFullscreen) {
4569 this.$toolbar.find('button[name="fullscreen"]').off('click').on('click', function () {
4570 return _this4.toggleFullscreen();
4571 });
4572 }
4573
4574 if (opts.showRefresh) {
4575 this.$toolbar.find('button[name="refresh"]').off('click').on('click', function () {
4576 return _this4.refresh();
4577 });
4578 }
4579
4580 if (opts.showToggle) {
4581 this.$toolbar.find('button[name="toggle"]').off('click').on('click', function () {
4582 _this4.toggleView();
4583 });
4584 }
4585
4586 if (opts.showColumns) {
4587 $keepOpen = this.$toolbar.find('.keep-open');
4588 var $checkboxes = $keepOpen.find('input[type="checkbox"]:not(".toggle-all")');
4589 var $toggleAll = $keepOpen.find('input[type="checkbox"].toggle-all');
4590
4591 if (switchableCount <= opts.minimumCountColumns) {
4592 $keepOpen.find('input').prop('disabled', true);
4593 }
4594
4595 $keepOpen.find('li, label').off('click').on('click', function (e) {
4596 e.stopImmediatePropagation();
4597 });
4598 $checkboxes.off('click').on('click', function (_ref2) {
4599 var currentTarget = _ref2.currentTarget;
4600 var $this = $(currentTarget);
4601
4602 _this4._toggleColumn($this.val(), $this.prop('checked'), false);
4603
4604 _this4.trigger('column-switch', $this.data('field'), $this.prop('checked'));
4605
4606 $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.filter(function (column) {
4607 return !_this4.isSelectionColumn(column);
4608 }).length);
4609 });
4610 $toggleAll.off('click').on('click', function (_ref3) {
4611 var currentTarget = _ref3.currentTarget;
4612
4613 _this4._toggleAllColumns($(currentTarget).prop('checked'));
4614 });
4615
4616 if (opts.showColumnsSearch) {
4617 var $columnsSearch = $keepOpen.find('#columnsSearch');
4618 var $listItems = $keepOpen.find('.dropdown-item-marker');
4619 $columnsSearch.on('keyup paste change', function (_ref4) {
4620 var currentTarget = _ref4.currentTarget;
4621 var $this = $(currentTarget);
4622 var searchValue = $this.val().toLowerCase();
4623 $listItems.show();
4624 $checkboxes.each(function (i, el) {
4625 var $checkbox = $(el);
4626 var $listItem = $checkbox.parents('.dropdown-item-marker');
4627 var text = $listItem.text().toLowerCase();
4628
4629 if (!text.includes(searchValue)) {
4630 $listItem.hide();
4631 }
4632 });
4633 });
4634 }
4635 } // Fix #4516: this.showSearchClearButton is for extensions
4636
4637
4638 if (opts.search || this.showSearchClearButton) {
4639 html = [];
4640 var showSearchButton = Utils.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, opts.formatSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.search) : '', opts.showButtonText ? opts.formatSearch() : '');
4641 var showSearchClearButton = Utils.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, opts.formatClearSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.clearSearch) : '', opts.showButtonText ? opts.formatClearSearch() : '');
4642 var searchInputHtml = "<input class=\"".concat(this.constants.classes.input, "\n ").concat(Utils.sprintf(' %s%s', this.constants.classes.inputPrefix, opts.iconSize), "\n search-input\" type=\"text\" placeholder=\"").concat(opts.formatSearch(), "\" autocomplete=\"off\">");
4643 var searchInputFinalHtml = searchInputHtml;
4644
4645 if (opts.showSearchButton || opts.showSearchClearButton) {
4646 var _buttonsHtml = (opts.showSearchButton ? showSearchButton : '') + (opts.showSearchClearButton ? showSearchClearButton : '');
4647
4648 searchInputFinalHtml = opts.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, _buttonsHtml) : _buttonsHtml;
4649 }
4650
4651 html.push(Utils.sprintf("\n <div class=\"".concat(this.constants.classes.pull, "-").concat(opts.searchAlign, " search ").concat(this.constants.classes.inputGroup, "\">\n %s\n </div>\n "), searchInputFinalHtml));
4652 this.$toolbar.append(html.join(''));
4653 var $searchInput = this.$toolbar.find('.search input');
4654
4655 var handleInputEvent = function handleInputEvent() {
4656 var eventTriggers = "keyup drop blur ".concat(Utils.isIEBrowser() ? 'mouseup' : '');
4657 $searchInput.off(eventTriggers).on(eventTriggers, function (event) {
4658 if (opts.searchOnEnterKey && event.keyCode !== 13) {
4659 return;
4660 }
4661
4662 if ([37, 38, 39, 40].includes(event.keyCode)) {
4663 return;
4664 }
4665
4666 clearTimeout(timeoutId); // doesn't matter if it's 0
4667
4668 timeoutId = setTimeout(function () {
4669 _this4.onSearch({
4670 currentTarget: event.currentTarget
4671 });
4672 }, opts.searchTimeOut);
4673 });
4674 };
4675
4676 if (opts.showSearchButton) {
4677 this.$toolbar.find('.search button[name=search]').off('click').on('click', function (event) {
4678 clearTimeout(timeoutId); // doesn't matter if it's 0
4679
4680 timeoutId = setTimeout(function () {
4681 _this4.onSearch({
4682 currentTarget: $searchInput
4683 });
4684 }, opts.searchTimeOut);
4685 });
4686
4687 if (opts.searchOnEnterKey) {
4688 handleInputEvent();
4689 }
4690 } else {
4691 handleInputEvent();
4692 }
4693
4694 if (opts.showSearchClearButton) {
4695 this.$toolbar.find('.search button[name=clearSearch]').click(function () {
4696 _this4.resetSearch();
4697 });
4698 }
4699 }
4700 }
4701 }, {
4702 key: "onSearch",
4703 value: function onSearch() {
4704 var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4705 currentTarget = _ref5.currentTarget,
4706 firedByInitSearchText = _ref5.firedByInitSearchText;
4707
4708 var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4709
4710 if (currentTarget !== undefined && $(currentTarget).length && overwriteSearchText) {
4711 var text = $(currentTarget).val().trim();
4712
4713 if (this.options.trimOnSearch && $(currentTarget).val() !== text) {
4714 $(currentTarget).val(text);
4715 }
4716
4717 if (this.searchText === text && text.length > 0) {
4718 return;
4719 }
4720
4721 if ($(currentTarget).hasClass('search-input')) {
4722 this.searchText = text;
4723 this.options.searchText = text;
4724 }
4725 }
4726
4727 if (!firedByInitSearchText) {
4728 this.options.pageNumber = 1;
4729 }
4730
4731 this.initSearch();
4732
4733 if (firedByInitSearchText) {
4734 if (this.options.sidePagination === 'client') {
4735 this.updatePagination();
4736 }
4737 } else {
4738 this.updatePagination();
4739 }
4740
4741 this.trigger('search', this.searchText);
4742 }
4743 }, {
4744 key: "initSearch",
4745 value: function initSearch() {
4746 var _this5 = this;
4747
4748 this.filterOptions = this.filterOptions || this.options.filterOptions;
4749
4750 if (this.options.sidePagination !== 'server') {
4751 if (this.options.customSearch) {
4752 this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]);
4753 return;
4754 }
4755
4756 var s = this.searchText && (this.fromHtml ? Utils.escapeHTML(this.searchText) : this.searchText).toLowerCase();
4757 var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns; // Check filter
4758
4759 if (typeof this.filterOptions.filterAlgorithm === 'function') {
4760 this.data = this.options.data.filter(function (item, i) {
4761 return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]);
4762 });
4763 } else if (typeof this.filterOptions.filterAlgorithm === 'string') {
4764 this.data = f ? this.options.data.filter(function (item, i) {
4765 var filterAlgorithm = _this5.filterOptions.filterAlgorithm;
4766
4767 if (filterAlgorithm === 'and') {
4768 for (var key in f) {
4769 if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) {
4770 return false;
4771 }
4772 }
4773 } else if (filterAlgorithm === 'or') {
4774 var match = false;
4775
4776 for (var _key in f) {
4777 if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) {
4778 match = true;
4779 }
4780 }
4781
4782 return match;
4783 }
4784
4785 return true;
4786 }) : this.options.data;
4787 }
4788
4789 var visibleFields = this.getVisibleFields();
4790 this.data = s ? this.data.filter(function (item, i) {
4791 for (var j = 0; j < _this5.header.fields.length; j++) {
4792 if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
4793 continue;
4794 }
4795
4796 var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j];
4797 var column = _this5.columns[_this5.fieldsColumnsIndex[key]];
4798 var value = void 0;
4799
4800 if (typeof key === 'string') {
4801 value = item;
4802 var props = key.split('.');
4803
4804 for (var _i2 = 0; _i2 < props.length; _i2++) {
4805 if (value[props[_i2]] !== null) {
4806 value = value[props[_i2]];
4807 }
4808 }
4809 } else {
4810 value = item[key];
4811 } // Fix #142: respect searchFormatter boolean
4812
4813
4814 if (column && column.searchFormatter) {
4815 value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
4816 }
4817
4818 if (typeof value === 'string' || typeof value === 'number') {
4819 if (_this5.options.strictSearch) {
4820 if ("".concat(value).toLowerCase() === s) {
4821 return true;
4822 }
4823 } else {
4824 var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
4825 var matches = largerSmallerEqualsRegex.exec(s);
4826 var comparisonCheck = false;
4827
4828 if (matches) {
4829 var operator = matches[1] || "".concat(matches[5], "l");
4830 var comparisonValue = matches[2] || matches[3];
4831 var int = parseInt(value, 10);
4832 var comparisonInt = parseInt(comparisonValue, 10);
4833
4834 switch (operator) {
4835 case '>':
4836 case '<l':
4837 comparisonCheck = int > comparisonInt;
4838 break;
4839
4840 case '<':
4841 case '>l':
4842 comparisonCheck = int < comparisonInt;
4843 break;
4844
4845 case '<=':
4846 case '=<':
4847 case '>=l':
4848 case '=>l':
4849 comparisonCheck = int <= comparisonInt;
4850 break;
4851
4852 case '>=':
4853 case '=>':
4854 case '<=l':
4855 case '=<l':
4856 comparisonCheck = int >= comparisonInt;
4857 break;
4858 }
4859 }
4860
4861 if (comparisonCheck || "".concat(value).toLowerCase().includes(s)) {
4862 return true;
4863 }
4864 }
4865 }
4866 }
4867
4868 return false;
4869 }) : this.data;
4870 }
4871
4872 this.initSort();
4873 }
4874 }, {
4875 key: "initPagination",
4876 value: function initPagination() {
4877 var _this6 = this;
4878
4879 var opts = this.options;
4880
4881 if (!opts.pagination) {
4882 this.$pagination.hide();
4883 return;
4884 }
4885
4886 this.$pagination.show();
4887 var html = [];
4888 var allSelected = false;
4889 var i;
4890 var from;
4891 var to;
4892 var $pageList;
4893 var $pre;
4894 var $next;
4895 var $number;
4896 var data = this.getData({
4897 includeHiddenRows: false
4898 });
4899 var pageList = opts.pageList;
4900
4901 if (typeof pageList === 'string') {
4902 pageList = pageList.replace(/\[|\]| /g, '').toLowerCase().split(',');
4903 }
4904
4905 pageList = pageList.map(function (value) {
4906 if (typeof value === 'string') {
4907 return value.toLowerCase() === opts.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? opts.formatAllRows() : +value;
4908 }
4909
4910 return value;
4911 });
4912
4913 if (opts.sidePagination !== 'server') {
4914 opts.totalRows = data.length;
4915 }
4916
4917 this.totalPages = 0;
4918
4919 if (opts.totalRows) {
4920 if (opts.pageSize === opts.formatAllRows()) {
4921 opts.pageSize = opts.totalRows;
4922 allSelected = true;
4923 }
4924
4925 this.totalPages = ~~((opts.totalRows - 1) / opts.pageSize) + 1;
4926 opts.totalPages = this.totalPages;
4927 }
4928
4929 if (this.totalPages > 0 && opts.pageNumber > this.totalPages) {
4930 opts.pageNumber = this.totalPages;
4931 }
4932
4933 this.pageFrom = (opts.pageNumber - 1) * opts.pageSize + 1;
4934 this.pageTo = opts.pageNumber * opts.pageSize;
4935
4936 if (this.pageTo > opts.totalRows) {
4937 this.pageTo = opts.totalRows;
4938 }
4939
4940 if (this.options.pagination && this.options.sidePagination !== 'server') {
4941 this.options.totalNotFiltered = this.options.data.length;
4942 }
4943
4944 if (!this.options.showExtendedPagination) {
4945 this.options.totalNotFiltered = undefined;
4946 }
4947
4948 var paginationInfo = opts.onlyInfoPagination ? opts.formatDetailPagination(opts.totalRows) : opts.formatShowingRows(this.pageFrom, this.pageTo, opts.totalRows, opts.totalNotFiltered);
4949 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationDetailHAlign, " pagination-detail\">\n <span class=\"pagination-info\">\n ").concat(paginationInfo, "\n </span>"));
4950
4951 if (!opts.onlyInfoPagination) {
4952 html.push('<span class="page-list">');
4953 var pageNumber = ["<span class=\"".concat(this.constants.classes.paginationDropdown, "\">\n <button class=\"").concat(this.constants.buttonsClass, " dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\">\n <span class=\"page-size\">\n ").concat(allSelected ? opts.formatAllRows() : opts.pageSize, "\n </span>\n ").concat(this.constants.html.dropdownCaret, "\n </button>\n ").concat(this.constants.html.pageDropdown[0])];
4954 pageList.forEach(function (page, i) {
4955 if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows) {
4956 var active;
4957
4958 if (allSelected) {
4959 active = page === opts.formatAllRows() ? _this6.constants.classes.dropdownActive : '';
4960 } else {
4961 active = page === opts.pageSize ? _this6.constants.classes.dropdownActive : '';
4962 }
4963
4964 pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page));
4965 }
4966 });
4967 pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</span>"));
4968 html.push(opts.formatRecordsPerPage(pageNumber.join('')));
4969 html.push('</span></div>');
4970 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationHAlign, " pagination\">"), Utils.sprintf(this.constants.html.pagination[0], Utils.sprintf(' pagination-%s', opts.iconSize)), Utils.sprintf(this.constants.html.paginationItem, ' page-pre', opts.formatSRPaginationPreText(), opts.paginationPreText));
4971
4972 if (this.totalPages < opts.paginationSuccessivelySize) {
4973 from = 1;
4974 to = this.totalPages;
4975 } else {
4976 from = opts.pageNumber - opts.paginationPagesBySide;
4977 to = from + opts.paginationPagesBySide * 2;
4978 }
4979
4980 if (opts.pageNumber < opts.paginationSuccessivelySize - 1) {
4981 to = opts.paginationSuccessivelySize;
4982 }
4983
4984 if (opts.paginationSuccessivelySize > this.totalPages - from) {
4985 from = from - (opts.paginationSuccessivelySize - (this.totalPages - from)) + 1;
4986 }
4987
4988 if (from < 1) {
4989 from = 1;
4990 }
4991
4992 if (to > this.totalPages) {
4993 to = this.totalPages;
4994 }
4995
4996 var middleSize = Math.round(opts.paginationPagesBySide / 2);
4997
4998 var pageItem = function pageItem(i) {
4999 var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
5000 return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === opts.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), opts.formatSRPaginationPageText(i), i);
5001 };
5002
5003 if (from > 1) {
5004 var max = opts.paginationPagesBySide;
5005 if (max >= from) max = from - 1;
5006
5007 for (i = 1; i <= max; i++) {
5008 html.push(pageItem(i));
5009 }
5010
5011 if (from - 1 === max + 1) {
5012 i = from - 1;
5013 html.push(pageItem(i));
5014 } else {
5015 if (from - 1 > max) {
5016 if (from - opts.paginationPagesBySide * 2 > opts.paginationPagesBySide && opts.paginationUseIntermediate) {
5017 i = Math.round((from - middleSize) / 2 + middleSize);
5018 html.push(pageItem(i, ' page-intermediate'));
5019 } else {
5020 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...'));
5021 }
5022 }
5023 }
5024 }
5025
5026 for (i = from; i <= to; i++) {
5027 html.push(pageItem(i));
5028 }
5029
5030 if (this.totalPages > to) {
5031 var min = this.totalPages - (opts.paginationPagesBySide - 1);
5032 if (to >= min) min = to + 1;
5033
5034 if (to + 1 === min - 1) {
5035 i = to + 1;
5036 html.push(pageItem(i));
5037 } else {
5038 if (min > to + 1) {
5039 if (this.totalPages - to > opts.paginationPagesBySide * 2 && opts.paginationUseIntermediate) {
5040 i = Math.round((this.totalPages - middleSize - to) / 2 + to);
5041 html.push(pageItem(i, ' page-intermediate'));
5042 } else {
5043 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...'));
5044 }
5045 }
5046 }
5047
5048 for (i = min; i <= this.totalPages; i++) {
5049 html.push(pageItem(i));
5050 }
5051 }
5052
5053 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', opts.formatSRPaginationNextText(), opts.paginationNextText));
5054 html.push(this.constants.html.pagination[1], '</div>');
5055 }
5056
5057 this.$pagination.html(html.join(''));
5058 var dropupClass = ['bottom', 'both'].includes(opts.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : '';
5059 this.$pagination.last().find('.page-list > span').addClass(dropupClass);
5060
5061 if (!opts.onlyInfoPagination) {
5062 $pageList = this.$pagination.find('.page-list a');
5063 $pre = this.$pagination.find('.page-pre');
5064 $next = this.$pagination.find('.page-next');
5065 $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator');
5066
5067 if (this.totalPages <= 1) {
5068 this.$pagination.find('div.pagination').hide();
5069 }
5070
5071 if (opts.smartDisplay) {
5072 if (pageList.length < 2 || opts.totalRows <= pageList[0]) {
5073 this.$pagination.find('span.page-list').hide();
5074 }
5075 } // when data is empty, hide the pagination
5076
5077
5078 this.$pagination[this.getData().length ? 'show' : 'hide']();
5079
5080 if (!opts.paginationLoop) {
5081 if (opts.pageNumber === 1) {
5082 $pre.addClass('disabled');
5083 }
5084
5085 if (opts.pageNumber === this.totalPages) {
5086 $next.addClass('disabled');
5087 }
5088 }
5089
5090 if (allSelected) {
5091 opts.pageSize = opts.formatAllRows();
5092 } // removed the events for last and first, onPageNumber executeds the same logic
5093
5094
5095 $pageList.off('click').on('click', function (e) {
5096 return _this6.onPageListChange(e);
5097 });
5098 $pre.off('click').on('click', function (e) {
5099 return _this6.onPagePre(e);
5100 });
5101 $next.off('click').on('click', function (e) {
5102 return _this6.onPageNext(e);
5103 });
5104 $number.off('click').on('click', function (e) {
5105 return _this6.onPageNumber(e);
5106 });
5107 }
5108 }
5109 }, {
5110 key: "updatePagination",
5111 value: function updatePagination(event) {
5112 // Fix #171: IE disabled button can be clicked bug.
5113 if (event && $(event.currentTarget).hasClass('disabled')) {
5114 return;
5115 }
5116
5117 if (!this.options.maintainMetaData) {
5118 this.resetRows();
5119 }
5120
5121 this.initPagination();
5122
5123 if (this.options.sidePagination === 'server') {
5124 this.initServer();
5125 } else {
5126 this.initBody();
5127 }
5128
5129 this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
5130 }
5131 }, {
5132 key: "onPageListChange",
5133 value: function onPageListChange(event) {
5134 event.preventDefault();
5135 var $this = $(event.currentTarget);
5136 $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);
5137 this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text();
5138 this.$toolbar.find('.page-size').text(this.options.pageSize);
5139 this.updatePagination(event);
5140 return false;
5141 }
5142 }, {
5143 key: "onPagePre",
5144 value: function onPagePre(event) {
5145 event.preventDefault();
5146
5147 if (this.options.pageNumber - 1 === 0) {
5148 this.options.pageNumber = this.options.totalPages;
5149 } else {
5150 this.options.pageNumber--;
5151 }
5152
5153 this.updatePagination(event);
5154 return false;
5155 }
5156 }, {
5157 key: "onPageNext",
5158 value: function onPageNext(event) {
5159 event.preventDefault();
5160
5161 if (this.options.pageNumber + 1 > this.options.totalPages) {
5162 this.options.pageNumber = 1;
5163 } else {
5164 this.options.pageNumber++;
5165 }
5166
5167 this.updatePagination(event);
5168 return false;
5169 }
5170 }, {
5171 key: "onPageNumber",
5172 value: function onPageNumber(event) {
5173 event.preventDefault();
5174
5175 if (this.options.pageNumber === +$(event.currentTarget).text()) {
5176 return;
5177 }
5178
5179 this.options.pageNumber = +$(event.currentTarget).text();
5180 this.updatePagination(event);
5181 return false;
5182 }
5183 }, {
5184 key: "initRow",
5185 value: function initRow(item, i, data, trFragments) {
5186 var _this7 = this;
5187
5188 var html = [];
5189 var style = {};
5190 var csses = [];
5191 var data_ = '';
5192 var attributes = {};
5193 var htmlAttributes = [];
5194
5195 if (Utils.findIndex(this.hiddenRows, item) > -1) {
5196 return;
5197 }
5198
5199 style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
5200
5201 if (style && style.css) {
5202 for (var _i3 = 0, _Object$entries2 = Object.entries(style.css); _i3 < _Object$entries2.length; _i3++) {
5203 var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2),
5204 key = _Object$entries2$_i[0],
5205 value = _Object$entries2$_i[1];
5206
5207 csses.push("".concat(key, ": ").concat(value));
5208 }
5209 }
5210
5211 attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
5212
5213 if (attributes) {
5214 for (var _i4 = 0, _Object$entries3 = Object.entries(attributes); _i4 < _Object$entries3.length; _i4++) {
5215 var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i4], 2),
5216 _key2 = _Object$entries3$_i[0],
5217 _value = _Object$entries3$_i[1];
5218
5219 htmlAttributes.push("".concat(_key2, "=\"").concat(Utils.escapeHTML(_value), "\""));
5220 }
5221 }
5222
5223 if (item._data && !Utils.isEmptyObject(item._data)) {
5224 for (var _i5 = 0, _Object$entries4 = Object.entries(item._data); _i5 < _Object$entries4.length; _i5++) {
5225 var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i5], 2),
5226 k = _Object$entries4$_i[0],
5227 v = _Object$entries4$_i[1];
5228
5229 // ignore data-index
5230 if (k === 'index') {
5231 return;
5232 }
5233
5234 data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'");
5235 }
5236 }
5237
5238 html.push('<tr', Utils.sprintf(' %s', htmlAttributes.length ? htmlAttributes.join(' ') : undefined), Utils.sprintf(' id="%s"', Array.isArray(item) ? undefined : item._id), Utils.sprintf(' class="%s"', style.classes || (Array.isArray(item) ? undefined : item._class)), " data-index=\"".concat(i, "\""), Utils.sprintf(' data-uniqueid="%s"', Utils.getItemField(item, this.options.uniqueId, false)), Utils.sprintf(' data-has-detail-view="%s"', !this.options.cardView && this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item]) ? 'true' : undefined), Utils.sprintf('%s', data_), '>');
5239
5240 if (this.options.cardView) {
5241 html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">"));
5242 }
5243
5244 if (!this.options.cardView && this.options.detailView && this.options.detailViewIcon) {
5245 html.push('<td>');
5246
5247 if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
5248 html.push("\n <a class=\"detail-icon\" href=\"#\">\n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n </a>\n "));
5249 }
5250
5251 html.push('</td>');
5252 }
5253
5254 this.header.fields.forEach(function (field, j) {
5255 var text = '';
5256 var value_ = Utils.getItemField(item, field, _this7.options.escape);
5257 var value = '';
5258 var type = '';
5259 var cellStyle = {};
5260 var id_ = '';
5261 var class_ = _this7.header.classes[j];
5262 var style_ = '';
5263 var data_ = '';
5264 var rowspan_ = '';
5265 var colspan_ = '';
5266 var title_ = '';
5267 var column = _this7.columns[j];
5268
5269 if (_this7.fromHtml && typeof value_ === 'undefined') {
5270 if (!column.checkbox && !column.radio) {
5271 return;
5272 }
5273 }
5274
5275 if (!column.visible) {
5276 return;
5277 }
5278
5279 if (_this7.options.cardView && !column.cardVisible) {
5280 return;
5281 }
5282
5283 if (column.escape) {
5284 value_ = Utils.escapeHTML(value_);
5285 }
5286
5287 if (csses.concat([_this7.header.styles[j]]).length) {
5288 style_ = " style=\"".concat(csses.concat([_this7.header.styles[j]]).join('; '), "\"");
5289 } // handle td's id and class
5290
5291
5292 if (item["_".concat(field, "_id")]) {
5293 id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
5294 }
5295
5296 if (item["_".concat(field, "_class")]) {
5297 class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
5298 }
5299
5300 if (item["_".concat(field, "_rowspan")]) {
5301 rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
5302 }
5303
5304 if (item["_".concat(field, "_colspan")]) {
5305 colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
5306 }
5307
5308 if (item["_".concat(field, "_title")]) {
5309 title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
5310 }
5311
5312 cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
5313
5314 if (cellStyle.classes) {
5315 class_ = " class=\"".concat(cellStyle.classes, "\"");
5316 }
5317
5318 if (cellStyle.css) {
5319 var csses_ = [];
5320
5321 for (var _i6 = 0, _Object$entries5 = Object.entries(cellStyle.css); _i6 < _Object$entries5.length; _i6++) {
5322 var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i6], 2),
5323 _key3 = _Object$entries5$_i[0],
5324 _value2 = _Object$entries5$_i[1];
5325
5326 csses_.push("".concat(_key3, ": ").concat(_value2));
5327 }
5328
5329 style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
5330 }
5331
5332 value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
5333
5334 if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
5335 for (var _i7 = 0, _Object$entries6 = Object.entries(item["_".concat(field, "_data")]); _i7 < _Object$entries6.length; _i7++) {
5336 var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i7], 2),
5337 _k = _Object$entries6$_i[0],
5338 _v = _Object$entries6$_i[1];
5339
5340 // ignore data-index
5341 if (_k === 'index') {
5342 return;
5343 }
5344
5345 data_ += " data-".concat(_k, "=\"").concat(_v, "\"");
5346 }
5347 }
5348
5349 if (column.checkbox || column.radio) {
5350 type = column.checkbox ? 'checkbox' : type;
5351 type = column.radio ? 'radio' : type;
5352 var c = column['class'] || '';
5353 var isChecked = (value === true || value_ || value && value.checked) && value !== false;
5354 var isDisabled = !column.checkboxEnabled || value && value.disabled;
5355 text = [_this7.options.cardView ? "<div class=\"card-view ".concat(c, "\">") : "<td class=\"bs-checkbox ".concat(c, "\"").concat(class_).concat(style_, ">"), "<label>\n <input\n data-index=\"".concat(i, "\"\n name=\"").concat(_this7.options.selectItemName, "\"\n type=\"").concat(type, "\"\n ").concat(Utils.sprintf('value="%s"', item[_this7.options.idField]), "\n ").concat(Utils.sprintf('checked="%s"', isChecked ? 'checked' : undefined), "\n ").concat(Utils.sprintf('disabled="%s"', isDisabled ? 'disabled' : undefined), " />\n <span></span>\n </label>"), _this7.header.formatters[j] && typeof value === 'string' ? value : '', _this7.options.cardView ? '</div>' : '</td>'].join('');
5356 item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
5357 } else {
5358 value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
5359
5360 if (_this7.options.cardView) {
5361 var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title\"".concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : '';
5362 text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value\">").concat(value, "</span></div>");
5363
5364 if (_this7.options.smartDisplay && value === '') {
5365 text = '<div class="card-view"></div>';
5366 }
5367 } else {
5368 text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>");
5369 }
5370 }
5371
5372 html.push(text);
5373 });
5374
5375 if (this.options.cardView) {
5376 html.push('</div></td>');
5377 }
5378
5379 html.push('</tr>');
5380 return html.join('');
5381 }
5382 }, {
5383 key: "initBody",
5384 value: function initBody(fixedScroll) {
5385 var _this8 = this;
5386
5387 var data = this.getData();
5388 this.trigger('pre-body', data);
5389 this.$body = this.$el.find('>tbody');
5390
5391 if (!this.$body.length) {
5392 this.$body = $('<tbody></tbody>').appendTo(this.$el);
5393 } // Fix #389 Bootstrap-table-flatJSON is not working
5394
5395
5396 if (!this.options.pagination || this.options.sidePagination === 'server') {
5397 this.pageFrom = 1;
5398 this.pageTo = data.length;
5399 }
5400
5401 var rows = [];
5402 var trFragments = $(document.createDocumentFragment());
5403 var hasTr = false;
5404
5405 for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
5406 var item = data[i];
5407 var tr = this.initRow(item, i, data, trFragments);
5408 hasTr = hasTr || !!tr;
5409
5410 if (tr && typeof tr === 'string') {
5411 if (!this.options.virtualScroll) {
5412 trFragments.append(tr);
5413 } else {
5414 rows.push(tr);
5415 }
5416 }
5417 } // show no records
5418
5419
5420 if (!hasTr) {
5421 this.$body.html("<tr class=\"no-records-found\">".concat(Utils.sprintf('<td colspan="%s">%s</td>', this.$header.find('th').length, this.options.formatNoMatches()), "</tr>"));
5422 } else {
5423 if (!this.options.virtualScroll) {
5424 this.$body.html(trFragments);
5425 } else {
5426 if (this.virtualScroll) {
5427 this.virtualScroll.destroy();
5428 }
5429
5430 this.virtualScroll = new VirtualScroll({
5431 rows: rows,
5432 fixedScroll: fixedScroll,
5433 scrollEl: this.$tableBody[0],
5434 contentEl: this.$body[0],
5435 itemHeight: this.options.virtualScrollItemHeight,
5436 callback: function callback() {
5437 _this8.fitHeader();
5438
5439 _this8.initBodyEvent();
5440 }
5441 });
5442 }
5443 }
5444
5445 if (!fixedScroll) {
5446 this.scrollTo(0);
5447 }
5448
5449 this.initBodyEvent();
5450 this.updateSelected();
5451 this.initFooter();
5452 this.resetView();
5453
5454 if (this.options.sidePagination !== 'server') {
5455 this.options.totalRows = data.length;
5456 }
5457
5458 this.trigger('post-body', data);
5459 }
5460 }, {
5461 key: "initBodyEvent",
5462 value: function initBodyEvent() {
5463 var _this9 = this;
5464
5465 // click to select by column
5466 this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
5467 var $td = $(e.currentTarget);
5468 var $tr = $td.parent();
5469 var $cardViewArr = $(e.target).parents('.card-views').children();
5470 var $cardViewTarget = $(e.target).parents('.card-view');
5471 var rowIndex = $tr.data('index');
5472 var item = _this9.data[rowIndex];
5473 var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
5474
5475 var fields = _this9.getVisibleFields();
5476
5477 var field = fields[_this9.options.detailView && _this9.options.detailViewIcon && !_this9.options.cardView ? index - 1 : index];
5478 var column = _this9.columns[_this9.fieldsColumnsIndex[field]];
5479 var value = Utils.getItemField(item, field, _this9.options.escape);
5480
5481 if ($td.find('.detail-icon').length) {
5482 return;
5483 }
5484
5485 _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
5486
5487 _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
5488
5489
5490 if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) {
5491 var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName));
5492
5493 if ($selectItem.length) {
5494 $selectItem[0].click();
5495 }
5496 }
5497
5498 if (e.type === 'click' && _this9.options.detailViewByClick) {
5499 _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]);
5500 }
5501 }).off('mousedown').on('mousedown', function (e) {
5502 // https://github.com/jquery/jquery/issues/1741
5503 _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
5504 _this9.multipleSelectRowShiftKey = e.shiftKey;
5505 });
5506 this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
5507 e.preventDefault();
5508
5509 _this9.toggleDetailView($(e.currentTarget).parent().parent().data('index'));
5510
5511 return false;
5512 });
5513 this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName));
5514 this.$selectItem.off('click').on('click', function (e) {
5515 e.stopImmediatePropagation();
5516 var $this = $(e.currentTarget);
5517
5518 _this9._toggleCheck($this.prop('checked'), $this.data('index'));
5519 });
5520 this.header.events.forEach(function (_events, i) {
5521 var events = _events;
5522
5523 if (!events) {
5524 return;
5525 } // fix bug, if events is defined with namespace
5526
5527
5528 if (typeof events === 'string') {
5529 events = Utils.calculateObjectValue(null, events);
5530 }
5531
5532 var field = _this9.header.fields[i];
5533
5534 var fieldIndex = _this9.getVisibleFields().indexOf(field);
5535
5536 if (fieldIndex === -1) {
5537 return;
5538 }
5539
5540 if (_this9.options.detailView && !_this9.options.cardView) {
5541 fieldIndex += 1;
5542 }
5543
5544 var _loop = function _loop(key) {
5545 if (!events.hasOwnProperty(key)) {
5546 return "continue";
5547 }
5548
5549 var event = events[key];
5550
5551 _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
5552 var $tr = $(tr);
5553 var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
5554 var index = key.indexOf(' ');
5555 var name = key.substring(0, index);
5556 var el = key.substring(index + 1);
5557 $td.find(el).off(name).on(name, function (e) {
5558 var index = $tr.data('index');
5559 var row = _this9.data[index];
5560 var value = row[field];
5561 event.apply(_this9, [e, value, row, index]);
5562 });
5563 });
5564 };
5565
5566 for (var key in events) {
5567 var _ret = _loop(key);
5568
5569 if (_ret === "continue") continue;
5570 }
5571 });
5572 }
5573 }, {
5574 key: "initServer",
5575 value: function initServer(silent, query, url) {
5576 var _this10 = this;
5577
5578 var data = {};
5579 var index = this.header.fields.indexOf(this.options.sortName);
5580 var params = {
5581 searchText: this.searchText,
5582 sortName: this.options.sortName,
5583 sortOrder: this.options.sortOrder
5584 };
5585
5586 if (this.header.sortNames[index]) {
5587 params.sortName = this.header.sortNames[index];
5588 }
5589
5590 if (this.options.pagination && this.options.sidePagination === 'server') {
5591 params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
5592 params.pageNumber = this.options.pageNumber;
5593 }
5594
5595 if (!(url || this.options.url) && !this.options.ajax) {
5596 return;
5597 }
5598
5599 if (this.options.queryParamsType === 'limit') {
5600 params = {
5601 search: params.searchText,
5602 sort: params.sortName,
5603 order: params.sortOrder
5604 };
5605
5606 if (this.options.pagination && this.options.sidePagination === 'server') {
5607 params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
5608 params.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
5609
5610 if (params.limit === 0) {
5611 delete params.limit;
5612 }
5613 }
5614 }
5615
5616 if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
5617 params.filter = JSON.stringify(this.filterColumnsPartial, null);
5618 }
5619
5620 $.extend(params, query || {});
5621 data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request
5622
5623 if (data === false) {
5624 return;
5625 }
5626
5627 if (!silent) {
5628 this.showLoading();
5629 }
5630
5631 var request = $.extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
5632 type: this.options.method,
5633 url: url || this.options.url,
5634 data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
5635 cache: this.options.cache,
5636 contentType: this.options.contentType,
5637 dataType: this.options.dataType,
5638 success: function success(_res, textStatus, jqXHR) {
5639 var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res);
5640
5641 _this10.load(res);
5642
5643 _this10.trigger('load-success', res, jqXHR && jqXHR.status, jqXHR);
5644
5645 if (!silent) {
5646 _this10.hideLoading();
5647 }
5648
5649 if (_this10.options.sidePagination === 'server' && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) {
5650 _this10.updatePagination();
5651 }
5652 },
5653 error: function error(jqXHR) {
5654 var data = [];
5655
5656 if (_this10.options.sidePagination === 'server') {
5657 data = {};
5658 data[_this10.options.totalField] = 0;
5659 data[_this10.options.dataField] = [];
5660 }
5661
5662 _this10.load(data);
5663
5664 _this10.trigger('load-error', jqXHR && jqXHR.status, jqXHR);
5665
5666 if (!silent) _this10.$tableLoading.hide();
5667 }
5668 });
5669
5670 if (this.options.ajax) {
5671 Utils.calculateObjectValue(this, this.options.ajax, [request], null);
5672 } else {
5673 if (this._xhr && this._xhr.readyState !== 4) {
5674 this._xhr.abort();
5675 }
5676
5677 this._xhr = $.ajax(request);
5678 }
5679
5680 return data;
5681 }
5682 }, {
5683 key: "initSearchText",
5684 value: function initSearchText() {
5685 if (this.options.search) {
5686 this.searchText = '';
5687
5688 if (this.options.searchText !== '') {
5689 var $search = this.$toolbar.find('.search input');
5690 $search.val(this.options.searchText);
5691 this.onSearch({
5692 currentTarget: $search,
5693 firedByInitSearchText: true
5694 });
5695 }
5696 }
5697 }
5698 }, {
5699 key: "getCaret",
5700 value: function getCaret() {
5701 var _this11 = this;
5702
5703 this.$header.find('th').each(function (i, th) {
5704 $(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both');
5705 });
5706 }
5707 }, {
5708 key: "updateSelected",
5709 value: function updateSelected() {
5710 var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
5711 this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
5712 this.$selectItem.each(function (i, el) {
5713 $(el).closest('tr')[$(el).prop('checked') ? 'addClass' : 'removeClass']('selected');
5714 });
5715 }
5716 }, {
5717 key: "updateRows",
5718 value: function updateRows() {
5719 var _this12 = this;
5720
5721 this.$selectItem.each(function (i, el) {
5722 _this12.data[$(el).data('index')][_this12.header.stateField] = $(el).prop('checked');
5723 });
5724 }
5725 }, {
5726 key: "resetRows",
5727 value: function resetRows() {
5728 var _iteratorNormalCompletion2 = true;
5729 var _didIteratorError2 = false;
5730 var _iteratorError2 = undefined;
5731
5732 try {
5733 for (var _iterator2 = this.data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
5734 var row = _step2.value;
5735 this.$selectAll.prop('checked', false);
5736 this.$selectItem.prop('checked', false);
5737
5738 if (this.header.stateField) {
5739 row[this.header.stateField] = false;
5740 }
5741 }
5742 } catch (err) {
5743 _didIteratorError2 = true;
5744 _iteratorError2 = err;
5745 } finally {
5746 try {
5747 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
5748 _iterator2.return();
5749 }
5750 } finally {
5751 if (_didIteratorError2) {
5752 throw _iteratorError2;
5753 }
5754 }
5755 }
5756
5757 this.initHiddenRows();
5758 }
5759 }, {
5760 key: "trigger",
5761 value: function trigger(_name) {
5762 var _this$options;
5763
5764 var name = "".concat(_name, ".bs.table");
5765
5766 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key4 = 1; _key4 < _len; _key4++) {
5767 args[_key4 - 1] = arguments[_key4];
5768 }
5769
5770 (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, args);
5771
5772 this.$el.trigger($.Event(name), args);
5773 this.options.onAll(name, args);
5774 this.$el.trigger($.Event('all.bs.table'), [name, args]);
5775 }
5776 }, {
5777 key: "resetHeader",
5778 value: function resetHeader() {
5779 var _this13 = this;
5780
5781 // fix #61: the hidden table reset header bug.
5782 // fix bug: get $el.css('width') error sometime (height = 500)
5783 clearTimeout(this.timeoutId_);
5784 this.timeoutId_ = setTimeout(function () {
5785 return _this13.fitHeader();
5786 }, this.$el.is(':hidden') ? 100 : 0);
5787 }
5788 }, {
5789 key: "fitHeader",
5790 value: function fitHeader() {
5791 var _this14 = this;
5792
5793 if (this.$el.is(':hidden')) {
5794 this.timeoutId_ = setTimeout(function () {
5795 return _this14.fitHeader();
5796 }, 100);
5797 return;
5798 }
5799
5800 var fixedBody = this.$tableBody.get(0);
5801 var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
5802 this.$el.css('margin-top', -this.$header.outerHeight());
5803 var focused = $(':focus');
5804
5805 if (focused.length > 0) {
5806 var $th = focused.parents('th');
5807
5808 if ($th.length > 0) {
5809 var dataField = $th.attr('data-field');
5810
5811 if (dataField !== undefined) {
5812 var $headerTh = this.$header.find("[data-field='".concat(dataField, "']"));
5813
5814 if ($headerTh.length > 0) {
5815 $headerTh.find(':input').addClass('focus-temp');
5816 }
5817 }
5818 }
5819 }
5820
5821 this.$header_ = this.$header.clone(true, true);
5822 this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
5823 this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_);
5824 this.$tableLoading.css('width', this.$el.outerWidth());
5825 var focusedTemp = $('.focus-temp:visible:eq(0)');
5826
5827 if (focusedTemp.length > 0) {
5828 focusedTemp.focus();
5829 this.$header.find('.focus-temp').removeClass('focus-temp');
5830 } // fix bug: $.data() is not working as expected after $.append()
5831
5832
5833 this.$header.find('th[data-field]').each(function (i, el) {
5834 _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $(el).data('field'))).data($(el).data());
5835 });
5836 var visibleFields = this.getVisibleFields();
5837 var $ths = this.$header_.find('th');
5838 var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0);
5839
5840 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
5841 $tr = $tr.next();
5842 }
5843
5844 $tr.find('> *').each(function (i, el) {
5845 var $this = $(el);
5846 var index = i;
5847
5848 if (_this14.options.detailView && _this14.options.detailViewIcon && !_this14.options.cardView) {
5849 if (i === 0) {
5850 var $thDetail = $ths.filter('.detail');
5851
5852 var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
5853
5854 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth);
5855 }
5856
5857 index = i - 1;
5858 }
5859
5860 if (index === -1) {
5861 return;
5862 }
5863
5864 var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
5865
5866 if ($th.length > 1) {
5867 $th = $($ths[$this[0].cellIndex]);
5868 }
5869
5870 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
5871 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
5872 });
5873 this.horizontalScroll();
5874 this.trigger('post-header');
5875 }
5876 }, {
5877 key: "initFooter",
5878 value: function initFooter() {
5879 if (!this.options.showFooter || this.options.cardView) {
5880 // do nothing
5881 return;
5882 }
5883
5884 var data = this.getData();
5885 var html = [];
5886
5887 if (!this.options.cardView && this.options.detailView && this.options.detailViewIcon) {
5888 html.push('<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>');
5889 }
5890
5891 var _iteratorNormalCompletion3 = true;
5892 var _didIteratorError3 = false;
5893 var _iteratorError3 = undefined;
5894
5895 try {
5896 for (var _iterator3 = this.columns[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
5897 var column = _step3.value;
5898 var falign = '';
5899 var valign = '';
5900 var csses = [];
5901 var style = {};
5902 var class_ = Utils.sprintf(' class="%s"', column['class']);
5903
5904 if (!column.visible) {
5905 continue;
5906 }
5907
5908 if (this.options.cardView && !column.cardVisible) {
5909 return;
5910 }
5911
5912 falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
5913 valign = Utils.sprintf('vertical-align: %s; ', column.valign);
5914 style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
5915
5916 if (style && style.css) {
5917 for (var _i8 = 0, _Object$entries7 = Object.entries(style.css); _i8 < _Object$entries7.length; _i8++) {
5918 var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
5919 key = _Object$entries7$_i[0],
5920 value = _Object$entries7$_i[1];
5921
5922 csses.push("".concat(key, ": ").concat(value));
5923 }
5924 }
5925
5926 if (style && style.classes) {
5927 class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes);
5928 }
5929
5930 html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ')), '>');
5931 html.push('<div class="th-inner">');
5932 html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data], this.footerData[0] && this.footerData[0][column.field] || ''));
5933 html.push('</div>');
5934 html.push('<div class="fht-cell"></div>');
5935 html.push('</div>');
5936 html.push('</th>');
5937 }
5938 } catch (err) {
5939 _didIteratorError3 = true;
5940 _iteratorError3 = err;
5941 } finally {
5942 try {
5943 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
5944 _iterator3.return();
5945 }
5946 } finally {
5947 if (_didIteratorError3) {
5948 throw _iteratorError3;
5949 }
5950 }
5951 }
5952
5953 if (!this.options.height && !this.$tableFooter.length) {
5954 this.$el.append('<tfoot><tr></tr></tfoot>');
5955 this.$tableFooter = this.$el.find('tfoot');
5956 }
5957
5958 this.$tableFooter.find('tr').html(html.join(''));
5959 this.trigger('post-footer', this.$tableFooter);
5960 }
5961 }, {
5962 key: "fitFooter",
5963 value: function fitFooter() {
5964 var _this15 = this;
5965
5966 if (this.$el.is(':hidden')) {
5967 setTimeout(function () {
5968 return _this15.fitFooter();
5969 }, 100);
5970 return;
5971 }
5972
5973 var fixedBody = this.$tableBody.get(0);
5974 var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
5975 this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
5976 var visibleFields = this.getVisibleFields();
5977 var $ths = this.$tableFooter.find('th');
5978 var $tr = this.$body.find('>tr:first-child:not(.no-records-found)');
5979
5980 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
5981 $tr = $tr.next();
5982 }
5983
5984 $tr.find('> *').each(function (i, el) {
5985 var $this = $(el);
5986 var index = i;
5987
5988 if (_this15.options.detailView && !_this15.options.cardView) {
5989 if (i === 0) {
5990 var $thDetail = $ths.filter('.detail');
5991
5992 var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
5993
5994 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2);
5995 }
5996
5997 index = i - 1;
5998 }
5999
6000 if (index === -1) {
6001 return;
6002 }
6003
6004 var $th = $ths.eq(i);
6005 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
6006 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
6007 });
6008 this.horizontalScroll();
6009 }
6010 }, {
6011 key: "horizontalScroll",
6012 value: function horizontalScroll() {
6013 var _this16 = this;
6014
6015 // horizontal scroll event
6016 // TODO: it's probably better improving the layout than binding to scroll event
6017 this.$tableBody.off('scroll').on('scroll', function () {
6018 var scrollLeft = _this16.$tableBody.scrollLeft();
6019
6020 if (_this16.options.showHeader && _this16.options.height) {
6021 _this16.$tableHeader.scrollLeft(scrollLeft);
6022 }
6023
6024 if (_this16.options.showFooter && !_this16.options.cardView) {
6025 _this16.$tableFooter.scrollLeft(scrollLeft);
6026 }
6027
6028 _this16.trigger('scroll-body', _this16.$tableBody);
6029 });
6030 }
6031 }, {
6032 key: "getVisibleFields",
6033 value: function getVisibleFields() {
6034 var visibleFields = [];
6035 var _iteratorNormalCompletion4 = true;
6036 var _didIteratorError4 = false;
6037 var _iteratorError4 = undefined;
6038
6039 try {
6040 for (var _iterator4 = this.header.fields[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
6041 var field = _step4.value;
6042 var column = this.columns[this.fieldsColumnsIndex[field]];
6043
6044 if (!column || !column.visible) {
6045 continue;
6046 }
6047
6048 visibleFields.push(field);
6049 }
6050 } catch (err) {
6051 _didIteratorError4 = true;
6052 _iteratorError4 = err;
6053 } finally {
6054 try {
6055 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
6056 _iterator4.return();
6057 }
6058 } finally {
6059 if (_didIteratorError4) {
6060 throw _iteratorError4;
6061 }
6062 }
6063 }
6064
6065 return visibleFields;
6066 }
6067 }, {
6068 key: "initHiddenRows",
6069 value: function initHiddenRows() {
6070 this.hiddenRows = [];
6071 } // PUBLIC FUNCTION DEFINITION
6072 // =======================
6073
6074 }, {
6075 key: "getOptions",
6076 value: function getOptions() {
6077 // deep copy and remove data
6078 var options = $.extend({}, this.options);
6079 delete options.data;
6080 return $.extend(true, {}, options);
6081 }
6082 }, {
6083 key: "refreshOptions",
6084 value: function refreshOptions(options) {
6085 // If the objects are equivalent then avoid the call of destroy / init methods
6086 if (Utils.compareObjects(this.options, options, true)) {
6087 return;
6088 }
6089
6090 this.options = $.extend(this.options, options);
6091 this.trigger('refresh-options', this.options);
6092 this.destroy();
6093 this.init();
6094 }
6095 }, {
6096 key: "getData",
6097 value: function getData(params) {
6098 var data = this.options.data;
6099
6100 if ((this.searchText || this.options.customSearch || this.options.sortName || !Utils.isEmptyObject(this.filterColumns) || !Utils.isEmptyObject(this.filterColumnsPartial)) && (!params || !params.unfiltered)) {
6101 data = this.data;
6102 }
6103
6104 if (params && params.useCurrentPage) {
6105 data = data.slice(this.pageFrom - 1, this.pageTo);
6106 }
6107
6108 if (params && !params.includeHiddenRows) {
6109 var hiddenRows = this.getHiddenRows();
6110 data = data.filter(function (row) {
6111 return Utils.findIndex(hiddenRows, row) === -1;
6112 });
6113 }
6114
6115 return data;
6116 }
6117 }, {
6118 key: "getSelections",
6119 value: function getSelections() {
6120 var _this17 = this;
6121
6122 // fix #2424: from html with checkbox
6123 return this.data.filter(function (row) {
6124 return row[_this17.header.stateField] === true;
6125 });
6126 }
6127 }, {
6128 key: "getAllSelections",
6129 value: function getAllSelections() {
6130 var _this18 = this;
6131
6132 return this.options.data.filter(function (row) {
6133 return row[_this18.header.stateField] === true;
6134 });
6135 }
6136 }, {
6137 key: "load",
6138 value: function load(_data) {
6139 var fixedScroll = false;
6140 var data = _data; // #431: support pagination
6141
6142 if (this.options.pagination && this.options.sidePagination === 'server') {
6143 this.options.totalRows = data[this.options.totalField];
6144 }
6145
6146 if (this.options.pagination && this.options.sidePagination === 'server') {
6147 this.options.totalNotFiltered = data[this.options.totalNotFilteredField];
6148 }
6149
6150 fixedScroll = data.fixedScroll;
6151 data = Array.isArray(data) ? data : data[this.options.dataField];
6152 this.initData(data);
6153 this.initSearch();
6154 this.initPagination();
6155 this.initBody(fixedScroll);
6156 }
6157 }, {
6158 key: "append",
6159 value: function append(data) {
6160 this.initData(data, 'append');
6161 this.initSearch();
6162 this.initPagination();
6163 this.initSort();
6164 this.initBody(true);
6165 }
6166 }, {
6167 key: "prepend",
6168 value: function prepend(data) {
6169 this.initData(data, 'prepend');
6170 this.initSearch();
6171 this.initPagination();
6172 this.initSort();
6173 this.initBody(true);
6174 }
6175 }, {
6176 key: "remove",
6177 value: function remove(params) {
6178 var len = this.options.data.length;
6179 var i;
6180 var row;
6181
6182 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('values')) {
6183 return;
6184 }
6185
6186 for (i = len - 1; i >= 0; i--) {
6187 row = this.options.data[i];
6188
6189 if (!row.hasOwnProperty(params.field)) {
6190 continue;
6191 }
6192
6193 if (params.values.includes(row[params.field])) {
6194 this.options.data.splice(i, 1);
6195
6196 if (this.options.sidePagination === 'server') {
6197 this.options.totalRows -= 1;
6198 }
6199 }
6200 }
6201
6202 if (len === this.options.data.length) {
6203 return;
6204 }
6205
6206 this.initSearch();
6207 this.initPagination();
6208 this.initSort();
6209 this.initBody(true);
6210 }
6211 }, {
6212 key: "removeAll",
6213 value: function removeAll() {
6214 if (this.options.data.length > 0) {
6215 this.options.data.splice(0, this.options.data.length);
6216 this.initSearch();
6217 this.initPagination();
6218 this.initBody(true);
6219 }
6220 }
6221 }, {
6222 key: "insertRow",
6223 value: function insertRow(params) {
6224 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
6225 return;
6226 }
6227
6228 this.options.data.splice(params.index, 0, params.row);
6229 this.initSearch();
6230 this.initPagination();
6231 this.initSort();
6232 this.initBody(true);
6233 }
6234 }, {
6235 key: "updateRow",
6236 value: function updateRow(params) {
6237 var allParams = Array.isArray(params) ? params : [params];
6238 var _iteratorNormalCompletion5 = true;
6239 var _didIteratorError5 = false;
6240 var _iteratorError5 = undefined;
6241
6242 try {
6243 for (var _iterator5 = allParams[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
6244 var _params = _step5.value;
6245
6246 if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) {
6247 continue;
6248 }
6249
6250 $.extend(this.options.data[_params.index], _params.row);
6251
6252 if (_params.hasOwnProperty('replace') && _params.replace) {
6253 this.options.data[_params.index] = _params.row;
6254 } else {
6255 $.extend(this.options.data[_params.index], _params.row);
6256 }
6257 }
6258 } catch (err) {
6259 _didIteratorError5 = true;
6260 _iteratorError5 = err;
6261 } finally {
6262 try {
6263 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
6264 _iterator5.return();
6265 }
6266 } finally {
6267 if (_didIteratorError5) {
6268 throw _iteratorError5;
6269 }
6270 }
6271 }
6272
6273 this.initSearch();
6274 this.initPagination();
6275 this.initSort();
6276 this.initBody(true);
6277 }
6278 }, {
6279 key: "getRowByUniqueId",
6280 value: function getRowByUniqueId(_id) {
6281 var uniqueId = this.options.uniqueId;
6282 var len = this.options.data.length;
6283 var id = _id;
6284 var dataRow = null;
6285 var i;
6286 var row;
6287 var rowUniqueId;
6288
6289 for (i = len - 1; i >= 0; i--) {
6290 row = this.options.data[i];
6291
6292 if (row.hasOwnProperty(uniqueId)) {
6293 // uniqueId is a column
6294 rowUniqueId = row[uniqueId];
6295 } else if (row._data && row._data.hasOwnProperty(uniqueId)) {
6296 // uniqueId is a row data property
6297 rowUniqueId = row._data[uniqueId];
6298 } else {
6299 continue;
6300 }
6301
6302 if (typeof rowUniqueId === 'string') {
6303 id = id.toString();
6304 } else if (typeof rowUniqueId === 'number') {
6305 if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
6306 id = parseInt(id);
6307 } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
6308 id = parseFloat(id);
6309 }
6310 }
6311
6312 if (rowUniqueId === id) {
6313 dataRow = row;
6314 break;
6315 }
6316 }
6317
6318 return dataRow;
6319 }
6320 }, {
6321 key: "updateByUniqueId",
6322 value: function updateByUniqueId(params) {
6323 var allParams = Array.isArray(params) ? params : [params];
6324 var _iteratorNormalCompletion6 = true;
6325 var _didIteratorError6 = false;
6326 var _iteratorError6 = undefined;
6327
6328 try {
6329 for (var _iterator6 = allParams[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
6330 var _params2 = _step6.value;
6331
6332 if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) {
6333 continue;
6334 }
6335
6336 var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id));
6337
6338 if (rowId === -1) {
6339 continue;
6340 }
6341
6342 if (_params2.hasOwnProperty('replace') && _params2.replace) {
6343 this.options.data[rowId] = _params2.row;
6344 } else {
6345 $.extend(this.options.data[rowId], _params2.row);
6346 }
6347 }
6348 } catch (err) {
6349 _didIteratorError6 = true;
6350 _iteratorError6 = err;
6351 } finally {
6352 try {
6353 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
6354 _iterator6.return();
6355 }
6356 } finally {
6357 if (_didIteratorError6) {
6358 throw _iteratorError6;
6359 }
6360 }
6361 }
6362
6363 this.initSearch();
6364 this.initPagination();
6365 this.initSort();
6366 this.initBody(true);
6367 }
6368 }, {
6369 key: "removeByUniqueId",
6370 value: function removeByUniqueId(id) {
6371 var len = this.options.data.length;
6372 var row = this.getRowByUniqueId(id);
6373
6374 if (row) {
6375 this.options.data.splice(this.options.data.indexOf(row), 1);
6376 }
6377
6378 if (len === this.options.data.length) {
6379 return;
6380 }
6381
6382 this.initSearch();
6383 this.initPagination();
6384 this.initBody(true);
6385 }
6386 }, {
6387 key: "updateCell",
6388 value: function updateCell(params) {
6389 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
6390 return;
6391 }
6392
6393 this.data[params.index][params.field] = params.value;
6394
6395 if (params.reinit === false) {
6396 return;
6397 }
6398
6399 this.initSort();
6400 this.initBody(true);
6401 }
6402 }, {
6403 key: "updateCellByUniqueId",
6404 value: function updateCellByUniqueId(params) {
6405 var _this19 = this;
6406
6407 if (!params.hasOwnProperty('id') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
6408 return;
6409 }
6410
6411 var allParams = Array.isArray(params) ? params : [params];
6412 allParams.forEach(function (_ref6) {
6413 var id = _ref6.id,
6414 field = _ref6.field,
6415 value = _ref6.value;
6416
6417 var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id));
6418
6419 if (rowId === -1) {
6420 return;
6421 }
6422
6423 _this19.options.data[rowId][field] = value;
6424 });
6425
6426 if (params.reinit === false) {
6427 return;
6428 }
6429
6430 this.initSort();
6431 this.initBody(true);
6432 }
6433 }, {
6434 key: "showRow",
6435 value: function showRow(params) {
6436 this._toggleRow(params, true);
6437 }
6438 }, {
6439 key: "hideRow",
6440 value: function hideRow(params) {
6441 this._toggleRow(params, false);
6442 }
6443 }, {
6444 key: "_toggleRow",
6445 value: function _toggleRow(params, visible) {
6446 var row;
6447
6448 if (params.hasOwnProperty('index')) {
6449 row = this.getData()[params.index];
6450 } else if (params.hasOwnProperty('uniqueId')) {
6451 row = this.getRowByUniqueId(params.uniqueId);
6452 }
6453
6454 if (!row) {
6455 return;
6456 }
6457
6458 var index = Utils.findIndex(this.hiddenRows, row);
6459
6460 if (!visible && index === -1) {
6461 this.hiddenRows.push(row);
6462 } else if (visible && index > -1) {
6463 this.hiddenRows.splice(index, 1);
6464 }
6465
6466 if (visible) {
6467 this.updatePagination();
6468 } else {
6469 this.initBody(true);
6470 this.initPagination();
6471 }
6472 }
6473 }, {
6474 key: "getHiddenRows",
6475 value: function getHiddenRows(show) {
6476 if (show) {
6477 this.initHiddenRows();
6478 this.initBody(true);
6479 return;
6480 }
6481
6482 var data = this.getData();
6483 var rows = [];
6484 var _iteratorNormalCompletion7 = true;
6485 var _didIteratorError7 = false;
6486 var _iteratorError7 = undefined;
6487
6488 try {
6489 for (var _iterator7 = data[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
6490 var row = _step7.value;
6491
6492 if (this.hiddenRows.includes(row)) {
6493 rows.push(row);
6494 }
6495 }
6496 } catch (err) {
6497 _didIteratorError7 = true;
6498 _iteratorError7 = err;
6499 } finally {
6500 try {
6501 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
6502 _iterator7.return();
6503 }
6504 } finally {
6505 if (_didIteratorError7) {
6506 throw _iteratorError7;
6507 }
6508 }
6509 }
6510
6511 this.hiddenRows = rows;
6512 return rows;
6513 }
6514 }, {
6515 key: "showColumn",
6516 value: function showColumn(field) {
6517 var _this20 = this;
6518
6519 var fields = Array.isArray(field) ? field : [field];
6520 fields.forEach(function (field) {
6521 _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true);
6522 });
6523 }
6524 }, {
6525 key: "hideColumn",
6526 value: function hideColumn(field) {
6527 var _this21 = this;
6528
6529 var fields = Array.isArray(field) ? field : [field];
6530 fields.forEach(function (field) {
6531 _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true);
6532 });
6533 }
6534 }, {
6535 key: "_toggleColumn",
6536 value: function _toggleColumn(index, checked, needUpdate) {
6537 if (index === -1 || this.columns[index].visible === checked) {
6538 return;
6539 }
6540
6541 this.columns[index].visible = checked;
6542 this.initHeader();
6543 this.initSearch();
6544 this.initPagination();
6545 this.initBody();
6546
6547 if (this.options.showColumns) {
6548 var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false);
6549
6550 if (needUpdate) {
6551 $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked);
6552 }
6553
6554 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
6555 $items.filter(':checked').prop('disabled', true);
6556 }
6557 }
6558 }
6559 }, {
6560 key: "getVisibleColumns",
6561 value: function getVisibleColumns() {
6562 var _this22 = this;
6563
6564 return this.columns.filter(function (column) {
6565 return column.visible && !_this22.isSelectionColumn(column);
6566 });
6567 }
6568 }, {
6569 key: "getHiddenColumns",
6570 value: function getHiddenColumns() {
6571 return this.columns.filter(function (_ref7) {
6572 var visible = _ref7.visible;
6573 return !visible;
6574 });
6575 }
6576 }, {
6577 key: "isSelectionColumn",
6578 value: function isSelectionColumn(column) {
6579 return column.radio || column.checkbox;
6580 }
6581 }, {
6582 key: "showAllColumns",
6583 value: function showAllColumns() {
6584 this._toggleAllColumns(true);
6585 }
6586 }, {
6587 key: "hideAllColumns",
6588 value: function hideAllColumns() {
6589 this._toggleAllColumns(false);
6590 }
6591 }, {
6592 key: "_toggleAllColumns",
6593 value: function _toggleAllColumns(visible) {
6594 var _this23 = this;
6595
6596 var _iteratorNormalCompletion8 = true;
6597 var _didIteratorError8 = false;
6598 var _iteratorError8 = undefined;
6599
6600 try {
6601 for (var _iterator8 = this.columns.slice().reverse()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
6602 var column = _step8.value;
6603
6604 if (column.switchable) {
6605 if (!visible && this.options.showColumns && this.getVisibleColumns().length === this.options.minimumCountColumns) {
6606 continue;
6607 }
6608
6609 column.visible = visible;
6610 }
6611 }
6612 } catch (err) {
6613 _didIteratorError8 = true;
6614 _iteratorError8 = err;
6615 } finally {
6616 try {
6617 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
6618 _iterator8.return();
6619 }
6620 } finally {
6621 if (_didIteratorError8) {
6622 throw _iteratorError8;
6623 }
6624 }
6625 }
6626
6627 this.initHeader();
6628 this.initSearch();
6629 this.initPagination();
6630 this.initBody();
6631
6632 if (this.options.showColumns) {
6633 var $items = this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop('disabled', false);
6634
6635 if (visible) {
6636 $items.prop('checked', visible);
6637 } else {
6638 $items.get().reverse().forEach(function (item) {
6639 if ($items.filter(':checked').length > _this23.options.minimumCountColumns) {
6640 $(item).prop('checked', visible);
6641 }
6642 });
6643 }
6644
6645 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
6646 $items.filter(':checked').prop('disabled', true);
6647 }
6648 }
6649 }
6650 }, {
6651 key: "mergeCells",
6652 value: function mergeCells(options) {
6653 var row = options.index;
6654 var col = this.getVisibleFields().indexOf(options.field);
6655 var rowspan = options.rowspan || 1;
6656 var colspan = options.colspan || 1;
6657 var i;
6658 var j;
6659 var $tr = this.$body.find('>tr');
6660
6661 if (this.options.detailView && !this.options.cardView) {
6662 col += 1;
6663 }
6664
6665 var $td = $tr.eq(row).find('>td').eq(col);
6666
6667 if (row < 0 || col < 0 || row >= this.data.length) {
6668 return;
6669 }
6670
6671 for (i = row; i < row + rowspan; i++) {
6672 for (j = col; j < col + colspan; j++) {
6673 $tr.eq(i).find('>td').eq(j).hide();
6674 }
6675 }
6676
6677 $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
6678 }
6679 }, {
6680 key: "checkAll",
6681 value: function checkAll() {
6682 this._toggleCheckAll(true);
6683 }
6684 }, {
6685 key: "uncheckAll",
6686 value: function uncheckAll() {
6687 this._toggleCheckAll(false);
6688 }
6689 }, {
6690 key: "_toggleCheckAll",
6691 value: function _toggleCheckAll(checked) {
6692 var rowsBefore = this.getSelections();
6693 this.$selectAll.add(this.$selectAll_).prop('checked', checked);
6694 this.$selectItem.filter(':enabled').prop('checked', checked);
6695 this.updateRows();
6696 var rowsAfter = this.getSelections();
6697
6698 if (checked) {
6699 this.trigger('check-all', rowsAfter, rowsBefore);
6700 return;
6701 }
6702
6703 this.trigger('uncheck-all', rowsAfter, rowsBefore);
6704 }
6705 }, {
6706 key: "checkInvert",
6707 value: function checkInvert() {
6708 var $items = this.$selectItem.filter(':enabled');
6709 var checked = $items.filter(':checked');
6710 $items.each(function (i, el) {
6711 $(el).prop('checked', !$(el).prop('checked'));
6712 });
6713 this.updateRows();
6714 this.updateSelected();
6715 this.trigger('uncheck-some', checked);
6716 checked = this.getSelections();
6717 this.trigger('check-some', checked);
6718 }
6719 }, {
6720 key: "check",
6721 value: function check(index) {
6722 this._toggleCheck(true, index);
6723 }
6724 }, {
6725 key: "uncheck",
6726 value: function uncheck(index) {
6727 this._toggleCheck(false, index);
6728 }
6729 }, {
6730 key: "_toggleCheck",
6731 value: function _toggleCheck(checked, index) {
6732 var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]"));
6733 var row = this.data[index];
6734
6735 if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
6736 var _iteratorNormalCompletion9 = true;
6737 var _didIteratorError9 = false;
6738 var _iteratorError9 = undefined;
6739
6740 try {
6741 for (var _iterator9 = this.options.data[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
6742 var r = _step9.value;
6743 r[this.header.stateField] = false;
6744 }
6745 } catch (err) {
6746 _didIteratorError9 = true;
6747 _iteratorError9 = err;
6748 } finally {
6749 try {
6750 if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
6751 _iterator9.return();
6752 }
6753 } finally {
6754 if (_didIteratorError9) {
6755 throw _iteratorError9;
6756 }
6757 }
6758 }
6759
6760 this.$selectItem.filter(':checked').not($el).prop('checked', false);
6761 }
6762
6763 row[this.header.stateField] = checked;
6764
6765 if (this.options.multipleSelectRow) {
6766 if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) {
6767 var indexes = [this.multipleSelectRowLastSelectedIndex, index].sort();
6768
6769 for (var i = indexes[0] + 1; i < indexes[1]; i++) {
6770 this.data[i][this.header.stateField] = true;
6771 this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true);
6772 }
6773 }
6774
6775 this.multipleSelectRowCtrlKey = false;
6776 this.multipleSelectRowShiftKey = false;
6777 this.multipleSelectRowLastSelectedIndex = checked ? index : -1;
6778 }
6779
6780 $el.prop('checked', checked);
6781 this.updateSelected();
6782 this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
6783 }
6784 }, {
6785 key: "checkBy",
6786 value: function checkBy(obj) {
6787 this._toggleCheckBy(true, obj);
6788 }
6789 }, {
6790 key: "uncheckBy",
6791 value: function uncheckBy(obj) {
6792 this._toggleCheckBy(false, obj);
6793 }
6794 }, {
6795 key: "_toggleCheckBy",
6796 value: function _toggleCheckBy(checked, obj) {
6797 var _this24 = this;
6798
6799 if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
6800 return;
6801 }
6802
6803 var rows = [];
6804 this.data.forEach(function (row, i) {
6805 if (!row.hasOwnProperty(obj.field)) {
6806 return false;
6807 }
6808
6809 if (obj.values.includes(row[obj.field])) {
6810 var $el = _this24.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
6811
6812 $el = checked ? $el.not(':checked') : $el.filter(':checked');
6813
6814 if (!$el.length) {
6815 return;
6816 }
6817
6818 $el.prop('checked', checked);
6819 row[_this24.header.stateField] = checked;
6820 rows.push(row);
6821
6822 _this24.trigger(checked ? 'check' : 'uncheck', row, $el);
6823 }
6824 });
6825 this.updateSelected();
6826 this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
6827 }
6828 }, {
6829 key: "refresh",
6830 value: function refresh(params) {
6831 if (params && params.url) {
6832 this.options.url = params.url;
6833 }
6834
6835 if (params && params.pageNumber) {
6836 this.options.pageNumber = params.pageNumber;
6837 }
6838
6839 if (params && params.pageSize) {
6840 this.options.pageSize = params.pageSize;
6841 }
6842
6843 this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url));
6844 }
6845 }, {
6846 key: "destroy",
6847 value: function destroy() {
6848 this.$el.insertBefore(this.$container);
6849 $(this.options.toolbar).insertBefore(this.$el);
6850 this.$container.next().remove();
6851 this.$container.remove();
6852 this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class
6853 }
6854 }, {
6855 key: "resetView",
6856 value: function resetView(params) {
6857 var padding = 0;
6858
6859 if (params && params.height) {
6860 this.options.height = params.height;
6861 }
6862
6863 this.$selectAll.prop('checked', this.$selectItem.length > 0 && this.$selectItem.length === this.$selectItem.filter(':checked').length);
6864 this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
6865
6866 if (!this.options.cardView && this.options.showHeader && this.options.height) {
6867 this.$tableHeader.show();
6868 this.resetHeader();
6869 padding += this.$header.outerHeight(true) + 1;
6870 } else {
6871 this.$tableHeader.hide();
6872 this.trigger('post-header');
6873 }
6874
6875 if (!this.options.cardView && this.options.showFooter) {
6876 this.$tableFooter.show();
6877 this.fitFooter();
6878
6879 if (this.options.height) {
6880 padding += this.$tableFooter.outerHeight(true);
6881 }
6882 }
6883
6884 if (this.$container.hasClass('fullscreen')) {
6885 this.$tableContainer.css('height', '');
6886 this.$tableContainer.css('width', '');
6887 } else if (this.options.height) {
6888 var toolbarHeight = this.$toolbar.outerHeight(true);
6889 var paginationHeight = this.$pagination.outerHeight(true);
6890 var height = this.options.height - toolbarHeight - paginationHeight;
6891 var $bodyTable = this.$tableBody.find('>table');
6892 var tableHeight = $bodyTable.outerHeight();
6893 this.$tableContainer.css('height', "".concat(height, "px"));
6894
6895 if (this.$tableBorder) {
6896 var tableBorderHeight = height - tableHeight - 2;
6897
6898 if (this.$tableBody[0].scrollWidth - this.$tableBody.innerWidth()) {
6899 tableBorderHeight -= Utils.getScrollBarWidth();
6900 }
6901
6902 this.$tableBorder.css('width', "".concat($bodyTable.outerWidth(), "px"));
6903 this.$tableBorder.css('height', "".concat(tableBorderHeight, "px"));
6904 }
6905 }
6906
6907 if (this.options.cardView) {
6908 // remove the element css
6909 this.$el.css('margin-top', '0');
6910 this.$tableContainer.css('padding-bottom', '0');
6911 this.$tableFooter.hide();
6912 } else {
6913 // Assign the correct sortable arrow
6914 this.getCaret();
6915 this.$tableContainer.css('padding-bottom', "".concat(padding, "px"));
6916 }
6917
6918 this.trigger('reset-view');
6919 }
6920 }, {
6921 key: "showLoading",
6922 value: function showLoading() {
6923 this.$tableLoading.css('display', 'flex');
6924 }
6925 }, {
6926 key: "hideLoading",
6927 value: function hideLoading() {
6928 this.$tableLoading.css('display', 'none');
6929 }
6930 }, {
6931 key: "togglePagination",
6932 value: function togglePagination() {
6933 this.options.pagination = !this.options.pagination;
6934 var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
6935 var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
6936 this.$toolbar.find('button[name="paginationSwitch"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
6937 this.updatePagination();
6938 }
6939 }, {
6940 key: "toggleFullscreen",
6941 value: function toggleFullscreen() {
6942 this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
6943 this.resetView();
6944 }
6945 }, {
6946 key: "toggleView",
6947 value: function toggleView() {
6948 this.options.cardView = !this.options.cardView;
6949 this.initHeader();
6950 var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : '';
6951 var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : '';
6952 this.$toolbar.find('button[name="toggle"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
6953 this.initBody();
6954 this.trigger('toggle', this.options.cardView);
6955 }
6956 }, {
6957 key: "resetSearch",
6958 value: function resetSearch(text) {
6959 var $search = this.$toolbar.find('.search input');
6960 $search.val(text || '');
6961 this.onSearch({
6962 currentTarget: $search
6963 });
6964 }
6965 }, {
6966 key: "filterBy",
6967 value: function filterBy(columns, options) {
6968 this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $.extend(this.options.filterOptions, options);
6969 this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns;
6970 this.options.pageNumber = 1;
6971 this.initSearch();
6972 this.updatePagination();
6973 }
6974 }, {
6975 key: "scrollTo",
6976 value: function scrollTo(params) {
6977 if (typeof params === 'undefined') {
6978 return this.$tableBody.scrollTop();
6979 }
6980
6981 var options = {
6982 unit: 'px',
6983 value: 0
6984 };
6985
6986 if (_typeof(params) === 'object') {
6987 options = Object.assign(options, params);
6988 } else if (typeof params === 'string' && params === 'bottom') {
6989 options.value = this.$tableBody[0].scrollHeight;
6990 } else if (typeof params === 'string') {
6991 options.value = params;
6992 }
6993
6994 var scrollTo = options.value;
6995
6996 if (options.unit === 'rows') {
6997 scrollTo = 0;
6998 this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
6999 scrollTo += $(el).outerHeight(true);
7000 });
7001 }
7002
7003 this.$tableBody.scrollTop(scrollTo);
7004 }
7005 }, {
7006 key: "getScrollPosition",
7007 value: function getScrollPosition() {
7008 return this.scrollTo();
7009 }
7010 }, {
7011 key: "selectPage",
7012 value: function selectPage(page) {
7013 if (page > 0 && page <= this.options.totalPages) {
7014 this.options.pageNumber = page;
7015 this.updatePagination();
7016 }
7017 }
7018 }, {
7019 key: "prevPage",
7020 value: function prevPage() {
7021 if (this.options.pageNumber > 1) {
7022 this.options.pageNumber--;
7023 this.updatePagination();
7024 }
7025 }
7026 }, {
7027 key: "nextPage",
7028 value: function nextPage() {
7029 if (this.options.pageNumber < this.options.totalPages) {
7030 this.options.pageNumber++;
7031 this.updatePagination();
7032 }
7033 }
7034 }, {
7035 key: "toggleDetailView",
7036 value: function toggleDetailView(index, _columnDetailFormatter) {
7037 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index));
7038
7039 if ($tr.next().is('tr.detail-view')) {
7040 this.collapseRow(index);
7041 } else {
7042 this.expandRow(index, _columnDetailFormatter);
7043 }
7044
7045 this.resetView();
7046 }
7047 }, {
7048 key: "expandRow",
7049 value: function expandRow(index, _columnDetailFormatter) {
7050 var row = this.data[index];
7051 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
7052
7053 if ($tr.next().is('tr.detail-view')) {
7054 return;
7055 }
7056
7057 if (this.options.detailViewIcon) {
7058 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
7059 }
7060
7061 $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
7062 var $element = $tr.next().find('td');
7063 var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;
7064 var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], '');
7065
7066 if ($element.length === 1) {
7067 $element.append(content);
7068 }
7069
7070 this.trigger('expand-row', index, row, $element);
7071 }
7072 }, {
7073 key: "collapseRow",
7074 value: function collapseRow(index) {
7075 var row = this.data[index];
7076 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
7077
7078 if (!$tr.next().is('tr.detail-view')) {
7079 return;
7080 }
7081
7082 if (this.options.detailViewIcon) {
7083 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen));
7084 }
7085
7086 this.trigger('collapse-row', index, row, $tr.next());
7087 $tr.next().remove();
7088 }
7089 }, {
7090 key: "expandAllRows",
7091 value: function expandAllRows() {
7092 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
7093
7094 for (var i = 0; i < trs.length; i++) {
7095 this.expandRow($(trs[i]).data('index'));
7096 }
7097 }
7098 }, {
7099 key: "collapseAllRows",
7100 value: function collapseAllRows() {
7101 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
7102
7103 for (var i = 0; i < trs.length; i++) {
7104 this.collapseRow($(trs[i]).data('index'));
7105 }
7106 }
7107 }, {
7108 key: "updateColumnTitle",
7109 value: function updateColumnTitle(params) {
7110 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) {
7111 return;
7112 }
7113
7114 this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title;
7115
7116 if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
7117 var header = this.options.height !== undefined ? this.$tableHeader : this.$header;
7118 header.find('th[data-field]').each(function (i, el) {
7119 if ($(el).data('field') === params.field) {
7120 $($(el).find('.th-inner')[0]).text(params.title);
7121 return false;
7122 }
7123 });
7124 }
7125 }
7126 }, {
7127 key: "updateFormatText",
7128 value: function updateFormatText(formatName, text) {
7129 if (!/^format/.test(formatName) || !this.options[formatName]) {
7130 return;
7131 }
7132
7133 if (typeof text === 'string') {
7134 this.options[formatName] = function () {
7135 return text;
7136 };
7137 } else if (typeof text === 'function') {
7138 this.options[formatName] = text;
7139 }
7140
7141 this.initToolbar();
7142 this.initPagination();
7143 this.initBody();
7144 }
7145 }]);
7146
7147 return BootstrapTable;
7148 }();
7149
7150 BootstrapTable.VERSION = Constants.VERSION;
7151 BootstrapTable.DEFAULTS = Constants.DEFAULTS;
7152 BootstrapTable.LOCALES = Constants.LOCALES;
7153 BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS;
7154 BootstrapTable.METHODS = Constants.METHODS;
7155 BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION
7156 // =======================
7157
7158 $.BootstrapTable = BootstrapTable;
7159
7160 $.fn.bootstrapTable = function (option) {
7161 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key5 = 1; _key5 < _len2; _key5++) {
7162 args[_key5 - 1] = arguments[_key5];
7163 }
7164
7165 var value;
7166 this.each(function (i, el) {
7167 var data = $(el).data('bootstrap.table');
7168 var options = $.extend({}, BootstrapTable.DEFAULTS, $(el).data(), _typeof(option) === 'object' && option);
7169
7170 if (typeof option === 'string') {
7171 var _data2;
7172
7173 if (!Constants.METHODS.includes(option)) {
7174 throw new Error("Unknown method: ".concat(option));
7175 }
7176
7177 if (!data) {
7178 return;
7179 }
7180
7181 value = (_data2 = data)[option].apply(_data2, args);
7182
7183 if (option === 'destroy') {
7184 $(el).removeData('bootstrap.table');
7185 }
7186 }
7187
7188 if (!data) {
7189 $(el).data('bootstrap.table', data = new $.BootstrapTable(el, options));
7190 }
7191 });
7192 return typeof value === 'undefined' ? this : value;
7193 };
7194
7195 $.fn.bootstrapTable.Constructor = BootstrapTable;
7196 $.fn.bootstrapTable.theme = Constants.THEME;
7197 $.fn.bootstrapTable.VERSION = Constants.VERSION;
7198 $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
7199 $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
7200 $.fn.bootstrapTable.events = BootstrapTable.EVENTS;
7201 $.fn.bootstrapTable.locales = BootstrapTable.LOCALES;
7202 $.fn.bootstrapTable.methods = BootstrapTable.METHODS;
7203 $.fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT
7204 // =======================
7205
7206 $(function () {
7207 $('[data-toggle="table"]').bootstrapTable();
7208 });
7209
7210 return BootstrapTable;
7211
7212})));