bootstrap-table-multiple-sort.js 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814
  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 = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jQuery));
  5. }(this, (function ($) { 'use strict';
  6. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  7. var $__default = /*#__PURE__*/_interopDefaultLegacy($);
  8. function _typeof(obj) {
  9. "@babel/helpers - typeof";
  10. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  11. _typeof = function (obj) {
  12. return typeof obj;
  13. };
  14. } else {
  15. _typeof = function (obj) {
  16. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  17. };
  18. }
  19. return _typeof(obj);
  20. }
  21. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  22. function createCommonjsModule(fn, module) {
  23. return module = { exports: {} }, fn(module, module.exports), module.exports;
  24. }
  25. var check = function (it) {
  26. return it && it.Math == Math && it;
  27. };
  28. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  29. var global_1 =
  30. // eslint-disable-next-line es/no-global-this -- safe
  31. check(typeof globalThis == 'object' && globalThis) ||
  32. check(typeof window == 'object' && window) ||
  33. // eslint-disable-next-line no-restricted-globals -- safe
  34. check(typeof self == 'object' && self) ||
  35. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  36. // eslint-disable-next-line no-new-func -- fallback
  37. (function () { return this; })() || Function('return this')();
  38. var fails = function (exec) {
  39. try {
  40. return !!exec();
  41. } catch (error) {
  42. return true;
  43. }
  44. };
  45. // Detect IE8's incomplete defineProperty implementation
  46. var descriptors = !fails(function () {
  47. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  48. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  49. });
  50. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  51. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  52. var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  53. // Nashorn ~ JDK8 bug
  54. var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  55. // `Object.prototype.propertyIsEnumerable` method implementation
  56. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  57. var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  58. var descriptor = getOwnPropertyDescriptor$1(this, V);
  59. return !!descriptor && descriptor.enumerable;
  60. } : $propertyIsEnumerable;
  61. var objectPropertyIsEnumerable = {
  62. f: f$4
  63. };
  64. var createPropertyDescriptor = function (bitmap, value) {
  65. return {
  66. enumerable: !(bitmap & 1),
  67. configurable: !(bitmap & 2),
  68. writable: !(bitmap & 4),
  69. value: value
  70. };
  71. };
  72. var toString = {}.toString;
  73. var classofRaw = function (it) {
  74. return toString.call(it).slice(8, -1);
  75. };
  76. var split = ''.split;
  77. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  78. var indexedObject = fails(function () {
  79. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  80. // eslint-disable-next-line no-prototype-builtins -- safe
  81. return !Object('z').propertyIsEnumerable(0);
  82. }) ? function (it) {
  83. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  84. } : Object;
  85. // `RequireObjectCoercible` abstract operation
  86. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  87. var requireObjectCoercible = function (it) {
  88. if (it == undefined) throw TypeError("Can't call method on " + it);
  89. return it;
  90. };
  91. // toObject with fallback for non-array-like ES3 strings
  92. var toIndexedObject = function (it) {
  93. return indexedObject(requireObjectCoercible(it));
  94. };
  95. var isObject = function (it) {
  96. return typeof it === 'object' ? it !== null : typeof it === 'function';
  97. };
  98. // `ToPrimitive` abstract operation
  99. // https://tc39.es/ecma262/#sec-toprimitive
  100. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  101. // and the second argument - flag - preferred type is a string
  102. var toPrimitive = function (input, PREFERRED_STRING) {
  103. if (!isObject(input)) return input;
  104. var fn, val;
  105. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  106. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  107. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  108. throw TypeError("Can't convert object to primitive value");
  109. };
  110. var hasOwnProperty = {}.hasOwnProperty;
  111. var has$1 = function (it, key) {
  112. return hasOwnProperty.call(it, key);
  113. };
  114. var document$1 = global_1.document;
  115. // typeof document.createElement is 'object' in old IE
  116. var EXISTS = isObject(document$1) && isObject(document$1.createElement);
  117. var documentCreateElement = function (it) {
  118. return EXISTS ? document$1.createElement(it) : {};
  119. };
  120. // Thank's IE8 for his funny defineProperty
  121. var ie8DomDefine = !descriptors && !fails(function () {
  122. // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
  123. return Object.defineProperty(documentCreateElement('div'), 'a', {
  124. get: function () { return 7; }
  125. }).a != 7;
  126. });
  127. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  128. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  129. // `Object.getOwnPropertyDescriptor` method
  130. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  131. var f$3 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  132. O = toIndexedObject(O);
  133. P = toPrimitive(P, true);
  134. if (ie8DomDefine) try {
  135. return $getOwnPropertyDescriptor(O, P);
  136. } catch (error) { /* empty */ }
  137. if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  138. };
  139. var objectGetOwnPropertyDescriptor = {
  140. f: f$3
  141. };
  142. var anObject = function (it) {
  143. if (!isObject(it)) {
  144. throw TypeError(String(it) + ' is not an object');
  145. } return it;
  146. };
  147. // eslint-disable-next-line es/no-object-defineproperty -- safe
  148. var $defineProperty = Object.defineProperty;
  149. // `Object.defineProperty` method
  150. // https://tc39.es/ecma262/#sec-object.defineproperty
  151. var f$2 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) {
  152. anObject(O);
  153. P = toPrimitive(P, true);
  154. anObject(Attributes);
  155. if (ie8DomDefine) try {
  156. return $defineProperty(O, P, Attributes);
  157. } catch (error) { /* empty */ }
  158. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  159. if ('value' in Attributes) O[P] = Attributes.value;
  160. return O;
  161. };
  162. var objectDefineProperty = {
  163. f: f$2
  164. };
  165. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  166. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  167. } : function (object, key, value) {
  168. object[key] = value;
  169. return object;
  170. };
  171. var setGlobal = function (key, value) {
  172. try {
  173. createNonEnumerableProperty(global_1, key, value);
  174. } catch (error) {
  175. global_1[key] = value;
  176. } return value;
  177. };
  178. var SHARED = '__core-js_shared__';
  179. var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
  180. var sharedStore = store$1;
  181. var functionToString = Function.toString;
  182. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  183. if (typeof sharedStore.inspectSource != 'function') {
  184. sharedStore.inspectSource = function (it) {
  185. return functionToString.call(it);
  186. };
  187. }
  188. var inspectSource = sharedStore.inspectSource;
  189. var WeakMap$1 = global_1.WeakMap;
  190. var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
  191. var shared = createCommonjsModule(function (module) {
  192. (module.exports = function (key, value) {
  193. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  194. })('versions', []).push({
  195. version: '3.10.1',
  196. mode: 'global',
  197. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  198. });
  199. });
  200. var id = 0;
  201. var postfix = Math.random();
  202. var uid = function (key) {
  203. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  204. };
  205. var keys = shared('keys');
  206. var sharedKey = function (key) {
  207. return keys[key] || (keys[key] = uid(key));
  208. };
  209. var hiddenKeys$1 = {};
  210. var WeakMap = global_1.WeakMap;
  211. var set, get, has;
  212. var enforce = function (it) {
  213. return has(it) ? get(it) : set(it, {});
  214. };
  215. var getterFor = function (TYPE) {
  216. return function (it) {
  217. var state;
  218. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  219. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  220. } return state;
  221. };
  222. };
  223. if (nativeWeakMap) {
  224. var store = sharedStore.state || (sharedStore.state = new WeakMap());
  225. var wmget = store.get;
  226. var wmhas = store.has;
  227. var wmset = store.set;
  228. set = function (it, metadata) {
  229. metadata.facade = it;
  230. wmset.call(store, it, metadata);
  231. return metadata;
  232. };
  233. get = function (it) {
  234. return wmget.call(store, it) || {};
  235. };
  236. has = function (it) {
  237. return wmhas.call(store, it);
  238. };
  239. } else {
  240. var STATE = sharedKey('state');
  241. hiddenKeys$1[STATE] = true;
  242. set = function (it, metadata) {
  243. metadata.facade = it;
  244. createNonEnumerableProperty(it, STATE, metadata);
  245. return metadata;
  246. };
  247. get = function (it) {
  248. return has$1(it, STATE) ? it[STATE] : {};
  249. };
  250. has = function (it) {
  251. return has$1(it, STATE);
  252. };
  253. }
  254. var internalState = {
  255. set: set,
  256. get: get,
  257. has: has,
  258. enforce: enforce,
  259. getterFor: getterFor
  260. };
  261. var redefine = createCommonjsModule(function (module) {
  262. var getInternalState = internalState.get;
  263. var enforceInternalState = internalState.enforce;
  264. var TEMPLATE = String(String).split('String');
  265. (module.exports = function (O, key, value, options) {
  266. var unsafe = options ? !!options.unsafe : false;
  267. var simple = options ? !!options.enumerable : false;
  268. var noTargetGet = options ? !!options.noTargetGet : false;
  269. var state;
  270. if (typeof value == 'function') {
  271. if (typeof key == 'string' && !has$1(value, 'name')) {
  272. createNonEnumerableProperty(value, 'name', key);
  273. }
  274. state = enforceInternalState(value);
  275. if (!state.source) {
  276. state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
  277. }
  278. }
  279. if (O === global_1) {
  280. if (simple) O[key] = value;
  281. else setGlobal(key, value);
  282. return;
  283. } else if (!unsafe) {
  284. delete O[key];
  285. } else if (!noTargetGet && O[key]) {
  286. simple = true;
  287. }
  288. if (simple) O[key] = value;
  289. else createNonEnumerableProperty(O, key, value);
  290. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  291. })(Function.prototype, 'toString', function toString() {
  292. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  293. });
  294. });
  295. var path = global_1;
  296. var aFunction$1 = function (variable) {
  297. return typeof variable == 'function' ? variable : undefined;
  298. };
  299. var getBuiltIn = function (namespace, method) {
  300. return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
  301. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  302. };
  303. var ceil = Math.ceil;
  304. var floor = Math.floor;
  305. // `ToInteger` abstract operation
  306. // https://tc39.es/ecma262/#sec-tointeger
  307. var toInteger = function (argument) {
  308. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  309. };
  310. var min$2 = Math.min;
  311. // `ToLength` abstract operation
  312. // https://tc39.es/ecma262/#sec-tolength
  313. var toLength = function (argument) {
  314. return argument > 0 ? min$2(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  315. };
  316. var max$2 = Math.max;
  317. var min$1 = Math.min;
  318. // Helper for a popular repeating case of the spec:
  319. // Let integer be ? ToInteger(index).
  320. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  321. var toAbsoluteIndex = function (index, length) {
  322. var integer = toInteger(index);
  323. return integer < 0 ? max$2(integer + length, 0) : min$1(integer, length);
  324. };
  325. // `Array.prototype.{ indexOf, includes }` methods implementation
  326. var createMethod$2 = function (IS_INCLUDES) {
  327. return function ($this, el, fromIndex) {
  328. var O = toIndexedObject($this);
  329. var length = toLength(O.length);
  330. var index = toAbsoluteIndex(fromIndex, length);
  331. var value;
  332. // Array#includes uses SameValueZero equality algorithm
  333. // eslint-disable-next-line no-self-compare -- NaN check
  334. if (IS_INCLUDES && el != el) while (length > index) {
  335. value = O[index++];
  336. // eslint-disable-next-line no-self-compare -- NaN check
  337. if (value != value) return true;
  338. // Array#indexOf ignores holes, Array#includes - not
  339. } else for (;length > index; index++) {
  340. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  341. } return !IS_INCLUDES && -1;
  342. };
  343. };
  344. var arrayIncludes = {
  345. // `Array.prototype.includes` method
  346. // https://tc39.es/ecma262/#sec-array.prototype.includes
  347. includes: createMethod$2(true),
  348. // `Array.prototype.indexOf` method
  349. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  350. indexOf: createMethod$2(false)
  351. };
  352. var indexOf = arrayIncludes.indexOf;
  353. var objectKeysInternal = function (object, names) {
  354. var O = toIndexedObject(object);
  355. var i = 0;
  356. var result = [];
  357. var key;
  358. for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key);
  359. // Don't enum bug & hidden keys
  360. while (names.length > i) if (has$1(O, key = names[i++])) {
  361. ~indexOf(result, key) || result.push(key);
  362. }
  363. return result;
  364. };
  365. // IE8- don't enum bug keys
  366. var enumBugKeys = [
  367. 'constructor',
  368. 'hasOwnProperty',
  369. 'isPrototypeOf',
  370. 'propertyIsEnumerable',
  371. 'toLocaleString',
  372. 'toString',
  373. 'valueOf'
  374. ];
  375. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  376. // `Object.getOwnPropertyNames` method
  377. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  378. // eslint-disable-next-line es/no-object-getownpropertynames -- safe
  379. var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  380. return objectKeysInternal(O, hiddenKeys);
  381. };
  382. var objectGetOwnPropertyNames = {
  383. f: f$1
  384. };
  385. // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
  386. var f = Object.getOwnPropertySymbols;
  387. var objectGetOwnPropertySymbols = {
  388. f: f
  389. };
  390. // all object keys, includes non-enumerable and symbols
  391. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  392. var keys = objectGetOwnPropertyNames.f(anObject(it));
  393. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  394. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  395. };
  396. var copyConstructorProperties = function (target, source) {
  397. var keys = ownKeys(source);
  398. var defineProperty = objectDefineProperty.f;
  399. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  400. for (var i = 0; i < keys.length; i++) {
  401. var key = keys[i];
  402. if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  403. }
  404. };
  405. var replacement = /#|\.prototype\./;
  406. var isForced = function (feature, detection) {
  407. var value = data[normalize(feature)];
  408. return value == POLYFILL ? true
  409. : value == NATIVE ? false
  410. : typeof detection == 'function' ? fails(detection)
  411. : !!detection;
  412. };
  413. var normalize = isForced.normalize = function (string) {
  414. return String(string).replace(replacement, '.').toLowerCase();
  415. };
  416. var data = isForced.data = {};
  417. var NATIVE = isForced.NATIVE = 'N';
  418. var POLYFILL = isForced.POLYFILL = 'P';
  419. var isForced_1 = isForced;
  420. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  421. /*
  422. options.target - name of the target object
  423. options.global - target is the global object
  424. options.stat - export as static methods of target
  425. options.proto - export as prototype methods of target
  426. options.real - real prototype method for the `pure` version
  427. options.forced - export even if the native feature is available
  428. options.bind - bind methods to the target, required for the `pure` version
  429. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  430. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  431. options.sham - add a flag to not completely full polyfills
  432. options.enumerable - export as enumerable property
  433. options.noTargetGet - prevent calling a getter on target
  434. */
  435. var _export = function (options, source) {
  436. var TARGET = options.target;
  437. var GLOBAL = options.global;
  438. var STATIC = options.stat;
  439. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  440. if (GLOBAL) {
  441. target = global_1;
  442. } else if (STATIC) {
  443. target = global_1[TARGET] || setGlobal(TARGET, {});
  444. } else {
  445. target = (global_1[TARGET] || {}).prototype;
  446. }
  447. if (target) for (key in source) {
  448. sourceProperty = source[key];
  449. if (options.noTargetGet) {
  450. descriptor = getOwnPropertyDescriptor(target, key);
  451. targetProperty = descriptor && descriptor.value;
  452. } else targetProperty = target[key];
  453. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  454. // contained in target
  455. if (!FORCED && targetProperty !== undefined) {
  456. if (typeof sourceProperty === typeof targetProperty) continue;
  457. copyConstructorProperties(sourceProperty, targetProperty);
  458. }
  459. // add a flag to not completely full polyfills
  460. if (options.sham || (targetProperty && targetProperty.sham)) {
  461. createNonEnumerableProperty(sourceProperty, 'sham', true);
  462. }
  463. // extend global
  464. redefine(target, key, sourceProperty, options);
  465. }
  466. };
  467. var aFunction = function (it) {
  468. if (typeof it != 'function') {
  469. throw TypeError(String(it) + ' is not a function');
  470. } return it;
  471. };
  472. // optional / simple context binding
  473. var functionBindContext = function (fn, that, length) {
  474. aFunction(fn);
  475. if (that === undefined) return fn;
  476. switch (length) {
  477. case 0: return function () {
  478. return fn.call(that);
  479. };
  480. case 1: return function (a) {
  481. return fn.call(that, a);
  482. };
  483. case 2: return function (a, b) {
  484. return fn.call(that, a, b);
  485. };
  486. case 3: return function (a, b, c) {
  487. return fn.call(that, a, b, c);
  488. };
  489. }
  490. return function (/* ...args */) {
  491. return fn.apply(that, arguments);
  492. };
  493. };
  494. // `ToObject` abstract operation
  495. // https://tc39.es/ecma262/#sec-toobject
  496. var toObject = function (argument) {
  497. return Object(requireObjectCoercible(argument));
  498. };
  499. // `IsArray` abstract operation
  500. // https://tc39.es/ecma262/#sec-isarray
  501. // eslint-disable-next-line es/no-array-isarray -- safe
  502. var isArray = Array.isArray || function isArray(arg) {
  503. return classofRaw(arg) == 'Array';
  504. };
  505. var engineIsNode = classofRaw(global_1.process) == 'process';
  506. var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
  507. var process = global_1.process;
  508. var versions = process && process.versions;
  509. var v8 = versions && versions.v8;
  510. var match, version;
  511. if (v8) {
  512. match = v8.split('.');
  513. version = match[0] + match[1];
  514. } else if (engineUserAgent) {
  515. match = engineUserAgent.match(/Edge\/(\d+)/);
  516. if (!match || match[1] >= 74) {
  517. match = engineUserAgent.match(/Chrome\/(\d+)/);
  518. if (match) version = match[1];
  519. }
  520. }
  521. var engineV8Version = version && +version;
  522. // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
  523. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  524. // eslint-disable-next-line es/no-symbol -- required for testing
  525. return !Symbol.sham &&
  526. // Chrome 38 Symbol has incorrect toString conversion
  527. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  528. (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41);
  529. });
  530. /* eslint-disable es/no-symbol -- required for testing */
  531. var useSymbolAsUid = nativeSymbol
  532. && !Symbol.sham
  533. && typeof Symbol.iterator == 'symbol';
  534. var WellKnownSymbolsStore = shared('wks');
  535. var Symbol$1 = global_1.Symbol;
  536. var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
  537. var wellKnownSymbol = function (name) {
  538. if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
  539. if (nativeSymbol && has$1(Symbol$1, name)) {
  540. WellKnownSymbolsStore[name] = Symbol$1[name];
  541. } else {
  542. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  543. }
  544. } return WellKnownSymbolsStore[name];
  545. };
  546. var SPECIES$2 = wellKnownSymbol('species');
  547. // `ArraySpeciesCreate` abstract operation
  548. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  549. var arraySpeciesCreate = function (originalArray, length) {
  550. var C;
  551. if (isArray(originalArray)) {
  552. C = originalArray.constructor;
  553. // cross-realm fallback
  554. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  555. else if (isObject(C)) {
  556. C = C[SPECIES$2];
  557. if (C === null) C = undefined;
  558. }
  559. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  560. };
  561. var push = [].push;
  562. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
  563. var createMethod$1 = function (TYPE) {
  564. var IS_MAP = TYPE == 1;
  565. var IS_FILTER = TYPE == 2;
  566. var IS_SOME = TYPE == 3;
  567. var IS_EVERY = TYPE == 4;
  568. var IS_FIND_INDEX = TYPE == 6;
  569. var IS_FILTER_OUT = TYPE == 7;
  570. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  571. return function ($this, callbackfn, that, specificCreate) {
  572. var O = toObject($this);
  573. var self = indexedObject(O);
  574. var boundFunction = functionBindContext(callbackfn, that, 3);
  575. var length = toLength(self.length);
  576. var index = 0;
  577. var create = specificCreate || arraySpeciesCreate;
  578. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
  579. var value, result;
  580. for (;length > index; index++) if (NO_HOLES || index in self) {
  581. value = self[index];
  582. result = boundFunction(value, index, O);
  583. if (TYPE) {
  584. if (IS_MAP) target[index] = result; // map
  585. else if (result) switch (TYPE) {
  586. case 3: return true; // some
  587. case 5: return value; // find
  588. case 6: return index; // findIndex
  589. case 2: push.call(target, value); // filter
  590. } else switch (TYPE) {
  591. case 4: return false; // every
  592. case 7: push.call(target, value); // filterOut
  593. }
  594. }
  595. }
  596. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  597. };
  598. };
  599. var arrayIteration = {
  600. // `Array.prototype.forEach` method
  601. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  602. forEach: createMethod$1(0),
  603. // `Array.prototype.map` method
  604. // https://tc39.es/ecma262/#sec-array.prototype.map
  605. map: createMethod$1(1),
  606. // `Array.prototype.filter` method
  607. // https://tc39.es/ecma262/#sec-array.prototype.filter
  608. filter: createMethod$1(2),
  609. // `Array.prototype.some` method
  610. // https://tc39.es/ecma262/#sec-array.prototype.some
  611. some: createMethod$1(3),
  612. // `Array.prototype.every` method
  613. // https://tc39.es/ecma262/#sec-array.prototype.every
  614. every: createMethod$1(4),
  615. // `Array.prototype.find` method
  616. // https://tc39.es/ecma262/#sec-array.prototype.find
  617. find: createMethod$1(5),
  618. // `Array.prototype.findIndex` method
  619. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  620. findIndex: createMethod$1(6),
  621. // `Array.prototype.filterOut` method
  622. // https://github.com/tc39/proposal-array-filtering
  623. filterOut: createMethod$1(7)
  624. };
  625. // `Object.keys` method
  626. // https://tc39.es/ecma262/#sec-object.keys
  627. // eslint-disable-next-line es/no-object-keys -- safe
  628. var objectKeys = Object.keys || function keys(O) {
  629. return objectKeysInternal(O, enumBugKeys);
  630. };
  631. // `Object.defineProperties` method
  632. // https://tc39.es/ecma262/#sec-object.defineproperties
  633. // eslint-disable-next-line es/no-object-defineproperties -- safe
  634. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  635. anObject(O);
  636. var keys = objectKeys(Properties);
  637. var length = keys.length;
  638. var index = 0;
  639. var key;
  640. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  641. return O;
  642. };
  643. var html = getBuiltIn('document', 'documentElement');
  644. var GT = '>';
  645. var LT = '<';
  646. var PROTOTYPE = 'prototype';
  647. var SCRIPT = 'script';
  648. var IE_PROTO = sharedKey('IE_PROTO');
  649. var EmptyConstructor = function () { /* empty */ };
  650. var scriptTag = function (content) {
  651. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  652. };
  653. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  654. var NullProtoObjectViaActiveX = function (activeXDocument) {
  655. activeXDocument.write(scriptTag(''));
  656. activeXDocument.close();
  657. var temp = activeXDocument.parentWindow.Object;
  658. activeXDocument = null; // avoid memory leak
  659. return temp;
  660. };
  661. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  662. var NullProtoObjectViaIFrame = function () {
  663. // Thrash, waste and sodomy: IE GC bug
  664. var iframe = documentCreateElement('iframe');
  665. var JS = 'java' + SCRIPT + ':';
  666. var iframeDocument;
  667. iframe.style.display = 'none';
  668. html.appendChild(iframe);
  669. // https://github.com/zloirock/core-js/issues/475
  670. iframe.src = String(JS);
  671. iframeDocument = iframe.contentWindow.document;
  672. iframeDocument.open();
  673. iframeDocument.write(scriptTag('document.F=Object'));
  674. iframeDocument.close();
  675. return iframeDocument.F;
  676. };
  677. // Check for document.domain and active x support
  678. // No need to use active x approach when document.domain is not set
  679. // see https://github.com/es-shims/es5-shim/issues/150
  680. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  681. // avoid IE GC bug
  682. var activeXDocument;
  683. var NullProtoObject = function () {
  684. try {
  685. /* global ActiveXObject -- old IE */
  686. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  687. } catch (error) { /* ignore */ }
  688. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  689. var length = enumBugKeys.length;
  690. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  691. return NullProtoObject();
  692. };
  693. hiddenKeys$1[IE_PROTO] = true;
  694. // `Object.create` method
  695. // https://tc39.es/ecma262/#sec-object.create
  696. var objectCreate = Object.create || function create(O, Properties) {
  697. var result;
  698. if (O !== null) {
  699. EmptyConstructor[PROTOTYPE] = anObject(O);
  700. result = new EmptyConstructor();
  701. EmptyConstructor[PROTOTYPE] = null;
  702. // add "__proto__" for Object.getPrototypeOf polyfill
  703. result[IE_PROTO] = O;
  704. } else result = NullProtoObject();
  705. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  706. };
  707. var UNSCOPABLES = wellKnownSymbol('unscopables');
  708. var ArrayPrototype = Array.prototype;
  709. // Array.prototype[@@unscopables]
  710. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  711. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  712. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  713. configurable: true,
  714. value: objectCreate(null)
  715. });
  716. }
  717. // add a key to Array.prototype[@@unscopables]
  718. var addToUnscopables = function (key) {
  719. ArrayPrototype[UNSCOPABLES][key] = true;
  720. };
  721. var $find = arrayIteration.find;
  722. var FIND = 'find';
  723. var SKIPS_HOLES = true;
  724. // Shouldn't skip holes
  725. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  726. // `Array.prototype.find` method
  727. // https://tc39.es/ecma262/#sec-array.prototype.find
  728. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  729. find: function find(callbackfn /* , that = undefined */) {
  730. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  731. }
  732. });
  733. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  734. addToUnscopables(FIND);
  735. var SPECIES$1 = wellKnownSymbol('species');
  736. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  737. // We can't use this feature detection in V8 since it causes
  738. // deoptimization and serious performance degradation
  739. // https://github.com/zloirock/core-js/issues/677
  740. return engineV8Version >= 51 || !fails(function () {
  741. var array = [];
  742. var constructor = array.constructor = {};
  743. constructor[SPECIES$1] = function () {
  744. return { foo: 1 };
  745. };
  746. return array[METHOD_NAME](Boolean).foo !== 1;
  747. });
  748. };
  749. var $map = arrayIteration.map;
  750. var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
  751. // `Array.prototype.map` method
  752. // https://tc39.es/ecma262/#sec-array.prototype.map
  753. // with adding support of @@species
  754. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, {
  755. map: function map(callbackfn /* , thisArg */) {
  756. return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  757. }
  758. });
  759. var arrayMethodIsStrict = function (METHOD_NAME, argument) {
  760. var method = [][METHOD_NAME];
  761. return !!method && fails(function () {
  762. // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
  763. method.call(null, argument || function () { throw 1; }, 1);
  764. });
  765. };
  766. var test$1 = [];
  767. var nativeSort = test$1.sort;
  768. // IE8-
  769. var FAILS_ON_UNDEFINED = fails(function () {
  770. test$1.sort(undefined);
  771. });
  772. // V8 bug
  773. var FAILS_ON_NULL = fails(function () {
  774. test$1.sort(null);
  775. });
  776. // Old WebKit
  777. var STRICT_METHOD$1 = arrayMethodIsStrict('sort');
  778. var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$1;
  779. // `Array.prototype.sort` method
  780. // https://tc39.es/ecma262/#sec-array.prototype.sort
  781. _export({ target: 'Array', proto: true, forced: FORCED$2 }, {
  782. sort: function sort(comparefn) {
  783. return comparefn === undefined
  784. ? nativeSort.call(toObject(this))
  785. : nativeSort.call(toObject(this), aFunction(comparefn));
  786. }
  787. });
  788. var createProperty = function (object, key, value) {
  789. var propertyKey = toPrimitive(key);
  790. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  791. else object[propertyKey] = value;
  792. };
  793. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  794. var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
  795. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  796. // We can't use this feature detection in V8 since it causes
  797. // deoptimization and serious performance degradation
  798. // https://github.com/zloirock/core-js/issues/679
  799. var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
  800. var array = [];
  801. array[IS_CONCAT_SPREADABLE] = false;
  802. return array.concat()[0] !== array;
  803. });
  804. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  805. var isConcatSpreadable = function (O) {
  806. if (!isObject(O)) return false;
  807. var spreadable = O[IS_CONCAT_SPREADABLE];
  808. return spreadable !== undefined ? !!spreadable : isArray(O);
  809. };
  810. var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  811. // `Array.prototype.concat` method
  812. // https://tc39.es/ecma262/#sec-array.prototype.concat
  813. // with adding support of @@isConcatSpreadable and @@species
  814. _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
  815. // eslint-disable-next-line no-unused-vars -- required for `.length`
  816. concat: function concat(arg) {
  817. var O = toObject(this);
  818. var A = arraySpeciesCreate(O, 0);
  819. var n = 0;
  820. var i, k, length, len, E;
  821. for (i = -1, length = arguments.length; i < length; i++) {
  822. E = i === -1 ? O : arguments[i];
  823. if (isConcatSpreadable(E)) {
  824. len = toLength(E.length);
  825. if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  826. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  827. } else {
  828. if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  829. createProperty(A, n++, E);
  830. }
  831. }
  832. A.length = n;
  833. return A;
  834. }
  835. });
  836. // eslint-disable-next-line es/no-object-assign -- safe
  837. var $assign = Object.assign;
  838. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  839. var defineProperty = Object.defineProperty;
  840. // `Object.assign` method
  841. // https://tc39.es/ecma262/#sec-object.assign
  842. var objectAssign = !$assign || fails(function () {
  843. // should have correct order of operations (Edge bug)
  844. if (descriptors && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
  845. enumerable: true,
  846. get: function () {
  847. defineProperty(this, 'b', {
  848. value: 3,
  849. enumerable: false
  850. });
  851. }
  852. }), { b: 2 })).b !== 1) return true;
  853. // should work with symbols and should have deterministic property order (V8 bug)
  854. var A = {};
  855. var B = {};
  856. // eslint-disable-next-line es/no-symbol -- safe
  857. var symbol = Symbol();
  858. var alphabet = 'abcdefghijklmnopqrst';
  859. A[symbol] = 7;
  860. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  861. return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
  862. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  863. var T = toObject(target);
  864. var argumentsLength = arguments.length;
  865. var index = 1;
  866. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  867. var propertyIsEnumerable = objectPropertyIsEnumerable.f;
  868. while (argumentsLength > index) {
  869. var S = indexedObject(arguments[index++]);
  870. var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
  871. var length = keys.length;
  872. var j = 0;
  873. var key;
  874. while (length > j) {
  875. key = keys[j++];
  876. if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
  877. }
  878. } return T;
  879. } : $assign;
  880. // `Object.assign` method
  881. // https://tc39.es/ecma262/#sec-object.assign
  882. // eslint-disable-next-line es/no-object-assign -- required for testing
  883. _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
  884. assign: objectAssign
  885. });
  886. var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice');
  887. var SPECIES = wellKnownSymbol('species');
  888. var nativeSlice = [].slice;
  889. var max$1 = Math.max;
  890. // `Array.prototype.slice` method
  891. // https://tc39.es/ecma262/#sec-array.prototype.slice
  892. // fallback for not array-like ES3 strings and DOM objects
  893. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
  894. slice: function slice(start, end) {
  895. var O = toIndexedObject(this);
  896. var length = toLength(O.length);
  897. var k = toAbsoluteIndex(start, length);
  898. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  899. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  900. var Constructor, result, n;
  901. if (isArray(O)) {
  902. Constructor = O.constructor;
  903. // cross-realm fallback
  904. if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
  905. Constructor = undefined;
  906. } else if (isObject(Constructor)) {
  907. Constructor = Constructor[SPECIES];
  908. if (Constructor === null) Constructor = undefined;
  909. }
  910. if (Constructor === Array || Constructor === undefined) {
  911. return nativeSlice.call(O, k, fin);
  912. }
  913. }
  914. result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
  915. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  916. result.length = n;
  917. return result;
  918. }
  919. });
  920. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
  921. var max = Math.max;
  922. var min = Math.min;
  923. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  924. var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
  925. // `Array.prototype.splice` method
  926. // https://tc39.es/ecma262/#sec-array.prototype.splice
  927. // with adding support of @@species
  928. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  929. splice: function splice(start, deleteCount /* , ...items */) {
  930. var O = toObject(this);
  931. var len = toLength(O.length);
  932. var actualStart = toAbsoluteIndex(start, len);
  933. var argumentsLength = arguments.length;
  934. var insertCount, actualDeleteCount, A, k, from, to;
  935. if (argumentsLength === 0) {
  936. insertCount = actualDeleteCount = 0;
  937. } else if (argumentsLength === 1) {
  938. insertCount = 0;
  939. actualDeleteCount = len - actualStart;
  940. } else {
  941. insertCount = argumentsLength - 2;
  942. actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
  943. }
  944. if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
  945. throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
  946. }
  947. A = arraySpeciesCreate(O, actualDeleteCount);
  948. for (k = 0; k < actualDeleteCount; k++) {
  949. from = actualStart + k;
  950. if (from in O) createProperty(A, k, O[from]);
  951. }
  952. A.length = actualDeleteCount;
  953. if (insertCount < actualDeleteCount) {
  954. for (k = actualStart; k < len - actualDeleteCount; k++) {
  955. from = k + actualDeleteCount;
  956. to = k + insertCount;
  957. if (from in O) O[to] = O[from];
  958. else delete O[to];
  959. }
  960. for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
  961. } else if (insertCount > actualDeleteCount) {
  962. for (k = len - actualDeleteCount; k > actualStart; k--) {
  963. from = k + actualDeleteCount - 1;
  964. to = k + insertCount - 1;
  965. if (from in O) O[to] = O[from];
  966. else delete O[to];
  967. }
  968. }
  969. for (k = 0; k < insertCount; k++) {
  970. O[k + actualStart] = arguments[k + 2];
  971. }
  972. O.length = len - actualDeleteCount + insertCount;
  973. return A;
  974. }
  975. });
  976. /* eslint-disable es/no-array-prototype-indexof -- required for testing */
  977. var $indexOf = arrayIncludes.indexOf;
  978. var nativeIndexOf = [].indexOf;
  979. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
  980. var STRICT_METHOD = arrayMethodIsStrict('indexOf');
  981. // `Array.prototype.indexOf` method
  982. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  983. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
  984. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  985. return NEGATIVE_ZERO
  986. // convert -0 to +0
  987. ? nativeIndexOf.apply(this, arguments) || 0
  988. : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
  989. }
  990. });
  991. // a string of all valid unicode whitespaces
  992. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  993. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  994. var whitespace = '[' + whitespaces + ']';
  995. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  996. var rtrim = RegExp(whitespace + whitespace + '*$');
  997. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  998. var createMethod = function (TYPE) {
  999. return function ($this) {
  1000. var string = String(requireObjectCoercible($this));
  1001. if (TYPE & 1) string = string.replace(ltrim, '');
  1002. if (TYPE & 2) string = string.replace(rtrim, '');
  1003. return string;
  1004. };
  1005. };
  1006. var stringTrim = {
  1007. // `String.prototype.{ trimLeft, trimStart }` methods
  1008. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  1009. start: createMethod(1),
  1010. // `String.prototype.{ trimRight, trimEnd }` methods
  1011. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  1012. end: createMethod(2),
  1013. // `String.prototype.trim` method
  1014. // https://tc39.es/ecma262/#sec-string.prototype.trim
  1015. trim: createMethod(3)
  1016. };
  1017. var trim = stringTrim.trim;
  1018. var $parseFloat = global_1.parseFloat;
  1019. var FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity;
  1020. // `parseFloat` method
  1021. // https://tc39.es/ecma262/#sec-parsefloat-string
  1022. var numberParseFloat = FORCED ? function parseFloat(string) {
  1023. var trimmedString = trim(String(string));
  1024. var result = $parseFloat(trimmedString);
  1025. return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
  1026. } : $parseFloat;
  1027. // `parseFloat` method
  1028. // https://tc39.es/ecma262/#sec-parsefloat-string
  1029. _export({ global: true, forced: parseFloat != numberParseFloat }, {
  1030. parseFloat: numberParseFloat
  1031. });
  1032. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  1033. var test = {};
  1034. test[TO_STRING_TAG$1] = 'z';
  1035. var toStringTagSupport = String(test) === '[object z]';
  1036. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  1037. // ES3 wrong here
  1038. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  1039. // fallback for IE11 Script Access Denied error
  1040. var tryGet = function (it, key) {
  1041. try {
  1042. return it[key];
  1043. } catch (error) { /* empty */ }
  1044. };
  1045. // getting tag from ES6+ `Object.prototype.toString`
  1046. var classof = toStringTagSupport ? classofRaw : function (it) {
  1047. var O, tag, result;
  1048. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1049. // @@toStringTag case
  1050. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
  1051. // builtinTag case
  1052. : CORRECT_ARGUMENTS ? classofRaw(O)
  1053. // ES3 arguments fallback
  1054. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  1055. };
  1056. // `Object.prototype.toString` method implementation
  1057. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1058. var objectToString = toStringTagSupport ? {}.toString : function toString() {
  1059. return '[object ' + classof(this) + ']';
  1060. };
  1061. // `Object.prototype.toString` method
  1062. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1063. if (!toStringTagSupport) {
  1064. redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
  1065. }
  1066. // `RegExp.prototype.flags` getter implementation
  1067. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  1068. var regexpFlags = function () {
  1069. var that = anObject(this);
  1070. var result = '';
  1071. if (that.global) result += 'g';
  1072. if (that.ignoreCase) result += 'i';
  1073. if (that.multiline) result += 'm';
  1074. if (that.dotAll) result += 's';
  1075. if (that.unicode) result += 'u';
  1076. if (that.sticky) result += 'y';
  1077. return result;
  1078. };
  1079. var TO_STRING = 'toString';
  1080. var RegExpPrototype = RegExp.prototype;
  1081. var nativeToString = RegExpPrototype[TO_STRING];
  1082. var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  1083. // FF44- RegExp#toString has a wrong name
  1084. var INCORRECT_NAME = nativeToString.name != TO_STRING;
  1085. // `RegExp.prototype.toString` method
  1086. // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
  1087. if (NOT_GENERIC || INCORRECT_NAME) {
  1088. redefine(RegExp.prototype, TO_STRING, function toString() {
  1089. var R = anObject(this);
  1090. var p = String(R.source);
  1091. var rf = R.flags;
  1092. var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
  1093. return '/' + p + '/' + f;
  1094. }, { unsafe: true });
  1095. }
  1096. /**
  1097. * @author Nadim Basalamah <dimbslmh@gmail.com>
  1098. * @version: v1.1.0
  1099. * https://github.com/dimbslmh/bootstrap-table/tree/master/src/extensions/multiple-sort/bootstrap-table-multiple-sort.js
  1100. * Modification: ErwannNevou <https://github.com/ErwannNevou>
  1101. */
  1102. var isSingleSort = false;
  1103. var Utils = $__default['default'].fn.bootstrapTable.utils;
  1104. $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults.icons, {
  1105. plus: {
  1106. bootstrap3: 'glyphicon-plus',
  1107. bootstrap4: 'fa-plus',
  1108. bootstrap5: 'bi-plus',
  1109. semantic: 'fa-plus',
  1110. materialize: 'plus',
  1111. foundation: 'fa-plus',
  1112. bulma: 'fa-plus',
  1113. 'bootstrap-table': 'icon-plus'
  1114. }[$__default['default'].fn.bootstrapTable.theme] || 'fa-clock',
  1115. minus: {
  1116. bootstrap3: 'glyphicon-minus',
  1117. bootstrap4: 'fa-minus',
  1118. bootstrap5: 'bi-dash',
  1119. semantic: 'fa-minus',
  1120. materialize: 'minus',
  1121. foundation: 'fa-minus',
  1122. bulma: 'fa-minus',
  1123. 'bootstrap-table': 'icon-minus'
  1124. }[$__default['default'].fn.bootstrapTable.theme] || 'fa-clock',
  1125. sort: {
  1126. bootstrap3: 'glyphicon-sort',
  1127. bootstrap4: 'fa-sort',
  1128. bootstrap5: 'bi-arrow-down-up',
  1129. semantic: 'fa-sort',
  1130. materialize: 'sort',
  1131. foundation: 'fa-sort',
  1132. bulma: 'fa-sort',
  1133. 'bootstrap-table': 'icon-sort-amount-asc'
  1134. }[$__default['default'].fn.bootstrapTable.theme] || 'fa-clock'
  1135. });
  1136. var theme = {
  1137. bootstrap3: {
  1138. html: {
  1139. multipleSortModal: "\n <div class=\"modal fade\" id=\"%s\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>\n <h4 class=\"modal-title\" id=\"%sLabel\">%s</h4>\n </div>\n <div class=\"modal-body\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\">\n <button id=\"add\" type=\"button\" class=\"btn btn-default\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn btn-default\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">%s</button>\n <button type=\"button\" class=\"btn btn-primary multi-sort-order-button\">%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
  1140. multipleSortButton: '<button class="multi-sort %s" type="button" data-toggle="modal" data-target="#%s" title="%s">%s</button>',
  1141. multipleSortSelect: '<select class="%s %s form-control">'
  1142. }
  1143. },
  1144. bootstrap4: {
  1145. html: {
  1146. multipleSortModal: "\n <div class=\"modal fade\" id=\"%s\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"%sLabel\">%s</h5>\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"btn btn-secondary\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn btn-secondary\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">%s</button>\n <button type=\"button\" class=\"btn btn-primary multi-sort-order-button\">%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
  1147. multipleSortButton: '<button class="multi-sort %s" type="button" data-toggle="modal" data-target="#%s" title="%s">%s</button>',
  1148. multipleSortSelect: '<select class="%s %s form-control">'
  1149. }
  1150. },
  1151. bootstrap5: {
  1152. html: {
  1153. multipleSortModal: "\n <div class=\"modal fade\" id=\"%s\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"%sLabel\">%s</h5>\n <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>\n </div>\n <div class=\"modal-body\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"btn btn-secondary\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn btn-secondary\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">%s</button>\n <button type=\"button\" class=\"btn btn-primary multi-sort-order-button\">%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
  1154. multipleSortButton: '<button class="multi-sort %s" type="button" data-bs-toggle="modal" data-bs-target="#%s" title="%s">%s</button>',
  1155. multipleSortSelect: '<select class="%s %s form-control">'
  1156. }
  1157. },
  1158. semantic: {
  1159. html: {
  1160. multipleSortModal: "\n <div class=\"ui modal tiny\" id=\"%s\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <i class=\"close icon\"></i>\n <div class=\"header\" id=\"%sLabel\">\n %s\n </div>\n <div class=\"image content\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"ui button\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"ui button\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"actions\">\n <div class=\"ui button deny\">%s</div>\n <div class=\"ui button approve multi-sort-order-button\">%s</div>\n </div>\n </div>\n ",
  1161. multipleSortButton: '<button class="multi-sort %s" type="button" data-toggle="modal" data-target="#%s" title="%s">%s</button>',
  1162. multipleSortSelect: '<select class="%s %s">'
  1163. }
  1164. },
  1165. materialize: {
  1166. html: {
  1167. multipleSortModal: "\n <div id=\"%s\" class=\"modal\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-content\" id=\"%sLabel\">\n <h4>%s</h4>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"waves-effect waves-light btn\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"waves-effect waves-light btn\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n <div class=\"modal-footer\">\n <a href=\"javascript:void(0)\" class=\"modal-close waves-effect waves-light btn\">%s</a>\n <a href=\"javascript:void(0)\" class=\"modal-close waves-effect waves-light btn multi-sort-order-button\">%s</a>\n </div>\n </div>\n </div>\n ",
  1168. multipleSortButton: '<a class="multi-sort %s modal-trigger" href="#%s" type="button" data-toggle="modal" title="%s">%s</a>',
  1169. multipleSortSelect: '<select class="%s %s browser-default">'
  1170. }
  1171. },
  1172. foundation: {
  1173. html: {
  1174. multipleSortModal: "\n <div class=\"reveal\" id=\"%s\" data-reveal aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div id=\"%sLabel\">\n <h1>%s</h1>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"padding-bottom-2\">\n <button id=\"add\" type=\"button\" class=\"waves-effect waves-light button\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"waves-effect waves-light button\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n\n <button class=\"waves-effect waves-light button\" data-close aria-label=\"Close modal\" type=\"button\">\n <span aria-hidden=\"true\">%s</span>\n </button>\n <button class=\"waves-effect waves-light button multi-sort-order-button\" data-close aria-label=\"Order\" type=\"button\">\n <span aria-hidden=\"true\">%s</span>\n </button>\n </div>\n </div>\n ",
  1175. multipleSortButton: '<button class="multi-sort %s" data-open="%s" title="%s">%s</button>',
  1176. multipleSortSelect: '<select class="%s %s browser-default">'
  1177. }
  1178. },
  1179. bulma: {
  1180. html: {
  1181. multipleSortModal: "\n <div class=\"modal\" id=\"%s\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-content\" id=\"%sLabel\">\n <div class=\"box\">\n <h2>%s</h2>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"padding-bottom-2\">\n <button id=\"add\" type=\"button\" class=\"waves-effect waves-light button\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"waves-effect waves-light button\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n <button type=\"button\" class=\"waves-effect waves-light button\" data-close>%s</button>\n <button type=\"button\" class=\"waves-effect waves-light button multi-sort-order-button\" data-close>%s</button>\n </div>\n </div>\n </div>\n ",
  1182. multipleSortButton: '<button class="multi-sort %s" data-target="%s" title="%s">%s</button>',
  1183. multipleSortSelect: '<select class="%s %s browser-default">'
  1184. }
  1185. },
  1186. 'bootstrap-table': {
  1187. html: {
  1188. multipleSortModal: "\n <div class=\"modal\" id=\"%s\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-content\" id=\"%sLabel\">\n <div class=\"box\">\n <h2>%s</h2>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"padding-bottom-2\">\n <button id=\"add\" type=\"button\" class=\"btn\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n <div class=\"mt-30\">\n <button type=\"button\" class=\"btn\" data-close>%s</button>\n <button type=\"button\" class=\"btn multi-sort-order-button\" data-close>%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
  1189. multipleSortButton: '<button class="multi-sort %s" data-target="%s" title="%s">%s</button>',
  1190. multipleSortSelect: '<select class="%s %s browser-default">'
  1191. }
  1192. }
  1193. }[$__default['default'].fn.bootstrapTable.theme];
  1194. var showSortModal = function showSortModal(that) {
  1195. var _selector = that.sortModalSelector;
  1196. var _id = "#".concat(_selector);
  1197. var o = that.options;
  1198. if (!$__default['default'](_id).hasClass('modal')) {
  1199. var sModal = Utils.sprintf(theme.html.multipleSortModal, _selector, _selector, _selector, that.options.formatMultipleSort(), Utils.sprintf(that.constants.html.icon, o.iconsPrefix, o.icons.plus), that.options.formatAddLevel(), Utils.sprintf(that.constants.html.icon, o.iconsPrefix, o.icons.minus), that.options.formatDeleteLevel(), that.options.formatColumn(), that.options.formatOrder(), that.options.formatCancel(), that.options.formatSort());
  1200. $__default['default']('body').append($__default['default'](sModal));
  1201. that.$sortModal = $__default['default'](_id);
  1202. var $rows = that.$sortModal.find('tbody > tr');
  1203. that.$sortModal.off('click', '#add').on('click', '#add', function () {
  1204. var total = that.$sortModal.find('.multi-sort-name:first option').length;
  1205. var current = that.$sortModal.find('tbody tr').length;
  1206. if (current < total) {
  1207. current++;
  1208. that.addLevel();
  1209. that.setButtonStates();
  1210. }
  1211. });
  1212. that.$sortModal.off('click', '#delete').on('click', '#delete', function () {
  1213. var total = that.$sortModal.find('.multi-sort-name:first option').length;
  1214. var current = that.$sortModal.find('tbody tr').length;
  1215. if (current > 1 && current <= total) {
  1216. current--;
  1217. that.$sortModal.find('tbody tr:last').remove();
  1218. that.setButtonStates();
  1219. }
  1220. });
  1221. that.$sortModal.off('click', '.multi-sort-order-button').on('click', '.multi-sort-order-button', function () {
  1222. var $rows = that.$sortModal.find('tbody > tr');
  1223. var $alert = that.$sortModal.find('div.alert');
  1224. var fields = [];
  1225. var results = [];
  1226. var sortPriority = $__default['default'].map($rows, function (row) {
  1227. var $row = $__default['default'](row);
  1228. var name = $row.find('.multi-sort-name').val();
  1229. var order = $row.find('.multi-sort-order').val();
  1230. fields.push(name);
  1231. return {
  1232. sortName: name,
  1233. sortOrder: order
  1234. };
  1235. });
  1236. var sorted_fields = fields.sort();
  1237. for (var i = 0; i < fields.length - 1; i++) {
  1238. if (sorted_fields[i + 1] === sorted_fields[i]) {
  1239. results.push(sorted_fields[i]);
  1240. }
  1241. }
  1242. if (results.length > 0) {
  1243. if ($alert.length === 0) {
  1244. $alert = "<div class=\"alert alert-danger\" role=\"alert\"><strong>".concat(that.options.formatDuplicateAlertTitle(), "</strong> ").concat(that.options.formatDuplicateAlertDescription(), "</div>");
  1245. $__default['default']($alert).insertBefore(that.$sortModal.find('.bars'));
  1246. }
  1247. } else {
  1248. if ($alert.length === 1) {
  1249. $__default['default']($alert).remove();
  1250. }
  1251. if ($__default['default'].inArray($__default['default'].fn.bootstrapTable.theme, ['bootstrap3', 'bootstrap4']) !== -1) {
  1252. that.$sortModal.modal('hide');
  1253. }
  1254. that.multiSort(sortPriority);
  1255. }
  1256. });
  1257. if (that.options.sortPriority === null || that.options.sortPriority.length === 0) {
  1258. if (that.options.sortName) {
  1259. that.options.sortPriority = [{
  1260. sortName: that.options.sortName,
  1261. sortOrder: that.options.sortOrder
  1262. }];
  1263. }
  1264. }
  1265. if (that.options.sortPriority !== null && that.options.sortPriority.length > 0) {
  1266. if ($rows.length < that.options.sortPriority.length && _typeof(that.options.sortPriority) === 'object') {
  1267. for (var i = 0; i < that.options.sortPriority.length; i++) {
  1268. that.addLevel(i, that.options.sortPriority[i]);
  1269. }
  1270. }
  1271. } else {
  1272. that.addLevel(0);
  1273. }
  1274. that.setButtonStates();
  1275. }
  1276. };
  1277. $__default['default'].fn.bootstrapTable.methods.push('multipleSort');
  1278. $__default['default'].fn.bootstrapTable.methods.push('multiSort');
  1279. $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, {
  1280. showMultiSort: false,
  1281. showMultiSortButton: true,
  1282. multiSortStrictSort: false,
  1283. sortPriority: null,
  1284. onMultipleSort: function onMultipleSort() {
  1285. return false;
  1286. }
  1287. });
  1288. $__default['default'].extend($__default['default'].fn.bootstrapTable.Constructor.EVENTS, {
  1289. 'multiple-sort.bs.table': 'onMultipleSort'
  1290. });
  1291. $__default['default'].extend($__default['default'].fn.bootstrapTable.locales, {
  1292. formatMultipleSort: function formatMultipleSort() {
  1293. return 'Multiple Sort';
  1294. },
  1295. formatAddLevel: function formatAddLevel() {
  1296. return 'Add Level';
  1297. },
  1298. formatDeleteLevel: function formatDeleteLevel() {
  1299. return 'Delete Level';
  1300. },
  1301. formatColumn: function formatColumn() {
  1302. return 'Column';
  1303. },
  1304. formatOrder: function formatOrder() {
  1305. return 'Order';
  1306. },
  1307. formatSortBy: function formatSortBy() {
  1308. return 'Sort by';
  1309. },
  1310. formatThenBy: function formatThenBy() {
  1311. return 'Then by';
  1312. },
  1313. formatSort: function formatSort() {
  1314. return 'Sort';
  1315. },
  1316. formatCancel: function formatCancel() {
  1317. return 'Cancel';
  1318. },
  1319. formatDuplicateAlertTitle: function formatDuplicateAlertTitle() {
  1320. return 'Duplicate(s) detected!';
  1321. },
  1322. formatDuplicateAlertDescription: function formatDuplicateAlertDescription() {
  1323. return 'Please remove or change any duplicate column.';
  1324. },
  1325. formatSortOrders: function formatSortOrders() {
  1326. return {
  1327. asc: 'Ascending',
  1328. desc: 'Descending'
  1329. };
  1330. }
  1331. });
  1332. $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, $__default['default'].fn.bootstrapTable.locales);
  1333. var BootstrapTable = $__default['default'].fn.bootstrapTable.Constructor;
  1334. var _initToolbar = BootstrapTable.prototype.initToolbar;
  1335. var _destroy = BootstrapTable.prototype.destroy;
  1336. BootstrapTable.prototype.initToolbar = function () {
  1337. var _this = this;
  1338. this.showToolbar = this.showToolbar || this.options.showMultiSort;
  1339. var that = this;
  1340. var sortModalSelector = "sortModal_".concat(this.$el.attr('id'));
  1341. var sortModalId = "#".concat(sortModalSelector);
  1342. var $multiSortBtn = this.$toolbar.find('div.multi-sort');
  1343. var o = this.options;
  1344. this.$sortModal = $__default['default'](sortModalId);
  1345. this.sortModalSelector = sortModalSelector;
  1346. if (that.options.sortPriority !== null) {
  1347. that.onMultipleSort();
  1348. }
  1349. if (this.options.showMultiSortButton) {
  1350. this.buttons = Object.assign(this.buttons, {
  1351. multipleSort: {
  1352. html: Utils.sprintf(theme.html.multipleSortButton, that.constants.buttonsClass, that.sortModalSelector, this.options.formatMultipleSort(), Utils.sprintf(that.constants.html.icon, o.iconsPrefix, o.icons.sort))
  1353. }
  1354. });
  1355. }
  1356. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  1357. args[_key] = arguments[_key];
  1358. }
  1359. _initToolbar.apply(this, Array.prototype.slice.apply(args));
  1360. if (that.options.sidePagination === 'server' && !isSingleSort && that.options.sortPriority !== null) {
  1361. var t = that.options.queryParams;
  1362. that.options.queryParams = function (params) {
  1363. params.multiSort = that.options.sortPriority;
  1364. return t(params);
  1365. };
  1366. }
  1367. if (this.options.showMultiSort) {
  1368. if (!$multiSortBtn.length && this.options.showMultiSortButton) {
  1369. if ($__default['default'].fn.bootstrapTable.theme === 'semantic') {
  1370. this.$toolbar.find('.multi-sort').on('click', function () {
  1371. $__default['default'](sortModalId).modal('show');
  1372. });
  1373. } else if ($__default['default'].fn.bootstrapTable.theme === 'materialize') {
  1374. this.$toolbar.find('.multi-sort').on('click', function () {
  1375. $__default['default'](sortModalId).modal();
  1376. });
  1377. } else if ($__default['default'].fn.bootstrapTable.theme === 'bootstrap-table') {
  1378. this.$toolbar.find('.multi-sort').on('click', function () {
  1379. $__default['default'](sortModalId).addClass('show');
  1380. });
  1381. } else if ($__default['default'].fn.bootstrapTable.theme === 'foundation') {
  1382. this.$toolbar.find('.multi-sort').on('click', function () {
  1383. if (!_this.foundationModal) {
  1384. // eslint-disable-next-line no-undef
  1385. _this.foundationModal = new Foundation.Reveal($__default['default'](sortModalId));
  1386. }
  1387. _this.foundationModal.open();
  1388. });
  1389. } else if ($__default['default'].fn.bootstrapTable.theme === 'bulma') {
  1390. this.$toolbar.find('.multi-sort').on('click', function () {
  1391. $__default['default']('html').toggleClass('is-clipped');
  1392. $__default['default'](sortModalId).toggleClass('is-active');
  1393. $__default['default']('button[data-close]').one('click', function () {
  1394. $__default['default']('html').toggleClass('is-clipped');
  1395. $__default['default'](sortModalId).toggleClass('is-active');
  1396. });
  1397. });
  1398. }
  1399. showSortModal(that);
  1400. }
  1401. this.$el.on('sort.bs.table', function () {
  1402. isSingleSort = true;
  1403. });
  1404. this.$el.on('multiple-sort.bs.table', function () {
  1405. isSingleSort = false;
  1406. });
  1407. this.$el.on('load-success.bs.table', function () {
  1408. if (!isSingleSort && that.options.sortPriority !== null && _typeof(that.options.sortPriority) === 'object' && that.options.sidePagination !== 'server') {
  1409. that.onMultipleSort();
  1410. }
  1411. });
  1412. this.$el.on('column-switch.bs.table', function (field, checked) {
  1413. if (that.options.sortPriority !== null && that.options.sortPriority.length > 0) {
  1414. for (var i = 0; i < that.options.sortPriority.length; i++) {
  1415. if (that.options.sortPriority[i].sortName === checked) {
  1416. that.options.sortPriority.splice(i, 1);
  1417. }
  1418. }
  1419. that.assignSortableArrows();
  1420. }
  1421. that.$sortModal.remove();
  1422. showSortModal(that);
  1423. });
  1424. this.$el.on('reset-view.bs.table', function () {
  1425. if (!isSingleSort && that.options.sortPriority !== null && _typeof(that.options.sortPriority) === 'object') {
  1426. that.assignSortableArrows();
  1427. }
  1428. });
  1429. }
  1430. };
  1431. BootstrapTable.prototype.destroy = function () {
  1432. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  1433. args[_key2] = arguments[_key2];
  1434. }
  1435. _destroy.apply(this, Array.prototype.slice.apply(args));
  1436. if (this.options.showMultiSort) {
  1437. this.enableCustomSort = false;
  1438. this.$sortModal.remove();
  1439. }
  1440. };
  1441. BootstrapTable.prototype.multipleSort = function () {
  1442. var that = this;
  1443. if (!isSingleSort && that.options.sortPriority !== null && _typeof(that.options.sortPriority) === 'object' && that.options.sidePagination !== 'server') {
  1444. that.onMultipleSort();
  1445. }
  1446. };
  1447. BootstrapTable.prototype.onMultipleSort = function () {
  1448. var that = this;
  1449. var cmp = function cmp(x, y) {
  1450. return x > y ? 1 : x < y ? -1 : 0;
  1451. };
  1452. var arrayCmp = function arrayCmp(a, b) {
  1453. var arr1 = [];
  1454. var arr2 = [];
  1455. for (var i = 0; i < that.options.sortPriority.length; i++) {
  1456. var fieldName = that.options.sortPriority[i].sortName;
  1457. var fieldIndex = that.header.fields.indexOf(fieldName);
  1458. var sorterName = that.header.sorters[that.header.fields.indexOf(fieldName)];
  1459. if (that.header.sortNames[fieldIndex]) {
  1460. fieldName = that.header.sortNames[fieldIndex];
  1461. }
  1462. var order = that.options.sortPriority[i].sortOrder === 'desc' ? -1 : 1;
  1463. var aa = Utils.getItemField(a, fieldName);
  1464. var bb = Utils.getItemField(b, fieldName);
  1465. var value1 = $__default['default'].fn.bootstrapTable.utils.calculateObjectValue(that.header, sorterName, [aa, bb]);
  1466. var value2 = $__default['default'].fn.bootstrapTable.utils.calculateObjectValue(that.header, sorterName, [bb, aa]);
  1467. if (value1 !== undefined && value2 !== undefined) {
  1468. arr1.push(order * value1);
  1469. arr2.push(order * value2);
  1470. continue;
  1471. }
  1472. if (aa === undefined || aa === null) aa = '';
  1473. if (bb === undefined || bb === null) bb = '';
  1474. if ($__default['default'].isNumeric(aa) && $__default['default'].isNumeric(bb)) {
  1475. aa = parseFloat(aa);
  1476. bb = parseFloat(bb);
  1477. } else {
  1478. aa = aa.toString();
  1479. bb = bb.toString();
  1480. if (that.options.multiSortStrictSort) {
  1481. aa = aa.toLowerCase();
  1482. bb = bb.toLowerCase();
  1483. }
  1484. }
  1485. arr1.push(order * cmp(aa, bb));
  1486. arr2.push(order * cmp(bb, aa));
  1487. }
  1488. return cmp(arr1, arr2);
  1489. };
  1490. this.enableCustomSort = true;
  1491. this.data.sort(function (a, b) {
  1492. return arrayCmp(a, b);
  1493. });
  1494. this.initBody();
  1495. this.assignSortableArrows();
  1496. this.trigger('multiple-sort');
  1497. };
  1498. BootstrapTable.prototype.addLevel = function (index, sortPriority) {
  1499. var text = index === 0 ? this.options.formatSortBy() : this.options.formatThenBy();
  1500. this.$sortModal.find('tbody').append($__default['default']('<tr>').append($__default['default']('<td>').text(text)).append($__default['default']('<td>').append($__default['default'](Utils.sprintf(theme.html.multipleSortSelect, this.constants.classes.paginationDropdown, 'multi-sort-name')))).append($__default['default']('<td>').append($__default['default'](Utils.sprintf(theme.html.multipleSortSelect, this.constants.classes.paginationDropdown, 'multi-sort-order')))));
  1501. var $multiSortName = this.$sortModal.find('.multi-sort-name').last();
  1502. var $multiSortOrder = this.$sortModal.find('.multi-sort-order').last();
  1503. $__default['default'].each(this.columns, function (i, column) {
  1504. if (column.sortable === false || column.visible === false) {
  1505. return true;
  1506. }
  1507. $multiSortName.append("<option value=\"".concat(column.field, "\">").concat(column.title, "</option>"));
  1508. });
  1509. $__default['default'].each(this.options.formatSortOrders(), function (value, order) {
  1510. $multiSortOrder.append("<option value=\"".concat(value, "\">").concat(order, "</option>"));
  1511. });
  1512. if (sortPriority !== undefined) {
  1513. $multiSortName.find("option[value=\"".concat(sortPriority.sortName, "\"]")).attr('selected', true);
  1514. $multiSortOrder.find("option[value=\"".concat(sortPriority.sortOrder, "\"]")).attr('selected', true);
  1515. }
  1516. };
  1517. BootstrapTable.prototype.assignSortableArrows = function () {
  1518. var that = this;
  1519. var headers = that.$header.find('th');
  1520. for (var i = 0; i < headers.length; i++) {
  1521. for (var c = 0; c < that.options.sortPriority.length; c++) {
  1522. if ($__default['default'](headers[i]).data('field') === that.options.sortPriority[c].sortName) {
  1523. $__default['default'](headers[i]).find('.sortable').removeClass('desc asc').addClass(that.options.sortPriority[c].sortOrder);
  1524. }
  1525. }
  1526. }
  1527. };
  1528. BootstrapTable.prototype.setButtonStates = function () {
  1529. var total = this.$sortModal.find('.multi-sort-name:first option').length;
  1530. var current = this.$sortModal.find('tbody tr').length;
  1531. if (current === total) {
  1532. this.$sortModal.find('#add').attr('disabled', 'disabled');
  1533. }
  1534. if (current > 1) {
  1535. this.$sortModal.find('#delete').removeAttr('disabled');
  1536. }
  1537. if (current < total) {
  1538. this.$sortModal.find('#add').removeAttr('disabled');
  1539. }
  1540. if (current === 1) {
  1541. this.$sortModal.find('#delete').attr('disabled', 'disabled');
  1542. }
  1543. };
  1544. BootstrapTable.prototype.multiSort = function (sortPriority) {
  1545. var _this2 = this;
  1546. this.options.sortPriority = sortPriority;
  1547. this.options.sortName = undefined;
  1548. if (this.options.sidePagination === 'server') {
  1549. var queryParams = this.options.queryParams;
  1550. this.options.queryParams = function (params) {
  1551. params.multiSort = _this2.options.sortPriority;
  1552. return $__default['default'].fn.bootstrapTable.utils.calculateObjectValue(_this2.options, queryParams, [params]);
  1553. };
  1554. isSingleSort = false;
  1555. this.initServer(this.options.silentSort);
  1556. return;
  1557. }
  1558. this.onMultipleSort();
  1559. };
  1560. })));