bootstrap-table.js 123 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420
  1. /**
  2. * bootstrap-table - An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features. (supports twitter bootstrap v2 and v3).
  3. *
  4. * @version v1.14.2
  5. * @homepage https://bootstrap-table.com
  6. * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
  7. * @license MIT
  8. */
  9. (function(e, t) {
  10. if ('function' == typeof define && define.amd) define([], t);
  11. else if ('undefined' != typeof exports) t();
  12. else {
  13. t(),
  14. e.bootstrapTable = {
  15. exports: {}
  16. }.exports
  17. }
  18. })(this,
  19. function() {
  20. 'use strict';
  21. function e(e, t) {
  22. if (! (e instanceof t)) throw new TypeError('Cannot call a class as a function')
  23. }
  24. function t(e) {
  25. if (Array.isArray(e)) {
  26. for (var t = 0,
  27. o = Array(e.length); t < e.length; t++) o[t] = e[t];
  28. return o
  29. }
  30. return Array.from(e)
  31. }
  32. var o = function() {
  33. function e(e, t) {
  34. for (var o, a = 0; a < t.length; a++) o = t[a],
  35. o.enumerable = o.enumerable || !1,
  36. o.configurable = !0,
  37. 'value' in o && (o.writable = !0),
  38. Object.defineProperty(e, o.key, o)
  39. }
  40. return function(t, o, a) {
  41. return o && e(t.prototype, o),
  42. a && e(t, a),
  43. t
  44. }
  45. } (),
  46. a = function() {
  47. function e(e, t) {
  48. var o = [],
  49. a = !0,
  50. i = !1,
  51. n = void 0;
  52. try {
  53. for (var s, l = e[Symbol.iterator](); ! (a = (s = l.next()).done) && (o.push(s.value), !(t && o.length === t)); a = !0);
  54. } catch(e) {
  55. i = !0,
  56. n = e
  57. } finally {
  58. try { ! a && l['return'] && l['return']()
  59. } finally {
  60. if (i) throw n
  61. }
  62. }
  63. return o
  64. }
  65. return function(t, o) {
  66. if (Array.isArray(t)) return t;
  67. if (Symbol.iterator in Object(t)) return e(t, o);
  68. throw new TypeError('Invalid attempt to destructure non-iterable instance')
  69. }
  70. } (),
  71. n = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ?
  72. function(e) {
  73. return typeof e
  74. }: function(e) {
  75. return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol': typeof e
  76. }; (function(s) {
  77. var i = 4;
  78. try {
  79. var g = s.fn.dropdown.Constructor.VERSION;
  80. g !== void 0 && (i = parseInt(g, 10))
  81. } catch(t) {}
  82. var l = {
  83. 3 : {
  84. theme: 'bootstrap3',
  85. iconsPrefix: 'mdi',
  86. icons: {
  87. paginationSwitchDown: 'mdi-arrow-down-drop-circle-outline',
  88. paginationSwitchUp: 'mdi-arrow-up-drop-circle-outline',
  89. refresh: 'mdi-refresh',
  90. toggleOff: 'mdi-playlist-check',
  91. toggleOn: 'mdi-playlist-remove',
  92. columns: 'mdi-table-column-remove',
  93. detailOpen: 'mdi-plus',
  94. detailClose: 'mdi-minus',
  95. fullscreen: 'mdi-fullscreen'
  96. },
  97. classes: {
  98. buttonsPrefix: 'btn',
  99. buttons: 'default',
  100. buttonsGroup: 'btn-group',
  101. buttonsDropdown: 'btn-group',
  102. pull: 'pull',
  103. inputGroup: '',
  104. input: 'form-control',
  105. paginationDropdown: 'btn-group dropdown',
  106. dropup: 'dropup',
  107. dropdownActive: 'active',
  108. paginationActive: 'active'
  109. },
  110. html: {
  111. toobarDropdow: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  112. toobarDropdowItem: '<li role="menuitem">%s</li>',
  113. pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  114. pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
  115. dropdownCaret: '<span class="caret"></span>',
  116. pagination: ['<ul class="pagination%s">', '</ul>'],
  117. paginationItem: '<li class="page-item%s"><a class="page-link" href="#">%s</a></li>',
  118. icon: '<i class="%s %s"></i>'
  119. }
  120. },
  121. 4 : {
  122. theme: 'bootstrap4',
  123. iconsPrefix: 'mdi',
  124. icons: {
  125. paginationSwitchDown: 'mdi-arrow-down-drop-circle-outline',
  126. paginationSwitchUp: 'mdi-arrow-up-drop-circle-outline',
  127. refresh: 'mdi-refresh',
  128. toggleOff: 'mdi-playlist-check',
  129. toggleOn: 'mdi-playlist-remove',
  130. columns: 'mdi-table-column-remove',
  131. fullscreen: 'mdi-fullscreen',
  132. detailOpen: 'mdi-plus',
  133. detailClose: 'mdi-minus'
  134. },
  135. classes: {
  136. buttonsPrefix: 'btn',
  137. buttons: 'secondary',
  138. buttonsGroup: 'btn-group',
  139. buttonsDropdown: 'btn-group',
  140. pull: 'float',
  141. inputGroup: '',
  142. input: 'form-control',
  143. paginationDropdown: 'btn-group dropdown',
  144. dropup: 'dropup',
  145. dropdownActive: 'active',
  146. paginationActive: 'active'
  147. },
  148. html: {
  149. toobarDropdow: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
  150. toobarDropdowItem: '<label class="dropdown-item">%s</label>',
  151. pageDropdown: ['<div class="dropdown-menu">', '</div>'],
  152. pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
  153. dropdownCaret: '<span class="caret"></span>',
  154. pagination: ['<ul class="pagination%s">', '</ul>'],
  155. paginationItem: '<li class="page-item%s"><a class="page-link" href="#">%s</a></li>',
  156. icon: '<i class="%s %s"></i>'
  157. }
  158. }
  159. } [i],
  160. r = {
  161. bootstrapVersion: i,
  162. sprintf: function(e) {
  163. for (var t = arguments.length,
  164. o = Array(1 < t ? t - 1 : 0), a = 1; a < t; a++) o[a - 1] = arguments[a];
  165. var n = !0,
  166. s = 0,
  167. i = e.replace(/%s/g,
  168. function() {
  169. var e = o[s++];
  170. return 'undefined' == typeof e ? (n = !1, '') : e
  171. });
  172. return n ? i: ''
  173. },
  174. isEmptyObject: function() {
  175. var e = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : {};
  176. return 0 ===
  177. function(e) {
  178. return Object.keys(e).map(function(t) {
  179. return [t, e[t]]
  180. })
  181. } (e).length && e.constructor === Object
  182. },
  183. isNumeric: function(e) {
  184. return ! isNaN(parseFloat(e)) && isFinite(e)
  185. },
  186. getFieldTitle: function(e, t) {
  187. for (var o = e,
  188. a = Array.isArray(o), i = 0, _iterator = a ? o: o[Symbol.iterator]();;) {
  189. var n;
  190. if (a) {
  191. if (i >= o.length) break;
  192. n = o[i++]
  193. } else {
  194. if (i = o.next(), i.done) break;
  195. n = i.value
  196. }
  197. var s = n;
  198. if (s.field === t) return s.title
  199. }
  200. return ''
  201. },
  202. setFieldIndex: function(e) {
  203. for (var t = 0,
  204. o = [], a = e[0], n = Array.isArray(a), s = 0, _iterator2 = n ? a: a[Symbol.iterator]();;) {
  205. var l;
  206. if (n) {
  207. if (s >= a.length) break;
  208. l = a[s++]
  209. } else {
  210. if (s = a.next(), s.done) break;
  211. l = s.value
  212. }
  213. var d = l;
  214. t += d.colspan || 1
  215. }
  216. for (var m = 0; m < e.length; m++) {
  217. o[m] = [];
  218. for (var i = 0; i < t; i++) o[m][i] = !1
  219. }
  220. for (var y = 0; y < e.length; y++) for (var c = e[y], p = Array.isArray(c), h = 0, _iterator3 = p ? c: c[Symbol.iterator]();;) {
  221. var g;
  222. if (p) {
  223. if (h >= c.length) break;
  224. g = c[h++]
  225. } else {
  226. if (h = c.next(), h.done) break;
  227. g = h.value
  228. }
  229. var u = g,
  230. r = u.rowspan || 1,
  231. f = u.colspan || 1,
  232. b = o[y].indexOf(!1);
  233. 1 === f && (u.fieldIndex = b, 'undefined' == typeof u.field && (u.field = b));
  234. for (var w = 0; w < r; w++) o[y + w][b] = !0;
  235. for (var k = 0; k < f; k++) o[y][b + k] = !0
  236. }
  237. },
  238. getScrollBarWidth: function() {
  239. if (this.cachedWidth === void 0) {
  240. var e = s('<div/>').addClass('fixed-table-scroll-inner'),
  241. t = s('<div/>').addClass('fixed-table-scroll-outer');
  242. t.append(e),
  243. s('body').append(t);
  244. var o = e[0].offsetWidth;
  245. t.css('overflow', 'scroll');
  246. var a = e[0].offsetWidth;
  247. o === a && (a = t[0].clientWidth),
  248. t.remove(),
  249. this.cachedWidth = o - a
  250. }
  251. return this.cachedWidth
  252. },
  253. calculateObjectValue: function(e, o, a, i) {
  254. var s = o;
  255. if ('string' == typeof o) {
  256. var h = o.split('.');
  257. if (1 < h.length) {
  258. s = window;
  259. for (var l = h,
  260. r = Array.isArray(l), d = 0, _iterator4 = r ? l: l[Symbol.iterator]();;) {
  261. var c;
  262. if (r) {
  263. if (d >= l.length) break;
  264. c = l[d++]
  265. } else {
  266. if (d = l.next(), d.done) break;
  267. c = d.value
  268. }
  269. var p = c;
  270. s = s[p]
  271. }
  272. } else s = window[o]
  273. }
  274. return null !== s && 'object' === ('undefined' == typeof s ? 'undefined': n(s)) ? s: 'function' == typeof s ? s.apply(e, a || []) : !s && 'string' == typeof o && this.sprintf.apply(this, [o].concat(t(a))) ? this.sprintf.apply(this, [o].concat(t(a))) : i
  275. },
  276. compareObjects: function(e, t, o) {
  277. var a = Object.keys(e),
  278. i = Object.keys(t);
  279. if (o && a.length !== i.length) return ! 1;
  280. for (var n = a,
  281. s = Array.isArray(n), l = 0, _iterator5 = s ? n: n[Symbol.iterator]();;) {
  282. var r;
  283. if (s) {
  284. if (l >= n.length) break;
  285. r = n[l++]
  286. } else {
  287. if (l = n.next(), l.done) break;
  288. r = l.value
  289. }
  290. var d = r;
  291. if ( - 1 !== i.indexOf(d) && e[d] !== t[d]) return ! 1
  292. }
  293. return ! 0
  294. },
  295. escapeHTML: function(e) {
  296. return 'string' == typeof e ? e.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;').replace(/`/g, '&#x60;') : e
  297. },
  298. getRealDataAttr: function(e) {
  299. for (var t = function(e) {
  300. return Object.keys(e).map(function(t) {
  301. return [t, e[t]]
  302. })
  303. } (e), o = Array.isArray(t), i = 0, _iterator6 = o ? t: t[Symbol.iterator]();;) {
  304. var n;
  305. if (o) {
  306. if (i >= t.length) break;
  307. n = t[i++]
  308. } else {
  309. if (i = t.next(), i.done) break;
  310. n = i.value
  311. }
  312. var s = n,
  313. l = a(s, 2),
  314. r = l[0],
  315. d = l[1],
  316. c = r.split(/(?=[A-Z])/).join('-').toLowerCase();
  317. c !== r && (e[c] = d, delete e[r])
  318. }
  319. return e
  320. },
  321. getItemField: function(e, t, o) {
  322. var a = e;
  323. if ('string' != typeof t || e.hasOwnProperty(t)) return o ? this.escapeHTML(e[t]) : e[t];
  324. for (var i = t.split('.'), n = i, s = Array.isArray(n), l = 0, _iterator7 = s ? n: n[Symbol.iterator]();;) {
  325. var r;
  326. if (s) {
  327. if (l >= n.length) break;
  328. r = n[l++]
  329. } else {
  330. if (l = n.next(), l.done) break;
  331. r = l.value
  332. }
  333. var d = r;
  334. a = a && a[d]
  335. }
  336. return o ? this.escapeHTML(a) : a
  337. },
  338. isIEBrowser: function() {
  339. return - 1 !== navigator.userAgent.indexOf('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent)
  340. },
  341. findIndex: function(e, t) {
  342. for (var o = e,
  343. a = Array.isArray(o), i = 0, _iterator8 = a ? o: o[Symbol.iterator]();;) {
  344. var n;
  345. if (a) {
  346. if (i >= o.length) break;
  347. n = o[i++]
  348. } else {
  349. if (i = o.next(), i.done) break;
  350. n = i.value
  351. }
  352. var s = n;
  353. if (JSON.stringify(s) === JSON.stringify(t)) return e.indexOf(s)
  354. }
  355. return - 1
  356. }
  357. },
  358. d = {
  359. height: void 0,
  360. classes: 'table table-bordered table-hover',
  361. theadClasses: '',
  362. rowStyle: function() {
  363. return {}
  364. },
  365. rowAttributes: function() {
  366. return {}
  367. },
  368. undefinedText: '-',
  369. locale: void 0,
  370. sortable: !0,
  371. sortClass: void 0,
  372. silentSort: !0,
  373. sortName: void 0,
  374. sortOrder: 'asc',
  375. sortStable: !1,
  376. rememberOrder: !1,
  377. customSort: void 0,
  378. columns: [[]],
  379. data: [],
  380. url: void 0,
  381. method: 'get',
  382. cache: !0,
  383. contentType: 'application/json',
  384. dataType: 'json',
  385. ajax: void 0,
  386. ajaxOptions: {},
  387. queryParams: function(e) {
  388. return e
  389. },
  390. queryParamsType: 'limit',
  391. responseHandler: function(e) {
  392. return e
  393. },
  394. totalField: 'total',
  395. dataField: 'rows',
  396. pagination: !1,
  397. onlyInfoPagination: !1,
  398. paginationLoop: !0,
  399. sidePagination: 'client',
  400. totalRows: 0,
  401. pageNumber: 1,
  402. pageSize: 10,
  403. pageList: [10, 25, 50, 100],
  404. paginationHAlign: 'right',
  405. paginationVAlign: 'bottom',
  406. paginationDetailHAlign: 'left',
  407. paginationPreText: '&lsaquo;',
  408. paginationNextText: '&rsaquo;',
  409. paginationSuccessivelySize: 5,
  410. paginationPagesBySide: 1,
  411. paginationUseIntermediate: !1,
  412. search: !1,
  413. searchOnEnterKey: !1,
  414. strictSearch: !1,
  415. trimOnSearch: !0,
  416. searchAlign: 'right',
  417. searchTimeOut: 500,
  418. searchText: '',
  419. customSearch: void 0,
  420. showHeader: !0,
  421. showFooter: !1,
  422. footerStyle: function() {
  423. return {}
  424. },
  425. showColumns: !1,
  426. minimumCountColumns: 1,
  427. showPaginationSwitch: !1,
  428. showRefresh: !1,
  429. showToggle: !1,
  430. showFullscreen: !1,
  431. smartDisplay: !0,
  432. escape: !1,
  433. idField: void 0,
  434. selectItemName: 'btSelectItem',
  435. clickToSelect: !1,
  436. ignoreClickToSelectOn: function(e) {
  437. var t = e.tagName;
  438. return - 1 !== ['A', 'BUTTON'].indexOf(t)
  439. },
  440. singleSelect: !1,
  441. checkboxHeader: !0,
  442. maintainSelected: !1,
  443. uniqueId: void 0,
  444. cardView: !1,
  445. detailView: !1,
  446. detailFormatter: function() {
  447. return ''
  448. },
  449. detailFilter: function() {
  450. return ! 0
  451. },
  452. toolbar: void 0,
  453. toolbarAlign: 'left',
  454. buttonsToolbar: void 0,
  455. buttonsAlign: 'right',
  456. buttonsPrefix: l.classes.buttonsPrefix,
  457. buttonsClass: l.classes.buttons,
  458. icons: l.icons,
  459. iconSize: void 0,
  460. iconsPrefix: l.iconsPrefix,
  461. onAll: function() {
  462. return ! 1
  463. },
  464. onClickCell: function() {
  465. return ! 1
  466. },
  467. onDblClickCell: function() {
  468. return ! 1
  469. },
  470. onClickRow: function() {
  471. return ! 1
  472. },
  473. onDblClickRow: function() {
  474. return ! 1
  475. },
  476. onSort: function() {
  477. return ! 1
  478. },
  479. onCheck: function() {
  480. return ! 1
  481. },
  482. onUncheck: function() {
  483. return ! 1
  484. },
  485. onCheckAll: function() {
  486. return ! 1
  487. },
  488. onUncheckAll: function() {
  489. return ! 1
  490. },
  491. onCheckSome: function() {
  492. return ! 1
  493. },
  494. onUncheckSome: function() {
  495. return ! 1
  496. },
  497. onLoadSuccess: function() {
  498. return ! 1
  499. },
  500. onLoadError: function() {
  501. return ! 1
  502. },
  503. onColumnSwitch: function() {
  504. return ! 1
  505. },
  506. onPageChange: function() {
  507. return ! 1
  508. },
  509. onSearch: function() {
  510. return ! 1
  511. },
  512. onToggle: function() {
  513. return ! 1
  514. },
  515. onPreBody: function() {
  516. return ! 1
  517. },
  518. onPostBody: function() {
  519. return ! 1
  520. },
  521. onPostHeader: function() {
  522. return ! 1
  523. },
  524. onExpandRow: function() {
  525. return ! 1
  526. },
  527. onCollapseRow: function() {
  528. return ! 1
  529. },
  530. onRefreshOptions: function() {
  531. return ! 1
  532. },
  533. onRefresh: function() {
  534. return ! 1
  535. },
  536. onResetView: function() {
  537. return ! 1
  538. },
  539. onScrollBody: function() {
  540. return ! 1
  541. }
  542. },
  543. c = {};
  544. c['en-US'] = c.en = {
  545. formatLoadingMessage: function() {
  546. return 'Loading, please wait'
  547. },
  548. formatRecordsPerPage: function(e) {
  549. return e + ' rows per page'
  550. },
  551. formatShowingRows: function(e, t, o) {
  552. return 'Showing ' + e + ' to ' + t + ' of ' + o + ' rows'
  553. },
  554. formatDetailPagination: function(e) {
  555. return 'Showing ' + e + ' rows'
  556. },
  557. formatSearch: function() {
  558. return 'Search'
  559. },
  560. formatNoMatches: function() {
  561. return 'No matching records found'
  562. },
  563. formatPaginationSwitch: function() {
  564. return 'Hide/Show pagination'
  565. },
  566. formatRefresh: function() {
  567. return 'Refresh'
  568. },
  569. formatToggle: function() {
  570. return 'Toggle'
  571. },
  572. formatColumns: function() {
  573. return 'Columns'
  574. },
  575. formatFullscreen: function() {
  576. return 'Fullscreen'
  577. },
  578. formatAllRows: function() {
  579. return 'All'
  580. }
  581. },
  582. s.extend(d, c['en-US']);
  583. var p = function() {
  584. function t(o, a) {
  585. e(this, t),
  586. this.options = a,
  587. this.$el = s(o),
  588. this.$el_ = this.$el.clone(),
  589. this.timeoutId_ = 0,
  590. this.timeoutFooter_ = 0,
  591. this.init()
  592. }
  593. return o(t, [{
  594. key: 'init',
  595. value: function() {
  596. this.initConstants(),
  597. this.initLocale(),
  598. this.initContainer(),
  599. this.initTable(),
  600. this.initHeader(),
  601. this.initData(),
  602. this.initHiddenRows(),
  603. this.initFooter(),
  604. this.initToolbar(),
  605. this.initPagination(),
  606. this.initBody(),
  607. this.initSearchText(),
  608. this.initServer()
  609. }
  610. },
  611. {
  612. key: 'initConstants',
  613. value: function() {
  614. var e = this.options;
  615. this.constants = l;
  616. var t = e.buttonsPrefix ? e.buttonsPrefix + '-': '';
  617. this.constants.buttonsClass = [e.buttonsPrefix, t + e.buttonsClass, r.sprintf(t + '%s', e.iconSize)].join(' ').trim()
  618. }
  619. },
  620. {
  621. key: 'initLocale',
  622. value: function() {
  623. if (this.options.locale) {
  624. var e = s.fn.bootstrapTable.locales,
  625. t = this.options.locale.split(/-|_/);
  626. t[0] = t[0].toLowerCase(),
  627. t[1] && (t[1] = t[1].toUpperCase()),
  628. e[this.options.locale] ? s.extend(this.options, e[this.options.locale]) : e[t.join('-')] ? s.extend(this.options, e[t.join('-')]) : e[t[0]] && s.extend(this.options, e[t[0]])
  629. }
  630. }
  631. },
  632. {
  633. key: 'initContainer',
  634. value: function() {
  635. var e = -1 === ['top', 'both'].indexOf(this.options.paginationVAlign) ? '': '<div class="fixed-table-pagination clearfix"></div>',
  636. t = -1 === ['bottom', 'both'].indexOf(this.options.paginationVAlign) ? '': '<div class="fixed-table-pagination"></div>';
  637. this.$container = s('\n <div class="bootstrap-table">\n <div class="fixed-table-toolbar"></div>\n ' + e + '\n <div class="fixed-table-container">\n <div class="fixed-table-header"><table></table></div>\n <div class="fixed-table-body">\n <div class="fixed-table-loading">\n <span class="loading-wrap">\n <span class="loading-text">' + this.options.formatLoadingMessage() + '</span>\n <span class="animation-wrap"><span class="animation-dot"></span></span>\n </span>\n </div>\n </div>\n <div class="fixed-table-footer"><table><thead><tr></tr></thead></table></div>\n </div>\n ' + t + '\n </div>\n '),
  638. this.$container.insertAfter(this.$el),
  639. this.$tableContainer = this.$container.find('.fixed-table-container'),
  640. this.$tableHeader = this.$container.find('.fixed-table-header'),
  641. this.$tableBody = this.$container.find('.fixed-table-body'),
  642. this.$tableLoading = this.$container.find('.fixed-table-loading'),
  643. this.$tableFooter = this.$container.find('.fixed-table-footer'),
  644. this.$toolbar = this.options.buttonsToolbar ? s('body').find(this.options.buttonsToolbar) : this.$container.find('.fixed-table-toolbar'),
  645. this.$pagination = this.$container.find('.fixed-table-pagination'),
  646. this.$tableBody.append(this.$el),
  647. this.$container.after('<div class="clearfix"></div>'),
  648. this.$el.addClass(this.options.classes),
  649. this.$tableLoading.addClass(this.options.classes),
  650. this.options.height && (this.$tableContainer.addClass('fixed-height'), this.options.showFooter && this.$tableContainer.addClass('has-footer'), -1 !== this.options.classes.split(' ').indexOf('table-bordered') && (this.$tableBody.append('<div class="fixed-table-border"></div>'), this.$tableBorder = this.$tableBody.find('.fixed-table-border'), this.$tableLoading.addClass('fixed-table-border')))
  651. }
  652. },
  653. {
  654. key: 'initTable',
  655. value: function() {
  656. var e = this,
  657. o = [],
  658. a = [];
  659. if (this.$header = this.$el.find('>thead'), this.$header.length ? this.options.theadClasses && this.$header.addClass(this.options.theadClasses) : this.$header = s('<thead class="' + this.options.theadClasses + '"></thead>').appendTo(this.$el), this.$header.find('tr').each(function(e, t) {
  660. var a = [];
  661. s(t).find('th').each(function(e, t) {
  662. 'undefined' != typeof s(t).data('field') && s(t).data('field', '' + s(t).data('field')),
  663. a.push(s.extend({},
  664. {
  665. title: s(t).html(),
  666. class: s(t).attr('class'),
  667. titleTooltip: s(t).attr('title'),
  668. rowspan: s(t).attr('rowspan') ? +s(t).attr('rowspan') : void 0,
  669. colspan: s(t).attr('colspan') ? +s(t).attr('colspan') : void 0
  670. },
  671. s(t).data()))
  672. }),
  673. o.push(a)
  674. }), Array.isArray(this.options.columns[0]) || (this.options.columns = [this.options.columns]), this.options.columns = s.extend(!0, [], o, this.options.columns), this.columns = [], this.fieldsColumnsIndex = [], r.setFieldIndex(this.options.columns), this.options.columns.forEach(function(o, a) {
  675. o.forEach(function(o, i) {
  676. var n = s.extend({},
  677. t.COLUMN_DEFAULTS, o);
  678. 'undefined' != typeof n.fieldIndex && (e.columns[n.fieldIndex] = n, e.fieldsColumnsIndex[n.field] = n.fieldIndex),
  679. e.options.columns[a][i] = n
  680. })
  681. }), !this.options.data.length) {
  682. var i = [];
  683. this.$el.find('>tbody>tr').each(function(t, o) {
  684. var n = {};
  685. n._id = s(o).attr('id'),
  686. n._class = s(o).attr('class'),
  687. n._data = r.getRealDataAttr(s(o).data()),
  688. s(o).find('>td').each(function(o, a) {
  689. for (var l = +s(a).attr('colspan') || 1, d = +s(a).attr('rowspan') || 1, c = o; i[t] && i[t][c]; c++);
  690. for (var h = c; h < c + l; h++) for (var g = t; g < t + d; g++) i[g] || (i[g] = []),
  691. i[g][h] = !0;
  692. var p = e.columns[c].field;
  693. n[p] = s(a).html().trim(),
  694. n['_' + p + '_id'] = s(a).attr('id'),
  695. n['_' + p + '_class'] = s(a).attr('class'),
  696. n['_' + p + '_rowspan'] = s(a).attr('rowspan'),
  697. n['_' + p + '_colspan'] = s(a).attr('colspan'),
  698. n['_' + p + '_title'] = s(a).attr('title'),
  699. n['_' + p + '_data'] = r.getRealDataAttr(s(a).data())
  700. }),
  701. a.push(n)
  702. }),
  703. this.options.data = a,
  704. a.length && (this.fromHtml = !0)
  705. }
  706. }
  707. },
  708. {
  709. key: 'initHeader',
  710. value: function() {
  711. var t = this,
  712. e = {},
  713. o = [];
  714. this.header = {
  715. fields: [],
  716. styles: [],
  717. classes: [],
  718. formatters: [],
  719. events: [],
  720. sorters: [],
  721. sortNames: [],
  722. cellStyles: [],
  723. searchables: []
  724. },
  725. this.options.columns.forEach(function(a, n) {
  726. o.push('<tr>'),
  727. 0 === n && !t.options.cardView && t.options.detailView && o.push('<th class="detail" rowspan="' + t.options.columns.length + '">\n <div class="fht-cell"></div>\n </th>\n '),
  728. a.forEach(function(a, i) {
  729. var s = '',
  730. l = '',
  731. d = '',
  732. c = '',
  733. p = r.sprintf(' class="%s"', a['class']),
  734. h = 'px',
  735. g = a.width;
  736. if (void 0 === a.width || t.options.cardView || 'string' != typeof a.width || -1 === a.width.indexOf('%') || (h = '%'), a.width && 'string' == typeof a.width && (g = a.width.replace('%', '').replace('px', '')), l = r.sprintf('text-align: %s; ', a.halign ? a.halign: a.align), d = r.sprintf('text-align: %s; ', a.align), c = r.sprintf('vertical-align: %s; ', a.valign), c += r.sprintf('width: %s; ', (a.checkbox || a.radio) && !g ? a.showSelectTitle ? void 0 : '36px': g ? g + h: void 0), 'undefined' != typeof a.fieldIndex) {
  737. if (t.header.fields[a.fieldIndex] = a.field, t.header.styles[a.fieldIndex] = d + c, t.header.classes[a.fieldIndex] = p, t.header.formatters[a.fieldIndex] = a.formatter, t.header.events[a.fieldIndex] = a.events, t.header.sorters[a.fieldIndex] = a.sorter, t.header.sortNames[a.fieldIndex] = a.sortName, t.header.cellStyles[a.fieldIndex] = a.cellStyle, t.header.searchables[a.fieldIndex] = a.searchable, !a.visible) return;
  738. if (t.options.cardView && !a.cardVisible) return;
  739. e[a.field] = a
  740. }
  741. o.push('<th' + r.sprintf(' title="%s"', a.titleTooltip), a.checkbox || a.radio ? r.sprintf(' class="bs-checkbox %s"', a['class'] || '') : p, r.sprintf(' style="%s"', l + c), r.sprintf(' rowspan="%s"', a.rowspan), r.sprintf(' colspan="%s"', a.colspan), r.sprintf(' data-field="%s"', a.field), 0 === i && 0 < n ? ' data-not-first-th': '', '>'),
  742. o.push(r.sprintf('<div class="th-inner %s">', t.options.sortable && a.sortable ? 'sortable both': '')),
  743. s = t.options.escape ? r.escapeHTML(a.title) : a.title;
  744. var u = s;
  745. a.checkbox && (s = '', !t.options.singleSelect && t.options.checkboxHeader && (s = '<label class="lyear-checkbox checkbox-primary"><input type="checkbox" name="btSelectAll"><span></span></label>'), t.header.stateField = a.field),
  746. a.radio && (s = '', t.header.stateField = a.field, t.options.singleSelect = !0),
  747. !s && a.showSelectTitle && (s += u),
  748. o.push(s),
  749. o.push('</div>'),
  750. o.push('<div class="fht-cell"></div>'),
  751. o.push('</div>'),
  752. o.push('</th>')
  753. }),
  754. o.push('</tr>')
  755. }),
  756. this.$header.html(o.join('')),
  757. this.$header.find('th[data-field]').each(function(t, o) {
  758. s(o).data(e[s(o).data('field')])
  759. }),
  760. this.$container.off('click', '.th-inner').on('click', '.th-inner',
  761. function(o) {
  762. var e = s(o.currentTarget);
  763. return t.options.detailView && !e.parent().hasClass('bs-checkbox') && e.closest('.bootstrap-table')[0] !== t.$container[0] ? !1 : void(t.options.sortable && e.parent().data().sortable && t.onSort(o))
  764. }),
  765. this.$header.children().children().off('keypress').on('keypress',
  766. function(o) {
  767. if (t.options.sortable && s(o.currentTarget).data().sortable) {
  768. var e = o.keyCode || o.which;
  769. 13 === e && t.onSort(o)
  770. }
  771. }),
  772. s(window).off('resize.bootstrap-table'),
  773. !this.options.showHeader || this.options.cardView ? (this.$header.hide(), this.$tableHeader.hide(), this.$tableLoading.css('top', 0)) : (this.$header.show(), this.$tableHeader.show(), this.$tableLoading.css('top', this.$header.outerHeight() + 1), this.getCaret(), s(window).on('resize.bootstrap-table',
  774. function(o) {
  775. return t.resetWidth(o)
  776. })),
  777. this.$selectAll = this.$header.find('[name="btSelectAll"]'),
  778. this.$selectAll.off('click').on('click',
  779. function(e) {
  780. var o = e.currentTarget,
  781. a = s(o).prop('checked');
  782. t[a ? 'checkAll': 'uncheckAll'](),
  783. t.updateSelected()
  784. })
  785. }
  786. },
  787. {
  788. key: 'initFooter',
  789. value: function() { ! this.options.showFooter || this.options.cardView ? this.$tableFooter.hide() : this.$tableFooter.show()
  790. }
  791. },
  792. {
  793. key: 'initData',
  794. value: function(e, t) {
  795. this.options.data = 'append' === t ? this.options.data.concat(e) : 'prepend' === t ? [].concat(e).concat(this.options.data) : e || this.options.data,
  796. this.data = this.options.data,
  797. 'server' === this.options.sidePagination || this.initSort()
  798. }
  799. },
  800. {
  801. key: 'initSort',
  802. value: function() {
  803. var e = this,
  804. t = this.options.sortName,
  805. o = 'desc' === this.options.sortOrder ? -1 : 1,
  806. i = this.header.fields.indexOf(this.options.sortName),
  807. a = 0; - 1 !== i && (this.options.sortStable && this.data.forEach(function(e, t) {
  808. e.hasOwnProperty('_position') || (e._position = t)
  809. }), this.options.customSort ? r.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]) : this.data.sort(function(n, a) {
  810. e.header.sortNames[i] && (t = e.header.sortNames[i]);
  811. var s = r.getItemField(n, t, e.options.escape),
  812. l = r.getItemField(a, t, e.options.escape),
  813. d = r.calculateObjectValue(e.header, e.header.sorters[i], [s, l, n, a]);
  814. return void 0 === d ? ((void 0 === s || null === s) && (s = ''), (void 0 === l || null === l) && (l = ''), e.options.sortStable && s === l && (s = n._position, l = a._position), r.isNumeric(s) && r.isNumeric(l)) ? (s = parseFloat(s), l = parseFloat(l), s < l ? -1 * o: s > l ? o: 0) : s === l ? 0 : ('string' != typeof s && (s = s.toString()), -1 === s.localeCompare(l) ? -1 * o: o) : e.options.sortStable && 0 === d ? o * (n._position - a._position) : o * d
  815. }), void 0 !== this.options.sortClass && (clearTimeout(a), a = setTimeout(function() {
  816. e.$el.removeClass(e.options.sortClass);
  817. var t = e.$header.find('[data-field="' + e.options.sortName + '"]').index();
  818. e.$el.find('tr td:nth-child(' + (t + 1) + ')').addClass(e.options.sortClass)
  819. },
  820. 250)))
  821. }
  822. },
  823. {
  824. key: 'onSort',
  825. value: function(e) {
  826. var t = e.type,
  827. o = e.currentTarget,
  828. a = 'keypress' === t ? s(o) : s(o).parent(),
  829. i = this.$header.find('th').eq(a.index());
  830. return this.$header.add(this.$header_).find('span.order').remove(),
  831. this.options.sortName === a.data('field') ? this.options.sortOrder = 'asc' === this.options.sortOrder ? 'desc': 'asc': (this.options.sortName = a.data('field'), this.options.sortOrder = this.options.rememberOrder ? 'asc' === a.data('order') ? 'desc': 'asc': this.columns[this.fieldsColumnsIndex[a.data('field')]].order),
  832. this.trigger('sort', this.options.sortName, this.options.sortOrder),
  833. a.add(i).data('order', this.options.sortOrder),
  834. this.getCaret(),
  835. 'server' === this.options.sidePagination ? void this.initServer(this.options.silentSort) : void(this.initSort(), this.initBody())
  836. }
  837. },
  838. {
  839. key: 'initToolbar',
  840. value: function() {
  841. var e = this,
  842. t = this.options,
  843. o = [],
  844. a = 0,
  845. i = void 0,
  846. l = void 0,
  847. d = 0;
  848. this.$toolbar.find('.bs-bars').children().length && s('body').append(s(t.toolbar)),
  849. this.$toolbar.html(''),
  850. ('string' == typeof t.toolbar || 'object' === n(t.toolbar)) && s(r.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, t.toolbarAlign)).appendTo(this.$toolbar).append(s(t.toolbar)),
  851. o = ['<div class="' + ['columns', 'columns-' + t.buttonsAlign, this.constants.classes.buttonsGroup, this.constants.classes.pull + '-' + t.buttonsAlign].join(' ') + '">'],
  852. 'string' == typeof t.icons && (t.icons = r.calculateObjectValue(null, t.icons)),
  853. t.showPaginationSwitch && o.push('<button class="' + this.constants.buttonsClass + '" type="button" name="paginationSwitch"\n aria-label="Pagination Switch" title="' + t.formatPaginationSwitch() + '">\n ' + r.sprintf(this.constants.html.icon, t.iconsPrefix, t.icons.paginationSwitchDown) + '\n </button>'),
  854. t.showRefresh && o.push('<button class="' + this.constants.buttonsClass + '" type="button" name="refresh"\n aria-label="Refresh" title="' + t.formatRefresh() + '">\n ' + r.sprintf(this.constants.html.icon, t.iconsPrefix, t.icons.refresh) + '\n </button>'),
  855. t.showToggle && o.push('<button class="' + this.constants.buttonsClass + '" type="button" name="toggle"\n aria-label="Toggle" title="' + t.formatToggle() + '">\n ' + r.sprintf(this.constants.html.icon, t.iconsPrefix, t.icons.toggleOff) + '\n </button>'),
  856. t.showFullscreen && o.push('<button class="' + this.constants.buttonsClass + '" type="button" name="fullscreen"\n aria-label="Fullscreen" title="' + t.formatFullscreen() + '">\n ' + r.sprintf(this.constants.html.icon, t.iconsPrefix, t.icons.fullscreen) + '\n </button>'),
  857. t.showColumns && (o.push('<div class="keep-open ' + this.constants.classes.buttonsDropdown + '" title="' + t.formatColumns() + '">\n <button class="' + this.constants.buttonsClass + ' dropdown-toggle" type="button" data-toggle="dropdown"\n aria-label="Columns" title="' + t.formatFullscreen() + '">\n ' + r.sprintf(this.constants.html.icon, t.iconsPrefix, t.icons.columns) + '\n ' + this.constants.html.dropdownCaret + '\n </button>\n ' + this.constants.html.toobarDropdow[0]), this.columns.forEach(function(a, n) {
  858. if (! (a.radio || a.checkbox) && (!t.cardView || a.cardVisible)) {
  859. var i = a.visible ? ' checked="checked"': '';
  860. a.switchable && (o.push(r.sprintf(e.constants.html.toobarDropdowItem, r.sprintf('<label class="lyear-checkbox checkbox-primary"><input type="checkbox" data-field="%s" value="%s"%s> <span>%s</span></label>', a.field, n, i, a.title))), d++)
  861. }
  862. }), o.push(this.constants.html.toobarDropdow[1], '</div>')),
  863. o.push('</div>'),
  864. (this.showToolbar || 2 < o.length) && this.$toolbar.append(o.join('')),
  865. t.showPaginationSwitch && this.$toolbar.find('button[name="paginationSwitch"]').off('click').on('click',
  866. function() {
  867. return e.togglePagination()
  868. }),
  869. t.showFullscreen && this.$toolbar.find('button[name="fullscreen"]').off('click').on('click',
  870. function() {
  871. return e.toggleFullscreen()
  872. }),
  873. t.showRefresh && this.$toolbar.find('button[name="refresh"]').off('click').on('click',
  874. function() {
  875. return e.refresh()
  876. }),
  877. t.showToggle && this.$toolbar.find('button[name="toggle"]').off('click').on('click',
  878. function() {
  879. e.toggleView()
  880. }),
  881. t.showColumns && (i = this.$toolbar.find('.keep-open'), d <= t.minimumCountColumns && i.find('input').prop('disabled', !0), i.find('li, label').off('click').on('click',
  882. function(t) {
  883. t.stopImmediatePropagation()
  884. }), i.find('input').off('click').on('click',
  885. function(t) {
  886. var o = t.currentTarget,
  887. a = s(o);
  888. e.toggleColumn(a.val(), a.prop('checked'), !1),
  889. e.trigger('column-switch', a.data('field'), a.prop('checked'))
  890. })),
  891. t.search && (o = [], o.push('<div class="' + this.constants.classes.pull + '-' + t.searchAlign + ' search ' + this.constants.classes.inputGroup + '">\n <input class="' + this.constants.classes.input + r.sprintf(' input-%s', t.iconSize) + '"\n type="text" placeholder="' + t.formatSearch() + '">\n </div>'), this.$toolbar.append(o.join('')), l = this.$toolbar.find('.search input'), l.off('keyup drop blur').on('keyup drop blur',
  892. function(o) {
  893. t.searchOnEnterKey && 13 !== o.keyCode || -1 !== [37, 38, 39, 40].indexOf(o.keyCode) || (clearTimeout(a), a = setTimeout(function() {
  894. e.onSearch(o)
  895. },
  896. t.searchTimeOut))
  897. }), r.isIEBrowser() && l.off('mouseup').on('mouseup',
  898. function(o) {
  899. clearTimeout(a),
  900. a = setTimeout(function() {
  901. e.onSearch(o)
  902. },
  903. t.searchTimeOut)
  904. }))
  905. }
  906. },
  907. {
  908. key: 'onSearch',
  909. value: function(e) {
  910. var t = e.currentTarget,
  911. o = e.firedByInitSearchText,
  912. a = s(t).val().trim();
  913. this.options.trimOnSearch && s(t).val() !== a && s(t).val(a),
  914. a === this.searchText || (this.searchText = a, this.options.searchText = a, !o && (this.options.pageNumber = 1), this.initSearch(), o ? 'client' === this.options.sidePagination && this.updatePagination() : this.updatePagination(), this.trigger('search', a))
  915. }
  916. },
  917. {
  918. key: 'initSearch',
  919. value: function() {
  920. var e = this;
  921. if ('server' !== this.options.sidePagination) {
  922. if (this.options.customSearch) return void(this.data = r.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText]));
  923. var t = this.searchText && (this.options.escape ? r.escapeHTML(this.searchText) : this.searchText).toLowerCase(),
  924. o = r.isEmptyObject(this.filterColumns) ? null: this.filterColumns;
  925. this.data = o ? this.options.data.filter(function(e) {
  926. for (var t in o) if (Array.isArray(o[t]) && -1 === o[t].indexOf(e[t]) || !Array.isArray(o[t]) && e[t] !== o[t]) return ! 1;
  927. return ! 0
  928. }) : this.options.data,
  929. this.data = t ? this.data.filter(function(o, a) {
  930. for (var c = 0; c < e.header.fields.length; c++) if (e.header.searchables[c]) {
  931. var i = r.isNumeric(e.header.fields[c]) ? parseInt(e.header.fields[c], 10) : e.header.fields[c],
  932. n = e.columns[e.fieldsColumnsIndex[i]],
  933. s = void 0;
  934. if ('string' == typeof i) {
  935. s = o;
  936. for (var l = i.split('.'), d = 0; d < l.length; d++) null !== s[l[d]] && (s = s[l[d]])
  937. } else s = o[i];
  938. if (n && n.searchFormatter && (s = r.calculateObjectValue(n, e.header.formatters[c], [s, o, a], s)), 'string' == typeof s || 'number' == typeof s) if (e.options.strictSearch) {
  939. if (('' + s).toLowerCase() === t) return ! 0;
  940. } else if ( - 1 !== ('' + s).toLowerCase().indexOf(t)) return ! 0
  941. }
  942. return ! 1
  943. }) : this.data
  944. }
  945. }
  946. },
  947. {
  948. key: 'initPagination',
  949. value: function() {
  950. var e = Math.round,
  951. t = this,
  952. a = this.options;
  953. if (!a.pagination) return void this.$pagination.hide();
  954. this.$pagination.show();
  955. var o = [],
  956. n = !1,
  957. s = void 0,
  958. i = void 0,
  959. l = void 0,
  960. d = void 0,
  961. c = void 0,
  962. p = void 0,
  963. h = void 0,
  964. g = this.getData(),
  965. u = a.pageList;
  966. if ('server' !== a.sidePagination && (a.totalRows = g.length), this.totalPages = 0, a.totalRows) {
  967. if (a.pageSize === a.formatAllRows()) a.pageSize = a.totalRows,
  968. n = !0;
  969. else if (a.pageSize === a.totalRows) {
  970. var $ = 'string' == typeof a.pageList ? a.pageList.replace('[', '').replace(']', '').replace(/ /g, '').toLowerCase().split(',') : a.pageList; - 1 !== $.indexOf(a.formatAllRows().toLowerCase()) && (n = !0)
  971. }
  972. this.totalPages = ~~ ((a.totalRows - 1) / a.pageSize) + 1,
  973. a.totalPages = this.totalPages
  974. }
  975. 0 < this.totalPages && a.pageNumber > this.totalPages && (a.pageNumber = this.totalPages),
  976. this.pageFrom = (a.pageNumber - 1) * a.pageSize + 1,
  977. this.pageTo = a.pageNumber * a.pageSize,
  978. this.pageTo > a.totalRows && (this.pageTo = a.totalRows);
  979. var f = a.onlyInfoPagination ? a.formatDetailPagination(a.totalRows) : a.formatShowingRows(this.pageFrom, this.pageTo, a.totalRows);
  980. if (o.push('<div class="' + this.constants.classes.pull + '-' + a.paginationDetailHAlign + ' pagination-detail">\n <span class="pagination-info">\n ' + f + '\n </span>'), !a.onlyInfoPagination) {
  981. o.push('<span class="page-list">');
  982. var P = ['<span class="' + this.constants.classes.paginationDropdown + '">\n <button class="' + this.constants.buttonsClass + ' dropdown-toggle" type="button" data-toggle="dropdown">\n <span class="page-size">\n ' + (n ? a.formatAllRows() : a.pageSize) + '\n </span>\n ' + this.constants.html.dropdownCaret + '\n </button>\n ' + this.constants.html.pageDropdown[0]];
  983. if ('string' == typeof a.pageList) {
  984. var C = a.pageList.replace('[', '').replace(']', '').replace(/ /g, '').split(',');
  985. u = [];
  986. for (var b = C,
  987. m = Array.isArray(b), y = 0, _iterator9 = m ? b: b[Symbol.iterator]();;) {
  988. var w;
  989. if (m) {
  990. if (y >= b.length) break;
  991. w = b[y++]
  992. } else {
  993. if (y = b.next(), y.done) break;
  994. w = y.value
  995. }
  996. var k = w;
  997. u.push(k.toUpperCase() === a.formatAllRows().toUpperCase() || 'UNLIMITED' === k.toUpperCase() ? a.formatAllRows() : +k)
  998. }
  999. }
  1000. u.forEach(function(e, o) {
  1001. if (!a.smartDisplay || 0 === o || u[o - 1] < a.totalRows) {
  1002. var i;
  1003. i = n ? e === a.formatAllRows() ? t.constants.classes.dropdownActive: '': e === a.pageSize ? t.constants.classes.dropdownActive: '',
  1004. P.push(r.sprintf(t.constants.html.pageDropdownItem, i, e))
  1005. }
  1006. }),
  1007. P.push(this.constants.html.pageDropdown[1] + '</span>'),
  1008. o.push(a.formatRecordsPerPage(P.join(''))),
  1009. o.push('</span></div>'),
  1010. o.push('<div class="' + this.constants.classes.pull + '-' + a.paginationHAlign + ' pagination">', r.sprintf(this.constants.html.pagination[0], r.sprintf(' pagination-%s', a.iconSize)), r.sprintf(this.constants.html.paginationItem, ' page-pre', a.paginationPreText)),
  1011. this.totalPages < a.paginationSuccessivelySize ? (i = 1, l = this.totalPages) : (i = a.pageNumber - a.paginationPagesBySide, l = i + 2 * a.paginationPagesBySide),
  1012. a.pageNumber < a.paginationSuccessivelySize - 1 && (l = a.paginationSuccessivelySize),
  1013. l > this.totalPages && (l = this.totalPages),
  1014. a.paginationSuccessivelySize > this.totalPages - i && (i = i - (a.paginationSuccessivelySize - (this.totalPages - i)) + 1),
  1015. 1 > i && (i = 1),
  1016. l > this.totalPages && (l = this.totalPages);
  1017. var v = e(a.paginationPagesBySide / 2),
  1018. x = function(e) {
  1019. var o = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : '';
  1020. return r.sprintf(t.constants.html.paginationItem, o + (e === a.pageNumber ? ' ' + t.constants.classes.paginationActive: ''), e)
  1021. };
  1022. if (1 < i) {
  1023. var T = a.paginationPagesBySide;
  1024. for (T >= i && (T = i - 1), s = 1; s <= T; s++) o.push(x(s));
  1025. i - 1 === T + 1 ? (s = i - 1, o.push(x(s))) : i - 1 > T && (i - 2 * a.paginationPagesBySide > a.paginationPagesBySide && a.paginationUseIntermediate ? (s = e((i - v) / 2 + v), o.push(x(s, ' page-intermediate'))) : o.push(r.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '...')))
  1026. }
  1027. for (s = i; s <= l; s++) o.push(x(s));
  1028. if (this.totalPages > l) {
  1029. var A = this.totalPages - (a.paginationPagesBySide - 1);
  1030. for (l >= A && (A = l + 1), l + 1 === A - 1 ? (s = l + 1, o.push(x(s))) : A > l + 1 && (this.totalPages - l > 2 * a.paginationPagesBySide && a.paginationUseIntermediate ? (s = e((this.totalPages - v - l) / 2 + l), o.push(x(s, ' page-intermediate'))) : o.push(r.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '...'))), s = A; s <= this.totalPages; s++) o.push(x(s))
  1031. }
  1032. o.push(r.sprintf(this.constants.html.paginationItem, ' page-next', a.paginationNextText)),
  1033. o.push(this.constants.html.pagination[1], '</div>')
  1034. }
  1035. this.$pagination.html(o.join(''));
  1036. var S = -1 === ['bottom', 'both'].indexOf(a.paginationVAlign) ? '': ' ' + this.constants.classes.dropup;
  1037. this.$pagination.last().find('.page-list > span').addClass(S),
  1038. a.onlyInfoPagination || (d = this.$pagination.find('.page-list a'), c = this.$pagination.find('.page-pre'), p = this.$pagination.find('.page-next'), h = this.$pagination.find('.page-item').not('.page-next, .page-pre'), a.smartDisplay && (1 >= this.totalPages && this.$pagination.find('div.pagination').hide(), (2 > u.length || a.totalRows <= u[0]) && this.$pagination.find('span.page-list').hide(), this.$pagination[this.getData().length ? 'show': 'hide']()), !a.paginationLoop && (1 === a.pageNumber && c.addClass('disabled'), a.pageNumber === this.totalPages && p.addClass('disabled')), n && (a.pageSize = a.formatAllRows()), d.off('click').on('click',
  1039. function(o) {
  1040. return t.onPageListChange(o)
  1041. }), c.off('click').on('click',
  1042. function(o) {
  1043. return t.onPagePre(o)
  1044. }), p.off('click').on('click',
  1045. function(o) {
  1046. return t.onPageNext(o)
  1047. }), h.off('click').on('click',
  1048. function(o) {
  1049. return t.onPageNumber(o)
  1050. }))
  1051. }
  1052. },
  1053. {
  1054. key: 'updatePagination',
  1055. value: function(e) {
  1056. e && s(e.currentTarget).hasClass('disabled') || (!this.options.maintainSelected && this.resetRows(), this.initPagination(), 'server' === this.options.sidePagination ? this.initServer() : this.initBody(), this.trigger('page-change', this.options.pageNumber, this.options.pageSize))
  1057. }
  1058. },
  1059. {
  1060. key: 'onPageListChange',
  1061. value: function(e) {
  1062. e.preventDefault();
  1063. var t = s(e.currentTarget);
  1064. return t.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive),
  1065. this.options.pageSize = t.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +t.text(),
  1066. this.$toolbar.find('.page-size').text(this.options.pageSize),
  1067. this.updatePagination(e),
  1068. !1
  1069. }
  1070. },
  1071. {
  1072. key: 'onPagePre',
  1073. value: function(e) {
  1074. return e.preventDefault(),
  1075. 0 == this.options.pageNumber - 1 ? this.options.pageNumber = this.options.totalPages: this.options.pageNumber--,
  1076. this.updatePagination(e),
  1077. !1
  1078. }
  1079. },
  1080. {
  1081. key: 'onPageNext',
  1082. value: function(e) {
  1083. return e.preventDefault(),
  1084. this.options.pageNumber + 1 > this.options.totalPages ? this.options.pageNumber = 1 : this.options.pageNumber++,
  1085. this.updatePagination(e),
  1086. !1
  1087. }
  1088. },
  1089. {
  1090. key: 'onPageNumber',
  1091. value: function(e) {
  1092. if (e.preventDefault(), this.options.pageNumber !== +s(e.currentTarget).text()) return this.options.pageNumber = +s(e.currentTarget).text(),
  1093. this.updatePagination(e),
  1094. !1
  1095. }
  1096. },
  1097. {
  1098. key: 'initRow',
  1099. value: function(e, t) {
  1100. var o = this,
  1101. i = [],
  1102. n = {},
  1103. s = [],
  1104. l = '',
  1105. d = {},
  1106. c = [];
  1107. if (! ( - 1 < r.findIndex(this.hiddenRows, e))) {
  1108. if (n = r.calculateObjectValue(this.options, this.options.rowStyle, [e, t], n), n && n.css) for (var p = function(e) {
  1109. return Object.keys(e).map(function(t) {
  1110. return [t, e[t]]
  1111. })
  1112. } (n.css), h = Array.isArray(p), g = 0, _iterator10 = h ? p: p[Symbol.iterator]();;) {
  1113. var u;
  1114. if (h) {
  1115. if (g >= p.length) break;
  1116. u = p[g++]
  1117. } else {
  1118. if (g = p.next(), g.done) break;
  1119. u = g.value
  1120. }
  1121. var f = u,
  1122. b = a(f, 2),
  1123. m = b[0],
  1124. y = b[1];
  1125. s.push(m + ': ' + y)
  1126. }
  1127. if (d = r.calculateObjectValue(this.options, this.options.rowAttributes, [e, t], d), d) for (var w = function(e) {
  1128. return Object.keys(e).map(function(t) {
  1129. return [t, e[t]]
  1130. })
  1131. } (d), x = Array.isArray(w), S = 0, _iterator11 = x ? w: w[Symbol.iterator]();;) {
  1132. var $;
  1133. if (x) {
  1134. if (S >= w.length) break;
  1135. $ = w[S++]
  1136. } else {
  1137. if (S = w.next(), S.done) break;
  1138. $ = S.value
  1139. }
  1140. var P = $,
  1141. C = a(P, 2),
  1142. T = C[0],
  1143. A = C[1];
  1144. c.push(T + '="' + r.escapeHTML(A) + '"')
  1145. }
  1146. if (e._data && !r.isEmptyObject(e._data)) for (var O = function(e) {
  1147. return Object.keys(e).map(function(t) {
  1148. return [t, e[t]]
  1149. })
  1150. } (e._data), I = Array.isArray(O), R = 0, _iterator12 = I ? O: O[Symbol.iterator]();;) {
  1151. var _;
  1152. if (I) {
  1153. if (R >= O.length) break;
  1154. _ = O[R++]
  1155. } else {
  1156. if (R = O.next(), R.done) break;
  1157. _ = R.value
  1158. }
  1159. var V = _,
  1160. F = a(V, 2),
  1161. B = F[0],
  1162. k = F[1];
  1163. if ('index' === B) return;
  1164. l += ' data-' + B + '="' + k + '"'
  1165. }
  1166. return i.push('<tr', r.sprintf(' %s', c.length ? c.join(' ') : void 0), r.sprintf(' id="%s"', Array.isArray(e) ? void 0 : e._id), r.sprintf(' class="%s"', n.classes || (Array.isArray(e) ? void 0 : e._class)), ' data-index="' + t + '"', r.sprintf(' data-uniqueid="%s"', e[this.options.uniqueId]), r.sprintf('%s', l), '>'),
  1167. this.options.cardView && i.push('<td colspan="' + this.header.fields.length + '"><div class="card-views">'),
  1168. !this.options.cardView && this.options.detailView && (i.push('<td>'), r.calculateObjectValue(null, this.options.detailFilter, [t, e]) && i.push('\n <a class="detail-icon" href="#">\n ' + r.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen) + '\n </a>\n '), i.push('</td>')),
  1169. this.header.fields.forEach(function(n, l) {
  1170. var d = '',
  1171. p = r.getItemField(e, n, o.options.escape),
  1172. h = '',
  1173. g = '',
  1174. z = '',
  1175. u = {},
  1176. f = '',
  1177. b = o.header.classes[l],
  1178. m = '',
  1179. y = '',
  1180. w = '',
  1181. k = '',
  1182. v = '',
  1183. x = o.columns[l];
  1184. if ((!o.fromHtml || 'undefined' != typeof p || x.checkbox || x.radio) && x.visible && (!o.options.cardView || x.cardVisible)) {
  1185. if (x.escape && (p = r.escapeHTML(p)), s.concat([o.header.styles[l]]).length && (m = ' style="' + s.concat([o.header.styles[l]]).join('; ') + '"'), e['_' + n + '_id'] && (f = r.sprintf(' id="%s"', e['_' + n + '_id'])), e['_' + n + '_class'] && (b = r.sprintf(' class="%s"', e['_' + n + '_class'])), e['_' + n + '_rowspan'] && (w = r.sprintf(' rowspan="%s"', e['_' + n + '_rowspan'])), e['_' + n + '_colspan'] && (k = r.sprintf(' colspan="%s"', e['_' + n + '_colspan'])), e['_' + n + '_title'] && (v = r.sprintf(' title="%s"', e['_' + n + '_title'])), u = r.calculateObjectValue(o.header, o.header.cellStyles[l], [p, e, t, n], u), u.classes && (b = ' class="' + u.classes + '"'), u.css) {
  1186. for (var S = [], $ = function(e) {
  1187. return Object.keys(e).map(function(t) {
  1188. return [t, e[t]]
  1189. })
  1190. } (u.css), P = Array.isArray($), C = 0, _iterator13 = P ? $: $[Symbol.iterator]();;) {
  1191. var T;
  1192. if (P) {
  1193. if (C >= $.length) break;
  1194. T = $[C++]
  1195. } else {
  1196. if (C = $.next(), C.done) break;
  1197. T = C.value
  1198. }
  1199. var A = T,
  1200. O = a(A, 2),
  1201. I = O[0],
  1202. R = O[1];
  1203. S.push(I + ': ' + R)
  1204. }
  1205. m = ' style="' + S.concat(o.header.styles[l]).join('; ') + '"'
  1206. }
  1207. if (h = r.calculateObjectValue(x, o.header.formatters[l], [p, e, t, n], p), e['_' + n + '_data'] && !r.isEmptyObject(e['_' + n + '_data'])) for (var _ = function(e) {
  1208. return Object.keys(e).map(function(t) {
  1209. return [t, e[t]]
  1210. })
  1211. } (e['_' + n + '_data']), V = Array.isArray(_), F = 0, _iterator14 = V ? _: _[Symbol.iterator]();;) {
  1212. var B;
  1213. if (V) {
  1214. if (F >= _.length) break;
  1215. B = _[F++]
  1216. } else {
  1217. if (F = _.next(), F.done) break;
  1218. B = F.value
  1219. }
  1220. var N = B,
  1221. j = a(N, 2),
  1222. H = j[0],
  1223. L = j[1];
  1224. if ('index' === H) return;
  1225. y += ' data-' + H + '="' + L + '"'
  1226. }
  1227. if (x.checkbox || x.radio) {
  1228. g = x.checkbox ? 'checkbox': g,
  1229. g = x.radio ? 'radio': g;
  1230. z = x.checkbox ? 'lyear-checkbox checkbox-primary' : z,
  1231. z = x.radio ? 'lyear-radio radio-primary' : z;
  1232. var D = x['class'] || '',
  1233. c = !0 === h || p || h && h.checked,
  1234. E = !x.checkboxEnabled || h && h.disabled;
  1235. d = [o.options.cardView ? '<div class="card-view ' + D + '">': '<td class="bs-checkbox ' + D + '">', '<label class=" ' + z + ' ">\n <input\n data-index="' + t + '"\n name="' + o.options.selectItemName + '"\n type="' + g + '"\n ' + r.sprintf('value="%s"', e[o.options.idField]) + '\n ' + r.sprintf('checked="%s"', c ? 'checked': void 0) + '\n ' + r.sprintf('disabled="%s"', E ? 'disabled': void 0) + ' />\n <span></span>\n </label>', o.header.formatters[l] && 'string' == typeof h ? h: '', o.options.cardView ? '</div>': '</td>'].join(''),
  1236. e[o.header.stateField] = !0 === h || !!p || h && h.checked
  1237. } else if (h = 'undefined' == typeof h || null === h ? o.options.undefinedText: h, o.options.cardView) {
  1238. var U = o.options.showHeader ? '<span class="card-view-title"' + m + '>' + r.getFieldTitle(o.columns, n) + '</span>': '';
  1239. d = '<div class="card-view">' + U + '<span class="card-view-value">' + h + '</span></div>',
  1240. o.options.smartDisplay && '' === h && (d = '<div class="card-view"></div>')
  1241. } else d = '<td' + f + b + m + y + w + k + v + '>' + h + '</td>';
  1242. i.push(d)
  1243. }
  1244. }),
  1245. this.options.cardView && i.push('</div></td>'),
  1246. i.push('</tr>'),
  1247. i.join('')
  1248. }
  1249. }
  1250. },
  1251. {
  1252. key: 'initBody',
  1253. value: function(e) {
  1254. var t = this,
  1255. o = this.getData();
  1256. this.trigger('pre-body', o),
  1257. this.$body = this.$el.find('>tbody'),
  1258. this.$body.length || (this.$body = s('<tbody></tbody>').appendTo(this.$el)),
  1259. this.options.pagination && 'server' !== this.options.sidePagination || (this.pageFrom = 1, this.pageTo = o.length);
  1260. for (var n = s(document.createDocumentFragment()), l = !1, d = this.pageFrom - 1; d < this.pageTo; d++) {
  1261. var i = o[d],
  1262. c = this.initRow(i, d, o, n);
  1263. l = l || !!c,
  1264. c && 'string' == typeof c && n.append(c)
  1265. }
  1266. l ? this.$body.html(n) : this.$body.html('<tr class="no-records-found">' + r.sprintf('<td colspan="%s">%s</td>', this.$header.find('th').length, this.options.formatNoMatches()) + '</tr>'),
  1267. e || this.scrollTo(0),
  1268. this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick',
  1269. function(e) {
  1270. var o = e.currentTarget,
  1271. a = e.type,
  1272. i = e.target,
  1273. n = s(o),
  1274. l = n.parent(),
  1275. d = s(i).parents('.card-views').children(),
  1276. c = s(i).parents('.card-view'),
  1277. p = t.data[l.data('index')],
  1278. h = t.options.cardView ? d.index(c) : n[0].cellIndex,
  1279. g = t.getVisibleFields(),
  1280. u = g[t.options.detailView && !t.options.cardView ? h - 1 : h],
  1281. f = t.columns[t.fieldsColumnsIndex[u]],
  1282. b = r.getItemField(p, u, t.options.escape);
  1283. if (!n.find('.detail-icon').length && (t.trigger('click' === a ? 'click-cell': 'dbl-click-cell', u, b, p, n), t.trigger('click' === a ? 'click-row': 'dbl-click-row', p, l, u), 'click' === a && t.options.clickToSelect && f.clickToSelect && !r.calculateObjectValue(t.options, t.options.ignoreClickToSelectOn, [i]))) {
  1284. var m = l.find(r.sprintf('[name="%s"]', t.options.selectItemName));
  1285. m.length && m[0].click()
  1286. }
  1287. }),
  1288. this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click',
  1289. function(a) {
  1290. a.preventDefault();
  1291. var e = s(a.currentTarget),
  1292. i = e.parent().parent(),
  1293. n = i.data('index'),
  1294. l = o[n];
  1295. if (i.next().is('tr.detail-view')) e.html(r.sprintf(t.constants.html.icon, t.options.iconsPrefix, t.options.icons.detailOpen)),
  1296. t.trigger('collapse-row', n, l, i.next()),
  1297. i.next().remove();
  1298. else {
  1299. e.html(r.sprintf(t.constants.html.icon, t.options.iconsPrefix, t.options.icons.detailClose)),
  1300. i.after(r.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', i.children('td').length));
  1301. var d = i.next().find('td'),
  1302. c = r.calculateObjectValue(t.options, t.options.detailFormatter, [n, l, d], '');
  1303. 1 === d.length && d.append(c),
  1304. t.trigger('expand-row', n, l, d)
  1305. }
  1306. return t.resetView(),
  1307. !1
  1308. }),
  1309. this.$selectItem = this.$body.find(r.sprintf('[name="%s"]', this.options.selectItemName)),
  1310. this.$selectItem.off('click').on('click',
  1311. function(o) {
  1312. o.stopImmediatePropagation();
  1313. var e = s(o.currentTarget);
  1314. t.check_(e.prop('checked'), e.data('index'))
  1315. }),
  1316. this.header.events.forEach(function(e, o) {
  1317. var i = e;
  1318. if (i) {
  1319. 'string' == typeof i && (i = r.calculateObjectValue(null, i));
  1320. var n = t.header.fields[o],
  1321. l = t.getVisibleFields().indexOf(n);
  1322. if ( - 1 !== l) {
  1323. t.options.detailView && !t.options.cardView && (l += 1);
  1324. for (var d = function() {
  1325. if (p) {
  1326. if (h >= c.length) return 'break';
  1327. g = c[h++]
  1328. } else {
  1329. if (h = c.next(), h.done) return 'break';
  1330. g = h.value
  1331. }
  1332. var e = g,
  1333. o = a(e, 2),
  1334. r = o[0],
  1335. i = o[1];
  1336. t.$body.find('>tr:not(.no-records-found)').each(function(e, o) {
  1337. var a = s(o),
  1338. d = a.find(t.options.cardView ? '.card-view': 'td').eq(l),
  1339. c = r.indexOf(' '),
  1340. p = r.substring(0, c),
  1341. h = r.substring(c + 1);
  1342. d.find(h).off(p).on(p,
  1343. function(o) {
  1344. var e = a.data('index'),
  1345. s = t.data[e],
  1346. l = s[n];
  1347. i.apply(t, [o, l, s, e])
  1348. })
  1349. })
  1350. },
  1351. c = function(e) {
  1352. return Object.keys(e).map(function(t) {
  1353. return [t, e[t]]
  1354. })
  1355. } (i), p = Array.isArray(c), h = 0, _iterator15 = p ? c: c[Symbol.iterator]();;) {
  1356. var g, u = d();
  1357. if ('break' === u) break
  1358. }
  1359. }
  1360. }
  1361. }),
  1362. this.updateSelected(),
  1363. this.resetView(),
  1364. this.trigger('post-body', o)
  1365. }
  1366. },
  1367. {
  1368. key: 'initServer',
  1369. value: function(e, t, o) {
  1370. var a = this,
  1371. i = {},
  1372. n = this.header.fields.indexOf(this.options.sortName),
  1373. l = {
  1374. searchText: this.searchText,
  1375. sortName: this.options.sortName,
  1376. sortOrder: this.options.sortOrder
  1377. };
  1378. if ((this.header.sortNames[n] && (l.sortName = this.header.sortNames[n]), this.options.pagination && 'server' === this.options.sidePagination && (l.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows: this.options.pageSize, l.pageNumber = this.options.pageNumber), o || this.options.url || this.options.ajax) && ('limit' === this.options.queryParamsType && (l = {
  1379. search: l.searchText,
  1380. sort: l.sortName,
  1381. order: l.sortOrder
  1382. },
  1383. this.options.pagination && 'server' === this.options.sidePagination && (l.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1), l.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows: this.options.pageSize, 0 === l.limit && delete l.limit)), r.isEmptyObject(this.filterColumnsPartial) || (l.filter = JSON.stringify(this.filterColumnsPartial, null)), i = r.calculateObjectValue(this.options, this.options.queryParams, [l], i), s.extend(i, t || {}), !1 !== i)) {
  1384. e || this.showLoading();
  1385. var d = s.extend({},
  1386. r.calculateObjectValue(null, this.options.ajaxOptions), {
  1387. type: this.options.method,
  1388. url: o || this.options.url,
  1389. data: 'application/json' === this.options.contentType && 'post' === this.options.method ? JSON.stringify(i) : i,
  1390. cache: this.options.cache,
  1391. contentType: this.options.contentType,
  1392. dataType: this.options.dataType,
  1393. success: function(t) {
  1394. var o = r.calculateObjectValue(a.options, a.options.responseHandler, [t], t);
  1395. a.load(o),
  1396. a.trigger('load-success', o),
  1397. e || a.hideLoading()
  1398. },
  1399. error: function(t) {
  1400. var o = [];
  1401. 'server' === a.options.sidePagination && (o = {},
  1402. o[a.options.totalField] = 0, o[a.options.dataField] = []),
  1403. a.load(o),
  1404. a.trigger('load-error', t.status, t),
  1405. e || a.$tableLoading.hide()
  1406. }
  1407. });
  1408. return this.options.ajax ? r.calculateObjectValue(this, this.options.ajax, [d], null) : (this._xhr && 4 !== this._xhr.readyState && this._xhr.abort(), this._xhr = s.ajax(d)),
  1409. i
  1410. }
  1411. }
  1412. },
  1413. {
  1414. key: 'initSearchText',
  1415. value: function() {
  1416. if (this.options.search && (this.searchText = '', '' !== this.options.searchText)) {
  1417. var e = this.$toolbar.find('.search input');
  1418. e.val(this.options.searchText),
  1419. this.onSearch({
  1420. currentTarget: e,
  1421. firedByInitSearchText: !0
  1422. })
  1423. }
  1424. }
  1425. },
  1426. {
  1427. key: 'getCaret',
  1428. value: function() {
  1429. var e = this;
  1430. this.$header.find('th').each(function(t, o) {
  1431. s(o).find('.sortable').removeClass('desc asc').addClass(s(o).data('field') === e.options.sortName ? e.options.sortOrder: 'both')
  1432. })
  1433. }
  1434. },
  1435. {
  1436. key: 'updateSelected',
  1437. value: function() {
  1438. var e = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
  1439. this.$selectAll.add(this.$selectAll_).prop('checked', e),
  1440. this.$selectItem.each(function(e, t) {
  1441. s(t).closest('tr')[s(t).prop('checked') ? 'addClass': 'removeClass']('selected')
  1442. })
  1443. }
  1444. },
  1445. {
  1446. key: 'updateRows',
  1447. value: function() {
  1448. var e = this;
  1449. this.$selectItem.each(function(t, o) {
  1450. e.data[s(o).data('index')][e.header.stateField] = s(o).prop('checked')
  1451. })
  1452. }
  1453. },
  1454. {
  1455. key: 'resetRows',
  1456. value: function() {
  1457. for (var e = this.data,
  1458. t = Array.isArray(e), o = 0, _iterator16 = t ? e: e[Symbol.iterator]();;) {
  1459. var a;
  1460. if (t) {
  1461. if (o >= e.length) break;
  1462. a = e[o++]
  1463. } else {
  1464. if (o = e.next(), o.done) break;
  1465. a = o.value
  1466. }
  1467. var i = a;
  1468. this.$selectAll.prop('checked', !1),
  1469. this.$selectItem.prop('checked', !1),
  1470. this.header.stateField && (i[this.header.stateField] = !1)
  1471. }
  1472. this.initHiddenRows()
  1473. }
  1474. },
  1475. {
  1476. key: 'trigger',
  1477. value: function(e) {
  1478. for (var o, a = e + '.bs.table',
  1479. i = arguments.length,
  1480. n = Array(1 < i ? i - 1 : 0), l = 1; l < i; l++) n[l - 1] = arguments[l]; (o = this.options)[t.EVENTS[a]].apply(o, n),
  1481. this.$el.trigger(s.Event(a), n),
  1482. this.options.onAll(a, n),
  1483. this.$el.trigger(s.Event('all.bs.table'), [a, n])
  1484. }
  1485. },
  1486. {
  1487. key: 'resetHeader',
  1488. value: function() {
  1489. var e = this;
  1490. clearTimeout(this.timeoutId_),
  1491. this.timeoutId_ = setTimeout(function() {
  1492. return e.fitHeader()
  1493. },
  1494. this.$el.is(':hidden') ? 100 : 0)
  1495. }
  1496. },
  1497. {
  1498. key: 'fitHeader',
  1499. value: function() {
  1500. var e = this;
  1501. if (this.$el.is(':hidden')) return void(this.timeoutId_ = setTimeout(function() {
  1502. return e.fitHeader()
  1503. },
  1504. 100));
  1505. var t = this.$tableBody.get(0),
  1506. o = t.scrollWidth > t.clientWidth && t.scrollHeight > t.clientHeight + this.$header.outerHeight() ? r.getScrollBarWidth() : 0;
  1507. this.$el.css('margin-top', -this.$header.outerHeight());
  1508. var a = s(':focus');
  1509. if (0 < a.length) {
  1510. var c = a.parents('th');
  1511. if (0 < c.length) {
  1512. var p = c.attr('data-field');
  1513. if (void 0 !== p) {
  1514. var h = this.$header.find('[data-field=\'' + p + '\']');
  1515. 0 < h.length && h.find(':input').addClass('focus-temp')
  1516. }
  1517. }
  1518. }
  1519. this.$header_ = this.$header.clone(!0, !0),
  1520. this.$selectAll_ = this.$header_.find('[name="btSelectAll"]'),
  1521. this.$tableHeader.css('margin-right', o).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_),
  1522. this.$tableLoading.css('width', this.$el.outerWidth());
  1523. var i = s('.focus-temp:visible:eq(0)');
  1524. 0 < i.length && (i.focus(), this.$header.find('.focus-temp').removeClass('focus-temp')),
  1525. this.$header.find('th[data-field]').each(function(t, o) {
  1526. e.$header_.find(r.sprintf('th[data-field="%s"]', s(o).data('field'))).data(s(o).data())
  1527. });
  1528. for (var n = this.getVisibleFields(), l = this.$header_.find('th'), d = this.$body.find('>tr:first-child:not(.no-records-found)'); d.length && d.find('>td[colspan]:not([colspan="1"])').length;) d = d.next();
  1529. d.find('> *').each(function(t, o) {
  1530. var a = s(o),
  1531. i = t;
  1532. if (e.options.detailView && !e.options.cardView) {
  1533. if (0 === t) {
  1534. var d = l.filter('.detail'),
  1535. c = d.width() - d.find('.fht-cell').width();
  1536. d.find('.fht-cell').width(a.innerWidth() - c)
  1537. }
  1538. i = t - 1
  1539. }
  1540. if ( - 1 !== i) {
  1541. var p = e.$header_.find(r.sprintf('th[data-field="%s"]', n[i]));
  1542. 1 < p.length && (p = s(l[a[0].cellIndex]));
  1543. var h = p.width() - p.find('.fht-cell').width();
  1544. p.find('.fht-cell').width(a.innerWidth() - h)
  1545. }
  1546. }),
  1547. this.horizontalScroll(),
  1548. this.trigger('post-header')
  1549. }
  1550. },
  1551. {
  1552. key: 'resetFooter',
  1553. value: function() {
  1554. var e = this.getData(),
  1555. t = [];
  1556. if (this.options.showFooter && !this.options.cardView) { ! this.options.cardView && this.options.detailView && t.push('<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>');
  1557. for (var o = this.columns,
  1558. i = Array.isArray(o), n = 0, _iterator17 = i ? o: o[Symbol.iterator]();;) {
  1559. var s;
  1560. if (i) {
  1561. if (n >= o.length) break;
  1562. s = o[n++]
  1563. } else {
  1564. if (n = o.next(), n.done) break;
  1565. s = n.value
  1566. }
  1567. var l = s,
  1568. d = '',
  1569. c = '',
  1570. p = [],
  1571. h = {},
  1572. g = r.sprintf(' class="%s"', l['class']);
  1573. if (l.visible) {
  1574. if (this.options.cardView && !l.cardVisible) return;
  1575. if (d = r.sprintf('text-align: %s; ', l.falign ? l.falign: l.align), c = r.sprintf('vertical-align: %s; ', l.valign), h = r.calculateObjectValue(null, this.options.footerStyle, [l]), h && h.css) for (var u = function(e) {
  1576. return Object.keys(e).map(function(t) {
  1577. return [t, e[t]]
  1578. })
  1579. } (h.css), f = Array.isArray(u), b = 0, _iterator18 = f ? u: u[Symbol.iterator]();;) {
  1580. var m;
  1581. if (f) {
  1582. if (b >= u.length) break;
  1583. m = u[b++]
  1584. } else {
  1585. if (b = u.next(), b.done) break;
  1586. m = b.value
  1587. }
  1588. var y = m,
  1589. w = a(y, 2),
  1590. k = w[0],
  1591. v = w[1];
  1592. p.push(k + ': ' + v)
  1593. }
  1594. h && h.classes && (g = r.sprintf(' class="%s"', l['class'] ? [l['class'], h.classes].join(' ') : h.classes)),
  1595. t.push('<th', g, r.sprintf(' style="%s"', d + c + p.concat().join('; ')), '>'),
  1596. t.push('<div class="th-inner">'),
  1597. t.push(r.calculateObjectValue(l, l.footerFormatter, [e], '')),
  1598. t.push('</div>'),
  1599. t.push('<div class="fht-cell"></div>'),
  1600. t.push('</div>'),
  1601. t.push('</th>')
  1602. }
  1603. }
  1604. this.$tableFooter.find('tr').html(t.join('')),
  1605. this.$tableFooter.show(),
  1606. this.fitFooter()
  1607. }
  1608. }
  1609. },
  1610. {
  1611. key: 'fitFooter',
  1612. value: function() {
  1613. var e = this;
  1614. if (this.$el.is(':hidden')) return void setTimeout(function() {
  1615. return e.fitFooter()
  1616. },
  1617. 100);
  1618. var t = this.$tableBody.get(0),
  1619. o = t.scrollWidth > t.clientWidth && t.scrollHeight > t.clientHeight + this.$header.outerHeight() ? r.getScrollBarWidth() : 0;
  1620. this.$tableFooter.css('margin-right', o).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
  1621. for (var a = this.getVisibleFields(), n = this.$tableFooter.find('th'), i = this.$body.find('>tr:first-child:not(.no-records-found)'); i.length && i.find('>td[colspan]:not([colspan="1"])').length;) i = i.next();
  1622. i.find('> *').each(function(t, o) {
  1623. var a = s(o),
  1624. i = t;
  1625. if (e.options.detailView && !e.options.cardView) {
  1626. if (0 === t) {
  1627. var l = n.filter('.detail'),
  1628. r = l.width() - l.find('.fht-cell').width();
  1629. l.find('.fht-cell').width(a.innerWidth() - r)
  1630. }
  1631. i = t - 1
  1632. }
  1633. if ( - 1 !== i) {
  1634. var d = n.eq(t),
  1635. c = d.width() - d.find('.fht-cell').width();
  1636. d.find('.fht-cell').width(a.innerWidth() - c)
  1637. }
  1638. }),
  1639. this.horizontalScroll()
  1640. }
  1641. },
  1642. {
  1643. key: 'horizontalScroll',
  1644. value: function() {
  1645. var e = this;
  1646. this.trigger('scroll-body'),
  1647. this.$tableBody.off('scroll').on('scroll',
  1648. function(t) {
  1649. var o = t.currentTarget;
  1650. e.options.showHeader && e.options.height && e.$tableHeader.scrollLeft(s(o).scrollLeft()),
  1651. e.options.showFooter && !e.options.cardView && e.$tableFooter.scrollLeft(s(o).scrollLeft())
  1652. })
  1653. }
  1654. },
  1655. {
  1656. key: 'toggleColumn',
  1657. value: function(e, t, o) {
  1658. if ( - 1 !== e && (this.columns[e].visible = t, this.initHeader(), this.initSearch(), this.initPagination(), this.initBody(), this.options.showColumns)) {
  1659. var a = this.$toolbar.find('.keep-open input').prop('disabled', !1);
  1660. o && a.filter(r.sprintf('[value="%s"]', e)).prop('checked', t),
  1661. a.filter(':checked').length <= this.options.minimumCountColumns && a.filter(':checked').prop('disabled', !0)
  1662. }
  1663. }
  1664. },
  1665. {
  1666. key: 'getVisibleFields',
  1667. value: function() {
  1668. for (var e = [], t = this.header.fields, o = Array.isArray(t), a = 0, _iterator19 = o ? t: t[Symbol.iterator]();;) {
  1669. var i;
  1670. if (o) {
  1671. if (a >= t.length) break;
  1672. i = t[a++]
  1673. } else {
  1674. if (a = t.next(), a.done) break;
  1675. i = a.value
  1676. }
  1677. var n = i,
  1678. s = this.columns[this.fieldsColumnsIndex[n]];
  1679. s.visible && e.push(n)
  1680. }
  1681. return e
  1682. }
  1683. },
  1684. {
  1685. key: 'resetView',
  1686. value: function(e) {
  1687. var t = 0;
  1688. if (e && e.height && (this.options.height = e.height), this.$selectAll.prop('checked', 0 < this.$selectItem.length && this.$selectItem.length === this.$selectItem.filter(':checked').length), this.options.cardView) return this.$el.css('margin-top', '0'),
  1689. this.$tableContainer.css('padding-bottom', '0'),
  1690. void this.$tableFooter.hide();
  1691. if (this.options.showHeader && this.options.height ? (this.$tableHeader.show(), this.resetHeader(), t += this.$header.outerHeight(!0)) : (this.$tableHeader.hide(), this.trigger('post-header')), this.options.showFooter && (this.resetFooter(), this.options.height && (t += this.$tableFooter.outerHeight(!0))), this.options.height) {
  1692. var o = this.$toolbar.outerHeight(!0),
  1693. a = this.$pagination.outerHeight(!0),
  1694. i = this.options.height - o - a,
  1695. n = this.$tableBody.find('table').outerHeight(!0);
  1696. this.$tableContainer.css('height', i + 'px'),
  1697. this.$tableBorder && this.$tableBorder.css('height', i - n - t - 1 + 'px')
  1698. }
  1699. this.getCaret(),
  1700. this.$tableContainer.css('padding-bottom', t + 'px'),
  1701. this.trigger('reset-view')
  1702. }
  1703. },
  1704. {
  1705. key: 'getData',
  1706. value: function(e) {
  1707. var t = this.options.data;
  1708. return (this.searchText || this.options.sortName || !r.isEmptyObject(this.filterColumns) || !r.isEmptyObject(this.filterColumnsPartial)) && (t = this.data),
  1709. e ? t.slice(this.pageFrom - 1, this.pageTo) : t
  1710. }
  1711. },
  1712. {
  1713. key: 'load',
  1714. value: function(e) {
  1715. var t = !1,
  1716. o = e;
  1717. this.options.pagination && 'server' === this.options.sidePagination && (this.options.totalRows = o[this.options.totalField]),
  1718. t = o.fixedScroll,
  1719. o = Array.isArray(o) ? o: o[this.options.dataField],
  1720. this.initData(o),
  1721. this.initSearch(),
  1722. this.initPagination(),
  1723. this.initBody(t)
  1724. }
  1725. },
  1726. {
  1727. key: 'append',
  1728. value: function(e) {
  1729. this.initData(e, 'append'),
  1730. this.initSearch(),
  1731. this.initPagination(),
  1732. this.initSort(),
  1733. this.initBody(!0)
  1734. }
  1735. },
  1736. {
  1737. key: 'prepend',
  1738. value: function(e) {
  1739. this.initData(e, 'prepend'),
  1740. this.initSearch(),
  1741. this.initPagination(),
  1742. this.initSort(),
  1743. this.initBody(!0)
  1744. }
  1745. },
  1746. {
  1747. key: 'remove',
  1748. value: function(e) {
  1749. var t = this.options.data.length,
  1750. o = void 0,
  1751. a = void 0;
  1752. if (e.hasOwnProperty('field') && e.hasOwnProperty('values')) {
  1753. for (o = t - 1; 0 <= o; o--)(a = this.options.data[o], !!a.hasOwnProperty(e.field)) && -1 !== e.values.indexOf(a[e.field]) && (this.options.data.splice(o, 1), 'server' === this.options.sidePagination && (this.options.totalRows -= 1));
  1754. t === this.options.data.length || (this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0))
  1755. }
  1756. }
  1757. },
  1758. {
  1759. key: 'removeAll',
  1760. value: function() {
  1761. 0 < this.options.data.length && (this.options.data.splice(0, this.options.data.length), this.initSearch(), this.initPagination(), this.initBody(!0))
  1762. }
  1763. },
  1764. {
  1765. key: 'getRowByUniqueId',
  1766. value: function(e) {
  1767. var t = this.options.uniqueId,
  1768. o = this.options.data.length,
  1769. a = e,
  1770. n = null,
  1771. s = void 0,
  1772. i = void 0,
  1773. l = void 0;
  1774. for (s = o - 1; 0 <= s; s--) {
  1775. if (i = this.options.data[s], i.hasOwnProperty(t)) l = i[t];
  1776. else if (i._data && i._data.hasOwnProperty(t)) l = i._data[t];
  1777. else continue;
  1778. if ('string' == typeof l ? a = a.toString() : 'number' == typeof l && ( + l === l && 0 == l % 1 ? a = parseInt(a) : l === +l && 0 !== l && (a = parseFloat(a))), l === a) {
  1779. n = i;
  1780. break
  1781. }
  1782. }
  1783. return n
  1784. }
  1785. },
  1786. {
  1787. key: 'removeByUniqueId',
  1788. value: function(e) {
  1789. var t = this.options.data.length,
  1790. o = this.getRowByUniqueId(e);
  1791. o && this.options.data.splice(this.options.data.indexOf(o), 1),
  1792. t === this.options.data.length || (this.initSearch(), this.initPagination(), this.initBody(!0))
  1793. }
  1794. },
  1795. {
  1796. key: 'updateByUniqueId',
  1797. value: function(e) {
  1798. for (var t = Array.isArray(e) ? e: [e], o = t, a = Array.isArray(o), i = 0, _iterator20 = a ? o: o[Symbol.iterator]();;) {
  1799. var n;
  1800. if (a) {
  1801. if (i >= o.length) break;
  1802. n = o[i++]
  1803. } else {
  1804. if (i = o.next(), i.done) break;
  1805. n = i.value
  1806. }
  1807. var l = n;
  1808. if (l.hasOwnProperty('id') && l.hasOwnProperty('row')) {
  1809. var r = this.options.data.indexOf(this.getRowByUniqueId(l.id)); - 1 !== r && s.extend(this.options.data[r], l.row)
  1810. }
  1811. }
  1812. this.initSearch(),
  1813. this.initPagination(),
  1814. this.initSort(),
  1815. this.initBody(!0)
  1816. }
  1817. },
  1818. {
  1819. key: 'refreshColumnTitle',
  1820. value: function(e) {
  1821. if (e.hasOwnProperty('field') && e.hasOwnProperty('title') && (this.columns[this.fieldsColumnsIndex[e.field]].title = this.options.escape ? r.escapeHTML(e.title) : e.title, this.columns[this.fieldsColumnsIndex[e.field]].visible)) {
  1822. var t = void 0 === this.options.height ? this.$header: this.$tableHeader;
  1823. t.find('th[data-field]').each(function(t, o) {
  1824. if (s(o).data('field') === e.field) return s(s(o).find('.th-inner')[0]).text(e.title),
  1825. !1
  1826. })
  1827. }
  1828. }
  1829. },
  1830. {
  1831. key: 'insertRow',
  1832. value: function(e) {
  1833. e.hasOwnProperty('index') && e.hasOwnProperty('row') && (this.options.data.splice(e.index, 0, e.row), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0))
  1834. }
  1835. },
  1836. {
  1837. key: 'updateRow',
  1838. value: function(e) {
  1839. for (var t = Array.isArray(e) ? e: [e], o = t, a = Array.isArray(o), i = 0, _iterator21 = a ? o: o[Symbol.iterator]();;) {
  1840. var n;
  1841. if (a) {
  1842. if (i >= o.length) break;
  1843. n = o[i++]
  1844. } else {
  1845. if (i = o.next(), i.done) break;
  1846. n = i.value
  1847. }
  1848. var l = n;
  1849. l.hasOwnProperty('index') && l.hasOwnProperty('row') && s.extend(this.options.data[l.index], l.row)
  1850. }
  1851. this.initSearch(),
  1852. this.initPagination(),
  1853. this.initSort(),
  1854. this.initBody(!0)
  1855. }
  1856. },
  1857. {
  1858. key: 'initHiddenRows',
  1859. value: function() {
  1860. this.hiddenRows = []
  1861. }
  1862. },
  1863. {
  1864. key: 'showRow',
  1865. value: function(e) {
  1866. this.toggleRow(e, !0)
  1867. }
  1868. },
  1869. {
  1870. key: 'hideRow',
  1871. value: function(e) {
  1872. this.toggleRow(e, !1)
  1873. }
  1874. },
  1875. {
  1876. key: 'toggleRow',
  1877. value: function(e, t) {
  1878. var o;
  1879. if (e.hasOwnProperty('index') ? o = this.getData()[e.index] : e.hasOwnProperty('uniqueId') && (o = this.getRowByUniqueId(e.uniqueId)), !!o) {
  1880. var a = r.findIndex(this.hiddenRows, o);
  1881. t || -1 !== a ? t && -1 < a && this.hiddenRows.splice(a, 1) : this.hiddenRows.push(o),
  1882. this.initBody(!0)
  1883. }
  1884. }
  1885. },
  1886. {
  1887. key: 'getHiddenRows',
  1888. value: function(e) {
  1889. if (e) return this.initHiddenRows(),
  1890. void this.initBody(!0);
  1891. for (var t = this.getData(), o = [], a = t, i = Array.isArray(a), n = 0, _iterator22 = i ? a: a[Symbol.iterator]();;) {
  1892. var s;
  1893. if (i) {
  1894. if (n >= a.length) break;
  1895. s = a[n++]
  1896. } else {
  1897. if (n = a.next(), n.done) break;
  1898. s = n.value
  1899. }
  1900. var l = s; - 1 !== this.hiddenRows.indexOf(l) && o.push(l)
  1901. }
  1902. return this.hiddenRows = o,
  1903. o
  1904. }
  1905. },
  1906. {
  1907. key: 'mergeCells',
  1908. value: function(e) {
  1909. var t = e.index,
  1910. o = this.getVisibleFields().indexOf(e.field),
  1911. a = e.rowspan || 1,
  1912. n = e.colspan || 1,
  1913. s = void 0,
  1914. i = void 0,
  1915. l = this.$body.find('>tr');
  1916. this.options.detailView && !this.options.cardView && (o += 1);
  1917. var r = l.eq(t).find('>td').eq(o);
  1918. if (! (0 > t || 0 > o || t >= this.data.length)) {
  1919. for (s = t; s < t + a; s++) for (i = o; i < o + n; i++) l.eq(s).find('>td').eq(i).hide();
  1920. r.attr('rowspan', a).attr('colspan', n).show()
  1921. }
  1922. }
  1923. },
  1924. {
  1925. key: 'updateCell',
  1926. value: function(e) {
  1927. e.hasOwnProperty('index') && e.hasOwnProperty('field') && e.hasOwnProperty('value') && (this.data[e.index][e.field] = e.value, !1 === e.reinit || (this.initSort(), this.initBody(!0)))
  1928. }
  1929. },
  1930. {
  1931. key: 'updateCellById',
  1932. value: function(e) {
  1933. var t = this;
  1934. if (e.hasOwnProperty('id') && e.hasOwnProperty('field') && e.hasOwnProperty('value')) {
  1935. var o = Array.isArray(e) ? e: [e];
  1936. o.forEach(function(e) {
  1937. var o = e.id,
  1938. a = e.field,
  1939. i = e.value,
  1940. n = t.options.data.indexOf(t.getRowByUniqueId(o)); - 1 === n || (t.data[n][a] = i)
  1941. }),
  1942. !1 === e.reinit || (this.initSort(), this.initBody(!0))
  1943. }
  1944. }
  1945. },
  1946. {
  1947. key: 'getOptions',
  1948. value: function() {
  1949. var e = JSON.parse(JSON.stringify(this.options));
  1950. return delete e.data,
  1951. e
  1952. }
  1953. },
  1954. {
  1955. key: 'getSelections',
  1956. value: function() {
  1957. var e = this;
  1958. return this.options.data.filter(function(t) {
  1959. return ! 0 === t[e.header.stateField]
  1960. })
  1961. }
  1962. },
  1963. {
  1964. key: 'getAllSelections',
  1965. value: function() {
  1966. var e = this;
  1967. return this.options.data.filter(function(t) {
  1968. return t[e.header.stateField]
  1969. })
  1970. }
  1971. },
  1972. {
  1973. key: 'checkAll',
  1974. value: function() {
  1975. this.checkAll_(!0)
  1976. }
  1977. },
  1978. {
  1979. key: 'uncheckAll',
  1980. value: function() {
  1981. this.checkAll_(!1)
  1982. }
  1983. },
  1984. {
  1985. key: 'checkInvert',
  1986. value: function() {
  1987. var e = this.$selectItem.filter(':enabled'),
  1988. t = e.filter(':checked');
  1989. e.each(function(e, t) {
  1990. s(t).prop('checked', !s(t).prop('checked'))
  1991. }),
  1992. this.updateRows(),
  1993. this.updateSelected(),
  1994. this.trigger('uncheck-some', t),
  1995. t = this.getSelections(),
  1996. this.trigger('check-some', t)
  1997. }
  1998. },
  1999. {
  2000. key: 'checkAll_',
  2001. value: function(e) {
  2002. var t;
  2003. e || (t = this.getSelections()),
  2004. this.$selectAll.add(this.$selectAll_).prop('checked', e),
  2005. this.$selectItem.filter(':enabled').prop('checked', e),
  2006. this.updateRows(),
  2007. e && (t = this.getSelections()),
  2008. this.trigger(e ? 'check-all': 'uncheck-all', t)
  2009. }
  2010. },
  2011. {
  2012. key: 'check',
  2013. value: function(e) {
  2014. this.check_(!0, e)
  2015. }
  2016. },
  2017. {
  2018. key: 'uncheck',
  2019. value: function(e) {
  2020. this.check_(!1, e)
  2021. }
  2022. },
  2023. {
  2024. key: 'check_',
  2025. value: function(e, t) {
  2026. var o = this.$selectItem.filter('[data-index="' + t + '"]'),
  2027. a = this.data[t];
  2028. if (o.is(':radio') || this.options.singleSelect) {
  2029. for (var i = this.options.data,
  2030. n = Array.isArray(i), s = 0, _iterator23 = n ? i: i[Symbol.iterator]();;) {
  2031. var l;
  2032. if (n) {
  2033. if (s >= i.length) break;
  2034. l = i[s++]
  2035. } else {
  2036. if (s = i.next(), s.done) break;
  2037. l = s.value
  2038. }
  2039. var d = l;
  2040. d[this.header.stateField] = !1
  2041. }
  2042. this.$selectItem.filter(':checked').not(o).prop('checked', !1)
  2043. }
  2044. a[this.header.stateField] = e,
  2045. o.prop('checked', e),
  2046. this.updateSelected(),
  2047. this.trigger(e ? 'check': 'uncheck', this.data[t], o)
  2048. }
  2049. },
  2050. {
  2051. key: 'checkBy',
  2052. value: function(e) {
  2053. this.checkBy_(!0, e)
  2054. }
  2055. },
  2056. {
  2057. key: 'uncheckBy',
  2058. value: function(e) {
  2059. this.checkBy_(!1, e)
  2060. }
  2061. },
  2062. {
  2063. key: 'checkBy_',
  2064. value: function(e, t) {
  2065. var o = this;
  2066. if (t.hasOwnProperty('field') && t.hasOwnProperty('values')) {
  2067. var a = [];
  2068. this.options.data.forEach(function(n, s) {
  2069. if (!n.hasOwnProperty(t.field)) return ! 1;
  2070. if ( - 1 !== t.values.indexOf(n[t.field])) {
  2071. var i = o.$selectItem.filter(':enabled').filter(r.sprintf('[data-index="%s"]', s)).prop('checked', e);
  2072. n[o.header.stateField] = e,
  2073. a.push(n),
  2074. o.trigger(e ? 'check': 'uncheck', n, i)
  2075. }
  2076. }),
  2077. this.updateSelected(),
  2078. this.trigger(e ? 'check-some': 'uncheck-some', a)
  2079. }
  2080. }
  2081. },
  2082. {
  2083. key: 'destroy',
  2084. value: function() {
  2085. this.$el.insertBefore(this.$container),
  2086. s(this.options.toolbar).insertBefore(this.$el),
  2087. this.$container.next().remove(),
  2088. this.$container.remove(),
  2089. this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || '')
  2090. }
  2091. },
  2092. {
  2093. key: 'showLoading',
  2094. value: function() {
  2095. this.$tableLoading.css('display', 'flex')
  2096. }
  2097. },
  2098. {
  2099. key: 'hideLoading',
  2100. value: function() {
  2101. this.$tableLoading.css('display', 'none')
  2102. }
  2103. },
  2104. {
  2105. key: 'togglePagination',
  2106. value: function() {
  2107. this.options.pagination = !this.options.pagination,
  2108. this.$toolbar.find('button[name="paginationSwitch"]').html(r.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.pagination ? this.options.icons.paginationSwitchDown: this.options.icons.paginationSwitchUp)),
  2109. this.updatePagination()
  2110. }
  2111. },
  2112. {
  2113. key: 'toggleFullscreen',
  2114. value: function() {
  2115. this.$el.closest('.bootstrap-table').toggleClass('fullscreen'),
  2116. this.resetView()
  2117. }
  2118. },
  2119. {
  2120. key: 'refresh',
  2121. value: function(e) {
  2122. e && e.url && (this.options.url = e.url),
  2123. e && e.pageNumber && (this.options.pageNumber = e.pageNumber),
  2124. e && e.pageSize && (this.options.pageSize = e.pageSize),
  2125. this.trigger('refresh', this.initServer(e && e.silent, e && e.query, e && e.url))
  2126. }
  2127. },
  2128. {
  2129. key: 'resetWidth',
  2130. value: function() {
  2131. this.options.showHeader && this.options.height && this.fitHeader(),
  2132. this.options.showFooter && !this.options.cardView && this.fitFooter()
  2133. }
  2134. },
  2135. {
  2136. key: 'showColumn',
  2137. value: function(e) {
  2138. this.toggleColumn(this.fieldsColumnsIndex[e], !0, !0)
  2139. }
  2140. },
  2141. {
  2142. key: 'hideColumn',
  2143. value: function(e) {
  2144. this.toggleColumn(this.fieldsColumnsIndex[e], !1, !0)
  2145. }
  2146. },
  2147. {
  2148. key: 'getHiddenColumns',
  2149. value: function() {
  2150. return this.columns.filter(function(e) {
  2151. var t = e.visible;
  2152. return ! t
  2153. })
  2154. }
  2155. },
  2156. {
  2157. key: 'getVisibleColumns',
  2158. value: function() {
  2159. return this.columns.filter(function(e) {
  2160. var t = e.visible;
  2161. return t
  2162. })
  2163. }
  2164. },
  2165. {
  2166. key: 'toggleAllColumns',
  2167. value: function(e) {
  2168. for (var t = this.columns,
  2169. o = Array.isArray(t), a = 0, _iterator24 = o ? t: t[Symbol.iterator]();;) {
  2170. var i;
  2171. if (o) {
  2172. if (a >= t.length) break;
  2173. i = t[a++]
  2174. } else {
  2175. if (a = t.next(), a.done) break;
  2176. i = a.value
  2177. }
  2178. var n = i;
  2179. n.visible = e
  2180. }
  2181. if (this.initHeader(), this.initSearch(), this.initPagination(), this.initBody(), this.options.showColumns) {
  2182. var s = this.$toolbar.find('.keep-open input').prop('disabled', !1);
  2183. s.filter(':checked').length <= this.options.minimumCountColumns && s.filter(':checked').prop('disabled', !0)
  2184. }
  2185. }
  2186. },
  2187. {
  2188. key: 'showAllColumns',
  2189. value: function() {
  2190. this.toggleAllColumns(!0)
  2191. }
  2192. },
  2193. {
  2194. key: 'hideAllColumns',
  2195. value: function() {
  2196. this.toggleAllColumns(!1)
  2197. }
  2198. },
  2199. {
  2200. key: 'filterBy',
  2201. value: function(e) {
  2202. this.filterColumns = r.isEmptyObject(e) ? {}: e,
  2203. this.options.pageNumber = 1,
  2204. this.initSearch(),
  2205. this.updatePagination()
  2206. }
  2207. },
  2208. {
  2209. key: 'scrollTo',
  2210. value: function(e) {
  2211. if ('undefined' == typeof e) return this.$tableBody.scrollTop();
  2212. var t = e;
  2213. 'string' == typeof e && 'bottom' === e && (t = this.$tableBody[0].scrollHeight),
  2214. this.$tableBody.scrollTop(t)
  2215. }
  2216. },
  2217. {
  2218. key: 'getScrollPosition',
  2219. value: function() {
  2220. return this.scrollTo()
  2221. }
  2222. },
  2223. {
  2224. key: 'selectPage',
  2225. value: function(e) {
  2226. 0 < e && e <= this.options.totalPages && (this.options.pageNumber = e, this.updatePagination())
  2227. }
  2228. },
  2229. {
  2230. key: 'prevPage',
  2231. value: function() {
  2232. 1 < this.options.pageNumber && (this.options.pageNumber--, this.updatePagination())
  2233. }
  2234. },
  2235. {
  2236. key: 'nextPage',
  2237. value: function() {
  2238. this.options.pageNumber < this.options.totalPages && (this.options.pageNumber++, this.updatePagination())
  2239. }
  2240. },
  2241. {
  2242. key: 'toggleView',
  2243. value: function() {
  2244. this.options.cardView = !this.options.cardView,
  2245. this.initHeader(),
  2246. this.$toolbar.find('button[name="toggle"]').html(r.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.cardView ? this.options.icons.toggleOn: this.options.icons.toggleOff)),
  2247. this.initBody(),
  2248. this.trigger('toggle', this.options.cardView)
  2249. }
  2250. },
  2251. {
  2252. key: 'refreshOptions',
  2253. value: function(e) {
  2254. r.compareObjects(this.options, e, !0) || (this.options = s.extend(this.options, e), this.trigger('refresh-options', this.options), this.destroy(), this.init())
  2255. }
  2256. },
  2257. {
  2258. key: 'resetSearch',
  2259. value: function(e) {
  2260. var t = this.$toolbar.find('.search input');
  2261. t.val(e || ''),
  2262. this.onSearch({
  2263. currentTarget: t
  2264. })
  2265. }
  2266. },
  2267. {
  2268. key: 'expandRow_',
  2269. value: function(e, t) {
  2270. var o = this.$body.find(r.sprintf('> tr[data-index="%s"]', t));
  2271. o.next().is('tr.detail-view') === !e && o.find('> td > .detail-icon').click()
  2272. }
  2273. },
  2274. {
  2275. key: 'expandRow',
  2276. value: function(e) {
  2277. this.expandRow_(!0, e)
  2278. }
  2279. },
  2280. {
  2281. key: 'collapseRow',
  2282. value: function(e) {
  2283. this.expandRow_(!1, e)
  2284. }
  2285. },
  2286. {
  2287. key: 'expandAllRows',
  2288. value: function(e) {
  2289. var t = this;
  2290. if (e) {
  2291. var o = this.$body.find(r.sprintf('> tr[data-index="%s"]', 0)),
  2292. a = null,
  2293. n = !1,
  2294. l = -1;
  2295. if (o.next().is('tr.detail-view') ? !o.next().next().is('tr.detail-view') && (o.next().find('.detail-icon').click(), n = !0) : (o.find('> td > .detail-icon').click(), n = !0), n) try {
  2296. l = setInterval(function() {
  2297. a = t.$body.find('tr.detail-view').last().find('.detail-icon'),
  2298. 0 < a.length ? a.click() : clearInterval(l)
  2299. },
  2300. 1)
  2301. } catch(e) {
  2302. clearInterval(l)
  2303. }
  2304. } else for (var d = this.$body.children(), c = 0; c < d.length; c++) this.expandRow_(!0, s(d[c]).data('index'))
  2305. }
  2306. },
  2307. {
  2308. key: 'collapseAllRows',
  2309. value: function(e) {
  2310. if (e) this.expandRow_(!1, 0);
  2311. else for (var t = this.$body.children(), o = 0; o < t.length; o++) this.expandRow_(!1, s(t[o]).data('index'))
  2312. }
  2313. },
  2314. {
  2315. key: 'updateFormatText',
  2316. value: function(e, t) {
  2317. this.options[r.sprintf('format%s', e)] && ('string' == typeof t ? this.options[r.sprintf('format%s', e)] = function() {
  2318. return t
  2319. }: 'function' == typeof t && (this.options[r.sprintf('format%s', e)] = t)),
  2320. this.initToolbar(),
  2321. this.initPagination(),
  2322. this.initBody()
  2323. }
  2324. }]),
  2325. t
  2326. } ();
  2327. p.DEFAULTS = d,
  2328. p.LOCALES = c,
  2329. p.COLUMN_DEFAULTS = {
  2330. radio: !1,
  2331. checkbox: !1,
  2332. checkboxEnabled: !0,
  2333. field: void 0,
  2334. title: void 0,
  2335. titleTooltip: void 0,
  2336. class: void 0,
  2337. align: void 0,
  2338. halign: void 0,
  2339. falign: void 0,
  2340. valign: void 0,
  2341. width: void 0,
  2342. sortable: !1,
  2343. order: 'asc',
  2344. visible: !0,
  2345. switchable: !0,
  2346. clickToSelect: !0,
  2347. formatter: void 0,
  2348. footerFormatter: void 0,
  2349. events: void 0,
  2350. sorter: void 0,
  2351. sortName: void 0,
  2352. cellStyle: void 0,
  2353. searchable: !0,
  2354. searchFormatter: !0,
  2355. cardVisible: !0,
  2356. escape: !1,
  2357. showSelectTitle: !1
  2358. },
  2359. p.EVENTS = {
  2360. "all.bs.table": 'onAll',
  2361. "click-cell.bs.table": 'onClickCell',
  2362. "dbl-click-cell.bs.table": 'onDblClickCell',
  2363. "click-row.bs.table": 'onClickRow',
  2364. "dbl-click-row.bs.table": 'onDblClickRow',
  2365. "sort.bs.table": 'onSort',
  2366. "check.bs.table": 'onCheck',
  2367. "uncheck.bs.table": 'onUncheck',
  2368. "check-all.bs.table": 'onCheckAll',
  2369. "uncheck-all.bs.table": 'onUncheckAll',
  2370. "check-some.bs.table": 'onCheckSome',
  2371. "uncheck-some.bs.table": 'onUncheckSome',
  2372. "load-success.bs.table": 'onLoadSuccess',
  2373. "load-error.bs.table": 'onLoadError',
  2374. "column-switch.bs.table": 'onColumnSwitch',
  2375. "page-change.bs.table": 'onPageChange',
  2376. "search.bs.table": 'onSearch',
  2377. "toggle.bs.table": 'onToggle',
  2378. "pre-body.bs.table": 'onPreBody',
  2379. "post-body.bs.table": 'onPostBody',
  2380. "post-header.bs.table": 'onPostHeader',
  2381. "expand-row.bs.table": 'onExpandRow',
  2382. "collapse-row.bs.table": 'onCollapseRow',
  2383. "refresh-options.bs.table": 'onRefreshOptions',
  2384. "reset-view.bs.table": 'onResetView',
  2385. "refresh.bs.table": 'onRefresh',
  2386. "scroll-body.bs.table": 'onScrollBody'
  2387. };
  2388. var h = ['getOptions', 'getSelections', 'getAllSelections', 'getData', 'load', 'append', 'prepend', 'remove', 'removeAll', 'insertRow', 'updateRow', 'updateCell', 'updateByUniqueId', 'removeByUniqueId', 'getRowByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', 'mergeCells', 'refreshColumnTitle', 'checkAll', 'uncheckAll', 'checkInvert', 'check', 'uncheck', 'checkBy', 'uncheckBy', 'refresh', 'resetView', 'resetWidth', 'destroy', 'showLoading', 'hideLoading', 'showColumn', 'hideColumn', 'getHiddenColumns', 'getVisibleColumns', 'showAllColumns', 'hideAllColumns', 'filterBy', 'scrollTo', 'getScrollPosition', 'selectPage', 'prevPage', 'nextPage', 'togglePagination', 'toggleView', 'refreshOptions', 'resetSearch', 'expandRow', 'collapseRow', 'expandAllRows', 'collapseAllRows', 'updateFormatText', 'updateCellById'];
  2389. s.BootstrapTable = p,
  2390. s.fn.bootstrapTable = function(e) {
  2391. for (var t = arguments.length,
  2392. o = Array(1 < t ? t - 1 : 0), a = 1; a < t; a++) o[a - 1] = arguments[a];
  2393. var i;
  2394. return this.each(function(t, a) {
  2395. var l = s(a).data('bootstrap.table'),
  2396. r = s.extend({},
  2397. p.DEFAULTS, s(a).data(), 'object' === ('undefined' == typeof e ? 'undefined': n(e)) && e);
  2398. if ('string' == typeof e) {
  2399. var d;
  2400. if ( - 1 === h.indexOf(e)) throw new Error('Unknown method: ' + e);
  2401. if (!l) return;
  2402. i = (d = l)[e].apply(d, o),
  2403. 'destroy' === e && s(a).removeData('bootstrap.table')
  2404. }
  2405. l || s(a).data('bootstrap.table', l = new s.BootstrapTable(a, r))
  2406. }),
  2407. 'undefined' == typeof i ? this: i
  2408. },
  2409. s.fn.bootstrapTable.Constructor = p,
  2410. s.fn.bootstrapTable.defaults = p.DEFAULTS,
  2411. s.fn.bootstrapTable.columnDefaults = p.COLUMN_DEFAULTS,
  2412. s.fn.bootstrapTable.locales = p.LOCALES,
  2413. s.fn.bootstrapTable.methods = h,
  2414. s.fn.bootstrapTable.utils = r,
  2415. s(function() {
  2416. s('[data-toggle="table"]').bootstrapTable()
  2417. })
  2418. })(jQuery)
  2419. });