bootstrap-table-filter-control.js 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452
  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$1 = global.document;
  99. // typeof document.createElement is 'object' in old IE
  100. var exist = isObject(document$1) && isObject(document$1.createElement);
  101. var documentCreateElement = function (it) {
  102. return exist ? document$1.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$1 = global.Symbol;
  183. var wellKnownSymbol = function (name) {
  184. return store[name] || (store[name] = nativeSymbol && Symbol$1[name]
  185. || (nativeSymbol ? Symbol$1 : 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$1 = global.Reflect;
  447. // all object keys, includes non-enumerable and symbols
  448. var ownKeys = Reflect$1 && Reflect$1.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. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  535. var objectKeys = Object.keys || function keys(O) {
  536. return objectKeysInternal(O, enumBugKeys);
  537. };
  538. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  539. anObject(O);
  540. var keys = objectKeys(Properties);
  541. var length = keys.length;
  542. var i = 0;
  543. var key;
  544. while (length > i) objectDefineProperty.f(O, key = keys[i++], Properties[key]);
  545. return O;
  546. };
  547. var document$2 = global.document;
  548. var html = document$2 && document$2.documentElement;
  549. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  550. var IE_PROTO = sharedKey('IE_PROTO');
  551. var PROTOTYPE = 'prototype';
  552. var Empty = function () { /* empty */ };
  553. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  554. var createDict = function () {
  555. // Thrash, waste and sodomy: IE GC bug
  556. var iframe = documentCreateElement('iframe');
  557. var length = enumBugKeys.length;
  558. var lt = '<';
  559. var script = 'script';
  560. var gt = '>';
  561. var js = 'java' + script + ':';
  562. var iframeDocument;
  563. iframe.style.display = 'none';
  564. html.appendChild(iframe);
  565. iframe.src = String(js);
  566. iframeDocument = iframe.contentWindow.document;
  567. iframeDocument.open();
  568. iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
  569. iframeDocument.close();
  570. createDict = iframeDocument.F;
  571. while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
  572. return createDict();
  573. };
  574. var objectCreate = Object.create || function create(O, Properties) {
  575. var result;
  576. if (O !== null) {
  577. Empty[PROTOTYPE] = anObject(O);
  578. result = new Empty();
  579. Empty[PROTOTYPE] = null;
  580. // add "__proto__" for Object.getPrototypeOf polyfill
  581. result[IE_PROTO] = O;
  582. } else result = createDict();
  583. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  584. };
  585. hiddenKeys[IE_PROTO] = true;
  586. var UNSCOPABLES = wellKnownSymbol('unscopables');
  587. var ArrayPrototype = Array.prototype;
  588. // Array.prototype[@@unscopables]
  589. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  590. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  591. hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
  592. }
  593. // add a key to Array.prototype[@@unscopables]
  594. var addToUnscopables = function (key) {
  595. ArrayPrototype[UNSCOPABLES][key] = true;
  596. };
  597. var internalFind = arrayMethods(5);
  598. var FIND = 'find';
  599. var SKIPS_HOLES = true;
  600. // Shouldn't skip holes
  601. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  602. // `Array.prototype.find` method
  603. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  604. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  605. find: function find(callbackfn /* , that = undefined */) {
  606. return internalFind(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  607. }
  608. });
  609. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  610. addToUnscopables(FIND);
  611. var internalIncludes = arrayIncludes(true);
  612. // `Array.prototype.includes` method
  613. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  614. _export({ target: 'Array', proto: true }, {
  615. includes: function includes(el /* , fromIndex = 0 */) {
  616. return internalIncludes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  617. }
  618. });
  619. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  620. addToUnscopables('includes');
  621. var sloppyArrayMethod = function (METHOD_NAME, argument) {
  622. var method = [][METHOD_NAME];
  623. return !method || !fails(function () {
  624. // eslint-disable-next-line no-useless-call
  625. method.call(null, argument || function () { throw Error(); }, 1);
  626. });
  627. };
  628. var internalIndexOf = arrayIncludes(false);
  629. var nativeIndexOf = [].indexOf;
  630. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
  631. var SLOPPY_METHOD = sloppyArrayMethod('indexOf');
  632. // `Array.prototype.indexOf` method
  633. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  634. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
  635. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  636. return NEGATIVE_ZERO
  637. // convert -0 to +0
  638. ? nativeIndexOf.apply(this, arguments) || 0
  639. : internalIndexOf(this, searchElement, arguments[1]);
  640. }
  641. });
  642. var nativeJoin = [].join;
  643. var ES3_STRINGS = indexedObject != Object;
  644. var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
  645. // `Array.prototype.join` method
  646. // https://tc39.github.io/ecma262/#sec-array.prototype.join
  647. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
  648. join: function join(separator) {
  649. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  650. }
  651. });
  652. var nativeSort = [].sort;
  653. var test = [1, 2, 3];
  654. // IE8-
  655. var FAILS_ON_UNDEFINED = fails(function () {
  656. test.sort(undefined);
  657. });
  658. // V8 bug
  659. var FAILS_ON_NULL = fails(function () {
  660. test.sort(null);
  661. });
  662. // Old WebKit
  663. var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
  664. var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
  665. // `Array.prototype.sort` method
  666. // https://tc39.github.io/ecma262/#sec-array.prototype.sort
  667. _export({ target: 'Array', proto: true, forced: FORCED }, {
  668. sort: function sort(comparefn) {
  669. return comparefn === undefined
  670. ? nativeSort.call(toObject(this))
  671. : nativeSort.call(toObject(this), aFunction(comparefn));
  672. }
  673. });
  674. var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  675. // `Object.keys` method
  676. // https://tc39.github.io/ecma262/#sec-object.keys
  677. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  678. keys: function keys(it) {
  679. return objectKeys(toObject(it));
  680. }
  681. });
  682. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  683. // ES3 wrong here
  684. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  685. // fallback for IE11 Script Access Denied error
  686. var tryGet = function (it, key) {
  687. try {
  688. return it[key];
  689. } catch (e) { /* empty */ }
  690. };
  691. // getting tag from ES6+ `Object.prototype.toString`
  692. var classof = function (it) {
  693. var O, tag, result;
  694. return it === undefined ? 'Undefined' : it === null ? 'Null'
  695. // @@toStringTag case
  696. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
  697. // builtinTag case
  698. : CORRECT_ARGUMENTS ? classofRaw(O)
  699. // ES3 arguments fallback
  700. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  701. };
  702. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  703. var test$1 = {};
  704. test$1[TO_STRING_TAG$1] = 'z';
  705. // `Object.prototype.toString` method implementation
  706. // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
  707. var objectToString = String(test$1) !== '[object z]' ? function toString() {
  708. return '[object ' + classof(this) + ']';
  709. } : test$1.toString;
  710. var ObjectPrototype = Object.prototype;
  711. // `Object.prototype.toString` method
  712. // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
  713. if (objectToString !== ObjectPrototype.toString) {
  714. redefine(ObjectPrototype, 'toString', objectToString, { unsafe: true });
  715. }
  716. // `RegExp.prototype.flags` getter implementation
  717. // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
  718. var regexpFlags = function () {
  719. var that = anObject(this);
  720. var result = '';
  721. if (that.global) result += 'g';
  722. if (that.ignoreCase) result += 'i';
  723. if (that.multiline) result += 'm';
  724. if (that.unicode) result += 'u';
  725. if (that.sticky) result += 'y';
  726. return result;
  727. };
  728. var TO_STRING = 'toString';
  729. var nativeToString = /./[TO_STRING];
  730. var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  731. // FF44- RegExp#toString has a wrong name
  732. var INCORRECT_NAME = nativeToString.name != TO_STRING;
  733. // `RegExp.prototype.toString` method
  734. // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
  735. if (NOT_GENERIC || INCORRECT_NAME) {
  736. redefine(RegExp.prototype, TO_STRING, function toString() {
  737. var R = anObject(this);
  738. return '/'.concat(R.source, '/',
  739. 'flags' in R ? R.flags : !descriptors && R instanceof RegExp ? regexpFlags.call(R) : undefined);
  740. }, { unsafe: true });
  741. }
  742. var MATCH = wellKnownSymbol('match');
  743. // `IsRegExp` abstract operation
  744. // https://tc39.github.io/ecma262/#sec-isregexp
  745. var isRegexp = function (it) {
  746. var isRegExp;
  747. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  748. };
  749. // helper for String#{startsWith, endsWith, includes}
  750. var validateStringMethodArguments = function (that, searchString, NAME) {
  751. if (isRegexp(searchString)) {
  752. throw TypeError('String.prototype.' + NAME + " doesn't accept regex");
  753. } return String(requireObjectCoercible(that));
  754. };
  755. var MATCH$1 = wellKnownSymbol('match');
  756. var correctIsRegexpLogic = function (METHOD_NAME) {
  757. var regexp = /./;
  758. try {
  759. '/./'[METHOD_NAME](regexp);
  760. } catch (e) {
  761. try {
  762. regexp[MATCH$1] = false;
  763. return '/./'[METHOD_NAME](regexp);
  764. } catch (f) { /* empty */ }
  765. } return false;
  766. };
  767. var INCLUDES = 'includes';
  768. var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic(INCLUDES);
  769. // `String.prototype.includes` method
  770. // https://tc39.github.io/ecma262/#sec-string.prototype.includes
  771. _export({ target: 'String', proto: true, forced: !CORRECT_IS_REGEXP_LOGIC }, {
  772. includes: function includes(searchString /* , position = 0 */) {
  773. return !!~validateStringMethodArguments(this, searchString, INCLUDES)
  774. .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
  775. }
  776. });
  777. // CONVERT_TO_STRING: true -> String#at
  778. // CONVERT_TO_STRING: false -> String#codePointAt
  779. var stringAt = function (that, pos, CONVERT_TO_STRING) {
  780. var S = String(requireObjectCoercible(that));
  781. var position = toInteger(pos);
  782. var size = S.length;
  783. var first, second;
  784. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  785. first = S.charCodeAt(position);
  786. return first < 0xd800 || first > 0xdbff || position + 1 === size
  787. || (second = S.charCodeAt(position + 1)) < 0xdc00 || second > 0xdfff
  788. ? CONVERT_TO_STRING ? S.charAt(position) : first
  789. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xd800 << 10) + (second - 0xdc00) + 0x10000;
  790. };
  791. // `AdvanceStringIndex` abstract operation
  792. // https://tc39.github.io/ecma262/#sec-advancestringindex
  793. var advanceStringIndex = function (S, index, unicode) {
  794. return index + (unicode ? stringAt(S, index, true).length : 1);
  795. };
  796. var nativeExec = RegExp.prototype.exec;
  797. // This always refers to the native implementation, because the
  798. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  799. // which loads this file before patching the method.
  800. var nativeReplace = String.prototype.replace;
  801. var patchedExec = nativeExec;
  802. var UPDATES_LAST_INDEX_WRONG = (function () {
  803. var re1 = /a/;
  804. var re2 = /b*/g;
  805. nativeExec.call(re1, 'a');
  806. nativeExec.call(re2, 'a');
  807. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  808. })();
  809. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  810. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  811. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
  812. if (PATCH) {
  813. patchedExec = function exec(str) {
  814. var re = this;
  815. var lastIndex, reCopy, match, i;
  816. if (NPCG_INCLUDED) {
  817. reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
  818. }
  819. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  820. match = nativeExec.call(re, str);
  821. if (UPDATES_LAST_INDEX_WRONG && match) {
  822. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  823. }
  824. if (NPCG_INCLUDED && match && match.length > 1) {
  825. // Fix browsers whose `exec` methods don't consistently return `undefined`
  826. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  827. nativeReplace.call(match[0], reCopy, function () {
  828. for (i = 1; i < arguments.length - 2; i++) {
  829. if (arguments[i] === undefined) match[i] = undefined;
  830. }
  831. });
  832. }
  833. return match;
  834. };
  835. }
  836. var regexpExec = patchedExec;
  837. // `RegExpExec` abstract operation
  838. // https://tc39.github.io/ecma262/#sec-regexpexec
  839. var regexpExecAbstract = function (R, S) {
  840. var exec = R.exec;
  841. if (typeof exec === 'function') {
  842. var result = exec.call(R, S);
  843. if (typeof result !== 'object') {
  844. throw TypeError('RegExp exec method returned something other than an Object or null');
  845. }
  846. return result;
  847. }
  848. if (classofRaw(R) !== 'RegExp') {
  849. throw TypeError('RegExp#exec called on incompatible receiver');
  850. }
  851. return regexpExec.call(R, S);
  852. };
  853. var SPECIES$2 = wellKnownSymbol('species');
  854. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  855. // #replace needs built-in support for named groups.
  856. // #match works fine because it just return the exec results, even if it has
  857. // a "grops" property.
  858. var re = /./;
  859. re.exec = function () {
  860. var result = [];
  861. result.groups = { a: '7' };
  862. return result;
  863. };
  864. return ''.replace(re, '$<a>') !== '7';
  865. });
  866. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  867. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  868. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  869. var re = /(?:)/;
  870. var originalExec = re.exec;
  871. re.exec = function () { return originalExec.apply(this, arguments); };
  872. var result = 'ab'.split(re);
  873. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  874. });
  875. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  876. var SYMBOL = wellKnownSymbol(KEY);
  877. var DELEGATES_TO_SYMBOL = !fails(function () {
  878. // String methods call symbol-named RegEp methods
  879. var O = {};
  880. O[SYMBOL] = function () { return 7; };
  881. return ''[KEY](O) != 7;
  882. });
  883. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  884. // Symbol-named RegExp methods call .exec
  885. var execCalled = false;
  886. var re = /a/;
  887. re.exec = function () { execCalled = true; return null; };
  888. if (KEY === 'split') {
  889. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  890. // a new one. We need to return the patched regex when creating the new one.
  891. re.constructor = {};
  892. re.constructor[SPECIES$2] = function () { return re; };
  893. }
  894. re[SYMBOL]('');
  895. return !execCalled;
  896. });
  897. if (
  898. !DELEGATES_TO_SYMBOL ||
  899. !DELEGATES_TO_EXEC ||
  900. (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
  901. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  902. ) {
  903. var nativeRegExpMethod = /./[SYMBOL];
  904. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  905. if (regexp.exec === regexpExec) {
  906. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  907. // The native String method already delegates to @@method (this
  908. // polyfilled function), leasing to infinite recursion.
  909. // We avoid it by directly calling the native @@method method.
  910. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  911. }
  912. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  913. }
  914. return { done: false };
  915. });
  916. var stringMethod = methods[0];
  917. var regexMethod = methods[1];
  918. redefine(String.prototype, KEY, stringMethod);
  919. redefine(RegExp.prototype, SYMBOL, length == 2
  920. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  921. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  922. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  923. // 21.2.5.6 RegExp.prototype[@@match](string)
  924. // 21.2.5.9 RegExp.prototype[@@search](string)
  925. : function (string) { return regexMethod.call(string, this); }
  926. );
  927. if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
  928. }
  929. };
  930. // @@match logic
  931. fixRegexpWellKnownSymbolLogic(
  932. 'match',
  933. 1,
  934. function (MATCH, nativeMatch, maybeCallNative) {
  935. return [
  936. // `String.prototype.match` method
  937. // https://tc39.github.io/ecma262/#sec-string.prototype.match
  938. function match(regexp) {
  939. var O = requireObjectCoercible(this);
  940. var matcher = regexp == undefined ? undefined : regexp[MATCH];
  941. return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  942. },
  943. // `RegExp.prototype[@@match]` method
  944. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
  945. function (regexp) {
  946. var res = maybeCallNative(nativeMatch, regexp, this);
  947. if (res.done) return res.value;
  948. var rx = anObject(regexp);
  949. var S = String(this);
  950. if (!rx.global) return regexpExecAbstract(rx, S);
  951. var fullUnicode = rx.unicode;
  952. rx.lastIndex = 0;
  953. var A = [];
  954. var n = 0;
  955. var result;
  956. while ((result = regexpExecAbstract(rx, S)) !== null) {
  957. var matchStr = String(result[0]);
  958. A[n] = matchStr;
  959. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  960. n++;
  961. }
  962. return n === 0 ? null : A;
  963. }
  964. ];
  965. }
  966. );
  967. var max$1 = Math.max;
  968. var min$2 = Math.min;
  969. var floor$1 = Math.floor;
  970. var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g;
  971. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g;
  972. var maybeToString = function (it) {
  973. return it === undefined ? it : String(it);
  974. };
  975. // @@replace logic
  976. fixRegexpWellKnownSymbolLogic(
  977. 'replace',
  978. 2,
  979. function (REPLACE, nativeReplace, maybeCallNative) {
  980. return [
  981. // `String.prototype.replace` method
  982. // https://tc39.github.io/ecma262/#sec-string.prototype.replace
  983. function replace(searchValue, replaceValue) {
  984. var O = requireObjectCoercible(this);
  985. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  986. return replacer !== undefined
  987. ? replacer.call(searchValue, O, replaceValue)
  988. : nativeReplace.call(String(O), searchValue, replaceValue);
  989. },
  990. // `RegExp.prototype[@@replace]` method
  991. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
  992. function (regexp, replaceValue) {
  993. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  994. if (res.done) return res.value;
  995. var rx = anObject(regexp);
  996. var S = String(this);
  997. var functionalReplace = typeof replaceValue === 'function';
  998. if (!functionalReplace) replaceValue = String(replaceValue);
  999. var global = rx.global;
  1000. if (global) {
  1001. var fullUnicode = rx.unicode;
  1002. rx.lastIndex = 0;
  1003. }
  1004. var results = [];
  1005. while (true) {
  1006. var result = regexpExecAbstract(rx, S);
  1007. if (result === null) break;
  1008. results.push(result);
  1009. if (!global) break;
  1010. var matchStr = String(result[0]);
  1011. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1012. }
  1013. var accumulatedResult = '';
  1014. var nextSourcePosition = 0;
  1015. for (var i = 0; i < results.length; i++) {
  1016. result = results[i];
  1017. var matched = String(result[0]);
  1018. var position = max$1(min$2(toInteger(result.index), S.length), 0);
  1019. var captures = [];
  1020. // NOTE: This is equivalent to
  1021. // captures = result.slice(1).map(maybeToString)
  1022. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  1023. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  1024. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  1025. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  1026. var namedCaptures = result.groups;
  1027. if (functionalReplace) {
  1028. var replacerArgs = [matched].concat(captures, position, S);
  1029. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  1030. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  1031. } else {
  1032. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  1033. }
  1034. if (position >= nextSourcePosition) {
  1035. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  1036. nextSourcePosition = position + matched.length;
  1037. }
  1038. }
  1039. return accumulatedResult + S.slice(nextSourcePosition);
  1040. }
  1041. ];
  1042. // https://tc39.github.io/ecma262/#sec-getsubstitution
  1043. function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
  1044. var tailPos = position + matched.length;
  1045. var m = captures.length;
  1046. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  1047. if (namedCaptures !== undefined) {
  1048. namedCaptures = toObject(namedCaptures);
  1049. symbols = SUBSTITUTION_SYMBOLS;
  1050. }
  1051. return nativeReplace.call(replacement, symbols, function (match, ch) {
  1052. var capture;
  1053. switch (ch.charAt(0)) {
  1054. case '$': return '$';
  1055. case '&': return matched;
  1056. case '`': return str.slice(0, position);
  1057. case "'": return str.slice(tailPos);
  1058. case '<':
  1059. capture = namedCaptures[ch.slice(1, -1)];
  1060. break;
  1061. default: // \d\d?
  1062. var n = +ch;
  1063. if (n === 0) return match;
  1064. if (n > m) {
  1065. var f = floor$1(n / 10);
  1066. if (f === 0) return match;
  1067. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  1068. return match;
  1069. }
  1070. capture = captures[n - 1];
  1071. }
  1072. return capture === undefined ? '' : capture;
  1073. });
  1074. }
  1075. }
  1076. );
  1077. var SPECIES$3 = wellKnownSymbol('species');
  1078. // `SpeciesConstructor` abstract operation
  1079. // https://tc39.github.io/ecma262/#sec-speciesconstructor
  1080. var speciesConstructor = function (O, defaultConstructor) {
  1081. var C = anObject(O).constructor;
  1082. var S;
  1083. return C === undefined || (S = anObject(C)[SPECIES$3]) == undefined ? defaultConstructor : aFunction(S);
  1084. };
  1085. var arrayPush = [].push;
  1086. var min$3 = Math.min;
  1087. var MAX_UINT32 = 0xffffffff;
  1088. // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
  1089. var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
  1090. // @@split logic
  1091. fixRegexpWellKnownSymbolLogic(
  1092. 'split',
  1093. 2,
  1094. function (SPLIT, nativeSplit, maybeCallNative) {
  1095. var internalSplit;
  1096. if (
  1097. 'abbc'.split(/(b)*/)[1] == 'c' ||
  1098. 'test'.split(/(?:)/, -1).length != 4 ||
  1099. 'ab'.split(/(?:ab)*/).length != 2 ||
  1100. '.'.split(/(.?)(.?)/).length != 4 ||
  1101. '.'.split(/()()/).length > 1 ||
  1102. ''.split(/.?/).length
  1103. ) {
  1104. // based on es5-shim implementation, need to rework it
  1105. internalSplit = function (separator, limit) {
  1106. var string = String(requireObjectCoercible(this));
  1107. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1108. if (lim === 0) return [];
  1109. if (separator === undefined) return [string];
  1110. // If `separator` is not a regex, use native split
  1111. if (!isRegexp(separator)) {
  1112. return nativeSplit.call(string, separator, lim);
  1113. }
  1114. var output = [];
  1115. var flags = (separator.ignoreCase ? 'i' : '') +
  1116. (separator.multiline ? 'm' : '') +
  1117. (separator.unicode ? 'u' : '') +
  1118. (separator.sticky ? 'y' : '');
  1119. var lastLastIndex = 0;
  1120. // Make `global` and avoid `lastIndex` issues by working with a copy
  1121. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1122. var match, lastIndex, lastLength;
  1123. while (match = regexpExec.call(separatorCopy, string)) {
  1124. lastIndex = separatorCopy.lastIndex;
  1125. if (lastIndex > lastLastIndex) {
  1126. output.push(string.slice(lastLastIndex, match.index));
  1127. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  1128. lastLength = match[0].length;
  1129. lastLastIndex = lastIndex;
  1130. if (output.length >= lim) break;
  1131. }
  1132. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1133. }
  1134. if (lastLastIndex === string.length) {
  1135. if (lastLength || !separatorCopy.test('')) output.push('');
  1136. } else output.push(string.slice(lastLastIndex));
  1137. return output.length > lim ? output.slice(0, lim) : output;
  1138. };
  1139. // Chakra, V8
  1140. } else if ('0'.split(undefined, 0).length) {
  1141. internalSplit = function (separator, limit) {
  1142. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  1143. };
  1144. } else internalSplit = nativeSplit;
  1145. return [
  1146. // `String.prototype.split` method
  1147. // https://tc39.github.io/ecma262/#sec-string.prototype.split
  1148. function split(separator, limit) {
  1149. var O = requireObjectCoercible(this);
  1150. var splitter = separator == undefined ? undefined : separator[SPLIT];
  1151. return splitter !== undefined
  1152. ? splitter.call(separator, O, limit)
  1153. : internalSplit.call(String(O), separator, limit);
  1154. },
  1155. // `RegExp.prototype[@@split]` method
  1156. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
  1157. //
  1158. // NOTE: This cannot be properly polyfilled in engines that don't support
  1159. // the 'y' flag.
  1160. function (regexp, limit) {
  1161. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
  1162. if (res.done) return res.value;
  1163. var rx = anObject(regexp);
  1164. var S = String(this);
  1165. var C = speciesConstructor(rx, RegExp);
  1166. var unicodeMatching = rx.unicode;
  1167. var flags = (rx.ignoreCase ? 'i' : '') +
  1168. (rx.multiline ? 'm' : '') +
  1169. (rx.unicode ? 'u' : '') +
  1170. (SUPPORTS_Y ? 'y' : 'g');
  1171. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1172. // simulate the 'y' flag.
  1173. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
  1174. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1175. if (lim === 0) return [];
  1176. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1177. var p = 0;
  1178. var q = 0;
  1179. var A = [];
  1180. while (q < S.length) {
  1181. splitter.lastIndex = SUPPORTS_Y ? q : 0;
  1182. var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
  1183. var e;
  1184. if (
  1185. z === null ||
  1186. (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
  1187. ) {
  1188. q = advanceStringIndex(S, q, unicodeMatching);
  1189. } else {
  1190. A.push(S.slice(p, q));
  1191. if (A.length === lim) return A;
  1192. for (var i = 1; i <= z.length - 1; i++) {
  1193. A.push(z[i]);
  1194. if (A.length === lim) return A;
  1195. }
  1196. q = p = e;
  1197. }
  1198. }
  1199. A.push(S.slice(p));
  1200. return A;
  1201. }
  1202. ];
  1203. },
  1204. !SUPPORTS_Y
  1205. );
  1206. // a string of all valid unicode whitespaces
  1207. // eslint-disable-next-line max-len
  1208. 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';
  1209. var whitespace = '[' + whitespaces + ']';
  1210. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  1211. var rtrim = RegExp(whitespace + whitespace + '*$');
  1212. // 1 -> String#trimStart
  1213. // 2 -> String#trimEnd
  1214. // 3 -> String#trim
  1215. var stringTrim = function (string, TYPE) {
  1216. string = String(requireObjectCoercible(string));
  1217. if (TYPE & 1) string = string.replace(ltrim, '');
  1218. if (TYPE & 2) string = string.replace(rtrim, '');
  1219. return string;
  1220. };
  1221. var non = '\u200b\u0085\u180e';
  1222. // check that a method works with the correct list
  1223. // of whitespaces and has a correct name
  1224. var forcedStringTrimMethod = function (METHOD_NAME) {
  1225. return fails(function () {
  1226. return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
  1227. });
  1228. };
  1229. var FORCED$1 = forcedStringTrimMethod('trim');
  1230. // `String.prototype.trim` method
  1231. // https://tc39.github.io/ecma262/#sec-string.prototype.trim
  1232. _export({ target: 'String', proto: true, forced: FORCED$1 }, {
  1233. trim: function trim() {
  1234. return stringTrim(this, 3);
  1235. }
  1236. });
  1237. // iterable DOM collections
  1238. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  1239. var domIterables = {
  1240. CSSRuleList: 0,
  1241. CSSStyleDeclaration: 0,
  1242. CSSValueList: 0,
  1243. ClientRectList: 0,
  1244. DOMRectList: 0,
  1245. DOMStringList: 0,
  1246. DOMTokenList: 1,
  1247. DataTransferItemList: 0,
  1248. FileList: 0,
  1249. HTMLAllCollection: 0,
  1250. HTMLCollection: 0,
  1251. HTMLFormElement: 0,
  1252. HTMLSelectElement: 0,
  1253. MediaList: 0,
  1254. MimeTypeArray: 0,
  1255. NamedNodeMap: 0,
  1256. NodeList: 1,
  1257. PaintRequestList: 0,
  1258. Plugin: 0,
  1259. PluginArray: 0,
  1260. SVGLengthList: 0,
  1261. SVGNumberList: 0,
  1262. SVGPathSegList: 0,
  1263. SVGPointList: 0,
  1264. SVGStringList: 0,
  1265. SVGTransformList: 0,
  1266. SourceBufferList: 0,
  1267. StyleSheetList: 0,
  1268. TextTrackCueList: 0,
  1269. TextTrackList: 0,
  1270. TouchList: 0
  1271. };
  1272. var nativeForEach = [].forEach;
  1273. var internalForEach = arrayMethods(0);
  1274. var SLOPPY_METHOD$3 = sloppyArrayMethod('forEach');
  1275. // `Array.prototype.forEach` method implementation
  1276. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  1277. var arrayForEach = SLOPPY_METHOD$3 ? function forEach(callbackfn /* , thisArg */) {
  1278. return internalForEach(this, callbackfn, arguments[1]);
  1279. } : nativeForEach;
  1280. for (var COLLECTION_NAME in domIterables) {
  1281. var Collection = global[COLLECTION_NAME];
  1282. var CollectionPrototype = Collection && Collection.prototype;
  1283. // some Chrome versions have non-configurable methods on DOMTokenList
  1284. if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
  1285. hide(CollectionPrototype, 'forEach', arrayForEach);
  1286. } catch (e) {
  1287. CollectionPrototype.forEach = arrayForEach;
  1288. }
  1289. }
  1290. function _typeof(obj) {
  1291. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  1292. _typeof = function (obj) {
  1293. return typeof obj;
  1294. };
  1295. } else {
  1296. _typeof = function (obj) {
  1297. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  1298. };
  1299. }
  1300. return _typeof(obj);
  1301. }
  1302. function _classCallCheck(instance, Constructor) {
  1303. if (!(instance instanceof Constructor)) {
  1304. throw new TypeError("Cannot call a class as a function");
  1305. }
  1306. }
  1307. function _defineProperties(target, props) {
  1308. for (var i = 0; i < props.length; i++) {
  1309. var descriptor = props[i];
  1310. descriptor.enumerable = descriptor.enumerable || false;
  1311. descriptor.configurable = true;
  1312. if ("value" in descriptor) descriptor.writable = true;
  1313. Object.defineProperty(target, descriptor.key, descriptor);
  1314. }
  1315. }
  1316. function _createClass(Constructor, protoProps, staticProps) {
  1317. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1318. if (staticProps) _defineProperties(Constructor, staticProps);
  1319. return Constructor;
  1320. }
  1321. function _inherits(subClass, superClass) {
  1322. if (typeof superClass !== "function" && superClass !== null) {
  1323. throw new TypeError("Super expression must either be null or a function");
  1324. }
  1325. subClass.prototype = Object.create(superClass && superClass.prototype, {
  1326. constructor: {
  1327. value: subClass,
  1328. writable: true,
  1329. configurable: true
  1330. }
  1331. });
  1332. if (superClass) _setPrototypeOf(subClass, superClass);
  1333. }
  1334. function _getPrototypeOf(o) {
  1335. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  1336. return o.__proto__ || Object.getPrototypeOf(o);
  1337. };
  1338. return _getPrototypeOf(o);
  1339. }
  1340. function _setPrototypeOf(o, p) {
  1341. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  1342. o.__proto__ = p;
  1343. return o;
  1344. };
  1345. return _setPrototypeOf(o, p);
  1346. }
  1347. function _assertThisInitialized(self) {
  1348. if (self === void 0) {
  1349. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  1350. }
  1351. return self;
  1352. }
  1353. function _possibleConstructorReturn(self, call) {
  1354. if (call && (typeof call === "object" || typeof call === "function")) {
  1355. return call;
  1356. }
  1357. return _assertThisInitialized(self);
  1358. }
  1359. function _superPropBase(object, property) {
  1360. while (!Object.prototype.hasOwnProperty.call(object, property)) {
  1361. object = _getPrototypeOf(object);
  1362. if (object === null) break;
  1363. }
  1364. return object;
  1365. }
  1366. function _get(target, property, receiver) {
  1367. if (typeof Reflect !== "undefined" && Reflect.get) {
  1368. _get = Reflect.get;
  1369. } else {
  1370. _get = function _get(target, property, receiver) {
  1371. var base = _superPropBase(target, property);
  1372. if (!base) return;
  1373. var desc = Object.getOwnPropertyDescriptor(base, property);
  1374. if (desc.get) {
  1375. return desc.get.call(receiver);
  1376. }
  1377. return desc.value;
  1378. };
  1379. }
  1380. return _get(target, property, receiver || target);
  1381. }
  1382. /**
  1383. * @author: Dennis Hernández
  1384. * @webSite: http://djhvscf.github.io/Blog
  1385. * @version: v2.2.0
  1386. */
  1387. var Utils = $.fn.bootstrapTable.utils;
  1388. var UtilsFilterControl = {
  1389. getOptionsFromSelectControl: function getOptionsFromSelectControl(selectControl) {
  1390. return selectControl.get(selectControl.length - 1).options;
  1391. },
  1392. hideUnusedSelectOptions: function hideUnusedSelectOptions(selectControl, uniqueValues) {
  1393. var options = UtilsFilterControl.getOptionsFromSelectControl(selectControl);
  1394. for (var i = 0; i < options.length; i++) {
  1395. if (options[i].value !== '') {
  1396. if (!uniqueValues.hasOwnProperty(options[i].value)) {
  1397. selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
  1398. } else {
  1399. selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
  1400. }
  1401. }
  1402. }
  1403. },
  1404. addOptionToSelectControl: function addOptionToSelectControl(selectControl, _value, text, selected) {
  1405. var value = $.trim(_value);
  1406. var $selectControl = $(selectControl.get(selectControl.length - 1));
  1407. if (!UtilsFilterControl.existOptionInSelectControl(selectControl, value)) {
  1408. var option = $($('<option></option>').attr('value', value).text($('<div />').html(text).text()));
  1409. if (value === selected) {
  1410. option.attr('selected', true);
  1411. }
  1412. $selectControl.append(option);
  1413. }
  1414. },
  1415. sortSelectControl: function sortSelectControl(selectControl, orderBy) {
  1416. var $selectControl = $(selectControl.get(selectControl.length - 1));
  1417. var $opts = $selectControl.find('option:gt(0)');
  1418. $opts.sort(function (a, b) {
  1419. return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1);
  1420. });
  1421. $selectControl.find('option:gt(0)').remove();
  1422. $selectControl.append($opts);
  1423. },
  1424. existOptionInSelectControl: function existOptionInSelectControl(selectControl, value) {
  1425. var options = UtilsFilterControl.getOptionsFromSelectControl(selectControl);
  1426. for (var i = 0; i < options.length; i++) {
  1427. if (options[i].value === value.toString()) {
  1428. // The value is not valid to add
  1429. return true;
  1430. }
  1431. } // If we get here, the value is valid to add
  1432. return false;
  1433. },
  1434. fixHeaderCSS: function fixHeaderCSS(_ref) {
  1435. var $tableHeader = _ref.$tableHeader;
  1436. $tableHeader.css('height', '77px');
  1437. },
  1438. getCurrentHeader: function getCurrentHeader(_ref2) {
  1439. var $header = _ref2.$header,
  1440. options = _ref2.options,
  1441. $tableHeader = _ref2.$tableHeader;
  1442. var header = $header;
  1443. if (options.height) {
  1444. header = $tableHeader;
  1445. }
  1446. return header;
  1447. },
  1448. getCurrentSearchControls: function getCurrentSearchControls(_ref3) {
  1449. var options = _ref3.options;
  1450. var searchControls = 'select, input';
  1451. if (options.height) {
  1452. searchControls = 'table select, table input';
  1453. }
  1454. return searchControls;
  1455. },
  1456. getCursorPosition: function getCursorPosition(el) {
  1457. if (Utils.isIEBrowser()) {
  1458. if ($(el).is('input[type=text]')) {
  1459. var pos = 0;
  1460. if ('selectionStart' in el) {
  1461. pos = el.selectionStart;
  1462. } else if ('selection' in document) {
  1463. el.focus();
  1464. var Sel = document.selection.createRange();
  1465. var SelLength = document.selection.createRange().text.length;
  1466. Sel.moveStart('character', -el.value.length);
  1467. pos = Sel.text.length - SelLength;
  1468. }
  1469. return pos;
  1470. }
  1471. return -1;
  1472. }
  1473. return -1;
  1474. },
  1475. setCursorPosition: function setCursorPosition(el) {
  1476. $(el).val(el.value);
  1477. },
  1478. copyValues: function copyValues(that) {
  1479. var header = UtilsFilterControl.getCurrentHeader(that);
  1480. var searchControls = UtilsFilterControl.getCurrentSearchControls(that);
  1481. that.options.valuesFilterControl = [];
  1482. header.find(searchControls).each(function () {
  1483. that.options.valuesFilterControl.push({
  1484. field: $(this).closest('[data-field]').data('field'),
  1485. value: $(this).val(),
  1486. position: UtilsFilterControl.getCursorPosition($(this).get(0)),
  1487. hasFocus: $(this).is(':focus')
  1488. });
  1489. });
  1490. },
  1491. setValues: function setValues(that) {
  1492. var field = null;
  1493. var result = [];
  1494. var header = UtilsFilterControl.getCurrentHeader(that);
  1495. var searchControls = UtilsFilterControl.getCurrentSearchControls(that);
  1496. if (that.options.valuesFilterControl.length > 0) {
  1497. // Callback to apply after settings fields values
  1498. var fieldToFocusCallback = null;
  1499. header.find(searchControls).each(function (index, ele) {
  1500. field = $(this).closest('[data-field]').data('field');
  1501. result = that.options.valuesFilterControl.filter(function (valueObj) {
  1502. return valueObj.field === field;
  1503. });
  1504. if (result.length > 0) {
  1505. $(this).val(result[0].value);
  1506. if (result[0].hasFocus) {
  1507. // set callback if the field had the focus.
  1508. fieldToFocusCallback = function (fieldToFocus, carretPosition) {
  1509. // Closure here to capture the field and cursor position
  1510. var closedCallback = function closedCallback() {
  1511. fieldToFocus.focus();
  1512. UtilsFilterControl.setCursorPosition(fieldToFocus, carretPosition);
  1513. };
  1514. return closedCallback;
  1515. }($(this).get(0), result[0].position);
  1516. }
  1517. }
  1518. }); // Callback call.
  1519. if (fieldToFocusCallback !== null) {
  1520. fieldToFocusCallback();
  1521. }
  1522. }
  1523. },
  1524. collectBootstrapCookies: function collectBootstrapCookies() {
  1525. var cookies = [];
  1526. var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
  1527. if (foundCookies) {
  1528. $.each(foundCookies, function (i, _cookie) {
  1529. var cookie = _cookie;
  1530. if (/./.test(cookie)) {
  1531. cookie = cookie.split('.').pop();
  1532. }
  1533. if ($.inArray(cookie, cookies) === -1) {
  1534. cookies.push(cookie);
  1535. }
  1536. });
  1537. return cookies;
  1538. }
  1539. },
  1540. escapeID: function escapeID(id) {
  1541. return String(id).replace(/(:|\.|\[|\]|,)/g, '\\$1');
  1542. },
  1543. isColumnSearchableViaSelect: function isColumnSearchableViaSelect(_ref4) {
  1544. var filterControl = _ref4.filterControl,
  1545. searchable = _ref4.searchable;
  1546. return filterControl && filterControl.toLowerCase() === 'select' && searchable;
  1547. },
  1548. isFilterDataNotGiven: function isFilterDataNotGiven(_ref5) {
  1549. var filterData = _ref5.filterData;
  1550. return filterData === undefined || filterData.toLowerCase() === 'column';
  1551. },
  1552. hasSelectControlElement: function hasSelectControlElement(selectControl) {
  1553. return selectControl && selectControl.length > 0;
  1554. },
  1555. initFilterSelectControls: function initFilterSelectControls(that) {
  1556. var data = that.data;
  1557. var itemsPerPage = that.pageTo < that.options.data.length ? that.options.data.length : that.pageTo;
  1558. var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
  1559. $.each(that.header.fields, function (j, field) {
  1560. var column = that.columns[that.fieldsColumnsIndex[field]];
  1561. var selectControl = $(".bootstrap-table-filter-control-".concat(UtilsFilterControl.escapeID(column.field)));
  1562. if (UtilsFilterControl.isColumnSearchableViaSelect(column) && UtilsFilterControl.isFilterDataNotGiven(column) && UtilsFilterControl.hasSelectControlElement(selectControl)) {
  1563. if (selectControl.get(selectControl.length - 1).options.length === 0) {
  1564. // Added the default option
  1565. UtilsFilterControl.addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
  1566. }
  1567. var uniqueValues = {};
  1568. for (var i = 0; i < z; i++) {
  1569. // Added a new value
  1570. var fieldValue = data[i][field];
  1571. var formattedValue = Utils.calculateObjectValue(that.header, that.header.formatters[j], [fieldValue, data[i], i], fieldValue);
  1572. if (column.filterDataCollector) {
  1573. formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
  1574. }
  1575. if (_typeof(formattedValue) === 'object') {
  1576. formattedValue.forEach(function (value) {
  1577. UtilsFilterControl.addOptionToSelectControl(selectControl, value, value, column.filterDefault);
  1578. });
  1579. continue;
  1580. }
  1581. UtilsFilterControl.addOptionToSelectControl(selectControl, fieldValue, formattedValue, column.filterDefault);
  1582. }
  1583. UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
  1584. if (that.options.hideUnusedSelectOptions) {
  1585. UtilsFilterControl.hideUnusedSelectOptions(selectControl, uniqueValues);
  1586. }
  1587. }
  1588. });
  1589. that.trigger('created-controls');
  1590. },
  1591. getFilterDataMethod: function getFilterDataMethod(objFilterDataMethod, searchTerm) {
  1592. var keys = Object.keys(objFilterDataMethod);
  1593. for (var i = 0; i < keys.length; i++) {
  1594. if (keys[i] === searchTerm) {
  1595. return objFilterDataMethod[searchTerm];
  1596. }
  1597. }
  1598. return null;
  1599. },
  1600. createControls: function createControls(that, header) {
  1601. var addedFilterControl = false;
  1602. var isVisible;
  1603. var html;
  1604. $.each(that.columns, function (i, column) {
  1605. isVisible = 'hidden';
  1606. html = [];
  1607. if (!column.visible) {
  1608. return;
  1609. }
  1610. if (!column.filterControl) {
  1611. html.push('<div class="no-filter-control"></div>');
  1612. } else {
  1613. html.push('<div class="filter-control">');
  1614. var nameControl = column.filterControl.toLowerCase();
  1615. if (column.searchable && that.options.filterTemplate[nameControl]) {
  1616. addedFilterControl = true;
  1617. isVisible = 'visible';
  1618. html.push(that.options.filterTemplate[nameControl](that, column.field, isVisible, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
  1619. if ('' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
  1620. if ($.isEmptyObject(that.filterColumnsPartial)) {
  1621. that.filterColumnsPartial = {};
  1622. }
  1623. that.filterColumnsPartial[column.field] = column.filterDefault;
  1624. }
  1625. }
  1626. }
  1627. $.each(header.children().children(), function (i, tr) {
  1628. var $tr = $(tr);
  1629. if ($tr.data('field') === column.field) {
  1630. $tr.find('.fht-cell').append(html.join(''));
  1631. return false;
  1632. }
  1633. });
  1634. if (column.filterData !== undefined && column.filterData.toLowerCase() !== 'column') {
  1635. var filterDataType = UtilsFilterControl.getFilterDataMethod(
  1636. /* eslint-disable no-use-before-define */
  1637. filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
  1638. var filterDataSource;
  1639. var selectControl;
  1640. if (filterDataType !== null) {
  1641. filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
  1642. selectControl = $(".bootstrap-table-filter-control-".concat(UtilsFilterControl.escapeID(column.field)));
  1643. UtilsFilterControl.addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
  1644. filterDataType(filterDataSource, selectControl, column.filterDefault);
  1645. } else {
  1646. throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, json, url.' + ' Use like this: var: {key: "value"}');
  1647. }
  1648. var variableValues;
  1649. var key; // eslint-disable-next-line default-case
  1650. switch (filterDataType) {
  1651. case 'url':
  1652. $.ajax({
  1653. url: filterDataSource,
  1654. dataType: 'json',
  1655. success: function success(data) {
  1656. // eslint-disable-next-line guard-for-in
  1657. for (var _key in data) {
  1658. UtilsFilterControl.addOptionToSelectControl(selectControl, _key, data[_key], column.filterDefault);
  1659. }
  1660. UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
  1661. }
  1662. });
  1663. break;
  1664. case 'var':
  1665. variableValues = window[filterDataSource]; // eslint-disable-next-line guard-for-in
  1666. for (key in variableValues) {
  1667. UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], column.filterDefault);
  1668. }
  1669. UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
  1670. break;
  1671. case 'jso':
  1672. variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
  1673. for (key in variableValues) {
  1674. UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], column.filterDefault);
  1675. }
  1676. UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
  1677. break;
  1678. }
  1679. }
  1680. });
  1681. if (addedFilterControl) {
  1682. header.off('keyup', 'input').on('keyup', 'input', function (event, obj) {
  1683. // Simulate enter key action from clear button
  1684. event.keyCode = obj ? obj.keyCode : event.keyCode;
  1685. if (that.options.searchOnEnterKey && event.keyCode !== 13) {
  1686. return;
  1687. }
  1688. if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
  1689. return;
  1690. }
  1691. var $currentTarget = $(event.currentTarget);
  1692. if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
  1693. return;
  1694. }
  1695. clearTimeout(event.currentTarget.timeoutId || 0);
  1696. event.currentTarget.timeoutId = setTimeout(function () {
  1697. that.onColumnSearch(event);
  1698. }, that.options.searchTimeOut);
  1699. });
  1700. header.off('change', 'select').on('change', 'select', function (event) {
  1701. if (that.options.searchOnEnterKey && event.keyCode !== 13) {
  1702. return;
  1703. }
  1704. if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
  1705. return;
  1706. }
  1707. clearTimeout(event.currentTarget.timeoutId || 0);
  1708. event.currentTarget.timeoutId = setTimeout(function () {
  1709. that.onColumnSearch(event);
  1710. }, that.options.searchTimeOut);
  1711. });
  1712. header.off('mouseup', 'input').on('mouseup', 'input', function (event) {
  1713. var $input = $(this);
  1714. var oldValue = $input.val();
  1715. if (oldValue === '') {
  1716. return;
  1717. }
  1718. setTimeout(function () {
  1719. var newValue = $input.val();
  1720. if (newValue === '') {
  1721. clearTimeout(event.currentTarget.timeoutId || 0);
  1722. event.currentTarget.timeoutId = setTimeout(function () {
  1723. that.onColumnSearch(event);
  1724. }, that.options.searchTimeOut);
  1725. }
  1726. }, 1);
  1727. });
  1728. if (header.find('.date-filter-control').length > 0) {
  1729. $.each(that.columns, function (i, _ref6) {
  1730. var filterControl = _ref6.filterControl,
  1731. field = _ref6.field,
  1732. filterDatepickerOptions = _ref6.filterDatepickerOptions;
  1733. if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
  1734. header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field)).datepicker(filterDatepickerOptions).on('changeDate', function (event) {
  1735. clearTimeout(event.currentTarget.timeoutId || 0);
  1736. event.currentTarget.timeoutId = setTimeout(function () {
  1737. that.onColumnSearch(event);
  1738. }, that.options.searchTimeOut);
  1739. });
  1740. }
  1741. });
  1742. }
  1743. if (that.options.sidePagination !== 'server') {
  1744. header.find('[class*=\'bootstrap-table-filter-control\']').each(function (k, input) {
  1745. $(input).trigger('change');
  1746. });
  1747. }
  1748. } else {
  1749. header.find('.filterControl').hide();
  1750. }
  1751. },
  1752. getDirectionOfSelectOptions: function getDirectionOfSelectOptions(_alignment) {
  1753. var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
  1754. switch (alignment) {
  1755. case 'left':
  1756. return 'ltr';
  1757. case 'right':
  1758. return 'rtl';
  1759. case 'auto':
  1760. return 'auto';
  1761. default:
  1762. return 'ltr';
  1763. }
  1764. }
  1765. };
  1766. var filterDataMethods = {
  1767. var: function _var(filterDataSource, selectControl, filterOrderBy, selected) {
  1768. var variableValues = window[filterDataSource]; // eslint-disable-next-line guard-for-in
  1769. for (var key in variableValues) {
  1770. UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  1771. }
  1772. UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
  1773. },
  1774. url: function url(filterDataSource, selectControl, filterOrderBy, selected) {
  1775. $.ajax({
  1776. url: filterDataSource,
  1777. dataType: 'json',
  1778. success: function success(data) {
  1779. // eslint-disable-next-line guard-for-in
  1780. for (var key in data) {
  1781. UtilsFilterControl.addOptionToSelectControl(selectControl, key, data[key], selected);
  1782. }
  1783. UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
  1784. }
  1785. });
  1786. },
  1787. json: function json(filterDataSource, selectControl, filterOrderBy, selected) {
  1788. var variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
  1789. for (var key in variableValues) {
  1790. UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  1791. }
  1792. UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
  1793. }
  1794. };
  1795. $.extend($.fn.bootstrapTable.defaults, {
  1796. filterControl: false,
  1797. onColumnSearch: function onColumnSearch(field, text) {
  1798. return false;
  1799. },
  1800. onCreatedControls: function onCreatedControls() {
  1801. return true;
  1802. },
  1803. alignmentSelectControlOptions: undefined,
  1804. filterTemplate: {
  1805. input: function input(that, field, isVisible, placeholder, value) {
  1806. return Utils.sprintf('<input type="text" class="form-control bootstrap-table-filter-control-%s" style="width: 100%; visibility: %s" placeholder="%s" value="%s">', field, isVisible, 'undefined' === typeof placeholder ? '' : placeholder, 'undefined' === typeof value ? '' : value);
  1807. },
  1808. select: function select(_ref7, field, isVisible) {
  1809. var options = _ref7.options;
  1810. return Utils.sprintf('<select class="form-control bootstrap-table-filter-control-%s" style="width: 100%; visibility: %s" dir="%s"></select>', field, isVisible, UtilsFilterControl.getDirectionOfSelectOptions(options.alignmentSelectControlOptions));
  1811. },
  1812. datepicker: function datepicker(that, field, isVisible, value) {
  1813. return Utils.sprintf('<input type="text" class="form-control date-filter-control bootstrap-table-filter-control-%s" style="width: 100%; visibility: %s" value="%s">', field, isVisible, 'undefined' === typeof value ? '' : value);
  1814. }
  1815. },
  1816. disableControlWhenSearch: false,
  1817. searchOnEnterKey: false,
  1818. // internal variables
  1819. valuesFilterControl: []
  1820. });
  1821. $.extend($.fn.bootstrapTable.columnDefaults, {
  1822. filterControl: undefined,
  1823. filterDataCollector: undefined,
  1824. filterData: undefined,
  1825. filterDatepickerOptions: undefined,
  1826. filterStrictSearch: false,
  1827. filterStartsWithSearch: false,
  1828. filterControlPlaceholder: '',
  1829. filterDefault: '',
  1830. filterOrderBy: 'asc' // asc || desc
  1831. });
  1832. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  1833. 'column-search.bs.table': 'onColumnSearch',
  1834. 'created-controls.bs.table': 'onCreatedControls'
  1835. });
  1836. $.extend($.fn.bootstrapTable.defaults.icons, {
  1837. clear: {
  1838. bootstrap3: 'glyphicon-trash icon-clear'
  1839. }[$.fn.bootstrapTable.theme] || 'fa-trash'
  1840. });
  1841. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  1842. $.extend($.fn.bootstrapTable.defaults, {
  1843. formatClearSearch: function formatClearSearch() {
  1844. return 'Clear filters';
  1845. }
  1846. });
  1847. $.fn.bootstrapTable.methods.push('triggerSearch');
  1848. $.fn.bootstrapTable.methods.push('clearFilterControl');
  1849. $.BootstrapTable =
  1850. /*#__PURE__*/
  1851. function (_$$BootstrapTable) {
  1852. _inherits(_class, _$$BootstrapTable);
  1853. function _class() {
  1854. _classCallCheck(this, _class);
  1855. return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
  1856. }
  1857. _createClass(_class, [{
  1858. key: "init",
  1859. value: function init() {
  1860. var _this = this;
  1861. // Make sure that the filterControl option is set
  1862. if (this.options.filterControl) {
  1863. var that = this; // Make sure that the internal variables are set correctly
  1864. this.options.valuesFilterControl = [];
  1865. this.$el.on('reset-view.bs.table', function () {
  1866. // Create controls on $tableHeader if the height is set
  1867. if (!that.options.height) {
  1868. return;
  1869. } // Avoid recreate the controls
  1870. if (that.$tableHeader.find('select').length > 0 || that.$tableHeader.find('input').length > 0) {
  1871. return;
  1872. }
  1873. UtilsFilterControl.createControls(that, that.$tableHeader);
  1874. }).on('post-header.bs.table', function () {
  1875. UtilsFilterControl.setValues(that);
  1876. }).on('post-body.bs.table', function () {
  1877. if (that.options.height) {
  1878. UtilsFilterControl.fixHeaderCSS(that);
  1879. }
  1880. _this.$tableLoading.css('top', _this.$header.outerHeight() + 1);
  1881. }).on('column-switch.bs.table', function () {
  1882. UtilsFilterControl.setValues(that);
  1883. }).on('load-success.bs.table', function () {
  1884. that.EnableControls(true);
  1885. }).on('load-error.bs.table', function () {
  1886. that.EnableControls(true);
  1887. });
  1888. }
  1889. _get(_getPrototypeOf(_class.prototype), "init", this).call(this);
  1890. }
  1891. }, {
  1892. key: "initHeader",
  1893. value: function initHeader() {
  1894. _get(_getPrototypeOf(_class.prototype), "initHeader", this).call(this);
  1895. if (!this.options.filterControl) {
  1896. return;
  1897. }
  1898. UtilsFilterControl.createControls(this, this.$header);
  1899. }
  1900. }, {
  1901. key: "initBody",
  1902. value: function initBody() {
  1903. _get(_getPrototypeOf(_class.prototype), "initBody", this).call(this);
  1904. UtilsFilterControl.initFilterSelectControls(this);
  1905. }
  1906. }, {
  1907. key: "initSearch",
  1908. value: function initSearch() {
  1909. var that = this;
  1910. var fp = $.isEmptyObject(that.filterColumnsPartial) ? null : that.filterColumnsPartial;
  1911. if (fp === null || Object.keys(fp).length <= 1) {
  1912. _get(_getPrototypeOf(_class.prototype), "initSearch", this).call(this);
  1913. }
  1914. if (this.options.sidePagination === 'server') {
  1915. return;
  1916. }
  1917. if (fp === null) {
  1918. return;
  1919. } // Check partial column filter
  1920. that.data = fp ? that.options.data.filter(function (item, i) {
  1921. var itemIsExpected = [];
  1922. Object.keys(item).forEach(function (x, index) {
  1923. var key = that.header.fields[index];
  1924. var thisColumn = that.columns[that.fieldsColumnsIndex[key]];
  1925. var fval = (fp[key] || '').toLowerCase();
  1926. var value = Utils.getItemField(item, key, false);
  1927. if (fval === '') {
  1928. itemIsExpected.push(true);
  1929. } else {
  1930. // Fix #142: search use formated data
  1931. if (thisColumn && thisColumn.searchFormatter) {
  1932. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(key, that.header.fields)], [value, item, i], value);
  1933. }
  1934. if ($.inArray(key, that.header.fields) !== -1) {
  1935. if (value === undefined || value === null) {
  1936. itemIsExpected.push(false);
  1937. } else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
  1938. if (thisColumn.filterStrictSearch) {
  1939. itemIsExpected.push(value.toString().toLowerCase() === fval.toString().toLowerCase());
  1940. } else if (thisColumn.filterStartsWithSearch) {
  1941. itemIsExpected.push("".concat(value).toLowerCase().indexOf(fval) === 0);
  1942. } else {
  1943. itemIsExpected.push("".concat(value).toLowerCase().includes(fval));
  1944. }
  1945. }
  1946. }
  1947. }
  1948. });
  1949. return !itemIsExpected.includes(false);
  1950. }) : that.data;
  1951. }
  1952. }, {
  1953. key: "initColumnSearch",
  1954. value: function initColumnSearch(filterColumnsDefaults) {
  1955. UtilsFilterControl.copyValues(this);
  1956. if (filterColumnsDefaults) {
  1957. this.filterColumnsPartial = filterColumnsDefaults;
  1958. this.updatePagination(); // eslint-disable-next-line guard-for-in
  1959. for (var filter in filterColumnsDefaults) {
  1960. this.trigger('column-search', filter, filterColumnsDefaults[filter]);
  1961. }
  1962. }
  1963. }
  1964. }, {
  1965. key: "onColumnSearch",
  1966. value: function onColumnSearch(event) {
  1967. if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
  1968. return;
  1969. }
  1970. UtilsFilterControl.copyValues(this);
  1971. var text = $.trim($(event.currentTarget).val());
  1972. var $field = $(event.currentTarget).closest('[data-field]').data('field');
  1973. if ($.isEmptyObject(this.filterColumnsPartial)) {
  1974. this.filterColumnsPartial = {};
  1975. }
  1976. if (text) {
  1977. this.filterColumnsPartial[$field] = text;
  1978. } else {
  1979. delete this.filterColumnsPartial[$field];
  1980. }
  1981. this.options.pageNumber = 1;
  1982. this.EnableControls(false);
  1983. this.onSearch(event, false);
  1984. this.trigger('column-search', $field, text);
  1985. }
  1986. }, {
  1987. key: "resetSearch",
  1988. value: function resetSearch() {
  1989. if (this.options.filterControl && this.options.showSearchClearButton) {
  1990. this.clearFilterControl();
  1991. }
  1992. _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this);
  1993. }
  1994. }, {
  1995. key: "clearFilterControl",
  1996. value: function clearFilterControl() {
  1997. if (this.options.filterControl) {
  1998. var that = this;
  1999. var cookies = UtilsFilterControl.collectBootstrapCookies();
  2000. var header = UtilsFilterControl.getCurrentHeader(that);
  2001. var table = header.closest('table');
  2002. var controls = header.find(UtilsFilterControl.getCurrentSearchControls(that));
  2003. var search = that.$toolbar.find('.search input');
  2004. var hasValues = false;
  2005. var timeoutId = 0;
  2006. $.each(that.options.valuesFilterControl, function (i, item) {
  2007. hasValues = hasValues ? true : item.value !== '';
  2008. item.value = '';
  2009. });
  2010. $.each(that.options.filterControls, function (i, item) {
  2011. item.text = '';
  2012. });
  2013. UtilsFilterControl.setValues(that); // clear cookies once the filters are clean
  2014. clearTimeout(timeoutId);
  2015. timeoutId = setTimeout(function () {
  2016. if (cookies && cookies.length > 0) {
  2017. $.each(cookies, function (i, item) {
  2018. if (that.deleteCookie !== undefined) {
  2019. that.deleteCookie(item);
  2020. }
  2021. });
  2022. }
  2023. }, that.options.searchTimeOut); // If there is not any value in the controls exit this method
  2024. if (!hasValues) {
  2025. return;
  2026. } // Clear each type of filter if it exists.
  2027. // Requires the body to reload each time a type of filter is found because we never know
  2028. // which ones are going to be present.
  2029. if (controls.length > 0) {
  2030. this.filterColumnsPartial = {};
  2031. $(controls[0]).trigger(controls[0].tagName === 'INPUT' ? 'keyup' : 'change', {
  2032. keyCode: 13
  2033. });
  2034. } else {
  2035. return;
  2036. }
  2037. if (search.length > 0) {
  2038. that.resetSearch();
  2039. } // use the default sort order if it exists. do nothing if it does not
  2040. if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
  2041. var sorter = header.find(Utils.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')));
  2042. if (sorter.length > 0) {
  2043. that.onSort({
  2044. type: 'keypress',
  2045. currentTarget: sorter
  2046. });
  2047. $(sorter).find('.sortable').trigger('click');
  2048. }
  2049. }
  2050. }
  2051. }
  2052. }, {
  2053. key: "triggerSearch",
  2054. value: function triggerSearch() {
  2055. var header = UtilsFilterControl.getCurrentHeader(this);
  2056. var searchControls = UtilsFilterControl.getCurrentSearchControls(this);
  2057. header.find(searchControls).each(function () {
  2058. var el = $(this);
  2059. if (el.is('select')) {
  2060. el.change();
  2061. } else {
  2062. el.keyup();
  2063. }
  2064. });
  2065. }
  2066. }, {
  2067. key: "EnableControls",
  2068. value: function EnableControls(enable) {
  2069. if (this.options.disableControlWhenSearch && this.options.sidePagination === 'server') {
  2070. var header = UtilsFilterControl.getCurrentHeader(this);
  2071. var searchControls = UtilsFilterControl.getCurrentSearchControls(this);
  2072. if (!enable) {
  2073. header.find(searchControls).prop('disabled', 'disabled');
  2074. } else {
  2075. header.find(searchControls).removeProp('disabled');
  2076. }
  2077. }
  2078. }
  2079. }]);
  2080. return _class;
  2081. }($.BootstrapTable);
  2082. }));