bootstrap-table-pipeline.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
  3. typeof define === 'function' && define.amd ? define(['jquery'], factory) :
  4. (global = global || self, factory(global.jQuery));
  5. }(this, function ($) { 'use strict';
  6. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  7. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  8. function createCommonjsModule(fn, module) {
  9. return module = { exports: {} }, fn(module, module.exports), module.exports;
  10. }
  11. var O = 'object';
  12. var check = function (it) {
  13. return it && it.Math == Math && it;
  14. };
  15. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  16. var global_1 =
  17. // eslint-disable-next-line no-undef
  18. check(typeof globalThis == O && globalThis) ||
  19. check(typeof window == O && window) ||
  20. check(typeof self == O && self) ||
  21. check(typeof commonjsGlobal == O && commonjsGlobal) ||
  22. // eslint-disable-next-line no-new-func
  23. Function('return this')();
  24. var fails = function (exec) {
  25. try {
  26. return !!exec();
  27. } catch (error) {
  28. return true;
  29. }
  30. };
  31. // Thank's IE8 for his funny defineProperty
  32. var descriptors = !fails(function () {
  33. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  34. });
  35. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  36. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  37. // Nashorn ~ JDK8 bug
  38. var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  39. // `Object.prototype.propertyIsEnumerable` method implementation
  40. // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
  41. var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  42. var descriptor = getOwnPropertyDescriptor(this, V);
  43. return !!descriptor && descriptor.enumerable;
  44. } : nativePropertyIsEnumerable;
  45. var objectPropertyIsEnumerable = {
  46. f: f
  47. };
  48. var createPropertyDescriptor = function (bitmap, value) {
  49. return {
  50. enumerable: !(bitmap & 1),
  51. configurable: !(bitmap & 2),
  52. writable: !(bitmap & 4),
  53. value: value
  54. };
  55. };
  56. var toString = {}.toString;
  57. var classofRaw = function (it) {
  58. return toString.call(it).slice(8, -1);
  59. };
  60. var split = ''.split;
  61. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  62. var indexedObject = fails(function () {
  63. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  64. // eslint-disable-next-line no-prototype-builtins
  65. return !Object('z').propertyIsEnumerable(0);
  66. }) ? function (it) {
  67. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  68. } : Object;
  69. // `RequireObjectCoercible` abstract operation
  70. // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
  71. var requireObjectCoercible = function (it) {
  72. if (it == undefined) throw TypeError("Can't call method on " + it);
  73. return it;
  74. };
  75. // toObject with fallback for non-array-like ES3 strings
  76. var toIndexedObject = function (it) {
  77. return indexedObject(requireObjectCoercible(it));
  78. };
  79. var isObject = function (it) {
  80. return typeof it === 'object' ? it !== null : typeof it === 'function';
  81. };
  82. // `ToPrimitive` abstract operation
  83. // https://tc39.github.io/ecma262/#sec-toprimitive
  84. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  85. // and the second argument - flag - preferred type is a string
  86. var toPrimitive = function (input, PREFERRED_STRING) {
  87. if (!isObject(input)) return input;
  88. var fn, val;
  89. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  90. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  91. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  92. throw TypeError("Can't convert object to primitive value");
  93. };
  94. var hasOwnProperty = {}.hasOwnProperty;
  95. var has = function (it, key) {
  96. return hasOwnProperty.call(it, key);
  97. };
  98. var document = global_1.document;
  99. // typeof document.createElement is 'object' in old IE
  100. var EXISTS = isObject(document) && isObject(document.createElement);
  101. var documentCreateElement = function (it) {
  102. return EXISTS ? document.createElement(it) : {};
  103. };
  104. // Thank's IE8 for his funny defineProperty
  105. var ie8DomDefine = !descriptors && !fails(function () {
  106. return Object.defineProperty(documentCreateElement('div'), 'a', {
  107. get: function () { return 7; }
  108. }).a != 7;
  109. });
  110. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  111. // `Object.getOwnPropertyDescriptor` method
  112. // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
  113. var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  114. O = toIndexedObject(O);
  115. P = toPrimitive(P, true);
  116. if (ie8DomDefine) try {
  117. return nativeGetOwnPropertyDescriptor(O, P);
  118. } catch (error) { /* empty */ }
  119. if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  120. };
  121. var objectGetOwnPropertyDescriptor = {
  122. f: f$1
  123. };
  124. var anObject = function (it) {
  125. if (!isObject(it)) {
  126. throw TypeError(String(it) + ' is not an object');
  127. } return it;
  128. };
  129. var nativeDefineProperty = Object.defineProperty;
  130. // `Object.defineProperty` method
  131. // https://tc39.github.io/ecma262/#sec-object.defineproperty
  132. var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  133. anObject(O);
  134. P = toPrimitive(P, true);
  135. anObject(Attributes);
  136. if (ie8DomDefine) try {
  137. return nativeDefineProperty(O, P, Attributes);
  138. } catch (error) { /* empty */ }
  139. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  140. if ('value' in Attributes) O[P] = Attributes.value;
  141. return O;
  142. };
  143. var objectDefineProperty = {
  144. f: f$2
  145. };
  146. var hide = descriptors ? function (object, key, value) {
  147. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  148. } : function (object, key, value) {
  149. object[key] = value;
  150. return object;
  151. };
  152. var setGlobal = function (key, value) {
  153. try {
  154. hide(global_1, key, value);
  155. } catch (error) {
  156. global_1[key] = value;
  157. } return value;
  158. };
  159. var shared = createCommonjsModule(function (module) {
  160. var SHARED = '__core-js_shared__';
  161. var store = global_1[SHARED] || setGlobal(SHARED, {});
  162. (module.exports = function (key, value) {
  163. return store[key] || (store[key] = value !== undefined ? value : {});
  164. })('versions', []).push({
  165. version: '3.1.3',
  166. mode: 'global',
  167. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  168. });
  169. });
  170. var functionToString = shared('native-function-to-string', Function.toString);
  171. var WeakMap = global_1.WeakMap;
  172. var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
  173. var id = 0;
  174. var postfix = Math.random();
  175. var uid = function (key) {
  176. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  177. };
  178. var keys = shared('keys');
  179. var sharedKey = function (key) {
  180. return keys[key] || (keys[key] = uid(key));
  181. };
  182. var hiddenKeys = {};
  183. var WeakMap$1 = global_1.WeakMap;
  184. var set, get, has$1;
  185. var enforce = function (it) {
  186. return has$1(it) ? get(it) : set(it, {});
  187. };
  188. var getterFor = function (TYPE) {
  189. return function (it) {
  190. var state;
  191. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  192. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  193. } return state;
  194. };
  195. };
  196. if (nativeWeakMap) {
  197. var store = new WeakMap$1();
  198. var wmget = store.get;
  199. var wmhas = store.has;
  200. var wmset = store.set;
  201. set = function (it, metadata) {
  202. wmset.call(store, it, metadata);
  203. return metadata;
  204. };
  205. get = function (it) {
  206. return wmget.call(store, it) || {};
  207. };
  208. has$1 = function (it) {
  209. return wmhas.call(store, it);
  210. };
  211. } else {
  212. var STATE = sharedKey('state');
  213. hiddenKeys[STATE] = true;
  214. set = function (it, metadata) {
  215. hide(it, STATE, metadata);
  216. return metadata;
  217. };
  218. get = function (it) {
  219. return has(it, STATE) ? it[STATE] : {};
  220. };
  221. has$1 = function (it) {
  222. return has(it, STATE);
  223. };
  224. }
  225. var internalState = {
  226. set: set,
  227. get: get,
  228. has: has$1,
  229. enforce: enforce,
  230. getterFor: getterFor
  231. };
  232. var redefine = createCommonjsModule(function (module) {
  233. var getInternalState = internalState.get;
  234. var enforceInternalState = internalState.enforce;
  235. var TEMPLATE = String(functionToString).split('toString');
  236. shared('inspectSource', function (it) {
  237. return functionToString.call(it);
  238. });
  239. (module.exports = function (O, key, value, options) {
  240. var unsafe = options ? !!options.unsafe : false;
  241. var simple = options ? !!options.enumerable : false;
  242. var noTargetGet = options ? !!options.noTargetGet : false;
  243. if (typeof value == 'function') {
  244. if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
  245. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  246. }
  247. if (O === global_1) {
  248. if (simple) O[key] = value;
  249. else setGlobal(key, value);
  250. return;
  251. } else if (!unsafe) {
  252. delete O[key];
  253. } else if (!noTargetGet && O[key]) {
  254. simple = true;
  255. }
  256. if (simple) O[key] = value;
  257. else hide(O, key, value);
  258. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  259. })(Function.prototype, 'toString', function toString() {
  260. return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
  261. });
  262. });
  263. var path = global_1;
  264. var aFunction = function (variable) {
  265. return typeof variable == 'function' ? variable : undefined;
  266. };
  267. var getBuiltIn = function (namespace, method) {
  268. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
  269. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  270. };
  271. var ceil = Math.ceil;
  272. var floor = Math.floor;
  273. // `ToInteger` abstract operation
  274. // https://tc39.github.io/ecma262/#sec-tointeger
  275. var toInteger = function (argument) {
  276. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  277. };
  278. var min = Math.min;
  279. // `ToLength` abstract operation
  280. // https://tc39.github.io/ecma262/#sec-tolength
  281. var toLength = function (argument) {
  282. return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  283. };
  284. var max = Math.max;
  285. var min$1 = Math.min;
  286. // Helper for a popular repeating case of the spec:
  287. // Let integer be ? ToInteger(index).
  288. // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
  289. var toAbsoluteIndex = function (index, length) {
  290. var integer = toInteger(index);
  291. return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
  292. };
  293. // `Array.prototype.{ indexOf, includes }` methods implementation
  294. var createMethod = function (IS_INCLUDES) {
  295. return function ($this, el, fromIndex) {
  296. var O = toIndexedObject($this);
  297. var length = toLength(O.length);
  298. var index = toAbsoluteIndex(fromIndex, length);
  299. var value;
  300. // Array#includes uses SameValueZero equality algorithm
  301. // eslint-disable-next-line no-self-compare
  302. if (IS_INCLUDES && el != el) while (length > index) {
  303. value = O[index++];
  304. // eslint-disable-next-line no-self-compare
  305. if (value != value) return true;
  306. // Array#indexOf ignores holes, Array#includes - not
  307. } else for (;length > index; index++) {
  308. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  309. } return !IS_INCLUDES && -1;
  310. };
  311. };
  312. var arrayIncludes = {
  313. // `Array.prototype.includes` method
  314. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  315. includes: createMethod(true),
  316. // `Array.prototype.indexOf` method
  317. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  318. indexOf: createMethod(false)
  319. };
  320. var indexOf = arrayIncludes.indexOf;
  321. var objectKeysInternal = function (object, names) {
  322. var O = toIndexedObject(object);
  323. var i = 0;
  324. var result = [];
  325. var key;
  326. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  327. // Don't enum bug & hidden keys
  328. while (names.length > i) if (has(O, key = names[i++])) {
  329. ~indexOf(result, key) || result.push(key);
  330. }
  331. return result;
  332. };
  333. // IE8- don't enum bug keys
  334. var enumBugKeys = [
  335. 'constructor',
  336. 'hasOwnProperty',
  337. 'isPrototypeOf',
  338. 'propertyIsEnumerable',
  339. 'toLocaleString',
  340. 'toString',
  341. 'valueOf'
  342. ];
  343. var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
  344. // `Object.getOwnPropertyNames` method
  345. // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
  346. var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  347. return objectKeysInternal(O, hiddenKeys$1);
  348. };
  349. var objectGetOwnPropertyNames = {
  350. f: f$3
  351. };
  352. var f$4 = Object.getOwnPropertySymbols;
  353. var objectGetOwnPropertySymbols = {
  354. f: f$4
  355. };
  356. // all object keys, includes non-enumerable and symbols
  357. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  358. var keys = objectGetOwnPropertyNames.f(anObject(it));
  359. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  360. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  361. };
  362. var copyConstructorProperties = function (target, source) {
  363. var keys = ownKeys(source);
  364. var defineProperty = objectDefineProperty.f;
  365. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  366. for (var i = 0; i < keys.length; i++) {
  367. var key = keys[i];
  368. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  369. }
  370. };
  371. var replacement = /#|\.prototype\./;
  372. var isForced = function (feature, detection) {
  373. var value = data[normalize(feature)];
  374. return value == POLYFILL ? true
  375. : value == NATIVE ? false
  376. : typeof detection == 'function' ? fails(detection)
  377. : !!detection;
  378. };
  379. var normalize = isForced.normalize = function (string) {
  380. return String(string).replace(replacement, '.').toLowerCase();
  381. };
  382. var data = isForced.data = {};
  383. var NATIVE = isForced.NATIVE = 'N';
  384. var POLYFILL = isForced.POLYFILL = 'P';
  385. var isForced_1 = isForced;
  386. var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  387. /*
  388. options.target - name of the target object
  389. options.global - target is the global object
  390. options.stat - export as static methods of target
  391. options.proto - export as prototype methods of target
  392. options.real - real prototype method for the `pure` version
  393. options.forced - export even if the native feature is available
  394. options.bind - bind methods to the target, required for the `pure` version
  395. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  396. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  397. options.sham - add a flag to not completely full polyfills
  398. options.enumerable - export as enumerable property
  399. options.noTargetGet - prevent calling a getter on target
  400. */
  401. var _export = function (options, source) {
  402. var TARGET = options.target;
  403. var GLOBAL = options.global;
  404. var STATIC = options.stat;
  405. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  406. if (GLOBAL) {
  407. target = global_1;
  408. } else if (STATIC) {
  409. target = global_1[TARGET] || setGlobal(TARGET, {});
  410. } else {
  411. target = (global_1[TARGET] || {}).prototype;
  412. }
  413. if (target) for (key in source) {
  414. sourceProperty = source[key];
  415. if (options.noTargetGet) {
  416. descriptor = getOwnPropertyDescriptor$1(target, key);
  417. targetProperty = descriptor && descriptor.value;
  418. } else targetProperty = target[key];
  419. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  420. // contained in target
  421. if (!FORCED && targetProperty !== undefined) {
  422. if (typeof sourceProperty === typeof targetProperty) continue;
  423. copyConstructorProperties(sourceProperty, targetProperty);
  424. }
  425. // add a flag to not completely full polyfills
  426. if (options.sham || (targetProperty && targetProperty.sham)) {
  427. hide(sourceProperty, 'sham', true);
  428. }
  429. // extend global
  430. redefine(target, key, sourceProperty, options);
  431. }
  432. };
  433. var aFunction$1 = function (it) {
  434. if (typeof it != 'function') {
  435. throw TypeError(String(it) + ' is not a function');
  436. } return it;
  437. };
  438. // optional / simple context binding
  439. var bindContext = function (fn, that, length) {
  440. aFunction$1(fn);
  441. if (that === undefined) return fn;
  442. switch (length) {
  443. case 0: return function () {
  444. return fn.call(that);
  445. };
  446. case 1: return function (a) {
  447. return fn.call(that, a);
  448. };
  449. case 2: return function (a, b) {
  450. return fn.call(that, a, b);
  451. };
  452. case 3: return function (a, b, c) {
  453. return fn.call(that, a, b, c);
  454. };
  455. }
  456. return function (/* ...args */) {
  457. return fn.apply(that, arguments);
  458. };
  459. };
  460. // `ToObject` abstract operation
  461. // https://tc39.github.io/ecma262/#sec-toobject
  462. var toObject = function (argument) {
  463. return Object(requireObjectCoercible(argument));
  464. };
  465. // `IsArray` abstract operation
  466. // https://tc39.github.io/ecma262/#sec-isarray
  467. var isArray = Array.isArray || function isArray(arg) {
  468. return classofRaw(arg) == 'Array';
  469. };
  470. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  471. // Chrome 38 Symbol has incorrect toString conversion
  472. // eslint-disable-next-line no-undef
  473. return !String(Symbol());
  474. });
  475. var Symbol$1 = global_1.Symbol;
  476. var store$1 = shared('wks');
  477. var wellKnownSymbol = function (name) {
  478. return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
  479. || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
  480. };
  481. var SPECIES = wellKnownSymbol('species');
  482. // `ArraySpeciesCreate` abstract operation
  483. // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
  484. var arraySpeciesCreate = function (originalArray, length) {
  485. var C;
  486. if (isArray(originalArray)) {
  487. C = originalArray.constructor;
  488. // cross-realm fallback
  489. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  490. else if (isObject(C)) {
  491. C = C[SPECIES];
  492. if (C === null) C = undefined;
  493. }
  494. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  495. };
  496. var push = [].push;
  497. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
  498. var createMethod$1 = function (TYPE) {
  499. var IS_MAP = TYPE == 1;
  500. var IS_FILTER = TYPE == 2;
  501. var IS_SOME = TYPE == 3;
  502. var IS_EVERY = TYPE == 4;
  503. var IS_FIND_INDEX = TYPE == 6;
  504. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  505. return function ($this, callbackfn, that, specificCreate) {
  506. var O = toObject($this);
  507. var self = indexedObject(O);
  508. var boundFunction = bindContext(callbackfn, that, 3);
  509. var length = toLength(self.length);
  510. var index = 0;
  511. var create = specificCreate || arraySpeciesCreate;
  512. var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  513. var value, result;
  514. for (;length > index; index++) if (NO_HOLES || index in self) {
  515. value = self[index];
  516. result = boundFunction(value, index, O);
  517. if (TYPE) {
  518. if (IS_MAP) target[index] = result; // map
  519. else if (result) switch (TYPE) {
  520. case 3: return true; // some
  521. case 5: return value; // find
  522. case 6: return index; // findIndex
  523. case 2: push.call(target, value); // filter
  524. } else if (IS_EVERY) return false; // every
  525. }
  526. }
  527. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  528. };
  529. };
  530. var arrayIteration = {
  531. // `Array.prototype.forEach` method
  532. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  533. forEach: createMethod$1(0),
  534. // `Array.prototype.map` method
  535. // https://tc39.github.io/ecma262/#sec-array.prototype.map
  536. map: createMethod$1(1),
  537. // `Array.prototype.filter` method
  538. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  539. filter: createMethod$1(2),
  540. // `Array.prototype.some` method
  541. // https://tc39.github.io/ecma262/#sec-array.prototype.some
  542. some: createMethod$1(3),
  543. // `Array.prototype.every` method
  544. // https://tc39.github.io/ecma262/#sec-array.prototype.every
  545. every: createMethod$1(4),
  546. // `Array.prototype.find` method
  547. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  548. find: createMethod$1(5),
  549. // `Array.prototype.findIndex` method
  550. // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
  551. findIndex: createMethod$1(6)
  552. };
  553. var SPECIES$1 = wellKnownSymbol('species');
  554. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  555. return !fails(function () {
  556. var array = [];
  557. var constructor = array.constructor = {};
  558. constructor[SPECIES$1] = function () {
  559. return { foo: 1 };
  560. };
  561. return array[METHOD_NAME](Boolean).foo !== 1;
  562. });
  563. };
  564. var $filter = arrayIteration.filter;
  565. // `Array.prototype.filter` method
  566. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  567. // with adding support of @@species
  568. _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
  569. filter: function filter(callbackfn /* , thisArg */) {
  570. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  571. }
  572. });
  573. var sloppyArrayMethod = function (METHOD_NAME, argument) {
  574. var method = [][METHOD_NAME];
  575. return !method || !fails(function () {
  576. // eslint-disable-next-line no-useless-call,no-throw-literal
  577. method.call(null, argument || function () { throw 1; }, 1);
  578. });
  579. };
  580. var $indexOf = arrayIncludes.indexOf;
  581. var nativeIndexOf = [].indexOf;
  582. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
  583. var SLOPPY_METHOD = sloppyArrayMethod('indexOf');
  584. // `Array.prototype.indexOf` method
  585. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  586. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
  587. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  588. return NEGATIVE_ZERO
  589. // convert -0 to +0
  590. ? nativeIndexOf.apply(this, arguments) || 0
  591. : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
  592. }
  593. });
  594. var createProperty = function (object, key, value) {
  595. var propertyKey = toPrimitive(key);
  596. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  597. else object[propertyKey] = value;
  598. };
  599. var SPECIES$2 = wellKnownSymbol('species');
  600. var nativeSlice = [].slice;
  601. var max$1 = Math.max;
  602. // `Array.prototype.slice` method
  603. // https://tc39.github.io/ecma262/#sec-array.prototype.slice
  604. // fallback for not array-like ES3 strings and DOM objects
  605. _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
  606. slice: function slice(start, end) {
  607. var O = toIndexedObject(this);
  608. var length = toLength(O.length);
  609. var k = toAbsoluteIndex(start, length);
  610. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  611. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  612. var Constructor, result, n;
  613. if (isArray(O)) {
  614. Constructor = O.constructor;
  615. // cross-realm fallback
  616. if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
  617. Constructor = undefined;
  618. } else if (isObject(Constructor)) {
  619. Constructor = Constructor[SPECIES$2];
  620. if (Constructor === null) Constructor = undefined;
  621. }
  622. if (Constructor === Array || Constructor === undefined) {
  623. return nativeSlice.call(O, k, fin);
  624. }
  625. }
  626. result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
  627. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  628. result.length = n;
  629. return result;
  630. }
  631. });
  632. // a string of all valid unicode whitespaces
  633. // eslint-disable-next-line max-len
  634. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  635. var whitespace = '[' + whitespaces + ']';
  636. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  637. var rtrim = RegExp(whitespace + whitespace + '*$');
  638. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  639. var createMethod$2 = function (TYPE) {
  640. return function ($this) {
  641. var string = String(requireObjectCoercible($this));
  642. if (TYPE & 1) string = string.replace(ltrim, '');
  643. if (TYPE & 2) string = string.replace(rtrim, '');
  644. return string;
  645. };
  646. };
  647. var stringTrim = {
  648. // `String.prototype.{ trimLeft, trimStart }` methods
  649. // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
  650. start: createMethod$2(1),
  651. // `String.prototype.{ trimRight, trimEnd }` methods
  652. // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
  653. end: createMethod$2(2),
  654. // `String.prototype.trim` method
  655. // https://tc39.github.io/ecma262/#sec-string.prototype.trim
  656. trim: createMethod$2(3)
  657. };
  658. var trim = stringTrim.trim;
  659. var nativeParseInt = global_1.parseInt;
  660. var hex = /^[+-]?0[Xx]/;
  661. var FORCED = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;
  662. // `parseInt` method
  663. // https://tc39.github.io/ecma262/#sec-parseint-string-radix
  664. var _parseInt = FORCED ? function parseInt(string, radix) {
  665. var S = trim(String(string));
  666. return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
  667. } : nativeParseInt;
  668. // `parseInt` method
  669. // https://tc39.github.io/ecma262/#sec-parseint-string-radix
  670. _export({ global: true, forced: parseInt != _parseInt }, {
  671. parseInt: _parseInt
  672. });
  673. /**
  674. * @author doug-the-guy
  675. * @version v1.0.0
  676. *
  677. * Bootstrap Table Pipeline
  678. * -----------------------
  679. *
  680. * This plugin enables client side data caching for server side requests which will
  681. * eliminate the need to issue a new request every page change. This will allow
  682. * for a performance balance for a large data set between returning all data at once
  683. * (client side paging) and a new server side request (server side paging).
  684. *
  685. * There are two new options:
  686. * - usePipeline: enables this feature
  687. * - pipelineSize: the size of each cache window
  688. *
  689. * The size of the pipeline must be evenly divisible by the current page size. This is
  690. * assured by rounding up to the nearest evenly divisible value. For example, if
  691. * the pipeline size is 4990 and the current page size is 25, then pipeline size will
  692. * be dynamically set to 5000.
  693. *
  694. * The cache windows are computed based on the pipeline size and the total number of rows
  695. * returned by the server side query. For example, with pipeline size 500 and total rows
  696. * 1300, the cache windows will be:
  697. *
  698. * [{'lower': 0, 'upper': 499}, {'lower': 500, 'upper': 999}, {'lower': 1000, 'upper': 1499}]
  699. *
  700. * Using the limit (i.e. the pipelineSize) and offset parameters, the server side request
  701. * **MUST** return only the data in the requested cache window **AND** the total number of rows.
  702. * To wit, the server side code must use the offset and limit parameters to prepare the response
  703. * data.
  704. *
  705. * On a page change, the new offset is checked if it is within the current cache window. If so,
  706. * the requested page data is returned from the cached data set. Otherwise, a new server side
  707. * request will be issued for the new cache window.
  708. *
  709. * The current cached data is only invalidated on these events:
  710. * * sorting
  711. * * searching
  712. * * page size change
  713. * * page change moves into a new cache window
  714. *
  715. * There are two new events:
  716. * - cached-data-hit.bs.table: issued when cached data is used on a page change
  717. * - cached-data-reset.bs.table: issued when the cached data is invalidated and a
  718. * new server side request is issued
  719. *
  720. **/
  721. var Utils = $.fn.bootstrapTable.utils;
  722. $.extend($.fn.bootstrapTable.defaults, {
  723. usePipeline: false,
  724. pipelineSize: 1000,
  725. onCachedDataHit: function onCachedDataHit(data) {
  726. return false;
  727. },
  728. onCachedDataReset: function onCachedDataReset(data) {
  729. return false;
  730. }
  731. });
  732. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  733. 'cached-data-hit.bs.table': 'onCachedDataHit',
  734. 'cached-data-reset.bs.table': 'onCachedDataReset'
  735. });
  736. var BootstrapTable = $.fn.bootstrapTable.Constructor;
  737. var _init = BootstrapTable.prototype.init;
  738. var _initServer = BootstrapTable.prototype.initServer;
  739. var _onSearch = BootstrapTable.prototype.onSearch;
  740. var _onSort = BootstrapTable.prototype.onSort;
  741. var _onPageListChange = BootstrapTable.prototype.onPageListChange;
  742. BootstrapTable.prototype.init = function () {
  743. // needs to be called before initServer()
  744. this.initPipeline();
  745. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  746. args[_key] = arguments[_key];
  747. }
  748. _init.apply(this, Array.prototype.slice.apply(args));
  749. };
  750. BootstrapTable.prototype.initPipeline = function () {
  751. this.cacheRequestJSON = {};
  752. this.cacheWindows = [];
  753. this.currWindow = 0;
  754. this.resetCache = true;
  755. };
  756. BootstrapTable.prototype.onSearch = function (event) {
  757. /* force a cache reset on search */
  758. if (this.options.usePipeline) {
  759. this.resetCache = true;
  760. }
  761. _onSearch.apply(this, Array.prototype.slice.apply(arguments));
  762. };
  763. BootstrapTable.prototype.onSort = function (event) {
  764. /* force a cache reset on sort */
  765. if (this.options.usePipeline) {
  766. this.resetCache = true;
  767. }
  768. _onSort.apply(this, Array.prototype.slice.apply(arguments));
  769. };
  770. BootstrapTable.prototype.onPageListChange = function (event) {
  771. /* rebuild cache window on page size change */
  772. var target = $(event.currentTarget);
  773. var newPageSize = parseInt(target.text());
  774. this.options.pipelineSize = this.calculatePipelineSize(this.options.pipelineSize, newPageSize);
  775. this.resetCache = true;
  776. _onPageListChange.apply(this, Array.prototype.slice.apply(arguments));
  777. };
  778. BootstrapTable.prototype.calculatePipelineSize = function (pipelineSize, pageSize) {
  779. /* calculate pipeline size by rounding up to the nearest value evenly divisible
  780. * by the pageSize */
  781. if (pageSize === 0) return 0;
  782. return Math.ceil(pipelineSize / pageSize) * pageSize;
  783. };
  784. BootstrapTable.prototype.setCacheWindows = function () {
  785. /* set cache windows based on the total number of rows returned by server side
  786. * request and the pipelineSize */
  787. this.cacheWindows = [];
  788. var numWindows = this.options.totalRows / this.options.pipelineSize;
  789. for (var i = 0; i <= numWindows; i++) {
  790. var b = i * this.options.pipelineSize;
  791. this.cacheWindows[i] = {
  792. 'lower': b,
  793. 'upper': b + this.options.pipelineSize - 1
  794. };
  795. }
  796. };
  797. BootstrapTable.prototype.setCurrWindow = function (offset) {
  798. /* set the current cache window index, based on where the current offset falls */
  799. this.currWindow = 0;
  800. for (var i = 0; i < this.cacheWindows.length; i++) {
  801. if (this.cacheWindows[i].lower <= offset && offset <= this.cacheWindows[i].upper) {
  802. this.currWindow = i;
  803. break;
  804. }
  805. }
  806. };
  807. BootstrapTable.prototype.drawFromCache = function (offset, limit) {
  808. /* draw rows from the cache using offset and limit */
  809. var res = $.extend(true, {}, this.cacheRequestJSON);
  810. var drawStart = offset - this.cacheWindows[this.currWindow].lower;
  811. var drawEnd = drawStart + limit;
  812. res.rows = res.rows.slice(drawStart, drawEnd);
  813. return res;
  814. };
  815. BootstrapTable.prototype.initServer = function (silent, query, url) {
  816. /* determine if requested data is in cache (on paging) or if
  817. * a new ajax request needs to be issued (sorting, searching, paging
  818. * moving outside of cached data, page size change)
  819. * initial version of this extension will entirely override base initServer
  820. **/
  821. var data = {};
  822. var index = this.header.fields.indexOf(this.options.sortName);
  823. var params = {
  824. searchText: this.searchText,
  825. sortName: this.options.sortName,
  826. sortOrder: this.options.sortOrder
  827. };
  828. var request = null;
  829. if (this.header.sortNames[index]) {
  830. params.sortName = this.header.sortNames[index];
  831. }
  832. if (this.options.pagination && this.options.sidePagination === 'server') {
  833. params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
  834. params.pageNumber = this.options.pageNumber;
  835. }
  836. if (!(url || this.options.url) && !this.options.ajax) {
  837. return;
  838. }
  839. var useAjax = true;
  840. if (this.options.queryParamsType === 'limit') {
  841. params = {
  842. searchText: params.searchText,
  843. sortName: params.sortName,
  844. sortOrder: params.sortOrder
  845. };
  846. if (this.options.pagination && this.options.sidePagination === 'server') {
  847. params.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
  848. params.offset = (this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize) * (this.options.pageNumber - 1);
  849. if (this.options.usePipeline) {
  850. // if cacheWindows is empty, this is the initial request
  851. if (!this.cacheWindows.length) {
  852. useAjax = true;
  853. params.drawOffset = params.offset; // cache exists: determine if the page request is entirely within the current cached window
  854. } else {
  855. var w = this.cacheWindows[this.currWindow]; // case 1: reset cache but stay within current window (e.g. column sort)
  856. // case 2: move outside of the current window (e.g. search or paging)
  857. // since each cache window is aligned with the current page size
  858. // checking if params.offset is outside the current window is sufficient.
  859. // need to requery for preceding or succeeding cache window
  860. // also handle case
  861. if (this.resetCache || params.offset < w.lower || params.offset > w.upper) {
  862. useAjax = true;
  863. this.setCurrWindow(params.offset); // store the relative offset for drawing the page data afterwards
  864. params.drawOffset = params.offset; // now set params.offset to the lower bound of the new cache window
  865. // the server will return that whole cache window
  866. params.offset = this.cacheWindows[this.currWindow].lower; // within current cache window
  867. } else {
  868. useAjax = false;
  869. }
  870. }
  871. } else {
  872. if (params.limit === 0) {
  873. delete params.limit;
  874. }
  875. }
  876. }
  877. } // force an ajax call - this is on search, sort or page size change
  878. if (this.resetCache) {
  879. useAjax = true;
  880. this.resetCache = false;
  881. }
  882. if (this.options.usePipeline && useAjax) {
  883. /* in this scenario limit is used on the server to get the cache window
  884. * and drawLimit is used to get the page data afterwards */
  885. params.drawLimit = params.limit;
  886. params.limit = this.options.pipelineSize;
  887. } // cached results can be used
  888. if (!useAjax) {
  889. var res = this.drawFromCache(params.offset, params.limit);
  890. this.load(res);
  891. this.trigger('load-success', res);
  892. this.trigger('cached-data-hit', res);
  893. return;
  894. } // cached results can't be used
  895. // continue base initServer code
  896. if (!$.isEmptyObject(this.filterColumnsPartial)) {
  897. params.filter = JSON.stringify(this.filterColumnsPartial, null);
  898. }
  899. data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data);
  900. $.extend(data, query || {}); // false to stop request
  901. if (data === false) {
  902. return;
  903. }
  904. if (!silent) {
  905. this.$tableLoading.show();
  906. }
  907. var self = this;
  908. request = $.extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
  909. type: this.options.method,
  910. url: url || this.options.url,
  911. data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
  912. cache: this.options.cache,
  913. contentType: this.options.contentType,
  914. dataType: this.options.dataType,
  915. success: function success(res) {
  916. res = Utils.calculateObjectValue(self.options, self.options.responseHandler, [res], res); // cache results if using pipelining
  917. if (self.options.usePipeline) {
  918. // store entire request in cache
  919. self.cacheRequestJSON = $.extend(true, {}, res); // this gets set in load() also but needs to be set before
  920. // setting cacheWindows
  921. self.options.totalRows = res[self.options.totalField]; // if this is a search, potentially less results will be returned
  922. // so cache windows need to be rebuilt. Otherwise it
  923. // will come out the same
  924. self.setCacheWindows();
  925. self.setCurrWindow(params.drawOffset); // just load data for the page
  926. res = self.drawFromCache(params.drawOffset, params.drawLimit);
  927. self.trigger('cached-data-reset', res);
  928. }
  929. self.load(res);
  930. self.trigger('load-success', res);
  931. if (!silent) self.$tableLoading.hide();
  932. },
  933. error: function error(res) {
  934. var data = [];
  935. if (self.options.sidePagination === 'server') {
  936. data = {};
  937. data[self.options.totalField] = 0;
  938. data[self.options.dataField] = [];
  939. }
  940. self.load(data);
  941. self.trigger('load-error', res.status, res);
  942. if (!silent) self.$tableLoading.hide();
  943. }
  944. });
  945. if (this.options.ajax) {
  946. Utils.calculateObjectValue(this, this.options.ajax, [request], null);
  947. } else {
  948. if (this._xhr && this._xhr.readyState !== 4) {
  949. this._xhr.abort();
  950. }
  951. this._xhr = $.ajax(request);
  952. }
  953. };
  954. }));