UNPKG

274 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 $ = $ && Object.prototype.hasOwnProperty.call($, '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 var MATCH = wellKnownSymbol('match');
1998
1999 // `IsRegExp` abstract operation
2000 // https://tc39.github.io/ecma262/#sec-isregexp
2001 var isRegexp = function (it) {
2002 var isRegExp;
2003 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
2004 };
2005
2006 // `RegExp.prototype.flags` getter implementation
2007 // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
2008 var regexpFlags = function () {
2009 var that = anObject(this);
2010 var result = '';
2011 if (that.global) result += 'g';
2012 if (that.ignoreCase) result += 'i';
2013 if (that.multiline) result += 'm';
2014 if (that.dotAll) result += 's';
2015 if (that.unicode) result += 'u';
2016 if (that.sticky) result += 'y';
2017 return result;
2018 };
2019
2020 // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
2021 // so we use an intermediate function.
2022 function RE(s, f) {
2023 return RegExp(s, f);
2024 }
2025
2026 var UNSUPPORTED_Y = fails(function () {
2027 // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
2028 var re = RE('a', 'y');
2029 re.lastIndex = 2;
2030 return re.exec('abcd') != null;
2031 });
2032
2033 var BROKEN_CARET = fails(function () {
2034 // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
2035 var re = RE('^r', 'gy');
2036 re.lastIndex = 2;
2037 return re.exec('str') != null;
2038 });
2039
2040 var regexpStickyHelpers = {
2041 UNSUPPORTED_Y: UNSUPPORTED_Y,
2042 BROKEN_CARET: BROKEN_CARET
2043 };
2044
2045 var SPECIES$3 = wellKnownSymbol('species');
2046
2047 var setSpecies = function (CONSTRUCTOR_NAME) {
2048 var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
2049 var defineProperty = objectDefineProperty.f;
2050
2051 if (descriptors && Constructor && !Constructor[SPECIES$3]) {
2052 defineProperty(Constructor, SPECIES$3, {
2053 configurable: true,
2054 get: function () { return this; }
2055 });
2056 }
2057 };
2058
2059 var defineProperty$5 = objectDefineProperty.f;
2060 var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
2061
2062
2063
2064
2065
2066 var setInternalState$2 = internalState.set;
2067
2068
2069
2070 var MATCH$1 = wellKnownSymbol('match');
2071 var NativeRegExp = global_1.RegExp;
2072 var RegExpPrototype = NativeRegExp.prototype;
2073 var re1 = /a/g;
2074 var re2 = /a/g;
2075
2076 // "new" should create a new object, old webkit bug
2077 var CORRECT_NEW = new NativeRegExp(re1) !== re1;
2078
2079 var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y;
2080
2081 var FORCED$4 = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y$1 || fails(function () {
2082 re2[MATCH$1] = false;
2083 // RegExp constructor can alter flags and IsRegExp works correct with @@match
2084 return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
2085 })));
2086
2087 // `RegExp` constructor
2088 // https://tc39.github.io/ecma262/#sec-regexp-constructor
2089 if (FORCED$4) {
2090 var RegExpWrapper = function RegExp(pattern, flags) {
2091 var thisIsRegExp = this instanceof RegExpWrapper;
2092 var patternIsRegExp = isRegexp(pattern);
2093 var flagsAreUndefined = flags === undefined;
2094 var sticky;
2095
2096 if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {
2097 return pattern;
2098 }
2099
2100 if (CORRECT_NEW) {
2101 if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;
2102 } else if (pattern instanceof RegExpWrapper) {
2103 if (flagsAreUndefined) flags = regexpFlags.call(pattern);
2104 pattern = pattern.source;
2105 }
2106
2107 if (UNSUPPORTED_Y$1) {
2108 sticky = !!flags && flags.indexOf('y') > -1;
2109 if (sticky) flags = flags.replace(/y/g, '');
2110 }
2111
2112 var result = inheritIfRequired(
2113 CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),
2114 thisIsRegExp ? this : RegExpPrototype,
2115 RegExpWrapper
2116 );
2117
2118 if (UNSUPPORTED_Y$1 && sticky) setInternalState$2(result, { sticky: sticky });
2119
2120 return result;
2121 };
2122 var proxy = function (key) {
2123 key in RegExpWrapper || defineProperty$5(RegExpWrapper, key, {
2124 configurable: true,
2125 get: function () { return NativeRegExp[key]; },
2126 set: function (it) { NativeRegExp[key] = it; }
2127 });
2128 };
2129 var keys$2 = getOwnPropertyNames$1(NativeRegExp);
2130 var index = 0;
2131 while (keys$2.length > index) proxy(keys$2[index++]);
2132 RegExpPrototype.constructor = RegExpWrapper;
2133 RegExpWrapper.prototype = RegExpPrototype;
2134 redefine(global_1, 'RegExp', RegExpWrapper);
2135 }
2136
2137 // https://tc39.github.io/ecma262/#sec-get-regexp-@@species
2138 setSpecies('RegExp');
2139
2140 var nativeExec = RegExp.prototype.exec;
2141 // This always refers to the native implementation, because the
2142 // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
2143 // which loads this file before patching the method.
2144 var nativeReplace = String.prototype.replace;
2145
2146 var patchedExec = nativeExec;
2147
2148 var UPDATES_LAST_INDEX_WRONG = (function () {
2149 var re1 = /a/;
2150 var re2 = /b*/g;
2151 nativeExec.call(re1, 'a');
2152 nativeExec.call(re2, 'a');
2153 return re1.lastIndex !== 0 || re2.lastIndex !== 0;
2154 })();
2155
2156 var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
2157
2158 // nonparticipating capturing group, copied from es5-shim's String#split patch.
2159 var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
2160
2161 var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2;
2162
2163 if (PATCH) {
2164 patchedExec = function exec(str) {
2165 var re = this;
2166 var lastIndex, reCopy, match, i;
2167 var sticky = UNSUPPORTED_Y$2 && re.sticky;
2168 var flags = regexpFlags.call(re);
2169 var source = re.source;
2170 var charsAdded = 0;
2171 var strCopy = str;
2172
2173 if (sticky) {
2174 flags = flags.replace('y', '');
2175 if (flags.indexOf('g') === -1) {
2176 flags += 'g';
2177 }
2178
2179 strCopy = String(str).slice(re.lastIndex);
2180 // Support anchored sticky behavior.
2181 if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
2182 source = '(?: ' + source + ')';
2183 strCopy = ' ' + strCopy;
2184 charsAdded++;
2185 }
2186 // ^(? + rx + ) is needed, in combination with some str slicing, to
2187 // simulate the 'y' flag.
2188 reCopy = new RegExp('^(?:' + source + ')', flags);
2189 }
2190
2191 if (NPCG_INCLUDED) {
2192 reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
2193 }
2194 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
2195
2196 match = nativeExec.call(sticky ? reCopy : re, strCopy);
2197
2198 if (sticky) {
2199 if (match) {
2200 match.input = match.input.slice(charsAdded);
2201 match[0] = match[0].slice(charsAdded);
2202 match.index = re.lastIndex;
2203 re.lastIndex += match[0].length;
2204 } else re.lastIndex = 0;
2205 } else if (UPDATES_LAST_INDEX_WRONG && match) {
2206 re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
2207 }
2208 if (NPCG_INCLUDED && match && match.length > 1) {
2209 // Fix browsers whose `exec` methods don't consistently return `undefined`
2210 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
2211 nativeReplace.call(match[0], reCopy, function () {
2212 for (i = 1; i < arguments.length - 2; i++) {
2213 if (arguments[i] === undefined) match[i] = undefined;
2214 }
2215 });
2216 }
2217
2218 return match;
2219 };
2220 }
2221
2222 var regexpExec = patchedExec;
2223
2224 _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
2225 exec: regexpExec
2226 });
2227
2228 var TO_STRING = 'toString';
2229 var RegExpPrototype$1 = RegExp.prototype;
2230 var nativeToString = RegExpPrototype$1[TO_STRING];
2231
2232 var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
2233 // FF44- RegExp#toString has a wrong name
2234 var INCORRECT_NAME = nativeToString.name != TO_STRING;
2235
2236 // `RegExp.prototype.toString` method
2237 // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
2238 if (NOT_GENERIC || INCORRECT_NAME) {
2239 redefine(RegExp.prototype, TO_STRING, function toString() {
2240 var R = anObject(this);
2241 var p = String(R.source);
2242 var rf = R.flags;
2243 var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype$1) ? regexpFlags.call(R) : rf);
2244 return '/' + p + '/' + f;
2245 }, { unsafe: true });
2246 }
2247
2248 var notARegexp = function (it) {
2249 if (isRegexp(it)) {
2250 throw TypeError("The method doesn't accept regular expressions");
2251 } return it;
2252 };
2253
2254 var MATCH$2 = wellKnownSymbol('match');
2255
2256 var correctIsRegexpLogic = function (METHOD_NAME) {
2257 var regexp = /./;
2258 try {
2259 '/./'[METHOD_NAME](regexp);
2260 } catch (e) {
2261 try {
2262 regexp[MATCH$2] = false;
2263 return '/./'[METHOD_NAME](regexp);
2264 } catch (f) { /* empty */ }
2265 } return false;
2266 };
2267
2268 // `String.prototype.includes` method
2269 // https://tc39.github.io/ecma262/#sec-string.prototype.includes
2270 _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
2271 includes: function includes(searchString /* , position = 0 */) {
2272 return !!~String(requireObjectCoercible(this))
2273 .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
2274 }
2275 });
2276
2277 // `String.prototype.{ codePointAt, at }` methods implementation
2278 var createMethod$4 = function (CONVERT_TO_STRING) {
2279 return function ($this, pos) {
2280 var S = String(requireObjectCoercible($this));
2281 var position = toInteger(pos);
2282 var size = S.length;
2283 var first, second;
2284 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
2285 first = S.charCodeAt(position);
2286 return first < 0xD800 || first > 0xDBFF || position + 1 === size
2287 || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
2288 ? CONVERT_TO_STRING ? S.charAt(position) : first
2289 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
2290 };
2291 };
2292
2293 var stringMultibyte = {
2294 // `String.prototype.codePointAt` method
2295 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
2296 codeAt: createMethod$4(false),
2297 // `String.prototype.at` method
2298 // https://github.com/mathiasbynens/String.prototype.at
2299 charAt: createMethod$4(true)
2300 };
2301
2302 var charAt = stringMultibyte.charAt;
2303
2304
2305
2306 var STRING_ITERATOR = 'String Iterator';
2307 var setInternalState$3 = internalState.set;
2308 var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
2309
2310 // `String.prototype[@@iterator]` method
2311 // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
2312 defineIterator(String, 'String', function (iterated) {
2313 setInternalState$3(this, {
2314 type: STRING_ITERATOR,
2315 string: String(iterated),
2316 index: 0
2317 });
2318 // `%StringIteratorPrototype%.next` method
2319 // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
2320 }, function next() {
2321 var state = getInternalState$2(this);
2322 var string = state.string;
2323 var index = state.index;
2324 var point;
2325 if (index >= string.length) return { value: undefined, done: true };
2326 point = charAt(string, index);
2327 state.index += point.length;
2328 return { value: point, done: false };
2329 });
2330
2331 var SPECIES$4 = wellKnownSymbol('species');
2332
2333 var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
2334 // #replace needs built-in support for named groups.
2335 // #match works fine because it just return the exec results, even if it has
2336 // a "grops" property.
2337 var re = /./;
2338 re.exec = function () {
2339 var result = [];
2340 result.groups = { a: '7' };
2341 return result;
2342 };
2343 return ''.replace(re, '$<a>') !== '7';
2344 });
2345
2346 // IE <= 11 replaces $0 with the whole match, as if it was $&
2347 // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
2348 var REPLACE_KEEPS_$0 = (function () {
2349 return 'a'.replace(/./, '$0') === '$0';
2350 })();
2351
2352 // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
2353 // Weex JS has frozen built-in prototypes, so use try / catch wrapper
2354 var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
2355 var re = /(?:)/;
2356 var originalExec = re.exec;
2357 re.exec = function () { return originalExec.apply(this, arguments); };
2358 var result = 'ab'.split(re);
2359 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
2360 });
2361
2362 var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
2363 var SYMBOL = wellKnownSymbol(KEY);
2364
2365 var DELEGATES_TO_SYMBOL = !fails(function () {
2366 // String methods call symbol-named RegEp methods
2367 var O = {};
2368 O[SYMBOL] = function () { return 7; };
2369 return ''[KEY](O) != 7;
2370 });
2371
2372 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
2373 // Symbol-named RegExp methods call .exec
2374 var execCalled = false;
2375 var re = /a/;
2376
2377 if (KEY === 'split') {
2378 // We can't use real regex here since it causes deoptimization
2379 // and serious performance degradation in V8
2380 // https://github.com/zloirock/core-js/issues/306
2381 re = {};
2382 // RegExp[@@split] doesn't call the regex's exec method, but first creates
2383 // a new one. We need to return the patched regex when creating the new one.
2384 re.constructor = {};
2385 re.constructor[SPECIES$4] = function () { return re; };
2386 re.flags = '';
2387 re[SYMBOL] = /./[SYMBOL];
2388 }
2389
2390 re.exec = function () { execCalled = true; return null; };
2391
2392 re[SYMBOL]('');
2393 return !execCalled;
2394 });
2395
2396 if (
2397 !DELEGATES_TO_SYMBOL ||
2398 !DELEGATES_TO_EXEC ||
2399 (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) ||
2400 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
2401 ) {
2402 var nativeRegExpMethod = /./[SYMBOL];
2403 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
2404 if (regexp.exec === regexpExec) {
2405 if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
2406 // The native String method already delegates to @@method (this
2407 // polyfilled function), leasing to infinite recursion.
2408 // We avoid it by directly calling the native @@method method.
2409 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
2410 }
2411 return { done: true, value: nativeMethod.call(str, regexp, arg2) };
2412 }
2413 return { done: false };
2414 }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 });
2415 var stringMethod = methods[0];
2416 var regexMethod = methods[1];
2417
2418 redefine(String.prototype, KEY, stringMethod);
2419 redefine(RegExp.prototype, SYMBOL, length == 2
2420 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
2421 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
2422 ? function (string, arg) { return regexMethod.call(string, this, arg); }
2423 // 21.2.5.6 RegExp.prototype[@@match](string)
2424 // 21.2.5.9 RegExp.prototype[@@search](string)
2425 : function (string) { return regexMethod.call(string, this); }
2426 );
2427 }
2428
2429 if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
2430 };
2431
2432 var charAt$1 = stringMultibyte.charAt;
2433
2434 // `AdvanceStringIndex` abstract operation
2435 // https://tc39.github.io/ecma262/#sec-advancestringindex
2436 var advanceStringIndex = function (S, index, unicode) {
2437 return index + (unicode ? charAt$1(S, index).length : 1);
2438 };
2439
2440 // `RegExpExec` abstract operation
2441 // https://tc39.github.io/ecma262/#sec-regexpexec
2442 var regexpExecAbstract = function (R, S) {
2443 var exec = R.exec;
2444 if (typeof exec === 'function') {
2445 var result = exec.call(R, S);
2446 if (typeof result !== 'object') {
2447 throw TypeError('RegExp exec method returned something other than an Object or null');
2448 }
2449 return result;
2450 }
2451
2452 if (classofRaw(R) !== 'RegExp') {
2453 throw TypeError('RegExp#exec called on incompatible receiver');
2454 }
2455
2456 return regexpExec.call(R, S);
2457 };
2458
2459 var max$3 = Math.max;
2460 var min$3 = Math.min;
2461 var floor$1 = Math.floor;
2462 var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
2463 var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
2464
2465 var maybeToString = function (it) {
2466 return it === undefined ? it : String(it);
2467 };
2468
2469 // @@replace logic
2470 fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
2471 return [
2472 // `String.prototype.replace` method
2473 // https://tc39.github.io/ecma262/#sec-string.prototype.replace
2474 function replace(searchValue, replaceValue) {
2475 var O = requireObjectCoercible(this);
2476 var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
2477 return replacer !== undefined
2478 ? replacer.call(searchValue, O, replaceValue)
2479 : nativeReplace.call(String(O), searchValue, replaceValue);
2480 },
2481 // `RegExp.prototype[@@replace]` method
2482 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
2483 function (regexp, replaceValue) {
2484 if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) {
2485 var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
2486 if (res.done) return res.value;
2487 }
2488
2489 var rx = anObject(regexp);
2490 var S = String(this);
2491
2492 var functionalReplace = typeof replaceValue === 'function';
2493 if (!functionalReplace) replaceValue = String(replaceValue);
2494
2495 var global = rx.global;
2496 if (global) {
2497 var fullUnicode = rx.unicode;
2498 rx.lastIndex = 0;
2499 }
2500 var results = [];
2501 while (true) {
2502 var result = regexpExecAbstract(rx, S);
2503 if (result === null) break;
2504
2505 results.push(result);
2506 if (!global) break;
2507
2508 var matchStr = String(result[0]);
2509 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
2510 }
2511
2512 var accumulatedResult = '';
2513 var nextSourcePosition = 0;
2514 for (var i = 0; i < results.length; i++) {
2515 result = results[i];
2516
2517 var matched = String(result[0]);
2518 var position = max$3(min$3(toInteger(result.index), S.length), 0);
2519 var captures = [];
2520 // NOTE: This is equivalent to
2521 // captures = result.slice(1).map(maybeToString)
2522 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
2523 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
2524 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
2525 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
2526 var namedCaptures = result.groups;
2527 if (functionalReplace) {
2528 var replacerArgs = [matched].concat(captures, position, S);
2529 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
2530 var replacement = String(replaceValue.apply(undefined, replacerArgs));
2531 } else {
2532 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
2533 }
2534 if (position >= nextSourcePosition) {
2535 accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
2536 nextSourcePosition = position + matched.length;
2537 }
2538 }
2539 return accumulatedResult + S.slice(nextSourcePosition);
2540 }
2541 ];
2542
2543 // https://tc39.github.io/ecma262/#sec-getsubstitution
2544 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
2545 var tailPos = position + matched.length;
2546 var m = captures.length;
2547 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
2548 if (namedCaptures !== undefined) {
2549 namedCaptures = toObject(namedCaptures);
2550 symbols = SUBSTITUTION_SYMBOLS;
2551 }
2552 return nativeReplace.call(replacement, symbols, function (match, ch) {
2553 var capture;
2554 switch (ch.charAt(0)) {
2555 case '$': return '$';
2556 case '&': return matched;
2557 case '`': return str.slice(0, position);
2558 case "'": return str.slice(tailPos);
2559 case '<':
2560 capture = namedCaptures[ch.slice(1, -1)];
2561 break;
2562 default: // \d\d?
2563 var n = +ch;
2564 if (n === 0) return match;
2565 if (n > m) {
2566 var f = floor$1(n / 10);
2567 if (f === 0) return match;
2568 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
2569 return match;
2570 }
2571 capture = captures[n - 1];
2572 }
2573 return capture === undefined ? '' : capture;
2574 });
2575 }
2576 });
2577
2578 // `SameValue` abstract operation
2579 // https://tc39.github.io/ecma262/#sec-samevalue
2580 var sameValue = Object.is || function is(x, y) {
2581 // eslint-disable-next-line no-self-compare
2582 return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
2583 };
2584
2585 // @@search logic
2586 fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
2587 return [
2588 // `String.prototype.search` method
2589 // https://tc39.github.io/ecma262/#sec-string.prototype.search
2590 function search(regexp) {
2591 var O = requireObjectCoercible(this);
2592 var searcher = regexp == undefined ? undefined : regexp[SEARCH];
2593 return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
2594 },
2595 // `RegExp.prototype[@@search]` method
2596 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
2597 function (regexp) {
2598 var res = maybeCallNative(nativeSearch, regexp, this);
2599 if (res.done) return res.value;
2600
2601 var rx = anObject(regexp);
2602 var S = String(this);
2603
2604 var previousLastIndex = rx.lastIndex;
2605 if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
2606 var result = regexpExecAbstract(rx, S);
2607 if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
2608 return result === null ? -1 : result.index;
2609 }
2610 ];
2611 });
2612
2613 var SPECIES$5 = wellKnownSymbol('species');
2614
2615 // `SpeciesConstructor` abstract operation
2616 // https://tc39.github.io/ecma262/#sec-speciesconstructor
2617 var speciesConstructor = function (O, defaultConstructor) {
2618 var C = anObject(O).constructor;
2619 var S;
2620 return C === undefined || (S = anObject(C)[SPECIES$5]) == undefined ? defaultConstructor : aFunction$1(S);
2621 };
2622
2623 var arrayPush = [].push;
2624 var min$4 = Math.min;
2625 var MAX_UINT32 = 0xFFFFFFFF;
2626
2627 // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
2628 var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
2629
2630 // @@split logic
2631 fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
2632 var internalSplit;
2633 if (
2634 'abbc'.split(/(b)*/)[1] == 'c' ||
2635 'test'.split(/(?:)/, -1).length != 4 ||
2636 'ab'.split(/(?:ab)*/).length != 2 ||
2637 '.'.split(/(.?)(.?)/).length != 4 ||
2638 '.'.split(/()()/).length > 1 ||
2639 ''.split(/.?/).length
2640 ) {
2641 // based on es5-shim implementation, need to rework it
2642 internalSplit = function (separator, limit) {
2643 var string = String(requireObjectCoercible(this));
2644 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2645 if (lim === 0) return [];
2646 if (separator === undefined) return [string];
2647 // If `separator` is not a regex, use native split
2648 if (!isRegexp(separator)) {
2649 return nativeSplit.call(string, separator, lim);
2650 }
2651 var output = [];
2652 var flags = (separator.ignoreCase ? 'i' : '') +
2653 (separator.multiline ? 'm' : '') +
2654 (separator.unicode ? 'u' : '') +
2655 (separator.sticky ? 'y' : '');
2656 var lastLastIndex = 0;
2657 // Make `global` and avoid `lastIndex` issues by working with a copy
2658 var separatorCopy = new RegExp(separator.source, flags + 'g');
2659 var match, lastIndex, lastLength;
2660 while (match = regexpExec.call(separatorCopy, string)) {
2661 lastIndex = separatorCopy.lastIndex;
2662 if (lastIndex > lastLastIndex) {
2663 output.push(string.slice(lastLastIndex, match.index));
2664 if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
2665 lastLength = match[0].length;
2666 lastLastIndex = lastIndex;
2667 if (output.length >= lim) break;
2668 }
2669 if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
2670 }
2671 if (lastLastIndex === string.length) {
2672 if (lastLength || !separatorCopy.test('')) output.push('');
2673 } else output.push(string.slice(lastLastIndex));
2674 return output.length > lim ? output.slice(0, lim) : output;
2675 };
2676 // Chakra, V8
2677 } else if ('0'.split(undefined, 0).length) {
2678 internalSplit = function (separator, limit) {
2679 return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
2680 };
2681 } else internalSplit = nativeSplit;
2682
2683 return [
2684 // `String.prototype.split` method
2685 // https://tc39.github.io/ecma262/#sec-string.prototype.split
2686 function split(separator, limit) {
2687 var O = requireObjectCoercible(this);
2688 var splitter = separator == undefined ? undefined : separator[SPLIT];
2689 return splitter !== undefined
2690 ? splitter.call(separator, O, limit)
2691 : internalSplit.call(String(O), separator, limit);
2692 },
2693 // `RegExp.prototype[@@split]` method
2694 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
2695 //
2696 // NOTE: This cannot be properly polyfilled in engines that don't support
2697 // the 'y' flag.
2698 function (regexp, limit) {
2699 var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
2700 if (res.done) return res.value;
2701
2702 var rx = anObject(regexp);
2703 var S = String(this);
2704 var C = speciesConstructor(rx, RegExp);
2705
2706 var unicodeMatching = rx.unicode;
2707 var flags = (rx.ignoreCase ? 'i' : '') +
2708 (rx.multiline ? 'm' : '') +
2709 (rx.unicode ? 'u' : '') +
2710 (SUPPORTS_Y ? 'y' : 'g');
2711
2712 // ^(? + rx + ) is needed, in combination with some S slicing, to
2713 // simulate the 'y' flag.
2714 var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
2715 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2716 if (lim === 0) return [];
2717 if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
2718 var p = 0;
2719 var q = 0;
2720 var A = [];
2721 while (q < S.length) {
2722 splitter.lastIndex = SUPPORTS_Y ? q : 0;
2723 var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
2724 var e;
2725 if (
2726 z === null ||
2727 (e = min$4(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
2728 ) {
2729 q = advanceStringIndex(S, q, unicodeMatching);
2730 } else {
2731 A.push(S.slice(p, q));
2732 if (A.length === lim) return A;
2733 for (var i = 1; i <= z.length - 1; i++) {
2734 A.push(z[i]);
2735 if (A.length === lim) return A;
2736 }
2737 q = p = e;
2738 }
2739 }
2740 A.push(S.slice(p));
2741 return A;
2742 }
2743 ];
2744 }, !SUPPORTS_Y);
2745
2746 var non = '\u200B\u0085\u180E';
2747
2748 // check that a method works with the correct list
2749 // of whitespaces and has a correct name
2750 var forcedStringTrimMethod = function (METHOD_NAME) {
2751 return fails(function () {
2752 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
2753 });
2754 };
2755
2756 var $trim = stringTrim.trim;
2757
2758
2759 // `String.prototype.trim` method
2760 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
2761 _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
2762 trim: function trim() {
2763 return $trim(this);
2764 }
2765 });
2766
2767 // iterable DOM collections
2768 // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2769 var domIterables = {
2770 CSSRuleList: 0,
2771 CSSStyleDeclaration: 0,
2772 CSSValueList: 0,
2773 ClientRectList: 0,
2774 DOMRectList: 0,
2775 DOMStringList: 0,
2776 DOMTokenList: 1,
2777 DataTransferItemList: 0,
2778 FileList: 0,
2779 HTMLAllCollection: 0,
2780 HTMLCollection: 0,
2781 HTMLFormElement: 0,
2782 HTMLSelectElement: 0,
2783 MediaList: 0,
2784 MimeTypeArray: 0,
2785 NamedNodeMap: 0,
2786 NodeList: 1,
2787 PaintRequestList: 0,
2788 Plugin: 0,
2789 PluginArray: 0,
2790 SVGLengthList: 0,
2791 SVGNumberList: 0,
2792 SVGPathSegList: 0,
2793 SVGPointList: 0,
2794 SVGStringList: 0,
2795 SVGTransformList: 0,
2796 SourceBufferList: 0,
2797 StyleSheetList: 0,
2798 TextTrackCueList: 0,
2799 TextTrackList: 0,
2800 TouchList: 0
2801 };
2802
2803 var $forEach$1 = arrayIteration.forEach;
2804
2805
2806 // `Array.prototype.forEach` method implementation
2807 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
2808 var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
2809 return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2810 } : [].forEach;
2811
2812 for (var COLLECTION_NAME in domIterables) {
2813 var Collection = global_1[COLLECTION_NAME];
2814 var CollectionPrototype = Collection && Collection.prototype;
2815 // some Chrome versions have non-configurable methods on DOMTokenList
2816 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
2817 createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
2818 } catch (error) {
2819 CollectionPrototype.forEach = arrayForEach;
2820 }
2821 }
2822
2823 var ITERATOR$2 = wellKnownSymbol('iterator');
2824 var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
2825 var ArrayValues = es_array_iterator.values;
2826
2827 for (var COLLECTION_NAME$1 in domIterables) {
2828 var Collection$1 = global_1[COLLECTION_NAME$1];
2829 var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
2830 if (CollectionPrototype$1) {
2831 // some Chrome versions have non-configurable methods on DOMTokenList
2832 if (CollectionPrototype$1[ITERATOR$2] !== ArrayValues) try {
2833 createNonEnumerableProperty(CollectionPrototype$1, ITERATOR$2, ArrayValues);
2834 } catch (error) {
2835 CollectionPrototype$1[ITERATOR$2] = ArrayValues;
2836 }
2837 if (!CollectionPrototype$1[TO_STRING_TAG$3]) {
2838 createNonEnumerableProperty(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1);
2839 }
2840 if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) {
2841 // some Chrome versions have non-configurable methods on DOMTokenList
2842 if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
2843 createNonEnumerableProperty(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);
2844 } catch (error) {
2845 CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];
2846 }
2847 }
2848 }
2849 }
2850
2851 function _typeof(obj) {
2852 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2853 _typeof = function (obj) {
2854 return typeof obj;
2855 };
2856 } else {
2857 _typeof = function (obj) {
2858 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2859 };
2860 }
2861
2862 return _typeof(obj);
2863 }
2864
2865 function _classCallCheck(instance, Constructor) {
2866 if (!(instance instanceof Constructor)) {
2867 throw new TypeError("Cannot call a class as a function");
2868 }
2869 }
2870
2871 function _defineProperties(target, props) {
2872 for (var i = 0; i < props.length; i++) {
2873 var descriptor = props[i];
2874 descriptor.enumerable = descriptor.enumerable || false;
2875 descriptor.configurable = true;
2876 if ("value" in descriptor) descriptor.writable = true;
2877 Object.defineProperty(target, descriptor.key, descriptor);
2878 }
2879 }
2880
2881 function _createClass(Constructor, protoProps, staticProps) {
2882 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2883 if (staticProps) _defineProperties(Constructor, staticProps);
2884 return Constructor;
2885 }
2886
2887 function _slicedToArray(arr, i) {
2888 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
2889 }
2890
2891 function _toConsumableArray(arr) {
2892 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
2893 }
2894
2895 function _arrayWithoutHoles(arr) {
2896 if (Array.isArray(arr)) {
2897 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
2898
2899 return arr2;
2900 }
2901 }
2902
2903 function _arrayWithHoles(arr) {
2904 if (Array.isArray(arr)) return arr;
2905 }
2906
2907 function _iterableToArray(iter) {
2908 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
2909 }
2910
2911 function _iterableToArrayLimit(arr, i) {
2912 if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
2913 return;
2914 }
2915
2916 var _arr = [];
2917 var _n = true;
2918 var _d = false;
2919 var _e = undefined;
2920
2921 try {
2922 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
2923 _arr.push(_s.value);
2924
2925 if (i && _arr.length === i) break;
2926 }
2927 } catch (err) {
2928 _d = true;
2929 _e = err;
2930 } finally {
2931 try {
2932 if (!_n && _i["return"] != null) _i["return"]();
2933 } finally {
2934 if (_d) throw _e;
2935 }
2936 }
2937
2938 return _arr;
2939 }
2940
2941 function _nonIterableSpread() {
2942 throw new TypeError("Invalid attempt to spread non-iterable instance");
2943 }
2944
2945 function _nonIterableRest() {
2946 throw new TypeError("Invalid attempt to destructure non-iterable instance");
2947 }
2948
2949 var VERSION = '1.18.0';
2950 var bootstrapVersion = 4;
2951
2952 try {
2953 var rawVersion = $.fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined.
2954 // It is undefined in older versions of Bootstrap (tested with 3.1.1).
2955
2956 if (rawVersion !== undefined) {
2957 bootstrapVersion = parseInt(rawVersion, 10);
2958 }
2959 } catch (e) {// ignore
2960 }
2961
2962 try {
2963 // eslint-disable-next-line no-undef
2964 var _rawVersion = bootstrap.Tooltip.VERSION;
2965
2966 if (_rawVersion !== undefined) {
2967 bootstrapVersion = parseInt(_rawVersion, 10);
2968 }
2969 } catch (e) {// ignore
2970 }
2971
2972 var CONSTANTS = {
2973 3: {
2974 iconsPrefix: 'glyphicon',
2975 icons: {
2976 paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
2977 paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
2978 refresh: 'glyphicon-refresh icon-refresh',
2979 toggleOff: 'glyphicon-list-alt icon-list-alt',
2980 toggleOn: 'glyphicon-list-alt icon-list-alt',
2981 columns: 'glyphicon-th icon-th',
2982 detailOpen: 'glyphicon-plus icon-plus',
2983 detailClose: 'glyphicon-minus icon-minus',
2984 fullscreen: 'glyphicon-fullscreen',
2985 search: 'glyphicon-search',
2986 clearSearch: 'glyphicon-trash'
2987 },
2988 classes: {
2989 buttonsPrefix: 'btn',
2990 buttons: 'default',
2991 buttonsGroup: 'btn-group',
2992 buttonsDropdown: 'btn-group',
2993 pull: 'pull',
2994 inputGroup: 'input-group',
2995 inputPrefix: 'input-',
2996 input: 'form-control',
2997 paginationDropdown: 'btn-group dropdown',
2998 dropup: 'dropup',
2999 dropdownActive: 'active',
3000 paginationActive: 'active',
3001 buttonActive: 'active'
3002 },
3003 html: {
3004 toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
3005 toolbarDropdownItem: '<li class="dropdown-item-marker" role="menuitem"><label>%s</label></li>',
3006 toolbarDropdownSeparator: '<li class="divider"></li>',
3007 pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
3008 pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
3009 dropdownCaret: '<span class="caret"></span>',
3010 pagination: ['<ul class="pagination%s">', '</ul>'],
3011 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
3012 icon: '<i class="%s %s"></i>',
3013 inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
3014 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
3015 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
3016 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
3017 }
3018 },
3019 4: {
3020 iconsPrefix: 'fa',
3021 icons: {
3022 paginationSwitchDown: 'fa-caret-square-down',
3023 paginationSwitchUp: 'fa-caret-square-up',
3024 refresh: 'fa-sync',
3025 toggleOff: 'fa-toggle-off',
3026 toggleOn: 'fa-toggle-on',
3027 columns: 'fa-th-list',
3028 detailOpen: 'fa-plus',
3029 detailClose: 'fa-minus',
3030 fullscreen: 'fa-arrows-alt',
3031 search: 'fa-search',
3032 clearSearch: 'fa-trash'
3033 },
3034 classes: {
3035 buttonsPrefix: 'btn',
3036 buttons: 'secondary',
3037 buttonsGroup: 'btn-group',
3038 buttonsDropdown: 'btn-group',
3039 pull: 'float',
3040 inputGroup: 'btn-group',
3041 inputPrefix: 'form-control-',
3042 input: 'form-control',
3043 paginationDropdown: 'btn-group dropdown',
3044 dropup: 'dropup',
3045 dropdownActive: 'active',
3046 paginationActive: 'active',
3047 buttonActive: 'active'
3048 },
3049 html: {
3050 toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
3051 toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
3052 pageDropdown: ['<div class="dropdown-menu">', '</div>'],
3053 pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
3054 toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
3055 dropdownCaret: '<span class="caret"></span>',
3056 pagination: ['<ul class="pagination%s">', '</ul>'],
3057 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
3058 icon: '<i class="%s %s"></i>',
3059 inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
3060 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
3061 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
3062 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
3063 }
3064 },
3065 5: {
3066 iconsPrefix: 'fa',
3067 icons: {
3068 paginationSwitchDown: 'fa-caret-square-down',
3069 paginationSwitchUp: 'fa-caret-square-up',
3070 refresh: 'fa-sync',
3071 toggleOff: 'fa-toggle-off',
3072 toggleOn: 'fa-toggle-on',
3073 columns: 'fa-th-list',
3074 detailOpen: 'fa-plus',
3075 detailClose: 'fa-minus',
3076 fullscreen: 'fa-arrows-alt',
3077 search: 'fa-search',
3078 clearSearch: 'fa-trash'
3079 },
3080 classes: {
3081 buttonsPrefix: 'btn',
3082 buttons: 'secondary',
3083 buttonsGroup: 'btn-group',
3084 buttonsDropdown: 'btn-group',
3085 pull: 'float',
3086 inputGroup: 'btn-group',
3087 inputPrefix: 'form-control-',
3088 input: 'form-control',
3089 paginationDropdown: 'btn-group dropdown',
3090 dropup: 'dropup',
3091 dropdownActive: 'active',
3092 paginationActive: 'active',
3093 buttonActive: 'active'
3094 },
3095 html: {
3096 toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
3097 toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
3098 pageDropdown: ['<div class="dropdown-menu">', '</div>'],
3099 pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
3100 toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
3101 dropdownCaret: '<span class="caret"></span>',
3102 pagination: ['<ul class="pagination%s">', '</ul>'],
3103 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
3104 icon: '<i class="%s %s"></i>',
3105 inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
3106 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
3107 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
3108 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
3109 }
3110 }
3111 }[bootstrapVersion];
3112 var DEFAULTS = {
3113 height: undefined,
3114 classes: 'table table-bordered table-hover',
3115 buttons: {},
3116 theadClasses: '',
3117 headerStyle: function headerStyle(column) {
3118 return {};
3119 },
3120 rowStyle: function rowStyle(row, index) {
3121 return {};
3122 },
3123 rowAttributes: function rowAttributes(row, index) {
3124 return {};
3125 },
3126 undefinedText: '-',
3127 locale: undefined,
3128 virtualScroll: false,
3129 virtualScrollItemHeight: undefined,
3130 sortable: true,
3131 sortClass: undefined,
3132 silentSort: true,
3133 sortName: undefined,
3134 sortOrder: undefined,
3135 sortReset: false,
3136 sortStable: false,
3137 rememberOrder: false,
3138 serverSort: true,
3139 customSort: undefined,
3140 columns: [[]],
3141 data: [],
3142 url: undefined,
3143 method: 'get',
3144 cache: true,
3145 contentType: 'application/json',
3146 dataType: 'json',
3147 ajax: undefined,
3148 ajaxOptions: {},
3149 queryParams: function queryParams(params) {
3150 return params;
3151 },
3152 queryParamsType: 'limit',
3153 // 'limit', undefined
3154 responseHandler: function responseHandler(res) {
3155 return res;
3156 },
3157 totalField: 'total',
3158 totalNotFilteredField: 'totalNotFiltered',
3159 dataField: 'rows',
3160 footerField: 'footer',
3161 pagination: false,
3162 paginationParts: ['pageInfo', 'pageSize', 'pageList'],
3163 showExtendedPagination: false,
3164 paginationLoop: true,
3165 sidePagination: 'client',
3166 // client or server
3167 totalRows: 0,
3168 totalNotFiltered: 0,
3169 pageNumber: 1,
3170 pageSize: 10,
3171 pageList: [10, 25, 50, 100],
3172 paginationHAlign: 'right',
3173 // right, left
3174 paginationVAlign: 'bottom',
3175 // bottom, top, both
3176 paginationDetailHAlign: 'left',
3177 // right, left
3178 paginationPreText: '&lsaquo;',
3179 paginationNextText: '&rsaquo;',
3180 paginationSuccessivelySize: 5,
3181 // Maximum successively number of pages in a row
3182 paginationPagesBySide: 1,
3183 // Number of pages on each side (right, left) of the current page.
3184 paginationUseIntermediate: false,
3185 // Calculate intermediate pages for quick access
3186 search: false,
3187 searchHighlight: false,
3188 searchOnEnterKey: false,
3189 strictSearch: false,
3190 searchSelector: false,
3191 visibleSearch: false,
3192 showButtonIcons: true,
3193 showButtonText: false,
3194 showSearchButton: false,
3195 showSearchClearButton: false,
3196 trimOnSearch: true,
3197 searchAlign: 'right',
3198 searchTimeOut: 500,
3199 searchText: '',
3200 customSearch: undefined,
3201 showHeader: true,
3202 showFooter: false,
3203 footerStyle: function footerStyle(column) {
3204 return {};
3205 },
3206 searchAccentNeutralise: false,
3207 showColumns: false,
3208 showColumnsToggleAll: false,
3209 showColumnsSearch: false,
3210 minimumCountColumns: 1,
3211 showPaginationSwitch: false,
3212 showRefresh: false,
3213 showToggle: false,
3214 showFullscreen: false,
3215 smartDisplay: true,
3216 escape: false,
3217 filterOptions: {
3218 filterAlgorithm: 'and'
3219 },
3220 idField: undefined,
3221 selectItemName: 'btSelectItem',
3222 clickToSelect: false,
3223 ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) {
3224 var tagName = _ref.tagName;
3225 return ['A', 'BUTTON'].includes(tagName);
3226 },
3227 singleSelect: false,
3228 checkboxHeader: true,
3229 maintainMetaData: false,
3230 multipleSelectRow: false,
3231 uniqueId: undefined,
3232 cardView: false,
3233 detailView: false,
3234 detailViewIcon: true,
3235 detailViewByClick: false,
3236 detailViewAlign: 'left',
3237 detailFormatter: function detailFormatter(index, row) {
3238 return '';
3239 },
3240 detailFilter: function detailFilter(index, row) {
3241 return true;
3242 },
3243 toolbar: undefined,
3244 toolbarAlign: 'left',
3245 buttonsToolbar: undefined,
3246 buttonsAlign: 'right',
3247 buttonsOrder: ['paginationSwitch', 'refresh', 'toggle', 'fullscreen', 'columns'],
3248 buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
3249 buttonsClass: CONSTANTS.classes.buttons,
3250 icons: CONSTANTS.icons,
3251 iconSize: undefined,
3252 iconsPrefix: CONSTANTS.iconsPrefix,
3253 // glyphicon or fa(font-awesome)
3254 loadingFontSize: 'auto',
3255 loadingTemplate: function loadingTemplate(loadingMessage) {
3256 return "<span class=\"loading-wrap\">\n <span class=\"loading-text\">".concat(loadingMessage, "</span>\n <span class=\"animation-wrap\"><span class=\"animation-dot\"></span></span>\n </span>\n ");
3257 },
3258 onAll: function onAll(name, args) {
3259 return false;
3260 },
3261 onClickCell: function onClickCell(field, value, row, $element) {
3262 return false;
3263 },
3264 onDblClickCell: function onDblClickCell(field, value, row, $element) {
3265 return false;
3266 },
3267 onClickRow: function onClickRow(item, $element) {
3268 return false;
3269 },
3270 onDblClickRow: function onDblClickRow(item, $element) {
3271 return false;
3272 },
3273 onSort: function onSort(name, order) {
3274 return false;
3275 },
3276 onCheck: function onCheck(row) {
3277 return false;
3278 },
3279 onUncheck: function onUncheck(row) {
3280 return false;
3281 },
3282 onCheckAll: function onCheckAll(rows) {
3283 return false;
3284 },
3285 onUncheckAll: function onUncheckAll(rows) {
3286 return false;
3287 },
3288 onCheckSome: function onCheckSome(rows) {
3289 return false;
3290 },
3291 onUncheckSome: function onUncheckSome(rows) {
3292 return false;
3293 },
3294 onLoadSuccess: function onLoadSuccess(data) {
3295 return false;
3296 },
3297 onLoadError: function onLoadError(status) {
3298 return false;
3299 },
3300 onColumnSwitch: function onColumnSwitch(field, checked) {
3301 return false;
3302 },
3303 onPageChange: function onPageChange(number, size) {
3304 return false;
3305 },
3306 onSearch: function onSearch(text) {
3307 return false;
3308 },
3309 onToggle: function onToggle(cardView) {
3310 return false;
3311 },
3312 onPreBody: function onPreBody(data) {
3313 return false;
3314 },
3315 onPostBody: function onPostBody() {
3316 return false;
3317 },
3318 onPostHeader: function onPostHeader() {
3319 return false;
3320 },
3321 onPostFooter: function onPostFooter() {
3322 return false;
3323 },
3324 onExpandRow: function onExpandRow(index, row, $detail) {
3325 return false;
3326 },
3327 onCollapseRow: function onCollapseRow(index, row) {
3328 return false;
3329 },
3330 onRefreshOptions: function onRefreshOptions(options) {
3331 return false;
3332 },
3333 onRefresh: function onRefresh(params) {
3334 return false;
3335 },
3336 onResetView: function onResetView() {
3337 return false;
3338 },
3339 onScrollBody: function onScrollBody() {
3340 return false;
3341 }
3342 };
3343 var EN = {
3344 formatLoadingMessage: function formatLoadingMessage() {
3345 return 'Loading, please wait';
3346 },
3347 formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
3348 return "".concat(pageNumber, " rows per page");
3349 },
3350 formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
3351 if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
3352 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)");
3353 }
3354
3355 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows");
3356 },
3357 formatSRPaginationPreText: function formatSRPaginationPreText() {
3358 return 'previous page';
3359 },
3360 formatSRPaginationPageText: function formatSRPaginationPageText(page) {
3361 return "to page ".concat(page);
3362 },
3363 formatSRPaginationNextText: function formatSRPaginationNextText() {
3364 return 'next page';
3365 },
3366 formatDetailPagination: function formatDetailPagination(totalRows) {
3367 return "Showing ".concat(totalRows, " rows");
3368 },
3369 formatSearch: function formatSearch() {
3370 return 'Search';
3371 },
3372 formatClearSearch: function formatClearSearch() {
3373 return 'Clear Search';
3374 },
3375 formatNoMatches: function formatNoMatches() {
3376 return 'No matching records found';
3377 },
3378 formatPaginationSwitch: function formatPaginationSwitch() {
3379 return 'Hide/Show pagination';
3380 },
3381 formatPaginationSwitchDown: function formatPaginationSwitchDown() {
3382 return 'Show pagination';
3383 },
3384 formatPaginationSwitchUp: function formatPaginationSwitchUp() {
3385 return 'Hide pagination';
3386 },
3387 formatRefresh: function formatRefresh() {
3388 return 'Refresh';
3389 },
3390 formatToggle: function formatToggle() {
3391 return 'Toggle';
3392 },
3393 formatToggleOn: function formatToggleOn() {
3394 return 'Show card view';
3395 },
3396 formatToggleOff: function formatToggleOff() {
3397 return 'Hide card view';
3398 },
3399 formatColumns: function formatColumns() {
3400 return 'Columns';
3401 },
3402 formatColumnsToggleAll: function formatColumnsToggleAll() {
3403 return 'Toggle all';
3404 },
3405 formatFullscreen: function formatFullscreen() {
3406 return 'Fullscreen';
3407 },
3408 formatAllRows: function formatAllRows() {
3409 return 'All';
3410 }
3411 };
3412 var COLUMN_DEFAULTS = {
3413 field: undefined,
3414 title: undefined,
3415 titleTooltip: undefined,
3416 'class': undefined,
3417 width: undefined,
3418 widthUnit: 'px',
3419 rowspan: undefined,
3420 colspan: undefined,
3421 align: undefined,
3422 // left, right, center
3423 halign: undefined,
3424 // left, right, center
3425 falign: undefined,
3426 // left, right, center
3427 valign: undefined,
3428 // top, middle, bottom
3429 cellStyle: undefined,
3430 radio: false,
3431 checkbox: false,
3432 checkboxEnabled: true,
3433 clickToSelect: true,
3434 showSelectTitle: false,
3435 sortable: false,
3436 sortName: undefined,
3437 order: 'asc',
3438 // asc, desc
3439 sorter: undefined,
3440 visible: true,
3441 switchable: true,
3442 cardVisible: true,
3443 searchable: true,
3444 formatter: undefined,
3445 footerFormatter: undefined,
3446 detailFormatter: undefined,
3447 searchFormatter: true,
3448 searchHighlightFormatter: false,
3449 escape: false,
3450 events: undefined
3451 };
3452 var METHODS = ['getOptions', 'refreshOptions', 'getData', 'getSelections', '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', 'expandRowByUniqueId', 'collapseRowByUniqueId', 'expandAllRows', 'collapseAllRows', 'updateColumnTitle', 'updateFormatText'];
3453 var EVENTS = {
3454 'all.bs.table': 'onAll',
3455 'click-row.bs.table': 'onClickRow',
3456 'dbl-click-row.bs.table': 'onDblClickRow',
3457 'click-cell.bs.table': 'onClickCell',
3458 'dbl-click-cell.bs.table': 'onDblClickCell',
3459 'sort.bs.table': 'onSort',
3460 'check.bs.table': 'onCheck',
3461 'uncheck.bs.table': 'onUncheck',
3462 'check-all.bs.table': 'onCheckAll',
3463 'uncheck-all.bs.table': 'onUncheckAll',
3464 'check-some.bs.table': 'onCheckSome',
3465 'uncheck-some.bs.table': 'onUncheckSome',
3466 'load-success.bs.table': 'onLoadSuccess',
3467 'load-error.bs.table': 'onLoadError',
3468 'column-switch.bs.table': 'onColumnSwitch',
3469 'page-change.bs.table': 'onPageChange',
3470 'search.bs.table': 'onSearch',
3471 'toggle.bs.table': 'onToggle',
3472 'pre-body.bs.table': 'onPreBody',
3473 'post-body.bs.table': 'onPostBody',
3474 'post-header.bs.table': 'onPostHeader',
3475 'post-footer.bs.table': 'onPostFooter',
3476 'expand-row.bs.table': 'onExpandRow',
3477 'collapse-row.bs.table': 'onCollapseRow',
3478 'refresh-options.bs.table': 'onRefreshOptions',
3479 'reset-view.bs.table': 'onResetView',
3480 'refresh.bs.table': 'onRefresh',
3481 'scroll-body.bs.table': 'onScrollBody'
3482 };
3483 Object.assign(DEFAULTS, EN);
3484 var Constants = {
3485 VERSION: VERSION,
3486 THEME: "bootstrap".concat(bootstrapVersion),
3487 CONSTANTS: CONSTANTS,
3488 DEFAULTS: DEFAULTS,
3489 COLUMN_DEFAULTS: COLUMN_DEFAULTS,
3490 METHODS: METHODS,
3491 EVENTS: EVENTS,
3492 LOCALES: {
3493 en: EN,
3494 'en-US': EN
3495 }
3496 };
3497
3498 var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
3499
3500 // `Object.keys` method
3501 // https://tc39.github.io/ecma262/#sec-object.keys
3502 _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
3503 keys: function keys(it) {
3504 return objectKeys(toObject(it));
3505 }
3506 });
3507
3508 var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
3509
3510
3511
3512
3513
3514
3515 var nativeEndsWith = ''.endsWith;
3516 var min$5 = Math.min;
3517
3518 var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('endsWith');
3519 // https://github.com/zloirock/core-js/pull/702
3520 var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
3521 var descriptor = getOwnPropertyDescriptor$3(String.prototype, 'endsWith');
3522 return descriptor && !descriptor.writable;
3523 }();
3524
3525 // `String.prototype.endsWith` method
3526 // https://tc39.github.io/ecma262/#sec-string.prototype.endswith
3527 _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
3528 endsWith: function endsWith(searchString /* , endPosition = @length */) {
3529 var that = String(requireObjectCoercible(this));
3530 notARegexp(searchString);
3531 var endPosition = arguments.length > 1 ? arguments[1] : undefined;
3532 var len = toLength(that.length);
3533 var end = endPosition === undefined ? len : min$5(toLength(endPosition), len);
3534 var search = String(searchString);
3535 return nativeEndsWith
3536 ? nativeEndsWith.call(that, search, end)
3537 : that.slice(end - search.length, end) === search;
3538 }
3539 });
3540
3541 var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f;
3542
3543
3544
3545
3546
3547
3548 var nativeStartsWith = ''.startsWith;
3549 var min$6 = Math.min;
3550
3551 var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('startsWith');
3552 // https://github.com/zloirock/core-js/pull/702
3553 var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
3554 var descriptor = getOwnPropertyDescriptor$4(String.prototype, 'startsWith');
3555 return descriptor && !descriptor.writable;
3556 }();
3557
3558 // `String.prototype.startsWith` method
3559 // https://tc39.github.io/ecma262/#sec-string.prototype.startswith
3560 _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
3561 startsWith: function startsWith(searchString /* , position = 0 */) {
3562 var that = String(requireObjectCoercible(this));
3563 notARegexp(searchString);
3564 var index = toLength(min$6(arguments.length > 1 ? arguments[1] : undefined, that.length));
3565 var search = String(searchString);
3566 return nativeStartsWith
3567 ? nativeStartsWith.call(that, search, index)
3568 : that.slice(index, index + search.length) === search;
3569 }
3570 });
3571
3572 var Utils = {
3573 getSearchInput: function getSearchInput(that) {
3574 if (typeof that.options.searchSelector === 'string') {
3575 return $(that.options.searchSelector);
3576 }
3577
3578 return that.$toolbar.find('.search input');
3579 },
3580 // it only does '%s', and return '' when arguments are undefined
3581 sprintf: function sprintf(_str) {
3582 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3583 args[_key - 1] = arguments[_key];
3584 }
3585
3586 var flag = true;
3587 var i = 0;
3588
3589 var str = _str.replace(/%s/g, function () {
3590 var arg = args[i++];
3591
3592 if (typeof arg === 'undefined') {
3593 flag = false;
3594 return '';
3595 }
3596
3597 return arg;
3598 });
3599
3600 return flag ? str : '';
3601 },
3602 isObject: function isObject(val) {
3603 return val instanceof Object && !Array.isArray(val);
3604 },
3605 isEmptyObject: function isEmptyObject() {
3606 var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3607 return Object.entries(obj).length === 0 && obj.constructor === Object;
3608 },
3609 isNumeric: function isNumeric(n) {
3610 return !isNaN(parseFloat(n)) && isFinite(n);
3611 },
3612 getFieldTitle: function getFieldTitle(list, value) {
3613 var _iteratorNormalCompletion = true;
3614 var _didIteratorError = false;
3615 var _iteratorError = undefined;
3616
3617 try {
3618 for (var _iterator = list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
3619 var item = _step.value;
3620
3621 if (item.field === value) {
3622 return item.title;
3623 }
3624 }
3625 } catch (err) {
3626 _didIteratorError = true;
3627 _iteratorError = err;
3628 } finally {
3629 try {
3630 if (!_iteratorNormalCompletion && _iterator.return != null) {
3631 _iterator.return();
3632 }
3633 } finally {
3634 if (_didIteratorError) {
3635 throw _iteratorError;
3636 }
3637 }
3638 }
3639
3640 return '';
3641 },
3642 setFieldIndex: function setFieldIndex(columns) {
3643 var totalCol = 0;
3644 var flag = [];
3645 var _iteratorNormalCompletion2 = true;
3646 var _didIteratorError2 = false;
3647 var _iteratorError2 = undefined;
3648
3649 try {
3650 for (var _iterator2 = columns[0][Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
3651 var column = _step2.value;
3652 totalCol += column.colspan || 1;
3653 }
3654 } catch (err) {
3655 _didIteratorError2 = true;
3656 _iteratorError2 = err;
3657 } finally {
3658 try {
3659 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
3660 _iterator2.return();
3661 }
3662 } finally {
3663 if (_didIteratorError2) {
3664 throw _iteratorError2;
3665 }
3666 }
3667 }
3668
3669 for (var i = 0; i < columns.length; i++) {
3670 flag[i] = [];
3671
3672 for (var j = 0; j < totalCol; j++) {
3673 flag[i][j] = false;
3674 }
3675 }
3676
3677 for (var _i = 0; _i < columns.length; _i++) {
3678 var _iteratorNormalCompletion3 = true;
3679 var _didIteratorError3 = false;
3680 var _iteratorError3 = undefined;
3681
3682 try {
3683 for (var _iterator3 = columns[_i][Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
3684 var r = _step3.value;
3685 var rowspan = r.rowspan || 1;
3686 var colspan = r.colspan || 1;
3687
3688 var index = flag[_i].indexOf(false);
3689
3690 r.colspanIndex = index;
3691
3692 if (colspan === 1) {
3693 r.fieldIndex = index; // when field is undefined, use index instead
3694
3695 if (typeof r.field === 'undefined') {
3696 r.field = index;
3697 }
3698 } else {
3699 r.colspanGroup = r.colspan;
3700 }
3701
3702 for (var _j = 0; _j < rowspan; _j++) {
3703 for (var k = 0; k < colspan; k++) {
3704 flag[_i + _j][index + k] = true;
3705 }
3706 }
3707 }
3708 } catch (err) {
3709 _didIteratorError3 = true;
3710 _iteratorError3 = err;
3711 } finally {
3712 try {
3713 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
3714 _iterator3.return();
3715 }
3716 } finally {
3717 if (_didIteratorError3) {
3718 throw _iteratorError3;
3719 }
3720 }
3721 }
3722 }
3723 },
3724 normalizeAccent: function normalizeAccent(value) {
3725 if (typeof value !== 'string') {
3726 return value;
3727 }
3728
3729 return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
3730 },
3731 updateFieldGroup: function updateFieldGroup(columns) {
3732 var _ref;
3733
3734 var allColumns = (_ref = []).concat.apply(_ref, _toConsumableArray(columns));
3735
3736 var _iteratorNormalCompletion4 = true;
3737 var _didIteratorError4 = false;
3738 var _iteratorError4 = undefined;
3739
3740 try {
3741 for (var _iterator4 = columns[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
3742 var c = _step4.value;
3743 var _iteratorNormalCompletion5 = true;
3744 var _didIteratorError5 = false;
3745 var _iteratorError5 = undefined;
3746
3747 try {
3748 for (var _iterator5 = c[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
3749 var r = _step5.value;
3750
3751 if (r.colspanGroup > 1) {
3752 var colspan = 0;
3753
3754 var _loop = function _loop(i) {
3755 var column = allColumns.find(function (col) {
3756 return col.fieldIndex === i;
3757 });
3758
3759 if (column.visible) {
3760 colspan++;
3761 }
3762 };
3763
3764 for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) {
3765 _loop(i);
3766 }
3767
3768 r.colspan = colspan;
3769 r.visible = colspan > 0;
3770 }
3771 }
3772 } catch (err) {
3773 _didIteratorError5 = true;
3774 _iteratorError5 = err;
3775 } finally {
3776 try {
3777 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
3778 _iterator5.return();
3779 }
3780 } finally {
3781 if (_didIteratorError5) {
3782 throw _iteratorError5;
3783 }
3784 }
3785 }
3786 }
3787 } catch (err) {
3788 _didIteratorError4 = true;
3789 _iteratorError4 = err;
3790 } finally {
3791 try {
3792 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
3793 _iterator4.return();
3794 }
3795 } finally {
3796 if (_didIteratorError4) {
3797 throw _iteratorError4;
3798 }
3799 }
3800 }
3801 },
3802 getScrollBarWidth: function getScrollBarWidth() {
3803 if (this.cachedWidth === undefined) {
3804 var $inner = $('<div/>').addClass('fixed-table-scroll-inner');
3805 var $outer = $('<div/>').addClass('fixed-table-scroll-outer');
3806 $outer.append($inner);
3807 $('body').append($outer);
3808 var w1 = $inner[0].offsetWidth;
3809 $outer.css('overflow', 'scroll');
3810 var w2 = $inner[0].offsetWidth;
3811
3812 if (w1 === w2) {
3813 w2 = $outer[0].clientWidth;
3814 }
3815
3816 $outer.remove();
3817 this.cachedWidth = w1 - w2;
3818 }
3819
3820 return this.cachedWidth;
3821 },
3822 calculateObjectValue: function calculateObjectValue(self, name) {
3823 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
3824 var defaultValue = arguments.length > 3 ? arguments[3] : undefined;
3825 var func = name;
3826
3827 if (typeof name === 'string') {
3828 // support obj.func1.func2
3829 var names = name.split('.');
3830
3831 if (names.length > 1) {
3832 func = window;
3833 var _iteratorNormalCompletion6 = true;
3834 var _didIteratorError6 = false;
3835 var _iteratorError6 = undefined;
3836
3837 try {
3838 for (var _iterator6 = names[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
3839 var f = _step6.value;
3840 func = func[f];
3841 }
3842 } catch (err) {
3843 _didIteratorError6 = true;
3844 _iteratorError6 = err;
3845 } finally {
3846 try {
3847 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
3848 _iterator6.return();
3849 }
3850 } finally {
3851 if (_didIteratorError6) {
3852 throw _iteratorError6;
3853 }
3854 }
3855 }
3856 } else {
3857 func = window[name];
3858 }
3859 }
3860
3861 if (func !== null && _typeof(func) === 'object') {
3862 return func;
3863 }
3864
3865 if (typeof func === 'function') {
3866 return func.apply(self, args || []);
3867 }
3868
3869 if (!func && typeof name === 'string' && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) {
3870 return this.sprintf.apply(this, [name].concat(_toConsumableArray(args)));
3871 }
3872
3873 return defaultValue;
3874 },
3875 compareObjects: function compareObjects(objectA, objectB, compareLength) {
3876 var aKeys = Object.keys(objectA);
3877 var bKeys = Object.keys(objectB);
3878
3879 if (compareLength && aKeys.length !== bKeys.length) {
3880 return false;
3881 }
3882
3883 for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) {
3884 var key = _aKeys[_i2];
3885
3886 if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
3887 return false;
3888 }
3889 }
3890
3891 return true;
3892 },
3893 escapeHTML: function escapeHTML(text) {
3894 if (typeof text === 'string') {
3895 return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;').replace(/`/g, '&#x60;');
3896 }
3897
3898 return text;
3899 },
3900 unescapeHTML: function unescapeHTML(text) {
3901 if (typeof text === 'string') {
3902 return text.replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#039;/g, '\'').replace(/&#x60;/g, '`');
3903 }
3904
3905 return text;
3906 },
3907 getRealDataAttr: function getRealDataAttr(dataAttr) {
3908 for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) {
3909 var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
3910 attr = _Object$entries$_i[0],
3911 value = _Object$entries$_i[1];
3912
3913 var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
3914
3915 if (auxAttr !== attr) {
3916 dataAttr[auxAttr] = value;
3917 delete dataAttr[attr];
3918 }
3919 }
3920
3921 return dataAttr;
3922 },
3923 getItemField: function getItemField(item, field, escape) {
3924 var value = item;
3925
3926 if (typeof field !== 'string' || item.hasOwnProperty(field)) {
3927 return escape ? this.escapeHTML(item[field]) : item[field];
3928 }
3929
3930 var props = field.split('.');
3931 var _iteratorNormalCompletion7 = true;
3932 var _didIteratorError7 = false;
3933 var _iteratorError7 = undefined;
3934
3935 try {
3936 for (var _iterator7 = props[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
3937 var p = _step7.value;
3938 value = value && value[p];
3939 }
3940 } catch (err) {
3941 _didIteratorError7 = true;
3942 _iteratorError7 = err;
3943 } finally {
3944 try {
3945 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
3946 _iterator7.return();
3947 }
3948 } finally {
3949 if (_didIteratorError7) {
3950 throw _iteratorError7;
3951 }
3952 }
3953 }
3954
3955 return escape ? this.escapeHTML(value) : value;
3956 },
3957 isIEBrowser: function isIEBrowser() {
3958 return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent);
3959 },
3960 findIndex: function findIndex(items, item) {
3961 var _iteratorNormalCompletion8 = true;
3962 var _didIteratorError8 = false;
3963 var _iteratorError8 = undefined;
3964
3965 try {
3966 for (var _iterator8 = items[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
3967 var it = _step8.value;
3968
3969 if (JSON.stringify(it) === JSON.stringify(item)) {
3970 return items.indexOf(it);
3971 }
3972 }
3973 } catch (err) {
3974 _didIteratorError8 = true;
3975 _iteratorError8 = err;
3976 } finally {
3977 try {
3978 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
3979 _iterator8.return();
3980 }
3981 } finally {
3982 if (_didIteratorError8) {
3983 throw _iteratorError8;
3984 }
3985 }
3986 }
3987
3988 return -1;
3989 },
3990 trToData: function trToData(columns, $els) {
3991 var _this = this;
3992
3993 var data = [];
3994 var m = [];
3995 $els.each(function (y, el) {
3996 var $el = $(el);
3997 var row = {}; // save tr's id, class and data-* attributes
3998
3999 row._id = $el.attr('id');
4000 row._class = $el.attr('class');
4001 row._data = _this.getRealDataAttr($el.data());
4002 row._style = $el.attr('style');
4003 $el.find('>td,>th').each(function (_x, el) {
4004 var $el = $(el);
4005 var cspan = +$el.attr('colspan') || 1;
4006 var rspan = +$el.attr('rowspan') || 1;
4007 var x = _x; // skip already occupied cells in current row
4008
4009 for (; m[y] && m[y][x]; x++) {} // ignore
4010 // mark matrix elements occupied by current cell with true
4011
4012
4013 for (var tx = x; tx < x + cspan; tx++) {
4014 for (var ty = y; ty < y + rspan; ty++) {
4015 if (!m[ty]) {
4016 // fill missing rows
4017 m[ty] = [];
4018 }
4019
4020 m[ty][tx] = true;
4021 }
4022 }
4023
4024 var field = columns[x].field;
4025 row[field] = $el.html().trim(); // save td's id, class and data-* attributes
4026
4027 row["_".concat(field, "_id")] = $el.attr('id');
4028 row["_".concat(field, "_class")] = $el.attr('class');
4029 row["_".concat(field, "_rowspan")] = $el.attr('rowspan');
4030 row["_".concat(field, "_colspan")] = $el.attr('colspan');
4031 row["_".concat(field, "_title")] = $el.attr('title');
4032 row["_".concat(field, "_data")] = _this.getRealDataAttr($el.data());
4033 row["_".concat(field, "_style")] = $el.attr('style');
4034 });
4035 data.push(row);
4036 });
4037 return data;
4038 },
4039 sort: function sort(a, b, order, sortStable, aPosition, bPosition) {
4040 if (a === undefined || a === null) {
4041 a = '';
4042 }
4043
4044 if (b === undefined || b === null) {
4045 b = '';
4046 }
4047
4048 if (sortStable && a === b) {
4049 a = aPosition;
4050 b = bPosition;
4051 } // If both values are numeric, do a numeric comparison
4052
4053
4054 if (this.isNumeric(a) && this.isNumeric(b)) {
4055 // Convert numerical values form string to float.
4056 a = parseFloat(a);
4057 b = parseFloat(b);
4058
4059 if (a < b) {
4060 return order * -1;
4061 }
4062
4063 if (a > b) {
4064 return order;
4065 }
4066
4067 return 0;
4068 }
4069
4070 if (a === b) {
4071 return 0;
4072 } // If value is not a string, convert to string
4073
4074
4075 if (typeof a !== 'string') {
4076 a = a.toString();
4077 }
4078
4079 if (a.localeCompare(b) === -1) {
4080 return order * -1;
4081 }
4082
4083 return order;
4084 },
4085 getEventName: function getEventName(eventPrefix) {
4086 var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
4087 id = id || "".concat(+new Date()).concat(~~(Math.random() * 1000000));
4088 return "".concat(eventPrefix, "-").concat(id);
4089 },
4090 hasDetailViewIcon: function hasDetailViewIcon(options) {
4091 return options.detailView && options.detailViewIcon && !options.cardView;
4092 },
4093 getDetailViewIndexOffset: function getDetailViewIndexOffset(options) {
4094 return this.hasDetailViewIcon(options) && options.detailViewAlign !== 'right' ? 1 : 0;
4095 },
4096 checkAutoMergeCells: function checkAutoMergeCells(data) {
4097 var _iteratorNormalCompletion9 = true;
4098 var _didIteratorError9 = false;
4099 var _iteratorError9 = undefined;
4100
4101 try {
4102 for (var _iterator9 = data[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
4103 var row = _step9.value;
4104
4105 for (var _i4 = 0, _Object$keys = Object.keys(row); _i4 < _Object$keys.length; _i4++) {
4106 var key = _Object$keys[_i4];
4107
4108 if (key.startsWith('_') && (key.endsWith('_rowspan') || key.endsWith('_colspan'))) {
4109 return true;
4110 }
4111 }
4112 }
4113 } catch (err) {
4114 _didIteratorError9 = true;
4115 _iteratorError9 = err;
4116 } finally {
4117 try {
4118 if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
4119 _iterator9.return();
4120 }
4121 } finally {
4122 if (_didIteratorError9) {
4123 throw _iteratorError9;
4124 }
4125 }
4126 }
4127
4128 return false;
4129 },
4130 deepCopy: function deepCopy(arg) {
4131 if (arg === undefined) {
4132 return arg;
4133 }
4134
4135 return $.extend(true, Array.isArray(arg) ? [] : {}, arg);
4136 }
4137 };
4138
4139 var BLOCK_ROWS = 50;
4140 var CLUSTER_BLOCKS = 4;
4141
4142 var VirtualScroll =
4143 /*#__PURE__*/
4144 function () {
4145 function VirtualScroll(options) {
4146 var _this = this;
4147
4148 _classCallCheck(this, VirtualScroll);
4149
4150 this.rows = options.rows;
4151 this.scrollEl = options.scrollEl;
4152 this.contentEl = options.contentEl;
4153 this.callback = options.callback;
4154 this.itemHeight = options.itemHeight;
4155 this.cache = {};
4156 this.scrollTop = this.scrollEl.scrollTop;
4157 this.initDOM(this.rows, options.fixedScroll);
4158 this.scrollEl.scrollTop = this.scrollTop;
4159 this.lastCluster = 0;
4160
4161 var onScroll = function onScroll() {
4162 if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
4163 _this.initDOM(_this.rows);
4164
4165 _this.callback();
4166 }
4167 };
4168
4169 this.scrollEl.addEventListener('scroll', onScroll, false);
4170
4171 this.destroy = function () {
4172 _this.contentEl.innerHtml = '';
4173
4174 _this.scrollEl.removeEventListener('scroll', onScroll, false);
4175 };
4176 }
4177
4178 _createClass(VirtualScroll, [{
4179 key: "initDOM",
4180 value: function initDOM(rows, fixedScroll) {
4181 if (typeof this.clusterHeight === 'undefined') {
4182 this.cache.scrollTop = this.scrollEl.scrollTop;
4183 this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
4184 this.getRowsHeight(rows);
4185 }
4186
4187 var data = this.initData(rows, this.getNum(fixedScroll));
4188 var thisRows = data.rows.join('');
4189 var dataChanged = this.checkChanges('data', thisRows);
4190 var topOffsetChanged = this.checkChanges('top', data.topOffset);
4191 var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
4192 var html = [];
4193
4194 if (dataChanged && topOffsetChanged) {
4195 if (data.topOffset) {
4196 html.push(this.getExtra('top', data.topOffset));
4197 }
4198
4199 html.push(thisRows);
4200
4201 if (data.bottomOffset) {
4202 html.push(this.getExtra('bottom', data.bottomOffset));
4203 }
4204
4205 this.contentEl.innerHTML = html.join('');
4206
4207 if (fixedScroll) {
4208 this.contentEl.scrollTop = this.cache.scrollTop;
4209 }
4210 } else if (bottomOffsetChanged) {
4211 this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
4212 }
4213 }
4214 }, {
4215 key: "getRowsHeight",
4216 value: function getRowsHeight() {
4217 if (typeof this.itemHeight === 'undefined') {
4218 var nodes = this.contentEl.children;
4219 var node = nodes[Math.floor(nodes.length / 2)];
4220 this.itemHeight = node.offsetHeight;
4221 }
4222
4223 this.blockHeight = this.itemHeight * BLOCK_ROWS;
4224 this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS;
4225 this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS;
4226 }
4227 }, {
4228 key: "getNum",
4229 value: function getNum(fixedScroll) {
4230 this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop;
4231 return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
4232 }
4233 }, {
4234 key: "initData",
4235 value: function initData(rows, num) {
4236 if (rows.length < BLOCK_ROWS) {
4237 return {
4238 topOffset: 0,
4239 bottomOffset: 0,
4240 rowsAbove: 0,
4241 rows: rows
4242 };
4243 }
4244
4245 var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0);
4246 var end = start + this.clusterRows;
4247 var topOffset = Math.max(start * this.itemHeight, 0);
4248 var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
4249 var thisRows = [];
4250 var rowsAbove = start;
4251
4252 if (topOffset < 1) {
4253 rowsAbove++;
4254 }
4255
4256 for (var i = start; i < end; i++) {
4257 rows[i] && thisRows.push(rows[i]);
4258 }
4259
4260 return {
4261 topOffset: topOffset,
4262 bottomOffset: bottomOffset,
4263 rowsAbove: rowsAbove,
4264 rows: thisRows
4265 };
4266 }
4267 }, {
4268 key: "checkChanges",
4269 value: function checkChanges(type, value) {
4270 var changed = value !== this.cache[type];
4271 this.cache[type] = value;
4272 return changed;
4273 }
4274 }, {
4275 key: "getExtra",
4276 value: function getExtra(className, height) {
4277 var tag = document.createElement('tr');
4278 tag.className = "virtual-scroll-".concat(className);
4279
4280 if (height) {
4281 tag.style.height = "".concat(height, "px");
4282 }
4283
4284 return tag.outerHTML;
4285 }
4286 }]);
4287
4288 return VirtualScroll;
4289 }();
4290
4291 var BootstrapTable =
4292 /*#__PURE__*/
4293 function () {
4294 function BootstrapTable(el, options) {
4295 _classCallCheck(this, BootstrapTable);
4296
4297 this.options = options;
4298 this.$el = $(el);
4299 this.$el_ = this.$el.clone();
4300 this.timeoutId_ = 0;
4301 this.timeoutFooter_ = 0;
4302 }
4303
4304 _createClass(BootstrapTable, [{
4305 key: "init",
4306 value: function init() {
4307 this.initConstants();
4308 this.initLocale();
4309 this.initContainer();
4310 this.initTable();
4311 this.initHeader();
4312 this.initData();
4313 this.initHiddenRows();
4314 this.initToolbar();
4315 this.initPagination();
4316 this.initBody();
4317 this.initSearchText();
4318 this.initServer();
4319 }
4320 }, {
4321 key: "initConstants",
4322 value: function initConstants() {
4323 var opts = this.options;
4324 this.constants = Constants.CONSTANTS;
4325 this.constants.theme = $.fn.bootstrapTable.theme;
4326 var buttonsPrefix = opts.buttonsPrefix ? "".concat(opts.buttonsPrefix, "-") : '';
4327 this.constants.buttonsClass = [opts.buttonsPrefix, buttonsPrefix + opts.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), opts.iconSize)].join(' ').trim();
4328 this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], []);
4329 }
4330 }, {
4331 key: "initLocale",
4332 value: function initLocale() {
4333 if (this.options.locale) {
4334 var locales = $.fn.bootstrapTable.locales;
4335 var parts = this.options.locale.split(/-|_/);
4336 parts[0] = parts[0].toLowerCase();
4337
4338 if (parts[1]) {
4339 parts[1] = parts[1].toUpperCase();
4340 }
4341
4342 if (locales[this.options.locale]) {
4343 $.extend(this.options, locales[this.options.locale]);
4344 } else if (locales[parts.join('-')]) {
4345 $.extend(this.options, locales[parts.join('-')]);
4346 } else if (locales[parts[0]]) {
4347 $.extend(this.options, locales[parts[0]]);
4348 }
4349 }
4350 }
4351 }, {
4352 key: "initContainer",
4353 value: function initContainer() {
4354 var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : '';
4355 var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : '';
4356 var loadingTemplate = Utils.calculateObjectValue(this.options, this.options.loadingTemplate, [this.options.formatLoadingMessage()]);
4357 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 ").concat(loadingTemplate, "\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 "));
4358 this.$container.insertAfter(this.$el);
4359 this.$tableContainer = this.$container.find('.fixed-table-container');
4360 this.$tableHeader = this.$container.find('.fixed-table-header');
4361 this.$tableBody = this.$container.find('.fixed-table-body');
4362 this.$tableLoading = this.$container.find('.fixed-table-loading');
4363 this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not
4364
4365 if (this.options.buttonsToolbar) {
4366 this.$toolbar = $('body').find(this.options.buttonsToolbar);
4367 } else {
4368 this.$toolbar = this.$container.find('.fixed-table-toolbar');
4369 }
4370
4371 this.$pagination = this.$container.find('.fixed-table-pagination');
4372 this.$tableBody.append(this.$el);
4373 this.$container.after('<div class="clearfix"></div>');
4374 this.$el.addClass(this.options.classes);
4375 this.$tableLoading.addClass(this.options.classes);
4376
4377 if (this.options.height) {
4378 this.$tableContainer.addClass('fixed-height');
4379
4380 if (this.options.showFooter) {
4381 this.$tableContainer.addClass('has-footer');
4382 }
4383
4384 if (this.options.classes.split(' ').includes('table-bordered')) {
4385 this.$tableBody.append('<div class="fixed-table-border"></div>');
4386 this.$tableBorder = this.$tableBody.find('.fixed-table-border');
4387 this.$tableLoading.addClass('fixed-table-border');
4388 }
4389
4390 this.$tableFooter = this.$container.find('.fixed-table-footer');
4391 }
4392 }
4393 }, {
4394 key: "initTable",
4395 value: function initTable() {
4396 var _this = this;
4397
4398 var columns = [];
4399 this.$header = this.$el.find('>thead');
4400
4401 if (!this.$header.length) {
4402 this.$header = $("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el);
4403 } else if (this.options.theadClasses) {
4404 this.$header.addClass(this.options.theadClasses);
4405 }
4406
4407 this._headerTrClasses = [];
4408 this._headerTrStyles = [];
4409 this.$header.find('tr').each(function (i, el) {
4410 var $tr = $(el);
4411 var column = [];
4412 $tr.find('th').each(function (i, el) {
4413 var $th = $(el); // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not
4414
4415 if (typeof $th.data('field') !== 'undefined') {
4416 $th.data('field', "".concat($th.data('field')));
4417 }
4418
4419 column.push($.extend({}, {
4420 title: $th.html(),
4421 'class': $th.attr('class'),
4422 titleTooltip: $th.attr('title'),
4423 rowspan: $th.attr('rowspan') ? +$th.attr('rowspan') : undefined,
4424 colspan: $th.attr('colspan') ? +$th.attr('colspan') : undefined
4425 }, $th.data()));
4426 });
4427 columns.push(column);
4428
4429 if ($tr.attr('class')) {
4430 _this._headerTrClasses.push($tr.attr('class'));
4431 }
4432
4433 if ($tr.attr('style')) {
4434 _this._headerTrStyles.push($tr.attr('style'));
4435 }
4436 });
4437
4438 if (!Array.isArray(this.options.columns[0])) {
4439 this.options.columns = [this.options.columns];
4440 }
4441
4442 this.options.columns = $.extend(true, [], columns, this.options.columns);
4443 this.columns = [];
4444 this.fieldsColumnsIndex = [];
4445 Utils.setFieldIndex(this.options.columns);
4446 this.options.columns.forEach(function (columns, i) {
4447 columns.forEach(function (_column, j) {
4448 var column = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, _column);
4449
4450 if (typeof column.fieldIndex !== 'undefined') {
4451 _this.columns[column.fieldIndex] = column;
4452 _this.fieldsColumnsIndex[column.field] = column.fieldIndex;
4453 }
4454
4455 _this.options.columns[i][j] = column;
4456 });
4457 }); // if options.data is setting, do not process tbody and tfoot data
4458
4459 if (!this.options.data.length) {
4460 var htmlData = Utils.trToData(this.columns, this.$el.find('>tbody>tr'));
4461
4462 if (htmlData.length) {
4463 this.options.data = htmlData;
4464 this.fromHtml = true;
4465 }
4466 }
4467
4468 if (!(this.options.pagination && this.options.sidePagination !== 'server')) {
4469 this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr'));
4470 }
4471
4472 if (this.footerData) {
4473 this.$el.find('tfoot').html('<tr></tr>');
4474 }
4475
4476 if (!this.options.showFooter || this.options.cardView) {
4477 this.$tableFooter.hide();
4478 } else {
4479 this.$tableFooter.show();
4480 }
4481 }
4482 }, {
4483 key: "initHeader",
4484 value: function initHeader() {
4485 var _this2 = this;
4486
4487 var visibleColumns = {};
4488 var html = [];
4489 this.header = {
4490 fields: [],
4491 styles: [],
4492 classes: [],
4493 formatters: [],
4494 detailFormatters: [],
4495 events: [],
4496 sorters: [],
4497 sortNames: [],
4498 cellStyles: [],
4499 searchables: []
4500 };
4501 Utils.updateFieldGroup(this.options.columns);
4502 this.options.columns.forEach(function (columns, i) {
4503 html.push("<tr".concat(Utils.sprintf(' class="%s"', _this2._headerTrClasses[i]), " ").concat(Utils.sprintf(' style="%s"', _this2._headerTrStyles[i]), ">"));
4504 var detailViewTemplate = '';
4505
4506 if (i === 0 && Utils.hasDetailViewIcon(_this2.options)) {
4507 detailViewTemplate = "<th class=\"detail\" rowspan=\"".concat(_this2.options.columns.length, "\">\n <div class=\"fht-cell\"></div>\n </th>");
4508 }
4509
4510 if (detailViewTemplate && _this2.options.detailViewAlign !== 'right') {
4511 html.push(detailViewTemplate);
4512 }
4513
4514 columns.forEach(function (column, j) {
4515 var class_ = Utils.sprintf(' class="%s"', column['class']);
4516 var unitWidth = column.widthUnit;
4517 var width = parseFloat(column.width);
4518 var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
4519 var align = Utils.sprintf('text-align: %s; ', column.align);
4520 var style = Utils.sprintf('vertical-align: %s; ', column.valign);
4521 style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined);
4522
4523 if (typeof column.fieldIndex === 'undefined' && !column.visible) {
4524 return;
4525 }
4526
4527 var headerStyle = Utils.calculateObjectValue(null, _this2.options.headerStyle, [column]);
4528 var csses = [];
4529 var classes = '';
4530
4531 if (headerStyle && headerStyle.css) {
4532 for (var _i = 0, _Object$entries = Object.entries(headerStyle.css); _i < _Object$entries.length; _i++) {
4533 var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
4534 key = _Object$entries$_i[0],
4535 value = _Object$entries$_i[1];
4536
4537 csses.push("".concat(key, ": ").concat(value));
4538 }
4539 }
4540
4541 if (headerStyle && headerStyle.classes) {
4542 classes = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], headerStyle.classes].join(' ') : headerStyle.classes);
4543 }
4544
4545 if (typeof column.fieldIndex !== 'undefined') {
4546 _this2.header.fields[column.fieldIndex] = column.field;
4547 _this2.header.styles[column.fieldIndex] = align + style;
4548 _this2.header.classes[column.fieldIndex] = class_;
4549 _this2.header.formatters[column.fieldIndex] = column.formatter;
4550 _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter;
4551 _this2.header.events[column.fieldIndex] = column.events;
4552 _this2.header.sorters[column.fieldIndex] = column.sorter;
4553 _this2.header.sortNames[column.fieldIndex] = column.sortName;
4554 _this2.header.cellStyles[column.fieldIndex] = column.cellStyle;
4555 _this2.header.searchables[column.fieldIndex] = column.searchable;
4556
4557 if (!column.visible) {
4558 return;
4559 }
4560
4561 if (_this2.options.cardView && !column.cardVisible) {
4562 return;
4563 }
4564
4565 visibleColumns[column.field] = column;
4566 }
4567
4568 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.
4569 j === 0 && i > 0 ? ' data-not-first-th' : '', '>');
4570 html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? 'sortable both' : ''));
4571 var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title;
4572 var title = text;
4573
4574 if (column.checkbox) {
4575 text = '';
4576
4577 if (!_this2.options.singleSelect && _this2.options.checkboxHeader) {
4578 text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>';
4579 }
4580
4581 _this2.header.stateField = column.field;
4582 }
4583
4584 if (column.radio) {
4585 text = '';
4586 _this2.header.stateField = column.field;
4587 }
4588
4589 if (!text && column.showSelectTitle) {
4590 text += title;
4591 }
4592
4593 html.push(text);
4594 html.push('</div>');
4595 html.push('<div class="fht-cell"></div>');
4596 html.push('</div>');
4597 html.push('</th>');
4598 });
4599
4600 if (detailViewTemplate && _this2.options.detailViewAlign === 'right') {
4601 html.push(detailViewTemplate);
4602 }
4603
4604 html.push('</tr>');
4605 });
4606 this.$header.html(html.join(''));
4607 this.$header.find('th[data-field]').each(function (i, el) {
4608 $(el).data(visibleColumns[$(el).data('field')]);
4609 });
4610 this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) {
4611 var $this = $(e.currentTarget);
4612
4613 if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) {
4614 if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) {
4615 return false;
4616 }
4617 }
4618
4619 if (_this2.options.sortable && $this.parent().data().sortable) {
4620 _this2.onSort(e);
4621 }
4622 });
4623 this.$header.children().children().off('keypress').on('keypress', function (e) {
4624 if (_this2.options.sortable && $(e.currentTarget).data().sortable) {
4625 var code = e.keyCode || e.which;
4626
4627 if (code === 13) {
4628 // Enter keycode
4629 _this2.onSort(e);
4630 }
4631 }
4632 });
4633 var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id'));
4634 $(window).off(resizeEvent);
4635
4636 if (!this.options.showHeader || this.options.cardView) {
4637 this.$header.hide();
4638 this.$tableHeader.hide();
4639 this.$tableLoading.css('top', 0);
4640 } else {
4641 this.$header.show();
4642 this.$tableHeader.show();
4643 this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow
4644
4645 this.getCaret();
4646 $(window).on(resizeEvent, function () {
4647 return _this2.resetView();
4648 });
4649 }
4650
4651 this.$selectAll = this.$header.find('[name="btSelectAll"]');
4652 this.$selectAll.off('click').on('click', function (e) {
4653 e.stopPropagation();
4654 var checked = $(e.currentTarget).prop('checked');
4655
4656 _this2[checked ? 'checkAll' : 'uncheckAll']();
4657
4658 _this2.updateSelected();
4659 });
4660 }
4661 }, {
4662 key: "initData",
4663 value: function initData(data, type) {
4664 if (type === 'append') {
4665 this.options.data = this.options.data.concat(data);
4666 } else if (type === 'prepend') {
4667 this.options.data = [].concat(data).concat(this.options.data);
4668 } else {
4669 data = data || Utils.deepCopy(this.options.data);
4670 this.options.data = Array.isArray(data) ? data : data[this.options.dataField];
4671 }
4672
4673 this.data = _toConsumableArray(this.options.data);
4674
4675 if (this.options.sortReset) {
4676 this.unsortedData = _toConsumableArray(this.data);
4677 }
4678
4679 if (this.options.sidePagination === 'server') {
4680 return;
4681 }
4682
4683 this.initSort();
4684 }
4685 }, {
4686 key: "initSort",
4687 value: function initSort() {
4688 var _this3 = this;
4689
4690 var name = this.options.sortName;
4691 var order = this.options.sortOrder === 'desc' ? -1 : 1;
4692 var index = this.header.fields.indexOf(this.options.sortName);
4693 var timeoutId = 0;
4694
4695 if (index !== -1) {
4696 if (this.options.sortStable) {
4697 this.data.forEach(function (row, i) {
4698 if (!row.hasOwnProperty('_position')) {
4699 row._position = i;
4700 }
4701 });
4702 }
4703
4704 if (this.options.customSort) {
4705 Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]);
4706 } else {
4707 this.data.sort(function (a, b) {
4708 if (_this3.header.sortNames[index]) {
4709 name = _this3.header.sortNames[index];
4710 }
4711
4712 var aa = Utils.getItemField(a, name, _this3.options.escape);
4713 var bb = Utils.getItemField(b, name, _this3.options.escape);
4714 var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]);
4715
4716 if (value !== undefined) {
4717 if (_this3.options.sortStable && value === 0) {
4718 return order * (a._position - b._position);
4719 }
4720
4721 return order * value;
4722 }
4723
4724 return Utils.sort(aa, bb, order, _this3.options.sortStable, a._position, b._position);
4725 });
4726 }
4727
4728 if (this.options.sortClass !== undefined) {
4729 clearTimeout(timeoutId);
4730 timeoutId = setTimeout(function () {
4731 _this3.$el.removeClass(_this3.options.sortClass);
4732
4733 var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index();
4734
4735 _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass);
4736 }, 250);
4737 }
4738 } else if (this.options.sortReset) {
4739 this.data = _toConsumableArray(this.unsortedData);
4740 }
4741 }
4742 }, {
4743 key: "onSort",
4744 value: function onSort(_ref) {
4745 var type = _ref.type,
4746 currentTarget = _ref.currentTarget;
4747 var $this = type === 'keypress' ? $(currentTarget) : $(currentTarget).parent();
4748 var $this_ = this.$header.find('th').eq($this.index());
4749 this.$header.add(this.$header_).find('span.order').remove();
4750
4751 if (this.options.sortName === $this.data('field')) {
4752 var currentSortOrder = this.options.sortOrder;
4753
4754 if (currentSortOrder === undefined) {
4755 this.options.sortOrder = 'asc';
4756 } else if (currentSortOrder === 'asc') {
4757 this.options.sortOrder = 'desc';
4758 } else if (this.options.sortOrder === 'desc') {
4759 this.options.sortOrder = this.options.sortReset ? undefined : 'asc';
4760 }
4761
4762 if (this.options.sortOrder === undefined) {
4763 this.options.sortName = undefined;
4764 }
4765 } else {
4766 this.options.sortName = $this.data('field');
4767
4768 if (this.options.rememberOrder) {
4769 this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
4770 } else {
4771 this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order;
4772 }
4773 }
4774
4775 this.trigger('sort', this.options.sortName, this.options.sortOrder);
4776 $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow
4777
4778 this.getCaret();
4779
4780 if (this.options.sidePagination === 'server' && this.options.serverSort) {
4781 this.options.pageNumber = 1;
4782 this.initServer(this.options.silentSort);
4783 return;
4784 }
4785
4786 this.initSort();
4787 this.initBody();
4788 }
4789 }, {
4790 key: "initToolbar",
4791 value: function initToolbar() {
4792 var _this4 = this;
4793
4794 var opts = this.options;
4795 var html = [];
4796 var timeoutId = 0;
4797 var $keepOpen;
4798 var switchableCount = 0;
4799
4800 if (this.$toolbar.find('.bs-bars').children().length) {
4801 $('body').append($(opts.toolbar));
4802 }
4803
4804 this.$toolbar.html('');
4805
4806 if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') {
4807 $(Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($(opts.toolbar));
4808 } // showColumns, showToggle, showRefresh
4809
4810
4811 html = ["<div class=\"".concat(['columns', "columns-".concat(opts.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(opts.buttonsAlign)].join(' '), "\">")];
4812
4813 if (typeof opts.icons === 'string') {
4814 opts.icons = Utils.calculateObjectValue(null, opts.icons);
4815 }
4816
4817 if (typeof opts.buttonsOrder === 'string') {
4818 opts.buttonsOrder = opts.buttonsOrder.replace(/\[|\]| |'/g, '').toLowerCase().split(',');
4819 }
4820
4821 this.buttons = Object.assign(this.buttons, {
4822 paginationSwitch: {
4823 text: opts.pagination ? opts.formatPaginationSwitchUp() : opts.formatPaginationSwitchDown(),
4824 icon: opts.pagination ? opts.icons.paginationSwitchDown : opts.icons.paginationSwitchUp,
4825 render: false,
4826 event: this.togglePagination,
4827 attributes: {
4828 'aria-label': opts.formatPaginationSwitch(),
4829 title: opts.formatPaginationSwitch()
4830 }
4831 },
4832 refresh: {
4833 text: opts.formatRefresh(),
4834 icon: opts.icons.refresh,
4835 render: false,
4836 event: this.refresh,
4837 attributes: {
4838 'aria-label': opts.formatRefresh(),
4839 title: opts.formatRefresh()
4840 }
4841 },
4842 toggle: {
4843 text: opts.formatToggle(),
4844 icon: opts.icons.toggleOff,
4845 render: false,
4846 event: this.toggleView,
4847 attributes: {
4848 'aria-label': opts.formatToggleOn(),
4849 title: opts.formatToggleOn()
4850 }
4851 },
4852 fullscreen: {
4853 text: opts.formatFullscreen(),
4854 icon: opts.icons.fullscreen,
4855 render: false,
4856 event: this.toggleFullscreen,
4857 attributes: {
4858 'aria-label': opts.formatFullscreen(),
4859 title: opts.formatFullscreen()
4860 }
4861 },
4862 columns: {
4863 render: false,
4864 html: function html() {
4865 var html = [];
4866 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]));
4867
4868 if (opts.showColumnsSearch) {
4869 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="text" class="%s" name="columnsSearch" placeholder="%s" autocomplete="off">', _this4.constants.classes.input, opts.formatSearch())));
4870 html.push(_this4.constants.html.toolbarDropdownSeparator);
4871 }
4872
4873 if (opts.showColumnsToggleAll) {
4874 var allFieldsVisible = _this4.getVisibleColumns().length === _this4.columns.filter(function (column) {
4875 return !_this4.isSelectionColumn(column);
4876 }).length;
4877
4878 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())));
4879 html.push(_this4.constants.html.toolbarDropdownSeparator);
4880 }
4881
4882 var visibleColumns = 0;
4883
4884 _this4.columns.forEach(function (column, i) {
4885 if (column.visible) {
4886 visibleColumns++;
4887 }
4888 });
4889
4890 _this4.columns.forEach(function (column, i) {
4891 if (_this4.isSelectionColumn(column)) {
4892 return;
4893 }
4894
4895 if (opts.cardView && !column.cardVisible) {
4896 return;
4897 }
4898
4899 var checked = column.visible ? ' checked="checked"' : '';
4900 var disabled = visibleColumns <= opts.minimumCountColumns && checked ? ' disabled="disabled"' : '';
4901
4902 if (column.switchable) {
4903 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)));
4904 switchableCount++;
4905 }
4906 });
4907
4908 html.push(_this4.constants.html.toolbarDropdown[1], '</div>');
4909 return html.join('');
4910 }
4911 }
4912 });
4913 var buttonsHtml = {};
4914
4915 for (var _i2 = 0, _Object$entries2 = Object.entries(this.buttons); _i2 < _Object$entries2.length; _i2++) {
4916 var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
4917 buttonName = _Object$entries2$_i[0],
4918 buttonConfig = _Object$entries2$_i[1];
4919
4920 var buttonHtml = void 0;
4921
4922 if (buttonConfig.hasOwnProperty('html')) {
4923 buttonHtml = Utils.calculateObjectValue(opts, buttonConfig.html);
4924 } else {
4925 buttonHtml = "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"").concat(buttonName, "\"");
4926
4927 if (buttonConfig.hasOwnProperty('attributes')) {
4928 for (var _i4 = 0, _Object$entries4 = Object.entries(buttonConfig.attributes); _i4 < _Object$entries4.length; _i4++) {
4929 var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
4930 attributeName = _Object$entries4$_i[0],
4931 value = _Object$entries4$_i[1];
4932
4933 buttonHtml += " ".concat(attributeName, "=\"").concat(Utils.calculateObjectValue(opts, value), "\"");
4934 }
4935 }
4936
4937 buttonHtml += '>';
4938
4939 if (opts.showButtonIcons && buttonConfig.hasOwnProperty('icon')) {
4940 var icon = Utils.calculateObjectValue(opts, buttonConfig.icon);
4941 buttonHtml += Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, icon) + ' ';
4942 }
4943
4944 if (opts.showButtonText && buttonConfig.hasOwnProperty('text')) {
4945 buttonHtml += Utils.calculateObjectValue(opts, buttonConfig.text);
4946 }
4947
4948 buttonHtml += '</button>';
4949 }
4950
4951 buttonsHtml[buttonName] = buttonHtml;
4952 var optionName = "show".concat(buttonName.charAt(0).toUpperCase()).concat(buttonName.substring(1));
4953 var showOption = opts[optionName];
4954
4955 if ((!buttonConfig.hasOwnProperty('render') || buttonConfig.hasOwnProperty('render') && buttonConfig.render) && (showOption === undefined || showOption === true)) {
4956 opts[optionName] = true;
4957 }
4958
4959 if (!opts.buttonsOrder.includes(buttonName)) {
4960 opts.buttonsOrder.push(buttonName);
4961 }
4962 } // Adding the button html to the final toolbar html when the showOption is true
4963
4964
4965 var _iteratorNormalCompletion = true;
4966 var _didIteratorError = false;
4967 var _iteratorError = undefined;
4968
4969 try {
4970 for (var _iterator = opts.buttonsOrder[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
4971 var button = _step.value;
4972 var _showOption = opts["show".concat(button.charAt(0).toUpperCase()).concat(button.substring(1))];
4973
4974 if (_showOption) {
4975 html.push(buttonsHtml[button]);
4976 }
4977 }
4978 } catch (err) {
4979 _didIteratorError = true;
4980 _iteratorError = err;
4981 } finally {
4982 try {
4983 if (!_iteratorNormalCompletion && _iterator.return != null) {
4984 _iterator.return();
4985 }
4986 } finally {
4987 if (_didIteratorError) {
4988 throw _iteratorError;
4989 }
4990 }
4991 }
4992
4993 html.push('</div>'); // Fix #188: this.showToolbar is for extensions
4994
4995 if (this.showToolbar || html.length > 2) {
4996 this.$toolbar.append(html.join(''));
4997 }
4998
4999 for (var _i3 = 0, _Object$entries3 = Object.entries(this.buttons); _i3 < _Object$entries3.length; _i3++) {
5000 var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
5001 _buttonName = _Object$entries3$_i[0],
5002 _buttonConfig = _Object$entries3$_i[1];
5003
5004 if (_buttonConfig.hasOwnProperty('event')) {
5005 if (typeof _buttonConfig.event === 'function' || typeof _buttonConfig.event === 'string') {
5006 var _ret = function () {
5007 var event = typeof _buttonConfig.event === 'string' ? window[_buttonConfig.event] : _buttonConfig.event;
5008
5009 _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off('click').on('click', function () {
5010 return event.call(_this4);
5011 });
5012
5013 return "continue";
5014 }();
5015
5016 if (_ret === "continue") continue;
5017 }
5018
5019 var _loop = function _loop() {
5020 var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
5021 eventType = _Object$entries5$_i[0],
5022 eventFunction = _Object$entries5$_i[1];
5023
5024 var event = typeof eventFunction === 'string' ? window[eventFunction] : eventFunction;
5025
5026 _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off(eventType).on(eventType, function () {
5027 return event.call(_this4);
5028 });
5029 };
5030
5031 for (var _i5 = 0, _Object$entries5 = Object.entries(_buttonConfig.event); _i5 < _Object$entries5.length; _i5++) {
5032 _loop();
5033 }
5034 }
5035 }
5036
5037 if (opts.showColumns) {
5038 $keepOpen = this.$toolbar.find('.keep-open');
5039 var $checkboxes = $keepOpen.find('input[type="checkbox"]:not(".toggle-all")');
5040 var $toggleAll = $keepOpen.find('input[type="checkbox"].toggle-all');
5041
5042 if (switchableCount <= opts.minimumCountColumns) {
5043 $keepOpen.find('input').prop('disabled', true);
5044 }
5045
5046 $keepOpen.find('li, label').off('click').on('click', function (e) {
5047 e.stopImmediatePropagation();
5048 });
5049 $checkboxes.off('click').on('click', function (_ref2) {
5050 var currentTarget = _ref2.currentTarget;
5051 var $this = $(currentTarget);
5052
5053 _this4._toggleColumn($this.val(), $this.prop('checked'), false);
5054
5055 _this4.trigger('column-switch', $this.data('field'), $this.prop('checked'));
5056
5057 $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.filter(function (column) {
5058 return !_this4.isSelectionColumn(column);
5059 }).length);
5060 });
5061 $toggleAll.off('click').on('click', function (_ref3) {
5062 var currentTarget = _ref3.currentTarget;
5063
5064 _this4._toggleAllColumns($(currentTarget).prop('checked'));
5065 });
5066
5067 if (opts.showColumnsSearch) {
5068 var $columnsSearch = $keepOpen.find('[name="columnsSearch"]');
5069 var $listItems = $keepOpen.find('.dropdown-item-marker');
5070 $columnsSearch.on('keyup paste change', function (_ref4) {
5071 var currentTarget = _ref4.currentTarget;
5072 var $this = $(currentTarget);
5073 var searchValue = $this.val().toLowerCase();
5074 $listItems.show();
5075 $checkboxes.each(function (i, el) {
5076 var $checkbox = $(el);
5077 var $listItem = $checkbox.parents('.dropdown-item-marker');
5078 var text = $listItem.text().toLowerCase();
5079
5080 if (!text.includes(searchValue)) {
5081 $listItem.hide();
5082 }
5083 });
5084 });
5085 }
5086 }
5087
5088 var handleInputEvent = function handleInputEvent($searchInput) {
5089 var eventTriggers = 'keyup drop blur mouseup';
5090 $searchInput.off(eventTriggers).on(eventTriggers, function (event) {
5091 if (opts.searchOnEnterKey && event.keyCode !== 13) {
5092 return;
5093 }
5094
5095 if ([37, 38, 39, 40].includes(event.keyCode)) {
5096 return;
5097 }
5098
5099 clearTimeout(timeoutId); // doesn't matter if it's 0
5100
5101 timeoutId = setTimeout(function () {
5102 _this4.onSearch({
5103 currentTarget: event.currentTarget
5104 });
5105 }, opts.searchTimeOut);
5106 });
5107 }; // Fix #4516: this.showSearchClearButton is for extensions
5108
5109
5110 if ((opts.search || this.showSearchClearButton) && typeof opts.searchSelector !== 'string') {
5111 html = [];
5112 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() : '');
5113 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() : '');
5114 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=\"search\" placeholder=\"").concat(opts.formatSearch(), "\" autocomplete=\"off\">");
5115 var searchInputFinalHtml = searchInputHtml;
5116
5117 if (opts.showSearchButton || opts.showSearchClearButton) {
5118 var _buttonsHtml = (opts.showSearchButton ? showSearchButton : '') + (opts.showSearchClearButton ? showSearchClearButton : '');
5119
5120 searchInputFinalHtml = opts.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, _buttonsHtml) : _buttonsHtml;
5121 }
5122
5123 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));
5124 this.$toolbar.append(html.join(''));
5125 var $searchInput = Utils.getSearchInput(this);
5126
5127 if (opts.showSearchButton) {
5128 this.$toolbar.find('.search button[name=search]').off('click').on('click', function (event) {
5129 clearTimeout(timeoutId); // doesn't matter if it's 0
5130
5131 timeoutId = setTimeout(function () {
5132 _this4.onSearch({
5133 currentTarget: $searchInput
5134 });
5135 }, opts.searchTimeOut);
5136 });
5137
5138 if (opts.searchOnEnterKey) {
5139 handleInputEvent($searchInput);
5140 }
5141 } else {
5142 handleInputEvent($searchInput);
5143 }
5144
5145 if (opts.showSearchClearButton) {
5146 this.$toolbar.find('.search button[name=clearSearch]').click(function () {
5147 _this4.resetSearch();
5148 });
5149 }
5150 } else if (typeof opts.searchSelector === 'string') {
5151 var _$searchInput = Utils.getSearchInput(this);
5152
5153 handleInputEvent(_$searchInput);
5154 }
5155 }
5156 }, {
5157 key: "onSearch",
5158 value: function onSearch() {
5159 var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
5160 currentTarget = _ref5.currentTarget,
5161 firedByInitSearchText = _ref5.firedByInitSearchText;
5162
5163 var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
5164
5165 if (currentTarget !== undefined && $(currentTarget).length && overwriteSearchText) {
5166 var text = $(currentTarget).val().trim();
5167
5168 if (this.options.trimOnSearch && $(currentTarget).val() !== text) {
5169 $(currentTarget).val(text);
5170 }
5171
5172 if (this.searchText === text) {
5173 return;
5174 }
5175
5176 if (currentTarget === Utils.getSearchInput(this)[0] || $(currentTarget).hasClass('search-input')) {
5177 this.searchText = text;
5178 this.options.searchText = text;
5179 }
5180 }
5181
5182 if (!firedByInitSearchText) {
5183 this.options.pageNumber = 1;
5184 }
5185
5186 this.initSearch();
5187
5188 if (firedByInitSearchText) {
5189 if (this.options.sidePagination === 'client') {
5190 this.updatePagination();
5191 }
5192 } else {
5193 this.updatePagination();
5194 }
5195
5196 this.trigger('search', this.searchText);
5197 }
5198 }, {
5199 key: "initSearch",
5200 value: function initSearch() {
5201 var _this5 = this;
5202
5203 this.filterOptions = this.filterOptions || this.options.filterOptions;
5204
5205 if (this.options.sidePagination !== 'server') {
5206 if (this.options.customSearch) {
5207 this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]);
5208
5209 if (this.options.sortReset) {
5210 this.unsortedData = _toConsumableArray(this.data);
5211 }
5212
5213 return;
5214 }
5215
5216 var s = this.searchText && (this.fromHtml ? Utils.escapeHTML(this.searchText) : this.searchText).toLowerCase();
5217 var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns; // Check filter
5218
5219 if (typeof this.filterOptions.filterAlgorithm === 'function') {
5220 this.data = this.options.data.filter(function (item, i) {
5221 return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]);
5222 });
5223 } else if (typeof this.filterOptions.filterAlgorithm === 'string') {
5224 this.data = f ? this.options.data.filter(function (item, i) {
5225 var filterAlgorithm = _this5.filterOptions.filterAlgorithm;
5226
5227 if (filterAlgorithm === 'and') {
5228 for (var key in f) {
5229 if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) {
5230 return false;
5231 }
5232 }
5233 } else if (filterAlgorithm === 'or') {
5234 var match = false;
5235
5236 for (var _key in f) {
5237 if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) {
5238 match = true;
5239 }
5240 }
5241
5242 return match;
5243 }
5244
5245 return true;
5246 }) : _toConsumableArray(this.options.data);
5247 }
5248
5249 var visibleFields = this.getVisibleFields();
5250 this.data = s ? this.data.filter(function (item, i) {
5251 for (var j = 0; j < _this5.header.fields.length; j++) {
5252 if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
5253 continue;
5254 }
5255
5256 var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j];
5257 var column = _this5.columns[_this5.fieldsColumnsIndex[key]];
5258 var value = void 0;
5259
5260 if (typeof key === 'string') {
5261 value = item;
5262 var props = key.split('.');
5263
5264 for (var _i6 = 0; _i6 < props.length; _i6++) {
5265 if (value[props[_i6]] !== null) {
5266 value = value[props[_i6]];
5267 }
5268 }
5269 } else {
5270 value = item[key];
5271 }
5272
5273 if (_this5.options.searchAccentNeutralise) {
5274 value = Utils.normalizeAccent(value);
5275 } // Fix #142: respect searchFormatter boolean
5276
5277
5278 if (column && column.searchFormatter) {
5279 value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
5280 }
5281
5282 if (typeof value === 'string' || typeof value === 'number') {
5283 if (_this5.options.strictSearch) {
5284 if ("".concat(value).toLowerCase() === s) {
5285 return true;
5286 }
5287 } else {
5288 var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
5289 var matches = largerSmallerEqualsRegex.exec(s);
5290 var comparisonCheck = false;
5291
5292 if (matches) {
5293 var operator = matches[1] || "".concat(matches[5], "l");
5294 var comparisonValue = matches[2] || matches[3];
5295 var int = parseInt(value, 10);
5296 var comparisonInt = parseInt(comparisonValue, 10);
5297
5298 switch (operator) {
5299 case '>':
5300 case '<l':
5301 comparisonCheck = int > comparisonInt;
5302 break;
5303
5304 case '<':
5305 case '>l':
5306 comparisonCheck = int < comparisonInt;
5307 break;
5308
5309 case '<=':
5310 case '=<':
5311 case '>=l':
5312 case '=>l':
5313 comparisonCheck = int <= comparisonInt;
5314 break;
5315
5316 case '>=':
5317 case '=>':
5318 case '<=l':
5319 case '=<l':
5320 comparisonCheck = int >= comparisonInt;
5321 break;
5322 }
5323 }
5324
5325 if (comparisonCheck || "".concat(value).toLowerCase().includes(s)) {
5326 return true;
5327 }
5328 }
5329 }
5330 }
5331
5332 return false;
5333 }) : this.data;
5334
5335 if (this.options.sortReset) {
5336 this.unsortedData = _toConsumableArray(this.data);
5337 }
5338
5339 this.initSort();
5340 }
5341 }
5342 }, {
5343 key: "initPagination",
5344 value: function initPagination() {
5345 var _this6 = this;
5346
5347 var opts = this.options;
5348
5349 if (!opts.pagination) {
5350 this.$pagination.hide();
5351 return;
5352 }
5353
5354 this.$pagination.show();
5355 var html = [];
5356 var allSelected = false;
5357 var i;
5358 var from;
5359 var to;
5360 var $pageList;
5361 var $pre;
5362 var $next;
5363 var $number;
5364 var data = this.getData({
5365 includeHiddenRows: false
5366 });
5367 var pageList = opts.pageList;
5368
5369 if (typeof pageList === 'string') {
5370 pageList = pageList.replace(/\[|\]| /g, '').toLowerCase().split(',');
5371 }
5372
5373 pageList = pageList.map(function (value) {
5374 if (typeof value === 'string') {
5375 return value.toLowerCase() === opts.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? opts.formatAllRows() : +value;
5376 }
5377
5378 return value;
5379 });
5380 this.paginationParts = opts.paginationParts;
5381
5382 if (typeof this.paginationParts === 'string') {
5383 this.paginationParts = this.paginationParts.replace(/\[|\]| |'/g, '').split(',');
5384 }
5385
5386 if (opts.sidePagination !== 'server') {
5387 opts.totalRows = data.length;
5388 }
5389
5390 this.totalPages = 0;
5391
5392 if (opts.totalRows) {
5393 if (opts.pageSize === opts.formatAllRows()) {
5394 opts.pageSize = opts.totalRows;
5395 allSelected = true;
5396 }
5397
5398 this.totalPages = ~~((opts.totalRows - 1) / opts.pageSize) + 1;
5399 opts.totalPages = this.totalPages;
5400 }
5401
5402 if (this.totalPages > 0 && opts.pageNumber > this.totalPages) {
5403 opts.pageNumber = this.totalPages;
5404 }
5405
5406 this.pageFrom = (opts.pageNumber - 1) * opts.pageSize + 1;
5407 this.pageTo = opts.pageNumber * opts.pageSize;
5408
5409 if (this.pageTo > opts.totalRows) {
5410 this.pageTo = opts.totalRows;
5411 }
5412
5413 if (this.options.pagination && this.options.sidePagination !== 'server') {
5414 this.options.totalNotFiltered = this.options.data.length;
5415 }
5416
5417 if (!this.options.showExtendedPagination) {
5418 this.options.totalNotFiltered = undefined;
5419 }
5420
5421 if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
5422 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationDetailHAlign, " pagination-detail\">"));
5423 }
5424
5425 if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort')) {
5426 var paginationInfo = this.paginationParts.includes('pageInfoShort') ? opts.formatDetailPagination(opts.totalRows) : opts.formatShowingRows(this.pageFrom, this.pageTo, opts.totalRows, opts.totalNotFiltered);
5427 html.push("<span class=\"pagination-info\">\n ".concat(paginationInfo, "\n </span>"));
5428 }
5429
5430 if (this.paginationParts.includes('pageSize')) {
5431 html.push('<span class="page-list">');
5432 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])];
5433 pageList.forEach(function (page, i) {
5434 if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows) {
5435 var active;
5436
5437 if (allSelected) {
5438 active = page === opts.formatAllRows() ? _this6.constants.classes.dropdownActive : '';
5439 } else {
5440 active = page === opts.pageSize ? _this6.constants.classes.dropdownActive : '';
5441 }
5442
5443 pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page));
5444 }
5445 });
5446 pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</span>"));
5447 html.push(opts.formatRecordsPerPage(pageNumber.join('')));
5448 }
5449
5450 if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
5451 html.push('</span></div>');
5452 }
5453
5454 if (this.paginationParts.includes('pageList')) {
5455 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));
5456
5457 if (this.totalPages < opts.paginationSuccessivelySize) {
5458 from = 1;
5459 to = this.totalPages;
5460 } else {
5461 from = opts.pageNumber - opts.paginationPagesBySide;
5462 to = from + opts.paginationPagesBySide * 2;
5463 }
5464
5465 if (opts.pageNumber < opts.paginationSuccessivelySize - 1) {
5466 to = opts.paginationSuccessivelySize;
5467 }
5468
5469 if (opts.paginationSuccessivelySize > this.totalPages - from) {
5470 from = from - (opts.paginationSuccessivelySize - (this.totalPages - from)) + 1;
5471 }
5472
5473 if (from < 1) {
5474 from = 1;
5475 }
5476
5477 if (to > this.totalPages) {
5478 to = this.totalPages;
5479 }
5480
5481 var middleSize = Math.round(opts.paginationPagesBySide / 2);
5482
5483 var pageItem = function pageItem(i) {
5484 var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
5485 return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === opts.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), opts.formatSRPaginationPageText(i), i);
5486 };
5487
5488 if (from > 1) {
5489 var max = opts.paginationPagesBySide;
5490 if (max >= from) max = from - 1;
5491
5492 for (i = 1; i <= max; i++) {
5493 html.push(pageItem(i));
5494 }
5495
5496 if (from - 1 === max + 1) {
5497 i = from - 1;
5498 html.push(pageItem(i));
5499 } else {
5500 if (from - 1 > max) {
5501 if (from - opts.paginationPagesBySide * 2 > opts.paginationPagesBySide && opts.paginationUseIntermediate) {
5502 i = Math.round((from - middleSize) / 2 + middleSize);
5503 html.push(pageItem(i, ' page-intermediate'));
5504 } else {
5505 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...'));
5506 }
5507 }
5508 }
5509 }
5510
5511 for (i = from; i <= to; i++) {
5512 html.push(pageItem(i));
5513 }
5514
5515 if (this.totalPages > to) {
5516 var min = this.totalPages - (opts.paginationPagesBySide - 1);
5517 if (to >= min) min = to + 1;
5518
5519 if (to + 1 === min - 1) {
5520 i = to + 1;
5521 html.push(pageItem(i));
5522 } else {
5523 if (min > to + 1) {
5524 if (this.totalPages - to > opts.paginationPagesBySide * 2 && opts.paginationUseIntermediate) {
5525 i = Math.round((this.totalPages - middleSize - to) / 2 + to);
5526 html.push(pageItem(i, ' page-intermediate'));
5527 } else {
5528 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...'));
5529 }
5530 }
5531 }
5532
5533 for (i = min; i <= this.totalPages; i++) {
5534 html.push(pageItem(i));
5535 }
5536 }
5537
5538 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', opts.formatSRPaginationNextText(), opts.paginationNextText));
5539 html.push(this.constants.html.pagination[1], '</div>');
5540 }
5541
5542 this.$pagination.html(html.join(''));
5543 var dropupClass = ['bottom', 'both'].includes(opts.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : '';
5544 this.$pagination.last().find('.page-list > span').addClass(dropupClass);
5545
5546 if (!opts.onlyInfoPagination) {
5547 $pageList = this.$pagination.find('.page-list a');
5548 $pre = this.$pagination.find('.page-pre');
5549 $next = this.$pagination.find('.page-next');
5550 $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator');
5551
5552 if (this.totalPages <= 1) {
5553 this.$pagination.find('div.pagination').hide();
5554 }
5555
5556 if (opts.smartDisplay) {
5557 if (pageList.length < 2 || opts.totalRows <= pageList[0]) {
5558 this.$pagination.find('span.page-list').hide();
5559 }
5560 } // when data is empty, hide the pagination
5561
5562
5563 this.$pagination[this.getData().length ? 'show' : 'hide']();
5564
5565 if (!opts.paginationLoop) {
5566 if (opts.pageNumber === 1) {
5567 $pre.addClass('disabled');
5568 }
5569
5570 if (opts.pageNumber === this.totalPages) {
5571 $next.addClass('disabled');
5572 }
5573 }
5574
5575 if (allSelected) {
5576 opts.pageSize = opts.formatAllRows();
5577 } // removed the events for last and first, onPageNumber executeds the same logic
5578
5579
5580 $pageList.off('click').on('click', function (e) {
5581 return _this6.onPageListChange(e);
5582 });
5583 $pre.off('click').on('click', function (e) {
5584 return _this6.onPagePre(e);
5585 });
5586 $next.off('click').on('click', function (e) {
5587 return _this6.onPageNext(e);
5588 });
5589 $number.off('click').on('click', function (e) {
5590 return _this6.onPageNumber(e);
5591 });
5592 }
5593 }
5594 }, {
5595 key: "updatePagination",
5596 value: function updatePagination(event) {
5597 // Fix #171: IE disabled button can be clicked bug.
5598 if (event && $(event.currentTarget).hasClass('disabled')) {
5599 return;
5600 }
5601
5602 if (!this.options.maintainMetaData) {
5603 this.resetRows();
5604 }
5605
5606 this.initPagination();
5607 this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
5608
5609 if (this.options.sidePagination === 'server') {
5610 this.initServer();
5611 } else {
5612 this.initBody();
5613 }
5614 }
5615 }, {
5616 key: "onPageListChange",
5617 value: function onPageListChange(event) {
5618 event.preventDefault();
5619 var $this = $(event.currentTarget);
5620 $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);
5621 this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text();
5622 this.$toolbar.find('.page-size').text(this.options.pageSize);
5623 this.updatePagination(event);
5624 return false;
5625 }
5626 }, {
5627 key: "onPagePre",
5628 value: function onPagePre(event) {
5629 event.preventDefault();
5630
5631 if (this.options.pageNumber - 1 === 0) {
5632 this.options.pageNumber = this.options.totalPages;
5633 } else {
5634 this.options.pageNumber--;
5635 }
5636
5637 this.updatePagination(event);
5638 return false;
5639 }
5640 }, {
5641 key: "onPageNext",
5642 value: function onPageNext(event) {
5643 event.preventDefault();
5644
5645 if (this.options.pageNumber + 1 > this.options.totalPages) {
5646 this.options.pageNumber = 1;
5647 } else {
5648 this.options.pageNumber++;
5649 }
5650
5651 this.updatePagination(event);
5652 return false;
5653 }
5654 }, {
5655 key: "onPageNumber",
5656 value: function onPageNumber(event) {
5657 event.preventDefault();
5658
5659 if (this.options.pageNumber === +$(event.currentTarget).text()) {
5660 return;
5661 }
5662
5663 this.options.pageNumber = +$(event.currentTarget).text();
5664 this.updatePagination(event);
5665 return false;
5666 }
5667 }, {
5668 key: "initRow",
5669 value: function initRow(item, i, data, trFragments) {
5670 var _this7 = this;
5671
5672 var html = [];
5673 var style = {};
5674 var csses = [];
5675 var data_ = '';
5676 var attributes = {};
5677 var htmlAttributes = [];
5678
5679 if (Utils.findIndex(this.hiddenRows, item) > -1) {
5680 return;
5681 }
5682
5683 style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
5684
5685 if (style && style.css) {
5686 for (var _i7 = 0, _Object$entries6 = Object.entries(style.css); _i7 < _Object$entries6.length; _i7++) {
5687 var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i7], 2),
5688 key = _Object$entries6$_i[0],
5689 value = _Object$entries6$_i[1];
5690
5691 csses.push("".concat(key, ": ").concat(value));
5692 }
5693 }
5694
5695 attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
5696
5697 if (attributes) {
5698 for (var _i8 = 0, _Object$entries7 = Object.entries(attributes); _i8 < _Object$entries7.length; _i8++) {
5699 var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
5700 _key2 = _Object$entries7$_i[0],
5701 _value = _Object$entries7$_i[1];
5702
5703 htmlAttributes.push("".concat(_key2, "=\"").concat(Utils.escapeHTML(_value), "\""));
5704 }
5705 }
5706
5707 if (item._data && !Utils.isEmptyObject(item._data)) {
5708 for (var _i9 = 0, _Object$entries8 = Object.entries(item._data); _i9 < _Object$entries8.length; _i9++) {
5709 var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2),
5710 k = _Object$entries8$_i[0],
5711 v = _Object$entries8$_i[1];
5712
5713 // ignore data-index
5714 if (k === 'index') {
5715 return;
5716 }
5717
5718 data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'");
5719 }
5720 }
5721
5722 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)), Utils.sprintf(' style="%s"', Array.isArray(item) ? undefined : item._style), " 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.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item]) ? 'true' : undefined), Utils.sprintf('%s', data_), '>');
5723
5724 if (this.options.cardView) {
5725 html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">"));
5726 }
5727
5728 var detailViewTemplate = '';
5729
5730 if (Utils.hasDetailViewIcon(this.options)) {
5731 detailViewTemplate = '<td>';
5732
5733 if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
5734 detailViewTemplate += "\n <a class=\"detail-icon\" href=\"#\">\n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n </a>\n ");
5735 }
5736
5737 detailViewTemplate += '</td>';
5738 }
5739
5740 if (detailViewTemplate && this.options.detailViewAlign !== 'right') {
5741 html.push(detailViewTemplate);
5742 }
5743
5744 this.header.fields.forEach(function (field, j) {
5745 var text = '';
5746 var value_ = Utils.getItemField(item, field, _this7.options.escape);
5747 var value = '';
5748 var type = '';
5749 var cellStyle = {};
5750 var id_ = '';
5751 var class_ = _this7.header.classes[j];
5752 var style_ = '';
5753 var styleToAdd_ = '';
5754 var data_ = '';
5755 var rowspan_ = '';
5756 var colspan_ = '';
5757 var title_ = '';
5758 var column = _this7.columns[j];
5759
5760 if ((_this7.fromHtml || _this7.autoMergeCells) && typeof value_ === 'undefined') {
5761 if (!column.checkbox && !column.radio) {
5762 return;
5763 }
5764 }
5765
5766 if (!column.visible) {
5767 return;
5768 }
5769
5770 if (_this7.options.cardView && !column.cardVisible) {
5771 return;
5772 }
5773
5774 if (column.escape) {
5775 value_ = Utils.escapeHTML(value_);
5776 } // Style concat
5777
5778
5779 if (csses.concat([_this7.header.styles[j]]).length) {
5780 styleToAdd_ += "".concat(csses.concat([_this7.header.styles[j]]).join('; '));
5781 }
5782
5783 if (item["_".concat(field, "_style")]) {
5784 styleToAdd_ += "".concat(item["_".concat(field, "_style")]);
5785 }
5786
5787 if (styleToAdd_) {
5788 style_ = " style=\"".concat(styleToAdd_, "\"");
5789 } // Style concat
5790 // handle id and class of td
5791
5792
5793 if (item["_".concat(field, "_id")]) {
5794 id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
5795 }
5796
5797 if (item["_".concat(field, "_class")]) {
5798 class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
5799 }
5800
5801 if (item["_".concat(field, "_rowspan")]) {
5802 rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
5803 }
5804
5805 if (item["_".concat(field, "_colspan")]) {
5806 colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
5807 }
5808
5809 if (item["_".concat(field, "_title")]) {
5810 title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
5811 }
5812
5813 cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
5814
5815 if (cellStyle.classes) {
5816 class_ = " class=\"".concat(cellStyle.classes, "\"");
5817 }
5818
5819 if (cellStyle.css) {
5820 var csses_ = [];
5821
5822 for (var _i10 = 0, _Object$entries9 = Object.entries(cellStyle.css); _i10 < _Object$entries9.length; _i10++) {
5823 var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2),
5824 _key3 = _Object$entries9$_i[0],
5825 _value2 = _Object$entries9$_i[1];
5826
5827 csses_.push("".concat(_key3, ": ").concat(_value2));
5828 }
5829
5830 style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
5831 }
5832
5833 value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
5834
5835 if (_this7.searchText !== '' && _this7.options.searchHighlight) {
5836 value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, _this7.searchText], value.replace(new RegExp('(' + _this7.searchText + ')', 'gim'), '<mark>$1</mark>'));
5837 }
5838
5839 if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
5840 for (var _i11 = 0, _Object$entries10 = Object.entries(item["_".concat(field, "_data")]); _i11 < _Object$entries10.length; _i11++) {
5841 var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2),
5842 _k = _Object$entries10$_i[0],
5843 _v = _Object$entries10$_i[1];
5844
5845 // ignore data-index
5846 if (_k === 'index') {
5847 return;
5848 }
5849
5850 data_ += " data-".concat(_k, "=\"").concat(_v, "\"");
5851 }
5852 }
5853
5854 if (column.checkbox || column.radio) {
5855 type = column.checkbox ? 'checkbox' : type;
5856 type = column.radio ? 'radio' : type;
5857 var c = column['class'] || '';
5858 var isChecked = Utils.isObject(value) && value.hasOwnProperty('checked') ? value.checked : (value === true || value_) && value !== false;
5859 var isDisabled = !column.checkboxEnabled || value && value.disabled;
5860 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('');
5861 item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
5862 } else {
5863 value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
5864
5865 if (_this7.options.cardView) {
5866 var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title\"".concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : '';
5867 text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value\">").concat(value, "</span></div>");
5868
5869 if (_this7.options.smartDisplay && value === '') {
5870 text = '<div class="card-view"></div>';
5871 }
5872 } else {
5873 text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>");
5874 }
5875 }
5876
5877 html.push(text);
5878 });
5879
5880 if (detailViewTemplate && this.options.detailViewAlign === 'right') {
5881 html.push(detailViewTemplate);
5882 }
5883
5884 if (this.options.cardView) {
5885 html.push('</div></td>');
5886 }
5887
5888 html.push('</tr>');
5889 return html.join('');
5890 }
5891 }, {
5892 key: "initBody",
5893 value: function initBody(fixedScroll) {
5894 var _this8 = this;
5895
5896 var data = this.getData();
5897 this.trigger('pre-body', data);
5898 this.$body = this.$el.find('>tbody');
5899
5900 if (!this.$body.length) {
5901 this.$body = $('<tbody></tbody>').appendTo(this.$el);
5902 } // Fix #389 Bootstrap-table-flatJSON is not working
5903
5904
5905 if (!this.options.pagination || this.options.sidePagination === 'server') {
5906 this.pageFrom = 1;
5907 this.pageTo = data.length;
5908 }
5909
5910 var rows = [];
5911 var trFragments = $(document.createDocumentFragment());
5912 var hasTr = false;
5913 this.autoMergeCells = Utils.checkAutoMergeCells(data.slice(this.pageFrom - 1, this.pageTo));
5914
5915 for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
5916 var item = data[i];
5917 var tr = this.initRow(item, i, data, trFragments);
5918 hasTr = hasTr || !!tr;
5919
5920 if (tr && typeof tr === 'string') {
5921 if (!this.options.virtualScroll) {
5922 trFragments.append(tr);
5923 } else {
5924 rows.push(tr);
5925 }
5926 }
5927 } // show no records
5928
5929
5930 if (!hasTr) {
5931 this.$body.html("<tr class=\"no-records-found\">".concat(Utils.sprintf('<td colspan="%s">%s</td>', this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options), this.options.formatNoMatches()), "</tr>"));
5932 } else {
5933 if (!this.options.virtualScroll) {
5934 this.$body.html(trFragments);
5935 } else {
5936 if (this.virtualScroll) {
5937 this.virtualScroll.destroy();
5938 }
5939
5940 this.virtualScroll = new VirtualScroll({
5941 rows: rows,
5942 fixedScroll: fixedScroll,
5943 scrollEl: this.$tableBody[0],
5944 contentEl: this.$body[0],
5945 itemHeight: this.options.virtualScrollItemHeight,
5946 callback: function callback() {
5947 _this8.fitHeader();
5948
5949 _this8.initBodyEvent();
5950 }
5951 });
5952 }
5953 }
5954
5955 if (!fixedScroll) {
5956 this.scrollTo(0);
5957 }
5958
5959 this.initBodyEvent();
5960 this.updateSelected();
5961 this.initFooter();
5962 this.resetView();
5963
5964 if (this.options.sidePagination !== 'server') {
5965 this.options.totalRows = data.length;
5966 }
5967
5968 this.trigger('post-body', data);
5969 }
5970 }, {
5971 key: "initBodyEvent",
5972 value: function initBodyEvent() {
5973 var _this9 = this;
5974
5975 // click to select by column
5976 this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
5977 var $td = $(e.currentTarget);
5978 var $tr = $td.parent();
5979 var $cardViewArr = $(e.target).parents('.card-views').children();
5980 var $cardViewTarget = $(e.target).parents('.card-view');
5981 var rowIndex = $tr.data('index');
5982 var item = _this9.data[rowIndex];
5983 var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
5984
5985 var fields = _this9.getVisibleFields();
5986
5987 var field = fields[index - Utils.getDetailViewIndexOffset(_this9.options)];
5988 var column = _this9.columns[_this9.fieldsColumnsIndex[field]];
5989 var value = Utils.getItemField(item, field, _this9.options.escape);
5990
5991 if ($td.find('.detail-icon').length) {
5992 return;
5993 }
5994
5995 _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
5996
5997 _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
5998
5999
6000 if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) {
6001 var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName));
6002
6003 if ($selectItem.length) {
6004 $selectItem[0].click();
6005 }
6006 }
6007
6008 if (e.type === 'click' && _this9.options.detailViewByClick) {
6009 _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]);
6010 }
6011 }).off('mousedown').on('mousedown', function (e) {
6012 // https://github.com/jquery/jquery/issues/1741
6013 _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
6014 _this9.multipleSelectRowShiftKey = e.shiftKey;
6015 });
6016 this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
6017 e.preventDefault();
6018
6019 _this9.toggleDetailView($(e.currentTarget).parent().parent().data('index'));
6020
6021 return false;
6022 });
6023 this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName));
6024 this.$selectItem.off('click').on('click', function (e) {
6025 e.stopImmediatePropagation();
6026 var $this = $(e.currentTarget);
6027
6028 _this9._toggleCheck($this.prop('checked'), $this.data('index'));
6029 });
6030 this.header.events.forEach(function (_events, i) {
6031 var events = _events;
6032
6033 if (!events) {
6034 return;
6035 } // fix bug, if events is defined with namespace
6036
6037
6038 if (typeof events === 'string') {
6039 events = Utils.calculateObjectValue(null, events);
6040 }
6041
6042 var field = _this9.header.fields[i];
6043
6044 var fieldIndex = _this9.getVisibleFields().indexOf(field);
6045
6046 if (fieldIndex === -1) {
6047 return;
6048 }
6049
6050 fieldIndex += Utils.getDetailViewIndexOffset(_this9.options);
6051
6052 var _loop2 = function _loop2(key) {
6053 if (!events.hasOwnProperty(key)) {
6054 return "continue";
6055 }
6056
6057 var event = events[key];
6058
6059 _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
6060 var $tr = $(tr);
6061 var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
6062 var index = key.indexOf(' ');
6063 var name = key.substring(0, index);
6064 var el = key.substring(index + 1);
6065 $td.find(el).off(name).on(name, function (e) {
6066 var index = $tr.data('index');
6067 var row = _this9.data[index];
6068 var value = row[field];
6069 event.apply(_this9, [e, value, row, index]);
6070 });
6071 });
6072 };
6073
6074 for (var key in events) {
6075 var _ret2 = _loop2(key);
6076
6077 if (_ret2 === "continue") continue;
6078 }
6079 });
6080 }
6081 }, {
6082 key: "initServer",
6083 value: function initServer(silent, query, url) {
6084 var _this10 = this;
6085
6086 var data = {};
6087 var index = this.header.fields.indexOf(this.options.sortName);
6088 var params = {
6089 searchText: this.searchText,
6090 sortName: this.options.sortName,
6091 sortOrder: this.options.sortOrder
6092 };
6093
6094 if (this.header.sortNames[index]) {
6095 params.sortName = this.header.sortNames[index];
6096 }
6097
6098 if (this.options.pagination && this.options.sidePagination === 'server') {
6099 params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
6100 params.pageNumber = this.options.pageNumber;
6101 }
6102
6103 if (!(url || this.options.url) && !this.options.ajax) {
6104 return;
6105 }
6106
6107 if (this.options.queryParamsType === 'limit') {
6108 params = {
6109 search: params.searchText,
6110 sort: params.sortName,
6111 order: params.sortOrder
6112 };
6113
6114 if (this.options.pagination && this.options.sidePagination === 'server') {
6115 params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
6116 params.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
6117
6118 if (params.limit === 0) {
6119 delete params.limit;
6120 }
6121 }
6122 }
6123
6124 if (this.options.search && this.options.sidePagination === 'server' && this.columns.filter(function (column) {
6125 return !column.searchable;
6126 }).length) {
6127 params.searchable = [];
6128 var _iteratorNormalCompletion2 = true;
6129 var _didIteratorError2 = false;
6130 var _iteratorError2 = undefined;
6131
6132 try {
6133 for (var _iterator2 = this.columns[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
6134 var column = _step2.value;
6135
6136 if (!column.checkbox && column.searchable && (this.options.visibleSearch && column.visible || !this.options.visibleSearch)) {
6137 params.searchable.push(column.field);
6138 }
6139 }
6140 } catch (err) {
6141 _didIteratorError2 = true;
6142 _iteratorError2 = err;
6143 } finally {
6144 try {
6145 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
6146 _iterator2.return();
6147 }
6148 } finally {
6149 if (_didIteratorError2) {
6150 throw _iteratorError2;
6151 }
6152 }
6153 }
6154 }
6155
6156 if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
6157 params.filter = JSON.stringify(this.filterColumnsPartial, null);
6158 }
6159
6160 $.extend(params, query || {});
6161 data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request
6162
6163 if (data === false) {
6164 return;
6165 }
6166
6167 if (!silent) {
6168 this.showLoading();
6169 }
6170
6171 var request = $.extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
6172 type: this.options.method,
6173 url: url || this.options.url,
6174 data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
6175 cache: this.options.cache,
6176 contentType: this.options.contentType,
6177 dataType: this.options.dataType,
6178 success: function success(_res, textStatus, jqXHR) {
6179 var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res);
6180
6181 _this10.load(res);
6182
6183 _this10.trigger('load-success', res, jqXHR && jqXHR.status, jqXHR);
6184
6185 if (!silent) {
6186 _this10.hideLoading();
6187 }
6188
6189 if (_this10.options.sidePagination === 'server' && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) {
6190 _this10.updatePagination();
6191 }
6192 },
6193 error: function error(jqXHR) {
6194 var data = [];
6195
6196 if (_this10.options.sidePagination === 'server') {
6197 data = {};
6198 data[_this10.options.totalField] = 0;
6199 data[_this10.options.dataField] = [];
6200 }
6201
6202 _this10.load(data);
6203
6204 _this10.trigger('load-error', jqXHR && jqXHR.status, jqXHR);
6205
6206 if (!silent) _this10.$tableLoading.hide();
6207 }
6208 });
6209
6210 if (this.options.ajax) {
6211 Utils.calculateObjectValue(this, this.options.ajax, [request], null);
6212 } else {
6213 if (this._xhr && this._xhr.readyState !== 4) {
6214 this._xhr.abort();
6215 }
6216
6217 this._xhr = $.ajax(request);
6218 }
6219
6220 return data;
6221 }
6222 }, {
6223 key: "initSearchText",
6224 value: function initSearchText() {
6225 if (this.options.search) {
6226 this.searchText = '';
6227
6228 if (this.options.searchText !== '') {
6229 var $search = Utils.getSearchInput(this);
6230 $search.val(this.options.searchText);
6231 this.onSearch({
6232 currentTarget: $search,
6233 firedByInitSearchText: true
6234 });
6235 }
6236 }
6237 }
6238 }, {
6239 key: "getCaret",
6240 value: function getCaret() {
6241 var _this11 = this;
6242
6243 this.$header.find('th').each(function (i, th) {
6244 $(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both');
6245 });
6246 }
6247 }, {
6248 key: "updateSelected",
6249 value: function updateSelected() {
6250 var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
6251 this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
6252 this.$selectItem.each(function (i, el) {
6253 $(el).closest('tr')[$(el).prop('checked') ? 'addClass' : 'removeClass']('selected');
6254 });
6255 }
6256 }, {
6257 key: "updateRows",
6258 value: function updateRows() {
6259 var _this12 = this;
6260
6261 this.$selectItem.each(function (i, el) {
6262 _this12.data[$(el).data('index')][_this12.header.stateField] = $(el).prop('checked');
6263 });
6264 }
6265 }, {
6266 key: "resetRows",
6267 value: function resetRows() {
6268 var _iteratorNormalCompletion3 = true;
6269 var _didIteratorError3 = false;
6270 var _iteratorError3 = undefined;
6271
6272 try {
6273 for (var _iterator3 = this.data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
6274 var row = _step3.value;
6275 this.$selectAll.prop('checked', false);
6276 this.$selectItem.prop('checked', false);
6277
6278 if (this.header.stateField) {
6279 row[this.header.stateField] = false;
6280 }
6281 }
6282 } catch (err) {
6283 _didIteratorError3 = true;
6284 _iteratorError3 = err;
6285 } finally {
6286 try {
6287 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
6288 _iterator3.return();
6289 }
6290 } finally {
6291 if (_didIteratorError3) {
6292 throw _iteratorError3;
6293 }
6294 }
6295 }
6296
6297 this.initHiddenRows();
6298 }
6299 }, {
6300 key: "trigger",
6301 value: function trigger(_name) {
6302 var _this$options, _this$options2;
6303
6304 var name = "".concat(_name, ".bs.table");
6305
6306 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key4 = 1; _key4 < _len; _key4++) {
6307 args[_key4 - 1] = arguments[_key4];
6308 }
6309
6310 (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, [].concat(args, [this]));
6311
6312 this.$el.trigger($.Event(name, {
6313 sender: this
6314 }), args);
6315
6316 (_this$options2 = this.options).onAll.apply(_this$options2, [name].concat([].concat(args, [this])));
6317
6318 this.$el.trigger($.Event('all.bs.table', {
6319 sender: this
6320 }), [name, args]);
6321 }
6322 }, {
6323 key: "resetHeader",
6324 value: function resetHeader() {
6325 var _this13 = this;
6326
6327 // fix #61: the hidden table reset header bug.
6328 // fix bug: get $el.css('width') error sometime (height = 500)
6329 clearTimeout(this.timeoutId_);
6330 this.timeoutId_ = setTimeout(function () {
6331 return _this13.fitHeader();
6332 }, this.$el.is(':hidden') ? 100 : 0);
6333 }
6334 }, {
6335 key: "fitHeader",
6336 value: function fitHeader() {
6337 var _this14 = this;
6338
6339 if (this.$el.is(':hidden')) {
6340 this.timeoutId_ = setTimeout(function () {
6341 return _this14.fitHeader();
6342 }, 100);
6343 return;
6344 }
6345
6346 var fixedBody = this.$tableBody.get(0);
6347 var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
6348 this.$el.css('margin-top', -this.$header.outerHeight());
6349 var focused = $(':focus');
6350
6351 if (focused.length > 0) {
6352 var $th = focused.parents('th');
6353
6354 if ($th.length > 0) {
6355 var dataField = $th.attr('data-field');
6356
6357 if (dataField !== undefined) {
6358 var $headerTh = this.$header.find("[data-field='".concat(dataField, "']"));
6359
6360 if ($headerTh.length > 0) {
6361 $headerTh.find(':input').addClass('focus-temp');
6362 }
6363 }
6364 }
6365 }
6366
6367 this.$header_ = this.$header.clone(true, true);
6368 this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
6369 this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_);
6370 this.$tableLoading.css('width', this.$el.outerWidth());
6371 var focusedTemp = $('.focus-temp:visible:eq(0)');
6372
6373 if (focusedTemp.length > 0) {
6374 focusedTemp.focus();
6375 this.$header.find('.focus-temp').removeClass('focus-temp');
6376 } // fix bug: $.data() is not working as expected after $.append()
6377
6378
6379 this.$header.find('th[data-field]').each(function (i, el) {
6380 _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $(el).data('field'))).data($(el).data());
6381 });
6382 var visibleFields = this.getVisibleFields();
6383 var $ths = this.$header_.find('th');
6384 var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0);
6385
6386 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
6387 $tr = $tr.next();
6388 }
6389
6390 var trLength = $tr.find('> *').length;
6391 $tr.find('> *').each(function (i, el) {
6392 var $this = $(el);
6393
6394 if (Utils.hasDetailViewIcon(_this14.options)) {
6395 if (i === 0 && _this14.options.detailViewAlign !== 'right' || i === trLength - 1 && _this14.options.detailViewAlign === 'right') {
6396 var $thDetail = $ths.filter('.detail');
6397
6398 var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
6399
6400 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth);
6401 return;
6402 }
6403 }
6404
6405 var index = i - Utils.getDetailViewIndexOffset(_this14.options);
6406
6407 var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
6408
6409 if ($th.length > 1) {
6410 $th = $($ths[$this[0].cellIndex]);
6411 }
6412
6413 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
6414 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
6415 });
6416 this.horizontalScroll();
6417 this.trigger('post-header');
6418 }
6419 }, {
6420 key: "initFooter",
6421 value: function initFooter() {
6422 if (!this.options.showFooter || this.options.cardView) {
6423 // do nothing
6424 return;
6425 }
6426
6427 var data = this.getData();
6428 var html = [];
6429 var detailTemplate = '';
6430
6431 if (Utils.hasDetailViewIcon(this.options)) {
6432 detailTemplate = '<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>';
6433 }
6434
6435 if (detailTemplate && this.options.detailViewAlign !== 'right') {
6436 html.push(detailTemplate);
6437 }
6438
6439 var _iteratorNormalCompletion4 = true;
6440 var _didIteratorError4 = false;
6441 var _iteratorError4 = undefined;
6442
6443 try {
6444 for (var _iterator4 = this.columns[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
6445 var column = _step4.value;
6446 var falign = '';
6447 var valign = '';
6448 var csses = [];
6449 var style = {};
6450 var class_ = Utils.sprintf(' class="%s"', column['class']);
6451
6452 if (!column.visible || this.footerData && this.footerData.length > 0 && !(column.field in this.footerData[0])) {
6453 continue;
6454 }
6455
6456 if (this.options.cardView && !column.cardVisible) {
6457 return;
6458 }
6459
6460 falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
6461 valign = Utils.sprintf('vertical-align: %s; ', column.valign);
6462 style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
6463
6464 if (style && style.css) {
6465 for (var _i12 = 0, _Object$entries11 = Object.entries(style.css); _i12 < _Object$entries11.length; _i12++) {
6466 var _Object$entries11$_i = _slicedToArray(_Object$entries11[_i12], 2),
6467 key = _Object$entries11$_i[0],
6468 _value3 = _Object$entries11$_i[1];
6469
6470 csses.push("".concat(key, ": ").concat(_value3));
6471 }
6472 }
6473
6474 if (style && style.classes) {
6475 class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes);
6476 }
6477
6478 html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ')));
6479 var colspan = 0;
6480
6481 if (this.footerData && this.footerData.length > 0) {
6482 colspan = this.footerData[0]['_' + column.field + '_colspan'] || 0;
6483 }
6484
6485 if (colspan) {
6486 html.push(" colspan=\"".concat(colspan, "\" "));
6487 }
6488
6489 html.push('>');
6490 html.push('<div class="th-inner">');
6491 var value = '';
6492
6493 if (this.footerData && this.footerData.length > 0) {
6494 value = this.footerData[0][column.field] || '';
6495 }
6496
6497 html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data, value], value));
6498 html.push('</div>');
6499 html.push('<div class="fht-cell"></div>');
6500 html.push('</div>');
6501 html.push('</th>');
6502 }
6503 } catch (err) {
6504 _didIteratorError4 = true;
6505 _iteratorError4 = err;
6506 } finally {
6507 try {
6508 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
6509 _iterator4.return();
6510 }
6511 } finally {
6512 if (_didIteratorError4) {
6513 throw _iteratorError4;
6514 }
6515 }
6516 }
6517
6518 if (detailTemplate && this.options.detailViewAlign === 'right') {
6519 html.push(detailTemplate);
6520 }
6521
6522 if (!this.options.height && !this.$tableFooter.length) {
6523 this.$el.append('<tfoot><tr></tr></tfoot>');
6524 this.$tableFooter = this.$el.find('tfoot');
6525 }
6526
6527 this.$tableFooter.find('tr').html(html.join(''));
6528 this.trigger('post-footer', this.$tableFooter);
6529 }
6530 }, {
6531 key: "fitFooter",
6532 value: function fitFooter() {
6533 var _this15 = this;
6534
6535 if (this.$el.is(':hidden')) {
6536 setTimeout(function () {
6537 return _this15.fitFooter();
6538 }, 100);
6539 return;
6540 }
6541
6542 var fixedBody = this.$tableBody.get(0);
6543 var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
6544 this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
6545 var visibleFields = this.getVisibleFields();
6546 var $ths = this.$tableFooter.find('th');
6547 var $tr = this.$body.find('>tr:first-child:not(.no-records-found)');
6548 $ths.find('.fht-cell').width('auto');
6549
6550 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
6551 $tr = $tr.next();
6552 }
6553
6554 var trLength = $tr.find('> *').length;
6555 $tr.find('> *').each(function (i, el) {
6556 var $this = $(el);
6557
6558 if (Utils.hasDetailViewIcon(_this15.options)) {
6559 if (i === 0 && _this15.options.detailViewAlign === 'left' || i === trLength - 1 && _this15.options.detailViewAlign === 'right') {
6560 var $thDetail = $ths.filter('.detail');
6561
6562 var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
6563
6564 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2);
6565 return;
6566 }
6567 }
6568
6569 var $th = $ths.eq(i);
6570 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
6571 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
6572 });
6573 this.horizontalScroll();
6574 }
6575 }, {
6576 key: "horizontalScroll",
6577 value: function horizontalScroll() {
6578 var _this16 = this;
6579
6580 // horizontal scroll event
6581 // TODO: it's probably better improving the layout than binding to scroll event
6582 this.$tableBody.off('scroll').on('scroll', function () {
6583 var scrollLeft = _this16.$tableBody.scrollLeft();
6584
6585 if (_this16.options.showHeader && _this16.options.height) {
6586 _this16.$tableHeader.scrollLeft(scrollLeft);
6587 }
6588
6589 if (_this16.options.showFooter && !_this16.options.cardView) {
6590 _this16.$tableFooter.scrollLeft(scrollLeft);
6591 }
6592
6593 _this16.trigger('scroll-body', _this16.$tableBody);
6594 });
6595 }
6596 }, {
6597 key: "getVisibleFields",
6598 value: function getVisibleFields() {
6599 var visibleFields = [];
6600 var _iteratorNormalCompletion5 = true;
6601 var _didIteratorError5 = false;
6602 var _iteratorError5 = undefined;
6603
6604 try {
6605 for (var _iterator5 = this.header.fields[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
6606 var field = _step5.value;
6607 var column = this.columns[this.fieldsColumnsIndex[field]];
6608
6609 if (!column || !column.visible) {
6610 continue;
6611 }
6612
6613 visibleFields.push(field);
6614 }
6615 } catch (err) {
6616 _didIteratorError5 = true;
6617 _iteratorError5 = err;
6618 } finally {
6619 try {
6620 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
6621 _iterator5.return();
6622 }
6623 } finally {
6624 if (_didIteratorError5) {
6625 throw _iteratorError5;
6626 }
6627 }
6628 }
6629
6630 return visibleFields;
6631 }
6632 }, {
6633 key: "initHiddenRows",
6634 value: function initHiddenRows() {
6635 this.hiddenRows = [];
6636 } // PUBLIC FUNCTION DEFINITION
6637 // =======================
6638
6639 }, {
6640 key: "getOptions",
6641 value: function getOptions() {
6642 // deep copy and remove data
6643 var options = $.extend({}, this.options);
6644 delete options.data;
6645 return $.extend(true, {}, options);
6646 }
6647 }, {
6648 key: "refreshOptions",
6649 value: function refreshOptions(options) {
6650 // If the objects are equivalent then avoid the call of destroy / init methods
6651 if (Utils.compareObjects(this.options, options, true)) {
6652 return;
6653 }
6654
6655 this.options = $.extend(this.options, options);
6656 this.trigger('refresh-options', this.options);
6657 this.destroy();
6658 this.init();
6659 }
6660 }, {
6661 key: "getData",
6662 value: function getData(params) {
6663 var _this17 = this;
6664
6665 var data = this.options.data;
6666
6667 if ((this.searchText || this.options.customSearch || this.options.sortName !== undefined || !Utils.isEmptyObject(this.filterColumns) || !Utils.isEmptyObject(this.filterColumnsPartial)) && (!params || !params.unfiltered)) {
6668 data = this.data;
6669 }
6670
6671 if (params && params.useCurrentPage) {
6672 data = data.slice(this.pageFrom - 1, this.pageTo);
6673 }
6674
6675 if (params && !params.includeHiddenRows) {
6676 var hiddenRows = this.getHiddenRows();
6677 data = data.filter(function (row) {
6678 return Utils.findIndex(hiddenRows, row) === -1;
6679 });
6680 }
6681
6682 if (params && params.formatted) {
6683 data.forEach(function (row) {
6684 for (var _i13 = 0, _Object$entries12 = Object.entries(row); _i13 < _Object$entries12.length; _i13++) {
6685 var _Object$entries12$_i = _slicedToArray(_Object$entries12[_i13], 2),
6686 key = _Object$entries12$_i[0],
6687 value = _Object$entries12$_i[1];
6688
6689 var column = _this17.columns[_this17.fieldsColumnsIndex[key]];
6690
6691 if (!column) {
6692 return;
6693 }
6694
6695 row[key] = Utils.calculateObjectValue(column, _this17.header.formatters[column.fieldIndex], [value, row, row.index, column.field], value);
6696 }
6697 });
6698 }
6699
6700 return data;
6701 }
6702 }, {
6703 key: "getSelections",
6704 value: function getSelections() {
6705 var _this18 = this;
6706
6707 return this.options.data.filter(function (row) {
6708 return row[_this18.header.stateField] === true;
6709 });
6710 }
6711 }, {
6712 key: "load",
6713 value: function load(_data) {
6714 var fixedScroll = false;
6715 var data = _data; // #431: support pagination
6716
6717 if (this.options.pagination && this.options.sidePagination === 'server') {
6718 this.options.totalRows = data[this.options.totalField];
6719 this.options.totalNotFiltered = data[this.options.totalNotFilteredField];
6720 this.footerData = data[this.options.footerField] ? [data[this.options.footerField]] : undefined;
6721 }
6722
6723 fixedScroll = data.fixedScroll;
6724 data = Array.isArray(data) ? data : data[this.options.dataField];
6725 this.initData(data);
6726 this.initSearch();
6727 this.initPagination();
6728 this.initBody(fixedScroll);
6729 }
6730 }, {
6731 key: "append",
6732 value: function append(data) {
6733 this.initData(data, 'append');
6734 this.initSearch();
6735 this.initPagination();
6736 this.initSort();
6737 this.initBody(true);
6738 }
6739 }, {
6740 key: "prepend",
6741 value: function prepend(data) {
6742 this.initData(data, 'prepend');
6743 this.initSearch();
6744 this.initPagination();
6745 this.initSort();
6746 this.initBody(true);
6747 }
6748 }, {
6749 key: "remove",
6750 value: function remove(params) {
6751 var len = this.options.data.length;
6752 var i;
6753 var row;
6754
6755 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('values')) {
6756 return;
6757 }
6758
6759 for (i = len - 1; i >= 0; i--) {
6760 var exists = false;
6761 row = this.options.data[i];
6762
6763 if (!row.hasOwnProperty(params.field) && params.field !== '$index') {
6764 continue;
6765 } else if (!row.hasOwnProperty(params.field) && params.field === '$index') {
6766 exists = params.values.includes(i);
6767 } else {
6768 exists = params.values.includes(row[params.field]);
6769 }
6770
6771 if (exists) {
6772 this.options.data.splice(i, 1);
6773
6774 if (this.options.sidePagination === 'server') {
6775 this.options.totalRows -= 1;
6776 }
6777 }
6778 }
6779
6780 if (len === this.options.data.length) {
6781 return;
6782 }
6783
6784 this.initSearch();
6785 this.initPagination();
6786 this.initSort();
6787 this.initBody(true);
6788 }
6789 }, {
6790 key: "removeAll",
6791 value: function removeAll() {
6792 if (this.options.data.length > 0) {
6793 this.options.data.splice(0, this.options.data.length);
6794 this.initSearch();
6795 this.initPagination();
6796 this.initBody(true);
6797 }
6798 }
6799 }, {
6800 key: "insertRow",
6801 value: function insertRow(params) {
6802 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
6803 return;
6804 }
6805
6806 this.options.data.splice(params.index, 0, params.row);
6807 this.initSearch();
6808 this.initPagination();
6809 this.initSort();
6810 this.initBody(true);
6811 }
6812 }, {
6813 key: "updateRow",
6814 value: function updateRow(params) {
6815 var allParams = Array.isArray(params) ? params : [params];
6816 var _iteratorNormalCompletion6 = true;
6817 var _didIteratorError6 = false;
6818 var _iteratorError6 = undefined;
6819
6820 try {
6821 for (var _iterator6 = allParams[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
6822 var _params = _step6.value;
6823
6824 if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) {
6825 continue;
6826 }
6827
6828 if (_params.hasOwnProperty('replace') && _params.replace) {
6829 this.options.data[_params.index] = _params.row;
6830 } else {
6831 $.extend(this.options.data[_params.index], _params.row);
6832 }
6833 }
6834 } catch (err) {
6835 _didIteratorError6 = true;
6836 _iteratorError6 = err;
6837 } finally {
6838 try {
6839 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
6840 _iterator6.return();
6841 }
6842 } finally {
6843 if (_didIteratorError6) {
6844 throw _iteratorError6;
6845 }
6846 }
6847 }
6848
6849 this.initSearch();
6850 this.initPagination();
6851 this.initSort();
6852 this.initBody(true);
6853 }
6854 }, {
6855 key: "getRowByUniqueId",
6856 value: function getRowByUniqueId(_id) {
6857 var uniqueId = this.options.uniqueId;
6858 var len = this.options.data.length;
6859 var id = _id;
6860 var dataRow = null;
6861 var i;
6862 var row;
6863 var rowUniqueId;
6864
6865 for (i = len - 1; i >= 0; i--) {
6866 row = this.options.data[i];
6867
6868 if (row.hasOwnProperty(uniqueId)) {
6869 // uniqueId is a column
6870 rowUniqueId = row[uniqueId];
6871 } else if (row._data && row._data.hasOwnProperty(uniqueId)) {
6872 // uniqueId is a row data property
6873 rowUniqueId = row._data[uniqueId];
6874 } else {
6875 continue;
6876 }
6877
6878 if (typeof rowUniqueId === 'string') {
6879 id = id.toString();
6880 } else if (typeof rowUniqueId === 'number') {
6881 if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
6882 id = parseInt(id);
6883 } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
6884 id = parseFloat(id);
6885 }
6886 }
6887
6888 if (rowUniqueId === id) {
6889 dataRow = row;
6890 break;
6891 }
6892 }
6893
6894 return dataRow;
6895 }
6896 }, {
6897 key: "updateByUniqueId",
6898 value: function updateByUniqueId(params) {
6899 var allParams = Array.isArray(params) ? params : [params];
6900 var _iteratorNormalCompletion7 = true;
6901 var _didIteratorError7 = false;
6902 var _iteratorError7 = undefined;
6903
6904 try {
6905 for (var _iterator7 = allParams[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
6906 var _params2 = _step7.value;
6907
6908 if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) {
6909 continue;
6910 }
6911
6912 var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id));
6913
6914 if (rowId === -1) {
6915 continue;
6916 }
6917
6918 if (_params2.hasOwnProperty('replace') && _params2.replace) {
6919 this.options.data[rowId] = _params2.row;
6920 } else {
6921 $.extend(this.options.data[rowId], _params2.row);
6922 }
6923 }
6924 } catch (err) {
6925 _didIteratorError7 = true;
6926 _iteratorError7 = err;
6927 } finally {
6928 try {
6929 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
6930 _iterator7.return();
6931 }
6932 } finally {
6933 if (_didIteratorError7) {
6934 throw _iteratorError7;
6935 }
6936 }
6937 }
6938
6939 this.initSearch();
6940 this.initPagination();
6941 this.initSort();
6942 this.initBody(true);
6943 }
6944 }, {
6945 key: "removeByUniqueId",
6946 value: function removeByUniqueId(id) {
6947 var len = this.options.data.length;
6948 var row = this.getRowByUniqueId(id);
6949
6950 if (row) {
6951 this.options.data.splice(this.options.data.indexOf(row), 1);
6952 }
6953
6954 if (len === this.options.data.length) {
6955 return;
6956 }
6957
6958 this.initSearch();
6959 this.initPagination();
6960 this.initBody(true);
6961 }
6962 }, {
6963 key: "updateCell",
6964 value: function updateCell(params) {
6965 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
6966 return;
6967 }
6968
6969 this.data[params.index][params.field] = params.value;
6970
6971 if (params.reinit === false) {
6972 return;
6973 }
6974
6975 this.initSort();
6976 this.initBody(true);
6977 }
6978 }, {
6979 key: "updateCellByUniqueId",
6980 value: function updateCellByUniqueId(params) {
6981 var _this19 = this;
6982
6983 var allParams = Array.isArray(params) ? params : [params];
6984 allParams.forEach(function (_ref6) {
6985 var id = _ref6.id,
6986 field = _ref6.field,
6987 value = _ref6.value;
6988
6989 var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id));
6990
6991 if (rowId === -1) {
6992 return;
6993 }
6994
6995 _this19.options.data[rowId][field] = value;
6996 });
6997
6998 if (params.reinit === false) {
6999 return;
7000 }
7001
7002 this.initSort();
7003 this.initBody(true);
7004 }
7005 }, {
7006 key: "showRow",
7007 value: function showRow(params) {
7008 this._toggleRow(params, true);
7009 }
7010 }, {
7011 key: "hideRow",
7012 value: function hideRow(params) {
7013 this._toggleRow(params, false);
7014 }
7015 }, {
7016 key: "_toggleRow",
7017 value: function _toggleRow(params, visible) {
7018 var row;
7019
7020 if (params.hasOwnProperty('index')) {
7021 row = this.getData()[params.index];
7022 } else if (params.hasOwnProperty('uniqueId')) {
7023 row = this.getRowByUniqueId(params.uniqueId);
7024 }
7025
7026 if (!row) {
7027 return;
7028 }
7029
7030 var index = Utils.findIndex(this.hiddenRows, row);
7031
7032 if (!visible && index === -1) {
7033 this.hiddenRows.push(row);
7034 } else if (visible && index > -1) {
7035 this.hiddenRows.splice(index, 1);
7036 }
7037
7038 this.initBody(true);
7039 this.initPagination();
7040 }
7041 }, {
7042 key: "getHiddenRows",
7043 value: function getHiddenRows(show) {
7044 if (show) {
7045 this.initHiddenRows();
7046 this.initBody(true);
7047 this.initPagination();
7048 return;
7049 }
7050
7051 var data = this.getData();
7052 var rows = [];
7053 var _iteratorNormalCompletion8 = true;
7054 var _didIteratorError8 = false;
7055 var _iteratorError8 = undefined;
7056
7057 try {
7058 for (var _iterator8 = data[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
7059 var row = _step8.value;
7060
7061 if (this.hiddenRows.includes(row)) {
7062 rows.push(row);
7063 }
7064 }
7065 } catch (err) {
7066 _didIteratorError8 = true;
7067 _iteratorError8 = err;
7068 } finally {
7069 try {
7070 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
7071 _iterator8.return();
7072 }
7073 } finally {
7074 if (_didIteratorError8) {
7075 throw _iteratorError8;
7076 }
7077 }
7078 }
7079
7080 this.hiddenRows = rows;
7081 return rows;
7082 }
7083 }, {
7084 key: "showColumn",
7085 value: function showColumn(field) {
7086 var _this20 = this;
7087
7088 var fields = Array.isArray(field) ? field : [field];
7089 fields.forEach(function (field) {
7090 _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true);
7091 });
7092 }
7093 }, {
7094 key: "hideColumn",
7095 value: function hideColumn(field) {
7096 var _this21 = this;
7097
7098 var fields = Array.isArray(field) ? field : [field];
7099 fields.forEach(function (field) {
7100 _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true);
7101 });
7102 }
7103 }, {
7104 key: "_toggleColumn",
7105 value: function _toggleColumn(index, checked, needUpdate) {
7106 if (index === -1 || this.columns[index].visible === checked) {
7107 return;
7108 }
7109
7110 this.columns[index].visible = checked;
7111 this.initHeader();
7112 this.initSearch();
7113 this.initPagination();
7114 this.initBody();
7115
7116 if (this.options.showColumns) {
7117 var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false);
7118
7119 if (needUpdate) {
7120 $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked);
7121 }
7122
7123 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
7124 $items.filter(':checked').prop('disabled', true);
7125 }
7126 }
7127 }
7128 }, {
7129 key: "getVisibleColumns",
7130 value: function getVisibleColumns() {
7131 var _this22 = this;
7132
7133 return this.columns.filter(function (column) {
7134 return column.visible && !_this22.isSelectionColumn(column);
7135 });
7136 }
7137 }, {
7138 key: "getHiddenColumns",
7139 value: function getHiddenColumns() {
7140 return this.columns.filter(function (_ref7) {
7141 var visible = _ref7.visible;
7142 return !visible;
7143 });
7144 }
7145 }, {
7146 key: "isSelectionColumn",
7147 value: function isSelectionColumn(column) {
7148 return column.radio || column.checkbox;
7149 }
7150 }, {
7151 key: "showAllColumns",
7152 value: function showAllColumns() {
7153 this._toggleAllColumns(true);
7154 }
7155 }, {
7156 key: "hideAllColumns",
7157 value: function hideAllColumns() {
7158 this._toggleAllColumns(false);
7159 }
7160 }, {
7161 key: "_toggleAllColumns",
7162 value: function _toggleAllColumns(visible) {
7163 var _this23 = this;
7164
7165 var _iteratorNormalCompletion9 = true;
7166 var _didIteratorError9 = false;
7167 var _iteratorError9 = undefined;
7168
7169 try {
7170 for (var _iterator9 = this.columns.slice().reverse()[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
7171 var column = _step9.value;
7172
7173 if (column.switchable) {
7174 if (!visible && this.options.showColumns && this.getVisibleColumns().length === this.options.minimumCountColumns) {
7175 continue;
7176 }
7177
7178 column.visible = visible;
7179 }
7180 }
7181 } catch (err) {
7182 _didIteratorError9 = true;
7183 _iteratorError9 = err;
7184 } finally {
7185 try {
7186 if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
7187 _iterator9.return();
7188 }
7189 } finally {
7190 if (_didIteratorError9) {
7191 throw _iteratorError9;
7192 }
7193 }
7194 }
7195
7196 this.initHeader();
7197 this.initSearch();
7198 this.initPagination();
7199 this.initBody();
7200
7201 if (this.options.showColumns) {
7202 var $items = this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop('disabled', false);
7203
7204 if (visible) {
7205 $items.prop('checked', visible);
7206 } else {
7207 $items.get().reverse().forEach(function (item) {
7208 if ($items.filter(':checked').length > _this23.options.minimumCountColumns) {
7209 $(item).prop('checked', visible);
7210 }
7211 });
7212 }
7213
7214 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
7215 $items.filter(':checked').prop('disabled', true);
7216 }
7217 }
7218 }
7219 }, {
7220 key: "mergeCells",
7221 value: function mergeCells(options) {
7222 var row = options.index;
7223 var col = this.getVisibleFields().indexOf(options.field);
7224 var rowspan = options.rowspan || 1;
7225 var colspan = options.colspan || 1;
7226 var i;
7227 var j;
7228 var $tr = this.$body.find('>tr');
7229 col += Utils.getDetailViewIndexOffset(this.options);
7230 var $td = $tr.eq(row).find('>td').eq(col);
7231
7232 if (row < 0 || col < 0 || row >= this.data.length) {
7233 return;
7234 }
7235
7236 for (i = row; i < row + rowspan; i++) {
7237 for (j = col; j < col + colspan; j++) {
7238 $tr.eq(i).find('>td').eq(j).hide();
7239 }
7240 }
7241
7242 $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
7243 }
7244 }, {
7245 key: "checkAll",
7246 value: function checkAll() {
7247 this._toggleCheckAll(true);
7248 }
7249 }, {
7250 key: "uncheckAll",
7251 value: function uncheckAll() {
7252 this._toggleCheckAll(false);
7253 }
7254 }, {
7255 key: "_toggleCheckAll",
7256 value: function _toggleCheckAll(checked) {
7257 var rowsBefore = this.getSelections();
7258 this.$selectAll.add(this.$selectAll_).prop('checked', checked);
7259 this.$selectItem.filter(':enabled').prop('checked', checked);
7260 this.updateRows();
7261 this.updateSelected();
7262 var rowsAfter = this.getSelections();
7263
7264 if (checked) {
7265 this.trigger('check-all', rowsAfter, rowsBefore);
7266 return;
7267 }
7268
7269 this.trigger('uncheck-all', rowsAfter, rowsBefore);
7270 }
7271 }, {
7272 key: "checkInvert",
7273 value: function checkInvert() {
7274 var $items = this.$selectItem.filter(':enabled');
7275 var checked = $items.filter(':checked');
7276 $items.each(function (i, el) {
7277 $(el).prop('checked', !$(el).prop('checked'));
7278 });
7279 this.updateRows();
7280 this.updateSelected();
7281 this.trigger('uncheck-some', checked);
7282 checked = this.getSelections();
7283 this.trigger('check-some', checked);
7284 }
7285 }, {
7286 key: "check",
7287 value: function check(index) {
7288 this._toggleCheck(true, index);
7289 }
7290 }, {
7291 key: "uncheck",
7292 value: function uncheck(index) {
7293 this._toggleCheck(false, index);
7294 }
7295 }, {
7296 key: "_toggleCheck",
7297 value: function _toggleCheck(checked, index) {
7298 var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]"));
7299 var row = this.options.data[index];
7300
7301 if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
7302 var _iteratorNormalCompletion10 = true;
7303 var _didIteratorError10 = false;
7304 var _iteratorError10 = undefined;
7305
7306 try {
7307 for (var _iterator10 = this.options.data[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
7308 var r = _step10.value;
7309 r[this.header.stateField] = false;
7310 }
7311 } catch (err) {
7312 _didIteratorError10 = true;
7313 _iteratorError10 = err;
7314 } finally {
7315 try {
7316 if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
7317 _iterator10.return();
7318 }
7319 } finally {
7320 if (_didIteratorError10) {
7321 throw _iteratorError10;
7322 }
7323 }
7324 }
7325
7326 this.$selectItem.filter(':checked').not($el).prop('checked', false);
7327 }
7328
7329 row[this.header.stateField] = checked;
7330
7331 if (this.options.multipleSelectRow) {
7332 if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) {
7333 var indexes = [this.multipleSelectRowLastSelectedIndex, index].sort();
7334
7335 for (var i = indexes[0] + 1; i < indexes[1]; i++) {
7336 this.data[i][this.header.stateField] = true;
7337 this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true);
7338 }
7339 }
7340
7341 this.multipleSelectRowCtrlKey = false;
7342 this.multipleSelectRowShiftKey = false;
7343 this.multipleSelectRowLastSelectedIndex = checked ? index : -1;
7344 }
7345
7346 $el.prop('checked', checked);
7347 this.updateSelected();
7348 this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
7349 }
7350 }, {
7351 key: "checkBy",
7352 value: function checkBy(obj) {
7353 this._toggleCheckBy(true, obj);
7354 }
7355 }, {
7356 key: "uncheckBy",
7357 value: function uncheckBy(obj) {
7358 this._toggleCheckBy(false, obj);
7359 }
7360 }, {
7361 key: "_toggleCheckBy",
7362 value: function _toggleCheckBy(checked, obj) {
7363 var _this24 = this;
7364
7365 if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
7366 return;
7367 }
7368
7369 var rows = [];
7370 this.data.forEach(function (row, i) {
7371 if (!row.hasOwnProperty(obj.field)) {
7372 return false;
7373 }
7374
7375 if (obj.values.includes(row[obj.field])) {
7376 var $el = _this24.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
7377
7378 $el = checked ? $el.not(':checked') : $el.filter(':checked');
7379
7380 if (!$el.length) {
7381 return;
7382 }
7383
7384 $el.prop('checked', checked);
7385 row[_this24.header.stateField] = checked;
7386 rows.push(row);
7387
7388 _this24.trigger(checked ? 'check' : 'uncheck', row, $el);
7389 }
7390 });
7391 this.updateSelected();
7392 this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
7393 }
7394 }, {
7395 key: "refresh",
7396 value: function refresh(params) {
7397 if (params && params.url) {
7398 this.options.url = params.url;
7399 }
7400
7401 if (params && params.pageNumber) {
7402 this.options.pageNumber = params.pageNumber;
7403 }
7404
7405 if (params && params.pageSize) {
7406 this.options.pageSize = params.pageSize;
7407 }
7408
7409 this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url));
7410 }
7411 }, {
7412 key: "destroy",
7413 value: function destroy() {
7414 this.$el.insertBefore(this.$container);
7415 $(this.options.toolbar).insertBefore(this.$el);
7416 this.$container.next().remove();
7417 this.$container.remove();
7418 this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class
7419 }
7420 }, {
7421 key: "resetView",
7422 value: function resetView(params) {
7423 var padding = 0;
7424
7425 if (params && params.height) {
7426 this.options.height = params.height;
7427 }
7428
7429 this.$selectAll.prop('checked', this.$selectItem.length > 0 && this.$selectItem.length === this.$selectItem.filter(':checked').length);
7430 this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
7431
7432 if (!this.options.cardView && this.options.showHeader && this.options.height) {
7433 this.$tableHeader.show();
7434 this.resetHeader();
7435 padding += this.$header.outerHeight(true) + 1;
7436 } else {
7437 this.$tableHeader.hide();
7438 this.trigger('post-header');
7439 }
7440
7441 if (!this.options.cardView && this.options.showFooter) {
7442 this.$tableFooter.show();
7443 this.fitFooter();
7444
7445 if (this.options.height) {
7446 padding += this.$tableFooter.outerHeight(true);
7447 }
7448 }
7449
7450 if (this.$container.hasClass('fullscreen')) {
7451 this.$tableContainer.css('height', '');
7452 this.$tableContainer.css('width', '');
7453 } else if (this.options.height) {
7454 if (this.$tableBorder) {
7455 this.$tableBorder.css('width', '');
7456 this.$tableBorder.css('height', '');
7457 }
7458
7459 var toolbarHeight = this.$toolbar.outerHeight(true);
7460 var paginationHeight = this.$pagination.outerHeight(true);
7461 var height = this.options.height - toolbarHeight - paginationHeight;
7462 var $bodyTable = this.$tableBody.find('>table');
7463 var tableHeight = $bodyTable.outerHeight();
7464 this.$tableContainer.css('height', "".concat(height, "px"));
7465
7466 if (this.$tableBorder && $bodyTable.is(':visible')) {
7467 var tableBorderHeight = height - tableHeight - 2;
7468
7469 if (this.$tableBody[0].scrollWidth - this.$tableBody.innerWidth()) {
7470 tableBorderHeight -= Utils.getScrollBarWidth();
7471 }
7472
7473 this.$tableBorder.css('width', "".concat($bodyTable.outerWidth(), "px"));
7474 this.$tableBorder.css('height', "".concat(tableBorderHeight, "px"));
7475 }
7476 }
7477
7478 if (this.options.cardView) {
7479 // remove the element css
7480 this.$el.css('margin-top', '0');
7481 this.$tableContainer.css('padding-bottom', '0');
7482 this.$tableFooter.hide();
7483 } else {
7484 // Assign the correct sortable arrow
7485 this.getCaret();
7486 this.$tableContainer.css('padding-bottom', "".concat(padding, "px"));
7487 }
7488
7489 this.trigger('reset-view');
7490 }
7491 }, {
7492 key: "showLoading",
7493 value: function showLoading() {
7494 this.$tableLoading.toggleClass('open', true);
7495 var fontSize = this.options.loadingFontSize;
7496
7497 if (this.options.loadingFontSize === 'auto') {
7498 fontSize = this.$tableLoading.width() * 0.04;
7499 fontSize = Math.max(12, fontSize);
7500 fontSize = Math.min(32, fontSize);
7501 fontSize = "".concat(fontSize, "px");
7502 }
7503
7504 this.$tableLoading.find('.loading-text').css('font-size', fontSize);
7505 }
7506 }, {
7507 key: "hideLoading",
7508 value: function hideLoading() {
7509 this.$tableLoading.toggleClass('open', false);
7510 }
7511 }, {
7512 key: "togglePagination",
7513 value: function togglePagination() {
7514 this.options.pagination = !this.options.pagination;
7515 var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
7516 var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
7517 this.$toolbar.find('button[name="paginationSwitch"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
7518 this.updatePagination();
7519 }
7520 }, {
7521 key: "toggleFullscreen",
7522 value: function toggleFullscreen() {
7523 this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
7524 this.resetView();
7525 }
7526 }, {
7527 key: "toggleView",
7528 value: function toggleView() {
7529 this.options.cardView = !this.options.cardView;
7530 this.initHeader();
7531 var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : '';
7532 var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : '';
7533 this.$toolbar.find('button[name="toggle"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
7534 this.initBody();
7535 this.trigger('toggle', this.options.cardView);
7536 }
7537 }, {
7538 key: "resetSearch",
7539 value: function resetSearch(text) {
7540 var $search = Utils.getSearchInput(this);
7541 $search.val(text || '');
7542 this.onSearch({
7543 currentTarget: $search
7544 });
7545 }
7546 }, {
7547 key: "filterBy",
7548 value: function filterBy(columns, options) {
7549 this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $.extend(this.options.filterOptions, options);
7550 this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns;
7551 this.options.pageNumber = 1;
7552 this.initSearch();
7553 this.updatePagination();
7554 }
7555 }, {
7556 key: "scrollTo",
7557 value: function scrollTo(params) {
7558 var options = {
7559 unit: 'px',
7560 value: 0
7561 };
7562
7563 if (_typeof(params) === 'object') {
7564 options = Object.assign(options, params);
7565 } else if (typeof params === 'string' && params === 'bottom') {
7566 options.value = this.$tableBody[0].scrollHeight;
7567 } else if (typeof params === 'string' || typeof params === 'number') {
7568 options.value = params;
7569 }
7570
7571 var scrollTo = options.value;
7572
7573 if (options.unit === 'rows') {
7574 scrollTo = 0;
7575 this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
7576 scrollTo += $(el).outerHeight(true);
7577 });
7578 }
7579
7580 this.$tableBody.scrollTop(scrollTo);
7581 }
7582 }, {
7583 key: "getScrollPosition",
7584 value: function getScrollPosition() {
7585 return this.$tableBody.scrollTop();
7586 }
7587 }, {
7588 key: "selectPage",
7589 value: function selectPage(page) {
7590 if (page > 0 && page <= this.options.totalPages) {
7591 this.options.pageNumber = page;
7592 this.updatePagination();
7593 }
7594 }
7595 }, {
7596 key: "prevPage",
7597 value: function prevPage() {
7598 if (this.options.pageNumber > 1) {
7599 this.options.pageNumber--;
7600 this.updatePagination();
7601 }
7602 }
7603 }, {
7604 key: "nextPage",
7605 value: function nextPage() {
7606 if (this.options.pageNumber < this.options.totalPages) {
7607 this.options.pageNumber++;
7608 this.updatePagination();
7609 }
7610 }
7611 }, {
7612 key: "toggleDetailView",
7613 value: function toggleDetailView(index, _columnDetailFormatter) {
7614 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index));
7615
7616 if ($tr.next().is('tr.detail-view')) {
7617 this.collapseRow(index);
7618 } else {
7619 this.expandRow(index, _columnDetailFormatter);
7620 }
7621
7622 this.resetView();
7623 }
7624 }, {
7625 key: "expandRow",
7626 value: function expandRow(index, _columnDetailFormatter) {
7627 var row = this.data[index];
7628 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
7629
7630 if ($tr.next().is('tr.detail-view')) {
7631 return;
7632 }
7633
7634 if (this.options.detailViewIcon) {
7635 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
7636 }
7637
7638 $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
7639 var $element = $tr.next().find('td');
7640 var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;
7641 var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], '');
7642
7643 if ($element.length === 1) {
7644 $element.append(content);
7645 }
7646
7647 this.trigger('expand-row', index, row, $element);
7648 }
7649 }, {
7650 key: "expandRowByUniqueId",
7651 value: function expandRowByUniqueId(uniqueId) {
7652 var row = this.getRowByUniqueId(uniqueId);
7653
7654 if (!row) {
7655 return;
7656 }
7657
7658 this.expandRow(this.data.indexOf(row));
7659 }
7660 }, {
7661 key: "collapseRow",
7662 value: function collapseRow(index) {
7663 var row = this.data[index];
7664 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
7665
7666 if (!$tr.next().is('tr.detail-view')) {
7667 return;
7668 }
7669
7670 if (this.options.detailViewIcon) {
7671 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen));
7672 }
7673
7674 this.trigger('collapse-row', index, row, $tr.next());
7675 $tr.next().remove();
7676 }
7677 }, {
7678 key: "collapseRowByUniqueId",
7679 value: function collapseRowByUniqueId(uniqueId) {
7680 var row = this.getRowByUniqueId(uniqueId);
7681
7682 if (!row) {
7683 return;
7684 }
7685
7686 this.collapseRow(this.data.indexOf(row));
7687 }
7688 }, {
7689 key: "expandAllRows",
7690 value: function expandAllRows() {
7691 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
7692
7693 for (var i = 0; i < trs.length; i++) {
7694 this.expandRow($(trs[i]).data('index'));
7695 }
7696 }
7697 }, {
7698 key: "collapseAllRows",
7699 value: function collapseAllRows() {
7700 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
7701
7702 for (var i = 0; i < trs.length; i++) {
7703 this.collapseRow($(trs[i]).data('index'));
7704 }
7705 }
7706 }, {
7707 key: "updateColumnTitle",
7708 value: function updateColumnTitle(params) {
7709 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) {
7710 return;
7711 }
7712
7713 this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title;
7714
7715 if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
7716 var header = this.options.height !== undefined ? this.$tableHeader : this.$header;
7717 header.find('th[data-field]').each(function (i, el) {
7718 if ($(el).data('field') === params.field) {
7719 $($(el).find('.th-inner')[0]).text(params.title);
7720 return false;
7721 }
7722 });
7723 }
7724 }
7725 }, {
7726 key: "updateFormatText",
7727 value: function updateFormatText(formatName, text) {
7728 if (!/^format/.test(formatName) || !this.options[formatName]) {
7729 return;
7730 }
7731
7732 if (typeof text === 'string') {
7733 this.options[formatName] = function () {
7734 return text;
7735 };
7736 } else if (typeof text === 'function') {
7737 this.options[formatName] = text;
7738 }
7739
7740 this.initToolbar();
7741 this.initPagination();
7742 this.initBody();
7743 }
7744 }]);
7745
7746 return BootstrapTable;
7747 }();
7748
7749 BootstrapTable.VERSION = Constants.VERSION;
7750 BootstrapTable.DEFAULTS = Constants.DEFAULTS;
7751 BootstrapTable.LOCALES = Constants.LOCALES;
7752 BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS;
7753 BootstrapTable.METHODS = Constants.METHODS;
7754 BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION
7755 // =======================
7756
7757 $.BootstrapTable = BootstrapTable;
7758
7759 $.fn.bootstrapTable = function (option) {
7760 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key5 = 1; _key5 < _len2; _key5++) {
7761 args[_key5 - 1] = arguments[_key5];
7762 }
7763
7764 var value;
7765 this.each(function (i, el) {
7766 var data = $(el).data('bootstrap.table');
7767 var options = $.extend({}, BootstrapTable.DEFAULTS, $(el).data(), _typeof(option) === 'object' && option);
7768
7769 if (typeof option === 'string') {
7770 var _data2;
7771
7772 if (!Constants.METHODS.includes(option)) {
7773 throw new Error("Unknown method: ".concat(option));
7774 }
7775
7776 if (!data) {
7777 return;
7778 }
7779
7780 value = (_data2 = data)[option].apply(_data2, args);
7781
7782 if (option === 'destroy') {
7783 $(el).removeData('bootstrap.table');
7784 }
7785 }
7786
7787 if (!data) {
7788 data = new $.BootstrapTable(el, options);
7789 $(el).data('bootstrap.table', data);
7790 data.init();
7791 }
7792 });
7793 return typeof value === 'undefined' ? this : value;
7794 };
7795
7796 $.fn.bootstrapTable.Constructor = BootstrapTable;
7797 $.fn.bootstrapTable.theme = Constants.THEME;
7798 $.fn.bootstrapTable.VERSION = Constants.VERSION;
7799 $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
7800 $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
7801 $.fn.bootstrapTable.events = BootstrapTable.EVENTS;
7802 $.fn.bootstrapTable.locales = BootstrapTable.LOCALES;
7803 $.fn.bootstrapTable.methods = BootstrapTable.METHODS;
7804 $.fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT
7805 // =======================
7806
7807 $(function () {
7808 $('[data-toggle="table"]').bootstrapTable();
7809 });
7810
7811 return BootstrapTable;
7812
7813})));