1(function (global, factory) { 2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('core-js/modules/es.array.concat.js'), require('core-js/modules/es.array.filter.js'), require('core-js/modules/es.array.find.js'), require('core-js/modules/es.array.find-index.js'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.index-of.js'), require('core-js/modules/es.array.iterator.js'), require('core-js/modules/es.array.join.js'), require('core-js/modules/es.array.map.js'), require('core-js/modules/es.array.reverse.js'), require('core-js/modules/es.array.slice.js'), require('core-js/modules/es.array.sort.js'), require('core-js/modules/es.array.splice.js'), require('core-js/modules/es.date.to-json.js'), require('core-js/modules/es.number.constructor.js'), require('core-js/modules/es.object.assign.js'), require('core-js/modules/es.object.entries.js'), require('core-js/modules/es.object.keys.js'), require('core-js/modules/es.object.to-string.js'), require('core-js/modules/es.parse-float.js'), require('core-js/modules/es.parse-int.js'), require('core-js/modules/es.regexp.constructor.js'), require('core-js/modules/es.regexp.exec.js'), require('core-js/modules/es.regexp.to-string.js'), require('core-js/modules/es.string.includes.js'), require('core-js/modules/es.string.replace.js'), require('core-js/modules/es.string.search.js'), require('core-js/modules/es.string.split.js'), require('core-js/modules/es.string.trim.js'), require('core-js/modules/web.dom-collections.for-each.js'), require('core-js/modules/web.dom-collections.iterator.js'), require('jquery'), require('core-js/modules/es.object.get-prototype-of.js'), require('core-js/modules/es.string.ends-with.js'), require('core-js/modules/es.string.match.js'), require('core-js/modules/es.string.starts-with.js')) : 3 typeof define === 'function' && define.amd ? define(['core-js/modules/es.array.concat.js', 'core-js/modules/es.array.filter.js', 'core-js/modules/es.array.find.js', 'core-js/modules/es.array.find-index.js', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.index-of.js', 'core-js/modules/es.array.iterator.js', 'core-js/modules/es.array.join.js', 'core-js/modules/es.array.map.js', 'core-js/modules/es.array.reverse.js', 'core-js/modules/es.array.slice.js', 'core-js/modules/es.array.sort.js', 'core-js/modules/es.array.splice.js', 'core-js/modules/es.date.to-json.js', 'core-js/modules/es.number.constructor.js', 'core-js/modules/es.object.assign.js', 'core-js/modules/es.object.entries.js', 'core-js/modules/es.object.keys.js', 'core-js/modules/es.object.to-string.js', 'core-js/modules/es.parse-float.js', 'core-js/modules/es.parse-int.js', 'core-js/modules/es.regexp.constructor.js', 'core-js/modules/es.regexp.exec.js', 'core-js/modules/es.regexp.to-string.js', 'core-js/modules/es.string.includes.js', 'core-js/modules/es.string.replace.js', 'core-js/modules/es.string.search.js', 'core-js/modules/es.string.split.js', 'core-js/modules/es.string.trim.js', 'core-js/modules/web.dom-collections.for-each.js', 'core-js/modules/web.dom-collections.iterator.js', 'jquery', 'core-js/modules/es.object.get-prototype-of.js', 'core-js/modules/es.string.ends-with.js', 'core-js/modules/es.string.match.js', 'core-js/modules/es.string.starts-with.js'], factory) : 4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BootstrapTable = factory(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, global.jQuery)); 5})(this, (function (es_array_concat_js, es_array_filter_js, es_array_find_js, es_array_findIndex_js, es_array_includes_js, es_array_indexOf_js, es_array_iterator_js, es_array_join_js, es_array_map_js, es_array_reverse_js, es_array_slice_js, es_array_sort_js, es_array_splice_js, es_date_toJson_js, es_number_constructor_js, es_object_assign_js, es_object_entries_js, es_object_keys_js, es_object_toString_js, es_parseFloat_js, es_parseInt_js, es_regexp_constructor_js, es_regexp_exec_js, es_regexp_toString_js, es_string_includes_js, es_string_replace_js, es_string_search_js, es_string_split_js, es_string_trim_js, web_domCollections_forEach_js, web_domCollections_iterator_js, $) { 'use strict'; 6 7 function _arrayLikeToArray(r, a) { 8 (null == a || a > r.length) && (a = r.length); 9 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; 10 return n; 11 } 12 function _arrayWithHoles(r) { 13 if (Array.isArray(r)) return r; 14 } 15 function _arrayWithoutHoles(r) { 16 if (Array.isArray(r)) return _arrayLikeToArray(r); 17 } 18 function _classCallCheck(a, n) { 19 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); 20 } 21 function _defineProperties(e, r) { 22 for (var t = 0; t < r.length; t++) { 23 var o = r[t]; 24 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); 25 } 26 } 27 function _createClass(e, r, t) { 28 return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", { 29 writable: !1 30 }), e; 31 } 32 function _createForOfIteratorHelper(r, e) { 33 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 34 if (!t) { 35 if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e ) { 36 t && (r = t); 37 var n = 0, 38 F = function () {}; 39 return { 40 s: F, 41 n: function () { 42 return n >= r.length ? { 43 done: !0 44 } : { 45 done: !1, 46 value: r[n++] 47 }; 48 }, 49 e: function (r) { 50 throw r; 51 }, 52 f: F 53 }; 54 } 55 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 56 } 57 var o, 58 a = !0, 59 u = !1; 60 return { 61 s: function () { 62 t = t.call(r); 63 }, 64 n: function () { 65 var r = t.next(); 66 return a = r.done, r; 67 }, 68 e: function (r) { 69 u = !0, o = r; 70 }, 71 f: function () { 72 try { 73 a || null == t.return || t.return(); 74 } finally { 75 if (u) throw o; 76 } 77 } 78 }; 79 } 80 function _iterableToArray(r) { 81 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); 82 } 83 function _iterableToArrayLimit(r, l) { 84 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 85 if (null != t) { 86 var e, 87 n, 88 i, 89 u, 90 a = [], 91 f = !0, 92 o = !1;
93 try { 94 if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 95 } catch (r) { 96 o = !0, n = r; 97 } finally { 98 try { 99 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; 100 } finally { 101 if (o) throw n; 102 } 103 } 104 return a; 105 } 106 } 107 function _nonIterableRest() { 108 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 109 } 110 function _nonIterableSpread() { 111 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 112 } 113 function _slicedToArray(r, e) { 114 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); 115 } 116 function _toConsumableArray(r) { 117 return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); 118 } 119 function _toPrimitive(t, r) { 120 if ("object" != typeof t || !t) return t; 121 var e = t[Symbol.toPrimitive]; 122 if (void 0 !== e) { 123 var i = e.call(t, r ); 124 if ("object" != typeof i) return i; 125 throw new TypeError("@@toPrimitive must return a primitive value."); 126 } 127 return (String )(t); 128 } 129 function _toPropertyKey(t) { 130 var i = _toPrimitive(t, "string"); 131 return "symbol" == typeof i ? i : i + ""; 132 } 133 function _typeof(o) { 134 "@babel/helpers - typeof"; 135 136 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 137 return typeof o; 138 } : function (o) { 139 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 140 }, _typeof(o); 141 } 142 function _unsupportedIterableToArray(r, a) { 143 if (r) { 144 if ("string" == typeof r) return _arrayLikeToArray(r, a); 145 var t = {}.toString.call(r).slice(8, -1); 146 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 147 } 148 } 149 150 var Utils = { 151 getBootstrapVersion: function getBootstrapVersion() { 152 var bootstrapVersion = 5; 153 try { 154 var rawVersion = $.fn.dropdown.Constructor.VERSION; 155 156 // Only try to parse VERSION if it is defined. 157 // It is undefined in older versions of Bootstrap (tested with 3.1.1). 158 if (rawVersion !== undefined) { 159 bootstrapVersion = parseInt(rawVersion, 10); 160 } 161 } catch (e) { 162 // ignore 163 } 164 try { 165 // eslint-disable-next-line no-undef 166 var _rawVersion = bootstrap.Tooltip.VERSION; 167 if (_rawVersion !== undefined) { 168 bootstrapVersion = parseInt(_rawVersion, 10); 169 } 170 } catch (e) { 171 // ignore 172 } 173 return bootstrapVersion; 174 }, 175 getIconsPrefix: function getIconsPrefix(theme) { 176 return { 177 bootstrap3: 'glyphicon', 178 bootstrap4: 'fa', 179 bootstrap5: 'bi', 180 'bootstrap-table': 'icon', 181 bulma: 'fa', 182 foundation: 'fa', 183 materialize: 'material-icons', 184 semantic: 'fa' 185 }[theme] || 'fa'; 186 }, 187 getIcons: function getIcons(prefix) { 188 return { 189 glyphicon: { 190 paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down', 191 paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up', 192 refresh: 'glyphicon-refresh icon-refresh', 193 toggleOff: 'glyphicon-list-alt icon-list-alt', 194 toggleOn: 'glyphicon-list-alt icon-list-alt', 195 columns: 'glyphicon-th icon-th', 196 detailOpen: 'glyphicon-plus icon-plus', 197 detailClose: 'glyphicon-minus icon-minus', 198 fullscreen: 'glyphicon-fullscreen', 199 search: 'glyphicon-search', 200 clearSearch: 'glyphicon-trash' 201 }, 202 fa: { 203 paginationSwitchDown: 'fa-caret-square-down', 204 paginationSwitchUp: 'fa-caret-square-up', 205 refresh: 'fa-sync', 206 toggleOff: 'fa-toggle-off', 207 toggleOn: 'fa-toggle-on', 208 columns: 'fa-th-list', 209 detailOpen: 'fa-plus', 210 detailClose: 'fa-minus', 211 fullscreen: 'fa-arrows-alt', 212 search: 'fa-search',
213 clearSearch: 'fa-trash' 214 }, 215 bi: { 216 paginationSwitchDown: 'bi-caret-down-square', 217 paginationSwitchUp: 'bi-caret-up-square', 218 refresh: 'bi-arrow-clockwise', 219 toggleOff: 'bi-toggle-off', 220 toggleOn: 'bi-toggle-on', 221 columns: 'bi-list-ul', 222 detailOpen: 'bi-plus', 223 detailClose: 'bi-dash', 224 fullscreen: 'bi-arrows-move', 225 search: 'bi-search', 226 clearSearch: 'bi-trash' 227 }, 228 icon: { 229 paginationSwitchDown: 'icon-arrow-up-circle', 230 paginationSwitchUp: 'icon-arrow-down-circle', 231 refresh: 'icon-refresh-cw', 232 toggleOff: 'icon-toggle-right', 233 toggleOn: 'icon-toggle-right', 234 columns: 'icon-list', 235 detailOpen: 'icon-plus', 236 detailClose: 'icon-minus', 237 fullscreen: 'icon-maximize', 238 search: 'icon-search', 239 clearSearch: 'icon-trash-2' 240 }, 241 'material-icons': { 242 paginationSwitchDown: 'grid_on', 243 paginationSwitchUp: 'grid_off', 244 refresh: 'refresh', 245 toggleOff: 'tablet', 246 toggleOn: 'tablet_android', 247 columns: 'view_list', 248 detailOpen: 'add', 249 detailClose: 'remove', 250 fullscreen: 'fullscreen', 251 sort: 'sort', 252 search: 'search', 253 clearSearch: 'delete' 254 } 255 }[prefix] || {}; 256 }, 257 getSearchInput: function getSearchInput(that) { 258 if (typeof that.options.searchSelector === 'string') { 259 return $(that.options.searchSelector); 260 } 261 return that.$toolbar.find('.search input'); 262 }, 263 // $.extend: https://github.com/jquery/jquery/blob/3.6.2/src/core.js#L132 264 extend: function extend() { 265 var _this = this; 266 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 267 args[_key] = arguments[_key]; 268 } 269 var target = args[0] || {}; 270 var i = 1; 271 var deep = false; 272 var clone; 273 274 // Handle a deep copy situation 275 if (typeof target === 'boolean') { 276 deep = target; 277 278 // Skip the boolean and the target 279 target = args[i] || {}; 280 i++; 281 } 282 283 // Handle case when target is a string or something (possible in deep copy) 284 if (_typeof(target) !== 'object' && typeof target !== 'function') { 285 target = {}; 286 } 287 for (; i < args.length; i++) { 288 var options = args[i]; 289 290 // Ignore undefined/null values 291 if (typeof options === 'undefined' || options === null) { 292 continue; 293 } 294 295 // Extend the base object 296 // eslint-disable-next-line guard-for-in 297 for (var name in options) { 298 var copy = options[name]; 299 300 // Prevent Object.prototype pollution 301 // Prevent never-ending loop 302 if (name === '__proto__' || target === copy) { 303 continue; 304 } 305 var copyIsArray = Array.isArray(copy); 306 307 // Recurse if we're merging plain objects or arrays 308 if (deep && copy && (this.isObject(copy) || copyIsArray)) { 309 var src = target[name]; 310 if (copyIsArray && Array.isArray(src)) { 311 if (src.every(function (it) { 312 return !_this.isObject(it) && !Array.isArray(it); 313 })) { 314 target[name] = copy; 315 continue; 316 } 317 } 318 if (copyIsArray && !Array.isArray(src)) { 319 clone = []; 320 } else if (!copyIsArray && !this.isObject(src)) { 321 clone = {}; 322 } else { 323 clone = src; 324 } 325 326 // Never move original objects, clone them 327 target[name] = this.extend(deep, clone, copy); 328 329 // Don't bring in undefined values 330 } else if (copy !== undefined) { 331 target[name] = copy; 332 } 333 } 334 } 335 return target; 336 }, 337 // it only does '%s', and return '' when arguments are undefined 338 sprintf: function sprintf(_str) { 339 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 340 args[_key2 - 1] = arguments[_key2]; 341 } 342 var flag = true; 343 var i = 0; 344 var str = _str.replace(/%s/g, function () { 345 var arg = args[i++]; 346 if (typeof arg === 'undefined') { 347 flag = false; 348 return ''; 349 } 350 return arg; 351 }); 352 return flag ? str : ''; 353 }, 354 isObject: function isObject(obj) { 355 if (_typeof(obj) !== 'object' || obj === null) { 356 return false; 357 } 358 var proto = obj;
359 while (Object.getPrototypeOf(proto) !== null) { 360 proto = Object.getPrototypeOf(proto); 361 } 362 return Object.getPrototypeOf(obj) === proto; 363 }, 364 isEmptyObject: function isEmptyObject() { 365 var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 366 return Object.entries(obj).length === 0 && obj.constructor === Object; 367 }, 368 isNumeric: function isNumeric(n) { 369 return !isNaN(parseFloat(n)) && isFinite(n); 370 }, 371 getFieldTitle: function getFieldTitle(list, value) { 372 var _iterator = _createForOfIteratorHelper(list), 373 _step; 374 try { 375 for (_iterator.s(); !(_step = _iterator.n()).done;) { 376 var item = _step.value; 377 if (item.field === value) { 378 return item.title; 379 } 380 } 381 } catch (err) { 382 _iterator.e(err); 383 } finally { 384 _iterator.f(); 385 } 386 return ''; 387 }, 388 setFieldIndex: function setFieldIndex(columns) { 389 var totalCol = 0; 390 var flag = []; 391 var _iterator2 = _createForOfIteratorHelper(columns[0]), 392 _step2; 393 try { 394 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 395 var column = _step2.value; 396 totalCol += column.colspan || 1; 397 } 398 } catch (err) { 399 _iterator2.e(err); 400 } finally { 401 _iterator2.f(); 402 } 403 for (var i = 0; i < columns.length; i++) { 404 flag[i] = []; 405 for (var j = 0; j < totalCol; j++) { 406 flag[i][j] = false; 407 } 408 } 409 for (var _i = 0; _i < columns.length; _i++) { 410 var _iterator3 = _createForOfIteratorHelper(columns[_i]), 411 _step3; 412 try { 413 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 414 var r = _step3.value; 415 var rowspan = r.rowspan || 1; 416 var colspan = r.colspan || 1; 417 var index = flag[_i].indexOf(false); 418 r.colspanIndex = index; 419 if (colspan === 1) { 420 r.fieldIndex = index; 421 // when field is undefined, use index instead 422 if (typeof r.field === 'undefined') { 423 r.field = index; 424 } 425 } else { 426 r.colspanGroup = r.colspan; 427 } 428 for (var _j = 0; _j < rowspan; _j++) { 429 for (var k = 0; k < colspan; k++) { 430 flag[_i + _j][index + k] = true; 431 } 432 } 433 } 434 } catch (err) { 435 _iterator3.e(err); 436 } finally { 437 _iterator3.f(); 438 } 439 } 440 }, 441 normalizeAccent: function normalizeAccent(value) { 442 if (typeof value !== 'string') { 443 return value; 444 } 445 return value.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); 446 }, 447 updateFieldGroup: function updateFieldGroup(columns, fieldColumns) { 448 var _ref; 449 var allColumns = (_ref = []).concat.apply(_ref, _toConsumableArray(columns)); 450 var _iterator4 = _createForOfIteratorHelper(columns), 451 _step4; 452 try { 453 for (_iterator4.s();
453 !(_step4 = _iterator4.n()).done;) { 454 var c = _step4.value; 455 var _iterator6 = _createForOfIteratorHelper(c), 456 _step6; 457 try { 458 for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { 459 var r = _step6.value; 460 if (r.colspanGroup > 1) { 461 var colspan = 0; 462 var _loop = function _loop(i) { 463 var underColumns = allColumns.filter(function (col) { 464 return col.fieldIndex === i; 465 }); 466 var column = underColumns[underColumns.length - 1]; 467 if (underColumns.length > 1) { 468 for (var j = 0; j < underColumns.length - 1; j++) { 469 underColumns[j].visible = column.visible; 470 } 471 } 472 if (column.visible) { 473 colspan++; 474 } 475 }; 476 for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) { 477 _loop(i); 478 } 479 r.colspan = colspan; 480 r.visible = colspan > 0; 481 } 482 } 483 } catch (err) { 484 _iterator6.e(err); 485 } finally { 486 _iterator6.f(); 487 } 488 } 489 } catch (err) { 490 _iterator4.e(err); 491 } finally { 492 _iterator4.f(); 493 } 494 if (columns.length < 2) { 495 return; 496 } 497 var _iterator5 = _createForOfIteratorHelper(fieldColumns), 498 _step5; 499 try { 500 var _loop2 = function _loop2() { 501 var column = _step5.value; 502 var sameColumns = allColumns.filter(function (col) { 503 return col.fieldIndex === column.fieldIndex; 504 }); 505 if (sameColumns.length > 1) { 506 var _iterator7 = _createForOfIteratorHelper(sameColumns), 507 _step7; 508 try { 509 for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { 510 var _c = _step7.value; 511 _c.visible = column.visible; 512 } 513 } catch (err) { 514 _iterator7.e(err); 515 } finally { 516 _iterator7.f(); 517 } 518 } 519 }; 520 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { 521 _loop2(); 522 } 523 } catch (err) { 524 _iterator5.e(err); 525 } finally { 526 _iterator5.f(); 527 } 528 }, 529 getScrollBarWidth: function getScrollBarWidth() { 530 if (this.cachedWidth === undefined) { 531 var $inner = $('<div/>').addClass('fixed-table-scroll-inner'); 532 var $outer = $('<div/>').addClass('fixed-table-scroll-outer'); 533 $outer.append($inner); 534 $('body').append($outer); 535 var w1 = $inner[0].offsetWidth; 536 $outer.css('overflow', 'scroll'); 537 var w2 = $inner[0].offsetWidth; 538 if (w1 === w2) { 539 w2 = $outer[0].clientWidth; 540 } 541 $outer.remove(); 542 this.cachedWidth = w1 - w2; 543 } 544 return this.cachedWidth; 545 }, 546 calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) { 547 var func = name; 548 if (typeof name === 'string') { 549 // support obj.func1.func2 550 var names = name.split('.'); 551 if (names.length > 1) { 552 func = window; 553 var _iterator8 = _createForOfIteratorHelper(names), 554 _step8; 555 try { 556 for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { 557 var f = _step8.value; 558 func = func[f]; 559 } 560 } catch (err) { 561 _iterator8.e(err); 562 } finally { 563 _iterator8.f(); 564 } 565 } else { 566 func = window[name]; 567 } 568 } 569 if (func !== null && _typeof(func) === 'object') { 570 return func; 571 } 572 if (typeof func === 'function') { 573 return func.apply(self, args || []); 574 } 575 if (!func && typeof name === 'string' && args && this.sprintf.apply(this, [name].
575concat(_toConsumableArray(args)))) { 576 return this.sprintf.apply(this, [name].concat(_toConsumableArray(args))); 577 } 578 return defaultValue; 579 }, 580 compareObjects: function compareObjects(objectA, objectB, compareLength) { 581 var aKeys = Object.keys(objectA); 582 var bKeys = Object.keys(objectB); 583 if (compareLength && aKeys.length !== bKeys.length) { 584 return false; 585 } 586 for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) { 587 var key = _aKeys[_i2]; 588 if (bKeys.includes(key) && objectA[key] !== objectB[key]) { 589 return false; 590 } 591 } 592 return true; 593 }, 594 regexCompare: function regexCompare(value, search) { 595 try { 596 var regexpParts = search.match(/^\/(.*?)\/([gim]*)$/); 597 if (value.toString().search(regexpParts ? new RegExp(regexpParts[1], regexpParts[2]) : new RegExp(search, 'gim')) !== -1) { 598 return true; 599 } 600 } catch (e) { 601 return false; 602 } 603 return false; 604 }, 605 escapeApostrophe: function escapeApostrophe(value) { 606 return value.toString().replace(/'/g, '''); 607 }, 608 escapeHTML: function escapeHTML(text) { 609 if (!text) { 610 return text; 611 } 612 return text.toString().replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '''); 613 }, 614 unescapeHTML: function unescapeHTML(text) { 615 if (typeof text !== 'string' || !text) { 616 return text; 617 } 618 return text.toString().replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '\''); 619 }, 620 removeHTML: function removeHTML(text) { 621 if (!text) { 622 return text; 623 } 624 return text.toString().replace(/(<([^>]+)>)/ig, '').replace(/&[#A-Za-z0-9]+;/gi, '').trim(); 625 }, 626 getRealDataAttr: function getRealDataAttr(dataAttr) { 627 for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) { 628 var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2), 629 attr = _Object$entries$_i[0], 630 value = _Object$entries$_i[1]; 631 var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase(); 632 if (auxAttr !== attr) { 633 dataAttr[auxAttr] = value; 634 delete dataAttr[attr]; 635 } 636 } 637 return dataAttr; 638 }, 639 getItemField: function getItemField(item, field, escape) { 640 var columnEscape = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined; 641 var value = item; 642 643 // use column escape if it is defined 644 if (typeof columnEscape !== 'undefined') { 645 escape = columnEscape; 646 } 647 if (typeof field !== 'string' || item.hasOwnProperty(field)) { 648 return escape ? this.escapeHTML(item[field]) : item[field]; 649 } 650 var props = field.split('.'); 651 var _iterator9 = _createForOfIteratorHelper(props), 652 _step9; 653 try { 654 for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { 655 var p = _step9.value; 656 value = value && value[p]; 657 } 658 } catch (err) { 659 _iterator9.e(err); 660 } finally { 661 _iterator9.f(); 662 } 663 return escape ? this.escapeHTML(value) : value; 664 }, 665 isIEBrowser: function isIEBrowser() { 666 return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent); 667 }, 668 findIndex: function findIndex(items, item) { 669 var _iterator10 = _createForOfIteratorHelper(items), 670 _step10; 671 try { 672 for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { 673 var it = _step10.value; 674 if (JSON.stringify(it) === JSON.stringify(item)) { 675 return items.indexOf(it); 676 } 677 } 678 } catch (err) { 679 _iterator10.e(err); 680 } finally { 681 _iterator10.f(); 682 } 683 return -1; 684 }, 685 trToData: function trToData(columns, $els) { 686 var _this2 = this; 687 var data = []; 688 var m = []; 689 $els.each(function (y, el) { 690 var $el = $(el); 691 var row = {}; 692 693 // save tr's id, class and data-* attributes 694 row._id = $el.attr('id'); 695 row._class = $el.attr('class'); 696 row._data = _this2.getRealDataAttr($el.data()); 697 row._style = $el.attr('style'); 698 $el.find('>td,>th').each(function (_x, el) { 699 var $el = $(el); 700 var colspan = +$el.attr('colspan') || 1; 701 var rowspan = +$el.attr('rowspan') || 1; 702 var x = _x; 703 704 // skip already occupied cells in current row 705 for (; m[y] && m[y][x]; x++) { 706 // ignore 707 } 708 709 // mark matrix elements occupied by current cell with true 710 for (var tx = x; tx < x + colspan; tx++) { 711 for (var ty = y; ty < y + rowspan; ty++) { 712 if (!m[ty]) { 713 // fill missing rows 714 m[ty] = []; 715 } 716 m[ty][tx] = true; 717 } 718 } 719 var field = columns[x].field; 720 row[field] = _this2.escapeApostrophe($el.html().trim()); 721 // save td's id, class and data-* attributes 722 row["_".concat(field, "_id")] = $el.attr('id'); 723 row["_".concat(field, "_class")] = $el.attr('class'); 724 row["_".concat(field, "_rowspan")] = $el.attr('rowspan'); 725 row["_".concat(field, "_colspan")] = $el.attr('colspan'); 726 row["_".concat(field, "_title")] = $el.attr('title'); 727 row["_".concat(field, "_data")] = _this2.getRealDataAttr($el.data()); 728 row["_".concat(field, "_style")] = $el.attr('style'); 729 }); 730 data.push(row); 731 }); 732 return data; 733 }, 734 sort: function sort(a, b, order, options, aPosition, bPosition) { 735 if (a === undefined || a === null) { 736 a = ''; 737 } 738 if (b === undefined || b === null) { 739 b = ''; 740 } 741 if (options.sortStable && a === b) { 742 a = aPosition; 743 b = bPosition; 744 } 745 746 // If both values are numeric, do a numeric comparison 747 if (this.isNumeric(a) && this.isNumeric(b)) {
748 // Convert numerical values form string to float. 749 a = parseFloat(a); 750 b = parseFloat(b); 751 if (a < b) { 752 return order * -1; 753 } 754 if (a > b) { 755 return order; 756 } 757 return 0; 758 } 759 if (options.sortEmptyLast) { 760 if (a === '') { 761 return 1; 762 } 763 if (b === '') { 764 return -1; 765 } 766 } 767 if (a === b) { 768 return 0; 769 } 770 771 // If value is not a string, convert to string 772 if (typeof a !== 'string') { 773 a = a.toString(); 774 } 775 if (a.localeCompare(b) === -1) { 776 return order * -1; 777 } 778 return order; 779 }, 780 getEventName: function getEventName(eventPrefix) { 781 var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 782 id = id || "".concat(+new Date()).concat(~~(Math.random() * 1000000)); 783 return "".concat(eventPrefix, "-").concat(id); 784 }, 785 hasDetailViewIcon: function hasDetailViewIcon(options) { 786 return options.detailView && options.detailViewIcon && !options.cardView; 787 }, 788 getDetailViewIndexOffset: function getDetailViewIndexOffset(options) { 789 return this.hasDetailViewIcon(options) && options.detailViewAlign !== 'right' ? 1 : 0; 790 }, 791 checkAutoMergeCells: function checkAutoMergeCells(data) { 792 var _iterator11 = _createForOfIteratorHelper(data), 793 _step11; 794 try { 795 for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { 796 var row = _step11.value; 797 for (var _i4 = 0, _Object$keys = Object.keys(row); _i4 < _Object$keys.length; _i4++) { 798 var key = _Object$keys[_i4]; 799 if (key.startsWith('_') && (key.endsWith('_rowspan') || key.endsWith('_colspan'))) { 800 return true; 801 } 802 } 803 } 804 } catch (err) { 805 _iterator11.e(err); 806 } finally { 807 _iterator11.f(); 808 } 809 return false; 810 }, 811 deepCopy: function deepCopy(arg) { 812 if (arg === undefined) { 813 return arg; 814 } 815 return this.extend(true, Array.isArray(arg) ? [] : {}, arg); 816 }, 817 debounce: function debounce(func, wait, immediate) { 818 var timeout; 819 return function executedFunction() { 820 var context = this; 821 var args = arguments; 822 var later = function later() { 823 timeout = null; 824 if (!immediate) func.apply(context, args); 825 }; 826 var callNow = immediate && !timeout; 827 clearTimeout(timeout); 828 timeout = setTimeout(later, wait); 829 if (callNow) func.apply(context, args); 830 }; 831 } 832 }; 833 834 var VERSION = '1.23.0'; 835 var bootstrapVersion = Utils.getBootstrapVersion(); 836 var CONSTANTS = { 837 3: { 838 classes: { 839 buttonsPrefix: 'btn', 840 buttons: 'default', 841 buttonsGroup: 'btn-group', 842 buttonsDropdown: 'btn-group', 843 pull: 'pull', 844 inputGroup: 'input-group', 845 inputPrefix: 'input-', 846 input: 'form-control', 847 select: 'form-control', 848 paginationDropdown: 'btn-group dropdown', 849 dropup: 'dropup', 850 dropdownActive: 'active', 851 paginationActive: 'active', 852 buttonActive: 'active' 853 }, 854 html: { 855 toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'], 856 toolbarDropdownItem: '<li class="dropdown-item-marker" role="menuitem"><label>%s</label></li>', 857 toolbarDropdownSeparator: '<li class="divider"></li>', 858 pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'], 859 pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>', 860 dropdownCaret: '<span class="caret"></span>', 861 pagination: ['<ul class="pagination%s">', '</ul>'], 862 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>', 863 icon: '<i class="%s %s"></i>', 864 inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>', 865 searchInput: '<input class="%s%s" type="text" placeholder="%s">', 866 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>', 867 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>' 868 } 869 }, 870 4: { 871 classes: { 872 buttonsPrefix: 'btn', 873 buttons: 'secondary', 874 buttonsGroup: 'btn-group', 875 buttonsDropdown: 'btn-group', 876 pull: 'float', 877 inputGroup: 'btn-group', 878 inputPrefix: 'form-control-', 879 input: 'form-control', 880 select: 'form-control', 881 paginationDropdown: 'btn-group dropdown', 882 dropup: 'dropup', 883 dropdownActive: 'active', 884 paginationActive: 'active', 885 buttonActive: 'active' 886 }, 887 html: { 888 toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'], 889 toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>', 890 pageDropdown: ['<div class="dropdown-menu">', '</div>'], 891 pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>', 892 toolbarDropdownSeparator: '<div class="dropdown-divider"></div>', 893 dropdownCaret: '<span class="caret"></span>', 894 pagination: ['<ul class="pagination%s">', '</ul>'], 895 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>', 896 icon: '<i class="%s %s"></i>', 897 inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>', 898 searchInput: '<input class="%s%s" type="text" placeholder="%s">', 899 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>', 900 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>' 901 } 902 }, 903 5: { 904 classes: { 905 buttonsPrefix: 'btn', 906 buttons: 'secondary', 907 buttonsGroup: 'btn-group', 908 buttonsDropdown: 'btn-group', 909 pull: 'float', 910 inputGroup: 'btn-group', 911 inputPrefix: 'form-control-', 912 input: 'form-control', 913 select: 'form-select', 914 paginationDropdown: 'btn-group dropdown', 915 dropup: 'dropup', 916 dropdownActive: 'active', 917 paginationActive: 'active', 918 buttonActive: 'active' 919 }, 920 html: { 921 dataToggle: 'data-bs-toggle', 922 toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-end">', '</div>'], 923 toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>', 924 pageDropdown: ['<div class="dropdown-menu">', '</div>'], 925 pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>', 926 toolbarDropdownSeparator: '<div class="dropdown-divider"></div>', 927 dropdownCaret: '<span class="caret"></span>', 928 pagination: ['<ul class="pagination%s">', '</ul>'], 929 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>', 930 icon: '<i class="%s %s"></i>', 931 inputGroup: '<div class="input-group">%s%s</div>', 932 searchInput: '<input class="%s%s" type="text" placeholder="%s">', 933 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>', 934 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>' 935 } 936 } 937 }[bootstrapVersion]; 938 var DEFAULTS = { 939 height: undefined, 940 classes: 'table table-bordered table-hover', 941 buttons: {}, 942 theadClasses: '', 943 headerStyle: function headerStyle(column) { 944 return {}; 945 }, 946 rowStyle: function rowStyle(row, index) { 947 return {}; 948 }, 949 rowAttributes: function rowAttributes(row, index) { 950 return {}; 951 }, 952 undefinedText: '-', 953 locale: undefined, 954 virtualScroll: false, 955 virtualScrollItemHeight: undefined, 956 sortable: true, 957 sortClass: undefined, 958 silentSort: true, 959 sortEmptyLast: false, 960 sortName: undefined, 961 sortOrder: undefined, 962 sortReset: false, 963 sortStable: false, 964 sortResetPage: false, 965 rememberOrder: false, 966 serverSort: true, 967 customSort: undefined, 968 columns: [[]], 969 data: [], 970 url: undefined, 971 method: 'get', 972 cache: true, 973 contentType: 'application/json', 974 dataType: 'json', 975 ajax: undefined, 976 ajaxOptions: {}, 977 queryParams: function queryParams(params) { 978 return params; 979 }, 980 queryParamsType: 'limit', 981 // 'limit', undefined 982 responseHandler: function responseHandler(res) { 983 return res; 984 }, 985 totalField: 'total', 986 totalNotFilteredField: 'totalNotFiltered', 987 dataField: 'rows', 988 footerField: 'footer', 989 pagination: false, 990 paginationParts: ['pageInfo', 'pageSize', 'pageList'], 991 showExtendedPagination: false, 992 paginationLoop: true, 993 sidePagination: 'client', 994 // client or server 995 totalRows: 0, 996 totalNotFiltered: 0, 997 pageNumber: 1, 998 pageSize: 10, 999 pageList: [10, 25, 50, 100], 1000 paginationHAlign: 'right', 1001 // right, left 1002 paginationVAlign: 'bottom', 1003 // bottom, top, both 1004 paginationDetailHAlign: 'left', 1005 // right, left 1006 paginationPreText: '‹', 1007 paginationNextText: '›', 1008 paginationSuccessivelySize: 5, 1009 // Maximum successively number of pages in a row 1010 paginationPagesBySide: 1, 1011 // Number of pages on each side (right, left) of the current page. 1012 paginationUseIntermediate: false, 1013 // Calculate intermediate pages for quick access 1014 paginationLoadMore: false, 1015 search: false, 1016 searchable: false, 1017 searchHighlight: false, 1018 searchOnEnterKey: false, 1019 strictSearch: false, 1020 regexSearch: false, 1021 searchSelector: false, 1022 visibleSearch: false, 1023 showButtonIcons: true, 1024 showButtonText: false,
1025 showSearchButton: false, 1026 showSearchClearButton: false, 1027 trimOnSearch: true, 1028 searchAlign: 'right', 1029 searchTimeOut: 500, 1030 searchText: '', 1031 customSearch: undefined, 1032 showHeader: true, 1033 showFooter: false, 1034 footerStyle: function footerStyle(column) { 1035 return {}; 1036 }, 1037 searchAccentNeutralise: false, 1038 showColumns: false, 1039 showColumnsToggleAll: false, 1040 showColumnsSearch: false, 1041 minimumCountColumns: 1, 1042 showPaginationSwitch: false, 1043 showRefresh: false, 1044 showToggle: false, 1045 showFullscreen: false, 1046 smartDisplay: true, 1047 escape: false, 1048 escapeTitle: true, 1049 filterOptions: { 1050 filterAlgorithm: 'and' 1051 }, 1052 idField: undefined, 1053 selectItemName: 'btSelectItem', 1054 clickToSelect: false, 1055 ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) { 1056 var tagName = _ref.tagName; 1057 return ['A', 'BUTTON'].includes(tagName); 1058 }, 1059 singleSelect: false, 1060 checkboxHeader: true, 1061 maintainMetaData: false, 1062 multipleSelectRow: false, 1063 uniqueId: undefined, 1064 cardView: false, 1065 detailView: false, 1066 detailViewIcon: true, 1067 detailViewByClick: false, 1068 detailViewAlign: 'left', 1069 detailFormatter: function detailFormatter(index, row) { 1070 return ''; 1071 }, 1072 detailFilter: function detailFilter(index, row) { 1073 return true; 1074 }, 1075 toolbar: undefined, 1076 toolbarAlign: 'left', 1077 buttonsToolbar: undefined, 1078 buttonsAlign: 'right', 1079 buttonsOrder: ['paginationSwitch', 'refresh', 'toggle', 'fullscreen', 'columns'], 1080 buttonsPrefix: CONSTANTS.classes.buttonsPrefix, 1081 buttonsClass: CONSTANTS.classes.buttons, 1082 iconsPrefix: undefined, 1083 // init in initConstants 1084 icons: {}, 1085 // init in initConstants 1086 iconSize: undefined, 1087 fixedScroll: false, 1088 loadingFontSize: 'auto', 1089 loadingTemplate: function loadingTemplate(loadingMessage) { 1090 return "<span class=\"loading-wrap\">
vendor: 52,926 bytes, lines 1090-2238
1090\n <span class=\"loading-text\">".concat(loadingMessage, "</span>\n <span class=\"animation-wrap\"><span class=\"animation-dot\"></span></span>\n </span>\n "); 1091 }, 1092 onAll: function onAll(name, args) { 1093 return false; 1094 }, 1095 onClickCell: function onClickCell(field, value, row, $element) { 1096 return false; 1097 }, 1098 onDblClickCell: function onDblClickCell(field, value, row, $element) { 1099 return false; 1100 }, 1101 onClickRow: function onClickRow(item, $element) { 1102 return false; 1103 }, 1104 onDblClickRow: function onDblClickRow(item, $element) { 1105 return false; 1106 }, 1107 onSort: function onSort(name, order) { 1108 return false; 1109 }, 1110 onCheck: function onCheck(row) { 1111 return false; 1112 }, 1113 onUncheck: function onUncheck(row) { 1114 return false; 1115 }, 1116 onCheckAll: function onCheckAll(rows) { 1117 return false; 1118 }, 1119 onUncheckAll: function onUncheckAll(rows) { 1120 return false; 1121 }, 1122 onCheckSome: function onCheckSome(rows) { 1123 return false; 1124 }, 1125 onUncheckSome: function onUncheckSome(rows) { 1126 return false; 1127 }, 1128 onLoadSuccess: function onLoadSuccess(data) { 1129 return false; 1130 }, 1131 onLoadError: function onLoadError(status) { 1132 return false; 1133 }, 1134 onColumnSwitch: function onColumnSwitch(field, checked) { 1135 return false; 1136 }, 1137 onColumnSwitchAll: function onColumnSwitchAll(checked) { 1138 return false; 1139 }, 1140 onPageChange: function onPageChange(number, size) { 1141 return false; 1142 }, 1143 onSearch: function onSearch(text) { 1144 return false; 1145 }, 1146 onToggle: function onToggle(cardView) { 1147 return false; 1148 }, 1149 onPreBody: function onPreBody(data) { 1150 return false; 1151 }, 1152 onPostBody: function onPostBody() { 1153 return false; 1154 }, 1155 onPostHeader: function onPostHeader() { 1156 return false; 1157 }, 1158 onPostFooter: function onPostFooter() { 1159 return false; 1160 }, 1161 onExpandRow: function onExpandRow(index, row, $detail) { 1162 return false; 1163 }, 1164 onCollapseRow: function onCollapseRow(index, row) { 1165 return false; 1166 }, 1167 onRefreshOptions: function onRefreshOptions(options) { 1168 return false; 1169 }, 1170 onRefresh: function onRefresh(params) { 1171 return false; 1172 }, 1173 onResetView: function onResetView() { 1174 return false; 1175 }, 1176 onScrollBody: function onScrollBody() { 1177 return false; 1178 }, 1179 onTogglePagination: function onTogglePagination(newState) { 1180 return false; 1181 }, 1182 onVirtualScroll: function onVirtualScroll(startIndex, endIndex) { 1183 return false; 1184 } 1185 }; 1186 var EN = { 1187 formatLoadingMessage: function formatLoadingMessage() { 1188 return 'Loading, please wait'; 1189 }, 1190 formatRecordsPerPage: function formatRecordsPerPage(pageNumber) { 1191 return "".concat(pageNumber, " rows per page"); 1192 }, 1193 formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) { 1194 if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) { 1195 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)"); 1196 } 1197 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows"); 1198 }, 1199 formatSRPaginationPreText: function formatSRPaginationPreText() { 1200 return 'previous page'; 1201 }, 1202 formatSRPaginationPageText: function formatSRPaginationPageText(page) { 1203 return "to page ".concat(page); 1204 }, 1205 formatSRPaginationNextText: function formatSRPaginationNextText() { 1206 return 'next page'; 1207 }, 1208 formatDetailPagination: function formatDetailPagination(totalRows) { 1209 return "Showing ".concat(totalRows, " rows"); 1210 }, 1211 formatSearch: function formatSearch() { 1212 return 'Search'; 1213 }, 1214 formatClearSearch: function formatClearSearch() { 1215 return 'Clear Search'; 1216 }, 1217 formatNoMatches: function formatNoMatches() { 1218 return 'No matching records found'; 1219 }, 1220 formatPaginationSwitch: function formatPaginationSwitch() { 1221 return 'Hide/Show pagination'; 1222 }, 1223 formatPaginationSwitchDown: function formatPaginationSwitchDown() { 1224 return 'Show pagination'; 1225 }, 1226 formatPaginationSwitchUp: function formatPaginationSwitchUp() { 1227 return 'Hide pagination'; 1228 }, 1229 formatRefresh: function formatRefresh() { 1230 return 'Refresh'; 1231 }, 1232 formatToggleOn: function formatToggleOn() { 1233 return 'Show card view'; 1234 }, 1235 formatToggleOff: function formatToggleOff() { 1236 return 'Hide card view'; 1237 }, 1238 formatColumns: function formatColumns() { 1239 return 'Columns'; 1240 }, 1241 formatColumnsToggleAll: function formatColumnsToggleAll() { 1242 return 'Toggle all'; 1243 }, 1244 formatFullscreen: function formatFullscreen() { 1245 return 'Fullscreen'; 1246 }, 1247 formatAllRows: function formatAllRows() { 1248 return 'All'; 1249 } 1250 }; 1251 var COLUMN_DEFAULTS = { 1252 field: undefined, 1253 title: undefined, 1254 titleTooltip: undefined, 1255 class: undefined, 1256 width: undefined, 1257 widthUnit: 'px', 1258 rowspan: undefined, 1259 colspan: undefined, 1260 align: undefined, 1261 // left, right, center 1262 halign: undefined, 1263 // left, right, center 1264 falign: undefined, 1265 // left, right, center 1266 valign: undefined, 1267 // top, middle, bottom 1268 cellStyle: undefined, 1269 radio: false, 1270 checkbox: false, 1271 checkboxEnabled: true, 1272 clickToSelect: true, 1273 showSelectTitle: false, 1274 sortable: false, 1275 sortName: undefined, 1276 order: 'asc', 1277 // asc, desc 1278 sorter: undefined, 1279 visible: true, 1280 switchable: true, 1281 switchableLabel: undefined, 1282 cardVisible: true, 1283 searchable: true, 1284 formatter: undefined, 1285 footerFormatter: undefined, 1286 footerStyle: undefined, 1287 detailFormatter: undefined, 1288 searchFormatter: true, 1289 searchHighlightFormatter: false, 1290 escape: undefined, 1291 events: undefined 1292 }; 1293 var METHODS = ['getOptions', 'refreshOptions', 'getData', 'getSelections', 'load', 'append', 'prepend', 'remove', 'removeAll', 'insertRow', 'updateRow', 'getRowByUniqueId', 'updateByUniqueId', 'removeByUniqueId', 'updateCell', 'updateCellByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', 'showColumn', 'hideColumn', 'getVisibleColumns', 'getHiddenColumns', 'showAllColumns', 'hideAllColumns', 'mergeCells', 'checkAll', 'uncheckAll', 'checkInvert', 'check', 'uncheck', 'checkBy', 'uncheckBy', 'refresh', 'destroy', 'resetView', 'showLoading', 'hideLoading', 'togglePagination', 'toggleFullscreen', 'toggleView', 'resetSearch', 'filterBy', 'sortBy', 'scrollTo', 'getScrollPosition', 'selectPage', 'prevPage', 'nextPage', 'toggleDetailView', 'expandRow', 'collapseRow', 'expandRowByUniqueId', 'collapseRowByUniqueId', 'expandAllRows', 'collapseAllRows', 'updateColumnTitle', 'updateFormatText']; 1294 var EVENTS = { 1295 'all.bs.table': 'onAll', 1296 'click-row.bs.table': 'onClickRow', 1297 'dbl-click-row.bs.table': 'onDblClickRow', 1298 'click-cell.bs.table': 'onClickCell', 1299 'dbl-click-cell.bs.table': 'onDblClickCell', 1300 'sort.bs.table': 'onSort', 1301 'check.bs.table': 'onCheck', 1302 'uncheck.bs.table': 'onUncheck', 1303 'check-all.bs.table': 'onCheckAll', 1304 'uncheck-all.bs.table': 'onUncheckAll', 1305 'check-some.bs.table': 'onCheckSome', 1306 'uncheck-some.bs.table': 'onUncheckSome', 1307 'load-success.bs.table': 'onLoadSuccess', 1308 'load-error.bs.table': 'onLoadError', 1309 'column-switch.bs.table': 'onColumnSwitch', 1310 'column-switch-all.bs.table': 'onColumnSwitchAll', 1311 'page-change.bs.table': 'onPageChange', 1312 'search.bs.table': 'onSearch', 1313 'toggle.bs.table': 'onToggle', 1314 'pre-body.bs.table': 'onPreBody', 1315 'post-body.bs.table': 'onPostBody', 1316 'post-header.bs.table': 'onPostHeader', 1317 'post-footer.bs.table': 'onPostFooter', 1318 'expand-row.bs.table': 'onExpandRow', 1319 'collapse-row.bs.table': 'onCollapseRow', 1320 'refresh-options.bs.table': 'onRefreshOptions', 1321 'reset-view.bs.table': 'onResetView', 1322 'refresh.bs.table': 'onRefresh', 1323 'scroll-body.bs.table': 'onScrollBody', 1324 'toggle-pagination.bs.table': 'onTogglePagination', 1325 'virtual-scroll.bs.table': 'onVirtualScroll' 1326 }; 1327 Object.assign(DEFAULTS, EN); 1328 var Constants = { 1329 VERSION: VERSION, 1330 THEME: "bootstrap".concat(bootstrapVersion), 1331 CONSTANTS: CONSTANTS, 1332 DEFAULTS: DEFAULTS, 1333 COLUMN_DEFAULTS: COLUMN_DEFAULTS, 1334 METHODS: METHODS, 1335 EVENTS: EVENTS, 1336 LOCALES: { 1337 en: EN, 1338 'en-US': EN 1339 } 1340 }; 1341 1342 var BLOCK_ROWS = 50; 1343 var CLUSTER_BLOCKS = 4; 1344 var VirtualScroll = /*#__PURE__*/function () { 1345 function VirtualScroll(options) { 1346 var _this = this; 1347 _classCallCheck(this, VirtualScroll); 1348 this.rows = options.rows; 1349 this.scrollEl = options.scrollEl; 1350 this.contentEl = options.contentEl; 1351 this.callback = options.callback; 1352 this.itemHeight = options.itemHeight; 1353 this.cache = {}; 1354 this.scrollTop = this.scrollEl.scrollTop; 1355 this.initDOM(this.rows, options.fixedScroll); 1356 this.scrollEl.scrollTop = this.scrollTop; 1357 this.lastCluster = 0; 1358 var onScroll = function onScroll() { 1359 if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) { 1360 _this.initDOM(_this.rows); 1361 _this.callback(_this.startIndex, _this.endIndex); 1362 } 1363 }; 1364 this.scrollEl.addEventListener('scroll', onScroll, false); 1365 this.destroy = function () { 1366 _this.contentEl.innerHtml = ''; 1367 _this.scrollEl.removeEventListener('scroll', onScroll, false); 1368 }; 1369 } 1370 return _createClass(VirtualScroll, [{ 1371 key: "initDOM", 1372 value: function initDOM(rows, fixedScroll) { 1373 if (typeof this.clusterHeight === 'undefined') { 1374 this.cache.scrollTop = this.scrollEl.scrollTop; 1375 this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0]; 1376 this.getRowsHeight(rows); 1377 } else if (this.blockHeight === 0) { 1378 this.getRowsHeight(rows); 1379 } 1380 var data = this.initData(rows, this.getNum(fixedScroll)); 1381 var thisRows = data.rows.join(''); 1382 var dataChanged = this.checkChanges('data', thisRows); 1383 var topOffsetChanged = this.checkChanges('top', data.topOffset); 1384 var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset); 1385 var html = []; 1386 if (dataChanged && topOffsetChanged) { 1387 if (data.topOffset) { 1388 html.push(this.getExtra('top', data.topOffset)); 1389 } 1390 html.push(thisRows); 1391 if (data.bottomOffset) { 1392 html.push(this.getExtra('bottom', data.bottomOffset)); 1393 } 1394 this.startIndex = data.start; 1395 this.endIndex = data.end; 1396 this.contentEl.innerHTML = html.join(''); 1397 if (fixedScroll) { 1398 this.contentEl.scrollTop = this.cache.scrollTop; 1399 } 1400 } else if (bottomOffsetChanged) { 1401 this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px"); 1402 } 1403 } 1404 }, { 1405 key: "getRowsHeight", 1406 value: function getRowsHeight() { 1407 if (typeof this.itemHeight === 'undefined' || this.itemHeight === 0) { 1408 var nodes = this.contentEl.children; 1409 var node = nodes[Math.floor(nodes.length / 2)]; 1410 this.itemHeight = node.offsetHeight; 1411 } 1412 this.blockHeight = this.itemHeight * BLOCK_ROWS; 1413 this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS; 1414 this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS; 1415 } 1416 }, { 1417 key: "getNum", 1418 value: function getNum(fixedScroll) { 1419 this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop; 1420 return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0; 1421 } 1422 }, { 1423 key: "initData", 1424 value: function initData(rows, num) { 1425 if (rows.length < BLOCK_ROWS) { 1426 return { 1427 topOffset: 0, 1428 bottomOffset: 0, 1429 rowsAbove: 0, 1430 rows: rows 1431 }; 1432 } 1433 var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0); 1434 var end = start + this.clusterRows; 1435 var topOffset = Math.max(start * this.itemHeight, 0); 1436 var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0); 1437 var thisRows = []; 1438 var rowsAbove = start; 1439 if (topOffset < 1) { 1440 rowsAbove++; 1441 } 1442 for (var i = start; i < end; i++) { 1443 rows[i] && thisRows.push(rows[i]); 1444 } 1445 return { 1446 start: start, 1447 end: end, 1448 topOffset: topOffset, 1449 bottomOffset: bottomOffset, 1450 rowsAbove: rowsAbove, 1451 rows: thisRows 1452 }; 1453 } 1454 }, { 1455 key: "checkChanges", 1456 value: function checkChanges(type, value) { 1457 var changed = value !== this.cache[type]; 1458 this.cache[type] = value; 1459 return changed; 1460 } 1461 }, { 1462 key: "getExtra", 1463 value: function getExtra(className, height) { 1464 var tag = document.createElement('tr'); 1465 tag.className = "virtual-scroll-".concat(className); 1466 if (height) { 1467 tag.style.height = "".concat(height, "px"); 1468 } 1469 return tag.outerHTML; 1470 } 1471 }]); 1472 }(); 1473 1474 var BootstrapTable = /*#__PURE__*/function () { 1475 function BootstrapTable(el, options) { 1476 _classCallCheck(this, BootstrapTable); 1477 this.options = options; 1478 this.$el = $(el); 1479 this.$el_ = this.$el.clone(); 1480 this.timeoutId_ = 0; 1481 this.timeoutFooter_ = 0; 1482 } 1483 return _createClass(BootstrapTable, [{ 1484 key: "init", 1485 value: function init() { 1486 this.initConstants(); 1487 this.initLocale(); 1488 this.initContainer(); 1489 this.initTable(); 1490 this.initHeader(); 1491 this.initData(); 1492 this.initHiddenRows(); 1493 this.initToolbar(); 1494 this.initPagination(); 1495 this.initBody(); 1496 this.initSearchText(); 1497 this.initServer(); 1498 } 1499 }, { 1500 key: "initConstants", 1501 value: function initConstants() { 1502 var opts = this.options; 1503 this.constants = Constants.CONSTANTS; 1504 this.constants.theme = $.fn.bootstrapTable.theme; 1505 this.constants.dataToggle = this.constants.html.dataToggle || 'data-toggle'; 1506 1507 // init iconsPrefix and icons 1508 var iconsPrefix = Utils.getIconsPrefix($.fn.bootstrapTable.theme); 1509 if (typeof opts.icons === 'string') { 1510 opts.icons = Utils.calculateObjectValue(null, opts.icons); 1511 } 1512 opts.iconsPrefix = opts.iconsPrefix || $.fn.bootstrapTable.defaults.iconsPrefix || iconsPrefix; 1513 opts.icons = Object.assign(Utils.getIcons(opts.iconsPrefix), $.fn.bootstrapTable.defaults.icons, opts.icons); 1514 1515 // init buttons class 1516 var buttonsPrefix = opts.buttonsPrefix ? "".concat(opts.buttonsPrefix, "-") : ''; 1517 this.constants.buttonsClass = [opts.buttonsPrefix, buttonsPrefix + opts.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), opts.iconSize)].join(' ').trim(); 1518 this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], {}); 1519 if (_typeof(this.buttons) !== 'object') { 1520 this.buttons = {}; 1521 } 1522 } 1523 }, { 1524 key: "initLocale", 1525 value: function initLocale() { 1526 if (this.options.locale) { 1527 var locales = $.fn.bootstrapTable.locales; 1528 var parts = this.options.locale.split(/-|_/); 1529 parts[0] = parts[0].toLowerCase(); 1530 if (parts[1]) { 1531 parts[1] = parts[1].toUpperCase(); 1532 } 1533 var localesToExtend = {}; 1534 if (locales[this.options.locale]) { 1535 localesToExtend = locales[this.options.locale]; 1536 } else if (locales[parts.join('-')]) { 1537 localesToExtend = locales[parts.join('-')]; 1538 } else if (locales[parts[0]]) { 1539 localesToExtend = locales[parts[0]]; 1540 } 1541 this._defaultLocales = this._defaultLocales || {}; 1542 for (var _i = 0, _Object$entries = Object.entries(localesToExtend); _i < _Object$entries.length; _i++) { 1543 var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), 1544 formatName = _Object$entries$_i[0], 1545 func = _Object$entries$_i[1]; 1546 var defaultLocale = this._defaultLocales.hasOwnProperty(formatName) ? this._defaultLocales[formatName] : BootstrapTable.DEFAULTS[formatName]; 1547 if (this.options[formatName] !== defaultLocale) { 1548 continue; 1549 } 1550 this.options[formatName] = func; 1551 this._defaultLocales[formatName] = func; 1552 } 1553 } 1554 } 1555 }, { 1556 key: "initContainer", 1557 value: function initContainer() { 1558 var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : ''; 1559 var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : ''; 1560 var loadingTemplate = Utils.calculateObjectValue(this.options, this.options.loadingTemplate, [this.options.formatLoadingMessage()]); 1561 this.$container = $("\n <div class=\"bootstrap-table ".concat(this.constants.theme, "\">\n <div class=\"fixed-table-toolbar\"></div>\n ").concat(topPagination, "\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 ").concat(loadingTemplate, "\n </div>\n </div>\n <div class=\"fixed-table-footer\"></div>\n </div>\n ").concat(bottomPagination, "\n </div>\n ")); 1562 this.$container.insertAfter(this.$el); 1563 this.$tableContainer = this.$container.find('.fixed-table-container'); 1564 this.$tableHeader = this.$container.find('.fixed-table-header'); 1565 this.$tableBody = this.$container.find('.fixed-table-body'); 1566 this.$tableLoading = this.$container.find('.fixed-table-loading'); 1567 this.$tableFooter = this.$el.find('tfoot'); 1568 // checking if custom table-toolbar exists or not 1569 if (this.options.buttonsToolbar) { 1570 this.$toolbar = $('body').find(this.options.buttonsToolbar); 1571 } else { 1572 this.$toolbar = this.$container.find('.fixed-table-toolbar'); 1573 } 1574 this.$pagination = this.$container.find('.fixed-table-pagination'); 1575 this.$tableBody.append(this.$el); 1576 this.$container.after('<div class="clearfix"></div>'); 1577 this.$el.addClass(this.options.classes); 1578 this.$tableLoading.addClass(this.options.classes); 1579 if (this.options.height) { 1580 this.$tableContainer.addClass('fixed-height'); 1581 if (this.options.showFooter) { 1582 this.$tableContainer.addClass('has-footer'); 1583 } 1584 if (this.options.classes.split(' ').includes('table-bordered')) { 1585 this.$tableBody.append('<div class="fixed-table-border"></div>'); 1586 this.$tableBorder = this.$tableBody.find('.fixed-table-border'); 1587 this.$tableLoading.addClass('fixed-table-border'); 1588 } 1589 this.$tableFooter = this.$container.find('.fixed-table-footer'); 1590 } 1591 } 1592 }, { 1593 key: "initTable", 1594 value: function initTable() { 1595 var _this = this; 1596 var columns = []; 1597 this.$header = this.$el.find('>thead'); 1598 if (!this.$header.length) { 1599 this.$header = $("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el); 1600 } else if (this.options.theadClasses) { 1601 this.$header.addClass(this.options.theadClasses); 1602 } 1603 this._headerTrClasses = []; 1604 this._headerTrStyles = []; 1605 this.$header.find('tr').each(function (i, el) { 1606 var $tr = $(el); 1607 var column = []; 1608 $tr.find('th').each(function (i, el) { 1609 var $th = $(el); 1610 1611 // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not 1612 if (typeof $th.data('field') !== 'undefined') { 1613 $th.data('field', "".concat($th.data('field'))); 1614 } 1615 var _data = Object.assign({}, $th.data()); 1616 for (var key in _data) { 1617 if ($.fn.bootstrapTable.columnDefaults.hasOwnProperty(key)) { 1618 delete _data[key]; 1619 } 1620 } 1621 column.push(Utils.extend({}, { 1622 _data: Utils.getRealDataAttr(_data), 1623 title: $th.html(), 1624 class: $th.attr('class'), 1625 titleTooltip: $th.attr('title'), 1626 rowspan: $th.attr('rowspan') ? +$th.attr('rowspan') : undefined, 1627 colspan: $th.attr('colspan') ? +$th.attr('colspan') : undefined 1628 }, $th.data())); 1629 }); 1630 columns.push(column); 1631 if ($tr.attr('class')) { 1632 _this._headerTrClasses.push($tr.attr('class')); 1633 } 1634 if ($tr.attr('style')) { 1635 _this._headerTrStyles.push($tr.attr('style')); 1636 } 1637 }); 1638 if (!Array.isArray(this.options.columns[0])) { 1639 this.options.columns = [this.options.columns]; 1640 } 1641 this.options.columns = Utils.extend(true, [], columns, this.options.columns); 1642 this.columns = []; 1643 this.fieldsColumnsIndex = []; 1644 Utils.setFieldIndex(this.options.columns); 1645 this.options.columns.forEach(function (columns, i) { 1646 columns.forEach(function (_column, j) { 1647 var column = Utils.extend({}, BootstrapTable.COLUMN_DEFAULTS, _column, { 1648 passed: _column 1649 }); 1650 if (typeof column.fieldIndex !== 'undefined') { 1651 _this.columns[column.fieldIndex] = column; 1652 _this.fieldsColumnsIndex[column.field] = column.fieldIndex; 1653 } 1654 _this.options.columns[i][j] = column; 1655 }); 1656 }); 1657 1658 // if options.data is setting, do not process tbody and tfoot data 1659 if (!this.options.data.length) { 1660 var htmlData = Utils.trToData(this.columns, this.$el.find('>tbody>tr')); 1661 if (htmlData.length) { 1662 this.options.data = htmlData; 1663 this.fromHtml = true; 1664 } 1665 } 1666 if (!(this.options.pagination && this.options.sidePagination !== 'server')) { 1667 this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr')); 1668 } 1669 if (this.footerData) { 1670 this.$el.find('tfoot').html('<tr></tr>'); 1671 } 1672 if (!this.options.showFooter || this.options.cardView) { 1673 this.$tableFooter.hide(); 1674 } else { 1675 this.$tableFooter.show(); 1676 } 1677 } 1678 }, { 1679 key: "initHeader", 1680 value: function initHeader() { 1681 var _this2 = this; 1682 var visibleColumns = {}; 1683 var headerHtml = []; 1684 this.header = { 1685 fields: [], 1686 styles: [], 1687 classes: [], 1688 formatters: [], 1689 detailFormatters: [], 1690 events: [], 1691 sorters: [], 1692 sortNames: [], 1693 cellStyles: [], 1694 searchables: [] 1695 }; 1696 Utils.updateFieldGroup(this.options.columns, this.columns); 1697 this.options.columns.forEach(function (columns, i) { 1698 var html = []; 1699 html.push("<tr".concat(Utils.sprintf(' class="%s"', _this2._headerTrClasses[i]), " ").concat(Utils.sprintf(' style="%s"', _this2._headerTrStyles[i]), ">")); 1700 var detailViewTemplate = ''; 1701 if (i === 0 && Utils.hasDetailViewIcon(_this2.options)) { 1702 var rowspan = _this2.options.columns.length > 1 ? " rowspan=\"".concat(_this2.options.columns.length, "\"") : ''; 1703 detailViewTemplate = "<th class=\"detail\"".concat(rowspan, ">\n <div class=\"fht-cell\"></div>\n </th>"); 1704 } 1705 if (detailViewTemplate && _this2.options.detailViewAlign !== 'right') { 1706 html.push(detailViewTemplate); 1707 } 1708 columns.forEach(function (column, j) { 1709 var class_ = Utils.sprintf(' class="%s"', column['class']); 1710 var unitWidth = column.widthUnit; 1711 var width = parseFloat(column.width); 1712 var columnHalign = column.halign ? column.halign : column.align; 1713 var halign = Utils.sprintf('text-align: %s; ', columnHalign); 1714 var align = Utils.sprintf('text-align: %s; ', column.align); 1715 var style = Utils.sprintf('vertical-align: %s; ', column.valign); 1716 style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined); 1717 if (typeof column.fieldIndex === 'undefined' && !column.visible) { 1718 return; 1719 } 1720 var headerStyle = Utils.calculateObjectValue(null, _this2.options.headerStyle, [column]); 1721 var csses = []; 1722 var data_ = []; 1723 var classes = ''; 1724 if (headerStyle && headerStyle.css) { 1725 for (var _i2 = 0, _Object$entries2 = Object.entries(headerStyle.css); _i2 < _Object$entries2.length; _i2++) { 1726 var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), 1727 key = _Object$entries2$_i[0], 1728 value = _Object$entries2$_i[1]; 1729 csses.push("".concat(key, ": ").concat(value)); 1730 } 1731 } 1732 if (headerStyle && headerStyle.classes) { 1733 classes = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], headerStyle.classes].join(' ') : headerStyle.classes); 1734 } 1735 if (typeof column.fieldIndex !== 'undefined') { 1736 _this2.header.fields[column.fieldIndex] = column.field; 1737 _this2.header.styles[column.fieldIndex] = align + style; 1738 _this2.header.classes[column.fieldIndex] = class_; 1739 _this2.header.formatters[column.fieldIndex] = column.formatter; 1740 _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter; 1741 _this2.header.events[column.fieldIndex] = column.events; 1742 _this2.header.sorters[column.fieldIndex] = column.sorter; 1743 _this2.header.sortNames[column.fieldIndex] = column.sortName; 1744 _this2.header.cellStyles[column.fieldIndex] = column.cellStyle; 1745 _this2.header.searchables[column.fieldIndex] = column.searchable; 1746 if (!column.visible) { 1747 return; 1748 } 1749 if (_this2.options.cardView && !column.cardVisible) { 1750 return; 1751 } 1752 visibleColumns[column.field] = column; 1753 } 1754 if (Object.keys(column._data || {}).length > 0) { 1755 for (var _i3 = 0, _Object$entries3 = Object.entries(column._data); _i3 < _Object$entries3.length; _i3++) { 1756 var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2), 1757 k = _Object$entries3$_i[0], 1758 v = _Object$entries3$_i[1]; 1759 data_.push("data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'")); 1760 } 1761 } 1762 html.push("<th".concat(Utils.sprintf(' title="%s"', column.titleTooltip)), column.checkbox || column.radio ? Utils.sprintf(' class="bs-checkbox %s"', column['class'] || '') : classes || class_, Utils.sprintf(' style="%s"', halign + style + csses.join('; ') || undefined), Utils.sprintf(' rowspan="%s"', column.rowspan), Utils.sprintf(' colspan="%s"', column.colspan), Utils.sprintf(' data-field="%s"', column.field), 1763 // If `column` is not the first element of `this.options.columns[0]`, then className 'data-not-first-th' should be added. 1764 j === 0 && i > 0 ? ' data-not-first-th' : '', data_.length > 0 ? data_.join(' ') : '', '>'); 1765 html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? "sortable".concat(columnHalign === 'center' ? ' sortable-center' : '', " both") : '')); 1766 var text = _this2.options.escape && _this2.options.escapeTitle ? Utils.escapeHTML(column.title) : column.title; 1767 var title = text; 1768 if (column.checkbox) { 1769 text = ''; 1770 if (!_this2.options.singleSelect && _this2.options.checkboxHeader) { 1771 text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>'; 1772 } 1773 _this2.header.stateField = column.field; 1774 } 1775 if (column.radio) { 1776 text = ''; 1777 _this2.header.stateField = column.field; 1778 } 1779 if (!text && column.showSelectTitle) { 1780 text += title; 1781 } 1782 html.push(text); 1783 html.push('</div>'); 1784 html.push('<div class="fht-cell"></div>'); 1785 html.push('</div>'); 1786 html.push('</th>'); 1787 }); 1788 if (detailViewTemplate && _this2.options.detailViewAlign === 'right') { 1789 html.push(detailViewTemplate); 1790 } 1791 html.push('</tr>'); 1792 if (html.length > 3) { 1793 headerHtml.push(html.join('')); 1794 } 1795 }); 1796 this.$header.html(headerHtml.join('')); 1797 this.$header.find('th[data-field]').each(function (i, el) { 1798 $(el).data(visibleColumns[$(el).data('field')]); 1799 }); 1800 this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) { 1801 var $this = $(e.currentTarget); 1802 if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) { 1803 if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) { 1804 return false; 1805 } 1806 } 1807 if (_this2.options.sortable && $this.parent().data().sortable) { 1808 _this2.onSort(e); 1809 } 1810 }); 1811 var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id')); 1812 $(window).off(resizeEvent); 1813 if (!this.options.showHeader || this.options.cardView) { 1814 this.$header.hide(); 1815 this.$tableHeader.hide(); 1816 this.$tableLoading.css('top', 0); 1817 } else { 1818 this.$header.show(); 1819 this.$tableHeader.show(); 1820 this.$tableLoading.css('top', this.$header.outerHeight() + 1); 1821 // Assign the correct sortable arrow 1822 this.getCaret(); 1823 $(window).on(resizeEvent, function () { 1824 return _this2.resetView(); 1825 }); 1826 } 1827 this.$selectAll = this.$header.find('[name="btSelectAll"]'); 1828 this.$selectAll.off('click').on('click', function (e) { 1829 e.stopPropagation(); 1830 var checked = $(e.currentTarget).prop('checked'); 1831 _this2[checked ? 'checkAll' : 'uncheckAll'](); 1832 _this2.updateSelected(); 1833 }); 1834 } 1835 }, { 1836 key: "initData", 1837 value: function initData(data, type) { 1838 if (type === 'append') { 1839 this.options.data = this.options.data.concat(data); 1840 } else if (type === 'prepend') { 1841 this.options.data = [].concat(data).concat(this.options.data); 1842 } else { 1843 data = data || Utils.deepCopy(this.options.data); 1844 this.options.data = Array.isArray(data) ? data : data[this.options.dataField]; 1845 } 1846 this.data = _toConsumableArray(this.options.data); 1847 if (this.options.sortReset) { 1848 this.unsortedData = _toConsumableArray(this.data); 1849 } 1850 if (this.options.sidePagination === 'server') { 1851 return; 1852 } 1853 this.initSort(); 1854 } 1855 }, { 1856 key: "initSort", 1857 value: function initSort() { 1858 var _this3 = this; 1859 var name = this.options.sortName; 1860 var order = this.options.sortOrder === 'desc' ? -1 : 1; 1861 var index = this.header.fields.indexOf(this.options.sortName); 1862 var timeoutId = 0; 1863 if (index !== -1) { 1864 if (this.options.sortStable) { 1865 this.data.forEach(function (row, i) { 1866 if (!row.hasOwnProperty('_position')) { 1867 row._position = i; 1868 } 1869 }); 1870 } 1871 if (this.options.customSort) { 1872 Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]); 1873 } else { 1874 this.data.sort(function (a, b) { 1875 if (_this3.header.sortNames[index]) { 1876 name = _this3.header.sortNames[index]; 1877 } 1878 var aa = Utils.getItemField(a, name, _this3.options.escape); 1879 var bb = Utils.getItemField(b, name, _this3.options.escape); 1880 var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]); 1881 if (value !== undefined) { 1882 if (_this3.options.sortStable && value === 0) { 1883 return order * (a._position - b._position); 1884 } 1885 return order * value; 1886 } 1887 return Utils.sort(aa, bb, order, _this3.options, a._position, b._position); 1888 }); 1889 } 1890 if (this.options.sortClass !== undefined) { 1891 clearTimeout(timeoutId); 1892 timeoutId = setTimeout(function () { 1893 _this3.$el.removeClass(_this3.options.sortClass); 1894 var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index(); 1895 _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass); 1896 }, 250); 1897 } 1898 } else if (this.options.sortReset) { 1899 this.data = _toConsumableArray(this.unsortedData); 1900 } 1901 } 1902 }, { 1903 key: "sortBy", 1904 value: function sortBy(params) { 1905 this.options.sortName = params.field; 1906 this.options.sortOrder = params.hasOwnProperty('sortOrder') ? params.sortOrder : 'asc'; 1907 this._sort(); 1908 } 1909 }, { 1910 key: "onSort", 1911 value: function onSort(_ref) { 1912 var type = _ref.type, 1913 currentTarget = _ref.currentTarget; 1914 var $this = type === 'keypress' ? $(currentTarget) : $(currentTarget).parent(); 1915 var $this_ = this.$header.find('th').eq($this.index()); 1916 this.$header.add(this.$header_).find('span.order').remove(); 1917 if (this.options.sortName === $this.data('field')) { 1918 var currentSortOrder = this.options.sortOrder; 1919 var initialSortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order; 1920 if (currentSortOrder === undefined) { 1921 this.options.sortOrder = 'asc'; 1922 } else if (currentSortOrder === 'asc') { 1923 this.options.sortOrder = this.options.sortReset ? initialSortOrder === 'asc' ? 'desc' : undefined : 'desc'; 1924 } else if (this.options.sortOrder === 'desc') { 1925 this.options.sortOrder = this.options.sortReset ? initialSortOrder === 'desc' ? 'asc' : undefined : 'asc'; 1926 } 1927 if (this.options.sortOrder === undefined) { 1928 this.options.sortName = undefined; 1929 } 1930 } else { 1931 this.options.sortName = $this.data('field'); 1932 if (this.options.rememberOrder) { 1933 this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc'; 1934 } else { 1935 this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order; 1936 } 1937 } 1938 $this.add($this_).data('order', this.options.sortOrder); 1939 1940 // Assign the correct sortable arrow 1941 this.getCaret(); 1942 this._sort(); 1943 } 1944 }, { 1945 key: "_sort", 1946 value: function _sort() { 1947 if (this.options.sidePagination === 'server' && this.options.serverSort) { 1948 this.options.pageNumber = 1; 1949 this.trigger('sort', this.options.sortName, this.options.sortOrder); 1950 this.initServer(this.options.silentSort); 1951 return; 1952 } 1953 if (this.options.pagination && this.options.sortResetPage) { 1954 this.options.pageNumber = 1; 1955 this.initPagination(); 1956 } 1957 this.trigger('sort', this.options.sortName, this.options.sortOrder); 1958 this.initSort(); 1959 this.initBody(); 1960 } 1961 }, { 1962 key: "initToolbar", 1963 value: function initToolbar() { 1964 var _this4 = this; 1965 var opts = this.options; 1966 var html = []; 1967 var timeoutId = 0; 1968 var $keepOpen; 1969 var switchableCount = 0; 1970 if (this.$toolbar.find('.bs-bars').children().length) { 1971 $('body').append($(opts.toolbar)); 1972 } 1973 this.$toolbar.html(''); 1974 if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') { 1975 $(Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($(opts.toolbar)); 1976 } 1977 1978 // showColumns, showToggle, showRefresh 1979 html = ["<div class=\"".concat(['columns', "columns-".concat(opts.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(opts.buttonsAlign)].join(' '), "\">")]; 1980 if (typeof opts.buttonsOrder === 'string') { 1981 opts.buttonsOrder = opts.buttonsOrder.replace(/\[|\]| |'/g, '').split(','); 1982 } 1983 this.buttons = Object.assign(this.buttons, { 1984 paginationSwitch: { 1985 text: opts.pagination ? opts.formatPaginationSwitchUp() : opts.formatPaginationSwitchDown(), 1986 icon: opts.pagination ? opts.icons.paginationSwitchDown : opts.icons.paginationSwitchUp, 1987 render: false, 1988 event: this.togglePagination, 1989 attributes: { 1990 'aria-label': opts.formatPaginationSwitch(), 1991 title: opts.formatPaginationSwitch() 1992 } 1993 }, 1994 refresh: { 1995 text: opts.formatRefresh(), 1996 icon: opts.icons.refresh, 1997 render: false, 1998 event: this.refresh, 1999 attributes: { 2000 'aria-label': opts.formatRefresh(), 2001 title: opts.formatRefresh() 2002 } 2003 }, 2004 toggle: { 2005 text: opts.formatToggleOn(), 2006 icon: opts.icons.toggleOff, 2007 render: false, 2008 event: this.toggleView, 2009 attributes: { 2010 'aria-label': opts.formatToggleOn(), 2011 title: opts.formatToggleOn() 2012 } 2013 }, 2014 fullscreen: { 2015 text: opts.formatFullscreen(), 2016 icon: opts.icons.fullscreen, 2017 render: false, 2018 event: this.toggleFullscreen, 2019 attributes: { 2020 'aria-label': opts.formatFullscreen(), 2021 title: opts.formatFullscreen() 2022 } 2023 }, 2024 columns: { 2025 render: false, 2026 html: function html() { 2027 var html = []; 2028 html.push("<div class=\"keep-open ".concat(_this4.constants.classes.buttonsDropdown, "\">\n <button class=\"").concat(_this4.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(_this4.constants.dataToggle, "=\"dropdown\"\n aria-label=\"").concat(opts.formatColumns(), "\" title=\"").concat(opts.formatColumns(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(_this4.constants.html.icon, opts.iconsPrefix, opts.icons.columns) : '', "\n ").concat(opts.showButtonText ? opts.formatColumns() : '', "\n ").concat(_this4.constants.html.dropdownCaret, "\n </button>\n ").concat(_this4.constants.html.toolbarDropdown[0])); 2029 if (opts.showColumnsSearch) { 2030 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="text" class="%s" name="columnsSearch" placeholder="%s" autocomplete="off">', _this4.constants.classes.input, opts.formatSearch()))); 2031 html.push(_this4.constants.html.toolbarDropdownSeparator); 2032 } 2033 if (opts.showColumnsToggleAll) { 2034 var allFieldsVisible = _this4.getVisibleColumns().length === _this4.columns.filter(function (column) { 2035 return !_this4.isSelectionColumn(column); 2036 }).length; 2037 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>', allFieldsVisible ? 'checked="checked"' : '', opts.formatColumnsToggleAll()))); 2038 html.push(_this4.constants.html.toolbarDropdownSeparator); 2039 } 2040 var visibleColumns = 0; 2041 _this4.columns.forEach(function (column) { 2042 if (column.visible) { 2043 visibleColumns++; 2044 } 2045 }); 2046 _this4.columns.forEach(function (column, i) { 2047 if (_this4.isSelectionColumn(column)) { 2048 return; 2049 } 2050 if (opts.cardView && !column.cardVisible) { 2051 return; 2052 } 2053 var checked = column.visible ? ' checked="checked"' : ''; 2054 var disabled = visibleColumns <= opts.minimumCountColumns && checked ? ' disabled="disabled"' : ''; 2055 if (column.switchable) { 2056 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" data-field="%s" value="%s"%s%s> <span>%s</span>', column.field, i, checked, disabled, column.switchableLabel || column.title))); 2057 switchableCount++; 2058 } 2059 }); 2060 html.push(_this4.constants.html.toolbarDropdown[1], '</div>'); 2061 return html.join(''); 2062 } 2063 } 2064 }); 2065 var buttonsHtml = {}; 2066 for (var _i4 = 0, _Object$entries4 = Object.entries(this.buttons); _i4 < _Object$entries4.length; _i4++) { 2067 var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2), 2068 buttonName = _Object$entries4$_i[0], 2069 buttonConfig = _Object$entries4$_i[1]; 2070 var buttonHtml = void 0; 2071 if (buttonConfig.hasOwnProperty('html')) { 2072 if (typeof buttonConfig.html === 'function') { 2073 buttonHtml = buttonConfig.html(); 2074 } else if (typeof buttonConfig.html === 'string') { 2075 buttonHtml = buttonConfig.html; 2076 } 2077 } else { 2078 var buttonClass = this.constants.buttonsClass; 2079 if (buttonConfig.hasOwnProperty('attributes') && buttonConfig.attributes.class) { 2080 buttonClass += " ".concat(buttonConfig.attributes.class); 2081 } 2082 buttonHtml = "<button class=\"".concat(buttonClass, "\" type=\"button\" name=\"").concat(buttonName, "\""); 2083 if (buttonConfig.hasOwnProperty('attributes')) { 2084 for (var _i5 = 0, _Object$entries5 = Object.entries(buttonConfig.attributes); _i5 < _Object$entries5.length; _i5++) { 2085 var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2), 2086 attributeName = _Object$entries5$_i[0], 2087 value = _Object$entries5$_i[1]; 2088 if (attributeName === 'class') { 2089 continue; 2090 } 2091 buttonHtml += " ".concat(attributeName, "=\"").concat(value, "\""); 2092 } 2093 } 2094 buttonHtml += '>'; 2095 if (opts.showButtonIcons && buttonConfig.hasOwnProperty('icon')) { 2096 buttonHtml += "".concat(Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, buttonConfig.icon), " "); 2097 } 2098 if (opts.showButtonText && buttonConfig.hasOwnProperty('text')) { 2099 buttonHtml += buttonConfig.text; 2100 } 2101 buttonHtml += '</button>'; 2102 } 2103 buttonsHtml[buttonName] = buttonHtml; 2104 var optionName = "show".concat(buttonName.charAt(0).toUpperCase()).concat(buttonName.substring(1)); 2105 var showOption = opts[optionName]; 2106 if ((!buttonConfig.hasOwnProperty('render') || buttonConfig.hasOwnProperty('render') && buttonConfig.render) && (showOption === undefined || showOption === true)) { 2107 opts[optionName] = true; 2108 } 2109 if (!opts.buttonsOrder.includes(buttonName)) { 2110 opts.buttonsOrder.push(buttonName); 2111 } 2112 } 2113 2114 // Adding the button html to the final toolbar html when the showOption is true 2115 var _iterator = _createForOfIteratorHelper(opts.buttonsOrder), 2116 _step; 2117 try { 2118 for (_iterator.s(); !(_step = _iterator.n()).done;) { 2119 var button = _step.value; 2120 var _showOption = opts["show".concat(button.charAt(0).toUpperCase()).concat(button.substring(1))]; 2121 if (_showOption) { 2122 html.push(buttonsHtml[button]); 2123 } 2124 } 2125 } catch (err) { 2126 _iterator.e(err); 2127 } finally { 2128 _iterator.f(); 2129 } 2130 html.push('</div>'); 2131 2132 // Fix #188: this.showToolbar is for extensions 2133 if (this.showToolbar || html.length > 2) { 2134 this.$toolbar.append(html.join('')); 2135 } 2136 var _loop = function _loop() { 2137 var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2), 2138 buttonName = _Object$entries6$_i[0], 2139 buttonConfig = _Object$entries6$_i[1]; 2140 if (buttonConfig.hasOwnProperty('event')) { 2141 if (typeof buttonConfig.event === 'function' || typeof buttonConfig.event === 'string') { 2142 var event = typeof buttonConfig.event === 'string' ? window[buttonConfig.event] : buttonConfig.event; 2143 _this4.$toolbar.find("button[name=\"".concat(buttonName, "\"]")).off('click').on('click', function () { 2144 return event.call(_this4); 2145 }); 2146 return 1; // continue 2147 } 2148 var _loop2 = function _loop2() { 2149 var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i7], 2), 2150 eventType = _Object$entries7$_i[0], 2151 eventFunction = _Object$entries7$_i[1]; 2152 var event = typeof eventFunction === 'string' ? window[eventFunction] : eventFunction; 2153 _this4.$toolbar.find("button[name=\"".concat(buttonName, "\"]")).off(eventType).on(eventType, function () { 2154 return event.call(_this4); 2155 }); 2156 }; 2157 for (var _i7 = 0, _Object$entries7 = Object.entries(buttonConfig.event); _i7 < _Object$entries7.length; _i7++) { 2158 _loop2(); 2159 } 2160 } 2161 }; 2162 for (var _i6 = 0, _Object$entries6 = Object.entries(this.buttons); _i6 < _Object$entries6.length; _i6++) { 2163 if (_loop()) continue; 2164 } 2165 if (opts.showColumns) { 2166 $keepOpen = this.$toolbar.find('.keep-open'); 2167 var $checkboxes = $keepOpen.find('input[type="checkbox"]:not(".toggle-all")'); 2168 var $toggleAll = $keepOpen.find('input[type="checkbox"].toggle-all'); 2169 if (switchableCount <= opts.minimumCountColumns) { 2170 $keepOpen.find('input').prop('disabled', true); 2171 } 2172 $keepOpen.find('li, label').off('click').on('click', function (e) { 2173 e.stopImmediatePropagation(); 2174 }); 2175 $checkboxes.off('click').on('click', function (_ref2) { 2176 var currentTarget = _ref2.currentTarget; 2177 var $this = $(currentTarget); 2178 _this4._toggleColumn($this.val(), $this.prop('checked'), false); 2179 _this4.trigger('column-switch', $this.data('field'), $this.prop('checked')); 2180 $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.filter(function (column) { 2181 return !_this4.isSelectionColumn(column); 2182 }).length); 2183 }); 2184 $toggleAll.off('click').on('click', function (_ref3) { 2185 var currentTarget = _ref3.currentTarget; 2186 _this4._toggleAllColumns($(currentTarget).prop('checked')); 2187 _this4.trigger('column-switch-all', $(currentTarget).prop('checked')); 2188 }); 2189 if (opts.showColumnsSearch) { 2190 var $columnsSearch = $keepOpen.find('[name="columnsSearch"]'); 2191 var $listItems = $keepOpen.find('.dropdown-item-marker'); 2192 $columnsSearch.on('keyup paste change', function (_ref4) { 2193 var currentTarget = _ref4.currentTarget; 2194 var $this = $(currentTarget); 2195 var searchValue = $this.val().toLowerCase(); 2196 $listItems.show(); 2197 $checkboxes.each(function (i, el) { 2198 var $checkbox = $(el); 2199 var $listItem = $checkbox.parents('.dropdown-item-marker'); 2200 var text = $listItem.text().toLowerCase(); 2201 if (!text.includes(searchValue)) { 2202 $listItem.hide(); 2203 } 2204 }); 2205 }); 2206 } 2207 } 2208 var handleInputEvent = function handleInputEvent($searchInput) { 2209 var eventTriggers = $searchInput.is('select') ? 'change' : 'keyup drop blur mouseup'; 2210 $searchInput.off(eventTriggers).on(eventTriggers, function (event) { 2211 if (opts.searchOnEnterKey && event.keyCode !== 13) { 2212 return; 2213 } 2214 if ([37, 38, 39, 40].includes(event.keyCode)) { 2215 return; 2216 } 2217 clearTimeout(timeoutId); // doesn't matter if it's 0 2218 timeoutId = setTimeout(function () { 2219 _this4.onSearch({ 2220 currentTarget: event.currentTarget 2221 }); 2222 }, opts.searchTimeOut); 2223 }); 2224 }; 2225 2226 // Fix #4516: this.showSearchClearButton is for extensions 2227 if ((opts.search || this.showSearchClearButton) && typeof opts.searchSelector !== 'string') { 2228 html = []; 2229 var showSearchButton = Utils.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, opts.formatSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.search) : '', opts.showButtonText ? opts.formatSearch() : ''); 2230 var showSearchClearButton = Utils.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, opts.formatClearSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.clearSearch) : '', opts.showButtonText ? opts.formatClearSearch() : ''); 2231 var searchInputHtml = "<input class=\"".concat(this.constants.classes.input, "\n ").concat(Utils.sprintf(' %s%s', this.constants.classes.inputPrefix, opts.iconSize), "\n search-input\" type=\"search\" aria-label=\"").concat(opts.formatSearch(), "\" placeholder=\"").concat(opts.formatSearch(), "\" autocomplete=\"off\">"); 2232 var searchInputFinalHtml = searchInputHtml; 2233 if (opts.showSearchButton || opts.showSearchClearButton) { 2234 var _buttonsHtml = (opts.showSearchButton ? showSearchButton : '') + (opts.showSearchClearButton ? showSearchClearButton : ''); 2235 searchInputFinalHtml = opts.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, _buttonsHtml) : _buttonsHtml; 2236 } 2237 html.push(Utils.sprintf("\n <div class=\"".concat(this.constants.classes.pull, "-").concat(opts.searchAlign, " search ").concat(this.constants.classes.inputGroup, "\">\n %s\n </div>\n "), searchInputFinalHtml)); 2238 this.$toolbar.append(html.join(''));
2239 var $searchInput = Utils.getSearchInput(this); 2240 if (opts.showSearchButton) { 2241 this.$toolbar.find('.search button[name=search]').off('click').on('click', function () { 2242 clearTimeout(timeoutId); // doesn't matter if it's 0 2243 timeoutId = setTimeout(function () { 2244 _this4.onSearch({ 2245 currentTarget: $searchInput 2246 }); 2247 }, opts.searchTimeOut); 2248 }); 2249 if (opts.searchOnEnterKey) { 2250 handleInputEvent($searchInput); 2251 } 2252 } else { 2253 handleInputEvent($searchInput); 2254 } 2255 if (opts.showSearchClearButton) { 2256 this.$toolbar.find('.search button[name=clearSearch]').click(function () { 2257 _this4.resetSearch(); 2258 }); 2259 } 2260 } else if (typeof opts.searchSelector === 'string') { 2261 handleInputEvent(Utils.getSearchInput(this)); 2262 } 2263 } 2264 }, { 2265 key: "onSearch", 2266 value: function onSearch() { 2267 var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, 2268 currentTarget = _ref5.currentTarget, 2269 firedByInitSearchText = _ref5.firedByInitSearchText; 2270 var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 2271 if (currentTarget !== undefined && $(currentTarget).length && overwriteSearchText) { 2272 var text = $(currentTarget).val().trim(); 2273 if (this.options.trimOnSearch && $(currentTarget).val() !== text) { 2274 $(currentTarget).val(text); 2275 } 2276 if (this.searchText === text) { 2277 return; 2278 } 2279 var $searchInput = Utils.getSearchInput(this); 2280 var $currentTarget = currentTarget instanceof jQuery ? currentTarget : $(currentTarget); 2281 if ($currentTarget.is($searchInput) || $currentTarget.hasClass('search-input')) { 2282 this.searchText = text; 2283 this.options.searchText = text; 2284 } 2285 } 2286 if (!firedByInitSearchText) { 2287 this.options.pageNumber = 1; 2288 } 2289 this.initSearch(); 2290 if (firedByInitSearchText) { 2291 if (this.options.sidePagination === 'client') { 2292 this.updatePagination(); 2293 } 2294 } else { 2295 this.updatePagination(); 2296 } 2297 this.trigger('search', this.searchText); 2298 } 2299 }, { 2300 key: "initSearch", 2301 value: function initSearch() { 2302 var _this5 = this; 2303 this.filterOptions = this.filterOptions || this.options.filterOptions; 2304 if (this.options.sidePagination !== 'server') { 2305 if (this.options.customSearch) { 2306 this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]); 2307 if (this.options.sortReset) { 2308 this.unsortedData = _toConsumableArray(this.data); 2309 } 2310 this.initSort(); 2311 return; 2312 } 2313 var rawSearchText = this.searchText && (this.fromHtml ? Utils.escapeHTML(this.searchText) : this.searchText); 2314 var searchText = rawSearchText ? rawSearchText.toLowerCase() : ''; 2315 var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns; 2316 if (this.options.searchAccentNeutralise) { 2317 searchText = Utils.normalizeAccent(searchText); 2318 } 2319 2320 // Check filter 2321 if (typeof this.filterOptions.filterAlgorithm === 'function') { 2322 this.data = this.options.data.filter(function (item) { 2323 return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]); 2324 }); 2325 } else if (typeof this.filterOptions.filterAlgorithm === 'string') { 2326 this.data = f ? this.options.data.filter(function (item) { 2327 var filterAlgorithm = _this5.filterOptions.filterAlgorithm; 2328 if (filterAlgorithm === 'and') { 2329 for (var key in f) { 2330 if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) { 2331 return false; 2332 } 2333 } 2334 } else if (filterAlgorithm === 'or') { 2335 var match = false; 2336 for (var _key in f) { 2337 if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) { 2338 match = true; 2339 } 2340 } 2341 return match; 2342 } 2343 return true; 2344 }) : _toConsumableArray(this.options.data); 2345 } 2346 var visibleFields = this.getVisibleFields(); 2347 this.data = searchText ? this.data.filter(function (item, i) { 2348 for (var j = 0; j < _this5.header.fields.length; j++) { 2349 if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) { 2350 continue; 2351 } 2352 var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j]; 2353 var column = _this5.columns[_this5.fieldsColumnsIndex[key]]; 2354 var value = void 0; 2355 if (typeof key === 'string' && !item.hasOwnProperty(key)) { 2356 value = item; 2357 var props = key.split('.'); 2358 for (var _i8 = 0; _i8 < props.length; _i8++) { 2359 if (value[props[_i8]] !== null) { 2360 value = value[props[_i8]]; 2361 } else { 2362 value = null; 2363 break; 2364 } 2365 } 2366 } else { 2367 value = item[key]; 2368 } 2369 if (_this5.options.searchAccentNeutralise) { 2370 value = Utils.normalizeAccent(value); 2371 } 2372 2373 // Fix #142: respect searchFormatter boolean 2374 if (column && column.searchFormatter) { 2375 value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value); 2376 } 2377 if (typeof value === 'string' || typeof value === 'number') { 2378 if (_this5.options.strictSearch && "".concat(value).toLowerCase() === searchText || _this5.options.regexSearch && Utils.regexCompare(value, rawSearchText)) { 2379 return true; 2380 } 2381 var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>
vendor: 10,137 bytes, lines 2381-2583
2381|<))/gm; 2382 var matches = largerSmallerEqualsRegex.exec(_this5.searchText); 2383 var comparisonCheck = false; 2384 if (matches) { 2385 var operator = matches[1] || "".concat(matches[5], "l"); 2386 var comparisonValue = matches[2] || matches[3]; 2387 var int = parseInt(value, 10); 2388 var comparisonInt = parseInt(comparisonValue, 10); 2389 switch (operator) { 2390 case '>': 2391 case '<l': 2392 comparisonCheck = int > comparisonInt; 2393 break; 2394 case '<': 2395 case '>l': 2396 comparisonCheck = int < comparisonInt; 2397 break; 2398 case '<=': 2399 case '=<': 2400 case '>=l': 2401 case '=>l': 2402 comparisonCheck = int <= comparisonInt; 2403 break; 2404 case '>=': 2405 case '=>': 2406 case '<=l': 2407 case '=<l': 2408 comparisonCheck = int >= comparisonInt; 2409 break; 2410 } 2411 } 2412 if (comparisonCheck || "".concat(value).toLowerCase().includes(searchText)) { 2413 return true; 2414 } 2415 } 2416 } 2417 return false; 2418 }) : this.data; 2419 if (this.options.sortReset) { 2420 this.unsortedData = _toConsumableArray(this.data); 2421 } 2422 this.initSort(); 2423 } 2424 } 2425 }, { 2426 key: "initPagination", 2427 value: function initPagination() { 2428 var _this6 = this; 2429 var opts = this.options; 2430 if (!opts.pagination) { 2431 this.$pagination.hide(); 2432 return; 2433 } 2434 this.$pagination.show(); 2435 var html = []; 2436 var allSelected = false; 2437 var i; 2438 var from; 2439 var to; 2440 var $pageList; 2441 var $pre; 2442 var $next; 2443 var $number; 2444 var data = this.getData({ 2445 includeHiddenRows: false 2446 }); 2447 var pageList = opts.pageList; 2448 if (typeof pageList === 'string') { 2449 pageList = pageList.replace(/\[|\]| /g, '').toLowerCase().split(','); 2450 } 2451 pageList = pageList.map(function (value) { 2452 if (typeof value === 'string') { 2453 return value.toLowerCase() === opts.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? opts.formatAllRows() : +value; 2454 } 2455 return value; 2456 }); 2457 this.paginationParts = opts.paginationParts; 2458 if (typeof this.paginationParts === 'string') { 2459 this.paginationParts = this.paginationParts.replace(/\[|\]| |'/g, '').split(','); 2460 } 2461 if (opts.sidePagination !== 'server') { 2462 opts.totalRows = data.length; 2463 } 2464 this.totalPages = 0; 2465 if (opts.totalRows) { 2466 if (opts.pageSize === opts.formatAllRows()) { 2467 opts.pageSize = opts.totalRows; 2468 allSelected = true; 2469 } 2470 this.totalPages = ~~((opts.totalRows - 1) / opts.pageSize) + 1; 2471 opts.totalPages = this.totalPages; 2472 } 2473 if (this.totalPages > 0 && opts.pageNumber > this.totalPages) { 2474 opts.pageNumber = this.totalPages; 2475 } 2476 this.pageFrom = (opts.pageNumber - 1) * opts.pageSize + 1; 2477 this.pageTo = opts.pageNumber * opts.pageSize; 2478 if (this.pageTo > opts.totalRows) { 2479 this.pageTo = opts.totalRows; 2480 } 2481 if (this.options.pagination && this.options.sidePagination !== 'server') { 2482 this.options.totalNotFiltered = this.options.data.length; 2483 } 2484 if (!this.options.showExtendedPagination) { 2485 this.options.totalNotFiltered = undefined; 2486 } 2487 if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) { 2488 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationDetailHAlign, " pagination-detail\">")); 2489 } 2490 if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort')) { 2491 var totalRows = this.options.totalRows + (this.options.sidePagination === 'client' && this.options.paginationLoadMore && !this._paginationLoaded ? ' +' : ''); 2492 var paginationInfo = this.paginationParts.includes('pageInfoShort') ? opts.formatDetailPagination(totalRows) : opts.formatShowingRows(this.pageFrom, this.pageTo, totalRows, opts.totalNotFiltered); 2493 html.push("<span class=\"pagination-info\">\n ".concat(paginationInfo, "\n </span>")); 2494 } 2495 if (this.paginationParts.includes('pageSize')) { 2496 html.push('<div class="page-list">'); 2497 var pageNumber = ["<div class=\"".concat(this.constants.classes.paginationDropdown, "\">\n <button class=\"").concat(this.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(this.constants.dataToggle, "=\"dropdown\">\n <span class=\"page-size\">\n ").concat(allSelected ? opts.formatAllRows() : opts.pageSize, "\n </span>\n ").concat(this.constants.html.dropdownCaret, "\n </button>\n ").concat(this.constants.html.pageDropdown[0])]; 2498 pageList.forEach(function (page, i) { 2499 if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows || page === opts.formatAllRows()) { 2500 var active; 2501 if (allSelected) { 2502 active = page === opts.formatAllRows() ? _this6.constants.classes.dropdownActive : ''; 2503 } else { 2504 active = page === opts.pageSize ? _this6.constants.classes.dropdownActive : ''; 2505 } 2506 pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page)); 2507 } 2508 }); 2509 pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</div>")); 2510 html.push(opts.formatRecordsPerPage(pageNumber.join(''))); 2511 } 2512 if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) { 2513 html.push('</div></div>'); 2514 } 2515 if (this.paginationParts.includes('pageList')) { 2516 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationHAlign, " pagination\">"), Utils.sprintf(this.constants.html.pagination[0], Utils.sprintf(' pagination-%s', opts.iconSize)), Utils.sprintf(this.constants.html.paginationItem, ' page-pre', opts.formatSRPaginationPreText(), opts.paginationPreText)); 2517 if (this.totalPages < opts.paginationSuccessivelySize) { 2518 from = 1; 2519 to = this.totalPages; 2520 } else { 2521 from = opts.pageNumber - opts.paginationPagesBySide; 2522 to = from + opts.paginationPagesBySide * 2; 2523 } 2524 if (opts.pageNumber < opts.paginationSuccessivelySize - 1) { 2525 to = opts.paginationSuccessivelySize; 2526 } 2527 if (opts.paginationSuccessivelySize > this.totalPages - from) { 2528 from = from - (opts.paginationSuccessivelySize - (this.totalPages - from)) + 1; 2529 } 2530 if (from < 1) { 2531 from = 1; 2532 } 2533 if (to > this.totalPages) { 2534 to = this.totalPages; 2535 } 2536 var middleSize = Math.round(opts.paginationPagesBySide / 2); 2537 var pageItem = function pageItem(i) { 2538 var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 2539 return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === opts.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), opts.formatSRPaginationPageText(i), i); 2540 }; 2541 if (from > 1) { 2542 var max = opts.paginationPagesBySide; 2543 if (max >= from) max = from - 1; 2544 for (i = 1; i <= max; i++) { 2545 html.push(pageItem(i)); 2546 } 2547 if (from - 1 === max + 1) { 2548 i = from - 1; 2549 html.push(pageItem(i)); 2550 } else if (from - 1 > max) { 2551 if (from - opts.paginationPagesBySide * 2 > opts.paginationPagesBySide && opts.paginationUseIntermediate) { 2552 i = Math.round((from - middleSize) / 2 + middleSize); 2553 html.push(pageItem(i, ' page-intermediate')); 2554 } else { 2555 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...')); 2556 } 2557 } 2558 } 2559 for (i = from; i <= to; i++) { 2560 html.push(pageItem(i)); 2561 } 2562 if (this.totalPages > to) { 2563 var min = this.totalPages - (opts.paginationPagesBySide - 1); 2564 if (to >= min) min = to + 1; 2565 if (to + 1 === min - 1) { 2566 i = to + 1; 2567 html.push(pageItem(i)); 2568 } else if (min > to + 1) { 2569 if (this.totalPages - to > opts.paginationPagesBySide * 2 && opts.paginationUseIntermediate) { 2570 i = Math.round((this.totalPages - middleSize - to) / 2 + to); 2571 html.push(pageItem(i, ' page-intermediate')); 2572 } else { 2573 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...')); 2574 } 2575 } 2576 for (i = min; i <= this.totalPages; i++) { 2577 html.push(pageItem(i)); 2578 } 2579 } 2580 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', opts.formatSRPaginationNextText(), opts.paginationNextText)); 2581 html.push(this.constants.html.pagination[1], '</div>'); 2582 } 2583 this.$pagination.html(html.join(''));
2584 var dropupClass = ['bottom', 'both'].includes(opts.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : ''; 2585 this.$pagination.last().find('.page-list > div').addClass(dropupClass); 2586 if (!opts.onlyInfoPagination) { 2587 $pageList = this.$pagination.find('.page-list a'); 2588 $pre = this.$pagination.find('.page-pre'); 2589 $next = this.$pagination.find('.page-next'); 2590 $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator'); 2591 if (this.totalPages <= 1) { 2592 this.$pagination.find('div.pagination').hide(); 2593 } 2594 if (opts.smartDisplay) { 2595 if (pageList.length < 2 || opts.totalRows <= pageList[0]) { 2596 this.$pagination.find('div.page-list').hide(); 2597 } 2598 } 2599 2600 // when data is empty, hide the pagination 2601 this.$pagination[this.getData().length ? 'show' : 'hide'](); 2602 if (!opts.paginationLoop) { 2603 if (opts.pageNumber === 1) { 2604 $pre.addClass('disabled'); 2605 } 2606 if (opts.pageNumber === this.totalPages) { 2607 $next.addClass('disabled'); 2608 } 2609 } 2610 if (allSelected) { 2611 opts.pageSize = opts.formatAllRows(); 2612 } 2613 $pageList.off('click').on('click', function (e) { 2614 return _this6.onPageListChange(e); 2615 }); 2616 $pre.off('click').on('click', function (e) { 2617 return _this6.onPagePre(e); 2618 }); 2619 $next.off('click').on('click', function (e) { 2620 return _this6.onPageNext(e); 2621 }); 2622 $number.off('click').on('click', function (e) { 2623 return _this6.onPageNumber(e); 2624 }); 2625 } 2626 } 2627 }, { 2628 key: "updatePagination", 2629 value: function updatePagination(event) { 2630 // Fix #171: IE disabled button can be clicked bug. 2631 if (event && $(event.currentTarget).hasClass('disabled')) { 2632 return; 2633 } 2634 if (!this.options.maintainMetaData) { 2635 this.resetRows(); 2636 } 2637 this.initPagination(); 2638 this.trigger('page-change', this.options.pageNumber, this.options.pageSize); 2639 if (this.options.sidePagination === 'server' || this.options.sidePagination === 'client' && this.options.paginationLoadMore && !this._paginationLoaded && this.options.pageNumber === this.totalPages) { 2640 this.initServer(); 2641 } else { 2642 this.initBody(); 2643 } 2644 } 2645 }, { 2646 key: "onPageListChange", 2647 value: function onPageListChange(event) { 2648 event.preventDefault(); 2649 var $this = $(event.currentTarget); 2650 $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive); 2651 this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text(); 2652 this.$toolbar.find('.page-size').text(this.options.pageSize); 2653 this.updatePagination(event); 2654 return false; 2655 } 2656 }, { 2657 key: "onPagePre", 2658 value: function onPagePre(event) { 2659 if ($(event.target).hasClass('disabled')) { 2660 return; 2661 } 2662 event.preventDefault(); 2663 if (this.options.pageNumber - 1 === 0) { 2664 this.options.pageNumber = this.options.totalPages; 2665 } else { 2666 this.options.pageNumber--; 2667 } 2668 this.updatePagination(event); 2669 return false; 2670 } 2671 }, { 2672 key: "onPageNext", 2673 value: function onPageNext(event) { 2674 if ($(event.target).hasClass('disabled')) { 2675 return; 2676 } 2677 event.preventDefault(); 2678 if (this.options.pageNumber + 1 > this.options.totalPages) { 2679 this.options.pageNumber = 1; 2680 } else { 2681 this.options.pageNumber++; 2682 } 2683 this.updatePagination(event); 2684 return false; 2685 } 2686 }, { 2687 key: "onPageNumber", 2688 value: function onPageNumber(event) { 2689 event.preventDefault(); 2690 if (this.options.pageNumber === +$(event.currentTarget).text()) { 2691 return; 2692 } 2693 this.options.pageNumber = +$(event.currentTarget).text(); 2694 this.updatePagination(event); 2695 return false; 2696 } 2697 2698 // eslint-disable-next-line no-unused-vars 2699 }, { 2700 key: "initRow", 2701 value: function initRow(item, i, data, trFragments) { 2702 var _this7 = this; 2703 var html = []; 2704 var style = {}; 2705 var csses = []; 2706 var data_ = ''; 2707 var attributes = {}; 2708 var htmlAttributes = []; 2709 if (Utils.findIndex(this.hiddenRows, item) > -1) { 2710 return; 2711 } 2712 style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style); 2713 if (style && style.css) { 2714 for (var _i9 = 0, _Object$entries8 = Object.entries(style.css); _i9 < _Object$entries8.length; _i9++) { 2715 var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2), 2716 key = _Object$entries8$_i[0], 2717 value = _Object$entries8$_i[1]; 2718 csses.push("".concat(key, ": ").concat(value)); 2719 } 2720 } 2721 attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes); 2722 if (attributes) { 2723 for (var _i10 = 0, _Object$entries9 = Object.entries(attributes); _i10 < _Object$entries9.length; _i10++) { 2724 var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2), 2725 _key2 = _Object$entries9$_i[0], 2726 _value = _Object$entries9$_i[1]; 2727 htmlAttributes.push("".concat(_key2, "=\"").concat(Utils.escapeHTML(_value), "\"")); 2728 } 2729 } 2730 if (item._data && !Utils.isEmptyObject(item._data)) { 2731 for (var _i11 = 0, _Object$entries10 = Object.entries(item._data); _i11 < _Object$entries10.length; _i11++) { 2732 var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2), 2733 k = _Object$entries10$_i[0], 2734 v = _Object$entries10$_i[1]; 2735 // ignore data-index 2736 if (k === 'index') { 2737 return; 2738 } 2739 data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'"); 2740 } 2741 } 2742 html.push('<tr', Utils.sprintf(' %s', htmlAttributes.length ? htmlAttributes.join(' ') : undefined), Utils.sprintf(' id="%s"', Array.isArray(item) ? undefined : item._id), Utils.sprintf(' class="%s"', style.classes || (Array.isArray(item) ? undefined : item._class)), Utils.sprintf(' style="%s"', Array.isArray(item) ? undefined : item._style), " data-index=\"".concat(i, "\""), Utils.sprintf(' data-uniqueid="%s"', Utils.getItemField(item, this.options.uniqueId, false)), Utils.sprintf(' data-has-detail-view="%s"', this.options.detailVie
2742w && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item]) ? 'true' : undefined), Utils.sprintf('%s', data_), '>'); 2743 if (this.options.cardView) { 2744 html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">")); 2745 } 2746 var detailViewTemplate = ''; 2747 if (Utils.hasDetailViewIcon(this.options)) { 2748 detailViewTemplate = '<td>'; 2749 if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) { 2750 detailViewTemplate += "\n <a class=\"detail-icon\" href=\"#\">\n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n </a>\n "); 2751 } 2752 detailViewTemplate += '</td>'; 2753 } 2754 if (detailViewTemplate && this.options.detailViewAlign !== 'right') { 2755 html.push(detailViewTemplate); 2756 } 2757 this.header.fields.forEach(function (field, j) { 2758 var column = _this7.columns[j]; 2759 var text = ''; 2760 var value_ = Utils.getItemField(item, field, _this7.options.escape, column.escape); 2761 var value = ''; 2762 var type = ''; 2763 var cellStyle = {}; 2764 var id_ = ''; 2765 var class_ = _this7.header.classes[j]; 2766 var style_ = ''; 2767 var styleToAdd_ = ''; 2768 var data_ = ''; 2769 var rowspan_ = ''; 2770 var colspan_ = ''; 2771 var title_ = ''; 2772 if ((_this7.fromHtml || _this7.autoMergeCells) && typeof value_ === 'undefined') { 2773 if (!column.checkbox && !column.radio) { 2774 return; 2775 } 2776 } 2777 if (!column.visible) { 2778 return; 2779 } 2780 if (_this7.options.cardView && !column.cardVisible) { 2781 return; 2782 } 2783 2784 // Style concat 2785 if (csses.concat([_this7.header.styles[j]]).length) { 2786 styleToAdd_ += "".concat(csses.concat([_this7.header.styles[j]]).join('; ')); 2787 } 2788 if (item["_".concat(field, "_style")]) { 2789 styleToAdd_ += "".concat(item["_".concat(field, "_style")]); 2790 } 2791 if (styleToAdd_) { 2792 style_ = " style=\"".concat(styleToAdd_, "\""); 2793 } 2794 // Style concat 2795 2796 // handle id and class of td 2797 if (item["_".concat(field, "_id")]) { 2798 id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]); 2799 } 2800 if (item["_".concat(field, "_class")]) { 2801 class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]); 2802 } 2803 if (item["_".concat(field, "_rowspan")]) { 2804 rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]); 2805 } 2806 if (item["_".concat(field, "_colspan")]) { 2807 colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]); 2808 } 2809 if (item["_".concat(field, "_title")]) { 2810 title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]); 2811 } 2812 cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle); 2813 if (cellStyle.classes) { 2814 class_ = " class=\"".concat(cellStyle.classes, "\""); 2815 } 2816 if (cellStyle.css) { 2817 var csses_ = []; 2818 for (var _i12 = 0, _Object$entries11 = Object.entries(cellStyle.css); _i12 < _Object$entries11.length; _i12++) { 2819 var _Object$entries11$_i = _slicedToArray(_Object$entries11[_i12], 2), 2820 _key3 = _Object$entries11$_i[0], 2821 _value2 = _Object$entries11$_i[1]; 2822 csses_.push("".concat(_key3, ": ").concat(_value2)); 2823 } 2824 style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\""); 2825 } 2826 value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_); 2827 if (!(column.checkbox || column.radio)) { 2828 value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value; 2829 } 2830 if (column.searchable && _this7.searchText && _this7.options.searchHighlight && !(column.checkbox || column.radio)) { 2831 var defValue = ''; 2832 var searchText = _this7.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); 2833 if (_this7.options.searchAccentNeutralise) { 2834 var indexRegex = new RegExp("".concat(Utils.normalizeAccent(searchText)), 'gmi'); 2835 var match = indexRegex.exec(Utils.normalizeAccent(value)); 2836 if (match) { 2837 searchText = value.substring(match.index, match.index + searchText.length); 2838 } 2839 } 2840 var regExp = new RegExp("(".concat(searchText, ")"), 'gim'); 2841 var marker = '<mark>$1</mark>'; 2842 var isHTML = value && /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(value); 2843 if (isHTML) { 2844 // value can contains a HTML tags 2845 var textContent = new DOMParser().parseFromString(value.toString(), 'text/html').documentElement.textContent; 2846 var textReplaced = textContent.replace(regExp, marker); 2847 textContent = textContent.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); 2848 defValue = value.replace(new RegExp("(>\\s*)(".concat(textContent, ")(\\s*)"), 'gm'), "$1".concat(textReplaced, "$3")); 2849 } else { 2850 // but usually not 2851 defValue = value.toString().replace(regExp, marker); 2852 } 2853 value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, _this7.searchText], defValue); 2854 } 2855 if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) { 2856 for (var _i13 = 0, _Object$entries12 = Object.entries(item["_".concat(field, "_data")]); _i13 < _Object$entries12.length; _i13++) { 2857 var _Object$entries12$_i = _slicedToArray(_Object$entries12[_i13], 2), 2858 _k = _Object$entries12$_i[0], 2859 _v = _Object$entries12$_i[1]; 2860 // ignore data-index 2861 if (_k === 'index') { 2862 return; 2863 } 2864 data_ += " data-".concat(_k, "=\"").concat(_v, "\""); 2865 } 2866 } 2867 if (column.checkbox || column.radio) { 2868 type = column.checkbox ? 'checkbox' : type; 2869 type = column.radio ? 'radio' : type; 2870 var c = column['class'] || ''; 2871 var isChecked = Utils.isObject(value) && value.hasOwnProperty('checked') ? value.checked : (value === true || value_) && value !== false; 2872 var isDisabled = !column.checkboxEnabled || value && value.disabled; 2873 text = [_this7.options.cardView ? "<div class=\"card-view ".concat(c, "\">") : "<td class=\"bs-checkbox ".concat(c, "\"").concat(class_).concat(style_, ">"), "<label>\n <input\n data-index=\"".concat(i, "\"\n name=\"").concat(_this7.options.selectItemName, "\"\n type=\"").concat(type, "\"\n ").concat(Utils.sprintf('value="%s"', item[_this7.options.idField]), "\n ").concat(Utils.sprintf('checked="%s"', isChecked ? 'checked' : undefined), "\n ").concat(Utils.sprintf('disabled="%s"', isDisabled ? 'disabled' : undefined), " />
2873\n <span></span>\n </label>"), _this7.header.formatters[j] && typeof value === 'string' ? value : '', _this7.options.cardView ? '</div>' : '</td>'].join(''); 2874 item[_this7.header.stateField] = value === true || !!value_ || value && value.checked; 2875 } else if (_this7.options.cardView) { 2876 var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title ".concat(cellStyle.classes || '', "\"").concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : ''; 2877 text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value ").concat(cellStyle.classes || '', "\"").concat(style_, ">").concat(value, "</span></div>"); 2878 if (_this7.options.smartDisplay && value === '') { 2879 text = '<div class="card-view"></div>'; 2880 } 2881 } else { 2882 text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>"); 2883 } 2884 html.push(text); 2885 }); 2886 if (detailViewTemplate && this.options.detailViewAlign === 'right') { 2887 html.push(detailViewTemplate); 2888 } 2889 if (this.options.cardView) { 2890 html.push('</div></td>'); 2891 } 2892 html.push('</tr>'); 2893 return html.join(''); 2894 } 2895 }, { 2896 key: "initBody", 2897 value: function initBody(fixedScroll, updatedUid) { 2898 var _this8 = this; 2899 var data = this.getData(); 2900 this.trigger('pre-body', data); 2901 this.$body = this.$el.find('>tbody'); 2902 if (!this.$body.length) { 2903 this.$body = $('<tbody></tbody>').appendTo(this.$el); 2904 } 2905 2906 // Fix #389 Bootstrap-table-flatJSON is not working 2907 if (!this.options.pagination || this.options.sidePagination === 'server') { 2908 this.pageFrom = 1; 2909 this.pageTo = data.length; 2910 } 2911 var rows = []; 2912 var trFragments = $(document.createDocumentFragment()); 2913 var hasTr = false; 2914 var toExpand = []; 2915 this.autoMergeCells = Utils.checkAutoMergeCells(data.slice(this.pageFrom - 1, this.pageTo)); 2916 for (var i = this.pageFrom - 1; i < this.pageTo; i++) { 2917 var item = data[i]; 2918 var tr = this.initRow(item, i, data, trFragments); 2919 hasTr = hasTr || !!tr; 2920 if (tr && typeof tr === 'string') { 2921 var uniqueId = this.options.uniqueId; 2922 if (uniqueId && item.hasOwnProperty(uniqueId)) { 2923 var itemUniqueId = item[uniqueId]; 2924 var oldTr = this.$body.find(Utils.sprintf('> tr[data-uniqueid="%s"][data-has-detail-view]', itemUniqueId)); 2925 var oldTrNext = oldTr.next(); 2926 if (oldTrNext.is('tr.detail-view')) { 2927 toExpand.push(i); 2928 if (!updatedUid || itemUniqueId !== updatedUid) { 2929 tr += oldTrNext[0].outerHTML; 2930 } 2931 } 2932 } 2933 if (!this.options.virtualScroll) { 2934 trFragments.append(tr); 2935 } else { 2936 rows.push(tr); 2937 } 2938 } 2939 } 2940 2941 // show no records 2942 if (!hasTr) { 2943 this.$body.html("<tr class=\"no-records-found\">".concat(Utils.sprintf('<td colspan="%s">%s</td>', this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options), this.options.formatNoMatches()), "</tr>")); 2944 } else if (!this.options.virtualScroll) { 2945 this.$body.html(trFragments); 2946 } else { 2947 if (this.virtualScroll) { 2948 this.virtualScroll.destroy(); 2949 } 2950 this.virtualScroll = new VirtualScroll({ 2951 rows: rows, 2952 fixedScroll: fixedScroll, 2953 scrollEl: this.$tableBody[0], 2954 contentEl: this.$body[0], 2955 itemHeight: this.options.virtualScrollItemHeight, 2956 callback: function callback(startIndex, endIndex) { 2957 _this8.fitHeader(); 2958 _this8.initBodyEvent(); 2959 _this8.trigger('virtual-scroll', startIndex, endIndex); 2960 } 2961 }); 2962 }
vendor: 17,678 bytes, lines 2963-3363
2963 toExpand.forEach(function (index) { 2964 _this8.expandRow(index); 2965 }); 2966 if (!fixedScroll) { 2967 this.scrollTo(0); 2968 } 2969 this.initBodyEvent(); 2970 this.initFooter(); 2971 this.resetView(); 2972 this.updateSelected(); 2973 if (this.options.sidePagination !== 'server') { 2974 this.options.totalRows = data.length; 2975 } 2976 this.trigger('post-body', data); 2977 } 2978 }, { 2979 key: "initBodyEvent", 2980 value: function initBodyEvent() { 2981 var _this9 = this; 2982 // click to select by column 2983 this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) { 2984 var $td = $(e.currentTarget); 2985 if ($td.find('.detail-icon').length || $td.index() - Utils.getDetailViewIndexOffset(_this9.options) < 0) { 2986 return; 2987 } 2988 var $tr = $td.parent(); 2989 var $cardViewArr = $(e.target).parents('.card-views').children(); 2990 var $cardViewTarget = $(e.target).parents('.card-view'); 2991 var rowIndex = $tr.data('index'); 2992 var item = _this9.data[rowIndex]; 2993 var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex; 2994 var fields = _this9.getVisibleFields(); 2995 var field = fields[index - Utils.getDetailViewIndexOffset(_this9.options)]; 2996 var column = _this9.columns[_this9.fieldsColumnsIndex[field]]; 2997 var value = Utils.getItemField(item, field, _this9.options.escape, column.escape); 2998 _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td); 2999 _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); 3000 3001 // if click to select - then trigger the checkbox/radio click 3002 if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) { 3003 var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName)); 3004 if ($selectItem.length) { 3005 $selectItem[0].click(); 3006 } 3007 } 3008 if (e.type === 'click' && _this9.options.detailViewByClick) { 3009 _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]); 3010 } 3011 }).off('mousedown').on('mousedown', function (e) { 3012 // https://github.com/jquery/jquery/issues/1741 3013 _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey; 3014 _this9.multipleSelectRowShiftKey = e.shiftKey; 3015 }); 3016 this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) { 3017 e.preventDefault(); 3018 _this9.toggleDetailView($(e.currentTarget).parent().parent().data('index')); 3019 return false; 3020 }); 3021 this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName)); 3022 this.$selectItem.off('click').on('click', function (e) { 3023 e.stopImmediatePropagation(); 3024 var $this = $(e.currentTarget); 3025 _this9._toggleCheck($this.prop('checked'), $this.data('index')); 3026 }); 3027 this.header.events.forEach(function (_events, i) { 3028 var events = _events; 3029 if (!events) { 3030 return; 3031 } 3032 // fix bug, if events is defined with namespace 3033 if (typeof events === 'string') { 3034 events = Utils.calculateObjectValue(null, events); 3035 } 3036 if (!events) { 3037 throw new Error("Unknown event in the scope: ".concat(_events)); 3038 } 3039 var field = _this9.header.fields[i]; 3040 var fieldIndex = _this9.getVisibleFields().indexOf(field); 3041 if (fieldIndex === -1) { 3042 return; 3043 } 3044 fieldIndex += Utils.getDetailViewIndexOffset(_this9.options); 3045 var _loop3 = function _loop3(key) { 3046 if (!events.hasOwnProperty(key)) { 3047 return 1; // continue 3048 } 3049 var event = events[key]; 3050 _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) { 3051 var $tr = $(tr); 3052 var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex); 3053 var index = key.indexOf(' '); 3054 var name = key.substring(0, index); 3055 var el = key.substring(index + 1); 3056 $td.find(el).off(name).on(name, function (e) { 3057 var index = $tr.data('index'); 3058 var row = _this9.data[index]; 3059 var value = row[field]; 3060 event.apply(_this9, [e, value, row, index]); 3061 }); 3062 }); 3063 }; 3064 for (var key in events) { 3065 if (_loop3(key)) continue; 3066 } 3067 }); 3068 } 3069 }, { 3070 key: "initServer", 3071 value: function initServer(silent, query, url) { 3072 var _this10 = this; 3073 var data = {}; 3074 var index = this.header.fields.indexOf(this.options.sortName); 3075 var params = { 3076 searchText: this.searchText, 3077 sortName: this.options.sortName, 3078 sortOrder: this.options.sortOrder 3079 }; 3080 if (this.header.sortNames[index]) { 3081 params.sortName = this.header.sortNames[index]; 3082 } 3083 if (this.options.pagination && this.options.sidePagination === 'server') { 3084 params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize; 3085 params.pageNumber = this.options.pageNumber; 3086 } 3087 if (!(url || this.options.url) && !this.options.ajax) { 3088 return; 3089 } 3090 if (this.options.queryParamsType === 'limit') { 3091 params = { 3092 search: params.searchText, 3093 sort: params.sortName, 3094 order: params.sortOrder 3095 }; 3096 if (this.options.pagination && this.options.sidePagination === 'server') { 3097 params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1); 3098 params.limit = this.options.pageSize; 3099 if (params.limit === 0 || this.options.pageSize === this.options.formatAllRows()) { 3100 delete params.limit; 3101 } 3102 } 3103 } 3104 if (this.options.search && this.options.sidePagination === 'server' && this.options.searchable && this.columns.filter(function (column) { 3105 return column.searchable; 3106 }).length) { 3107 params.searchable = []; 3108 var _iterator2 = _createForOfIteratorHelper(this.columns), 3109 _step2; 3110 try { 3111 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 3112 var column = _step2.value; 3113 if (!column.checkbox && column.searchable && (this.options.visibleSearch && column.visible || !this.options.visibleSearch)) { 3114 params.searchable.push(column.field); 3115 } 3116 } 3117 } catch (err) { 3118 _iterator2.e(err); 3119 } finally { 3120 _iterator2.f(); 3121 } 3122 } 3123 if (!Utils.isEmptyObject(this.filterColumnsPartial)) { 3124 params.filter = JSON.stringify(this.filterColumnsPartial, null); 3125 } 3126 Utils.extend(params, query || {}); 3127 data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); 3128 3129 // false to stop request 3130 if (data === false) { 3131 return; 3132 } 3133 if (!silent) { 3134 this.showLoading(); 3135 } 3136 var request = Utils.extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), { 3137 type: this.options.method, 3138 url: url || this.options.url, 3139 data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data, 3140 cache: this.options.cache, 3141 contentType: this.options.contentType, 3142 dataType: this.options.dataType, 3143 success: function success(_res, textStatus, jqXHR) { 3144 var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res); 3145 if (_this10.options.sidePagination === 'client' && _this10.options.paginationLoadMore) { 3146 _this10._paginationLoaded = _this10.data.length === res.length; 3147 } 3148 _this10.load(res); 3149 _this10.trigger('load-success', res, jqXHR && jqXHR.status, jqXHR); 3150 if (!silent) { 3151 _this10.hideLoading(); 3152 } 3153 if (_this10.options.sidePagination === 'server' && _this10.options.pageNumber > 1 && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) { 3154 _this10.updatePagination(); 3155 } 3156 }, 3157 error: function error(jqXHR) { 3158 // abort ajax by multiple request 3159 if (jqXHR && jqXHR.status === 0 && _this10._xhrAbort) { 3160 _this10._xhrAbort = false; 3161 return; 3162 } 3163 var data = []; 3164 if (_this10.options.sidePagination === 'server') { 3165 data = {}; 3166 data[_this10.options.totalField] = 0; 3167 data[_this10.options.dataField] = []; 3168 } 3169 _this10.load(data); 3170 _this10.trigger('load-error', jqXHR && jqXHR.status, jqXHR); 3171 if (!silent) { 3172 _this10.hideLoading(); 3173 } 3174 } 3175 }); 3176 if (this.options.ajax) { 3177 Utils.calculateObjectValue(this, this.options.ajax, [request], null); 3178 } else { 3179 if (this._xhr && this._xhr.readyState !== 4) { 3180 this._xhrAbort = true; 3181 this._xhr.abort(); 3182 } 3183 this._xhr = $.ajax(request); 3184 } 3185 return data; 3186 } 3187 }, { 3188 key: "initSearchText", 3189 value: function initSearchText() { 3190 if (this.options.search) { 3191 this.searchText = ''; 3192 if (this.options.searchText !== '') { 3193 var $search = Utils.getSearchInput(this); 3194 $search.val(this.options.searchText); 3195 this.onSearch({ 3196 currentTarget: $search, 3197 firedByInitSearchText: true 3198 }); 3199 } 3200 } 3201 } 3202 }, { 3203 key: "getCaret", 3204 value: function getCaret() { 3205 var _this11 = this; 3206 this.$header.find('th').each(function (i, th) { 3207 $(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both'); 3208 }); 3209 } 3210 }, { 3211 key: "updateSelected", 3212 value: function updateSelected() { 3213 var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length; 3214 this.$selectAll.add(this.$selectAll_).prop('checked', checkAll); 3215 this.$selectItem.each(function (i, el) { 3216 $(el).closest('tr')[$(el).prop('checked') ? 'addClass' : 'removeClass']('selected'); 3217 }); 3218 } 3219 }, { 3220 key: "updateRows", 3221 value: function updateRows() { 3222 var _this12 = this; 3223 this.$selectItem.each(function (i, el) { 3224 _this12.data[$(el).data('index')][_this12.header.stateField] = $(el).prop('checked'); 3225 }); 3226 } 3227 }, { 3228 key: "resetRows", 3229 value: function resetRows() { 3230 var _iterator3 = _createForOfIteratorHelper(this.data), 3231 _step3; 3232 try { 3233 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 3234 var row = _step3.value; 3235 this.$selectAll.prop('checked', false); 3236 this.$selectItem.prop('checked', false); 3237 if (this.header.stateField) { 3238 row[this.header.stateField] = false; 3239 } 3240 } 3241 } catch (err) { 3242 _iterator3.e(err); 3243 } finally { 3244 _iterator3.f(); 3245 } 3246 this.initHiddenRows(); 3247 } 3248 }, { 3249 key: "trigger", 3250 value: function trigger(_name) { 3251 var _this$options, _this$options2; 3252 var name = "".concat(_name, ".bs.table"); 3253 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key4 = 1; _key4 < _len; _key4++) { 3254 args[_key4 - 1] = arguments[_key4]; 3255 } 3256 (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, [].concat(args, [this])); 3257 this.$el.trigger($.Event(name, { 3258 sender: this 3259 }), args); 3260 (_this$options2 = this.options).onAll.apply(_this$options2, [name].concat([].concat(args, [this]))); 3261 this.$el.trigger($.Event('all.bs.table', { 3262 sender: this 3263 }), [name, args]); 3264 } 3265 }, { 3266 key: "resetHeader", 3267 value: function resetHeader() { 3268 var _this13 = this; 3269 // fix #61: the hidden table reset header bug. 3270 // fix bug: get $el.css('width') error sometime (height = 500) 3271 clearTimeout(this.timeoutId_); 3272 this.timeoutId_ = setTimeout(function () { 3273 return _this13.fitHeader(); 3274 }, this.$el.is(':hidden') ? 100 : 0); 3275 } 3276 }, { 3277 key: "fitHeader", 3278 value: function fitHeader() { 3279 var _this14 = this; 3280 if (this.$el.is(':hidden')) { 3281 this.timeoutId_ = setTimeout(function () { 3282 return _this14.fitHeader(); 3283 }, 100); 3284 return; 3285 } 3286 var fixedBody = this.$tableBody.get(0); 3287 var scrollWidth = this.hasScrollBar && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0; 3288 this.$el.css('margin-top', -this.$header.outerHeight()); 3289 var focused = this.$tableHeader.find(':focus'); 3290 if (focused.length > 0) { 3291 var $th = focused.parents('th'); 3292 if ($th.length > 0) { 3293 var dataField = $th.attr('data-field'); 3294 if (dataField !== undefined) { 3295 var $headerTh = this.$header.find("[data-field='".concat(dataField, "']")); 3296 if ($headerTh.length > 0) { 3297 $headerTh.find(':input').addClass('focus-temp'); 3298 } 3299 } 3300 } 3301 } 3302 this.$header_ = this.$header.clone(true, true); 3303 this.$selectAll_ = this.$header_.find('[name="btSelectAll"]'); 3304 this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_); 3305 this.$tableLoading.css('width', this.$el.outerWidth()); 3306 var focusedTemp = $('.focus-temp:visible:eq(0)'); 3307 if (focusedTemp.length > 0) { 3308 focusedTemp.focus(); 3309 this.$header.find('.focus-temp').removeClass('focus-temp'); 3310 } 3311 3312 // fix bug: $.data() is not working as expected after $.append() 3313 this.$header.find('th[data-field]').each(function (i, el) { 3314 _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $(el).data('field'))).data($(el).data()); 3315 }); 3316 var visibleFields = this.getVisibleFields(); 3317 var $ths = this.$header_.find('th'); 3318 var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0); 3319 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) { 3320 $tr = $tr.next(); 3321 } 3322 var trLength = $tr.find('> *').length; 3323 $tr.find('> *').each(function (i, el) { 3324 var $this = $(el); 3325 if (Utils.hasDetailViewIcon(_this14.options)) { 3326 if (i === 0 && _this14.options.detailViewAlign !== 'right' || i === trLength - 1 && _this14.options.detailViewAlign === 'right') { 3327 var $thDetail = $ths.filter('.detail'); 3328 var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width(); 3329 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth); 3330 return; 3331 } 3332 } 3333 var index = i - Utils.getDetailViewIndexOffset(_this14.options); 3334 var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index])); 3335 if ($th.length > 1) { 3336 $th = $($ths[$this[0].cellIndex]); 3337 } 3338 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width(); 3339 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth); 3340 }); 3341 this.horizontalScroll(); 3342 this.trigger('post-header'); 3343 } 3344 }, { 3345 key: "initFooter", 3346 value: function initFooter() { 3347 if (!this.options.showFooter || this.options.cardView) { 3348 // do nothing 3349 return; 3350 } 3351 var data = this.getData(); 3352 var html = []; 3353 var detailTemplate = ''; 3354 if (Utils.hasDetailViewIcon(this.options)) { 3355 detailTemplate = '<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>'; 3356 } 3357 if (detailTemplate && this.options.detailViewAlign !== 'right') { 3358 html.push(detailTemplate); 3359 } 3360 var _iterator4 = _createForOfIteratorHelper(this.columns), 3361 _step4; 3362 try { 3363 for (_iterator4.s();
3363 !(_step4 = _iterator4.n()).done;) { 3364 var column = _step4.value; 3365 var falign = ''; 3366 var valign = ''; 3367 var csses = []; 3368 var style = {}; 3369 var class_ = Utils.sprintf(' class="%s"', column['class']); 3370 if (!column.visible || this.footerData && this.footerData.length > 0 && !(column.field in this.footerData[0])) { 3371 continue; 3372 } 3373 if (this.options.cardView && !column.cardVisible) { 3374 return; 3375 } 3376 falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align); 3377 valign = Utils.sprintf('vertical-align: %s; ', column.valign); 3378 style = Utils.calculateObjectValue(null, column.footerStyle || this.options.footerStyle, [column]); 3379 if (style && style.css) { 3380 for (var _i14 = 0, _Object$entries13 = Object.entries(style.css); _i14 < _Object$entries13.length; _i14++) { 3381 var _Object$entries13$_i = _slicedToArray(_Object$entries13[_i14], 2), 3382 key = _Object$entries13$_i[0], 3383 _value3 = _Object$entries13$_i[1]; 3384 csses.push("".concat(key, ": ").concat(_value3)); 3385 } 3386 } 3387 if (style && style.classes) { 3388 class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes); 3389 } 3390 html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ') || undefined)); 3391 var colspan = 0; 3392 if (this.footerData && this.footerData.length > 0) { 3393 colspan = this.footerData[0]["_".concat(column.field, "_colspan")] || 0; 3394 } 3395 if (colspan) { 3396 html.push(" colspan=\"".concat(colspan, "\" ")); 3397 } 3398 html.push('>'); 3399 html.push('<div class="th-inner">'); 3400 var value = ''; 3401 if (this.footerData && this.footerData.length > 0) { 3402 value = this.footerData[0][column.field] || ''; 3403 } 3404 html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data, value], value)); 3405 html.push('</div>'); 3406 html.push('<div class="fht-cell"></div>'); 3407 html.push('</div>'); 3408 html.push('</th>'); 3409 } 3410 } catch (err) { 3411 _iterator4.e(err); 3412 } finally { 3413 _iterator4.f(); 3414 } 3415 if (detailTemplate && this.options.detailViewAlign === 'right') { 3416 html.push(detailTemplate); 3417 } 3418 if (!this.options.height && !this.$tableFooter.length) { 3419 this.$el.append('<tfoot><tr></tr></tfoot>'); 3420 this.$tableFooter = this.$el.find('tfoot'); 3421 } 3422 if (!this.$tableFooter.find('tr').length) { 3423 this.$tableFooter.html('<table><thead><tr></tr></thead></table>'); 3424 } 3425 this.$tableFooter.find('tr').html(html.join('')); 3426 this.trigger('post-footer', this.$tableFooter); 3427 } 3428 }, { 3429 key: "fitFooter", 3430 value: function fitFooter() { 3431 var _this15 = this; 3432 if (this.$el.is(':hidden')) { 3433 setTimeout(function () { 3434 return _this15.fitFooter(); 3435 }, 100); 3436 return; 3437 } 3438 var fixedBody = this.$tableBody.get(0); 3439 var scrollWidth = this.hasScrollBar && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0; 3440 this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class')); 3441 var $ths = this.$tableFooter.find('th'); 3442 var $tr = this.$body.find('>tr:first-child:not(.no-records-found)'); 3443 $ths.find('.fht-cell').width('auto'); 3444 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) { 3445 $tr = $tr.next(); 3446 } 3447 var trLength = $tr.find('> *').length; 3448 $tr.find('> *').each(function (i, el) { 3449 var $this = $(el);
vendor: 15,276 bytes, lines 3450-3868
3450 if (Utils.hasDetailViewIcon(_this15.options)) { 3451 if (i === 0 && _this15.options.detailViewAlign === 'left' || i === trLength - 1 && _this15.options.detailViewAlign === 'right') { 3452 var $thDetail = $ths.filter('.detail'); 3453 var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width(); 3454 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2); 3455 return; 3456 } 3457 } 3458 var $th = $ths.eq(i); 3459 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width(); 3460 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth); 3461 }); 3462 this.horizontalScroll(); 3463 } 3464 }, { 3465 key: "horizontalScroll", 3466 value: function horizontalScroll() { 3467 var _this16 = this; 3468 // horizontal scroll event 3469 // TODO: it's probably better improving the layout than binding to scroll event 3470 this.$tableBody.off('scroll').on('scroll', function () { 3471 var scrollLeft = _this16.$tableBody.scrollLeft(); 3472 if (_this16.options.showHeader && _this16.options.height) { 3473 _this16.$tableHeader.scrollLeft(scrollLeft); 3474 } 3475 if (_this16.options.showFooter && !_this16.options.cardView) { 3476 _this16.$tableFooter.scrollLeft(scrollLeft); 3477 } 3478 _this16.trigger('scroll-body', _this16.$tableBody); 3479 }); 3480 } 3481 }, { 3482 key: "getVisibleFields", 3483 value: function getVisibleFields() { 3484 var visibleFields = []; 3485 var _iterator5 = _createForOfIteratorHelper(this.header.fields), 3486 _step5; 3487 try { 3488 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { 3489 var field = _step5.value; 3490 var column = this.columns[this.fieldsColumnsIndex[field]]; 3491 if (!column || !column.visible || this.options.cardView && !column.cardVisible) { 3492 continue; 3493 } 3494 visibleFields.push(field); 3495 } 3496 } catch (err) { 3497 _iterator5.e(err); 3498 } finally { 3499 _iterator5.f(); 3500 } 3501 return visibleFields; 3502 } 3503 }, { 3504 key: "initHiddenRows", 3505 value: function initHiddenRows() { 3506 this.hiddenRows = []; 3507 } 3508 3509 // PUBLIC FUNCTION DEFINITION 3510 // ======================= 3511 }, { 3512 key: "getOptions", 3513 value: function getOptions() { 3514 // deep copy and remove data 3515 var options = Utils.extend({}, this.options); 3516 delete options.data; 3517 return Utils.extend(true, {}, options); 3518 } 3519 }, { 3520 key: "refreshOptions", 3521 value: function refreshOptions(options) { 3522 // If the objects are equivalent then avoid the call of destroy / init methods 3523 if (Utils.compareObjects(this.options, options, true)) { 3524 return; 3525 } 3526 this.options = Utils.extend(this.options, options); 3527 this.trigger('refresh-options', this.options); 3528 this.destroy(); 3529 this.init(); 3530 } 3531 }, { 3532 key: "getData", 3533 value: function getData(params) { 3534 var _this17 = this; 3535 var data = this.options.data; 3536 if ((this.searchText || this.options.customSearch || this.options.sortName !== undefined || this.enableCustomSort || 3537 // Fix #4616: this.enableCustomSort is for extensions 3538 !Utils.isEmptyObject(this.filterColumns) || typeof this.options.filterOptions.filterAlgorithm === 'function' || !Utils.isEmptyObject(this.filterColumnsPartial)) && (!params || !params.unfiltered)) { 3539 data = this.data; 3540 } 3541 if (params && !params.includeHiddenRows) { 3542 var hiddenRows = this.getHiddenRows(); 3543 data = data.filter(function (row) { 3544 return Utils.findIndex(hiddenRows, row) === -1; 3545 }); 3546 } 3547 if (params && params.useCurrentPage) { 3548 data = data.slice(this.pageFrom - 1, this.pageTo); 3549 } 3550 if (params && params.formatted) { 3551 return data.map(function (row) { 3552 for (var _i15 = 0, _Object$entries14 = Object.entries(row); _i15 < _Object$entries14.length; _i15++) { 3553 var _Object$entries14$_i = _slicedToArray(_Object$entries14[_i15], 2), 3554 key = _Object$entries14$_i[0], 3555 value = _Object$entries14$_i[1]; 3556 var column = _this17.columns[_this17.fieldsColumnsIndex[key]]; 3557 if (!column) { 3558 continue; 3559 } 3560 return Utils.calculateObjectValue(column, _this17.header.formatters[column.fieldIndex], [value, row, row.index, column.field], value); 3561 } 3562 }); 3563 } 3564 return data; 3565 } 3566 }, { 3567 key: "getSelections", 3568 value: function getSelections() { 3569 var _this18 = this; 3570 return (this.options.maintainMetaData ? this.options.data : this.data).filter(function (row) { 3571 return row[_this18.header.stateField] === true; 3572 }); 3573 } 3574 }, { 3575 key: "load", 3576 value: function load(_data) { 3577 var fixedScroll = false; 3578 var data = _data; 3579 3580 // #431: support pagination 3581 if (this.options.pagination && this.options.sidePagination === 'server') { 3582 this.options.totalRows = data[this.options.totalField]; 3583 this.options.totalNotFiltered = data[this.options.totalNotFilteredField]; 3584 this.footerData = data[this.options.footerField] ? [data[this.options.footerField]] : undefined; 3585 } 3586 fixedScroll = this.options.fixedScroll || data.fixedScroll; 3587 data = Array.isArray(data) ? data : data[this.options.dataField]; 3588 this.initData(data); 3589 this.initSearch(); 3590 this.initPagination(); 3591 this.initBody(fixedScroll); 3592 } 3593 }, { 3594 key: "append", 3595 value: function append(data) { 3596 this.initData(data, 'append'); 3597 this.initSearch(); 3598 this.initPagination(); 3599 this.initSort(); 3600 this.initBody(true); 3601 } 3602 }, { 3603 key: "prepend", 3604 value: function prepend(data) { 3605 this.initData(data, 'prepend'); 3606 this.initSearch(); 3607 this.initPagination(); 3608 this.initSort(); 3609 this.initBody(true); 3610 } 3611 }, { 3612 key: "remove", 3613 value: function remove(params) { 3614 var removed = 0; 3615 for (var i = this.options.data.length - 1; i >= 0; i--) { 3616 var row = this.options.data[i]; 3617 var value = Utils.getItemField(row, params.field, this.options.escape, row.escape); 3618 if (value === undefined && params.field !== '$index') { 3619 continue; 3620 } 3621 if (!row.hasOwnProperty(params.field) && params.field === '$index' && params.values.includes(i) || params.values.includes(value)) { 3622 removed++; 3623 this.options.data.splice(i, 1); 3624 } 3625 } 3626 if (!removed) { 3627 return; 3628 } 3629 if (this.options.sidePagination === 'server') { 3630 this.options.totalRows -= removed; 3631 this.data = _toConsumableArray(this.options.data); 3632 } 3633 this.initSearch(); 3634 this.initPagination(); 3635 this.initSort(); 3636 this.initBody(true); 3637 } 3638 }, { 3639 key: "removeAll", 3640 value: function removeAll() { 3641 if (this.options.data.length > 0) { 3642 this.options.data.splice(0, this.options.data.length); 3643 this.initSearch(); 3644 this.initPagination(); 3645 this.initBody(true); 3646 } 3647 } 3648 }, { 3649 key: "insertRow", 3650 value: function insertRow(params) { 3651 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) { 3652 return; 3653 } 3654 this.options.data.splice(params.index, 0, params.row); 3655 this.initSearch(); 3656 this.initPagination(); 3657 this.initSort(); 3658 this.initBody(true); 3659 } 3660 }, { 3661 key: "updateRow", 3662 value: function updateRow(params) { 3663 var allParams = Array.isArray(params) ? params : [params]; 3664 var _iterator6 = _createForOfIteratorHelper(allParams), 3665 _step6; 3666 try { 3667 for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { 3668 var _params = _step6.value; 3669 if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) { 3670 continue; 3671 } 3672 if (_params.hasOwnProperty('replace') && _params.replace) { 3673 this.options.data[_params.index] = _params.row; 3674 } else { 3675 Utils.extend(this.options.data[_params.index], _params.row); 3676 } 3677 } 3678 } catch (err) { 3679 _iterator6.e(err); 3680 } finally { 3681 _iterator6.f(); 3682 } 3683 this.initSearch(); 3684 this.initPagination(); 3685 this.initSort(); 3686 this.initBody(true); 3687 } 3688 }, { 3689 key: "getRowByUniqueId", 3690 value: function getRowByUniqueId(_id) { 3691 var uniqueId = this.options.uniqueId; 3692 var len = this.options.data.length; 3693 var id = _id; 3694 var dataRow = null; 3695 var i; 3696 var row; 3697 for (i = len - 1; i >= 0; i--) { 3698 row = this.options.data[i]; 3699 var rowUniqueId = Utils.getItemField(row, uniqueId, this.options.escape, row.escape); 3700 if (rowUniqueId === undefined) { 3701 continue; 3702 } 3703 if (typeof rowUniqueId === 'string') { 3704 id = _id.toString(); 3705 } else if (typeof rowUniqueId === 'number') { 3706 if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) { 3707 id = parseInt(_id, 10); 3708 } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) { 3709 id = parseFloat(_id); 3710 } 3711 } 3712 if (rowUniqueId === id) { 3713 dataRow = row; 3714 break; 3715 } 3716 } 3717 return dataRow; 3718 } 3719 }, { 3720 key: "updateByUniqueId", 3721 value: function updateByUniqueId(params) { 3722 var allParams = Array.isArray(params) ? params : [params]; 3723 var updatedUid = null; 3724 var _iterator7 = _createForOfIteratorHelper(allParams), 3725 _step7; 3726 try { 3727 for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { 3728 var _params2 = _step7.value; 3729 if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) { 3730 continue; 3731 } 3732 var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id)); 3733 if (rowId === -1) { 3734 continue; 3735 } 3736 if (_params2.hasOwnProperty('replace') && _params2.replace) { 3737 this.options.data[rowId] = _params2.row; 3738 } else { 3739 Utils.extend(this.options.data[rowId], _params2.row); 3740 } 3741 updatedUid = _params2.id; 3742 } 3743 } catch (err) { 3744 _iterator7.e(err); 3745 } finally { 3746 _iterator7.f(); 3747 } 3748 this.initSearch(); 3749 this.initPagination(); 3750 this.initSort(); 3751 this.initBody(true, updatedUid); 3752 } 3753 }, { 3754 key: "removeByUniqueId", 3755 value: function removeByUniqueId(id) { 3756 var len = this.options.data.length; 3757 var row = this.getRowByUniqueId(id); 3758 if (row) { 3759 this.options.data.splice(this.options.data.indexOf(row), 1); 3760 } 3761 if (len === this.options.data.length) { 3762 return; 3763 } 3764 if (this.options.sidePagination === 'server') { 3765 this.options.totalRows -= 1; 3766 this.data = _toConsumableArray(this.options.data); 3767 } 3768 this.initSearch(); 3769 this.initPagination(); 3770 this.initBody(true); 3771 } 3772 }, { 3773 key: "_updateCellOnly", 3774 value: function _updateCellOnly(field, index) { 3775 var rowHtml = this.initRow(this.options.data[index], index); 3776 var fieldIndex = this.getVisibleFields().indexOf(field); 3777 if (fieldIndex === -1) { 3778 return; 3779 } 3780 fieldIndex += Utils.getDetailViewIndexOffset(this.options); 3781 this.$body.find(">tr[data-index=".concat(index, "]")).find(">td:eq(".concat(fieldIndex, ")")).replaceWith($(rowHtml).find(">td:eq(".concat(fieldIndex, ")"))); 3782 this.initBodyEvent(); 3783 this.initFooter(); 3784 this.resetView(); 3785 this.updateSelected(); 3786 } 3787 }, { 3788 key: "updateCell", 3789 value: function updateCell(params) { 3790 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) { 3791 return; 3792 } 3793 this.options.data[params.index][params.field] = params.value; 3794 if (params.reinit === false) { 3795 this._updateCellOnly(params.field, params.index); 3796 return; 3797 } 3798 this.initSort(); 3799 this.initBody(true); 3800 } 3801 }, { 3802 key: "updateCellByUniqueId", 3803 value: function updateCellByUniqueId(params) { 3804 var _this19 = this; 3805 var allParams = Array.isArray(params) ? params : [params]; 3806 allParams.forEach(function (_ref6) { 3807 var id = _ref6.id, 3808 field = _ref6.field, 3809 value = _ref6.value; 3810 var index = _this19.options.data.indexOf(_this19.getRowByUniqueId(id)); 3811 if (index === -1) { 3812 return; 3813 } 3814 _this19.options.data[index][field] = value; 3815 }); 3816 if (params.reinit === false) { 3817 this._updateCellOnly(params.field, this.options.data.indexOf(this.getRowByUniqueId(params.id))); 3818 return; 3819 } 3820 this.initSort(); 3821 this.initBody(true); 3822 } 3823 }, { 3824 key: "showRow", 3825 value: function showRow(params) { 3826 this._toggleRow(params, true); 3827 } 3828 }, { 3829 key: "hideRow", 3830 value: function hideRow(params) { 3831 this._toggleRow(params, false); 3832 } 3833 }, { 3834 key: "_toggleRow", 3835 value: function _toggleRow(params, visible) { 3836 var row; 3837 if (params.hasOwnProperty('index')) { 3838 row = this.getData()[params.index]; 3839 } else if (params.hasOwnProperty('uniqueId')) { 3840 row = this.getRowByUniqueId(params.uniqueId); 3841 } 3842 if (!row) { 3843 return; 3844 } 3845 var index = Utils.findIndex(this.hiddenRows, row); 3846 if (!visible && index === -1) { 3847 this.hiddenRows.push(row); 3848 } else if (visible && index > -1) { 3849 this.hiddenRows.splice(index, 1); 3850 } 3851 this.initBody(true); 3852 this.initPagination(); 3853 } 3854 }, { 3855 key: "getHiddenRows", 3856 value: function getHiddenRows(show) { 3857 if (show) { 3858 this.initHiddenRows(); 3859 this.initBody(true); 3860 this.initPagination(); 3861 return; 3862 } 3863 var data = this.getData(); 3864 var rows = []; 3865 var _iterator8 = _createForOfIteratorHelper(data), 3866 _step8; 3867 try { 3868 for (_iterator8.s();
3868 !(_step8 = _iterator8.n()).done;) { 3869 var row = _step8.value; 3870 if (this.hiddenRows.includes(row)) { 3871 rows.push(row); 3872 } 3873 } 3874 } catch (err) { 3875 _iterator8.e(err); 3876 } finally { 3877 _iterator8.f(); 3878 } 3879 this.hiddenRows = rows; 3880 return rows; 3881 } 3882 }, { 3883 key: "showColumn", 3884 value: function showColumn(field) { 3885 var _this20 = this; 3886 var fields = Array.isArray(field) ? field : [field]; 3887 fields.forEach(function (field) { 3888 _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true); 3889 }); 3890 } 3891 }, { 3892 key: "hideColumn", 3893 value: function hideColumn(field) { 3894 var _this21 = this; 3895 var fields = Array.isArray(field) ? field : [field]; 3896 fields.forEach(function (field) { 3897 _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true); 3898 }); 3899 } 3900 }, { 3901 key: "_toggleColumn", 3902 value: function _toggleColumn(index, checked, needUpdate) { 3903 if (index === undefined || this.columns[index].visible === checked) { 3904 return; 3905 } 3906 this.columns[index].visible = checked; 3907 this.initHeader(); 3908 this.initSearch(); 3909 this.initPagination(); 3910 this.initBody(); 3911 if (this.options.showColumns) { 3912 var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false); 3913 if (needUpdate) { 3914 $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked); 3915 } 3916 if ($items.filter(':checked').length <= this.options.minimumCountColumns) { 3917 $items.filter(':checked').prop('disabled', true); 3918 } 3919 } 3920 } 3921 }, { 3922 key: "getVisibleColumns", 3923 value: function getVisibleColumns() { 3924 var _this22 = this; 3925 return this.columns.filter(function (column) { 3926 return column.visible && !_this22.isSelectionColumn(column); 3927 }); 3928 } 3929 }, { 3930 key: "getHiddenColumns", 3931 value: function getHiddenColumns() { 3932 return this.columns.filter(function (_ref7) { 3933 var visible = _ref7.visible; 3934 return !visible; 3935 }); 3936 } 3937 }, { 3938 key: "isSelectionColumn", 3939 value: function isSelectionColumn(column) { 3940 return column.radio || column.checkbox; 3941 } 3942 }, { 3943 key: "showAllColumns", 3944 value: function showAllColumns() { 3945 this._toggleAllColumns(true); 3946 } 3947 }, { 3948 key: "hideAllColumns", 3949 value: function hideAllColumns() { 3950 this._toggleAllColumns(false); 3951 } 3952 }, { 3953 key: "_toggleAllColumns", 3954 value: function _toggleAllColumns(visible) { 3955 var _this23 = this; 3956 var _iterator9 = _createForOfIteratorHelper(this.columns.slice().reverse()), 3957 _step9; 3958 try { 3959 for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { 3960 var column = _step9.value; 3961 if (column.switchable) { 3962 if (!visible && this.options.showColumns && this.getVisibleColumns().filter(function (it) { 3963 return it.switchable; 3964 }).length === this.options.minimumCountColumns) { 3965 continue; 3966 } 3967 column.visible = visible; 3968 } 3969 } 3970 } catch (err) { 3971 _iterator9.e(err); 3972 } finally { 3973 _iterator9.f(); 3974 } 3975 this.initHeader(); 3976 this.initSearch(); 3977 this.initPagination(); 3978 this.initBody(); 3979 if (this.options.showColumns) { 3980 var $items = this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop('disabled', false); 3981 if (visible) { 3982 $items.prop('checked', visible); 3983 } else { 3984 $items.get().reverse().forEach(function (item) { 3985 if ($items.filter(':checked').length > _this23.options.minimumCountColumns) { 3986 $(item).prop('checked', visible); 3987 } 3988 }); 3989 } 3990 if ($items.filter(':checked').length <= this.options.minimumCountColumns) { 3991 $items.filter(':checked').prop('disabled', true); 3992 } 3993 } 3994 } 3995 }, { 3996 key: "mergeCells", 3997 value: function mergeCells(options) { 3998 var row = options.index; 3999 var col = this.getVisibleFields().indexOf(options.field); 4000 var rowspan = options.rowspan || 1; 4001 var colspan = options.colspan || 1; 4002 var i; 4003 var j; 4004 var $tr = this.$body.find('>tr[data-index]');
vendor: 20,563 bytes, lines 4005-4526
4005 col += Utils.getDetailViewIndexOffset(this.options); 4006 var $td = $tr.eq(row).find('>td').eq(col); 4007 if (row < 0 || col < 0 || row >= this.data.length) { 4008 return; 4009 } 4010 for (i = row; i < row + rowspan; i++) { 4011 for (j = col; j < col + colspan; j++) { 4012 $tr.eq(i).find('>td').eq(j).hide(); 4013 } 4014 } 4015 $td.attr('rowspan', rowspan).attr('colspan', colspan).show(); 4016 } 4017 }, { 4018 key: "checkAll", 4019 value: function checkAll() { 4020 this._toggleCheckAll(true); 4021 } 4022 }, { 4023 key: "uncheckAll", 4024 value: function uncheckAll() { 4025 this._toggleCheckAll(false); 4026 } 4027 }, { 4028 key: "_toggleCheckAll", 4029 value: function _toggleCheckAll(checked) { 4030 var rowsBefore = this.getSelections(); 4031 this.$selectAll.add(this.$selectAll_).prop('checked', checked); 4032 this.$selectItem.filter(':enabled').prop('checked', checked); 4033 this.updateRows(); 4034 this.updateSelected(); 4035 var rowsAfter = this.getSelections(); 4036 if (checked) { 4037 this.trigger('check-all', rowsAfter, rowsBefore); 4038 return; 4039 } 4040 this.trigger('uncheck-all', rowsAfter, rowsBefore); 4041 } 4042 }, { 4043 key: "checkInvert", 4044 value: function checkInvert() { 4045 var $items = this.$selectItem.filter(':enabled'); 4046 var checked = $items.filter(':checked'); 4047 $items.each(function (i, el) { 4048 $(el).prop('checked', !$(el).prop('checked')); 4049 }); 4050 this.updateRows(); 4051 this.updateSelected(); 4052 this.trigger('uncheck-some', checked); 4053 checked = this.getSelections(); 4054 this.trigger('check-some', checked); 4055 } 4056 }, { 4057 key: "check", 4058 value: function check(index) { 4059 this._toggleCheck(true, index); 4060 } 4061 }, { 4062 key: "uncheck", 4063 value: function uncheck(index) { 4064 this._toggleCheck(false, index); 4065 } 4066 }, { 4067 key: "_toggleCheck", 4068 value: function _toggleCheck(checked, index) { 4069 var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]")); 4070 var row = this.data[index]; 4071 if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) { 4072 var _iterator10 = _createForOfIteratorHelper(this.options.data), 4073 _step10; 4074 try { 4075 for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { 4076 var r = _step10.value; 4077 r[this.header.stateField] = false; 4078 } 4079 } catch (err) { 4080 _iterator10.e(err); 4081 } finally { 4082 _iterator10.f(); 4083 } 4084 this.$selectItem.filter(':checked').not($el).prop('checked', false); 4085 } 4086 row[this.header.stateField] = checked; 4087 if (this.options.multipleSelectRow) { 4088 if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) { 4089 var _ref8 = this.multipleSelectRowLastSelectedIndex < index ? [this.multipleSelectRowLastSelectedIndex, index] : [index, this.multipleSelectRowLastSelectedIndex], 4090 _ref9 = _slicedToArray(_ref8, 2), 4091 fromIndex = _ref9[0], 4092 toIndex = _ref9[1]; 4093 for (var i = fromIndex + 1; i < toIndex; i++) { 4094 this.data[i][this.header.stateField] = true; 4095 this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true); 4096 } 4097 } 4098 this.multipleSelectRowCtrlKey = false; 4099 this.multipleSelectRowShiftKey = false; 4100 this.multipleSelectRowLastSelectedIndex = checked ? index : -1; 4101 } 4102 $el.prop('checked', checked); 4103 this.updateSelected(); 4104 this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el); 4105 } 4106 }, { 4107 key: "checkBy", 4108 value: function checkBy(obj) { 4109 this._toggleCheckBy(true, obj); 4110 } 4111 }, { 4112 key: "uncheckBy", 4113 value: function uncheckBy(obj) { 4114 this._toggleCheckBy(false, obj); 4115 } 4116 }, { 4117 key: "_toggleCheckBy", 4118 value: function _toggleCheckBy(checked, obj) { 4119 var _this24 = this; 4120 if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) { 4121 return; 4122 } 4123 var rows = []; 4124 this.data.forEach(function (row, i) { 4125 if (!row.hasOwnProperty(obj.field)) { 4126 return false; 4127 } 4128 if (obj.values.includes(row[obj.field])) { 4129 var $el = _this24.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i)); 4130 var onlyCurrentPage = obj.hasOwnProperty('onlyCurrentPage') ? obj.onlyCurrentPage : false; 4131 $el = checked ? $el.not(':checked') : $el.filter(':checked'); 4132 if (!$el.length && onlyCurrentPage) { 4133 return; 4134 } 4135 $el.prop('checked', checked); 4136 row[_this24.header.stateField] = checked; 4137 rows.push(row); 4138 _this24.trigger(checked ? 'check' : 'uncheck', row, $el); 4139 } 4140 }); 4141 this.updateSelected(); 4142 this.trigger(checked ? 'check-some' : 'uncheck-some', rows); 4143 } 4144 }, { 4145 key: "refresh", 4146 value: function refresh(params) { 4147 if (params && params.url) { 4148 this.options.url = params.url; 4149 } 4150 if (params && params.pageNumber) { 4151 this.options.pageNumber = params.pageNumber; 4152 } 4153 if (params && params.pageSize) { 4154 this.options.pageSize = params.pageSize; 4155 } 4156 this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url)); 4157 } 4158 }, { 4159 key: "destroy", 4160 value: function destroy() { 4161 this.$el.insertBefore(this.$container); 4162 $(this.options.toolbar).insertBefore(this.$el); 4163 this.$container.next().remove(); 4164 this.$container.remove(); 4165 this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class 4166 4167 var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id')); 4168 $(window).off(resizeEvent); 4169 } 4170 }, { 4171 key: "resetView", 4172 value: function resetView(params) { 4173 var padding = 0; 4174 if (params && params.height) { 4175 this.options.height = params.height; 4176 } 4177 this.$tableContainer.toggleClass('has-card-view', this.options.cardView); 4178 if (this.options.height) { 4179 var fixedBody = this.$tableBody.get(0); 4180 this.hasScrollBar = fixedBody.scrollWidth > fixedBody.clientWidth; 4181 } 4182 if (!this.options.cardView && this.options.showHeader && this.options.height) { 4183 this.$tableHeader.show(); 4184 this.resetHeader(); 4185 padding += this.$header.outerHeight(true) + 1; 4186 } else { 4187 this.$tableHeader.hide(); 4188 this.trigger('post-header'); 4189 } 4190 if (!this.options.cardView && this.options.showFooter) { 4191 this.$tableFooter.show(); 4192 this.fitFooter(); 4193 if (this.options.height) { 4194 padding += this.$tableFooter.outerHeight(true); 4195 } 4196 } 4197 if (this.$container.hasClass('fullscreen')) { 4198 this.$tableContainer.css('height', ''); 4199 this.$tableContainer.css('width', ''); 4200 } else if (this.options.height) { 4201 if (this.$tableBorder) { 4202 this.$tableBorder.css('width', ''); 4203 this.$tableBorder.css('height', ''); 4204 } 4205 var toolbarHeight = this.$toolbar.outerHeight(true); 4206 var paginationHeight = this.$pagination.outerHeight(true); 4207 var height = this.options.height - toolbarHeight - paginationHeight; 4208 var $bodyTable = this.$tableBody.find('>table'); 4209 var tableHeight = $bodyTable.outerHeight(); 4210 this.$tableContainer.css('height', "".concat(height, "px")); 4211 if (this.$tableBorder && $bodyTable.is(':visible')) { 4212 var tableBorderHeight = height - tableHeight - 2; 4213 if (this.hasScrollBar) { 4214 tableBorderHeight -= Utils.getScrollBarWidth(); 4215 } 4216 this.$tableBorder.css('width', "".concat($bodyTable.outerWidth(), "px")); 4217 this.$tableBorder.css('height', "".concat(tableBorderHeight, "px")); 4218 } 4219 } 4220 if (this.options.cardView) { 4221 // remove the element css 4222 this.$el.css('margin-top', '0'); 4223 this.$tableContainer.css('padding-bottom', '0'); 4224 this.$tableFooter.hide(); 4225 } else { 4226 // Assign the correct sortable arrow 4227 this.getCaret(); 4228 this.$tableContainer.css('padding-bottom', "".concat(padding, "px")); 4229 } 4230 this.trigger('reset-view'); 4231 } 4232 }, { 4233 key: "showLoading", 4234 value: function showLoading() { 4235 this.$tableLoading.toggleClass('open', true); 4236 var fontSize = this.options.loadingFontSize; 4237 if (this.options.loadingFontSize === 'auto') { 4238 fontSize = this.$tableLoading.width() * 0.04; 4239 fontSize = Math.max(12, fontSize); 4240 fontSize = Math.min(32, fontSize); 4241 fontSize = "".concat(Math.round((fontSize / 16) * 10000) / 10000, "rem"); 4242 } 4243 this.$tableLoading.find('.loading-text').css('font-size', fontSize); 4244 } 4245 }, { 4246 key: "hideLoading", 4247 value: function hideLoading() { 4248 this.$tableLoading.toggleClass('open', false); 4249 } 4250 }, { 4251 key: "togglePagination", 4252 value: function togglePagination() { 4253 this.options.pagination = !this.options.pagination; 4254 var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : ''; 4255 var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : ''; 4256 this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text)); 4257 this.updatePagination(); 4258 this.trigger('toggle-pagination', this.options.pagination); 4259 } 4260 }, { 4261 key: "toggleFullscreen", 4262 value: function toggleFullscreen() { 4263 this.$el.closest('.bootstrap-table').toggleClass('fullscreen'); 4264 this.resetView(); 4265 } 4266 }, { 4267 key: "toggleView", 4268 value: function toggleView() { 4269 this.options.cardView = !this.options.cardView; 4270 this.initHeader(); 4271 var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : ''; 4272 var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : ''; 4273 this.$toolbar.find('button[name="toggle"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text)).attr('aria-label', text).attr('title', text); 4274 this.initBody(); 4275 this.trigger('toggle', this.options.cardView); 4276 } 4277 }, { 4278 key: "resetSearch", 4279 value: function resetSearch(text) { 4280 var $search = Utils.getSearchInput(this); 4281 var textToUse = text || ''; 4282 $search.val(textToUse); 4283 this.searchText = textToUse; 4284 this.onSearch({ 4285 currentTarget: $search 4286 }, false); 4287 } 4288 }, { 4289 key: "filterBy", 4290 value: function filterBy(columns, options) { 4291 this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : Utils.extend(this.options.filterOptions, options); 4292 this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns; 4293 this.options.pageNumber = 1; 4294 this.initSearch(); 4295 this.updatePagination(); 4296 } 4297 }, { 4298 key: "scrollTo", 4299 value: function scrollTo(params) { 4300 var options = { 4301 unit: 'px', 4302 value: 0 4303 }; 4304 if (_typeof(params) === 'object') { 4305 options = Object.assign(options, params); 4306 } else if (typeof params === 'string' && params === 'bottom') { 4307 options.value = this.$tableBody[0].scrollHeight; 4308 } else if (typeof params === 'string' || typeof params === 'number') { 4309 options.value = params; 4310 } 4311 var scrollTo = options.value; 4312 if (options.unit === 'rows') { 4313 scrollTo = 0; 4314 this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) { 4315 scrollTo += $(el).outerHeight(true); 4316 }); 4317 } 4318 this.$tableBody.scrollTop(scrollTo); 4319 } 4320 }, { 4321 key: "getScrollPosition", 4322 value: function getScrollPosition() { 4323 return this.$tableBody.scrollTop(); 4324 } 4325 }, { 4326 key: "selectPage", 4327 value: function selectPage(page) { 4328 if (page > 0 && page <= this.options.totalPages) { 4329 this.options.pageNumber = page; 4330 this.updatePagination(); 4331 } 4332 } 4333 }, { 4334 key: "prevPage", 4335 value: function prevPage() { 4336 if (this.options.pageNumber > 1) { 4337 this.options.pageNumber--; 4338 this.updatePagination(); 4339 } 4340 } 4341 }, { 4342 key: "nextPage", 4343 value: function nextPage() { 4344 if (this.options.pageNumber < this.options.totalPages) { 4345 this.options.pageNumber++; 4346 this.updatePagination(); 4347 } 4348 } 4349 }, { 4350 key: "toggleDetailView", 4351 value: function toggleDetailView(index, _columnDetailFormatter) { 4352 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index)); 4353 if ($tr.next().is('tr.detail-view')) { 4354 this.collapseRow(index); 4355 } else { 4356 this.expandRow(index, _columnDetailFormatter); 4357 } 4358 this.resetView(); 4359 } 4360 }, { 4361 key: "expandRow", 4362 value: function expandRow(index, _columnDetailFormatter) { 4363 var row = this.data[index]; 4364 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index)); 4365 if (this.options.detailViewIcon) { 4366 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose)); 4367 } 4368 if ($tr.next().is('tr.detail-view')) { 4369 return; 4370 } 4371 $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length)); 4372 var $element = $tr.next().find('td'); 4373 var detailFormatter = _columnDetailFormatter || this.options.detailFormatter; 4374 var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], ''); 4375 if ($element.length === 1) { 4376 $element.append(content); 4377 } 4378 this.trigger('expand-row', index, row, $element); 4379 } 4380 }, { 4381 key: "expandRowByUniqueId", 4382 value: function expandRowByUniqueId(uniqueId) { 4383 var row = this.getRowByUniqueId(uniqueId); 4384 if (!row) { 4385 return; 4386 } 4387 this.expandRow(this.data.indexOf(row)); 4388 } 4389 }, { 4390 key: "collapseRow", 4391 value: function collapseRow(index) { 4392 var row = this.data[index]; 4393 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index)); 4394 if (!$tr.next().is('tr.detail-view')) { 4395 return; 4396 } 4397 if (this.options.detailViewIcon) { 4398 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen)); 4399 } 4400 this.trigger('collapse-row', index, row, $tr.next()); 4401 $tr.next().remove(); 4402 } 4403 }, { 4404 key: "collapseRowByUniqueId", 4405 value: function collapseRowByUniqueId(uniqueId) { 4406 var row = this.getRowByUniqueId(uniqueId); 4407 if (!row) { 4408 return; 4409 } 4410 this.collapseRow(this.data.indexOf(row)); 4411 } 4412 }, { 4413 key: "expandAllRows", 4414 value: function expandAllRows() { 4415 var trs = this.$body.find('> tr[data-index][data-has-detail-view]'); 4416 for (var i = 0; i < trs.length; i++) { 4417 this.expandRow($(trs[i]).data('index')); 4418 } 4419 } 4420 }, { 4421 key: "collapseAllRows", 4422 value: function collapseAllRows() { 4423 var trs = this.$body.find('> tr[data-index][data-has-detail-view]'); 4424 for (var i = 0; i < trs.length; i++) { 4425 this.collapseRow($(trs[i]).data('index')); 4426 } 4427 } 4428 }, { 4429 key: "updateColumnTitle", 4430 value: function updateColumnTitle(params) { 4431 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) { 4432 return; 4433 } 4434 this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape && this.options.escapeTitle ? Utils.escapeHTML(params.title) : params.title; 4435 if (this.columns[this.fieldsColumnsIndex[params.field]].visible) { 4436 this.$header.find('th[data-field]').each(function (i, el) { 4437 if ($(el).data('field') === params.field) { 4438 $($(el).find('.th-inner')[0]).html(params.title); 4439 return false; 4440 } 4441 }); 4442 this.resetView(); 4443 } 4444 } 4445 }, { 4446 key: "updateFormatText", 4447 value: function updateFormatText(formatName, text) { 4448 if (!/^format/.test(formatName) || !this.options[formatName]) { 4449 return; 4450 } 4451 if (typeof text === 'string') { 4452 this.options[formatName] = function () { 4453 return text; 4454 }; 4455 } else if (typeof text === 'function') { 4456 this.options[formatName] = text; 4457 } 4458 this.initToolbar(); 4459 this.initPagination(); 4460 this.initBody(); 4461 } 4462 }]); 4463 }(); 4464 BootstrapTable.VERSION = Constants.VERSION; 4465 BootstrapTable.DEFAULTS = Constants.DEFAULTS; 4466 BootstrapTable.LOCALES = Constants.LOCALES; 4467 BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS; 4468 BootstrapTable.METHODS = Constants.METHODS; 4469 BootstrapTable.EVENTS = Constants.EVENTS; 4470 4471 // BOOTSTRAP TABLE PLUGIN DEFINITION 4472 // ======================= 4473 4474 $.BootstrapTable = BootstrapTable; 4475 $.fn.bootstrapTable = function (option) { 4476 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key5 = 1; _key5 < _len2; _key5++) { 4477 args[_key5 - 1] = arguments[_key5]; 4478 } 4479 var value; 4480 this.each(function (i, el) { 4481 var data = $(el).data('bootstrap.table'); 4482 if (typeof option === 'string') { 4483 var _data2; 4484 if (!Constants.METHODS.includes(option)) { 4485 throw new Error("Unknown method: ".concat(option)); 4486 } 4487 if (!data) { 4488 return; 4489 } 4490 value = (_data2 = data)[option].apply(_data2, args); 4491 if (option === 'destroy') { 4492 $(el).removeData('bootstrap.table'); 4493 } 4494 return; 4495 } 4496 if (data) { 4497 console.warn('You cannot initialize the table more than once!'); 4498 return; 4499 } 4500 var options = Utils.extend(true, {}, BootstrapTable.DEFAULTS, $(el).data(), _typeof(option) === 'object' && option); 4501 data = new $.BootstrapTable(el, options); 4502 $(el).data('bootstrap.table', data); 4503 data.init(); 4504 }); 4505 return typeof value === 'undefined' ? this : value; 4506 }; 4507 $.fn.bootstrapTable.Constructor = BootstrapTable; 4508 $.fn.bootstrapTable.theme = Constants.THEME; 4509 $.fn.bootstrapTable.VERSION = Constants.VERSION; 4510 $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS; 4511 $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS; 4512 $.fn.bootstrapTable.events = BootstrapTable.EVENTS; 4513 $.fn.bootstrapTable.locales = BootstrapTable.LOCALES; 4514 $.fn.bootstrapTable.methods = BootstrapTable.METHODS; 4515 $.fn.bootstrapTable.utils = Utils; 4516 4517 // BOOTSTRAP TABLE INIT 4518 // ======================= 4519 4520 $(function () { 4521 $('[data-toggle="table"]').bootstrapTable(); 4522 }); 4523 4524 return BootstrapTable; 4525 4526}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.