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