bootstrap-table-reorder-columns.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
  3. typeof define === 'function' && define.amd ? define(['jquery'], factory) :
  4. (global = global || self, factory(global.jQuery));
  5. }(this, function ($) { 'use strict';
  6. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  7. var aFunction = function (it) {
  8. if (typeof it != 'function') {
  9. throw TypeError(String(it) + ' is not a function');
  10. } return it;
  11. };
  12. // optional / simple context binding
  13. var bindContext = function (fn, that, length) {
  14. aFunction(fn);
  15. if (that === undefined) return fn;
  16. switch (length) {
  17. case 0: return function () {
  18. return fn.call(that);
  19. };
  20. case 1: return function (a) {
  21. return fn.call(that, a);
  22. };
  23. case 2: return function (a, b) {
  24. return fn.call(that, a, b);
  25. };
  26. case 3: return function (a, b, c) {
  27. return fn.call(that, a, b, c);
  28. };
  29. }
  30. return function (/* ...args */) {
  31. return fn.apply(that, arguments);
  32. };
  33. };
  34. var fails = function (exec) {
  35. try {
  36. return !!exec();
  37. } catch (e) {
  38. return true;
  39. }
  40. };
  41. var toString = {}.toString;
  42. var classofRaw = function (it) {
  43. return toString.call(it).slice(8, -1);
  44. };
  45. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  46. var split = ''.split;
  47. var indexedObject = fails(function () {
  48. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  49. // eslint-disable-next-line no-prototype-builtins
  50. return !Object('z').propertyIsEnumerable(0);
  51. }) ? function (it) {
  52. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  53. } : Object;
  54. // `RequireObjectCoercible` abstract operation
  55. // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
  56. var requireObjectCoercible = function (it) {
  57. if (it == undefined) throw TypeError("Can't call method on " + it);
  58. return it;
  59. };
  60. // `ToObject` abstract operation
  61. // https://tc39.github.io/ecma262/#sec-toobject
  62. var toObject = function (argument) {
  63. return Object(requireObjectCoercible(argument));
  64. };
  65. var ceil = Math.ceil;
  66. var floor = Math.floor;
  67. // `ToInteger` abstract operation
  68. // https://tc39.github.io/ecma262/#sec-tointeger
  69. var toInteger = function (argument) {
  70. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  71. };
  72. var min = Math.min;
  73. // `ToLength` abstract operation
  74. // https://tc39.github.io/ecma262/#sec-tolength
  75. var toLength = function (argument) {
  76. return argument > 0 ? min(toInteger(argument), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  77. };
  78. var isObject = function (it) {
  79. return typeof it === 'object' ? it !== null : typeof it === 'function';
  80. };
  81. // `IsArray` abstract operation
  82. // https://tc39.github.io/ecma262/#sec-isarray
  83. var isArray = Array.isArray || function isArray(arg) {
  84. return classofRaw(arg) == 'Array';
  85. };
  86. function createCommonjsModule(fn, module) {
  87. return module = { exports: {} }, fn(module, module.exports), module.exports;
  88. }
  89. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  90. var global = typeof window == 'object' && window && window.Math == Math ? window
  91. : typeof self == 'object' && self && self.Math == Math ? self
  92. // eslint-disable-next-line no-new-func
  93. : Function('return this')();
  94. // Thank's IE8 for his funny defineProperty
  95. var descriptors = !fails(function () {
  96. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  97. });
  98. var document = global.document;
  99. // typeof document.createElement is 'object' in old IE
  100. var exist = isObject(document) && isObject(document.createElement);
  101. var documentCreateElement = function (it) {
  102. return exist ? document.createElement(it) : {};
  103. };
  104. // Thank's IE8 for his funny defineProperty
  105. var ie8DomDefine = !descriptors && !fails(function () {
  106. return Object.defineProperty(documentCreateElement('div'), 'a', {
  107. get: function () { return 7; }
  108. }).a != 7;
  109. });
  110. var anObject = function (it) {
  111. if (!isObject(it)) {
  112. throw TypeError(String(it) + ' is not an object');
  113. } return it;
  114. };
  115. // 7.1.1 ToPrimitive(input [, PreferredType])
  116. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  117. // and the second argument - flag - preferred type is a string
  118. var toPrimitive = function (it, S) {
  119. if (!isObject(it)) return it;
  120. var fn, val;
  121. if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  122. if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  123. if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  124. throw TypeError("Can't convert object to primitive value");
  125. };
  126. var nativeDefineProperty = Object.defineProperty;
  127. var f = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  128. anObject(O);
  129. P = toPrimitive(P, true);
  130. anObject(Attributes);
  131. if (ie8DomDefine) try {
  132. return nativeDefineProperty(O, P, Attributes);
  133. } catch (e) { /* empty */ }
  134. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  135. if ('value' in Attributes) O[P] = Attributes.value;
  136. return O;
  137. };
  138. var objectDefineProperty = {
  139. f: f
  140. };
  141. var createPropertyDescriptor = function (bitmap, value) {
  142. return {
  143. enumerable: !(bitmap & 1),
  144. configurable: !(bitmap & 2),
  145. writable: !(bitmap & 4),
  146. value: value
  147. };
  148. };
  149. var hide = descriptors ? function (object, key, value) {
  150. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  151. } : function (object, key, value) {
  152. object[key] = value;
  153. return object;
  154. };
  155. var setGlobal = function (key, value) {
  156. try {
  157. hide(global, key, value);
  158. } catch (e) {
  159. global[key] = value;
  160. } return value;
  161. };
  162. var shared = createCommonjsModule(function (module) {
  163. var SHARED = '__core-js_shared__';
  164. var store = global[SHARED] || setGlobal(SHARED, {});
  165. (module.exports = function (key, value) {
  166. return store[key] || (store[key] = value !== undefined ? value : {});
  167. })('versions', []).push({
  168. version: '3.0.0',
  169. mode: 'global',
  170. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  171. });
  172. });
  173. var id = 0;
  174. var postfix = Math.random();
  175. var uid = function (key) {
  176. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36));
  177. };
  178. // Chrome 38 Symbol has incorrect toString conversion
  179. var nativeSymbol = !fails(function () {
  180. });
  181. var store = shared('wks');
  182. var Symbol = global.Symbol;
  183. var wellKnownSymbol = function (name) {
  184. return store[name] || (store[name] = nativeSymbol && Symbol[name]
  185. || (nativeSymbol ? Symbol : uid)('Symbol.' + name));
  186. };
  187. var SPECIES = wellKnownSymbol('species');
  188. // `ArraySpeciesCreate` abstract operation
  189. // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
  190. var arraySpeciesCreate = function (originalArray, length) {
  191. var C;
  192. if (isArray(originalArray)) {
  193. C = originalArray.constructor;
  194. // cross-realm fallback
  195. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  196. else if (isObject(C)) {
  197. C = C[SPECIES];
  198. if (C === null) C = undefined;
  199. }
  200. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  201. };
  202. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
  203. // 0 -> Array#forEach
  204. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  205. // 1 -> Array#map
  206. // https://tc39.github.io/ecma262/#sec-array.prototype.map
  207. // 2 -> Array#filter
  208. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  209. // 3 -> Array#some
  210. // https://tc39.github.io/ecma262/#sec-array.prototype.some
  211. // 4 -> Array#every
  212. // https://tc39.github.io/ecma262/#sec-array.prototype.every
  213. // 5 -> Array#find
  214. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  215. // 6 -> Array#findIndex
  216. // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
  217. var arrayMethods = function (TYPE, specificCreate) {
  218. var IS_MAP = TYPE == 1;
  219. var IS_FILTER = TYPE == 2;
  220. var IS_SOME = TYPE == 3;
  221. var IS_EVERY = TYPE == 4;
  222. var IS_FIND_INDEX = TYPE == 6;
  223. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  224. var create = specificCreate || arraySpeciesCreate;
  225. return function ($this, callbackfn, that) {
  226. var O = toObject($this);
  227. var self = indexedObject(O);
  228. var boundFunction = bindContext(callbackfn, that, 3);
  229. var length = toLength(self.length);
  230. var index = 0;
  231. var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  232. var value, result;
  233. for (;length > index; index++) if (NO_HOLES || index in self) {
  234. value = self[index];
  235. result = boundFunction(value, index, O);
  236. if (TYPE) {
  237. if (IS_MAP) target[index] = result; // map
  238. else if (result) switch (TYPE) {
  239. case 3: return true; // some
  240. case 5: return value; // find
  241. case 6: return index; // findIndex
  242. case 2: target.push(value); // filter
  243. } else if (IS_EVERY) return false; // every
  244. }
  245. }
  246. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  247. };
  248. };
  249. var SPECIES$1 = wellKnownSymbol('species');
  250. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  251. return !fails(function () {
  252. var array = [];
  253. var constructor = array.constructor = {};
  254. constructor[SPECIES$1] = function () {
  255. return { foo: 1 };
  256. };
  257. return array[METHOD_NAME](Boolean).foo !== 1;
  258. });
  259. };
  260. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  261. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  262. // Nashorn ~ JDK8 bug
  263. var NASHORN_BUG = nativeGetOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  264. var f$1 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  265. var descriptor = nativeGetOwnPropertyDescriptor(this, V);
  266. return !!descriptor && descriptor.enumerable;
  267. } : nativePropertyIsEnumerable;
  268. var objectPropertyIsEnumerable = {
  269. f: f$1
  270. };
  271. // toObject with fallback for non-array-like ES3 strings
  272. var toIndexedObject = function (it) {
  273. return indexedObject(requireObjectCoercible(it));
  274. };
  275. var hasOwnProperty = {}.hasOwnProperty;
  276. var has = function (it, key) {
  277. return hasOwnProperty.call(it, key);
  278. };
  279. var nativeGetOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  280. var f$2 = descriptors ? nativeGetOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
  281. O = toIndexedObject(O);
  282. P = toPrimitive(P, true);
  283. if (ie8DomDefine) try {
  284. return nativeGetOwnPropertyDescriptor$1(O, P);
  285. } catch (e) { /* empty */ }
  286. if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  287. };
  288. var objectGetOwnPropertyDescriptor = {
  289. f: f$2
  290. };
  291. var functionToString = shared('native-function-to-string', Function.toString);
  292. var WeakMap = global.WeakMap;
  293. var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
  294. var shared$1 = shared('keys');
  295. var sharedKey = function (key) {
  296. return shared$1[key] || (shared$1[key] = uid(key));
  297. };
  298. var hiddenKeys = {};
  299. var WeakMap$1 = global.WeakMap;
  300. var set, get, has$1;
  301. var enforce = function (it) {
  302. return has$1(it) ? get(it) : set(it, {});
  303. };
  304. var getterFor = function (TYPE) {
  305. return function (it) {
  306. var state;
  307. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  308. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  309. } return state;
  310. };
  311. };
  312. if (nativeWeakMap) {
  313. var store$1 = new WeakMap$1();
  314. var wmget = store$1.get;
  315. var wmhas = store$1.has;
  316. var wmset = store$1.set;
  317. set = function (it, metadata) {
  318. wmset.call(store$1, it, metadata);
  319. return metadata;
  320. };
  321. get = function (it) {
  322. return wmget.call(store$1, it) || {};
  323. };
  324. has$1 = function (it) {
  325. return wmhas.call(store$1, it);
  326. };
  327. } else {
  328. var STATE = sharedKey('state');
  329. hiddenKeys[STATE] = true;
  330. set = function (it, metadata) {
  331. hide(it, STATE, metadata);
  332. return metadata;
  333. };
  334. get = function (it) {
  335. return has(it, STATE) ? it[STATE] : {};
  336. };
  337. has$1 = function (it) {
  338. return has(it, STATE);
  339. };
  340. }
  341. var internalState = {
  342. set: set,
  343. get: get,
  344. has: has$1,
  345. enforce: enforce,
  346. getterFor: getterFor
  347. };
  348. var redefine = createCommonjsModule(function (module) {
  349. var getInternalState = internalState.get;
  350. var enforceInternalState = internalState.enforce;
  351. var TEMPLATE = String(functionToString).split('toString');
  352. shared('inspectSource', function (it) {
  353. return functionToString.call(it);
  354. });
  355. (module.exports = function (O, key, value, options) {
  356. var unsafe = options ? !!options.unsafe : false;
  357. var simple = options ? !!options.enumerable : false;
  358. var noTargetGet = options ? !!options.noTargetGet : false;
  359. if (typeof value == 'function') {
  360. if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
  361. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  362. }
  363. if (O === global) {
  364. if (simple) O[key] = value;
  365. else setGlobal(key, value);
  366. return;
  367. } else if (!unsafe) {
  368. delete O[key];
  369. } else if (!noTargetGet && O[key]) {
  370. simple = true;
  371. }
  372. if (simple) O[key] = value;
  373. else hide(O, key, value);
  374. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  375. })(Function.prototype, 'toString', function toString() {
  376. return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
  377. });
  378. });
  379. var max = Math.max;
  380. var min$1 = Math.min;
  381. // Helper for a popular repeating case of the spec:
  382. // Let integer be ? ToInteger(index).
  383. // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
  384. var toAbsoluteIndex = function (index, length) {
  385. var integer = toInteger(index);
  386. return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
  387. };
  388. // `Array.prototype.{ indexOf, includes }` methods implementation
  389. // false -> Array#indexOf
  390. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  391. // true -> Array#includes
  392. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  393. var arrayIncludes = function (IS_INCLUDES) {
  394. return function ($this, el, fromIndex) {
  395. var O = toIndexedObject($this);
  396. var length = toLength(O.length);
  397. var index = toAbsoluteIndex(fromIndex, length);
  398. var value;
  399. // Array#includes uses SameValueZero equality algorithm
  400. // eslint-disable-next-line no-self-compare
  401. if (IS_INCLUDES && el != el) while (length > index) {
  402. value = O[index++];
  403. // eslint-disable-next-line no-self-compare
  404. if (value != value) return true;
  405. // Array#indexOf ignores holes, Array#includes - not
  406. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  407. if (O[index] === el) return IS_INCLUDES || index || 0;
  408. } return !IS_INCLUDES && -1;
  409. };
  410. };
  411. var arrayIndexOf = arrayIncludes(false);
  412. var objectKeysInternal = function (object, names) {
  413. var O = toIndexedObject(object);
  414. var i = 0;
  415. var result = [];
  416. var key;
  417. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  418. // Don't enum bug & hidden keys
  419. while (names.length > i) if (has(O, key = names[i++])) {
  420. ~arrayIndexOf(result, key) || result.push(key);
  421. }
  422. return result;
  423. };
  424. // IE8- don't enum bug keys
  425. var enumBugKeys = [
  426. 'constructor',
  427. 'hasOwnProperty',
  428. 'isPrototypeOf',
  429. 'propertyIsEnumerable',
  430. 'toLocaleString',
  431. 'toString',
  432. 'valueOf'
  433. ];
  434. // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
  435. var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
  436. var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  437. return objectKeysInternal(O, hiddenKeys$1);
  438. };
  439. var objectGetOwnPropertyNames = {
  440. f: f$3
  441. };
  442. var f$4 = Object.getOwnPropertySymbols;
  443. var objectGetOwnPropertySymbols = {
  444. f: f$4
  445. };
  446. var Reflect = global.Reflect;
  447. // all object keys, includes non-enumerable and symbols
  448. var ownKeys = Reflect && Reflect.ownKeys || function ownKeys(it) {
  449. var keys = objectGetOwnPropertyNames.f(anObject(it));
  450. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  451. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  452. };
  453. var copyConstructorProperties = function (target, source) {
  454. var keys = ownKeys(source);
  455. var defineProperty = objectDefineProperty.f;
  456. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  457. for (var i = 0; i < keys.length; i++) {
  458. var key = keys[i];
  459. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  460. }
  461. };
  462. var replacement = /#|\.prototype\./;
  463. var isForced = function (feature, detection) {
  464. var value = data[normalize(feature)];
  465. return value == POLYFILL ? true
  466. : value == NATIVE ? false
  467. : typeof detection == 'function' ? fails(detection)
  468. : !!detection;
  469. };
  470. var normalize = isForced.normalize = function (string) {
  471. return String(string).replace(replacement, '.').toLowerCase();
  472. };
  473. var data = isForced.data = {};
  474. var NATIVE = isForced.NATIVE = 'N';
  475. var POLYFILL = isForced.POLYFILL = 'P';
  476. var isForced_1 = isForced;
  477. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  478. /*
  479. options.target - name of the target object
  480. options.global - target is the global object
  481. options.stat - export as static methods of target
  482. options.proto - export as prototype methods of target
  483. options.real - real prototype method for the `pure` version
  484. options.forced - export even if the native feature is available
  485. options.bind - bind methods to the target, required for the `pure` version
  486. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  487. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  488. options.sham - add a flag to not completely full polyfills
  489. options.enumerable - export as enumerable property
  490. options.noTargetGet - prevent calling a getter on target
  491. */
  492. var _export = function (options, source) {
  493. var TARGET = options.target;
  494. var GLOBAL = options.global;
  495. var STATIC = options.stat;
  496. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  497. if (GLOBAL) {
  498. target = global;
  499. } else if (STATIC) {
  500. target = global[TARGET] || setGlobal(TARGET, {});
  501. } else {
  502. target = (global[TARGET] || {}).prototype;
  503. }
  504. if (target) for (key in source) {
  505. sourceProperty = source[key];
  506. if (options.noTargetGet) {
  507. descriptor = getOwnPropertyDescriptor(target, key);
  508. targetProperty = descriptor && descriptor.value;
  509. } else targetProperty = target[key];
  510. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  511. // contained in target
  512. if (!FORCED && targetProperty !== undefined) {
  513. if (typeof sourceProperty === typeof targetProperty) continue;
  514. copyConstructorProperties(sourceProperty, targetProperty);
  515. }
  516. // add a flag to not completely full polyfills
  517. if (options.sham || (targetProperty && targetProperty.sham)) {
  518. hide(sourceProperty, 'sham', true);
  519. }
  520. // extend global
  521. redefine(target, key, sourceProperty, options);
  522. }
  523. };
  524. var internalFilter = arrayMethods(2);
  525. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  526. // `Array.prototype.filter` method
  527. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  528. // with adding support of @@species
  529. _export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT }, {
  530. filter: function filter(callbackfn /* , thisArg */) {
  531. return internalFilter(this, callbackfn, arguments[1]);
  532. }
  533. });
  534. // 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$1 = global.document;
  548. var html = document$1 && document$1.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 createProperty = function (object, key, value) {
  612. var propertyKey = toPrimitive(key);
  613. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  614. else object[propertyKey] = value;
  615. };
  616. var SPECIES$2 = wellKnownSymbol('species');
  617. var nativeSlice = [].slice;
  618. var max$1 = Math.max;
  619. var SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice');
  620. // `Array.prototype.slice` method
  621. // https://tc39.github.io/ecma262/#sec-array.prototype.slice
  622. // fallback for not array-like ES3 strings and DOM objects
  623. _export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT$1 }, {
  624. slice: function slice(start, end) {
  625. var O = toIndexedObject(this);
  626. var length = toLength(O.length);
  627. var k = toAbsoluteIndex(start, length);
  628. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  629. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  630. var Constructor, result, n;
  631. if (isArray(O)) {
  632. Constructor = O.constructor;
  633. // cross-realm fallback
  634. if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
  635. Constructor = undefined;
  636. } else if (isObject(Constructor)) {
  637. Constructor = Constructor[SPECIES$2];
  638. if (Constructor === null) Constructor = undefined;
  639. }
  640. if (Constructor === Array || Constructor === undefined) {
  641. return nativeSlice.call(O, k, fin);
  642. }
  643. }
  644. result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
  645. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  646. result.length = n;
  647. return result;
  648. }
  649. });
  650. /**
  651. * @author: Dennis Hernández
  652. * @webSite: http://djhvscf.github.io/Blog
  653. * @version: v1.1.0
  654. */
  655. // From MDN site, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
  656. var filterFn = function filterFn() {
  657. if (!Array.prototype.filter) {
  658. Array.prototype.filter = function (fun
  659. /* , thisArg*/
  660. ) {
  661. if (this === undefined || this === null) {
  662. throw new TypeError();
  663. }
  664. var t = Object(this);
  665. var len = t.length >>> 0;
  666. if (typeof fun !== 'function') {
  667. throw new TypeError();
  668. }
  669. var res = [];
  670. var thisArg = arguments.length >= 2 ? arguments[1] : undefined;
  671. for (var i = 0; i < len; i++) {
  672. if (i in t) {
  673. var val = t[i]; // NOTE: Technically this should Object.defineProperty at
  674. // the next index, as push can be affected by
  675. // properties on Object.prototype and Array.prototype.
  676. // But that method's new, and collisions should be
  677. // rare, so use the more-compatible alternative.
  678. if (fun.call(thisArg, val, i, t)) {
  679. res.push(val);
  680. }
  681. }
  682. }
  683. return res;
  684. };
  685. }
  686. };
  687. $.extend($.fn.bootstrapTable.defaults, {
  688. reorderableColumns: false,
  689. maxMovingRows: 10,
  690. onReorderColumn: function onReorderColumn(headerFields) {
  691. return false;
  692. },
  693. dragaccept: null
  694. });
  695. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  696. 'reorder-column.bs.table': 'onReorderColumn'
  697. });
  698. var BootstrapTable = $.fn.bootstrapTable.Constructor;
  699. var _initHeader = BootstrapTable.prototype.initHeader;
  700. var _toggleColumn = BootstrapTable.prototype.toggleColumn;
  701. var _toggleView = BootstrapTable.prototype.toggleView;
  702. var _resetView = BootstrapTable.prototype.resetView;
  703. BootstrapTable.prototype.initHeader = function () {
  704. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  705. args[_key] = arguments[_key];
  706. }
  707. _initHeader.apply(this, Array.prototype.slice.apply(args));
  708. if (!this.options.reorderableColumns) {
  709. return;
  710. }
  711. this.makeRowsReorderable();
  712. };
  713. BootstrapTable.prototype.toggleColumn = function () {
  714. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  715. args[_key2] = arguments[_key2];
  716. }
  717. _toggleColumn.apply(this, Array.prototype.slice.apply(args));
  718. if (!this.options.reorderableColumns) {
  719. return;
  720. }
  721. this.makeRowsReorderable();
  722. };
  723. BootstrapTable.prototype.toggleView = function () {
  724. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  725. args[_key3] = arguments[_key3];
  726. }
  727. _toggleView.apply(this, Array.prototype.slice.apply(args));
  728. if (!this.options.reorderableColumns) {
  729. return;
  730. }
  731. if (this.options.cardView) {
  732. return;
  733. }
  734. this.makeRowsReorderable();
  735. };
  736. BootstrapTable.prototype.resetView = function () {
  737. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  738. args[_key4] = arguments[_key4];
  739. }
  740. _resetView.apply(this, Array.prototype.slice.apply(args));
  741. if (!this.options.reorderableColumns) {
  742. return;
  743. }
  744. this.makeRowsReorderable();
  745. };
  746. BootstrapTable.prototype.makeRowsReorderable = function () {
  747. var that = this;
  748. try {
  749. $(this.$el).dragtable('destroy');
  750. } catch (e) {//
  751. }
  752. $(this.$el).dragtable({
  753. maxMovingRows: that.options.maxMovingRows,
  754. dragaccept: that.options.dragaccept,
  755. clickDelay: 200,
  756. dragHandle: '.th-inner',
  757. beforeStop: function beforeStop() {
  758. var ths = [];
  759. var formatters = [];
  760. var columns = [];
  761. var columnsHidden = [];
  762. var columnIndex = -1;
  763. var optionsColumns = [];
  764. that.$header.find('th').each(function (i) {
  765. ths.push($(this).data('field'));
  766. formatters.push($(this).data('formatter'));
  767. }); // Exist columns not shown
  768. if (ths.length < that.columns.length) {
  769. columnsHidden = that.columns.filter(function (column) {
  770. return !column.visible;
  771. });
  772. for (var i = 0; i < columnsHidden.length; i++) {
  773. ths.push(columnsHidden[i].field);
  774. formatters.push(columnsHidden[i].formatter);
  775. }
  776. }
  777. for (var _i = 0; _i < ths.length; _i++) {
  778. columnIndex = that.fieldsColumnsIndex[ths[_i]];
  779. if (columnIndex !== -1) {
  780. that.fieldsColumnsIndex[ths[_i]] = _i;
  781. that.columns[columnIndex].fieldIndex = _i;
  782. columns.push(that.columns[columnIndex]);
  783. }
  784. }
  785. that.columns = columns;
  786. filterFn(); // Support <IE9
  787. $.each(that.columns, function (i, column) {
  788. var found = false;
  789. var field = column.field;
  790. that.options.columns[0].filter(function (item) {
  791. if (!found && item['field'] === field) {
  792. optionsColumns.push(item);
  793. found = true;
  794. return false;
  795. }
  796. return true;
  797. });
  798. });
  799. that.options.columns[0] = optionsColumns;
  800. that.header.fields = ths;
  801. that.header.formatters = formatters;
  802. that.initHeader();
  803. that.initBody();
  804. that.resetView();
  805. that.trigger('reorder-column', ths);
  806. }
  807. });
  808. };
  809. }));