2779 lines
169 KiB
JavaScript
2779 lines
169 KiB
JavaScript
/**
|
|
* bootstrap-table - An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)
|
|
*
|
|
* @version v1.23.1
|
|
* @homepage https://bootstrap-table.com
|
|
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
|
|
* @license MIT
|
|
*/
|
|
|
|
! function(t, e) {
|
|
"object" == typeof exports && "undefined" != typeof module ? module.exports = e(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")) : "function" == typeof define && 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"], e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).BootstrapTable = e(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, t.jQuery)
|
|
}(this, (function(t, e, i, o, s, n, a, r, l, c, h, d, u, p, f, g, v, m, b, y, w, S, x, k, j, C, O, P, T, $, A, I) {
|
|
"use strict";
|
|
|
|
function R(t, e) {
|
|
(null == e || e > t.length) && (e = t.length);
|
|
for (var i = 0, o = Array(e); i < e; i++) o[i] = t[i];
|
|
return o
|
|
}
|
|
|
|
function _(t, e) {
|
|
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
|
}
|
|
|
|
function D(t, e, i) {
|
|
return e && function(t, e) {
|
|
for (var i = 0; i < e.length; i++) {
|
|
var o = e[i];
|
|
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(t, N(o.key), o)
|
|
}
|
|
}(t.prototype, e), Object.defineProperty(t, "prototype", {
|
|
writable: !1
|
|
}), t
|
|
}
|
|
|
|
function V(t, e) {
|
|
var i = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
if (!i) {
|
|
if (Array.isArray(t) || (i = H(t)) || e) {
|
|
i && (t = i);
|
|
var o = 0,
|
|
s = function() {};
|
|
return {
|
|
s: s,
|
|
n: function() {
|
|
return o >= t.length ? {
|
|
done: !0
|
|
} : {
|
|
done: !1,
|
|
value: t[o++]
|
|
}
|
|
},
|
|
e: function(t) {
|
|
throw t
|
|
},
|
|
f: s
|
|
}
|
|
}
|
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
|
|
}
|
|
var n, a = !0,
|
|
r = !1;
|
|
return {
|
|
s: function() {
|
|
i = i.call(t)
|
|
},
|
|
n: function() {
|
|
var t = i.next();
|
|
return a = t.done, t
|
|
},
|
|
e: function(t) {
|
|
r = !0, n = t
|
|
},
|
|
f: function() {
|
|
try {
|
|
a || null == i.return || i.return()
|
|
} finally {
|
|
if (r) throw n
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function B(t, e) {
|
|
return function(t) {
|
|
if (Array.isArray(t)) return t
|
|
}(t) || function(t, e) {
|
|
var i = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
|
|
if (null != i) {
|
|
var o, s, n, a, r = [],
|
|
l = !0,
|
|
c = !1;
|
|
try {
|
|
if (n = (i = i.call(t)).next, 0 === e);
|
|
else
|
|
for (; !(l = (o = n.call(i)).done) && (r.push(o.value), r.length !== e); l = !0);
|
|
} catch (t) {
|
|
c = !0, s = t
|
|
} finally {
|
|
try {
|
|
if (!l && null != i.return && (a = i.return(), Object(a) !== a)) return
|
|
} finally {
|
|
if (c) throw s
|
|
}
|
|
}
|
|
return r
|
|
}
|
|
}(t, e) || H(t, e) || function() {
|
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
|
|
}()
|
|
}
|
|
|
|
function F(t) {
|
|
return function(t) {
|
|
if (Array.isArray(t)) return R(t)
|
|
}(t) || function(t) {
|
|
if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t)
|
|
}(t) || H(t) || function() {
|
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
|
|
}()
|
|
}
|
|
|
|
function N(t) {
|
|
var e = function(t, e) {
|
|
if ("object" != typeof t || !t) return t;
|
|
var i = t[Symbol.toPrimitive];
|
|
if (void 0 !== i) {
|
|
var o = i.call(t, e);
|
|
if ("object" != typeof o) return o;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.")
|
|
}
|
|
return String(t)
|
|
}(t, "string");
|
|
return "symbol" == typeof e ? e : e + ""
|
|
}
|
|
|
|
function E(t) {
|
|
return E = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
return typeof t
|
|
} : function(t) {
|
|
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
|
|
}, E(t)
|
|
}
|
|
|
|
function H(t, e) {
|
|
if (t) {
|
|
if ("string" == typeof t) return R(t, e);
|
|
var i = {}.toString.call(t).slice(8, -1);
|
|
return "Object" === i && t.constructor && (i = t.constructor.name), "Map" === i || "Set" === i ? Array.from(t) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? R(t, e) : void 0
|
|
}
|
|
}
|
|
var L = {
|
|
getBootstrapVersion: function() {
|
|
var t = 5;
|
|
try {
|
|
var e = I.fn.dropdown.Constructor.VERSION;
|
|
void 0 !== e && (t = parseInt(e, 10))
|
|
} catch (t) {}
|
|
try {
|
|
var i = bootstrap.Tooltip.VERSION;
|
|
void 0 !== i && (t = parseInt(i, 10))
|
|
} catch (t) {}
|
|
return t
|
|
},
|
|
getIconsPrefix: function(t) {
|
|
return {
|
|
bootstrap3: "glyphicon",
|
|
bootstrap4: "fa",
|
|
bootstrap5: "bi",
|
|
"bootstrap-table": "icon",
|
|
bulma: "fa",
|
|
foundation: "fa",
|
|
materialize: "material-icons",
|
|
semantic: "fa"
|
|
}[t] || "fa"
|
|
},
|
|
getIcons: function(t) {
|
|
return {
|
|
glyphicon: {
|
|
paginationSwitchDown: "glyphicon-collapse-down icon-chevron-down",
|
|
paginationSwitchUp: "glyphicon-collapse-up icon-chevron-up",
|
|
refresh: "glyphicon-refresh icon-refresh",
|
|
toggleOff: "glyphicon-list-alt icon-list-alt",
|
|
toggleOn: "glyphicon-list-alt icon-list-alt",
|
|
columns: "glyphicon-th icon-th",
|
|
detailOpen: "glyphicon-plus icon-plus",
|
|
detailClose: "glyphicon-minus icon-minus",
|
|
fullscreen: "glyphicon-fullscreen",
|
|
search: "glyphicon-search",
|
|
clearSearch: "glyphicon-trash"
|
|
},
|
|
fa: {
|
|
paginationSwitchDown: "fa-caret-square-down",
|
|
paginationSwitchUp: "fa-caret-square-up",
|
|
refresh: "fa-sync",
|
|
toggleOff: "fa-toggle-off",
|
|
toggleOn: "fa-toggle-on",
|
|
columns: "fa-th-list",
|
|
detailOpen: "fa-plus",
|
|
detailClose: "fa-minus",
|
|
fullscreen: "fa-arrows-alt",
|
|
search: "fa-search",
|
|
clearSearch: "fa-trash"
|
|
},
|
|
bi: {
|
|
paginationSwitchDown: "bi-caret-down-square",
|
|
paginationSwitchUp: "bi-caret-up-square",
|
|
refresh: "bi-arrow-clockwise",
|
|
toggleOff: "bi-toggle-off",
|
|
toggleOn: "bi-toggle-on",
|
|
columns: "bi-list-ul",
|
|
detailOpen: "bi-plus",
|
|
detailClose: "bi-dash",
|
|
fullscreen: "bi-arrows-move",
|
|
search: "bi-search",
|
|
clearSearch: "bi-trash"
|
|
},
|
|
icon: {
|
|
paginationSwitchDown: "icon-arrow-up-circle",
|
|
paginationSwitchUp: "icon-arrow-down-circle",
|
|
refresh: "icon-refresh-cw",
|
|
toggleOff: "icon-toggle-right",
|
|
toggleOn: "icon-toggle-right",
|
|
columns: "icon-list",
|
|
detailOpen: "icon-plus",
|
|
detailClose: "icon-minus",
|
|
fullscreen: "icon-maximize",
|
|
search: "icon-search",
|
|
clearSearch: "icon-trash-2"
|
|
},
|
|
"material-icons": {
|
|
paginationSwitchDown: "grid_on",
|
|
paginationSwitchUp: "grid_off",
|
|
refresh: "refresh",
|
|
toggleOff: "tablet",
|
|
toggleOn: "tablet_android",
|
|
columns: "view_list",
|
|
detailOpen: "add",
|
|
detailClose: "remove",
|
|
fullscreen: "fullscreen",
|
|
sort: "sort",
|
|
search: "search",
|
|
clearSearch: "delete"
|
|
}
|
|
}[t] || {}
|
|
},
|
|
getSearchInput: function(t) {
|
|
return "string" == typeof t.options.searchSelector ? I(t.options.searchSelector) : t.$toolbar.find(".search input")
|
|
},
|
|
extend: function() {
|
|
for (var t = this, e = arguments.length, i = new Array(e), o = 0; o < e; o++) i[o] = arguments[o];
|
|
var s, n = i[0] || {},
|
|
a = 1,
|
|
r = !1;
|
|
for ("boolean" == typeof n && (r = n, n = i[a] || {}, a++), "object" !== E(n) && "function" != typeof n && (n = {}); a < i.length; a++) {
|
|
var l = i[a];
|
|
if (null != l)
|
|
for (var c in l) {
|
|
var h = l[c];
|
|
if ("__proto__" !== c && n !== h) {
|
|
var d = Array.isArray(h);
|
|
if (r && h && (this.isObject(h) || d)) {
|
|
var u = n[c];
|
|
if (d && Array.isArray(u) && u.every((function(e) {
|
|
return !t.isObject(e) && !Array.isArray(e)
|
|
}))) {
|
|
n[c] = h;
|
|
continue
|
|
}
|
|
s = d && !Array.isArray(u) ? [] : d || this.isObject(u) ? u : {}, n[c] = this.extend(r, s, h)
|
|
} else void 0 !== h && (n[c] = h)
|
|
}
|
|
}
|
|
}
|
|
return n
|
|
},
|
|
sprintf: function(t) {
|
|
for (var e = arguments.length, i = new Array(e > 1 ? e - 1 : 0), o = 1; o < e; o++) i[o - 1] = arguments[o];
|
|
var s = !0,
|
|
n = 0,
|
|
a = t.replace(/%s/g, (function() {
|
|
var t = i[n++];
|
|
return void 0 === t ? (s = !1, "") : t
|
|
}));
|
|
return s ? a : ""
|
|
},
|
|
isObject: function(t) {
|
|
if ("object" !== E(t) || null === t) return !1;
|
|
for (var e = t; null !== Object.getPrototypeOf(e);) e = Object.getPrototypeOf(e);
|
|
return Object.getPrototypeOf(t) === e
|
|
},
|
|
isEmptyObject: function() {
|
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
return 0 === Object.entries(t).length && t.constructor === Object
|
|
},
|
|
isNumeric: function(t) {
|
|
return !isNaN(parseFloat(t)) && isFinite(t)
|
|
},
|
|
getFieldTitle: function(t, e) {
|
|
var i, o = V(t);
|
|
try {
|
|
for (o.s(); !(i = o.n()).done;) {
|
|
var s = i.value;
|
|
if (s.field === e) return s.title
|
|
}
|
|
} catch (t) {
|
|
o.e(t)
|
|
} finally {
|
|
o.f()
|
|
}
|
|
return ""
|
|
},
|
|
setFieldIndex: function(t) {
|
|
var e, i = 0,
|
|
o = [],
|
|
s = V(t[0]);
|
|
try {
|
|
for (s.s(); !(e = s.n()).done;) {
|
|
i += e.value.colspan || 1
|
|
}
|
|
} catch (t) {
|
|
s.e(t)
|
|
} finally {
|
|
s.f()
|
|
}
|
|
for (var n = 0; n < t.length; n++) {
|
|
o[n] = [];
|
|
for (var a = 0; a < i; a++) o[n][a] = !1
|
|
}
|
|
for (var r = 0; r < t.length; r++) {
|
|
var l, c = V(t[r]);
|
|
try {
|
|
for (c.s(); !(l = c.n()).done;) {
|
|
var h = l.value,
|
|
d = h.rowspan || 1,
|
|
u = h.colspan || 1,
|
|
p = o[r].indexOf(!1);
|
|
h.colspanIndex = p, 1 === u ? (h.fieldIndex = p, void 0 === h.field && (h.field = p)) : h.colspanGroup = h.colspan;
|
|
for (var f = 0; f < d; f++)
|
|
for (var g = 0; g < u; g++) o[r + f][p + g] = !0
|
|
}
|
|
} catch (t) {
|
|
c.e(t)
|
|
} finally {
|
|
c.f()
|
|
}
|
|
}
|
|
},
|
|
normalizeAccent: function(t) {
|
|
return "string" != typeof t ? t : t.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
|
|
},
|
|
updateFieldGroup: function(t, e) {
|
|
var i, o, s = (i = []).concat.apply(i, F(t)),
|
|
n = V(t);
|
|
try {
|
|
for (n.s(); !(o = n.n()).done;) {
|
|
var a, r = V(o.value);
|
|
try {
|
|
for (r.s(); !(a = r.n()).done;) {
|
|
var l = a.value;
|
|
if (l.colspanGroup > 1) {
|
|
for (var c = 0, h = function(t) {
|
|
var e = s.filter((function(e) {
|
|
return e.fieldIndex === t
|
|
})),
|
|
i = e[e.length - 1];
|
|
if (e.length > 1)
|
|
for (var o = 0; o < e.length - 1; o++) e[o].visible = i.visible;
|
|
i.visible && c++
|
|
}, d = l.colspanIndex; d < l.colspanIndex + l.colspanGroup; d++) h(d);
|
|
l.colspan = c, l.visible = c > 0
|
|
}
|
|
}
|
|
} catch (t) {
|
|
r.e(t)
|
|
} finally {
|
|
r.f()
|
|
}
|
|
}
|
|
} catch (t) {
|
|
n.e(t)
|
|
} finally {
|
|
n.f()
|
|
}
|
|
if (!(t.length < 2)) {
|
|
var u, p = V(e);
|
|
try {
|
|
var f = function() {
|
|
var t = u.value,
|
|
e = s.filter((function(e) {
|
|
return e.fieldIndex === t.fieldIndex
|
|
}));
|
|
if (e.length > 1) {
|
|
var i, o = V(e);
|
|
try {
|
|
for (o.s(); !(i = o.n()).done;) {
|
|
i.value.visible = t.visible
|
|
}
|
|
} catch (t) {
|
|
o.e(t)
|
|
} finally {
|
|
o.f()
|
|
}
|
|
}
|
|
};
|
|
for (p.s(); !(u = p.n()).done;) f()
|
|
} catch (t) {
|
|
p.e(t)
|
|
} finally {
|
|
p.f()
|
|
}
|
|
}
|
|
},
|
|
getScrollBarWidth: function() {
|
|
if (void 0 === this.cachedWidth) {
|
|
var t = I("<div/>").addClass("fixed-table-scroll-inner"),
|
|
e = I("<div/>").addClass("fixed-table-scroll-outer");
|
|
e.append(t), I("body").append(e);
|
|
var i = t[0].offsetWidth;
|
|
e.css("overflow", "scroll");
|
|
var o = t[0].offsetWidth;
|
|
i === o && (o = e[0].clientWidth), e.remove(), this.cachedWidth = i - o
|
|
}
|
|
return this.cachedWidth
|
|
},
|
|
calculateObjectValue: function(t, e, i, o) {
|
|
var s = e;
|
|
if ("string" == typeof e) {
|
|
var n = e.split(".");
|
|
if (n.length > 1) {
|
|
s = window;
|
|
var a, r = V(n);
|
|
try {
|
|
for (r.s(); !(a = r.n()).done;) {
|
|
s = s[a.value]
|
|
}
|
|
} catch (t) {
|
|
r.e(t)
|
|
} finally {
|
|
r.f()
|
|
}
|
|
} else s = window[e]
|
|
}
|
|
return null !== s && "object" === E(s) ? s : "function" == typeof s ? s.apply(t, i || []) : !s && "string" == typeof e && i && this.sprintf.apply(this, [e].concat(F(i))) ? this.sprintf.apply(this, [e].concat(F(i))) : o
|
|
},
|
|
compareObjects: function(t, e, i) {
|
|
var o = Object.keys(t),
|
|
s = Object.keys(e);
|
|
if (i && o.length !== s.length) return !1;
|
|
for (var n = 0, a = o; n < a.length; n++) {
|
|
var r = a[n];
|
|
if (s.includes(r) && t[r] !== e[r]) return !1
|
|
}
|
|
return !0
|
|
},
|
|
regexCompare: function(t, e) {
|
|
try {
|
|
var i = e.match(/^\/(.*?)\/([gim]*)$/);
|
|
if (-1 !== t.toString().search(i ? new RegExp(i[1], i[2]) : new RegExp(e, "gim"))) return !0
|
|
} catch (t) {
|
|
return !1
|
|
}
|
|
return !1
|
|
},
|
|
escapeApostrophe: function(t) {
|
|
return t.toString().replace(/'/g, "'")
|
|
},
|
|
escapeHTML: function(t) {
|
|
return t ? t.toString().replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'") : t
|
|
},
|
|
unescapeHTML: function(t) {
|
|
return "string" == typeof t && t ? t.toString().replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'") : t
|
|
},
|
|
removeHTML: function(t) {
|
|
return t ? t.toString().replace(/(<([^>]+)>)/gi, "").replace(/&[#A-Za-z0-9]+;/gi, "").trim() : t
|
|
},
|
|
getRealDataAttr: function(t) {
|
|
for (var e = 0, i = Object.entries(t); e < i.length; e++) {
|
|
var o = B(i[e], 2),
|
|
s = o[0],
|
|
n = o[1],
|
|
a = s.split(/(?=[A-Z])/).join("-").toLowerCase();
|
|
a !== s && (t[a] = n, delete t[s])
|
|
}
|
|
return t
|
|
},
|
|
getItemField: function(t, e, i) {
|
|
var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : void 0,
|
|
s = t;
|
|
if (void 0 !== o && (i = o), "string" != typeof e || t.hasOwnProperty(e)) return i ? this.escapeHTML(t[e]) : t[e];
|
|
var n, a = V(e.split("."));
|
|
try {
|
|
for (a.s(); !(n = a.n()).done;) {
|
|
var r = n.value;
|
|
s = s && s[r]
|
|
}
|
|
} catch (t) {
|
|
a.e(t)
|
|
} finally {
|
|
a.f()
|
|
}
|
|
return i ? this.escapeHTML(s) : s
|
|
},
|
|
isIEBrowser: function() {
|
|
return navigator.userAgent.includes("MSIE ") || /Trident.*rv:11\./.test(navigator.userAgent)
|
|
},
|
|
findIndex: function(t, e) {
|
|
var i, o = V(t);
|
|
try {
|
|
for (o.s(); !(i = o.n()).done;) {
|
|
var s = i.value;
|
|
if (JSON.stringify(s) === JSON.stringify(e)) return t.indexOf(s)
|
|
}
|
|
} catch (t) {
|
|
o.e(t)
|
|
} finally {
|
|
o.f()
|
|
}
|
|
return -1
|
|
},
|
|
trToData: function(t, e) {
|
|
var i = this,
|
|
o = [],
|
|
s = [];
|
|
return e.each((function(e, n) {
|
|
var a = I(n),
|
|
r = {};
|
|
r._id = a.attr("id"), r._class = a.attr("class"), r._data = i.getRealDataAttr(a.data()), r._style = a.attr("style"), a.find(">td,>th").each((function(o, n) {
|
|
for (var a = I(n), l = +a.attr("colspan") || 1, c = +a.attr("rowspan") || 1, h = o; s[e] && s[e][h]; h++);
|
|
for (var d = h; d < h + l; d++)
|
|
for (var u = e; u < e + c; u++) s[u] || (s[u] = []), s[u][d] = !0;
|
|
var p = t[h].field;
|
|
r[p] = i.escapeApostrophe(a.html().trim()), r["_".concat(p, "_id")] = a.attr("id"), r["_".concat(p, "_class")] = a.attr("class"), r["_".concat(p, "_rowspan")] = a.attr("rowspan"), r["_".concat(p, "_colspan")] = a.attr("colspan"), r["_".concat(p, "_title")] = a.attr("title"), r["_".concat(p, "_data")] = i.getRealDataAttr(a.data()), r["_".concat(p, "_style")] = a.attr("style")
|
|
})), o.push(r)
|
|
})), o
|
|
},
|
|
sort: function(t, e, i, o, s, n) {
|
|
if (null == t && (t = ""), null == e && (e = ""), o.sortStable && t === e && (t = s, e = n), this.isNumeric(t) && this.isNumeric(e)) return (t = parseFloat(t)) < (e = parseFloat(e)) ? -1 * i : t > e ? i : 0;
|
|
if (o.sortEmptyLast) {
|
|
if ("" === t) return 1;
|
|
if ("" === e) return -1
|
|
}
|
|
return t === e ? 0 : ("string" != typeof t && (t = t.toString()), -1 === t.localeCompare(e) ? -1 * i : i)
|
|
},
|
|
getEventName: function(t) {
|
|
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
|
|
return e = e || "".concat(+new Date).concat(~~(1e6 * Math.random())), "".concat(t, "-").concat(e)
|
|
},
|
|
hasDetailViewIcon: function(t) {
|
|
return t.detailView && t.detailViewIcon && !t.cardView
|
|
},
|
|
getDetailViewIndexOffset: function(t) {
|
|
return this.hasDetailViewIcon(t) && "right" !== t.detailViewAlign ? 1 : 0
|
|
},
|
|
checkAutoMergeCells: function(t) {
|
|
var e, i = V(t);
|
|
try {
|
|
for (i.s(); !(e = i.n()).done;)
|
|
for (var o = e.value, s = 0, n = Object.keys(o); s < n.length; s++) {
|
|
var a = n[s];
|
|
if (a.startsWith("_") && (a.endsWith("_rowspan") || a.endsWith("_colspan"))) return !0
|
|
}
|
|
} catch (t) {
|
|
i.e(t)
|
|
} finally {
|
|
i.f()
|
|
}
|
|
return !1
|
|
},
|
|
deepCopy: function(t) {
|
|
return void 0 === t ? t : this.extend(!0, Array.isArray(t) ? [] : {}, t)
|
|
},
|
|
debounce: function(t, e, i) {
|
|
var o;
|
|
return function() {
|
|
var s = this,
|
|
n = arguments,
|
|
a = i && !o;
|
|
clearTimeout(o), o = setTimeout((function() {
|
|
o = null, i || t.apply(s, n)
|
|
}), e), a && t.apply(s, n)
|
|
}
|
|
}
|
|
},
|
|
q = L.getBootstrapVersion(),
|
|
U = {
|
|
3: {
|
|
classes: {
|
|
buttonsPrefix: "btn",
|
|
buttons: "default",
|
|
buttonsGroup: "btn-group",
|
|
buttonsDropdown: "btn-group",
|
|
pull: "pull",
|
|
inputGroup: "input-group",
|
|
inputPrefix: "input-",
|
|
input: "form-control",
|
|
select: "form-control",
|
|
paginationDropdown: "btn-group dropdown",
|
|
dropup: "dropup",
|
|
dropdownActive: "active",
|
|
paginationActive: "active",
|
|
buttonActive: "active"
|
|
},
|
|
html: {
|
|
toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', "</ul>"],
|
|
toolbarDropdownItem: '<li class="dropdown-item-marker" role="menuitem"><label>%s</label></li>',
|
|
toolbarDropdownSeparator: '<li class="divider"></li>',
|
|
pageDropdown: ['<ul class="dropdown-menu" role="menu">', "</ul>"],
|
|
pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
|
|
dropdownCaret: '<span class="caret"></span>',
|
|
pagination: ['<ul class="pagination%s">', "</ul>"],
|
|
paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
|
|
icon: '<i class="%s %s"></i>',
|
|
inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
|
|
searchInput: '<input class="%s%s" type="text" placeholder="%s">',
|
|
searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
|
|
searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
|
|
}
|
|
},
|
|
4: {
|
|
classes: {
|
|
buttonsPrefix: "btn",
|
|
buttons: "secondary",
|
|
buttonsGroup: "btn-group",
|
|
buttonsDropdown: "btn-group",
|
|
pull: "float",
|
|
inputGroup: "btn-group",
|
|
inputPrefix: "form-control-",
|
|
input: "form-control",
|
|
select: "form-control",
|
|
paginationDropdown: "btn-group dropdown",
|
|
dropup: "dropup",
|
|
dropdownActive: "active",
|
|
paginationActive: "active",
|
|
buttonActive: "active"
|
|
},
|
|
html: {
|
|
toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', "</div>"],
|
|
toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
|
|
pageDropdown: ['<div class="dropdown-menu">', "</div>"],
|
|
pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
|
|
toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
|
|
dropdownCaret: '<span class="caret"></span>',
|
|
pagination: ['<ul class="pagination%s">', "</ul>"],
|
|
paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
|
|
icon: '<i class="%s %s"></i>',
|
|
inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
|
|
searchInput: '<input class="%s%s" type="text" placeholder="%s">',
|
|
searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
|
|
searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
|
|
}
|
|
},
|
|
5: {
|
|
classes: {
|
|
buttonsPrefix: "btn",
|
|
buttons: "secondary",
|
|
buttonsGroup: "btn-group",
|
|
buttonsDropdown: "btn-group",
|
|
pull: "float",
|
|
inputGroup: "btn-group",
|
|
inputPrefix: "form-control-",
|
|
input: "form-control",
|
|
select: "form-select",
|
|
paginationDropdown: "btn-group dropdown",
|
|
dropup: "dropup",
|
|
dropdownActive: "active",
|
|
paginationActive: "active",
|
|
buttonActive: "active"
|
|
},
|
|
html: {
|
|
dataToggle: "data-bs-toggle",
|
|
toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-end">', "</div>"],
|
|
toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
|
|
pageDropdown: ['<div class="dropdown-menu">', "</div>"],
|
|
pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
|
|
toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
|
|
dropdownCaret: '<span class="caret"></span>',
|
|
pagination: ['<ul class="pagination%s">', "</ul>"],
|
|
paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
|
|
icon: '<i class="%s %s"></i>',
|
|
inputGroup: '<div class="input-group">%s%s</div>',
|
|
searchInput: '<input class="%s%s" type="text" placeholder="%s">',
|
|
searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
|
|
searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
|
|
}
|
|
}
|
|
}[q],
|
|
z = {
|
|
height: void 0,
|
|
classes: "table table-bordered table-hover",
|
|
buttons: {},
|
|
theadClasses: "",
|
|
headerStyle: function(t) {
|
|
return {}
|
|
},
|
|
rowStyle: function(t, e) {
|
|
return {}
|
|
},
|
|
rowAttributes: function(t, e) {
|
|
return {}
|
|
},
|
|
undefinedText: "-",
|
|
locale: void 0,
|
|
virtualScroll: !1,
|
|
virtualScrollItemHeight: void 0,
|
|
sortable: !0,
|
|
sortClass: void 0,
|
|
silentSort: !0,
|
|
sortEmptyLast: !1,
|
|
sortName: void 0,
|
|
sortOrder: void 0,
|
|
sortReset: !1,
|
|
sortStable: !1,
|
|
sortResetPage: !1,
|
|
rememberOrder: !1,
|
|
serverSort: !0,
|
|
customSort: void 0,
|
|
columns: [
|
|
[]
|
|
],
|
|
data: [],
|
|
url: void 0,
|
|
method: "get",
|
|
cache: !0,
|
|
contentType: "application/json",
|
|
dataType: "json",
|
|
ajax: void 0,
|
|
ajaxOptions: {},
|
|
queryParams: function(t) {
|
|
return t
|
|
},
|
|
queryParamsType: "limit",
|
|
responseHandler: function(t) {
|
|
return t
|
|
},
|
|
totalField: "total",
|
|
totalNotFilteredField: "totalNotFiltered",
|
|
dataField: "rows",
|
|
footerField: "footer",
|
|
pagination: !1,
|
|
paginationParts: ["pageInfo", "pageSize", "pageList"],
|
|
showExtendedPagination: !1,
|
|
paginationLoop: !0,
|
|
sidePagination: "client",
|
|
totalRows: 0,
|
|
totalNotFiltered: 0,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
pageList: [10, 25, 50, 100],
|
|
paginationHAlign: "right",
|
|
paginationVAlign: "bottom",
|
|
paginationDetailHAlign: "left",
|
|
paginationPreText: "‹",
|
|
paginationNextText: "›",
|
|
paginationSuccessivelySize: 5,
|
|
paginationPagesBySide: 1,
|
|
paginationUseIntermediate: !1,
|
|
paginationLoadMore: !1,
|
|
search: !1,
|
|
searchable: !1,
|
|
searchHighlight: !1,
|
|
searchOnEnterKey: !1,
|
|
strictSearch: !1,
|
|
regexSearch: !1,
|
|
searchSelector: !1,
|
|
visibleSearch: !1,
|
|
showButtonIcons: !0,
|
|
showButtonText: !1,
|
|
showSearchButton: !1,
|
|
showSearchClearButton: !1,
|
|
trimOnSearch: !0,
|
|
searchAlign: "right",
|
|
searchTimeOut: 500,
|
|
searchText: "",
|
|
customSearch: void 0,
|
|
showHeader: !0,
|
|
showFooter: !1,
|
|
footerStyle: function(t) {
|
|
return {}
|
|
},
|
|
searchAccentNeutralise: !1,
|
|
showColumns: !1,
|
|
showColumnsToggleAll: !1,
|
|
showColumnsSearch: !1,
|
|
minimumCountColumns: 1,
|
|
showPaginationSwitch: !1,
|
|
showRefresh: !1,
|
|
showToggle: !1,
|
|
showFullscreen: !1,
|
|
smartDisplay: !0,
|
|
escape: !1,
|
|
escapeTitle: !0,
|
|
filterOptions: {
|
|
filterAlgorithm: "and"
|
|
},
|
|
idField: void 0,
|
|
selectItemName: "btSelectItem",
|
|
clickToSelect: !1,
|
|
ignoreClickToSelectOn: function(t) {
|
|
var e = t.tagName;
|
|
return ["A", "BUTTON"].includes(e)
|
|
},
|
|
singleSelect: !1,
|
|
checkboxHeader: !0,
|
|
maintainMetaData: !1,
|
|
multipleSelectRow: !1,
|
|
uniqueId: void 0,
|
|
cardView: !1,
|
|
detailView: !1,
|
|
detailViewIcon: !0,
|
|
detailViewByClick: !1,
|
|
detailViewAlign: "left",
|
|
detailFormatter: function(t, e) {
|
|
return ""
|
|
},
|
|
detailFilter: function(t, e) {
|
|
return !0
|
|
},
|
|
toolbar: void 0,
|
|
toolbarAlign: "left",
|
|
buttonsToolbar: void 0,
|
|
buttonsAlign: "right",
|
|
buttonsOrder: ["paginationSwitch", "refresh", "toggle", "fullscreen", "columns"],
|
|
buttonsPrefix: U.classes.buttonsPrefix,
|
|
buttonsClass: U.classes.buttons,
|
|
iconsPrefix: void 0,
|
|
icons: {},
|
|
iconSize: void 0,
|
|
fixedScroll: !1,
|
|
loadingFontSize: "auto",
|
|
loadingTemplate: function(t) {
|
|
return '<span class="loading-wrap">\n <span class="loading-text">'.concat(t, '</span>\n <span class="animation-wrap"><span class="animation-dot"></span></span>\n </span>\n ')
|
|
},
|
|
onAll: function(t, e) {
|
|
return !1
|
|
},
|
|
onClickCell: function(t, e, i, o) {
|
|
return !1
|
|
},
|
|
onDblClickCell: function(t, e, i, o) {
|
|
return !1
|
|
},
|
|
onClickRow: function(t, e) {
|
|
return !1
|
|
},
|
|
onDblClickRow: function(t, e) {
|
|
return !1
|
|
},
|
|
onSort: function(t, e) {
|
|
return !1
|
|
},
|
|
onCheck: function(t) {
|
|
return !1
|
|
},
|
|
onUncheck: function(t) {
|
|
return !1
|
|
},
|
|
onCheckAll: function(t) {
|
|
return !1
|
|
},
|
|
onUncheckAll: function(t) {
|
|
return !1
|
|
},
|
|
onCheckSome: function(t) {
|
|
return !1
|
|
},
|
|
onUncheckSome: function(t) {
|
|
return !1
|
|
},
|
|
onLoadSuccess: function(t) {
|
|
return !1
|
|
},
|
|
onLoadError: function(t) {
|
|
return !1
|
|
},
|
|
onColumnSwitch: function(t, e) {
|
|
return !1
|
|
},
|
|
onColumnSwitchAll: function(t) {
|
|
return !1
|
|
},
|
|
onPageChange: function(t, e) {
|
|
return !1
|
|
},
|
|
onSearch: function(t) {
|
|
return !1
|
|
},
|
|
onToggle: function(t) {
|
|
return !1
|
|
},
|
|
onPreBody: function(t) {
|
|
return !1
|
|
},
|
|
onPostBody: function() {
|
|
return !1
|
|
},
|
|
onPostHeader: function() {
|
|
return !1
|
|
},
|
|
onPostFooter: function() {
|
|
return !1
|
|
},
|
|
onExpandRow: function(t, e, i) {
|
|
return !1
|
|
},
|
|
onCollapseRow: function(t, e) {
|
|
return !1
|
|
},
|
|
onRefreshOptions: function(t) {
|
|
return !1
|
|
},
|
|
onRefresh: function(t) {
|
|
return !1
|
|
},
|
|
onResetView: function() {
|
|
return !1
|
|
},
|
|
onScrollBody: function() {
|
|
return !1
|
|
},
|
|
onTogglePagination: function(t) {
|
|
return !1
|
|
},
|
|
onVirtualScroll: function(t, e) {
|
|
return !1
|
|
}
|
|
},
|
|
M = {
|
|
formatLoadingMessage: function() {
|
|
return "Loading, please wait"
|
|
},
|
|
formatRecordsPerPage: function(t) {
|
|
return "".concat(t, " rows per page")
|
|
},
|
|
formatShowingRows: function(t, e, i, o) {
|
|
return void 0 !== o && o > 0 && o > i ? "Showing ".concat(t, " to ").concat(e, " of ").concat(i, " rows (filtered from ").concat(o, " total rows)") : "Showing ".concat(t, " to ").concat(e, " of ").concat(i, " rows")
|
|
},
|
|
formatSRPaginationPreText: function() {
|
|
return "previous page"
|
|
},
|
|
formatSRPaginationPageText: function(t) {
|
|
return "to page ".concat(t)
|
|
},
|
|
formatSRPaginationNextText: function() {
|
|
return "next page"
|
|
},
|
|
formatDetailPagination: function(t) {
|
|
return "Showing ".concat(t, " rows")
|
|
},
|
|
formatSearch: function() {
|
|
return "Search"
|
|
},
|
|
formatClearSearch: function() {
|
|
return "Clear Search"
|
|
},
|
|
formatNoMatches: function() {
|
|
return "No matching records found"
|
|
},
|
|
formatPaginationSwitch: function() {
|
|
return "Hide/Show pagination"
|
|
},
|
|
formatPaginationSwitchDown: function() {
|
|
return "Show pagination"
|
|
},
|
|
formatPaginationSwitchUp: function() {
|
|
return "Hide pagination"
|
|
},
|
|
formatRefresh: function() {
|
|
return "Refresh"
|
|
},
|
|
formatToggleOn: function() {
|
|
return "Show card view"
|
|
},
|
|
formatToggleOff: function() {
|
|
return "Hide card view"
|
|
},
|
|
formatColumns: function() {
|
|
return "Columns"
|
|
},
|
|
formatColumnsToggleAll: function() {
|
|
return "Toggle all"
|
|
},
|
|
formatFullscreen: function() {
|
|
return "Fullscreen"
|
|
},
|
|
formatAllRows: function() {
|
|
return "All"
|
|
}
|
|
},
|
|
W = {
|
|
field: void 0,
|
|
title: void 0,
|
|
titleTooltip: void 0,
|
|
class: void 0,
|
|
width: void 0,
|
|
widthUnit: "px",
|
|
rowspan: void 0,
|
|
colspan: void 0,
|
|
align: void 0,
|
|
halign: void 0,
|
|
falign: void 0,
|
|
valign: void 0,
|
|
cellStyle: void 0,
|
|
radio: !1,
|
|
checkbox: !1,
|
|
checkboxEnabled: !0,
|
|
clickToSelect: !0,
|
|
showSelectTitle: !1,
|
|
sortable: !1,
|
|
sortName: void 0,
|
|
order: "asc",
|
|
sorter: void 0,
|
|
visible: !0,
|
|
switchable: !0,
|
|
switchableLabel: void 0,
|
|
cardVisible: !0,
|
|
searchable: !0,
|
|
formatter: void 0,
|
|
footerFormatter: void 0,
|
|
footerStyle: void 0,
|
|
detailFormatter: void 0,
|
|
searchFormatter: !0,
|
|
searchHighlightFormatter: !1,
|
|
escape: void 0,
|
|
events: void 0
|
|
};
|
|
Object.assign(z, M);
|
|
var G = {
|
|
VERSION: "1.23.1",
|
|
THEME: "bootstrap".concat(q),
|
|
CONSTANTS: U,
|
|
DEFAULTS: z,
|
|
COLUMN_DEFAULTS: W,
|
|
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"],
|
|
EVENTS: {
|
|
"all.bs.table": "onAll",
|
|
"click-row.bs.table": "onClickRow",
|
|
"dbl-click-row.bs.table": "onDblClickRow",
|
|
"click-cell.bs.table": "onClickCell",
|
|
"dbl-click-cell.bs.table": "onDblClickCell",
|
|
"sort.bs.table": "onSort",
|
|
"check.bs.table": "onCheck",
|
|
"uncheck.bs.table": "onUncheck",
|
|
"check-all.bs.table": "onCheckAll",
|
|
"uncheck-all.bs.table": "onUncheckAll",
|
|
"check-some.bs.table": "onCheckSome",
|
|
"uncheck-some.bs.table": "onUncheckSome",
|
|
"load-success.bs.table": "onLoadSuccess",
|
|
"load-error.bs.table": "onLoadError",
|
|
"column-switch.bs.table": "onColumnSwitch",
|
|
"column-switch-all.bs.table": "onColumnSwitchAll",
|
|
"page-change.bs.table": "onPageChange",
|
|
"search.bs.table": "onSearch",
|
|
"toggle.bs.table": "onToggle",
|
|
"pre-body.bs.table": "onPreBody",
|
|
"post-body.bs.table": "onPostBody",
|
|
"post-header.bs.table": "onPostHeader",
|
|
"post-footer.bs.table": "onPostFooter",
|
|
"expand-row.bs.table": "onExpandRow",
|
|
"collapse-row.bs.table": "onCollapseRow",
|
|
"refresh-options.bs.table": "onRefreshOptions",
|
|
"reset-view.bs.table": "onResetView",
|
|
"refresh.bs.table": "onRefresh",
|
|
"scroll-body.bs.table": "onScrollBody",
|
|
"toggle-pagination.bs.table": "onTogglePagination",
|
|
"virtual-scroll.bs.table": "onVirtualScroll"
|
|
},
|
|
LOCALES: {
|
|
en: M,
|
|
"en-US": M
|
|
}
|
|
},
|
|
K = function() {
|
|
return D((function t(e) {
|
|
var i = this;
|
|
_(this, t), this.rows = e.rows, this.scrollEl = e.scrollEl, this.contentEl = e.contentEl, this.callback = e.callback, this.itemHeight = e.itemHeight, this.cache = {}, this.scrollTop = this.scrollEl.scrollTop, this.initDOM(this.rows, e.fixedScroll), this.scrollEl.scrollTop = this.scrollTop, this.lastCluster = 0;
|
|
var o = function() {
|
|
i.lastCluster !== (i.lastCluster = i.getNum()) && (i.initDOM(i.rows), i.callback(i.startIndex, i.endIndex))
|
|
};
|
|
this.scrollEl.addEventListener("scroll", o, !1), this.destroy = function() {
|
|
i.contentEl.innerHtml = "", i.scrollEl.removeEventListener("scroll", o, !1)
|
|
}
|
|
}), [{
|
|
key: "initDOM",
|
|
value: function(t, e) {
|
|
void 0 === this.clusterHeight ? (this.cache.scrollTop = this.scrollEl.scrollTop, this.cache.data = this.contentEl.innerHTML = t[0] + t[0] + t[0], this.getRowsHeight(t)) : 0 === this.blockHeight && this.getRowsHeight(t);
|
|
var i = this.initData(t, this.getNum(e)),
|
|
o = i.rows.join(""),
|
|
s = this.checkChanges("data", o),
|
|
n = this.checkChanges("top", i.topOffset),
|
|
a = this.checkChanges("bottom", i.bottomOffset),
|
|
r = [];
|
|
s && n ? (i.topOffset && r.push(this.getExtra("top", i.topOffset)), r.push(o), i.bottomOffset && r.push(this.getExtra("bottom", i.bottomOffset)), this.startIndex = i.start, this.endIndex = i.end, this.contentEl.innerHTML = r.join(""), e && (this.contentEl.scrollTop = this.cache.scrollTop)) : a && (this.contentEl.lastChild.style.height = "".concat(i.bottomOffset, "px"))
|
|
}
|
|
}, {
|
|
key: "getRowsHeight",
|
|
value: function() {
|
|
if (void 0 === this.itemHeight || 0 === this.itemHeight) {
|
|
var t = this.contentEl.children,
|
|
e = t[Math.floor(t.length / 2)];
|
|
this.itemHeight = e.offsetHeight
|
|
}
|
|
this.blockHeight = 50 * this.itemHeight, this.clusterRows = 200, this.clusterHeight = 4 * this.blockHeight
|
|
}
|
|
}, {
|
|
key: "getNum",
|
|
value: function(t) {
|
|
return this.scrollTop = t ? this.cache.scrollTop : this.scrollEl.scrollTop, Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0
|
|
}
|
|
}, {
|
|
key: "initData",
|
|
value: function(t, e) {
|
|
if (t.length < 50) return {
|
|
topOffset: 0,
|
|
bottomOffset: 0,
|
|
rowsAbove: 0,
|
|
rows: t
|
|
};
|
|
var i = Math.max((this.clusterRows - 50) * e, 0),
|
|
o = i + this.clusterRows,
|
|
s = Math.max(i * this.itemHeight, 0),
|
|
n = Math.max((t.length - o) * this.itemHeight, 0),
|
|
a = [],
|
|
r = i;
|
|
s < 1 && r++;
|
|
for (var l = i; l < o; l++) t[l] && a.push(t[l]);
|
|
return {
|
|
start: i,
|
|
end: o,
|
|
topOffset: s,
|
|
bottomOffset: n,
|
|
rowsAbove: r,
|
|
rows: a
|
|
}
|
|
}
|
|
}, {
|
|
key: "checkChanges",
|
|
value: function(t, e) {
|
|
var i = e !== this.cache[t];
|
|
return this.cache[t] = e, i
|
|
}
|
|
}, {
|
|
key: "getExtra",
|
|
value: function(t, e) {
|
|
var i = document.createElement("tr");
|
|
return i.className = "virtual-scroll-".concat(t), e && (i.style.height = "".concat(e, "px")), i.outerHTML
|
|
}
|
|
}])
|
|
}(),
|
|
J = function() {
|
|
function t(e, i) {
|
|
_(this, t), this.options = i, this.$el = I(e), this.$el_ = this.$el.clone(), this.timeoutId_ = 0, this.timeoutFooter_ = 0
|
|
}
|
|
return D(t, [{
|
|
key: "init",
|
|
value: function() {
|
|
this.initConstants(), this.initLocale(), this.initContainer(), this.initTable(), this.initHeader(), this.initData(), this.initHiddenRows(), this.initToolbar(), this.initPagination(), this.initBody(), this.initSearchText(), this.initServer()
|
|
}
|
|
}, {
|
|
key: "initConstants",
|
|
value: function() {
|
|
var t = this.options;
|
|
this.constants = G.CONSTANTS, this.constants.theme = I.fn.bootstrapTable.theme, this.constants.dataToggle = this.constants.html.dataToggle || "data-toggle";
|
|
var e = L.getIconsPrefix(I.fn.bootstrapTable.theme);
|
|
"string" == typeof t.icons && (t.icons = L.calculateObjectValue(null, t.icons)), t.iconsPrefix = t.iconsPrefix || I.fn.bootstrapTable.defaults.iconsPrefix || e, t.icons = Object.assign(L.getIcons(t.iconsPrefix), I.fn.bootstrapTable.defaults.icons, t.icons);
|
|
var i = t.buttonsPrefix ? "".concat(t.buttonsPrefix, "-") : "";
|
|
this.constants.buttonsClass = [t.buttonsPrefix, i + t.buttonsClass, L.sprintf("".concat(i, "%s"), t.iconSize)].join(" ").trim(), this.buttons = L.calculateObjectValue(this, t.buttons, [], {}), "object" !== E(this.buttons) && (this.buttons = {})
|
|
}
|
|
}, {
|
|
key: "initLocale",
|
|
value: function() {
|
|
if (this.options.locale) {
|
|
var e = I.fn.bootstrapTable.locales,
|
|
i = this.options.locale.split(/-|_/);
|
|
i[0] = i[0].toLowerCase(), i[1] && (i[1] = i[1].toUpperCase());
|
|
var o = {};
|
|
e[this.options.locale] ? o = e[this.options.locale] : e[i.join("-")] ? o = e[i.join("-")] : e[i[0]] && (o = e[i[0]]), this._defaultLocales = this._defaultLocales || {};
|
|
for (var s = 0, n = Object.entries(o); s < n.length; s++) {
|
|
var a = B(n[s], 2),
|
|
r = a[0],
|
|
l = a[1],
|
|
c = this._defaultLocales.hasOwnProperty(r) ? this._defaultLocales[r] : t.DEFAULTS[r];
|
|
this.options[r] === c && (this.options[r] = l, this._defaultLocales[r] = l)
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "initContainer",
|
|
value: function() {
|
|
var t = ["top", "both"].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : "",
|
|
e = ["bottom", "both"].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : "",
|
|
i = L.calculateObjectValue(this.options, this.options.loadingTemplate, [this.options.formatLoadingMessage()]);
|
|
this.$container = I('\n <div class="bootstrap-table '.concat(this.constants.theme, '">\n <div class="fixed-table-toolbar"></div>\n ').concat(t, '\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(i, '\n </div>\n </div>\n <div class="fixed-table-footer"></div>\n </div>\n ').concat(e, "\n </div>\n ")), this.$container.insertAfter(this.$el), this.$tableContainer = this.$container.find(".fixed-table-container"), this.$tableHeader = this.$container.find(".fixed-table-header"), this.$tableBody = this.$container.find(".fixed-table-body"), this.$tableLoading = this.$container.find(".fixed-table-loading"), this.$tableFooter = this.$el.find("tfoot"), this.options.buttonsToolbar ? this.$toolbar = I("body").find(this.options.buttonsToolbar) : this.$toolbar = this.$container.find(".fixed-table-toolbar"), this.$pagination = this.$container.find(".fixed-table-pagination"), this.$tableBody.append(this.$el), this.$container.after('<div class="clearfix"></div>'), this.$el.addClass(this.options.classes), this.$tableLoading.addClass(this.options.classes), this.options.height && (this.$tableContainer.addClass("fixed-height"), this.options.showFooter && this.$tableContainer.addClass("has-footer"), this.options.classes.split(" ").includes("table-bordered") && (this.$tableBody.append('<div class="fixed-table-border"></div>'), this.$tableBorder = this.$tableBody.find(".fixed-table-border"), this.$tableLoading.addClass("fixed-table-border")), this.$tableFooter = this.$container.find(".fixed-table-footer"))
|
|
}
|
|
}, {
|
|
key: "initTable",
|
|
value: function() {
|
|
var e = this,
|
|
i = [];
|
|
if (this.$header = this.$el.find(">thead"), this.$header.length ? this.options.theadClasses && this.$header.addClass(this.options.theadClasses) : this.$header = I('<thead class="'.concat(this.options.theadClasses, '"></thead>')).appendTo(this.$el), this._headerTrClasses = [], this._headerTrStyles = [], this.$header.find("tr").each((function(t, o) {
|
|
var s = I(o),
|
|
n = [];
|
|
s.find("th").each((function(t, e) {
|
|
var i = I(e);
|
|
void 0 !== i.data("field") && i.data("field", "".concat(i.data("field")));
|
|
var o = Object.assign({}, i.data());
|
|
for (var s in o) I.fn.bootstrapTable.columnDefaults.hasOwnProperty(s) && delete o[s];
|
|
n.push(L.extend({}, {
|
|
_data: L.getRealDataAttr(o),
|
|
title: i.html(),
|
|
class: i.attr("class"),
|
|
titleTooltip: i.attr("title"),
|
|
rowspan: i.attr("rowspan") ? +i.attr("rowspan") : void 0,
|
|
colspan: i.attr("colspan") ? +i.attr("colspan") : void 0
|
|
}, i.data()))
|
|
})), i.push(n), s.attr("class") && e._headerTrClasses.push(s.attr("class")), s.attr("style") && e._headerTrStyles.push(s.attr("style"))
|
|
})), Array.isArray(this.options.columns[0]) || (this.options.columns = [this.options.columns]), this.options.columns = L.extend(!0, [], i, this.options.columns), this.columns = [], this.fieldsColumnsIndex = [], L.setFieldIndex(this.options.columns), this.options.columns.forEach((function(i, o) {
|
|
i.forEach((function(i, s) {
|
|
var n = L.extend({}, t.COLUMN_DEFAULTS, i, {
|
|
passed: i
|
|
});
|
|
void 0 !== n.fieldIndex && (e.columns[n.fieldIndex] = n, e.fieldsColumnsIndex[n.field] = n.fieldIndex), e.options.columns[o][s] = n
|
|
}))
|
|
})), !this.options.data.length) {
|
|
var o = L.trToData(this.columns, this.$el.find(">tbody>tr"));
|
|
o.length && (this.options.data = o, this.fromHtml = !0)
|
|
}
|
|
this.options.pagination && "server" !== this.options.sidePagination || (this.footerData = L.trToData(this.columns, this.$el.find(">tfoot>tr"))), this.footerData && this.$el.find("tfoot").html("<tr></tr>"), !this.options.showFooter || this.options.cardView ? this.$tableFooter.hide() : this.$tableFooter.show()
|
|
}
|
|
}, {
|
|
key: "initHeader",
|
|
value: function() {
|
|
var t = this,
|
|
e = {},
|
|
i = [];
|
|
this.header = {
|
|
fields: [],
|
|
styles: [],
|
|
classes: [],
|
|
formatters: [],
|
|
detailFormatters: [],
|
|
events: [],
|
|
sorters: [],
|
|
sortNames: [],
|
|
cellStyles: [],
|
|
searchables: []
|
|
}, L.updateFieldGroup(this.options.columns, this.columns), this.options.columns.forEach((function(o, s) {
|
|
var n = [];
|
|
n.push("<tr".concat(L.sprintf(' class="%s"', t._headerTrClasses[s]), " ").concat(L.sprintf(' style="%s"', t._headerTrStyles[s]), ">"));
|
|
var a = "";
|
|
if (0 === s && L.hasDetailViewIcon(t.options)) {
|
|
var r = t.options.columns.length > 1 ? ' rowspan="'.concat(t.options.columns.length, '"') : "";
|
|
a = '<th class="detail"'.concat(r, '>\n <div class="fht-cell"></div>\n </th>')
|
|
}
|
|
a && "right" !== t.options.detailViewAlign && n.push(a), o.forEach((function(i, o) {
|
|
var a = L.sprintf(' class="%s"', i.class),
|
|
r = i.widthUnit,
|
|
l = parseFloat(i.width),
|
|
c = i.halign ? i.halign : i.align,
|
|
h = L.sprintf("text-align: %s; ", c),
|
|
d = L.sprintf("text-align: %s; ", i.align),
|
|
u = L.sprintf("vertical-align: %s; ", i.valign);
|
|
if (u += L.sprintf("width: %s; ", !i.checkbox && !i.radio || l ? l ? l + r : void 0 : i.showSelectTitle ? void 0 : "36px"), void 0 !== i.fieldIndex || i.visible) {
|
|
var p = L.calculateObjectValue(null, t.options.headerStyle, [i]),
|
|
f = [],
|
|
g = [],
|
|
v = "";
|
|
if (p && p.css)
|
|
for (var m = 0, b = Object.entries(p.css); m < b.length; m++) {
|
|
var y = B(b[m], 2),
|
|
w = y[0],
|
|
S = y[1];
|
|
f.push("".concat(w, ": ").concat(S))
|
|
}
|
|
if (p && p.classes && (v = L.sprintf(' class="%s"', i.class ? [i.class, p.classes].join(" ") : p.classes)), void 0 !== i.fieldIndex) {
|
|
if (t.header.fields[i.fieldIndex] = i.field, t.header.styles[i.fieldIndex] = d + u, t.header.classes[i.fieldIndex] = a, t.header.formatters[i.fieldIndex] = i.formatter, t.header.detailFormatters[i.fieldIndex] = i.detailFormatter, t.header.events[i.fieldIndex] = i.events, t.header.sorters[i.fieldIndex] = i.sorter, t.header.sortNames[i.fieldIndex] = i.sortName, t.header.cellStyles[i.fieldIndex] = i.cellStyle, t.header.searchables[i.fieldIndex] = i.searchable, !i.visible) return;
|
|
if (t.options.cardView && !i.cardVisible) return;
|
|
e[i.field] = i
|
|
}
|
|
if (Object.keys(i._data || {}).length > 0)
|
|
for (var x = 0, k = Object.entries(i._data); x < k.length; x++) {
|
|
var j = B(k[x], 2),
|
|
C = j[0],
|
|
O = j[1];
|
|
g.push("data-".concat(C, "='").concat("object" === E(O) ? JSON.stringify(O) : O, "'"))
|
|
}
|
|
n.push("<th".concat(L.sprintf(' title="%s"', i.titleTooltip)), i.checkbox || i.radio ? L.sprintf(' class="bs-checkbox %s"', i.class || "") : v || a, L.sprintf(' style="%s"', h + u + f.join("; ") || void 0), L.sprintf(' rowspan="%s"', i.rowspan), L.sprintf(' colspan="%s"', i.colspan), L.sprintf(' data-field="%s"', i.field), 0 === o && s > 0 ? " data-not-first-th" : "", g.length > 0 ? g.join(" ") : "", ">"), n.push(L.sprintf('<div class="th-inner %s">', t.options.sortable && i.sortable ? "sortable".concat("center" === c ? " sortable-center" : "", " both") : ""));
|
|
var P = t.options.escape && t.options.escapeTitle ? L.escapeHTML(i.title) : i.title,
|
|
T = P;
|
|
i.checkbox && (P = "", !t.options.singleSelect && t.options.checkboxHeader && (P = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>'), t.header.stateField = i.field), i.radio && (P = "", t.header.stateField = i.field), !P && i.showSelectTitle && (P += T), n.push(P), n.push("</div>"), n.push('<div class="fht-cell"></div>'), n.push("</div>"), n.push("</th>")
|
|
}
|
|
})), a && "right" === t.options.detailViewAlign && n.push(a), n.push("</tr>"), n.length > 3 && i.push(n.join(""))
|
|
})), this.$header.html(i.join("")), this.$header.find("th[data-field]").each((function(t, i) {
|
|
I(i).data(e[I(i).data("field")])
|
|
})), this.$container.off("click", ".th-inner").on("click", ".th-inner", (function(e) {
|
|
var i = I(e.currentTarget);
|
|
if (t.options.detailView && !i.parent().hasClass("bs-checkbox") && i.closest(".bootstrap-table")[0] !== t.$container[0]) return !1;
|
|
t.options.sortable && i.parent().data().sortable && t.onSort(e)
|
|
}));
|
|
var o = L.getEventName("resize.bootstrap-table", this.$el.attr("id"));
|
|
I(window).off(o), !this.options.showHeader || this.options.cardView ? (this.$header.hide(), this.$tableHeader.hide(), this.$tableLoading.css("top", 0)) : (this.$header.show(), this.$tableHeader.show(), this.$tableLoading.css("top", this.$header.outerHeight() + 1), this.getCaret(), I(window).on(o, (function() {
|
|
return t.resetView()
|
|
}))), this.$selectAll = this.$header.find('[name="btSelectAll"]'), this.$selectAll.off("click").on("click", (function(e) {
|
|
e.stopPropagation();
|
|
var i = I(e.currentTarget).prop("checked");
|
|
t[i ? "checkAll" : "uncheckAll"](), t.updateSelected()
|
|
}))
|
|
}
|
|
}, {
|
|
key: "initData",
|
|
value: function(t, e) {
|
|
"append" === e ? this.options.data = this.options.data.concat(t) : "prepend" === e ? this.options.data = [].concat(t).concat(this.options.data) : (t = t || L.deepCopy(this.options.data), this.options.data = Array.isArray(t) ? t : t[this.options.dataField]), this.data = F(this.options.data), this.options.sortReset && (this.unsortedData = F(this.data)), "server" !== this.options.sidePagination && this.initSort()
|
|
}
|
|
}, {
|
|
key: "initSort",
|
|
value: function() {
|
|
var t = this,
|
|
e = this.options.sortName,
|
|
i = "desc" === this.options.sortOrder ? -1 : 1,
|
|
o = this.header.fields.indexOf(this.options.sortName),
|
|
s = 0; - 1 !== o ? (this.options.sortStable && this.data.forEach((function(t, e) {
|
|
t.hasOwnProperty("_position") || (t._position = e)
|
|
})), this.options.customSort ? L.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]) : this.data.sort((function(s, n) {
|
|
t.header.sortNames[o] && (e = t.header.sortNames[o]);
|
|
var a = L.getItemField(s, e, t.options.escape),
|
|
r = L.getItemField(n, e, t.options.escape),
|
|
l = L.calculateObjectValue(t.header, t.header.sorters[o], [a, r, s, n]);
|
|
return void 0 !== l ? t.options.sortStable && 0 === l ? i * (s._position - n._position) : i * l : L.sort(a, r, i, t.options, s._position, n._position)
|
|
})), void 0 !== this.options.sortClass && (clearTimeout(s), s = setTimeout((function() {
|
|
t.$el.removeClass(t.options.sortClass);
|
|
var e = t.$header.find('[data-field="'.concat(t.options.sortName, '"]')).index();
|
|
t.$el.find("tr td:nth-child(".concat(e + 1, ")")).addClass(t.options.sortClass)
|
|
}), 250))) : this.options.sortReset && (this.data = F(this.unsortedData))
|
|
}
|
|
}, {
|
|
key: "sortBy",
|
|
value: function(t) {
|
|
this.options.sortName = t.field, this.options.sortOrder = t.hasOwnProperty("sortOrder") ? t.sortOrder : "asc", this._sort()
|
|
}
|
|
}, {
|
|
key: "onSort",
|
|
value: function(t) {
|
|
var e = t.type,
|
|
i = t.currentTarget,
|
|
o = "keypress" === e ? I(i) : I(i).parent(),
|
|
s = this.$header.find("th").eq(o.index());
|
|
if (this.$header.add(this.$header_).find("span.order").remove(), this.options.sortName === o.data("field")) {
|
|
var n = this.options.sortOrder,
|
|
a = this.columns[this.fieldsColumnsIndex[o.data("field")]].sortOrder || this.columns[this.fieldsColumnsIndex[o.data("field")]].order;
|
|
void 0 === n ? this.options.sortOrder = "asc" : "asc" === n ? this.options.sortOrder = this.options.sortReset ? "asc" === a ? "desc" : void 0 : "desc" : "desc" === this.options.sortOrder && (this.options.sortOrder = this.options.sortReset ? "desc" === a ? "asc" : void 0 : "asc"), void 0 === this.options.sortOrder && (this.options.sortName = void 0)
|
|
} else this.options.sortName = o.data("field"), this.options.rememberOrder ? this.options.sortOrder = "asc" === o.data("order") ? "desc" : "asc" : this.options.sortOrder = this.columns[this.fieldsColumnsIndex[o.data("field")]].sortOrder || this.columns[this.fieldsColumnsIndex[o.data("field")]].order;
|
|
o.add(s).data("order", this.options.sortOrder), this.getCaret(), this._sort()
|
|
}
|
|
}, {
|
|
key: "_sort",
|
|
value: function() {
|
|
if ("server" === this.options.sidePagination && this.options.serverSort) return this.options.pageNumber = 1, this.trigger("sort", this.options.sortName, this.options.sortOrder), void this.initServer(this.options.silentSort);
|
|
this.options.pagination && this.options.sortResetPage && (this.options.pageNumber = 1, this.initPagination()), this.trigger("sort", this.options.sortName, this.options.sortOrder), this.initSort(), this.initBody()
|
|
}
|
|
}, {
|
|
key: "initToolbar",
|
|
value: function() {
|
|
var t, e = this,
|
|
i = this.options,
|
|
o = [],
|
|
s = 0,
|
|
n = 0;
|
|
this.$toolbar.find(".bs-bars").children().length && I("body").append(I(i.toolbar)), this.$toolbar.html(""), "string" != typeof i.toolbar && "object" !== E(i.toolbar) || I(L.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, i.toolbarAlign)).appendTo(this.$toolbar).append(I(i.toolbar)), o = ['<div class="'.concat(["columns", "columns-".concat(i.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(i.buttonsAlign)].join(" "), '">')], "string" == typeof i.buttonsOrder && (i.buttonsOrder = i.buttonsOrder.replace(/\[|\]| |'/g, "").split(",")), this.buttons = Object.assign(this.buttons, {
|
|
paginationSwitch: {
|
|
text: i.pagination ? i.formatPaginationSwitchUp() : i.formatPaginationSwitchDown(),
|
|
icon: i.pagination ? i.icons.paginationSwitchDown : i.icons.paginationSwitchUp,
|
|
render: !1,
|
|
event: this.togglePagination,
|
|
attributes: {
|
|
"aria-label": i.formatPaginationSwitch(),
|
|
title: i.formatPaginationSwitch()
|
|
}
|
|
},
|
|
refresh: {
|
|
text: i.formatRefresh(),
|
|
icon: i.icons.refresh,
|
|
render: !1,
|
|
event: this.refresh,
|
|
attributes: {
|
|
"aria-label": i.formatRefresh(),
|
|
title: i.formatRefresh()
|
|
}
|
|
},
|
|
toggle: {
|
|
text: i.formatToggleOn(),
|
|
icon: i.icons.toggleOff,
|
|
render: !1,
|
|
event: this.toggleView,
|
|
attributes: {
|
|
"aria-label": i.formatToggleOn(),
|
|
title: i.formatToggleOn()
|
|
}
|
|
},
|
|
fullscreen: {
|
|
text: i.formatFullscreen(),
|
|
icon: i.icons.fullscreen,
|
|
render: !1,
|
|
event: this.toggleFullscreen,
|
|
attributes: {
|
|
"aria-label": i.formatFullscreen(),
|
|
title: i.formatFullscreen()
|
|
}
|
|
},
|
|
columns: {
|
|
render: !1,
|
|
html: function() {
|
|
var t = [];
|
|
if (t.push('<div class="keep-open '.concat(e.constants.classes.buttonsDropdown, '">\n <button class="').concat(e.constants.buttonsClass, ' dropdown-toggle" type="button" ').concat(e.constants.dataToggle, '="dropdown"\n aria-label="').concat(i.formatColumns(), '" title="').concat(i.formatColumns(), '">\n ').concat(i.showButtonIcons ? L.sprintf(e.constants.html.icon, i.iconsPrefix, i.icons.columns) : "", "\n ").concat(i.showButtonText ? i.formatColumns() : "", "\n ").concat(e.constants.html.dropdownCaret, "\n </button>\n ").concat(e.constants.html.toolbarDropdown[0])), i.showColumnsSearch && (t.push(L.sprintf(e.constants.html.toolbarDropdownItem, L.sprintf('<input type="text" class="%s" name="columnsSearch" placeholder="%s" autocomplete="off">', e.constants.classes.input, i.formatSearch()))), t.push(e.constants.html.toolbarDropdownSeparator)), i.showColumnsToggleAll) {
|
|
var o = e.getVisibleColumns().length === e.columns.filter((function(t) {
|
|
return !e.isSelectionColumn(t)
|
|
})).length;
|
|
t.push(L.sprintf(e.constants.html.toolbarDropdownItem, L.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>', o ? 'checked="checked"' : "", i.formatColumnsToggleAll()))), t.push(e.constants.html.toolbarDropdownSeparator)
|
|
}
|
|
var s = 0;
|
|
return e.columns.forEach((function(t) {
|
|
t.visible && s++
|
|
})), e.columns.forEach((function(o, a) {
|
|
if (!e.isSelectionColumn(o) && (!i.cardView || o.cardVisible)) {
|
|
var r = o.visible ? ' checked="checked"' : "",
|
|
l = s <= i.minimumCountColumns && r ? ' disabled="disabled"' : "";
|
|
o.switchable && (t.push(L.sprintf(e.constants.html.toolbarDropdownItem, L.sprintf('<input type="checkbox" data-field="%s" value="%s"%s%s> <span>%s</span>', o.field, a, r, l, o.switchableLabel || o.title))), n++)
|
|
}
|
|
})), t.push(e.constants.html.toolbarDropdown[1], "</div>"), t.join("")
|
|
}
|
|
}
|
|
});
|
|
for (var a = {}, r = 0, l = Object.entries(this.buttons); r < l.length; r++) {
|
|
var c = B(l[r], 2),
|
|
h = c[0],
|
|
d = c[1],
|
|
u = void 0;
|
|
if (d.hasOwnProperty("html")) "function" == typeof d.html ? u = d.html() : "string" == typeof d.html && (u = d.html);
|
|
else {
|
|
var p = this.constants.buttonsClass;
|
|
if (d.hasOwnProperty("attributes") && d.attributes.class && (p += " ".concat(d.attributes.class)), u = '<button class="'.concat(p, '" type="button" name="').concat(h, '"'), d.hasOwnProperty("attributes"))
|
|
for (var f = 0, g = Object.entries(d.attributes); f < g.length; f++) {
|
|
var v = B(g[f], 2),
|
|
m = v[0],
|
|
b = v[1];
|
|
"class" !== m && (u += " ".concat(m, '="').concat(b, '"'))
|
|
}
|
|
u += ">", i.showButtonIcons && d.hasOwnProperty("icon") && (u += "".concat(L.sprintf(this.constants.html.icon, i.iconsPrefix, d.icon), " ")), i.showButtonText && d.hasOwnProperty("text") && (u += d.text), u += "</button>"
|
|
}
|
|
a[h] = u;
|
|
var y = "show".concat(h.charAt(0).toUpperCase()).concat(h.substring(1)),
|
|
w = i[y];
|
|
!(!d.hasOwnProperty("render") || d.hasOwnProperty("render") && d.render) || void 0 !== w && !0 !== w || (i[y] = !0), i.buttonsOrder.includes(h) || i.buttonsOrder.push(h)
|
|
}
|
|
var S, x = V(i.buttonsOrder);
|
|
try {
|
|
for (x.s(); !(S = x.n()).done;) {
|
|
var k = S.value;
|
|
i["show".concat(k.charAt(0).toUpperCase()).concat(k.substring(1))] && o.push(a[k])
|
|
}
|
|
} catch (t) {
|
|
x.e(t)
|
|
} finally {
|
|
x.f()
|
|
}
|
|
o.push("</div>"), (this.showToolbar || o.length > 2) && this.$toolbar.append(o.join(""));
|
|
for (var j = function() {
|
|
var t = B(O[C], 2),
|
|
i = t[0],
|
|
o = t[1];
|
|
if (o.hasOwnProperty("event")) {
|
|
if ("function" == typeof o.event || "string" == typeof o.event) {
|
|
var s = "string" == typeof o.event ? window[o.event] : o.event;
|
|
return e.$toolbar.find('button[name="'.concat(i, '"]')).off("click").on("click", (function() {
|
|
return s.call(e)
|
|
})), 1
|
|
}
|
|
for (var n = function() {
|
|
var t = B(r[a], 2),
|
|
o = t[0],
|
|
s = t[1],
|
|
n = "string" == typeof s ? window[s] : s;
|
|
e.$toolbar.find('button[name="'.concat(i, '"]')).off(o).on(o, (function() {
|
|
return n.call(e)
|
|
}))
|
|
}, a = 0, r = Object.entries(o.event); a < r.length; a++) n()
|
|
}
|
|
}, C = 0, O = Object.entries(this.buttons); C < O.length; C++) j();
|
|
if (i.showColumns) {
|
|
var P = (t = this.$toolbar.find(".keep-open")).find('input[type="checkbox"]:not(".toggle-all")'),
|
|
T = t.find('input[type="checkbox"].toggle-all');
|
|
if (n <= i.minimumCountColumns && t.find("input").prop("disabled", !0), t.find("li, label").off("click").on("click", (function(t) {
|
|
t.stopImmediatePropagation()
|
|
})), P.off("click").on("click", (function(t) {
|
|
var i = t.currentTarget,
|
|
o = I(i);
|
|
e._toggleColumn(o.val(), o.prop("checked"), !1), e.trigger("column-switch", o.data("field"), o.prop("checked")), T.prop("checked", P.filter(":checked").length === e.columns.filter((function(t) {
|
|
return !e.isSelectionColumn(t)
|
|
})).length)
|
|
})), T.off("click").on("click", (function(t) {
|
|
var i = t.currentTarget;
|
|
e._toggleAllColumns(I(i).prop("checked")), e.trigger("column-switch-all", I(i).prop("checked"))
|
|
})), i.showColumnsSearch) {
|
|
var $ = t.find('[name="columnsSearch"]'),
|
|
A = t.find(".dropdown-item-marker");
|
|
$.on("keyup paste change", (function(t) {
|
|
var e = t.currentTarget,
|
|
i = I(e).val().toLowerCase();
|
|
A.show(), P.each((function(t, e) {
|
|
var o = I(e).parents(".dropdown-item-marker");
|
|
o.text().toLowerCase().includes(i) || o.hide()
|
|
}))
|
|
}))
|
|
}
|
|
}
|
|
var R = function(t) {
|
|
var o = t.is("select") ? "change" : "keyup drop blur mouseup";
|
|
t.off(o).on(o, (function(t) {
|
|
i.searchOnEnterKey && 13 !== t.keyCode || [37, 38, 39, 40].includes(t.keyCode) || (clearTimeout(s), s = setTimeout((function() {
|
|
e.onSearch({
|
|
currentTarget: t.currentTarget
|
|
})
|
|
}), i.searchTimeOut))
|
|
}))
|
|
};
|
|
if ((i.search || this.showSearchClearButton) && "string" != typeof i.searchSelector) {
|
|
o = [];
|
|
var _ = L.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, i.formatSearch(), i.showButtonIcons ? L.sprintf(this.constants.html.icon, i.iconsPrefix, i.icons.search) : "", i.showButtonText ? i.formatSearch() : ""),
|
|
D = L.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, i.formatClearSearch(), i.showButtonIcons ? L.sprintf(this.constants.html.icon, i.iconsPrefix, i.icons.clearSearch) : "", i.showButtonText ? i.formatClearSearch() : ""),
|
|
F = '<input class="'.concat(this.constants.classes.input, "\n ").concat(L.sprintf(" %s%s", this.constants.classes.inputPrefix, i.iconSize), '\n search-input" type="search" aria-label="').concat(i.formatSearch(), '" placeholder="').concat(i.formatSearch(), '" autocomplete="off">'),
|
|
N = F;
|
|
if (i.showSearchButton || i.showSearchClearButton) {
|
|
var H = (i.showSearchButton ? _ : "") + (i.showSearchClearButton ? D : "");
|
|
N = i.search ? L.sprintf(this.constants.html.inputGroup, F, H) : H
|
|
}
|
|
o.push(L.sprintf('\n <div class="'.concat(this.constants.classes.pull, "-").concat(i.searchAlign, " search ").concat(this.constants.classes.inputGroup, '">\n %s\n </div>\n '), N)), this.$toolbar.append(o.join(""));
|
|
var q = L.getSearchInput(this);
|
|
i.showSearchButton ? (this.$toolbar.find(".search button[name=search]").off("click").on("click", (function() {
|
|
clearTimeout(s), s = setTimeout((function() {
|
|
e.onSearch({
|
|
currentTarget: q
|
|
})
|
|
}), i.searchTimeOut)
|
|
})), i.searchOnEnterKey && R(q)) : R(q), i.showSearchClearButton && this.$toolbar.find(".search button[name=clearSearch]").click((function() {
|
|
e.resetSearch()
|
|
}))
|
|
} else "string" == typeof i.searchSelector && R(L.getSearchInput(this))
|
|
}
|
|
}, {
|
|
key: "onSearch",
|
|
value: function() {
|
|
// console.log('开始搜索')
|
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
|
|
e = t.currentTarget,
|
|
i = t.firedByInitSearchText,
|
|
o = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
|
|
if (void 0 !== e && I(e).length && o) {
|
|
var s = I(e).val().trim();
|
|
if (this.options.trimOnSearch && I(e).val() !== s && I(e).val(s), this.searchText === s) return;
|
|
var n = L.getSearchInput(this),
|
|
a = e instanceof jQuery ? e : I(e);
|
|
(a.is(n) || a.hasClass("search-input")) && (this.searchText = s, this.options.searchText = s)
|
|
}
|
|
i || (this.options.pageNumber = 1), this.initSearch(), i ? "client" === this.options.sidePagination && this.updatePagination() : this.updatePagination(), this.trigger("search", this.searchText)
|
|
}
|
|
}, {
|
|
key: "initSearch",
|
|
value: function() {
|
|
// console.log('搜索进行中')
|
|
var t = this;
|
|
if (this.filterOptions = this.filterOptions || this.options.filterOptions, "server" !== this.options.sidePagination) {
|
|
if (this.options.customSearch) return this.data = L.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]), this.options.sortReset && (this.unsortedData = F(this.data)), void this.initSort();
|
|
var e = this.searchText && (this.fromHtml ? L.escapeHTML(this.searchText) : this.searchText),
|
|
i = e ? e.toLowerCase() : "",
|
|
o = L.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
|
|
this.options.searchAccentNeutralise && (i = L.normalizeAccent(i)), "function" == typeof this.filterOptions.filterAlgorithm ? this.data = this.options.data.filter((function(e) {
|
|
return t.filterOptions.filterAlgorithm.apply(null, [e, o])
|
|
})) : "string" == typeof this.filterOptions.filterAlgorithm && (this.data = o ? this.options.data.filter((function(e) {
|
|
var i = t.filterOptions.filterAlgorithm;
|
|
if ("and" === i) {
|
|
for (var s in o)
|
|
if (Array.isArray(o[s]) && !o[s].includes(e[s]) || !Array.isArray(o[s]) && e[s] !== o[s]) return !1
|
|
} else if ("or" === i) {
|
|
var n = !1;
|
|
for (var a in o)(Array.isArray(o[a]) && o[a].includes(e[a]) || !Array.isArray(o[a]) && e[a] === o[a]) && (n = !0);
|
|
return n
|
|
}
|
|
return !0
|
|
})) : F(this.options.data));
|
|
var s = this.getVisibleFields();
|
|
this.data = i ? this.data.filter((function(o, n) {
|
|
for (var a = 0; a < t.header.fields.length; a++)
|
|
if (t.header.searchables[a] && (!t.options.visibleSearch || -1 !== s.indexOf(t.header.fields[a]))) {
|
|
var r = L.isNumeric(t.header.fields[a]) ? parseInt(t.header.fields[a], 10) : t.header.fields[a],
|
|
l = t.columns[t.fieldsColumnsIndex[r]],
|
|
c = void 0;
|
|
if ("string" != typeof r || o.hasOwnProperty(r)) c = o[r];
|
|
else {
|
|
c = o;
|
|
for (var h = r.split("."), d = 0; d < h.length; d++) {
|
|
if (null === c[h[d]]) {
|
|
c = null;
|
|
break
|
|
}
|
|
c = c[h[d]]
|
|
}
|
|
}
|
|
if (t.options.searchAccentNeutralise && (c = L.normalizeAccent(c)), l && l.searchFormatter && (c = L.calculateObjectValue(l, t.header.formatters[a], [c, o, n, l.field], c)), "string" == typeof c || "number" == typeof c) {
|
|
if (t.options.strictSearch && "".concat(c).toLowerCase() === i || t.options.regexSearch && L.regexCompare(c, e)) return !0;
|
|
var u = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm.exec(t.searchText),
|
|
p = !1;
|
|
if (u) {
|
|
var f = u[1] || "".concat(u[5], "l"),
|
|
g = u[2] || u[3],
|
|
v = parseInt(c, 10),
|
|
m = parseInt(g, 10);
|
|
switch (f) {
|
|
case ">":
|
|
case "<l":
|
|
p = v > m;
|
|
break;
|
|
case "<":
|
|
case ">l":
|
|
p = v < m;
|
|
break;
|
|
case "<=":
|
|
case "=<":
|
|
case ">=l":
|
|
case "=>l":
|
|
p = v <= m;
|
|
break;
|
|
case ">=":
|
|
case "=>":
|
|
case "<=l":
|
|
case "=<l":
|
|
p = v >= m
|
|
}
|
|
}
|
|
if (p || "".concat(c).toLowerCase().includes(i)) return !0
|
|
}
|
|
}
|
|
return !1
|
|
})) : this.data, this.options.sortReset && (this.unsortedData = F(this.data)), this.initSort()
|
|
}
|
|
}
|
|
}, {
|
|
key: "initPagination",
|
|
value: function() {
|
|
var t = this,
|
|
e = this.options;
|
|
if (e.pagination) {
|
|
this.$pagination.show();
|
|
var i, o, s, n, a, r, l, c = [],
|
|
h = !1,
|
|
d = this.getData({
|
|
includeHiddenRows: !1
|
|
}),
|
|
u = e.pageList;
|
|
if ("string" == typeof u && (u = u.replace(/\[|\]| /g, "").toLowerCase().split(",")), u = u.map((function(t) {
|
|
return "string" == typeof t ? t.toLowerCase() === e.formatAllRows().toLowerCase() || ["all", "unlimited"].includes(t.toLowerCase()) ? e.formatAllRows() : +t : t
|
|
})), this.paginationParts = e.paginationParts, "string" == typeof this.paginationParts && (this.paginationParts = this.paginationParts.replace(/\[|\]| |'/g, "").split(",")), "server" !== e.sidePagination && (e.totalRows = d.length), this.totalPages = 0, e.totalRows && (e.pageSize === e.formatAllRows() && (e.pageSize = e.totalRows, h = !0), this.totalPages = 1 + ~~((e.totalRows - 1) / e.pageSize), e.totalPages = this.totalPages), this.totalPages > 0 && e.pageNumber > this.totalPages && (e.pageNumber = this.totalPages), this.pageFrom = (e.pageNumber - 1) * e.pageSize + 1, this.pageTo = e.pageNumber * e.pageSize, this.pageTo > e.totalRows && (this.pageTo = e.totalRows), this.options.pagination && "server" !== this.options.sidePagination && (this.options.totalNotFiltered = this.options.data.length), this.options.showExtendedPagination || (this.options.totalNotFiltered = void 0), (this.paginationParts.includes("pageInfo") || this.paginationParts.includes("pageInfoShort") || this.paginationParts.includes("pageSize")) && c.push('<div class="'.concat(this.constants.classes.pull, "-").concat(e.paginationDetailHAlign, ' pagination-detail">')), this.paginationParts.includes("pageInfo") || this.paginationParts.includes("pageInfoShort")) {
|
|
var p = this.options.totalRows + ("client" === this.options.sidePagination && this.options.paginationLoadMore && !this._paginationLoaded ? " +" : ""),
|
|
f = this.paginationParts.includes("pageInfoShort") ? e.formatDetailPagination(p) : e.formatShowingRows(this.pageFrom, this.pageTo, p, e.totalNotFiltered);
|
|
c.push('<span class="pagination-info">\n '.concat(f, "\n </span>"))
|
|
}
|
|
if (this.paginationParts.includes("pageSize")) {
|
|
c.push('<div class="page-list">');
|
|
var g = ['<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(h ? e.formatAllRows() : e.pageSize, "\n </span>\n ").concat(this.constants.html.dropdownCaret, "\n </button>\n ").concat(this.constants.html.pageDropdown[0])];
|
|
u.forEach((function(i, o) {
|
|
var s;
|
|
(!e.smartDisplay || 0 === o || u[o - 1] < e.totalRows || i === e.formatAllRows()) && (s = h ? i === e.formatAllRows() ? t.constants.classes.dropdownActive : "" : i === e.pageSize ? t.constants.classes.dropdownActive : "", g.push(L.sprintf(t.constants.html.pageDropdownItem, s, i)))
|
|
})), g.push("".concat(this.constants.html.pageDropdown[1], "</div>")), c.push(e.formatRecordsPerPage(g.join("")))
|
|
}
|
|
if ((this.paginationParts.includes("pageInfo") || this.paginationParts.includes("pageInfoShort") || this.paginationParts.includes("pageSize")) && c.push("</div></div>"), this.paginationParts.includes("pageList")) {
|
|
c.push('<div class="'.concat(this.constants.classes.pull, "-").concat(e.paginationHAlign, ' pagination">'), L.sprintf(this.constants.html.pagination[0], L.sprintf(" pagination-%s", e.iconSize)), L.sprintf(this.constants.html.paginationItem, " page-pre", e.formatSRPaginationPreText(), e.paginationPreText)), this.totalPages < e.paginationSuccessivelySize ? (o = 1, s = this.totalPages) : s = (o = e.pageNumber - e.paginationPagesBySide) + 2 * e.paginationPagesBySide, e.pageNumber < e.paginationSuccessivelySize - 1 && (s = e.paginationSuccessivelySize), e.paginationSuccessivelySize > this.totalPages - o && (o = o - (e.paginationSuccessivelySize - (this.totalPages - o)) + 1), o < 1 && (o = 1), s > this.totalPages && (s = this.totalPages);
|
|
var v = Math.round(e.paginationPagesBySide / 2),
|
|
m = function(i) {
|
|
var o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
|
|
return L.sprintf(t.constants.html.paginationItem, o + (i === e.pageNumber ? " ".concat(t.constants.classes.paginationActive) : ""), e.formatSRPaginationPageText(i), i)
|
|
};
|
|
if (o > 1) {
|
|
var b = e.paginationPagesBySide;
|
|
for (b >= o && (b = o - 1), i = 1; i <= b; i++) c.push(m(i));
|
|
o - 1 === b + 1 ? (i = o - 1, c.push(m(i))) : o - 1 > b && (o - 2 * e.paginationPagesBySide > e.paginationPagesBySide && e.paginationUseIntermediate ? (i = Math.round((o - v) / 2 + v), c.push(m(i, " page-intermediate"))) : c.push(L.sprintf(this.constants.html.paginationItem, " page-first-separator disabled", "", "...")))
|
|
}
|
|
for (i = o; i <= s; i++) c.push(m(i));
|
|
if (this.totalPages > s) {
|
|
var y = this.totalPages - (e.paginationPagesBySide - 1);
|
|
for (s >= y && (y = s + 1), s + 1 === y - 1 ? (i = s + 1, c.push(m(i))) : y > s + 1 && (this.totalPages - s > 2 * e.paginationPagesBySide && e.paginationUseIntermediate ? (i = Math.round((this.totalPages - v - s) / 2 + s), c.push(m(i, " page-intermediate"))) : c.push(L.sprintf(this.constants.html.paginationItem, " page-last-separator disabled", "", "..."))), i = y; i <= this.totalPages; i++) c.push(m(i))
|
|
}
|
|
c.push(L.sprintf(this.constants.html.paginationItem, " page-next", e.formatSRPaginationNextText(), e.paginationNextText)), c.push(this.constants.html.pagination[1], "</div>")
|
|
}
|
|
this.$pagination.html(c.join(""));
|
|
var w = ["bottom", "both"].includes(e.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : "";
|
|
this.$pagination.last().find(".page-list > div").addClass(w), e.onlyInfoPagination || (n = this.$pagination.find(".page-list a"), a = this.$pagination.find(".page-pre"), r = this.$pagination.find(".page-next"), l = this.$pagination.find(".page-item").not(".page-next, .page-pre, .page-last-separator, .page-first-separator"), this.totalPages <= 1 && this.$pagination.find("div.pagination").hide(), e.smartDisplay && (u.length < 2 || e.totalRows <= u[0]) && this.$pagination.find("div.page-list").hide(), this.$pagination[this.getData().length ? "show" : "hide"](), e.paginationLoop || (1 === e.pageNumber && a.addClass("disabled"), e.pageNumber === this.totalPages && r.addClass("disabled")), h && (e.pageSize = e.formatAllRows()), n.off("click").on("click", (function(e) {
|
|
return t.onPageListChange(e)
|
|
})), a.off("click").on("click", (function(e) {
|
|
return t.onPagePre(e)
|
|
})), r.off("click").on("click", (function(e) {
|
|
return t.onPageNext(e)
|
|
})), l.off("click").on("click", (function(e) {
|
|
return t.onPageNumber(e)
|
|
})))
|
|
} else this.$pagination.hide()
|
|
}
|
|
}, {
|
|
key: "updatePagination",
|
|
value: function(t) {
|
|
t && I(t.currentTarget).hasClass("disabled") || (this.options.maintainMetaData || this.resetRows(), this.initPagination(), this.trigger("page-change", this.options.pageNumber, this.options.pageSize), "server" === this.options.sidePagination || "client" === this.options.sidePagination && this.options.paginationLoadMore && !this._paginationLoaded && this.options.pageNumber === this.totalPages ? this.initServer() : this.initBody())
|
|
}
|
|
}, {
|
|
key: "onPageListChange",
|
|
value: function(t) {
|
|
t.preventDefault();
|
|
var e = I(t.currentTarget);
|
|
return e.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive), this.options.pageSize = e.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +e.text(), this.$toolbar.find(".page-size").text(this.options.pageSize), this.updatePagination(t), !1
|
|
}
|
|
}, {
|
|
key: "onPagePre",
|
|
value: function(t) {
|
|
if (!I(t.target).hasClass("disabled")) return t.preventDefault(), this.options.pageNumber - 1 == 0 ? this.options.pageNumber = this.options.totalPages : this.options.pageNumber--, this.updatePagination(t), !1
|
|
}
|
|
}, {
|
|
key: "onPageNext",
|
|
value: function(t) {
|
|
if (!I(t.target).hasClass("disabled")) return t.preventDefault(), this.options.pageNumber + 1 > this.options.totalPages ? this.options.pageNumber = 1 : this.options.pageNumber++, this.updatePagination(t), !1
|
|
}
|
|
}, {
|
|
key: "onPageNumber",
|
|
value: function(t) {
|
|
if (t.preventDefault(), this.options.pageNumber !== +I(t.currentTarget).text()) return this.options.pageNumber = +I(t.currentTarget).text(), this.updatePagination(t), !1
|
|
}
|
|
}, {
|
|
key: "initRow",
|
|
value: function(t, e, i, o) {
|
|
var s = this,
|
|
n = [],
|
|
a = {},
|
|
r = [],
|
|
l = "",
|
|
c = {},
|
|
h = [];
|
|
if (!(L.findIndex(this.hiddenRows, t) > -1)) {
|
|
if ((a = L.calculateObjectValue(this.options, this.options.rowStyle, [t, e], a)) && a.css)
|
|
for (var d = 0, u = Object.entries(a.css); d < u.length; d++) {
|
|
var p = B(u[d], 2),
|
|
f = p[0],
|
|
g = p[1];
|
|
r.push("".concat(f, ": ").concat(g))
|
|
}
|
|
if (c = L.calculateObjectValue(this.options, this.options.rowAttributes, [t, e], c))
|
|
for (var v = 0, m = Object.entries(c); v < m.length; v++) {
|
|
var b = B(m[v], 2),
|
|
y = b[0],
|
|
w = b[1];
|
|
h.push("".concat(y, '="').concat(L.escapeHTML(w), '"'))
|
|
}
|
|
if (t._data && !L.isEmptyObject(t._data))
|
|
for (var S = 0, x = Object.entries(t._data); S < x.length; S++) {
|
|
var k = B(x[S], 2),
|
|
j = k[0],
|
|
C = k[1];
|
|
if ("index" === j) return;
|
|
l += " data-".concat(j, "='").concat("object" === E(C) ? JSON.stringify(C) : C, "'")
|
|
}
|
|
// n.push("<tr", L.sprintf(" %s", h.length ? h.join(" ") : void 0), L.sprintf(' id="%s"', Array.isArray(t) ? void 0 : t._id), L.sprintf(' class="%s"', a.classes || (Array.isArray(t) ? void 0 : t._class)), L.sprintf(' style="%s"', Array.isArray(t) ? void 0 : t._style), ' data-index="'.concat(e, '"'), L.sprintf(' data-uniqueid="%s"', L.getItemField(t, this.options.uniqueId, !1)), L.sprintf(' data-has-detail-view="%s"', this.options.detailView && L.calculateObjectValue(null, this.options.detailFilter, [e, t]) ? "true" : void 0), L.sprintf("%s", l), ">"), this.options.cardView && n.push('<td colspan="'.concat(this.header.fields.length, '"><div class="card-views">'));
|
|
n.push("<tr", L.sprintf(" %s", h.length ? h.join(" ") : void 0), L.sprintf(' id="%s"', Array.isArray(t) ? void 0 : t._id), L.sprintf(' class="%s"', a.classes || (Array.isArray(t) ? void 0 : t._class)), L.sprintf(' style="%s"', Array.isArray(t) ? void 0 : t._style), ' data-index="'.concat(e, '"'), L.sprintf(' data-uniqueid="%s"', L.getItemField(t, this.options.uniqueId, !1)), L.sprintf(' data-has-detail-view="%s"', this.options.detailView && L.calculateObjectValue(null, this.options.detailFilter, [e, t]) ? "true" : void 0), L.sprintf("%s", l), ">"), this.options.cardView && n.push('<td colspan="'.concat(this.header.fields.length, '"><div class="card-views">'));
|
|
|
|
var O = "";
|
|
return L.hasDetailViewIcon(this.options) && (O = "<td>", L.calculateObjectValue(null, this.options.detailFilter, [e, t]) && (O += '\n <a class="detail-icon" href="#">\n '.concat(L.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n </a>\n ")), O += "</td>"), O && "right" !== this.options.detailViewAlign && n.push(O), this.header.fields.forEach((function(i, o) {
|
|
var a = s.columns[o],
|
|
l = "",
|
|
c = L.getItemField(t, i, s.options.escape, a.escape),
|
|
h = "",
|
|
d = "",
|
|
u = {},
|
|
p = "",
|
|
f = s.header.classes[o],
|
|
g = "",
|
|
v = "",
|
|
m = "",
|
|
b = "",
|
|
y = "",
|
|
w = "";
|
|
if ((!s.fromHtml && !s.autoMergeCells || void 0 !== c || a.checkbox || a.radio) && a.visible && (!s.options.cardView || a.cardVisible)) {
|
|
if (r.concat([s.header.styles[o]]).length && (v += "".concat(r.concat([s.header.styles[o]]).join("; "))), t["_".concat(i, "_style")] && (v += "".concat(t["_".concat(i, "_style")])), v && (g = ' style="'.concat(v, '"')), t["_".concat(i, "_id")] && (p = L.sprintf(' id="%s"', t["_".concat(i, "_id")])), t["_".concat(i, "_class")] && (f = L.sprintf(' class="%s"', t["_".concat(i, "_class")])), t["_".concat(i, "_rowspan")] && (b = L.sprintf(' rowspan="%s"', t["_".concat(i, "_rowspan")])), t["_".concat(i, "_colspan")] && (y = L.sprintf(' colspan="%s"', t["_".concat(i, "_colspan")])), t["_".concat(i, "_title")] && (w = L.sprintf(' title="%s"', t["_".concat(i, "_title")])), (u = L.calculateObjectValue(s.header, s.header.cellStyles[o], [c, t, e, i], u)).classes && (f = ' class="'.concat(u.classes, '"')), u.css) {
|
|
for (var S = [], x = 0, k = Object.entries(u.css); x < k.length; x++) {
|
|
var j = B(k[x], 2),
|
|
C = j[0],
|
|
O = j[1];
|
|
S.push("".concat(C, ": ").concat(O))
|
|
}
|
|
g = ' style="'.concat(S.concat(s.header.styles[o]).join("; "), '"')
|
|
}
|
|
if (h = L.calculateObjectValue(a, s.header.formatters[o], [c, t, e, i], c), a.checkbox || a.radio || (h = null == h ? s.options.undefinedText : h), a.searchable && s.searchText && s.options.searchHighlight && !a.checkbox && !a.radio) {
|
|
var P = "",
|
|
T = s.searchText.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
if (s.options.searchAccentNeutralise) {
|
|
var $ = new RegExp("".concat(L.normalizeAccent(T)), "gmi").exec(L.normalizeAccent(h));
|
|
$ && (T = h.substring($.index, $.index + T.length))
|
|
}
|
|
var A = new RegExp("(".concat(T, ")"), "gim"),
|
|
I = "<mark>$1</mark>";
|
|
if (h && /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(h)) {
|
|
var R = (new DOMParser).parseFromString(h.toString(), "text/html").documentElement.textContent,
|
|
_ = R.replace(A, I);
|
|
R = R.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), P = h.replace(new RegExp("(>\\s*)(".concat(R, ")(\\s*)"), "gm"), "$1".concat(_, "$3"))
|
|
} else P = h.toString().replace(A, I);
|
|
// console.log('格式化高亮搜索',t,e,i,o,h)
|
|
h = L.calculateObjectValue(a, a.searchHighlightFormatter, [h, s.searchText,t,e,i,o], P)
|
|
}
|
|
if (t["_".concat(i, "_data")] && !L.isEmptyObject(t["_".concat(i, "_data")]))
|
|
for (var D = 0, V = Object.entries(t["_".concat(i, "_data")]); D < V.length; D++) {
|
|
var F = B(V[D], 2),
|
|
N = F[0],
|
|
E = F[1];
|
|
if ("index" === N) return;
|
|
m += " data-".concat(N, '="').concat(E, '"')
|
|
}
|
|
if (a.checkbox || a.radio) {
|
|
d = a.checkbox ? "checkbox" : d, d = a.radio ? "radio" : d;
|
|
var H = a.class || "",
|
|
q = L.isObject(h) && h.hasOwnProperty("checked") ? h.checked : (!0 === h || c) && !1 !== h,
|
|
U = !a.checkboxEnabled || h && h.disabled;
|
|
l = [s.options.cardView ? '<div class="card-view '.concat(H, '">') : '<td class="bs-checkbox '.concat(H, '"').concat(f).concat(g, ">"), '<label>\n <input\n data-index="'.concat(e, '"\n name="').concat(s.options.selectItemName, '"\n type="').concat(d, '"\n ').concat(L.sprintf('value="%s"', t[s.options.idField]), "\n ").concat(L.sprintf('checked="%s"', q ? "checked" : void 0), "\n ").concat(L.sprintf('disabled="%s"', U ? "disabled" : void 0), " />\n <span></span>\n </label>"), s.header.formatters[o] && "string" == typeof h ? h : "", s.options.cardView ? "</div>" : "</td>"].join(""), t[s.header.stateField] = !0 === h || !!c || h && h.checked
|
|
} else if (s.options.cardView) {
|
|
var z = s.options.showHeader ? '<span class="card-view-title '.concat(u.classes || "", '"').concat(g, ">").concat(L.getFieldTitle(s.columns, i), "</span>") : "";
|
|
l = '<div class="card-view">'.concat(z, '<span class="card-view-value ').concat(u.classes || "", '"').concat(g, ">").concat(h, "</span></div>"), s.options.smartDisplay && "" === h && (l = '<div class="card-view"></div>')
|
|
} else l = "<td".concat(p).concat(f).concat(g).concat(m).concat(b).concat(y).concat(w, ">").concat(h, "</td>");
|
|
n.push(l)
|
|
}
|
|
})), O && "right" === this.options.detailViewAlign && n.push(O), this.options.cardView && n.push("</div></td>"), n.push("</tr>"), n.join("")
|
|
}
|
|
}
|
|
}, {
|
|
key: "initBody",
|
|
value: function(t, e) {
|
|
var i = this,
|
|
o = this.getData();
|
|
this.trigger("pre-body", o), this.$body = this.$el.find(">tbody"), this.$body.length || (this.$body = I("<tbody></tbody>").appendTo(this.$el)), this.options.pagination && "server" !== this.options.sidePagination || (this.pageFrom = 1, this.pageTo = o.length);
|
|
var s = [],
|
|
n = I(document.createDocumentFragment()),
|
|
a = !1,
|
|
r = [];
|
|
this.autoMergeCells = L.checkAutoMergeCells(o.slice(this.pageFrom - 1, this.pageTo));
|
|
for (var l = this.pageFrom - 1; l < this.pageTo; l++) {
|
|
var c = o[l],
|
|
h = this.initRow(c, l, o, n);
|
|
if (a = a || !!h, h && "string" == typeof h) {
|
|
var d = this.options.uniqueId;
|
|
if (d && c.hasOwnProperty(d)) {
|
|
var u = c[d],
|
|
p = this.$body.find(L.sprintf('> tr[data-uniqueid="%s"][data-has-detail-view]', u)).next();
|
|
p.is("tr.detail-view") && (r.push(l), e && u === e || (h += p[0].outerHTML))
|
|
}
|
|
this.options.virtualScroll ? s.push(h) : n.append(h)
|
|
}
|
|
}
|
|
a ? this.options.virtualScroll ? (this.virtualScroll && this.virtualScroll.destroy(), this.virtualScroll = new K({
|
|
rows: s,
|
|
fixedScroll: t,
|
|
scrollEl: this.$tableBody[0],
|
|
contentEl: this.$body[0],
|
|
itemHeight: this.options.virtualScrollItemHeight,
|
|
callback: function(t, e) {
|
|
i.fitHeader(), i.initBodyEvent(), i.trigger("virtual-scroll", t, e)
|
|
}
|
|
})) : this.$body.html(n) : this.$body.html('<tr class="no-records-found">'.concat(L.sprintf('<td colspan="%s">%s</td>', this.getVisibleFields().length + L.getDetailViewIndexOffset(this.options), this.options.formatNoMatches()), "</tr>")), r.forEach((function(t) {
|
|
i.expandRow(t)
|
|
})), t || this.scrollTo(0), this.initBodyEvent(), this.initFooter(), this.resetView(), this.updateSelected(), "server" !== this.options.sidePagination && (this.options.totalRows = o.length), this.trigger("post-body", o)
|
|
}
|
|
}, {
|
|
key: "initBodyEvent",
|
|
value: function() {
|
|
var t = this;
|
|
this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick", (function(e) {
|
|
var i = I(e.currentTarget);
|
|
if (!(i.find(".detail-icon").length || i.index() - L.getDetailViewIndexOffset(t.options) < 0)) {
|
|
var o = i.parent(),
|
|
s = I(e.target).parents(".card-views").children(),
|
|
n = I(e.target).parents(".card-view"),
|
|
a = o.data("index"),
|
|
r = t.data[a],
|
|
l = t.options.cardView ? s.index(n) : i[0].cellIndex,
|
|
c = t.getVisibleFields()[l - L.getDetailViewIndexOffset(t.options)],
|
|
h = t.columns[t.fieldsColumnsIndex[c]],
|
|
d = L.getItemField(r, c, t.options.escape, h.escape);
|
|
if (t.trigger("click" === e.type ? "click-cell" : "dbl-click-cell", c, d, r, i), t.trigger("click" === e.type ? "click-row" : "dbl-click-row", r, o, c), "click" === e.type && t.options.clickToSelect && h.clickToSelect && !L.calculateObjectValue(t.options, t.options.ignoreClickToSelectOn, [e.target])) {
|
|
var u = o.find(L.sprintf('[name="%s"]', t.options.selectItemName));
|
|
u.length && u[0].click()
|
|
}
|
|
"click" === e.type && t.options.detailViewByClick && t.toggleDetailView(a, t.header.detailFormatters[t.fieldsColumnsIndex[c]])
|
|
}
|
|
})).off("mousedown").on("mousedown", (function(e) {
|
|
t.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey, t.multipleSelectRowShiftKey = e.shiftKey
|
|
})), this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click", (function(e) {
|
|
return e.preventDefault(), t.toggleDetailView(I(e.currentTarget).parent().parent().data("index")), !1
|
|
})), this.$selectItem = this.$body.find(L.sprintf('[name="%s"]', this.options.selectItemName)), this.$selectItem.off("click").on("click", (function(e) {
|
|
e.stopImmediatePropagation();
|
|
var i = I(e.currentTarget);
|
|
t._toggleCheck(i.prop("checked"), i.data("index"))
|
|
})), this.header.events.forEach((function(e, i) {
|
|
var o = e;
|
|
if (o) {
|
|
if ("string" == typeof o && (o = L.calculateObjectValue(null, o)), !o) throw new Error("Unknown event in the scope: ".concat(e));
|
|
var s = t.header.fields[i],
|
|
n = t.getVisibleFields().indexOf(s);
|
|
if (-1 !== n) {
|
|
n += L.getDetailViewIndexOffset(t.options);
|
|
var a = function(e) {
|
|
if (!o.hasOwnProperty(e)) return 1;
|
|
var i = o[e];
|
|
t.$body.find(">tr:not(.no-records-found)").each((function(o, a) {
|
|
var r = I(a),
|
|
l = r.find(t.options.cardView ? ".card-views>.card-view" : ">td").eq(n),
|
|
c = e.indexOf(" "),
|
|
h = e.substring(0, c),
|
|
d = e.substring(c + 1);
|
|
l.find(d).off(h).on(h, (function(e) {
|
|
var o = r.data("index"),
|
|
n = t.data[o],
|
|
a = n[s];
|
|
i.apply(t, [e, a, n, o])
|
|
}))
|
|
}))
|
|
};
|
|
for (var r in o) a(r)
|
|
}
|
|
}
|
|
}))
|
|
}
|
|
}, {
|
|
key: "initServer",
|
|
value: function(t, e, i) {
|
|
var o = this,
|
|
s = {},
|
|
n = this.header.fields.indexOf(this.options.sortName),
|
|
a = {
|
|
searchText: this.searchText,
|
|
sortName: this.options.sortName,
|
|
sortOrder: this.options.sortOrder
|
|
};
|
|
if (this.header.sortNames[n] && (a.sortName = this.header.sortNames[n]), this.options.pagination && "server" === this.options.sidePagination && (a.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize, a.pageNumber = this.options.pageNumber), i || this.options.url || this.options.ajax) {
|
|
if ("limit" === this.options.queryParamsType && (a = {
|
|
search: a.searchText,
|
|
sort: a.sortName,
|
|
order: a.sortOrder
|
|
}, this.options.pagination && "server" === this.options.sidePagination && (a.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1), a.limit = this.options.pageSize, 0 !== a.limit && this.options.pageSize !== this.options.formatAllRows() || delete a.limit)), this.options.search && "server" === this.options.sidePagination && this.options.searchable && this.columns.filter((function(t) {
|
|
return t.searchable
|
|
})).length) {
|
|
a.searchable = [];
|
|
var r, l = V(this.columns);
|
|
try {
|
|
for (l.s(); !(r = l.n()).done;) {
|
|
var c = r.value;
|
|
!c.checkbox && c.searchable && (this.options.visibleSearch && c.visible || !this.options.visibleSearch) && a.searchable.push(c.field)
|
|
}
|
|
} catch (t) {
|
|
l.e(t)
|
|
} finally {
|
|
l.f()
|
|
}
|
|
}
|
|
if (L.isEmptyObject(this.filterColumnsPartial) || (a.filter = JSON.stringify(this.filterColumnsPartial, null)), L.extend(a, e || {}), !1 !== (s = L.calculateObjectValue(this.options, this.options.queryParams, [a], s))) {
|
|
t || this.showLoading();
|
|
var h = L.extend({}, L.calculateObjectValue(null, this.options.ajaxOptions), {
|
|
type: this.options.method,
|
|
url: i || this.options.url,
|
|
data: "application/json" === this.options.contentType && "post" === this.options.method ? JSON.stringify(s) : s,
|
|
cache: this.options.cache,
|
|
contentType: this.options.contentType,
|
|
dataType: this.options.dataType,
|
|
success: function(e, i, s) {
|
|
var n = L.calculateObjectValue(o.options, o.options.responseHandler, [e, s], e);
|
|
"client" === o.options.sidePagination && o.options.paginationLoadMore && (o._paginationLoaded = o.data.length === n.length), o.load(n), o.trigger("load-success", n, s && s.status, s), t || o.hideLoading(), "server" === o.options.sidePagination && o.options.pageNumber > 1 && n[o.options.totalField] > 0 && !n[o.options.dataField].length && o.updatePagination()
|
|
},
|
|
error: function(e) {
|
|
if (e && 0 === e.status && o._xhrAbort) o._xhrAbort = !1;
|
|
else {
|
|
var i = [];
|
|
"server" === o.options.sidePagination && ((i = {})[o.options.totalField] = 0, i[o.options.dataField] = []), o.load(i), o.trigger("load-error", e && e.status, e), t || o.hideLoading()
|
|
}
|
|
}
|
|
});
|
|
return this.options.ajax ? L.calculateObjectValue(this, this.options.ajax, [h], null) : (this._xhr && 4 !== this._xhr.readyState && (this._xhrAbort = !0, this._xhr.abort()), this._xhr = I.ajax(h)), s
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "initSearchText",
|
|
value: function() {
|
|
if (this.options.search && (this.searchText = "", "" !== this.options.searchText)) {
|
|
var t = L.getSearchInput(this);
|
|
t.val(this.options.searchText), this.onSearch({
|
|
currentTarget: t,
|
|
firedByInitSearchText: !0
|
|
})
|
|
}
|
|
}
|
|
}, {
|
|
key: "getCaret",
|
|
value: function() {
|
|
var t = this;
|
|
this.$header.find("th").each((function(e, i) {
|
|
I(i).find(".sortable").removeClass("desc asc").addClass(I(i).data("field") === t.options.sortName ? t.options.sortOrder : "both")
|
|
}))
|
|
}
|
|
}, {
|
|
key: "updateSelected",
|
|
value: function() {
|
|
var t = this.$selectItem.filter(":enabled").length && this.$selectItem.filter(":enabled").length === this.$selectItem.filter(":enabled").filter(":checked").length;
|
|
this.$selectAll.add(this.$selectAll_).prop("checked", t), this.$selectItem.each((function(t, e) {
|
|
I(e).closest("tr")[I(e).prop("checked") ? "addClass" : "removeClass"]("selected")
|
|
}))
|
|
}
|
|
}, {
|
|
key: "updateRows",
|
|
value: function() {
|
|
var t = this;
|
|
this.$selectItem.each((function(e, i) {
|
|
t.data[I(i).data("index")][t.header.stateField] = I(i).prop("checked")
|
|
}))
|
|
}
|
|
}, {
|
|
key: "resetRows",
|
|
value: function() {
|
|
var t, e = V(this.data);
|
|
try {
|
|
for (e.s(); !(t = e.n()).done;) {
|
|
var i = t.value;
|
|
this.$selectAll.prop("checked", !1), this.$selectItem.prop("checked", !1), this.header.stateField && (i[this.header.stateField] = !1)
|
|
}
|
|
} catch (t) {
|
|
e.e(t)
|
|
} finally {
|
|
e.f()
|
|
}
|
|
this.initHiddenRows()
|
|
}
|
|
}, {
|
|
key: "trigger",
|
|
value: function(e) {
|
|
for (var i, o, s = "".concat(e, ".bs.table"), n = arguments.length, a = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++) a[r - 1] = arguments[r];
|
|
(i = this.options)[t.EVENTS[s]].apply(i, [].concat(a, [this])), this.$el.trigger(I.Event(s, {
|
|
sender: this
|
|
}), a), (o = this.options).onAll.apply(o, [s].concat([].concat(a, [this]))), this.$el.trigger(I.Event("all.bs.table", {
|
|
sender: this
|
|
}), [s, a])
|
|
}
|
|
}, {
|
|
key: "resetHeader",
|
|
value: function() {
|
|
var t = this;
|
|
clearTimeout(this.timeoutId_), this.timeoutId_ = setTimeout((function() {
|
|
return t.fitHeader()
|
|
}), this.$el.is(":hidden") ? 100 : 0)
|
|
}
|
|
}, {
|
|
key: "fitHeader",
|
|
value: function() {
|
|
var t = this;
|
|
if (this.$el.is(":hidden")) this.timeoutId_ = setTimeout((function() {
|
|
return t.fitHeader()
|
|
}), 100);
|
|
else {
|
|
var e = this.$tableBody.get(0),
|
|
i = this.hasScrollBar && e.scrollHeight > e.clientHeight + this.$header.outerHeight() ? L.getScrollBarWidth() : 0;
|
|
this.$el.css("margin-top", -this.$header.outerHeight());
|
|
var o = this.$tableHeader.find(":focus");
|
|
if (o.length > 0) {
|
|
var s = o.parents("th");
|
|
if (s.length > 0) {
|
|
var n = s.attr("data-field");
|
|
if (void 0 !== n) {
|
|
var a = this.$header.find("[data-field='".concat(n, "']"));
|
|
a.length > 0 && a.find(":input").addClass("focus-temp")
|
|
}
|
|
}
|
|
}
|
|
this.$header_ = this.$header.clone(!0, !0), this.$selectAll_ = this.$header_.find('[name="btSelectAll"]'), this.$tableHeader.css("margin-right", i).find("table").css("width", this.$el.outerWidth()).html("").attr("class", this.$el.attr("class")).append(this.$header_), this.$tableLoading.css("width", this.$el.outerWidth());
|
|
var r = I(".focus-temp:visible:eq(0)");
|
|
r.length > 0 && (r.focus(), this.$header.find(".focus-temp").removeClass("focus-temp")), this.$header.find("th[data-field]").each((function(e, i) {
|
|
t.$header_.find(L.sprintf('th[data-field="%s"]', I(i).data("field"))).data(I(i).data())
|
|
}));
|
|
for (var l = this.getVisibleFields(), c = this.$header_.find("th"), h = this.$body.find(">tr:not(.no-records-found,.virtual-scroll-top)").eq(0); h.length && h.find('>td[colspan]:not([colspan="1"])').length;) h = h.next();
|
|
var d = h.find("> *").length;
|
|
h.find("> *").each((function(e, i) {
|
|
var o = I(i);
|
|
if (L.hasDetailViewIcon(t.options) && (0 === e && "right" !== t.options.detailViewAlign || e === d - 1 && "right" === t.options.detailViewAlign)) {
|
|
var s = c.filter(".detail"),
|
|
n = s.innerWidth() - s.find(".fht-cell").width();
|
|
s.find(".fht-cell").width(o.innerWidth() - n)
|
|
} else {
|
|
var a = e - L.getDetailViewIndexOffset(t.options),
|
|
r = t.$header_.find(L.sprintf('th[data-field="%s"]', l[a]));
|
|
r.length > 1 && (r = I(c[o[0].cellIndex]));
|
|
var h = r.innerWidth() - r.find(".fht-cell").width();
|
|
r.find(".fht-cell").width(o.innerWidth() - h)
|
|
}
|
|
})), this.horizontalScroll(), this.trigger("post-header")
|
|
}
|
|
}
|
|
}, {
|
|
key: "initFooter",
|
|
value: function() {
|
|
if (this.options.showFooter && !this.options.cardView) {
|
|
var t = this.getData(),
|
|
e = [],
|
|
i = "";
|
|
L.hasDetailViewIcon(this.options) && (i = '<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>'), i && "right" !== this.options.detailViewAlign && e.push(i);
|
|
var o, s = V(this.columns);
|
|
try {
|
|
for (s.s(); !(o = s.n()).done;) {
|
|
var n, a, r = o.value,
|
|
l = [],
|
|
c = {},
|
|
h = L.sprintf(' class="%s"', r.class);
|
|
if (!(!r.visible || this.footerData && this.footerData.length > 0 && !(r.field in this.footerData[0]))) {
|
|
if (this.options.cardView && !r.cardVisible) return;
|
|
if (n = L.sprintf("text-align: %s; ", r.falign ? r.falign : r.align), a = L.sprintf("vertical-align: %s; ", r.valign), (c = L.calculateObjectValue(null, r.footerStyle || this.options.footerStyle, [r])) && c.css)
|
|
for (var d = 0, u = Object.entries(c.css); d < u.length; d++) {
|
|
var p = B(u[d], 2),
|
|
f = p[0],
|
|
g = p[1];
|
|
l.push("".concat(f, ": ").concat(g))
|
|
}
|
|
c && c.classes && (h = L.sprintf(' class="%s"', r.class ? [r.class, c.classes].join(" ") : c.classes)), e.push("<th", h, L.sprintf(' style="%s"', n + a + l.concat().join("; ") || void 0));
|
|
var v = 0;
|
|
this.footerData && this.footerData.length > 0 && (v = this.footerData[0]["_".concat(r.field, "_colspan")] || 0), v && e.push(' colspan="'.concat(v, '" ')), e.push(">"), e.push('<div class="th-inner">');
|
|
var m = "";
|
|
this.footerData && this.footerData.length > 0 && (m = this.footerData[0][r.field] || ""), e.push(L.calculateObjectValue(r, r.footerFormatter, [t, m], m)), e.push("</div>"), e.push('<div class="fht-cell"></div>'), e.push("</div>"), e.push("</th>")
|
|
}
|
|
}
|
|
} catch (t) {
|
|
s.e(t)
|
|
} finally {
|
|
s.f()
|
|
}
|
|
i && "right" === this.options.detailViewAlign && e.push(i), this.options.height || this.$tableFooter.length || (this.$el.append("<tfoot><tr></tr></tfoot>"), this.$tableFooter = this.$el.find("tfoot")), this.$tableFooter.find("tr").length || this.$tableFooter.html("<table><thead><tr></tr></thead></table>"), this.$tableFooter.find("tr").html(e.join("")), this.trigger("post-footer", this.$tableFooter)
|
|
}
|
|
}
|
|
}, {
|
|
key: "fitFooter",
|
|
value: function() {
|
|
var t = this;
|
|
if (this.$el.is(":hidden")) setTimeout((function() {
|
|
return t.fitFooter()
|
|
}), 100);
|
|
else {
|
|
var e = this.$tableBody.get(0),
|
|
i = this.hasScrollBar && e.scrollHeight > e.clientHeight + this.$header.outerHeight() ? L.getScrollBarWidth() : 0;
|
|
this.$tableFooter.css("margin-right", i).find("table").css("width", this.$el.outerWidth()).attr("class", this.$el.attr("class"));
|
|
var o = this.$tableFooter.find("th"),
|
|
s = this.$body.find(">tr:first-child:not(.no-records-found)");
|
|
for (o.find(".fht-cell").width("auto"); s.length && s.find('>td[colspan]:not([colspan="1"])').length;) s = s.next();
|
|
var n = s.find("> *").length;
|
|
s.find("> *").each((function(e, i) {
|
|
var s = I(i);
|
|
if (L.hasDetailViewIcon(t.options) && (0 === e && "left" === t.options.detailViewAlign || e === n - 1 && "right" === t.options.detailViewAlign)) {
|
|
var a = o.filter(".detail"),
|
|
r = a.innerWidth() - a.find(".fht-cell").width();
|
|
a.find(".fht-cell").width(s.innerWidth() - r)
|
|
} else {
|
|
var l = o.eq(e),
|
|
c = l.innerWidth() - l.find(".fht-cell").width();
|
|
l.find(".fht-cell").width(s.innerWidth() - c)
|
|
}
|
|
})), this.horizontalScroll()
|
|
}
|
|
}
|
|
}, {
|
|
key: "horizontalScroll",
|
|
value: function() {
|
|
var t = this;
|
|
this.$tableBody.off("scroll").on("scroll", (function() {
|
|
var e = t.$tableBody.scrollLeft();
|
|
t.options.showHeader && t.options.height && t.$tableHeader.scrollLeft(e), t.options.showFooter && !t.options.cardView && t.$tableFooter.scrollLeft(e), t.trigger("scroll-body", t.$tableBody)
|
|
}))
|
|
}
|
|
}, {
|
|
key: "getVisibleFields",
|
|
value: function() {
|
|
var t, e = [],
|
|
i = V(this.header.fields);
|
|
try {
|
|
for (i.s(); !(t = i.n()).done;) {
|
|
var o = t.value,
|
|
s = this.columns[this.fieldsColumnsIndex[o]];
|
|
s && s.visible && (!this.options.cardView || s.cardVisible) && e.push(o)
|
|
}
|
|
} catch (t) {
|
|
i.e(t)
|
|
} finally {
|
|
i.f()
|
|
}
|
|
return e
|
|
}
|
|
}, {
|
|
key: "initHiddenRows",
|
|
value: function() {
|
|
this.hiddenRows = []
|
|
}
|
|
}, {
|
|
key: "getOptions",
|
|
value: function() {
|
|
var t = L.extend({}, this.options);
|
|
return delete t.data, L.extend(!0, {}, t)
|
|
}
|
|
}, {
|
|
key: "refreshOptions",
|
|
value: function(t) {
|
|
L.compareObjects(this.options, t, !0) || (this.options = L.extend(this.options, t), this.trigger("refresh-options", this.options), this.destroy(), this.init())
|
|
}
|
|
}, {
|
|
key: "getData",
|
|
value: function(t) {
|
|
var e = this,
|
|
i = this.options.data;
|
|
if (!(this.searchText || this.options.customSearch || void 0 !== this.options.sortName || this.enableCustomSort) && L.isEmptyObject(this.filterColumns) && "function" != typeof this.options.filterOptions.filterAlgorithm && L.isEmptyObject(this.filterColumnsPartial) || t && t.unfiltered || (i = this.data), t && !t.includeHiddenRows) {
|
|
var o = this.getHiddenRows();
|
|
i = i.filter((function(t) {
|
|
return -1 === L.findIndex(o, t)
|
|
}))
|
|
}
|
|
return t && t.useCurrentPage && (i = i.slice(this.pageFrom - 1, this.pageTo)), t && t.formatted ? i.map((function(t) {
|
|
for (var i = 0, o = Object.entries(t); i < o.length; i++) {
|
|
var s = B(o[i], 2),
|
|
n = s[0],
|
|
a = s[1],
|
|
r = e.columns[e.fieldsColumnsIndex[n]];
|
|
if (r) return L.calculateObjectValue(r, e.header.formatters[r.fieldIndex], [a, t, t.index, r.field], a)
|
|
}
|
|
})) : i
|
|
}
|
|
}, {
|
|
key: "getSelections",
|
|
value: function() {
|
|
var t = this;
|
|
return (this.options.maintainMetaData ? this.options.data : this.data).filter((function(e) {
|
|
return !0 === e[t.header.stateField]
|
|
}))
|
|
}
|
|
}, {
|
|
key: "load",
|
|
value: function(t) {
|
|
var e, i = t;
|
|
this.options.pagination && "server" === this.options.sidePagination && (this.options.totalRows = i[this.options.totalField], this.options.totalNotFiltered = i[this.options.totalNotFilteredField], this.footerData = i[this.options.footerField] ? [i[this.options.footerField]] : void 0), e = this.options.fixedScroll || i.fixedScroll, i = Array.isArray(i) ? i : i[this.options.dataField], this.initData(i), this.initSearch(), this.initPagination(), this.initBody(e)
|
|
}
|
|
}, {
|
|
key: "append",
|
|
value: function(t) {
|
|
this.initData(t, "append"), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0)
|
|
}
|
|
}, {
|
|
key: "prepend",
|
|
value: function(t) {
|
|
this.initData(t, "prepend"), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0)
|
|
}
|
|
}, {
|
|
key: "remove",
|
|
value: function(t) {
|
|
for (var e = 0, i = this.options.data.length - 1; i >= 0; i--) {
|
|
var o = this.options.data[i],
|
|
s = L.getItemField(o, t.field, this.options.escape, o.escape);
|
|
void 0 === s && "$index" !== t.field || (!o.hasOwnProperty(t.field) && "$index" === t.field && t.values.includes(i) || t.values.includes(s)) && (e++, this.options.data.splice(i, 1))
|
|
}
|
|
e && ("server" === this.options.sidePagination && (this.options.totalRows -= e, this.data = F(this.options.data)), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0))
|
|
}
|
|
}, {
|
|
key: "removeAll",
|
|
value: function() {
|
|
this.options.data.length > 0 && (this.options.data.splice(0, this.options.data.length), this.initSearch(), this.initPagination(), this.initBody(!0))
|
|
}
|
|
}, {
|
|
key: "insertRow",
|
|
value: function(t) {
|
|
t.hasOwnProperty("index") && t.hasOwnProperty("row") && (this.options.data.splice(t.index, 0, t.row), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0))
|
|
}
|
|
}, {
|
|
key: "updateRow",
|
|
value: function(t) {
|
|
var e, i = V(Array.isArray(t) ? t : [t]);
|
|
try {
|
|
for (i.s(); !(e = i.n()).done;) {
|
|
var o = e.value;
|
|
o.hasOwnProperty("index") && o.hasOwnProperty("row") && (o.hasOwnProperty("replace") && o.replace ? this.options.data[o.index] = o.row : L.extend(this.options.data[o.index], o.row))
|
|
}
|
|
} catch (t) {
|
|
i.e(t)
|
|
} finally {
|
|
i.f()
|
|
}
|
|
this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0)
|
|
}
|
|
}, {
|
|
key: "getRowByUniqueId",
|
|
value: function(t) {
|
|
var e, i, o = this.options.uniqueId,
|
|
s = t,
|
|
n = null;
|
|
for (e = this.options.data.length - 1; e >= 0; e--) {
|
|
i = this.options.data[e];
|
|
var a = L.getItemField(i, o, this.options.escape, i.escape);
|
|
if (void 0 !== a && ("string" == typeof a ? s = t.toString() : "number" == typeof a && (Number(a) === a && a % 1 == 0 ? s = parseInt(t, 10) : a === Number(a) && 0 !== a && (s = parseFloat(t))), a === s)) {
|
|
n = i;
|
|
break
|
|
}
|
|
}
|
|
return n
|
|
}
|
|
}, {
|
|
key: "updateByUniqueId",
|
|
value: function(t) {
|
|
var e, i = null,
|
|
o = V(Array.isArray(t) ? t : [t]);
|
|
try {
|
|
for (o.s(); !(e = o.n()).done;) {
|
|
var s = e.value;
|
|
if (s.hasOwnProperty("id") && s.hasOwnProperty("row")) {
|
|
var n = this.options.data.indexOf(this.getRowByUniqueId(s.id)); - 1 !== n && (s.hasOwnProperty("replace") && s.replace ? this.options.data[n] = s.row : L.extend(this.options.data[n], s.row), i = s.id)
|
|
}
|
|
}
|
|
} catch (t) {
|
|
o.e(t)
|
|
} finally {
|
|
o.f()
|
|
}
|
|
this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0, i)
|
|
}
|
|
}, {
|
|
key: "removeByUniqueId",
|
|
value: function(t) {
|
|
var e = this.options.data.length,
|
|
i = this.getRowByUniqueId(t);
|
|
i && this.options.data.splice(this.options.data.indexOf(i), 1), e !== this.options.data.length && ("server" === this.options.sidePagination && (this.options.totalRows -= 1, this.data = F(this.options.data)), this.initSearch(), this.initPagination(), this.initBody(!0))
|
|
}
|
|
}, {
|
|
key: "_updateCellOnly",
|
|
value: function(t, e) {
|
|
var i = this.initRow(this.options.data[e], e),
|
|
o = this.getVisibleFields().indexOf(t); - 1 !== o && (o += L.getDetailViewIndexOffset(this.options), this.$body.find(">tr[data-index=".concat(e, "]")).find(">td:eq(".concat(o, ")")).replaceWith(I(i).find(">td:eq(".concat(o, ")"))), this.initBodyEvent(), this.initFooter(), this.resetView(), this.updateSelected())
|
|
}
|
|
}, {
|
|
key: "updateCell",
|
|
value: function(t) {
|
|
t.hasOwnProperty("index") && t.hasOwnProperty("field") && t.hasOwnProperty("value") && (this.options.data[t.index][t.field] = t.value, !1 !== t.reinit ? (this.initSort(), this.initBody(!0)) : this._updateCellOnly(t.field, t.index))
|
|
}
|
|
}, {
|
|
key: "updateCellByUniqueId",
|
|
value: function(t) {
|
|
var e = this;
|
|
(Array.isArray(t) ? t : [t]).forEach((function(t) {
|
|
var i = t.id,
|
|
o = t.field,
|
|
s = t.value,
|
|
n = e.options.data.indexOf(e.getRowByUniqueId(i)); - 1 !== n && (e.options.data[n][o] = s)
|
|
})), !1 !== t.reinit ? (this.initSort(), this.initBody(!0)) : this._updateCellOnly(t.field, this.options.data.indexOf(this.getRowByUniqueId(t.id)))
|
|
}
|
|
}, {
|
|
key: "showRow",
|
|
value: function(t) {
|
|
this._toggleRow(t, !0)
|
|
}
|
|
}, {
|
|
key: "hideRow",
|
|
value: function(t) {
|
|
this._toggleRow(t, !1)
|
|
}
|
|
}, {
|
|
key: "_toggleRow",
|
|
value: function(t, e) {
|
|
var i;
|
|
if (t.hasOwnProperty("index") ? i = this.getData()[t.index] : t.hasOwnProperty("uniqueId") && (i = this.getRowByUniqueId(t.uniqueId)), i) {
|
|
var o = L.findIndex(this.hiddenRows, i);
|
|
e || -1 !== o ? e && o > -1 && this.hiddenRows.splice(o, 1) : this.hiddenRows.push(i), this.initBody(!0), this.initPagination()
|
|
}
|
|
}
|
|
}, {
|
|
key: "getHiddenRows",
|
|
value: function(t) {
|
|
if (t) return this.initHiddenRows(), this.initBody(!0), void this.initPagination();
|
|
var e, i = [],
|
|
o = V(this.getData());
|
|
try {
|
|
for (o.s(); !(e = o.n()).done;) {
|
|
var s = e.value;
|
|
this.hiddenRows.includes(s) && i.push(s)
|
|
}
|
|
} catch (t) {
|
|
o.e(t)
|
|
} finally {
|
|
o.f()
|
|
}
|
|
return this.hiddenRows = i, i
|
|
}
|
|
}, {
|
|
key: "showColumn",
|
|
value: function(t) {
|
|
var e = this;
|
|
(Array.isArray(t) ? t : [t]).forEach((function(t) {
|
|
e._toggleColumn(e.fieldsColumnsIndex[t], !0, !0)
|
|
}))
|
|
}
|
|
}, {
|
|
key: "hideColumn",
|
|
value: function(t) {
|
|
var e = this;
|
|
(Array.isArray(t) ? t : [t]).forEach((function(t) {
|
|
e._toggleColumn(e.fieldsColumnsIndex[t], !1, !0)
|
|
}))
|
|
}
|
|
}, {
|
|
key: "_toggleColumn",
|
|
value: function(t, e, i) {
|
|
if (void 0 !== t && this.columns[t].visible !== e && (this.columns[t].visible = e, this.initHeader(), this.initSearch(), this.initPagination(), this.initBody(), this.options.showColumns)) {
|
|
var o = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop("disabled", !1);
|
|
i && o.filter(L.sprintf('[value="%s"]', t)).prop("checked", e), o.filter(":checked").length <= this.options.minimumCountColumns && o.filter(":checked").prop("disabled", !0)
|
|
}
|
|
}
|
|
}, {
|
|
key: "getVisibleColumns",
|
|
value: function() {
|
|
var t = this;
|
|
return this.columns.filter((function(e) {
|
|
return e.visible && !t.isSelectionColumn(e)
|
|
}))
|
|
}
|
|
}, {
|
|
key: "getHiddenColumns",
|
|
value: function() {
|
|
return this.columns.filter((function(t) {
|
|
return !t.visible
|
|
}))
|
|
}
|
|
}, {
|
|
key: "isSelectionColumn",
|
|
value: function(t) {
|
|
return t.radio || t.checkbox
|
|
}
|
|
}, {
|
|
key: "showAllColumns",
|
|
value: function() {
|
|
this._toggleAllColumns(!0)
|
|
}
|
|
}, {
|
|
key: "hideAllColumns",
|
|
value: function() {
|
|
this._toggleAllColumns(!1)
|
|
}
|
|
}, {
|
|
key: "_toggleAllColumns",
|
|
value: function(t) {
|
|
var e, i = this,
|
|
o = V(this.columns.slice().reverse());
|
|
try {
|
|
for (o.s(); !(e = o.n()).done;) {
|
|
var s = e.value;
|
|
if (s.switchable) {
|
|
if (!t && this.options.showColumns && this.getVisibleColumns().filter((function(t) {
|
|
return t.switchable
|
|
})).length === this.options.minimumCountColumns) continue;
|
|
s.visible = t
|
|
}
|
|
}
|
|
} catch (t) {
|
|
o.e(t)
|
|
} finally {
|
|
o.f()
|
|
}
|
|
if (this.initHeader(), this.initSearch(), this.initPagination(), this.initBody(), this.options.showColumns) {
|
|
var n = this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop("disabled", !1);
|
|
t ? n.prop("checked", t) : n.get().reverse().forEach((function(e) {
|
|
n.filter(":checked").length > i.options.minimumCountColumns && I(e).prop("checked", t)
|
|
})), n.filter(":checked").length <= this.options.minimumCountColumns && n.filter(":checked").prop("disabled", !0)
|
|
}
|
|
}
|
|
}, {
|
|
key: "mergeCells",
|
|
value: function(t) {
|
|
var e, i, o = t.index,
|
|
s = this.getVisibleFields().indexOf(t.field),
|
|
n = t.rowspan || 1,
|
|
a = t.colspan || 1,
|
|
r = this.$body.find(">tr[data-index]");
|
|
s += L.getDetailViewIndexOffset(this.options);
|
|
var l = r.eq(o).find(">td").eq(s);
|
|
if (!(o < 0 || s < 0 || o >= this.data.length)) {
|
|
for (e = o; e < o + n; e++)
|
|
for (i = s; i < s + a; i++) r.eq(e).find(">td").eq(i).hide();
|
|
l.attr("rowspan", n).attr("colspan", a).show()
|
|
}
|
|
}
|
|
}, {
|
|
key: "checkAll",
|
|
value: function() {
|
|
this._toggleCheckAll(!0)
|
|
}
|
|
}, {
|
|
key: "uncheckAll",
|
|
value: function() {
|
|
this._toggleCheckAll(!1)
|
|
}
|
|
}, {
|
|
key: "_toggleCheckAll",
|
|
value: function(t) {
|
|
var e = this.getSelections();
|
|
this.$selectAll.add(this.$selectAll_).prop("checked", t), this.$selectItem.filter(":enabled").prop("checked", t), this.updateRows(), this.updateSelected();
|
|
var i = this.getSelections();
|
|
t ? this.trigger("check-all", i, e) : this.trigger("uncheck-all", i, e)
|
|
}
|
|
}, {
|
|
key: "checkInvert",
|
|
value: function() {
|
|
var t = this.$selectItem.filter(":enabled"),
|
|
e = t.filter(":checked");
|
|
t.each((function(t, e) {
|
|
I(e).prop("checked", !I(e).prop("checked"))
|
|
})), this.updateRows(), this.updateSelected(), this.trigger("uncheck-some", e), e = this.getSelections(), this.trigger("check-some", e)
|
|
}
|
|
}, {
|
|
key: "check",
|
|
value: function(t) {
|
|
this._toggleCheck(!0, t)
|
|
}
|
|
}, {
|
|
key: "uncheck",
|
|
value: function(t) {
|
|
this._toggleCheck(!1, t)
|
|
}
|
|
}, {
|
|
key: "_toggleCheck",
|
|
value: function(t, e) {
|
|
var i = this.$selectItem.filter('[data-index="'.concat(e, '"]')),
|
|
o = this.data[e];
|
|
if (i.is(":radio") || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
|
|
var s, n = V(this.options.data);
|
|
try {
|
|
for (n.s(); !(s = n.n()).done;) {
|
|
s.value[this.header.stateField] = !1
|
|
}
|
|
} catch (t) {
|
|
n.e(t)
|
|
} finally {
|
|
n.f()
|
|
}
|
|
this.$selectItem.filter(":checked").not(i).prop("checked", !1)
|
|
}
|
|
if (o[this.header.stateField] = t, this.options.multipleSelectRow) {
|
|
if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0)
|
|
for (var a = B(this.multipleSelectRowLastSelectedIndex < e ? [this.multipleSelectRowLastSelectedIndex, e] : [e, this.multipleSelectRowLastSelectedIndex], 2), r = a[0], l = a[1], c = r + 1; c < l; c++) this.data[c][this.header.stateField] = !0, this.$selectItem.filter('[data-index="'.concat(c, '"]')).prop("checked", !0);
|
|
this.multipleSelectRowCtrlKey = !1, this.multipleSelectRowShiftKey = !1, this.multipleSelectRowLastSelectedIndex = t ? e : -1
|
|
}
|
|
i.prop("checked", t), this.updateSelected(), this.trigger(t ? "check" : "uncheck", this.data[e], i)
|
|
}
|
|
}, {
|
|
key: "checkBy",
|
|
value: function(t) {
|
|
this._toggleCheckBy(!0, t)
|
|
}
|
|
}, {
|
|
key: "uncheckBy",
|
|
value: function(t) {
|
|
this._toggleCheckBy(!1, t)
|
|
}
|
|
}, {
|
|
key: "_toggleCheckBy",
|
|
value: function(t, e) {
|
|
var i = this;
|
|
if (e.hasOwnProperty("field") && e.hasOwnProperty("values")) {
|
|
var o = [];
|
|
this.data.forEach((function(s, n) {
|
|
if (!s.hasOwnProperty(e.field)) return !1;
|
|
if (e.values.includes(s[e.field])) {
|
|
var a = i.$selectItem.filter(":enabled").filter(L.sprintf('[data-index="%s"]', n)),
|
|
r = !!e.hasOwnProperty("onlyCurrentPage") && e.onlyCurrentPage;
|
|
if (!(a = t ? a.not(":checked") : a.filter(":checked")).length && r) return;
|
|
a.prop("checked", t), s[i.header.stateField] = t, o.push(s), i.trigger(t ? "check" : "uncheck", s, a)
|
|
}
|
|
})), this.updateSelected(), this.trigger(t ? "check-some" : "uncheck-some", o)
|
|
}
|
|
}
|
|
}, {
|
|
key: "refresh",
|
|
value: function(t) {
|
|
t && t.url && (this.options.url = t.url), t && t.pageNumber && (this.options.pageNumber = t.pageNumber), t && t.pageSize && (this.options.pageSize = t.pageSize), this.trigger("refresh", this.initServer(t && t.silent, t && t.query, t && t.url))
|
|
}
|
|
}, {
|
|
key: "destroy",
|
|
value: function() {
|
|
this.$el.insertBefore(this.$container), I(this.options.toolbar).insertBefore(this.$el), this.$container.next().remove(), this.$container.remove(), this.$el.html(this.$el_.html()).css("margin-top", "0").attr("class", this.$el_.attr("class") || "");
|
|
var t = L.getEventName("resize.bootstrap-table", this.$el.attr("id"));
|
|
I(window).off(t)
|
|
}
|
|
}, {
|
|
key: "resetView",
|
|
value: function(t) {
|
|
var e = 0;
|
|
if (t && t.height && (this.options.height = t.height), this.$tableContainer.toggleClass("has-card-view", this.options.cardView), this.options.height) {
|
|
var i = this.$tableBody.get(0);
|
|
this.hasScrollBar = i.scrollWidth > i.clientWidth
|
|
}
|
|
if (!this.options.cardView && this.options.showHeader && this.options.height ? (this.$tableHeader.show(), this.resetHeader(), e += this.$header.outerHeight(!0) + 1) : (this.$tableHeader.hide(), this.trigger("post-header")), !this.options.cardView && this.options.showFooter && (this.$tableFooter.show(), this.fitFooter(), this.options.height && (e += this.$tableFooter.outerHeight(!0))), this.$container.hasClass("fullscreen")) this.$tableContainer.css("height", ""), this.$tableContainer.css("width", "");
|
|
else if (this.options.height) {
|
|
this.$tableBorder && (this.$tableBorder.css("width", ""), this.$tableBorder.css("height", ""));
|
|
var o = this.$toolbar.outerHeight(!0),
|
|
s = this.$pagination.outerHeight(!0),
|
|
n = this.options.height - o - s,
|
|
a = this.$tableBody.find(">table"),
|
|
r = a.outerHeight();
|
|
if (this.$tableContainer.css("height", "".concat(n, "px")), this.$tableBorder && a.is(":visible")) {
|
|
var l = n - r - 2;
|
|
this.hasScrollBar && (l -= L.getScrollBarWidth()), this.$tableBorder.css("width", "".concat(a.outerWidth(), "px")), this.$tableBorder.css("height", "".concat(l, "px"))
|
|
}
|
|
}
|
|
this.options.cardView ? (this.$el.css("margin-top", "0"), this.$tableContainer.css("padding-bottom", "0"), this.$tableFooter.hide()) : (this.getCaret(), this.$tableContainer.css("padding-bottom", "".concat(e, "px"))), this.trigger("reset-view")
|
|
}
|
|
}, {
|
|
key: "showLoading",
|
|
value: function() {
|
|
this.$tableLoading.toggleClass("open", !0);
|
|
var t = this.options.loadingFontSize;
|
|
"auto" === this.options.loadingFontSize && (t = .04 * this.$tableLoading.width(), t = Math.max(12, t), t = Math.min(32, t), t = "".concat(t, "px")), this.$tableLoading.find(".loading-text").css("font-size", t)
|
|
}
|
|
}, {
|
|
key: "hideLoading",
|
|
value: function() {
|
|
this.$tableLoading.toggleClass("open", !1)
|
|
}
|
|
}, {
|
|
key: "togglePagination",
|
|
value: function() {
|
|
this.options.pagination = !this.options.pagination;
|
|
var t = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : "",
|
|
e = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : "";
|
|
this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(L.sprintf(this.constants.html.icon, this.options.iconsPrefix, t), " ").concat(e)), this.updatePagination(), this.trigger("toggle-pagination", this.options.pagination)
|
|
}
|
|
}, {
|
|
key: "toggleFullscreen",
|
|
value: function() {
|
|
this.$el.closest(".bootstrap-table").toggleClass("fullscreen"), this.resetView()
|
|
}
|
|
}, {
|
|
key: "toggleView",
|
|
value: function() {
|
|
this.options.cardView = !this.options.cardView, this.initHeader();
|
|
var t = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : "",
|
|
e = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : "";
|
|
this.$toolbar.find('button[name="toggle"]').html("".concat(L.sprintf(this.constants.html.icon, this.options.iconsPrefix, t), " ").concat(e)).attr("aria-label", e).attr("title", e), this.initBody(), this.trigger("toggle", this.options.cardView)
|
|
}
|
|
}, {
|
|
key: "resetSearch",
|
|
value: function(t) {
|
|
var e = L.getSearchInput(this),
|
|
i = t || "";
|
|
e.val(i), this.searchText = i, this.onSearch({
|
|
currentTarget: e
|
|
}, !1)
|
|
}
|
|
}, {
|
|
key: "filterBy",
|
|
value: function(t, e) {
|
|
this.filterOptions = L.isEmptyObject(e) ? this.options.filterOptions : L.extend(this.options.filterOptions, e), this.filterColumns = L.isEmptyObject(t) ? {} : t, this.options.pageNumber = 1, this.initSearch(), this.updatePagination()
|
|
}
|
|
}, {
|
|
key: "scrollTo",
|
|
value: function(t) {
|
|
var e = {
|
|
unit: "px",
|
|
value: 0
|
|
};
|
|
"object" === E(t) ? e = Object.assign(e, t) : "string" == typeof t && "bottom" === t ? e.value = this.$tableBody[0].scrollHeight : "string" != typeof t && "number" != typeof t || (e.value = t);
|
|
var i = e.value;
|
|
"rows" === e.unit && (i = 0, this.$body.find("> tr:lt(".concat(e.value, ")")).each((function(t, e) {
|
|
i += I(e).outerHeight(!0)
|
|
}))), this.$tableBody.scrollTop(i)
|
|
}
|
|
}, {
|
|
key: "getScrollPosition",
|
|
value: function() {
|
|
return this.$tableBody.scrollTop()
|
|
}
|
|
}, {
|
|
key: "selectPage",
|
|
value: function(t) {
|
|
t > 0 && t <= this.options.totalPages && (this.options.pageNumber = t, this.updatePagination())
|
|
}
|
|
}, {
|
|
key: "prevPage",
|
|
value: function() {
|
|
this.options.pageNumber > 1 && (this.options.pageNumber--, this.updatePagination())
|
|
}
|
|
}, {
|
|
key: "nextPage",
|
|
value: function() {
|
|
this.options.pageNumber < this.options.totalPages && (this.options.pageNumber++, this.updatePagination())
|
|
}
|
|
}, {
|
|
key: "toggleDetailView",
|
|
value: function(t, e) {
|
|
this.$body.find(L.sprintf('> tr[data-index="%s"]', t)).next().is("tr.detail-view") ? this.collapseRow(t) : this.expandRow(t, e), this.resetView()
|
|
}
|
|
}, {
|
|
key: "expandRow",
|
|
value: function(t, e) {
|
|
var i = this.data[t],
|
|
o = this.$body.find(L.sprintf('> tr[data-index="%s"][data-has-detail-view]', t));
|
|
if (this.options.detailViewIcon && o.find("a.detail-icon").html(L.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose)), !o.next().is("tr.detail-view")) {
|
|
o.after(L.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', o.children("td").length));
|
|
var s = o.next().find("td"),
|
|
n = e || this.options.detailFormatter,
|
|
a = L.calculateObjectValue(this.options, n, [t, i, s], "");
|
|
1 === s.length && s.append(a), this.trigger("expand-row", t, i, s)
|
|
}
|
|
}
|
|
}, {
|
|
key: "expandRowByUniqueId",
|
|
value: function(t) {
|
|
var e = this.getRowByUniqueId(t);
|
|
e && this.expandRow(this.data.indexOf(e))
|
|
}
|
|
}, {
|
|
key: "collapseRow",
|
|
value: function(t) {
|
|
var e = this.data[t],
|
|
i = this.$body.find(L.sprintf('> tr[data-index="%s"][data-has-detail-view]', t));
|
|
i.next().is("tr.detail-view") && (this.options.detailViewIcon && i.find("a.detail-icon").html(L.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen)), this.trigger("collapse-row", t, e, i.next()), i.next().remove())
|
|
}
|
|
}, {
|
|
key: "collapseRowByUniqueId",
|
|
value: function(t) {
|
|
var e = this.getRowByUniqueId(t);
|
|
e && this.collapseRow(this.data.indexOf(e))
|
|
}
|
|
}, {
|
|
key: "expandAllRows",
|
|
value: function() {
|
|
for (var t = this.$body.find("> tr[data-index][data-has-detail-view]"), e = 0; e < t.length; e++) this.expandRow(I(t[e]).data("index"))
|
|
}
|
|
}, {
|
|
key: "collapseAllRows",
|
|
value: function() {
|
|
for (var t = this.$body.find("> tr[data-index][data-has-detail-view]"), e = 0; e < t.length; e++) this.collapseRow(I(t[e]).data("index"))
|
|
}
|
|
}, {
|
|
key: "updateColumnTitle",
|
|
value: function(t) {
|
|
t.hasOwnProperty("field") && t.hasOwnProperty("title") && (this.columns[this.fieldsColumnsIndex[t.field]].title = this.options.escape && this.options.escapeTitle ? L.escapeHTML(t.title) : t.title, this.columns[this.fieldsColumnsIndex[t.field]].visible && (this.$header.find("th[data-field]").each((function(e, i) {
|
|
if (I(i).data("field") === t.field) return I(I(i).find(".th-inner")[0]).html(t.title), !1
|
|
})), this.resetView()))
|
|
}
|
|
}, {
|
|
key: "updateFormatText",
|
|
value: function(t, e) {
|
|
/^format/.test(t) && this.options[t] && ("string" == typeof e ? this.options[t] = function() {
|
|
return e
|
|
} : "function" == typeof e && (this.options[t] = e), this.initToolbar(), this.initPagination(), this.initBody())
|
|
}
|
|
}])
|
|
}();
|
|
return J.VERSION = G.VERSION, J.DEFAULTS = G.DEFAULTS, J.LOCALES = G.LOCALES, J.COLUMN_DEFAULTS = G.COLUMN_DEFAULTS, J.METHODS = G.METHODS, J.EVENTS = G.EVENTS, I.BootstrapTable = J, I.fn.bootstrapTable = function(t) {
|
|
for (var e = arguments.length, i = new Array(e > 1 ? e - 1 : 0), o = 1; o < e; o++) i[o - 1] = arguments[o];
|
|
var s;
|
|
return this.each((function(e, o) {
|
|
var n = I(o).data("bootstrap.table");
|
|
if ("string" == typeof t) {
|
|
var a;
|
|
if (!G.METHODS.includes(t)) throw new Error("Unknown method: ".concat(t));
|
|
if (!n) return;
|
|
return s = (a = n)[t].apply(a, i), void("destroy" === t && I(o).removeData("bootstrap.table"))
|
|
}
|
|
if (n) console.warn("You cannot initialize the table more than once!");
|
|
else {
|
|
var r = L.extend(!0, {}, J.DEFAULTS, I(o).data(), "object" === E(t) && t);
|
|
n = new I.BootstrapTable(o, r), I(o).data("bootstrap.table", n), n.init()
|
|
}
|
|
})), void 0 === s ? this : s
|
|
}, I.fn.bootstrapTable.Constructor = J, I.fn.bootstrapTable.theme = G.THEME, I.fn.bootstrapTable.VERSION = G.VERSION, I.fn.bootstrapTable.defaults = J.DEFAULTS, I.fn.bootstrapTable.columnDefaults = J.COLUMN_DEFAULTS, I.fn.bootstrapTable.events = J.EVENTS, I.fn.bootstrapTable.locales = J.LOCALES, I.fn.bootstrapTable.methods = J.METHODS, I.fn.bootstrapTable.utils = L, I((function() {
|
|
I('[data-toggle="table"]').bootstrapTable()
|
|
})), J
|
|
})); |