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