bootstrap-table-pipeline.js 36 KB

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