You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2771 lines
93 KiB
2771 lines
93 KiB
1 year ago
|
/*
|
||
|
* bootstrap-table - v1.12.2 - 2018-11-29
|
||
|
* https://github.com/wenzhixin/bootstrap-table
|
||
|
* Copyright (c) 2018 zhixin wen
|
||
|
* Licensed MIT License
|
||
|
*/
|
||
|
!(function (t) {
|
||
|
"use strict";
|
||
|
var i = 3;
|
||
|
try {
|
||
|
i = parseInt(t.fn.dropdown.Constructor.VERSION, 10);
|
||
|
} catch (t) {}
|
||
|
var e = {
|
||
|
3: {
|
||
|
buttonsClass: "default",
|
||
|
iconsPrefix: "glyphicon",
|
||
|
icons: {
|
||
|
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: "fas fa-filter icon-th",
|
||
|
detailOpen: "glyphicon-plus icon-plus",
|
||
|
detailClose: "glyphicon-minus icon-minus",
|
||
|
fullscreen: "glyphicon-fullscreen",
|
||
|
},
|
||
|
pullClass: "pull",
|
||
|
toobarDropdowHtml: ['<ul class="dropdown-menu" role="menu">', "</ul>"],
|
||
|
toobarDropdowItemHtml:
|
||
|
'<li role="menuitem" class="dropdown-item"><label class="px-0">%s</label></li>',
|
||
|
pageDropdownHtml: ['<ul class="dropdown-menu" role="menu">', "</ul>"],
|
||
|
pageDropdownItemHtml:
|
||
|
'<li role="menuitem" class="%s"><a href="#" class="dropdown-item">%s</a></li>',
|
||
|
},
|
||
|
4: {
|
||
|
buttonsClass: "secondary",
|
||
|
iconsPrefix: "fa",
|
||
|
icons: {
|
||
|
paginationSwitchDown: "fa-toggle-down",
|
||
|
paginationSwitchUp: "fa-toggle-up",
|
||
|
refresh: "fa-refresh",
|
||
|
toggleOff: "fa-toggle-off",
|
||
|
toggleOn: "fa-toggle-on",
|
||
|
columns: "fa-th-list",
|
||
|
detailOpen: "fa-plus",
|
||
|
detailClose: "fa-minus",
|
||
|
fullscreen: "fa-arrows-alt",
|
||
|
},
|
||
|
pullClass: "float",
|
||
|
toobarDropdowHtml: [
|
||
|
'<div class="dropdown-menu dropdown-menu-right">',
|
||
|
"</div>",
|
||
|
],
|
||
|
toobarDropdowItemHtml: '<label class="dropdown-item">%s</label>',
|
||
|
pageDropdownHtml: ['<div class="dropdown-menu">', "</div>"],
|
||
|
pageDropdownItemHtml: '<a class="dropdown-item %s" href="#">%s</a>',
|
||
|
},
|
||
|
}[i],
|
||
|
o = null,
|
||
|
s = function (t) {
|
||
|
var i = arguments,
|
||
|
e = !0,
|
||
|
o = 1;
|
||
|
return (
|
||
|
(t = t.replace(/%s/g, function () {
|
||
|
var t = i[o++];
|
||
|
return void 0 === t ? ((e = !1), "") : t;
|
||
|
})),
|
||
|
e ? t : ""
|
||
|
);
|
||
|
},
|
||
|
n = function (i, e, o, s) {
|
||
|
var n = "";
|
||
|
return (
|
||
|
t.each(i, function (t, i) {
|
||
|
return i[e] !== s || ((n = i[o]), !1);
|
||
|
}),
|
||
|
n
|
||
|
);
|
||
|
},
|
||
|
a = function () {
|
||
|
if (null === o) {
|
||
|
var i,
|
||
|
e,
|
||
|
s = t("<p/>").addClass("fixed-table-scroll-inner"),
|
||
|
n = t("<div/>").addClass("fixed-table-scroll-outer");
|
||
|
n.append(s),
|
||
|
t("body").append(n),
|
||
|
(i = s[0].offsetWidth),
|
||
|
n.css("overflow", "scroll"),
|
||
|
i === (e = s[0].offsetWidth) && (e = n[0].clientWidth),
|
||
|
n.remove(),
|
||
|
(o = i - e);
|
||
|
}
|
||
|
return o;
|
||
|
},
|
||
|
r = function (i, e, o, n) {
|
||
|
var a = e;
|
||
|
if ("string" == typeof e) {
|
||
|
var r = e.split(".");
|
||
|
r.length > 1
|
||
|
? ((a = window),
|
||
|
t.each(r, function (t, i) {
|
||
|
a = a[i];
|
||
|
}))
|
||
|
: (a = window[e]);
|
||
|
}
|
||
|
return "object" == typeof a
|
||
|
? a
|
||
|
: "function" == typeof a
|
||
|
? a.apply(i, o || [])
|
||
|
: !a && "string" == typeof e && s.apply(this, [e].concat(o))
|
||
|
? s.apply(this, [e].concat(o))
|
||
|
: n;
|
||
|
},
|
||
|
l = function (i, e, o) {
|
||
|
var s =
|
||
|
Object.getOwnPropertyNames ||
|
||
|
function (t) {
|
||
|
var i = [];
|
||
|
for (var e in t) t.hasOwnProperty(e) && i.push(e);
|
||
|
return i;
|
||
|
},
|
||
|
n = s(i),
|
||
|
a = s(e),
|
||
|
r = "";
|
||
|
if (o && n.length !== a.length) return !1;
|
||
|
for (var l = 0; l < n.length; l++)
|
||
|
if (((r = n[l]), t.inArray(r, a) > -1 && i[r] !== e[r])) return !1;
|
||
|
return !0;
|
||
|
},
|
||
|
h = function (t) {
|
||
|
return "string" == typeof t
|
||
|
? t
|
||
|
.replace(/&/g, "&")
|
||
|
.replace(/</g, "<")
|
||
|
.replace(/>/g, ">")
|
||
|
.replace(/"/g, """)
|
||
|
.replace(/'/g, "'")
|
||
|
.replace(/`/g, "`")
|
||
|
: t;
|
||
|
},
|
||
|
p = function (t) {
|
||
|
for (var i in t) {
|
||
|
var e = i
|
||
|
.split(/(?=[A-Z])/)
|
||
|
.join("-")
|
||
|
.toLowerCase();
|
||
|
e !== i && ((t[e] = t[i]), delete t[i]);
|
||
|
}
|
||
|
return t;
|
||
|
},
|
||
|
c = function (t, i, e) {
|
||
|
var o = t;
|
||
|
if ("string" != typeof i || t.hasOwnProperty(i))
|
||
|
return e ? h(t[i]) : t[i];
|
||
|
var s = i.split(".");
|
||
|
for (var n in s) s.hasOwnProperty(n) && (o = o && o[s[n]]);
|
||
|
return e ? h(o) : o;
|
||
|
},
|
||
|
d = function () {
|
||
|
return !!(
|
||
|
navigator.userAgent.indexOf("MSIE ") > 0 ||
|
||
|
navigator.userAgent.match(/Trident.*rv\:11\./)
|
||
|
);
|
||
|
},
|
||
|
u = function (i, e) {
|
||
|
(this.options = e),
|
||
|
(this.$el = t(i)),
|
||
|
(this.$el_ = this.$el.clone()),
|
||
|
(this.timeoutId_ = 0),
|
||
|
(this.timeoutFooter_ = 0),
|
||
|
this.init();
|
||
|
};
|
||
|
(u.DEFAULTS = {
|
||
|
classes: "table table-hover",
|
||
|
sortClass: void 0,
|
||
|
locale: void 0,
|
||
|
height: void 0,
|
||
|
undefinedText: "-",
|
||
|
sortName: void 0,
|
||
|
sortOrder: "asc",
|
||
|
sortStable: !1,
|
||
|
rememberOrder: !1,
|
||
|
striped: !1,
|
||
|
columns: [[]],
|
||
|
data: [],
|
||
|
totalField: "total",
|
||
|
dataField: "rows",
|
||
|
method: "get",
|
||
|
url: void 0,
|
||
|
ajax: void 0,
|
||
|
cache: !0,
|
||
|
contentType: "application/json",
|
||
|
dataType: "json",
|
||
|
ajaxOptions: {},
|
||
|
queryParams: function (t) {
|
||
|
return t;
|
||
|
},
|
||
|
queryParamsType: "limit",
|
||
|
responseHandler: function (t) {
|
||
|
return t;
|
||
|
},
|
||
|
pagination: !1,
|
||
|
onlyInfoPagination: !1,
|
||
|
paginationLoop: !0,
|
||
|
sidePagination: "client",
|
||
|
totalRows: 0,
|
||
|
pageNumber: 1,
|
||
|
pageSize: 10,
|
||
|
pageList: [10, 25, 50, 100],
|
||
|
paginationHAlign: "right",
|
||
|
paginationVAlign: "bottom",
|
||
|
paginationDetailHAlign: "left",
|
||
|
paginationPreText: "‹",
|
||
|
paginationNextText: "›",
|
||
|
search: !1,
|
||
|
searchOnEnterKey: !1,
|
||
|
strictSearch: !1,
|
||
|
searchAlign: "right",
|
||
|
selectItemName: "btSelectItem",
|
||
|
showHeader: !0,
|
||
|
showFooter: !1,
|
||
|
showColumns: !1,
|
||
|
showPaginationSwitch: !1,
|
||
|
showRefresh: !1,
|
||
|
showToggle: !1,
|
||
|
showFullscreen: !1,
|
||
|
smartDisplay: !0,
|
||
|
escape: !1,
|
||
|
minimumCountColumns: 1,
|
||
|
idField: void 0,
|
||
|
uniqueId: void 0,
|
||
|
cardView: !1,
|
||
|
detailView: !1,
|
||
|
detailFormatter: function (t, i) {
|
||
|
return "";
|
||
|
},
|
||
|
detailFilter: function (t, i) {
|
||
|
return !0;
|
||
|
},
|
||
|
trimOnSearch: !0,
|
||
|
clickToSelect: !1,
|
||
|
singleSelect: !1,
|
||
|
toolbar: void 0,
|
||
|
toolbarAlign: "left",
|
||
|
buttonsToolbar: void 0,
|
||
|
buttonsAlign: "right",
|
||
|
checkboxHeader: !0,
|
||
|
sortable: !0,
|
||
|
silentSort: !0,
|
||
|
maintainSelected: !1,
|
||
|
searchTimeOut: 500,
|
||
|
searchText: "",
|
||
|
iconSize: void 0,
|
||
|
buttonsClass: e.buttonsClass,
|
||
|
iconsPrefix: e.iconsPrefix,
|
||
|
icons: e.icons,
|
||
|
customSearch: t.noop,
|
||
|
customSort: t.noop,
|
||
|
ignoreClickToSelectOn: function (i) {
|
||
|
return t.inArray(i.tagName, ["A", "BUTTON"]);
|
||
|
},
|
||
|
rowStyle: function (t, i) {
|
||
|
return {};
|
||
|
},
|
||
|
rowAttributes: function (t, i) {
|
||
|
return {};
|
||
|
},
|
||
|
footerStyle: function (t, i) {
|
||
|
return {};
|
||
|
},
|
||
|
onAll: function (t, i) {
|
||
|
return !1;
|
||
|
},
|
||
|
onClickCell: function (t, i, e, o) {
|
||
|
return !1;
|
||
|
},
|
||
|
onDblClickCell: function (t, i, e, o) {
|
||
|
return !1;
|
||
|
},
|
||
|
onClickRow: function (t, i) {
|
||
|
return !1;
|
||
|
},
|
||
|
onDblClickRow: function (t, i) {
|
||
|
return !1;
|
||
|
},
|
||
|
onSort: function (t, i) {
|
||
|
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, i) {
|
||
|
return !1;
|
||
|
},
|
||
|
onPageChange: function (t, i) {
|
||
|
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;
|
||
|
},
|
||
|
onExpandRow: function (t, i, e) {
|
||
|
return !1;
|
||
|
},
|
||
|
onCollapseRow: function (t, i) {
|
||
|
return !1;
|
||
|
},
|
||
|
onRefreshOptions: function (t) {
|
||
|
return !1;
|
||
|
},
|
||
|
onRefresh: function (t) {
|
||
|
return !1;
|
||
|
},
|
||
|
onResetView: function () {
|
||
|
return !1;
|
||
|
},
|
||
|
onScrollBody: function () {
|
||
|
return !1;
|
||
|
},
|
||
|
}),
|
||
|
((u.LOCALES = {})["en-US"] = u.LOCALES.en =
|
||
|
{
|
||
|
formatLoadingMessage: function () {
|
||
|
return "Loading, please wait...";
|
||
|
},
|
||
|
formatRecordsPerPage: function (t) {
|
||
|
return s("%s rows per page", t);
|
||
|
},
|
||
|
formatShowingRows: function (t, i, e) {
|
||
|
return s("Showing %s to %s of %s rows", t, i, e);
|
||
|
},
|
||
|
formatDetailPagination: function (t) {
|
||
|
return s("Showing %s rows", t);
|
||
|
},
|
||
|
formatSearch: function () {
|
||
|
return "Search";
|
||
|
},
|
||
|
formatNoMatches: function () {
|
||
|
return "No matching records found";
|
||
|
},
|
||
|
formatPaginationSwitch: function () {
|
||
|
return "Hide/Show pagination";
|
||
|
},
|
||
|
formatRefresh: function () {
|
||
|
return "Refresh";
|
||
|
},
|
||
|
formatToggle: function () {
|
||
|
return "Toggle";
|
||
|
},
|
||
|
formatFullscreen: function () {
|
||
|
return "Fullscreen";
|
||
|
},
|
||
|
formatColumns: function () {
|
||
|
return "Columns";
|
||
|
},
|
||
|
formatAllRows: function () {
|
||
|
return "All";
|
||
|
},
|
||
|
}),
|
||
|
t.extend(u.DEFAULTS, u.LOCALES["en-US"]),
|
||
|
(u.COLUMN_DEFAULTS = {
|
||
|
radio: !1,
|
||
|
checkbox: !1,
|
||
|
checkboxEnabled: !0,
|
||
|
field: void 0,
|
||
|
title: void 0,
|
||
|
titleTooltip: void 0,
|
||
|
class: void 0,
|
||
|
align: void 0,
|
||
|
halign: void 0,
|
||
|
falign: void 0,
|
||
|
valign: void 0,
|
||
|
width: void 0,
|
||
|
sortable: !1,
|
||
|
order: "asc",
|
||
|
visible: !0,
|
||
|
switchable: !0,
|
||
|
clickToSelect: !0,
|
||
|
formatter: void 0,
|
||
|
footerFormatter: void 0,
|
||
|
events: void 0,
|
||
|
sorter: void 0,
|
||
|
sortName: void 0,
|
||
|
cellStyle: void 0,
|
||
|
searchable: !0,
|
||
|
searchFormatter: !0,
|
||
|
cardVisible: !0,
|
||
|
escape: !1,
|
||
|
showSelectTitle: !1,
|
||
|
}),
|
||
|
(u.EVENTS = {
|
||
|
"all.bs.table": "onAll",
|
||
|
"click-cell.bs.table": "onClickCell",
|
||
|
"dbl-click-cell.bs.table": "onDblClickCell",
|
||
|
"click-row.bs.table": "onClickRow",
|
||
|
"dbl-click-row.bs.table": "onDblClickRow",
|
||
|
"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",
|
||
|
"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",
|
||
|
"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",
|
||
|
}),
|
||
|
(u.prototype.init = function () {
|
||
|
this.initLocale(),
|
||
|
this.initContainer(),
|
||
|
this.initTable(),
|
||
|
this.initHeader(),
|
||
|
this.initData(),
|
||
|
this.initHiddenRows(),
|
||
|
this.initFooter(),
|
||
|
this.initToolbar(),
|
||
|
this.initPagination(),
|
||
|
this.initBody(),
|
||
|
this.initSearchText(),
|
||
|
this.initServer();
|
||
|
}),
|
||
|
(u.prototype.initLocale = function () {
|
||
|
if (this.options.locale) {
|
||
|
var i = this.options.locale.split(/-|_/);
|
||
|
i[0].toLowerCase(),
|
||
|
i[1] && i[1].toUpperCase(),
|
||
|
t.fn.bootstrapTable.locales[this.options.locale]
|
||
|
? t.extend(
|
||
|
this.options,
|
||
|
t.fn.bootstrapTable.locales[this.options.locale]
|
||
|
)
|
||
|
: t.fn.bootstrapTable.locales[i.join("-")]
|
||
|
? t.extend(this.options, t.fn.bootstrapTable.locales[i.join("-")])
|
||
|
: t.fn.bootstrapTable.locales[i[0]] &&
|
||
|
t.extend(this.options, t.fn.bootstrapTable.locales[i[0]]);
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.initContainer = function () {
|
||
|
(this.$container = t(
|
||
|
[
|
||
|
'<div class="bootstrap-table">',
|
||
|
'<div class="fixed-table-toolbar"></div>',
|
||
|
"top" === this.options.paginationVAlign ||
|
||
|
"both" === this.options.paginationVAlign
|
||
|
? '<div class="fixed-table-pagination" style="clear: both;"></div>'
|
||
|
: "",
|
||
|
'<div class="fixed-table-container">',
|
||
|
'<div class="fixed-table-header"><table></table></div>',
|
||
|
'<div class="fixed-table-body">',
|
||
|
'<div class="fixed-table-loading">',
|
||
|
this.options.formatLoadingMessage(),
|
||
|
"</div>",
|
||
|
"</div>",
|
||
|
'<div class="fixed-table-footer"><table><tr></tr></table></div>',
|
||
|
"</div>",
|
||
|
"bottom" === this.options.paginationVAlign ||
|
||
|
"both" === this.options.paginationVAlign
|
||
|
? '<div class="fixed-table-pagination"></div>'
|
||
|
: "",
|
||
|
"</div>",
|
||
|
].join("")
|
||
|
)),
|
||
|
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.$container.find(".fixed-table-footer")),
|
||
|
this.options.buttonsToolbar
|
||
|
? (this.$toolbar = t("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.options.striped && this.$el.addClass("table-striped"),
|
||
|
-1 !==
|
||
|
t.inArray("table-no-bordered", this.options.classes.split(" ")) &&
|
||
|
this.$tableContainer.addClass("table-no-bordered");
|
||
|
}),
|
||
|
(u.prototype.initTable = function () {
|
||
|
var i = this,
|
||
|
e = [],
|
||
|
o = [];
|
||
|
if (
|
||
|
((this.$header = this.$el.find(">thead")),
|
||
|
this.$header.length ||
|
||
|
(this.$header = t("<thead></thead>").appendTo(this.$el)),
|
||
|
this.$header.find("tr").each(function () {
|
||
|
var i = [];
|
||
|
t(this)
|
||
|
.find("th")
|
||
|
.each(function () {
|
||
|
void 0 !== t(this).data("field") &&
|
||
|
t(this).data("field", t(this).data("field") + ""),
|
||
|
i.push(
|
||
|
t.extend(
|
||
|
{},
|
||
|
{
|
||
|
title: t(this).html(),
|
||
|
class: t(this).attr("class"),
|
||
|
titleTooltip: t(this).attr("title"),
|
||
|
rowspan: t(this).attr("rowspan")
|
||
|
? +t(this).attr("rowspan")
|
||
|
: void 0,
|
||
|
colspan: t(this).attr("colspan")
|
||
|
? +t(this).attr("colspan")
|
||
|
: void 0,
|
||
|
},
|
||
|
t(this).data()
|
||
|
)
|
||
|
);
|
||
|
}),
|
||
|
e.push(i);
|
||
|
}),
|
||
|
t.isArray(this.options.columns[0]) ||
|
||
|
(this.options.columns = [this.options.columns]),
|
||
|
(this.options.columns = t.extend(!0, [], e, this.options.columns)),
|
||
|
(this.columns = []),
|
||
|
(this.fieldsColumnsIndex = []),
|
||
|
(function (i) {
|
||
|
var e,
|
||
|
o,
|
||
|
s,
|
||
|
n = 0,
|
||
|
a = [];
|
||
|
for (e = 0; e < i[0].length; e++) n += i[0][e].colspan || 1;
|
||
|
for (e = 0; e < i.length; e++)
|
||
|
for (a[e] = [], o = 0; o < n; o++) a[e][o] = !1;
|
||
|
for (e = 0; e < i.length; e++)
|
||
|
for (o = 0; o < i[e].length; o++) {
|
||
|
var r = i[e][o],
|
||
|
l = r.rowspan || 1,
|
||
|
h = r.colspan || 1,
|
||
|
p = t.inArray(!1, a[e]);
|
||
|
for (
|
||
|
1 === h &&
|
||
|
((r.fieldIndex = p), void 0 === r.field && (r.field = p)),
|
||
|
s = 0;
|
||
|
s < l;
|
||
|
s++
|
||
|
)
|
||
|
a[e + s][p] = !0;
|
||
|
for (s = 0; s < h; s++) a[e][p + s] = !0;
|
||
|
}
|
||
|
})(this.options.columns),
|
||
|
t.each(this.options.columns, function (e, o) {
|
||
|
t.each(o, function (o, s) {
|
||
|
void 0 !== (s = t.extend({}, u.COLUMN_DEFAULTS, s)).fieldIndex &&
|
||
|
((i.columns[s.fieldIndex] = s),
|
||
|
(i.fieldsColumnsIndex[s.field] = s.fieldIndex)),
|
||
|
(i.options.columns[e][o] = s);
|
||
|
});
|
||
|
}),
|
||
|
!this.options.data.length)
|
||
|
) {
|
||
|
var s = [];
|
||
|
this.$el.find(">tbody>tr").each(function (e) {
|
||
|
var n = {};
|
||
|
(n._id = t(this).attr("id")),
|
||
|
(n._class = t(this).attr("class")),
|
||
|
(n._data = p(t(this).data())),
|
||
|
t(this)
|
||
|
.find(">td")
|
||
|
.each(function (o) {
|
||
|
for (
|
||
|
var a,
|
||
|
r,
|
||
|
l = t(this),
|
||
|
h = +l.attr("colspan") || 1,
|
||
|
c = +l.attr("rowspan") || 1;
|
||
|
s[e] && s[e][o];
|
||
|
o++
|
||
|
);
|
||
|
for (a = o; a < o + h; a++)
|
||
|
for (r = e; r < e + c; r++)
|
||
|
s[r] || (s[r] = []), (s[r][a] = !0);
|
||
|
var d = i.columns[o].field;
|
||
|
(n[d] = t(this).html()),
|
||
|
(n["_" + d + "_id"] = t(this).attr("id")),
|
||
|
(n["_" + d + "_class"] = t(this).attr("class")),
|
||
|
(n["_" + d + "_rowspan"] = t(this).attr("rowspan")),
|
||
|
(n["_" + d + "_colspan"] = t(this).attr("colspan")),
|
||
|
(n["_" + d + "_title"] = t(this).attr("title")),
|
||
|
(n["_" + d + "_data"] = p(t(this).data()));
|
||
|
}),
|
||
|
o.push(n);
|
||
|
}),
|
||
|
(this.options.data = o),
|
||
|
o.length && (this.fromHtml = !0);
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.initHeader = function () {
|
||
|
var i = this,
|
||
|
e = {},
|
||
|
o = [];
|
||
|
(this.header = {
|
||
|
fields: [],
|
||
|
styles: [],
|
||
|
classes: [],
|
||
|
formatters: [],
|
||
|
events: [],
|
||
|
sorters: [],
|
||
|
sortNames: [],
|
||
|
cellStyles: [],
|
||
|
searchables: [],
|
||
|
}),
|
||
|
t.each(this.options.columns, function (n, a) {
|
||
|
o.push("<tr>"),
|
||
|
0 === n &&
|
||
|
!i.options.cardView &&
|
||
|
i.options.detailView &&
|
||
|
o.push(
|
||
|
s(
|
||
|
'<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',
|
||
|
i.options.columns.length
|
||
|
)
|
||
|
),
|
||
|
t.each(a, function (t, n) {
|
||
|
var a,
|
||
|
r,
|
||
|
l = "",
|
||
|
p = "",
|
||
|
c = s(' class="%s"', n.class),
|
||
|
d = (i.options.sortOrder || n.order, "px"),
|
||
|
u = n.width;
|
||
|
if (
|
||
|
(void 0 === n.width ||
|
||
|
i.options.cardView ||
|
||
|
("string" == typeof n.width &&
|
||
|
-1 !== n.width.indexOf("%") &&
|
||
|
(d = "%")),
|
||
|
n.width &&
|
||
|
"string" == typeof n.width &&
|
||
|
(u = n.width.replace("%", "").replace("px", "")),
|
||
|
(a = s("text-align: %s; ", n.halign ? n.halign : n.align)),
|
||
|
(r = s("text-align: %s; ", n.align)),
|
||
|
(p = s("vertical-align: %s; ", n.valign)),
|
||
|
(p += s(
|
||
|
"width: %s; ",
|
||
|
(!n.checkbox && !n.radio) || u
|
||
|
? u
|
||
|
? u + d
|
||
|
: void 0
|
||
|
: n.showSelectTitle
|
||
|
? void 0
|
||
|
: "36px"
|
||
|
)),
|
||
|
void 0 !== n.fieldIndex)
|
||
|
) {
|
||
|
if (
|
||
|
((i.header.fields[n.fieldIndex] = n.field),
|
||
|
(i.header.styles[n.fieldIndex] = r + p),
|
||
|
(i.header.classes[n.fieldIndex] = c),
|
||
|
(i.header.formatters[n.fieldIndex] = n.formatter),
|
||
|
(i.header.events[n.fieldIndex] = n.events),
|
||
|
(i.header.sorters[n.fieldIndex] = n.sorter),
|
||
|
(i.header.sortNames[n.fieldIndex] = n.sortName),
|
||
|
(i.header.cellStyles[n.fieldIndex] = n.cellStyle),
|
||
|
(i.header.searchables[n.fieldIndex] = n.searchable),
|
||
|
!n.visible)
|
||
|
)
|
||
|
return;
|
||
|
if (i.options.cardView && !n.cardVisible) return;
|
||
|
e[n.field] = n;
|
||
|
}
|
||
|
o.push(
|
||
|
"<th" + s(' title="%s"', n.titleTooltip),
|
||
|
n.checkbox || n.radio
|
||
|
? s(' class="bs-checkbox %s"', n.class || "")
|
||
|
: c,
|
||
|
s(' style="%s"', a + p),
|
||
|
s(' rowspan="%s"', n.rowspan),
|
||
|
s(' colspan="%s"', n.colspan),
|
||
|
s(' data-field="%s"', n.field),
|
||
|
0 === t && n.fieldIndex ? " data-not-first-th" : "",
|
||
|
">"
|
||
|
),
|
||
|
o.push(
|
||
|
s(
|
||
|
'<div class="th-inner %s">',
|
||
|
i.options.sortable && n.sortable ? "sortable both" : ""
|
||
|
)
|
||
|
);
|
||
|
var f = (l = i.options.escape ? h(n.title) : n.title);
|
||
|
n.checkbox &&
|
||
|
((l = ""),
|
||
|
!i.options.singleSelect &&
|
||
|
i.options.checkboxHeader &&
|
||
|
(l = '<input name="btSelectAll" type="checkbox" />'),
|
||
|
(i.header.stateField = n.field)),
|
||
|
n.radio &&
|
||
|
((l = ""),
|
||
|
(i.header.stateField = n.field),
|
||
|
(i.options.singleSelect = !0)),
|
||
|
!l && n.showSelectTitle && (l += f),
|
||
|
o.push(l),
|
||
|
o.push("</div>"),
|
||
|
o.push('<div class="fht-cell"></div>'),
|
||
|
o.push("</div>"),
|
||
|
o.push("</th>");
|
||
|
}),
|
||
|
o.push("</tr>");
|
||
|
}),
|
||
|
this.$header.html(o.join("")),
|
||
|
this.$header.find("th[data-field]").each(function (i) {
|
||
|
t(this).data(e[t(this).data("field")]);
|
||
|
}),
|
||
|
this.$container
|
||
|
.off("click", ".th-inner")
|
||
|
.on("click", ".th-inner", function (e) {
|
||
|
var o = t(this);
|
||
|
if (
|
||
|
i.options.detailView &&
|
||
|
!o.parent().hasClass("bs-checkbox") &&
|
||
|
o.closest(".bootstrap-table")[0] !== i.$container[0]
|
||
|
)
|
||
|
return !1;
|
||
|
i.options.sortable && o.parent().data().sortable && i.onSort(e);
|
||
|
}),
|
||
|
this.$header
|
||
|
.children()
|
||
|
.children()
|
||
|
.off("keypress")
|
||
|
.on("keypress", function (e) {
|
||
|
i.options.sortable &&
|
||
|
t(this).data().sortable &&
|
||
|
13 == (e.keyCode || e.which) &&
|
||
|
i.onSort(e);
|
||
|
}),
|
||
|
t(window).off("resize.bootstrap-table"),
|
||
|
!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(),
|
||
|
t(window).on(
|
||
|
"resize.bootstrap-table",
|
||
|
t.proxy(this.resetWidth, this)
|
||
|
)),
|
||
|
(this.$selectAll = this.$header.find('[name="btSelectAll"]')),
|
||
|
this.$selectAll.off("click").on("click", function () {
|
||
|
var e = t(this).prop("checked");
|
||
|
i[e ? "checkAll" : "uncheckAll"](), i.updateSelected();
|
||
|
});
|
||
|
}),
|
||
|
(u.prototype.initFooter = function () {
|
||
|
!this.options.showFooter || this.options.cardView
|
||
|
? this.$tableFooter.hide()
|
||
|
: this.$tableFooter.show();
|
||
|
}),
|
||
|
(u.prototype.initData = function (t, i) {
|
||
|
(this.options.data =
|
||
|
"append" === i
|
||
|
? this.options.data.concat(t)
|
||
|
: "prepend" === i
|
||
|
? [].concat(t).concat(this.options.data)
|
||
|
: t || this.options.data),
|
||
|
(this.data = this.options.data),
|
||
|
"server" !== this.options.sidePagination && this.initSort();
|
||
|
}),
|
||
|
(u.prototype.initSort = function () {
|
||
|
var i = this,
|
||
|
e = this.options.sortName,
|
||
|
o = "desc" === this.options.sortOrder ? -1 : 1,
|
||
|
n = t.inArray(this.options.sortName, this.header.fields),
|
||
|
a = 0;
|
||
|
this.options.customSort === t.noop
|
||
|
? -1 !== n &&
|
||
|
(this.options.sortStable &&
|
||
|
t.each(this.data, function (t, i) {
|
||
|
i._position = t;
|
||
|
}),
|
||
|
this.data.sort(function (s, a) {
|
||
|
i.header.sortNames[n] && (e = i.header.sortNames[n]);
|
||
|
var l = c(s, e, i.options.escape),
|
||
|
h = c(a, e, i.options.escape),
|
||
|
p = r(i.header, i.header.sorters[n], [l, h, s, a]);
|
||
|
return void 0 !== p
|
||
|
? i.options.sortStable && 0 === p
|
||
|
? s._position - a._position
|
||
|
: o * p
|
||
|
: (null == l && (l = ""),
|
||
|
null == h && (h = ""),
|
||
|
i.options.sortStable && l === h
|
||
|
? ((l = s._position),
|
||
|
(h = a._position),
|
||
|
s._position - a._position)
|
||
|
: t.isNumeric(l) && t.isNumeric(h)
|
||
|
? (l = parseFloat(l)) < (h = parseFloat(h))
|
||
|
? -1 * o
|
||
|
: o
|
||
|
: l === h
|
||
|
? 0
|
||
|
: ("string" != typeof l && (l = l.toString()),
|
||
|
-1 === l.localeCompare(h) ? -1 * o : o));
|
||
|
}),
|
||
|
void 0 !== this.options.sortClass &&
|
||
|
(clearTimeout(a),
|
||
|
(a = setTimeout(function () {
|
||
|
i.$el.removeClass(i.options.sortClass);
|
||
|
var t = i.$header.find(
|
||
|
s('[data-field="%s"]', i.options.sortName).index() + 1
|
||
|
);
|
||
|
i.$el
|
||
|
.find(s("tr td:nth-child(%s)", t))
|
||
|
.addClass(i.options.sortClass);
|
||
|
}, 250))))
|
||
|
: this.options.customSort.apply(this, [
|
||
|
this.options.sortName,
|
||
|
this.options.sortOrder,
|
||
|
]);
|
||
|
}),
|
||
|
(u.prototype.onSort = function (i) {
|
||
|
var e =
|
||
|
"keypress" === i.type
|
||
|
? t(i.currentTarget)
|
||
|
: t(i.currentTarget).parent(),
|
||
|
o = this.$header.find("th").eq(e.index());
|
||
|
this.$header.add(this.$header_).find("span.order").remove(),
|
||
|
this.options.sortName === e.data("field")
|
||
|
? (this.options.sortOrder =
|
||
|
"asc" === this.options.sortOrder ? "desc" : "asc")
|
||
|
: ((this.options.sortName = e.data("field")),
|
||
|
this.options.rememberOrder
|
||
|
? (this.options.sortOrder =
|
||
|
"asc" === e.data("order") ? "desc" : "asc")
|
||
|
: (this.options.sortOrder =
|
||
|
this.columns[
|
||
|
this.fieldsColumnsIndex[e.data("field")]
|
||
|
].order)),
|
||
|
this.trigger("sort", this.options.sortName, this.options.sortOrder),
|
||
|
e.add(o).data("order", this.options.sortOrder),
|
||
|
this.getCaret(),
|
||
|
"server" !== this.options.sidePagination
|
||
|
? (this.initSort(), this.initBody())
|
||
|
: this.initServer(this.options.silentSort);
|
||
|
}),
|
||
|
(u.prototype.initToolbar = function () {
|
||
|
var i,
|
||
|
o,
|
||
|
n = this,
|
||
|
a = [],
|
||
|
l = 0,
|
||
|
h = 0;
|
||
|
this.$toolbar.find(".bs-bars").children().length &&
|
||
|
t("body").append(t(this.options.toolbar)),
|
||
|
this.$toolbar.html(""),
|
||
|
("string" != typeof this.options.toolbar &&
|
||
|
"object" != typeof this.options.toolbar) ||
|
||
|
t(
|
||
|
s(
|
||
|
'<div class="bs-bars %s-%s"></div>',
|
||
|
e.pullClass,
|
||
|
this.options.toolbarAlign
|
||
|
)
|
||
|
)
|
||
|
.appendTo(this.$toolbar)
|
||
|
.append(t(this.options.toolbar)),
|
||
|
(a = [
|
||
|
s(
|
||
|
'<div class="columns columns-%s btn-group %s-%s">',
|
||
|
this.options.buttonsAlign,
|
||
|
e.pullClass,
|
||
|
this.options.buttonsAlign
|
||
|
),
|
||
|
]),
|
||
|
"string" == typeof this.options.icons &&
|
||
|
(this.options.icons = r(null, this.options.icons)),
|
||
|
this.options.showPaginationSwitch &&
|
||
|
a.push(
|
||
|
s(
|
||
|
'<button class="btn' +
|
||
|
s(" btn-%s", this.options.buttonsClass) +
|
||
|
s(" btn-%s", this.options.iconSize) +
|
||
|
'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',
|
||
|
this.options.formatPaginationSwitch()
|
||
|
),
|
||
|
s(
|
||
|
'<i class="%s %s"></i>',
|
||
|
this.options.iconsPrefix,
|
||
|
this.options.icons.paginationSwitchDown
|
||
|
),
|
||
|
"</button>"
|
||
|
),
|
||
|
this.options.showFullscreen &&
|
||
|
this.$toolbar
|
||
|
.find('button[name="fullscreen"]')
|
||
|
.off("click")
|
||
|
.on("click", t.proxy(this.toggleFullscreen, this)),
|
||
|
this.options.showRefresh &&
|
||
|
a.push(
|
||
|
s(
|
||
|
'<button class="btn' +
|
||
|
s(" btn-%s", this.options.buttonsClass) +
|
||
|
s(" btn-%s", this.options.iconSize) +
|
||
|
'" type="button" name="refresh" aria-label="refresh" title="%s">',
|
||
|
this.options.formatRefresh()
|
||
|
),
|
||
|
s(
|
||
|
'<i class="%s %s"></i>',
|
||
|
this.options.iconsPrefix,
|
||
|
this.options.icons.refresh
|
||
|
),
|
||
|
"</button>"
|
||
|
),
|
||
|
this.options.showToggle &&
|
||
|
a.push(
|
||
|
s(
|
||
|
'<button class="btn' +
|
||
|
s(" btn-%s", this.options.buttonsClass) +
|
||
|
s(" btn-%s", this.options.iconSize) +
|
||
|
'" type="button" name="toggle" aria-label="toggle" title="%s">',
|
||
|
this.options.formatToggle()
|
||
|
),
|
||
|
s(
|
||
|
'<i class="%s %s"></i>',
|
||
|
this.options.iconsPrefix,
|
||
|
this.options.icons.toggleOff
|
||
|
),
|
||
|
"</button>"
|
||
|
),
|
||
|
this.options.showFullscreen &&
|
||
|
a.push(
|
||
|
s(
|
||
|
'<button class="btn' +
|
||
|
s(" btn-%s", this.options.buttonsClass) +
|
||
|
s(" btn-%s", this.options.iconSize) +
|
||
|
'" type="button" name="fullscreen" aria-label="fullscreen" title="%s">',
|
||
|
this.options.formatFullscreen()
|
||
|
),
|
||
|
s(
|
||
|
'<i class="%s %s"></i>',
|
||
|
this.options.iconsPrefix,
|
||
|
this.options.icons.fullscreen
|
||
|
),
|
||
|
"</button>"
|
||
|
),
|
||
|
this.options.showColumns &&
|
||
|
(a.push(
|
||
|
s(
|
||
|
'<div class="keep-open btn-group" title="%s">',
|
||
|
this.options.formatColumns()
|
||
|
),
|
||
|
'<button type="button" aria-label="columns" class="btn' +
|
||
|
s(" btn-%s", this.options.buttonsClass) +
|
||
|
s(" btn-%s", this.options.iconSize) +
|
||
|
' dropdown-toggle" data-bs-toggle="dropdown">',
|
||
|
s(
|
||
|
'<i class="%s %s"></i>',
|
||
|
this.options.iconsPrefix,
|
||
|
this.options.icons.columns
|
||
|
),
|
||
|
' <span class="caret"></span>',
|
||
|
"</button>",
|
||
|
e.toobarDropdowHtml[0]
|
||
|
),
|
||
|
t.each(this.columns, function (t, i) {
|
||
|
if (
|
||
|
!i.radio &&
|
||
|
!i.checkbox &&
|
||
|
(!n.options.cardView || i.cardVisible)
|
||
|
) {
|
||
|
var o = i.visible ? ' checked="checked"' : "";
|
||
|
i.switchable &&
|
||
|
(a.push(
|
||
|
s(
|
||
|
e.toobarDropdowItemHtml,
|
||
|
s(
|
||
|
'<input type="checkbox" data-field="%s" value="%s"%s> %s',
|
||
|
i.field,
|
||
|
t,
|
||
|
o,
|
||
|
i.title
|
||
|
)
|
||
|
)
|
||
|
),
|
||
|
h++);
|
||
|
}
|
||
|
}),
|
||
|
a.push(e.toobarDropdowHtml[1], "</div>")),
|
||
|
a.push("</div>"),
|
||
|
(this.showToolbar || a.length > 2) && this.$toolbar.append(a.join("")),
|
||
|
this.options.showPaginationSwitch &&
|
||
|
this.$toolbar
|
||
|
.find('button[name="paginationSwitch"]')
|
||
|
.off("click")
|
||
|
.on("click", t.proxy(this.togglePagination, this)),
|
||
|
this.options.showRefresh &&
|
||
|
this.$toolbar
|
||
|
.find('button[name="refresh"]')
|
||
|
.off("click")
|
||
|
.on("click", t.proxy(this.refresh, this)),
|
||
|
this.options.showToggle &&
|
||
|
this.$toolbar
|
||
|
.find('button[name="toggle"]')
|
||
|
.off("click")
|
||
|
.on("click", function () {
|
||
|
n.toggleView();
|
||
|
}),
|
||
|
this.options.showColumns &&
|
||
|
((i = this.$toolbar.find(".keep-open")),
|
||
|
h <= this.options.minimumCountColumns &&
|
||
|
i.find("input").prop("disabled", !0),
|
||
|
i
|
||
|
.find("li")
|
||
|
.off("click")
|
||
|
.on("click", function (t) {
|
||
|
t.stopImmediatePropagation();
|
||
|
}),
|
||
|
i
|
||
|
.find("input")
|
||
|
.off("click")
|
||
|
.on("click", function () {
|
||
|
var i = t(this);
|
||
|
n.toggleColumn(t(this).val(), i.prop("checked"), !1),
|
||
|
n.trigger(
|
||
|
"column-switch",
|
||
|
t(this).data("field"),
|
||
|
i.prop("checked")
|
||
|
);
|
||
|
})),
|
||
|
this.options.search &&
|
||
|
((a = []).push(
|
||
|
s(
|
||
|
'<div class="%s-%s search">',
|
||
|
e.pullClass,
|
||
|
this.options.searchAlign
|
||
|
),
|
||
|
s(
|
||
|
'<input class="form-control' +
|
||
|
s(" input-%s", this.options.iconSize) +
|
||
|
'" type="text" placeholder="%s">',
|
||
|
this.options.formatSearch()
|
||
|
),
|
||
|
"</div>"
|
||
|
),
|
||
|
this.$toolbar.append(a.join("")),
|
||
|
(o = this.$toolbar.find(".search input"))
|
||
|
.off("keyup drop blur")
|
||
|
.on("keyup drop blur", function (i) {
|
||
|
(n.options.searchOnEnterKey && 13 !== i.keyCode) ||
|
||
|
t.inArray(i.keyCode, [37, 38, 39, 40]) > -1 ||
|
||
|
(clearTimeout(l),
|
||
|
(l = setTimeout(function () {
|
||
|
n.onSearch(i);
|
||
|
}, n.options.searchTimeOut)));
|
||
|
}),
|
||
|
d() &&
|
||
|
o.off("mouseup").on("mouseup", function (t) {
|
||
|
clearTimeout(l),
|
||
|
(l = setTimeout(function () {
|
||
|
n.onSearch(t);
|
||
|
}, n.options.searchTimeOut));
|
||
|
}));
|
||
|
}),
|
||
|
(u.prototype.onSearch = function (i) {
|
||
|
var e = t.trim(t(i.currentTarget).val());
|
||
|
this.options.trimOnSearch &&
|
||
|
t(i.currentTarget).val() !== e &&
|
||
|
t(i.currentTarget).val(e),
|
||
|
e !== this.searchText &&
|
||
|
((this.searchText = e),
|
||
|
(this.options.searchText = e),
|
||
|
(this.options.pageNumber = 1),
|
||
|
this.initSearch(),
|
||
|
i.firedByInitSearchText
|
||
|
? "client" === this.options.sidePagination &&
|
||
|
this.updatePagination()
|
||
|
: this.updatePagination(),
|
||
|
this.trigger("search", e));
|
||
|
}),
|
||
|
(u.prototype.initSearch = function () {
|
||
|
var i = this;
|
||
|
if ("server" !== this.options.sidePagination) {
|
||
|
if (this.options.customSearch !== t.noop)
|
||
|
return void window[this.options.customSearch].apply(this, [
|
||
|
this.searchText,
|
||
|
]);
|
||
|
var e =
|
||
|
this.searchText &&
|
||
|
(this.options.escape
|
||
|
? h(this.searchText)
|
||
|
: this.searchText
|
||
|
).toLowerCase(),
|
||
|
o = t.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
|
||
|
(this.data = o
|
||
|
? t.grep(this.options.data, function (i, e) {
|
||
|
for (var s in o)
|
||
|
if (
|
||
|
(t.isArray(o[s]) && -1 === t.inArray(i[s], o[s])) ||
|
||
|
(!t.isArray(o[s]) && i[s] !== o[s])
|
||
|
)
|
||
|
return !1;
|
||
|
return !0;
|
||
|
})
|
||
|
: this.options.data),
|
||
|
(this.data = e
|
||
|
? t.grep(this.data, function (o, s) {
|
||
|
for (var n = 0; n < i.header.fields.length; n++)
|
||
|
if (i.header.searchables[n]) {
|
||
|
var a,
|
||
|
l = t.isNumeric(i.header.fields[n])
|
||
|
? parseInt(i.header.fields[n], 10)
|
||
|
: i.header.fields[n],
|
||
|
h = i.columns[i.fieldsColumnsIndex[l]];
|
||
|
if ("string" == typeof l) {
|
||
|
a = o;
|
||
|
for (var p = l.split("."), c = 0; c < p.length; c++)
|
||
|
null != a[p[c]] && (a = a[p[c]]);
|
||
|
h &&
|
||
|
h.searchFormatter &&
|
||
|
(a = r(h, i.header.formatters[n], [a, o, s], a));
|
||
|
} else a = o[l];
|
||
|
if ("string" == typeof a || "number" == typeof a)
|
||
|
if (i.options.strictSearch) {
|
||
|
if ((a + "").toLowerCase() === e) return !0;
|
||
|
} else if (-1 !== (a + "").toLowerCase().indexOf(e))
|
||
|
return !0;
|
||
|
}
|
||
|
return !1;
|
||
|
})
|
||
|
: this.data);
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.initPagination = function () {
|
||
|
if (this.options.pagination) {
|
||
|
this.$pagination.show();
|
||
|
var i,
|
||
|
o,
|
||
|
n,
|
||
|
a,
|
||
|
r,
|
||
|
l,
|
||
|
h,
|
||
|
p = this,
|
||
|
c = [],
|
||
|
d = !1,
|
||
|
u = this.getData(),
|
||
|
f = this.options.pageList;
|
||
|
if (
|
||
|
("server" !== this.options.sidePagination &&
|
||
|
(this.options.totalRows = u.length),
|
||
|
(this.totalPages = 0),
|
||
|
this.options.totalRows)
|
||
|
) {
|
||
|
if (this.options.pageSize === this.options.formatAllRows())
|
||
|
(this.options.pageSize = this.options.totalRows), (d = !0);
|
||
|
else if (this.options.pageSize === this.options.totalRows) {
|
||
|
var g =
|
||
|
"string" == typeof this.options.pageList
|
||
|
? this.options.pageList
|
||
|
.replace("[", "")
|
||
|
.replace("]", "")
|
||
|
.replace(/ /g, "")
|
||
|
.toLowerCase()
|
||
|
.split(",")
|
||
|
: this.options.pageList;
|
||
|
t.inArray(this.options.formatAllRows().toLowerCase(), g) > -1 &&
|
||
|
(d = !0);
|
||
|
}
|
||
|
(this.totalPages =
|
||
|
1 + ~~((this.options.totalRows - 1) / this.options.pageSize)),
|
||
|
(this.options.totalPages = this.totalPages);
|
||
|
}
|
||
|
if (
|
||
|
(this.totalPages > 0 &&
|
||
|
this.options.pageNumber > this.totalPages &&
|
||
|
(this.options.pageNumber = this.totalPages),
|
||
|
(this.pageFrom =
|
||
|
(this.options.pageNumber - 1) * this.options.pageSize + 1),
|
||
|
(this.pageTo = this.options.pageNumber * this.options.pageSize),
|
||
|
this.pageTo > this.options.totalRows &&
|
||
|
(this.pageTo = this.options.totalRows),
|
||
|
c.push(
|
||
|
s(
|
||
|
'<div class="%s-%s pagination-detail">',
|
||
|
e.pullClass,
|
||
|
this.options.paginationDetailHAlign
|
||
|
),
|
||
|
'<span class="pagination-info">',
|
||
|
this.options.onlyInfoPagination
|
||
|
? this.options.formatDetailPagination(this.options.totalRows)
|
||
|
: this.options.formatShowingRows(
|
||
|
this.pageFrom,
|
||
|
this.pageTo,
|
||
|
this.options.totalRows
|
||
|
),
|
||
|
"</span>"
|
||
|
),
|
||
|
!this.options.onlyInfoPagination)
|
||
|
) {
|
||
|
c.push('<span class="page-list">');
|
||
|
var b = [
|
||
|
s(
|
||
|
'<span class="btn-group %s">',
|
||
|
"top" === this.options.paginationVAlign ||
|
||
|
"both" === this.options.paginationVAlign
|
||
|
? "dropdown"
|
||
|
: "dropup"
|
||
|
),
|
||
|
'<button type="button" class="btn' +
|
||
|
s(" btn-%s", this.options.buttonsClass) +
|
||
|
s(" btn-%s", this.options.iconSize) +
|
||
|
' dropdown-toggle" data-bs-toggle="dropdown">',
|
||
|
'<span class="page-size">',
|
||
|
d ? this.options.formatAllRows() : this.options.pageSize,
|
||
|
"</span>",
|
||
|
' <span class="caret"></span>',
|
||
|
"</button>",
|
||
|
e.pageDropdownHtml[0],
|
||
|
];
|
||
|
if ("string" == typeof this.options.pageList) {
|
||
|
var m = this.options.pageList
|
||
|
.replace("[", "")
|
||
|
.replace("]", "")
|
||
|
.replace(/ /g, "")
|
||
|
.split(",");
|
||
|
(f = []),
|
||
|
t.each(m, function (t, i) {
|
||
|
f.push(
|
||
|
i.toUpperCase() === p.options.formatAllRows().toUpperCase() ||
|
||
|
"UNLIMITED" === i.toUpperCase()
|
||
|
? p.options.formatAllRows()
|
||
|
: +i
|
||
|
);
|
||
|
});
|
||
|
}
|
||
|
for (
|
||
|
t.each(f, function (t, i) {
|
||
|
var o;
|
||
|
(!p.options.smartDisplay ||
|
||
|
0 === t ||
|
||
|
f[t - 1] < p.options.totalRows) &&
|
||
|
((o = d
|
||
|
? i === p.options.formatAllRows()
|
||
|
? "active"
|
||
|
: ""
|
||
|
: i === p.options.pageSize
|
||
|
? "active"
|
||
|
: ""),
|
||
|
b.push(s(e.pageDropdownItemHtml, o, i)));
|
||
|
}),
|
||
|
b.push(e.pageDropdownHtml[1] + "</span>"),
|
||
|
c.push(this.options.formatRecordsPerPage(b.join(""))),
|
||
|
c.push("</span>"),
|
||
|
c.push(
|
||
|
"</div>",
|
||
|
s(
|
||
|
'<div class="%s-%s pagination">',
|
||
|
e.pullClass,
|
||
|
this.options.paginationHAlign
|
||
|
),
|
||
|
'<ul class="pagination' +
|
||
|
s(" pagination-%s", this.options.iconSize) +
|
||
|
'">',
|
||
|
s(
|
||
|
'<li class="page-item page-pre"><a class="page-link" href="#">%s</a></li>',
|
||
|
this.options.paginationPreText
|
||
|
)
|
||
|
),
|
||
|
this.totalPages < 5
|
||
|
? ((o = 1), (n = this.totalPages))
|
||
|
: ((n = (o = this.options.pageNumber - 2) + 4),
|
||
|
o < 1 && ((o = 1), (n = 5)),
|
||
|
n > this.totalPages && (o = (n = this.totalPages) - 4)),
|
||
|
this.totalPages >= 6 &&
|
||
|
(this.options.pageNumber >= 3 &&
|
||
|
(c.push(
|
||
|
s(
|
||
|
'<li class="page-item page-first%s">',
|
||
|
1 === this.options.pageNumber ? " active" : ""
|
||
|
),
|
||
|
'<a class="page-link" href="#">',
|
||
|
1,
|
||
|
"</a>",
|
||
|
"</li>"
|
||
|
),
|
||
|
o++),
|
||
|
this.options.pageNumber >= 4 &&
|
||
|
(4 == this.options.pageNumber ||
|
||
|
6 == this.totalPages ||
|
||
|
7 == this.totalPages
|
||
|
? o--
|
||
|
: c.push(
|
||
|
'<li class="page-item page-first-separator disabled">',
|
||
|
'<a class="page-link" href="#">...</a>',
|
||
|
"</li>"
|
||
|
),
|
||
|
n--)),
|
||
|
this.totalPages >= 7 &&
|
||
|
this.options.pageNumber >= this.totalPages - 2 &&
|
||
|
o--,
|
||
|
6 == this.totalPages
|
||
|
? this.options.pageNumber >= this.totalPages - 2 && n++
|
||
|
: this.totalPages >= 7 &&
|
||
|
(7 == this.totalPages ||
|
||
|
this.options.pageNumber >= this.totalPages - 3) &&
|
||
|
n++,
|
||
|
i = o;
|
||
|
i <= n;
|
||
|
i++
|
||
|
)
|
||
|
c.push(
|
||
|
s(
|
||
|
'<li class="page-item%s">',
|
||
|
i === this.options.pageNumber ? " active" : ""
|
||
|
),
|
||
|
'<a class="page-link" href="#">',
|
||
|
i,
|
||
|
"</a>",
|
||
|
"</li>"
|
||
|
);
|
||
|
this.totalPages >= 8 &&
|
||
|
this.options.pageNumber <= this.totalPages - 4 &&
|
||
|
c.push(
|
||
|
'<li class="page-item page-last-separator disabled">',
|
||
|
'<a class="page-link" href="#">...</a>',
|
||
|
"</li>"
|
||
|
),
|
||
|
this.totalPages >= 6 &&
|
||
|
this.options.pageNumber <= this.totalPages - 3 &&
|
||
|
c.push(
|
||
|
s(
|
||
|
'<li class="page-item page-last%s">',
|
||
|
this.totalPages === this.options.pageNumber ? " active" : ""
|
||
|
),
|
||
|
'<a class="page-link" href="#">',
|
||
|
this.totalPages,
|
||
|
"</a>",
|
||
|
"</li>"
|
||
|
),
|
||
|
c.push(
|
||
|
s(
|
||
|
'<li class="page-item page-next"><a class="page-link" href="#">%s</a></li>',
|
||
|
this.options.paginationNextText
|
||
|
),
|
||
|
"</ul>",
|
||
|
"</div>"
|
||
|
);
|
||
|
}
|
||
|
this.$pagination.html(c.join("")),
|
||
|
this.options.onlyInfoPagination ||
|
||
|
((a = this.$pagination.find(".page-list a")),
|
||
|
(r = this.$pagination.find(".page-pre")),
|
||
|
(l = this.$pagination.find(".page-next")),
|
||
|
(h = this.$pagination
|
||
|
.find(".page-item")
|
||
|
.not(".page-next, .page-pre")),
|
||
|
this.options.smartDisplay &&
|
||
|
(this.totalPages <= 1 &&
|
||
|
this.$pagination.find("div.pagination").hide(),
|
||
|
(f.length < 2 || this.options.totalRows <= f[0]) &&
|
||
|
this.$pagination.find("span.page-list").hide(),
|
||
|
this.$pagination[this.getData().length ? "show" : "hide"]()),
|
||
|
this.options.paginationLoop ||
|
||
|
(1 === this.options.pageNumber && r.addClass("disabled"),
|
||
|
this.options.pageNumber === this.totalPages &&
|
||
|
l.addClass("disabled")),
|
||
|
d && (this.options.pageSize = this.options.formatAllRows()),
|
||
|
a.off("click").on("click", t.proxy(this.onPageListChange, this)),
|
||
|
r.off("click").on("click", t.proxy(this.onPagePre, this)),
|
||
|
l.off("click").on("click", t.proxy(this.onPageNext, this)),
|
||
|
h.off("click").on("click", t.proxy(this.onPageNumber, this)));
|
||
|
} else this.$pagination.hide();
|
||
|
}),
|
||
|
(u.prototype.updatePagination = function (i) {
|
||
|
(i && t(i.currentTarget).hasClass("disabled")) ||
|
||
|
(this.options.maintainSelected || this.resetRows(),
|
||
|
this.initPagination(),
|
||
|
"server" === this.options.sidePagination
|
||
|
? this.initServer()
|
||
|
: this.initBody(),
|
||
|
this.trigger(
|
||
|
"page-change",
|
||
|
this.options.pageNumber,
|
||
|
this.options.pageSize
|
||
|
));
|
||
|
}),
|
||
|
(u.prototype.onPageListChange = function (i) {
|
||
|
i.preventDefault();
|
||
|
var e = t(i.currentTarget);
|
||
|
return (
|
||
|
e.parent().addClass("active").siblings().removeClass("active"),
|
||
|
(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(i),
|
||
|
!1
|
||
|
);
|
||
|
}),
|
||
|
(u.prototype.onPagePre = function (t) {
|
||
|
return (
|
||
|
t.preventDefault(),
|
||
|
this.options.pageNumber - 1 == 0
|
||
|
? (this.options.pageNumber = this.options.totalPages)
|
||
|
: this.options.pageNumber--,
|
||
|
this.updatePagination(t),
|
||
|
!1
|
||
|
);
|
||
|
}),
|
||
|
(u.prototype.onPageNext = function (t) {
|
||
|
return (
|
||
|
t.preventDefault(),
|
||
|
this.options.pageNumber + 1 > this.options.totalPages
|
||
|
? (this.options.pageNumber = 1)
|
||
|
: this.options.pageNumber++,
|
||
|
this.updatePagination(t),
|
||
|
!1
|
||
|
);
|
||
|
}),
|
||
|
(u.prototype.onPageNumber = function (i) {
|
||
|
if (
|
||
|
(i.preventDefault(),
|
||
|
this.options.pageNumber !== +t(i.currentTarget).text())
|
||
|
)
|
||
|
return (
|
||
|
(this.options.pageNumber = +t(i.currentTarget).text()),
|
||
|
this.updatePagination(i),
|
||
|
!1
|
||
|
);
|
||
|
}),
|
||
|
(u.prototype.initRow = function (i, e, o, a) {
|
||
|
var l,
|
||
|
p = this,
|
||
|
d = [],
|
||
|
u = {},
|
||
|
f = [],
|
||
|
g = "",
|
||
|
b = {},
|
||
|
m = [];
|
||
|
if (!(t.inArray(i, this.hiddenRows) > -1)) {
|
||
|
if ((u = r(this.options, this.options.rowStyle, [i, e], u)) && u.css)
|
||
|
for (l in u.css) f.push(l + ": " + u.css[l]);
|
||
|
if ((b = r(this.options, this.options.rowAttributes, [i, e], b)))
|
||
|
for (l in b) m.push(s('%s="%s"', l, h(b[l])));
|
||
|
return (
|
||
|
i._data &&
|
||
|
!t.isEmptyObject(i._data) &&
|
||
|
t.each(i._data, function (t, i) {
|
||
|
"index" !== t && (g += s(' data-%s="%s"', t, i));
|
||
|
}),
|
||
|
d.push(
|
||
|
"<tr",
|
||
|
s(" %s", m.join(" ")),
|
||
|
s(' id="%s"', t.isArray(i) ? void 0 : i._id),
|
||
|
s(' class="%s"', u.classes || (t.isArray(i) ? void 0 : i._class)),
|
||
|
s(' data-index="%s"', e),
|
||
|
s(' data-uniqueid="%s"', i[this.options.uniqueId]),
|
||
|
s("%s", g),
|
||
|
">"
|
||
|
),
|
||
|
this.options.cardView &&
|
||
|
d.push(
|
||
|
s(
|
||
|
'<td colspan="%s"><div class="card-views">',
|
||
|
this.header.fields.length
|
||
|
)
|
||
|
),
|
||
|
!this.options.cardView &&
|
||
|
this.options.detailView &&
|
||
|
(d.push("<td>"),
|
||
|
r(null, this.options.detailFilter, [e, i]) &&
|
||
|
d.push(
|
||
|
'<a class="detail-icon" href="#">',
|
||
|
s(
|
||
|
'<i class="%s %s"></i>',
|
||
|
this.options.iconsPrefix,
|
||
|
this.options.icons.detailOpen
|
||
|
),
|
||
|
"</a>"
|
||
|
),
|
||
|
d.push("</td>")),
|
||
|
t.each(this.header.fields, function (o, a) {
|
||
|
var l = "",
|
||
|
g = c(i, a, p.options.escape),
|
||
|
b = "",
|
||
|
m = "",
|
||
|
y = {},
|
||
|
w = "",
|
||
|
v = p.header.classes[o],
|
||
|
x = "",
|
||
|
S = "",
|
||
|
$ = "",
|
||
|
k = "",
|
||
|
C = p.columns[o];
|
||
|
if (
|
||
|
(!p.fromHtml || void 0 !== g || C.checkbox || C.radio) &&
|
||
|
C.visible &&
|
||
|
(!p.options.cardView || C.cardVisible)
|
||
|
) {
|
||
|
if (
|
||
|
(C.escape && (g = h(g)),
|
||
|
(u = s('style="%s"', f.concat(p.header.styles[o]).join("; "))),
|
||
|
i["_" + a + "_id"] && (w = s(' id="%s"', i["_" + a + "_id"])),
|
||
|
i["_" + a + "_class"] &&
|
||
|
(v = s(' class="%s"', i["_" + a + "_class"])),
|
||
|
i["_" + a + "_rowspan"] &&
|
||
|
(S = s(' rowspan="%s"', i["_" + a + "_rowspan"])),
|
||
|
i["_" + a + "_colspan"] &&
|
||
|
($ = s(' colspan="%s"', i["_" + a + "_colspan"])),
|
||
|
i["_" + a + "_title"] &&
|
||
|
(k = s(' title="%s"', i["_" + a + "_title"])),
|
||
|
(y = r(p.header, p.header.cellStyles[o], [g, i, e, a], y))
|
||
|
.classes && (v = s(' class="%s"', y.classes)),
|
||
|
y.css)
|
||
|
) {
|
||
|
var P = [];
|
||
|
for (var T in y.css) P.push(T + ": " + y.css[T]);
|
||
|
u = s('style="%s"', P.concat(p.header.styles[o]).join("; "));
|
||
|
}
|
||
|
(b = r(C, p.header.formatters[o], [g, i, e, a], g)),
|
||
|
i["_" + a + "_data"] &&
|
||
|
!t.isEmptyObject(i["_" + a + "_data"]) &&
|
||
|
t.each(i["_" + a + "_data"], function (t, i) {
|
||
|
"index" !== t && (x += s(' data-%s="%s"', t, i));
|
||
|
}),
|
||
|
C.checkbox || C.radio
|
||
|
? ((m = C.checkbox ? "checkbox" : m),
|
||
|
(m = C.radio ? "radio" : m),
|
||
|
(l = [
|
||
|
s(
|
||
|
p.options.cardView
|
||
|
? '<div class="card-view %s">'
|
||
|
: '<td class="bs-checkbox %s">',
|
||
|
C.class || ""
|
||
|
),
|
||
|
"<input" +
|
||
|
s(' data-index="%s"', e) +
|
||
|
s(' name="%s"', p.options.selectItemName) +
|
||
|
s(' type="%s"', m) +
|
||
|
s(' value="%s"', i[p.options.idField]) +
|
||
|
s(
|
||
|
' checked="%s"',
|
||
|
!0 === b || g || (b && b.checked) ? "checked" : void 0
|
||
|
) +
|
||
|
s(
|
||
|
' disabled="%s"',
|
||
|
!C.checkboxEnabled || (b && b.disabled)
|
||
|
? "disabled"
|
||
|
: void 0
|
||
|
) +
|
||
|
" />",
|
||
|
p.header.formatters[o] && "string" == typeof b ? b : "",
|
||
|
p.options.cardView ? "</div>" : "</td>",
|
||
|
].join("")),
|
||
|
(i[p.header.stateField] =
|
||
|
!0 === b || !!g || (b && b.checked)))
|
||
|
: ((b = null == b ? p.options.undefinedText : b),
|
||
|
(l = p.options.cardView
|
||
|
? [
|
||
|
'<div class="card-view">',
|
||
|
p.options.showHeader
|
||
|
? s(
|
||
|
'<span class="title" %s>%s</span>',
|
||
|
u,
|
||
|
n(p.columns, "field", "title", a)
|
||
|
)
|
||
|
: "",
|
||
|
s('<span class="value">%s</span>', b),
|
||
|
"</div>",
|
||
|
].join("")
|
||
|
: [
|
||
|
s("<td%s %s %s %s %s %s %s>", w, v, u, x, S, $, k),
|
||
|
b,
|
||
|
"</td>",
|
||
|
].join("")),
|
||
|
p.options.cardView &&
|
||
|
p.options.smartDisplay &&
|
||
|
"" === b &&
|
||
|
(l = '<div class="card-view"></div>')),
|
||
|
d.push(l);
|
||
|
}
|
||
|
}),
|
||
|
this.options.cardView && d.push("</div></td>"),
|
||
|
d.push("</tr>"),
|
||
|
d.join(" ")
|
||
|
);
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.initBody = function (i) {
|
||
|
var e = this,
|
||
|
o = this.getData();
|
||
|
this.trigger("pre-body", o),
|
||
|
(this.$body = this.$el.find(">tbody")),
|
||
|
this.$body.length ||
|
||
|
(this.$body = t("<tbody></tbody>").appendTo(this.$el)),
|
||
|
(this.options.pagination && "server" !== this.options.sidePagination) ||
|
||
|
((this.pageFrom = 1), (this.pageTo = o.length));
|
||
|
for (
|
||
|
var n, a = t(document.createDocumentFragment()), l = this.pageFrom - 1;
|
||
|
l < this.pageTo;
|
||
|
l++
|
||
|
) {
|
||
|
var h = o[l],
|
||
|
p = this.initRow(h, l, o, a);
|
||
|
(n = n || !!p), p && !0 !== p && a.append(p);
|
||
|
}
|
||
|
n ||
|
||
|
a.append(
|
||
|
'<tr class="no-records-found">' +
|
||
|
s(
|
||
|
'<td colspan="%s">%s</td>',
|
||
|
this.$header.find("th").length,
|
||
|
this.options.formatNoMatches()
|
||
|
) +
|
||
|
"</tr>"
|
||
|
),
|
||
|
this.$body.html(a),
|
||
|
i || this.scrollTo(0),
|
||
|
this.$body
|
||
|
.find("> tr[data-index] > td")
|
||
|
.off("click dblclick")
|
||
|
.on("click dblclick", function (i) {
|
||
|
var o = t(this),
|
||
|
n = o.parent(),
|
||
|
a = e.data[n.data("index")],
|
||
|
r = o[0].cellIndex,
|
||
|
l =
|
||
|
e.getVisibleFields()[
|
||
|
e.options.detailView && !e.options.cardView ? r - 1 : r
|
||
|
],
|
||
|
h = e.columns[e.fieldsColumnsIndex[l]],
|
||
|
p = c(a, l, e.options.escape);
|
||
|
if (
|
||
|
!o.find(".detail-icon").length &&
|
||
|
(e.trigger(
|
||
|
"click" === i.type ? "click-cell" : "dbl-click-cell",
|
||
|
l,
|
||
|
p,
|
||
|
a,
|
||
|
o
|
||
|
),
|
||
|
e.trigger(
|
||
|
"click" === i.type ? "click-row" : "dbl-click-row",
|
||
|
a,
|
||
|
n,
|
||
|
l
|
||
|
),
|
||
|
"click" === i.type &&
|
||
|
e.options.clickToSelect &&
|
||
|
h.clickToSelect &&
|
||
|
e.options.ignoreClickToSelectOn(i.target))
|
||
|
) {
|
||
|
var d = n.find(s('[name="%s"]', e.options.selectItemName));
|
||
|
d.length && d[0].click();
|
||
|
}
|
||
|
}),
|
||
|
this.$body
|
||
|
.find("> tr[data-index] > td > .detail-icon")
|
||
|
.off("click")
|
||
|
.on("click", function (i) {
|
||
|
i.preventDefault();
|
||
|
var n = t(this),
|
||
|
a = n.parent().parent(),
|
||
|
l = a.data("index"),
|
||
|
h = o[l];
|
||
|
if (a.next().is("tr.detail-view"))
|
||
|
n
|
||
|
.find("i")
|
||
|
.attr(
|
||
|
"class",
|
||
|
s("%s %s", e.options.iconsPrefix, e.options.icons.detailOpen)
|
||
|
),
|
||
|
e.trigger("collapse-row", l, h, a.next()),
|
||
|
a.next().remove();
|
||
|
else {
|
||
|
n
|
||
|
.find("i")
|
||
|
.attr(
|
||
|
"class",
|
||
|
s("%s %s", e.options.iconsPrefix, e.options.icons.detailClose)
|
||
|
),
|
||
|
a.after(
|
||
|
s(
|
||
|
'<tr class="detail-view"><td colspan="%s"></td></tr>',
|
||
|
a.find("td").length
|
||
|
)
|
||
|
);
|
||
|
var p = a.next().find("td"),
|
||
|
c = r(e.options, e.options.detailFormatter, [l, h, p], "");
|
||
|
1 === p.length && p.append(c), e.trigger("expand-row", l, h, p);
|
||
|
}
|
||
|
return e.resetView(), !1;
|
||
|
}),
|
||
|
(this.$selectItem = this.$body.find(
|
||
|
s('[name="%s"]', this.options.selectItemName)
|
||
|
)),
|
||
|
this.$selectItem.off("click").on("click", function (i) {
|
||
|
i.stopImmediatePropagation();
|
||
|
var o = t(this),
|
||
|
s = o.prop("checked"),
|
||
|
n = e.data[o.data("index")];
|
||
|
(t(this).is(":radio") || e.options.singleSelect) &&
|
||
|
t.each(e.options.data, function (t, i) {
|
||
|
i[e.header.stateField] = !1;
|
||
|
}),
|
||
|
(n[e.header.stateField] = s),
|
||
|
e.options.singleSelect &&
|
||
|
(e.$selectItem.not(this).each(function () {
|
||
|
e.data[t(this).data("index")][e.header.stateField] = !1;
|
||
|
}),
|
||
|
e.$selectItem.filter(":checked").not(this).prop("checked", !1)),
|
||
|
e.updateSelected(),
|
||
|
e.trigger(s ? "check" : "uncheck", n, o);
|
||
|
}),
|
||
|
t.each(this.header.events, function (i, o) {
|
||
|
if (o) {
|
||
|
"string" == typeof o && (o = r(null, o));
|
||
|
var s = e.header.fields[i],
|
||
|
n = t.inArray(s, e.getVisibleFields());
|
||
|
if (-1 !== n)
|
||
|
for (var a in (e.options.detailView &&
|
||
|
!e.options.cardView &&
|
||
|
(n += 1),
|
||
|
o))
|
||
|
e.$body.find(">tr:not(.no-records-found)").each(function () {
|
||
|
var i = t(this),
|
||
|
r = i.find(e.options.cardView ? ".card-view" : "td").eq(n),
|
||
|
l = a.indexOf(" "),
|
||
|
h = a.substring(0, l),
|
||
|
p = a.substring(l + 1),
|
||
|
c = o[a];
|
||
|
r.find(p)
|
||
|
.off(h)
|
||
|
.on(h, function (t) {
|
||
|
var o = i.data("index"),
|
||
|
n = e.data[o],
|
||
|
a = n[s];
|
||
|
c.apply(this, [t, a, n, o]);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
}),
|
||
|
this.updateSelected(),
|
||
|
this.resetView(),
|
||
|
this.trigger("post-body", o);
|
||
|
}),
|
||
|
(u.prototype.initServer = function (i, e, o) {
|
||
|
var s,
|
||
|
n = this,
|
||
|
a = {},
|
||
|
l = t.inArray(this.options.sortName, this.header.fields),
|
||
|
h = {
|
||
|
searchText: this.searchText,
|
||
|
sortName: this.options.sortName,
|
||
|
sortOrder: this.options.sortOrder,
|
||
|
};
|
||
|
this.header.sortNames[l] && (h.sortName = this.header.sortNames[l]),
|
||
|
this.options.pagination &&
|
||
|
"server" === this.options.sidePagination &&
|
||
|
((h.pageSize =
|
||
|
this.options.pageSize === this.options.formatAllRows()
|
||
|
? this.options.totalRows
|
||
|
: this.options.pageSize),
|
||
|
(h.pageNumber = this.options.pageNumber)),
|
||
|
(o || this.options.url || this.options.ajax) &&
|
||
|
("limit" === this.options.queryParamsType &&
|
||
|
((h = {
|
||
|
search: h.searchText,
|
||
|
sort: h.sortName,
|
||
|
order: h.sortOrder,
|
||
|
}),
|
||
|
this.options.pagination &&
|
||
|
"server" === this.options.sidePagination &&
|
||
|
((h.offset =
|
||
|
this.options.pageSize === this.options.formatAllRows()
|
||
|
? 0
|
||
|
: this.options.pageSize * (this.options.pageNumber - 1)),
|
||
|
(h.limit =
|
||
|
this.options.pageSize === this.options.formatAllRows()
|
||
|
? this.options.totalRows
|
||
|
: this.options.pageSize),
|
||
|
0 === h.limit && delete h.limit)),
|
||
|
t.isEmptyObject(this.filterColumnsPartial) ||
|
||
|
(h.filter = JSON.stringify(this.filterColumnsPartial, null)),
|
||
|
(a = r(this.options, this.options.queryParams, [h], a)),
|
||
|
t.extend(a, e || {}),
|
||
|
!1 !== a &&
|
||
|
(i || this.$tableLoading.show(),
|
||
|
(s = t.extend({}, r(null, this.options.ajaxOptions), {
|
||
|
type: this.options.method,
|
||
|
url: o || this.options.url,
|
||
|
data:
|
||
|
"application/json" === this.options.contentType &&
|
||
|
"post" === this.options.method
|
||
|
? JSON.stringify(a)
|
||
|
: a,
|
||
|
cache: this.options.cache,
|
||
|
contentType: this.options.contentType,
|
||
|
dataType: this.options.dataType,
|
||
|
success: function (t) {
|
||
|
(t = r(n.options, n.options.responseHandler, [t], t)),
|
||
|
n.load(t),
|
||
|
n.trigger("load-success", t),
|
||
|
i || n.$tableLoading.hide();
|
||
|
},
|
||
|
error: function (t) {
|
||
|
var e = [];
|
||
|
"server" === n.options.sidePagination &&
|
||
|
(((e = {})[n.options.totalField] = 0),
|
||
|
(e[n.options.dataField] = [])),
|
||
|
n.load(e),
|
||
|
n.trigger("load-error", t.status, t),
|
||
|
i || n.$tableLoading.hide();
|
||
|
},
|
||
|
})),
|
||
|
this.options.ajax
|
||
|
? r(this, this.options.ajax, [s], null)
|
||
|
: (this._xhr && 4 !== this._xhr.readyState && this._xhr.abort(),
|
||
|
(this._xhr = t.ajax(s)))));
|
||
|
}),
|
||
|
(u.prototype.initSearchText = function () {
|
||
|
if (
|
||
|
this.options.search &&
|
||
|
((this.searchText = ""), "" !== this.options.searchText)
|
||
|
) {
|
||
|
var t = this.$toolbar.find(".search input");
|
||
|
t.val(this.options.searchText),
|
||
|
this.onSearch({ currentTarget: t, firedByInitSearchText: !0 });
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.getCaret = function () {
|
||
|
var i = this;
|
||
|
t.each(this.$header.find("th"), function (e, o) {
|
||
|
t(o)
|
||
|
.find(".sortable")
|
||
|
.removeClass("desc asc")
|
||
|
.addClass(
|
||
|
t(o).data("field") === i.options.sortName
|
||
|
? i.options.sortOrder
|
||
|
: "both"
|
||
|
);
|
||
|
});
|
||
|
}),
|
||
|
(u.prototype.updateSelected = function () {
|
||
|
var i =
|
||
|
this.$selectItem.filter(":enabled").length &&
|
||
|
this.$selectItem.filter(":enabled").length ===
|
||
|
this.$selectItem.filter(":enabled").filter(":checked").length;
|
||
|
this.$selectAll.add(this.$selectAll_).prop("checked", i),
|
||
|
this.$selectItem.each(function () {
|
||
|
t(this)
|
||
|
.closest("tr")
|
||
|
[t(this).prop("checked") ? "addClass" : "removeClass"]("selected");
|
||
|
});
|
||
|
}),
|
||
|
(u.prototype.updateRows = function () {
|
||
|
var i = this;
|
||
|
this.$selectItem.each(function () {
|
||
|
i.data[t(this).data("index")][i.header.stateField] =
|
||
|
t(this).prop("checked");
|
||
|
});
|
||
|
}),
|
||
|
(u.prototype.resetRows = function () {
|
||
|
var i = this;
|
||
|
t.each(this.data, function (t, e) {
|
||
|
i.$selectAll.prop("checked", !1),
|
||
|
i.$selectItem.prop("checked", !1),
|
||
|
i.header.stateField && (e[i.header.stateField] = !1);
|
||
|
}),
|
||
|
this.initHiddenRows();
|
||
|
}),
|
||
|
(u.prototype.trigger = function (i) {
|
||
|
var e = Array.prototype.slice.call(arguments, 1);
|
||
|
(i += ".bs.table"),
|
||
|
this.options[u.EVENTS[i]].apply(this.options, e),
|
||
|
this.$el.trigger(t.Event(i), e),
|
||
|
this.options.onAll(i, e),
|
||
|
this.$el.trigger(t.Event("all.bs.table"), [i, e]);
|
||
|
}),
|
||
|
(u.prototype.resetHeader = function () {
|
||
|
clearTimeout(this.timeoutId_),
|
||
|
(this.timeoutId_ = setTimeout(
|
||
|
t.proxy(this.fitHeader, this),
|
||
|
this.$el.is(":hidden") ? 100 : 0
|
||
|
));
|
||
|
}),
|
||
|
(u.prototype.fitHeader = function () {
|
||
|
var i,
|
||
|
e,
|
||
|
o,
|
||
|
n,
|
||
|
r = this;
|
||
|
if (r.$el.is(":hidden"))
|
||
|
r.timeoutId_ = setTimeout(t.proxy(r.fitHeader, r), 100);
|
||
|
else {
|
||
|
if (
|
||
|
((e =
|
||
|
(i = this.$tableBody.get(0)).scrollWidth > i.clientWidth &&
|
||
|
i.scrollHeight > i.clientHeight + this.$header.outerHeight()
|
||
|
? a()
|
||
|
: 0),
|
||
|
this.$el.css("margin-top", -this.$header.outerHeight()),
|
||
|
(o = t(":focus")).length > 0)
|
||
|
) {
|
||
|
var l = o.parents("th");
|
||
|
if (l.length > 0) {
|
||
|
var h = l.attr("data-field");
|
||
|
if (void 0 !== h) {
|
||
|
var p = this.$header.find("[data-field='" + h + "']");
|
||
|
p.length > 0 && p.find(":input").addClass("focus-temp");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
(this.$header_ = this.$header.clone(!0, !0)),
|
||
|
(this.$selectAll_ = this.$header_.find('[name="btSelectAll"]')),
|
||
|
this.$tableHeader
|
||
|
.css({ "margin-right": e })
|
||
|
.find("table")
|
||
|
.css("width", this.$el.outerWidth())
|
||
|
.html("")
|
||
|
.attr("class", this.$el.attr("class"))
|
||
|
.append(this.$header_),
|
||
|
(n = t(".focus-temp:visible:eq(0)")).length > 0 &&
|
||
|
(n.focus(),
|
||
|
this.$header.find(".focus-temp").removeClass("focus-temp")),
|
||
|
this.$header.find("th[data-field]").each(function (i) {
|
||
|
r.$header_
|
||
|
.find(s('th[data-field="%s"]', t(this).data("field")))
|
||
|
.data(t(this).data());
|
||
|
});
|
||
|
var c = this.getVisibleFields(),
|
||
|
d = this.$header_.find("th");
|
||
|
this.$body
|
||
|
.find(">tr:first-child:not(.no-records-found) > *")
|
||
|
.each(function (i) {
|
||
|
var e = t(this),
|
||
|
o = i;
|
||
|
if (
|
||
|
(r.options.detailView &&
|
||
|
!r.options.cardView &&
|
||
|
(0 === i &&
|
||
|
r.$header_
|
||
|
.find("th.detail")
|
||
|
.find(".fht-cell")
|
||
|
.width(e.innerWidth()),
|
||
|
(o = i - 1)),
|
||
|
-1 !== o)
|
||
|
) {
|
||
|
var n = r.$header_.find(s('th[data-field="%s"]', c[o]));
|
||
|
n.length > 1 && (n = t(d[e[0].cellIndex]));
|
||
|
var a = n.width() - n.find(".fht-cell").width();
|
||
|
n.find(".fht-cell").width(e.innerWidth() - a);
|
||
|
}
|
||
|
}),
|
||
|
this.horizontalScroll(),
|
||
|
this.trigger("post-header");
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.resetFooter = function () {
|
||
|
var i = this,
|
||
|
e = i.getData(),
|
||
|
o = [];
|
||
|
this.options.showFooter &&
|
||
|
!this.options.cardView &&
|
||
|
(!this.options.cardView &&
|
||
|
this.options.detailView &&
|
||
|
o.push(
|
||
|
'<td><div class="th-inner"> </div><div class="fht-cell"></div></td>'
|
||
|
),
|
||
|
t.each(this.columns, function (t, n) {
|
||
|
var a,
|
||
|
l,
|
||
|
h,
|
||
|
p,
|
||
|
c = [],
|
||
|
d = s(' class="%s"', n.class);
|
||
|
if (n.visible && (!i.options.cardView || n.cardVisible)) {
|
||
|
if (
|
||
|
((l = s("text-align: %s; ", n.falign ? n.falign : n.align)),
|
||
|
(h = s("vertical-align: %s; ", n.valign)),
|
||
|
(p = r(null, i.options.footerStyle)) && p.css)
|
||
|
)
|
||
|
for (a in p.css) c.push(a + ": " + p.css[a]);
|
||
|
o.push(
|
||
|
"<td",
|
||
|
d,
|
||
|
s(' style="%s"', l + h + c.concat().join("; ")),
|
||
|
">"
|
||
|
),
|
||
|
o.push('<div class="th-inner">'),
|
||
|
o.push(r(n, n.footerFormatter, [e], " ") || " "),
|
||
|
o.push("</div>"),
|
||
|
o.push('<div class="fht-cell"></div>'),
|
||
|
o.push("</div>"),
|
||
|
o.push("</td>");
|
||
|
}
|
||
|
}),
|
||
|
this.$tableFooter.find("tr").html(o.join("")),
|
||
|
this.$tableFooter.show(),
|
||
|
clearTimeout(this.timeoutFooter_),
|
||
|
(this.timeoutFooter_ = setTimeout(
|
||
|
t.proxy(this.fitFooter, this),
|
||
|
this.$el.is(":hidden") ? 100 : 0
|
||
|
)));
|
||
|
}),
|
||
|
(u.prototype.fitFooter = function () {
|
||
|
var i, e, o;
|
||
|
clearTimeout(this.timeoutFooter_),
|
||
|
this.$el.is(":hidden")
|
||
|
? (this.timeoutFooter_ = setTimeout(
|
||
|
t.proxy(this.fitFooter, this),
|
||
|
100
|
||
|
))
|
||
|
: ((o =
|
||
|
(e = this.$el.css("width")) > this.$tableBody.width() ? a() : 0),
|
||
|
this.$tableFooter
|
||
|
.css({ "margin-right": o })
|
||
|
.find("table")
|
||
|
.css("width", e)
|
||
|
.attr("class", this.$el.attr("class")),
|
||
|
(i = this.$tableFooter.find("td")),
|
||
|
this.$body
|
||
|
.find(">tr:first-child:not(.no-records-found) > *")
|
||
|
.each(function (e) {
|
||
|
var o = t(this);
|
||
|
i.eq(e).find(".fht-cell").width(o.innerWidth());
|
||
|
}),
|
||
|
this.horizontalScroll());
|
||
|
}),
|
||
|
(u.prototype.horizontalScroll = function () {
|
||
|
var i = this;
|
||
|
i.trigger("scroll-body"),
|
||
|
this.$tableBody.off("scroll").on("scroll", function () {
|
||
|
i.options.showHeader &&
|
||
|
i.options.height &&
|
||
|
i.$tableHeader.scrollLeft(t(this).scrollLeft()),
|
||
|
i.options.showFooter &&
|
||
|
!i.options.cardView &&
|
||
|
i.$tableFooter.scrollLeft(t(this).scrollLeft());
|
||
|
});
|
||
|
}),
|
||
|
(u.prototype.toggleColumn = function (t, i, e) {
|
||
|
if (
|
||
|
-1 !== t &&
|
||
|
((this.columns[t].visible = i),
|
||
|
this.initHeader(),
|
||
|
this.initSearch(),
|
||
|
this.initPagination(),
|
||
|
this.initBody(),
|
||
|
this.options.showColumns)
|
||
|
) {
|
||
|
var o = this.$toolbar.find(".keep-open input").prop("disabled", !1);
|
||
|
e && o.filter(s('[value="%s"]', t)).prop("checked", i),
|
||
|
o.filter(":checked").length <= this.options.minimumCountColumns &&
|
||
|
o.filter(":checked").prop("disabled", !0);
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.getVisibleFields = function () {
|
||
|
var i = this,
|
||
|
e = [];
|
||
|
return (
|
||
|
t.each(this.header.fields, function (t, o) {
|
||
|
i.columns[i.fieldsColumnsIndex[o]].visible && e.push(o);
|
||
|
}),
|
||
|
e
|
||
|
);
|
||
|
}),
|
||
|
(u.prototype.resetView = function (t) {
|
||
|
var i = 0;
|
||
|
if (
|
||
|
(t && t.height && (this.options.height = t.height),
|
||
|
this.$selectAll.prop(
|
||
|
"checked",
|
||
|
this.$selectItem.length > 0 &&
|
||
|
this.$selectItem.length ===
|
||
|
this.$selectItem.filter(":checked").length
|
||
|
),
|
||
|
this.options.height)
|
||
|
) {
|
||
|
var e = this.$toolbar.outerHeight(!0),
|
||
|
o = this.$pagination.outerHeight(!0),
|
||
|
s = this.options.height - e - o;
|
||
|
this.$tableContainer.css("height", s + "px");
|
||
|
}
|
||
|
if (this.options.cardView)
|
||
|
return (
|
||
|
this.$el.css("margin-top", "0"),
|
||
|
this.$tableContainer.css("padding-bottom", "0"),
|
||
|
void this.$tableFooter.hide()
|
||
|
);
|
||
|
this.options.showHeader && this.options.height
|
||
|
? (this.$tableHeader.show(),
|
||
|
this.resetHeader(),
|
||
|
(i += this.$header.outerHeight()))
|
||
|
: (this.$tableHeader.hide(), this.trigger("post-header")),
|
||
|
this.options.showFooter &&
|
||
|
(this.resetFooter(),
|
||
|
this.options.height && (i += this.$tableFooter.outerHeight() + 1)),
|
||
|
this.getCaret(),
|
||
|
this.$tableContainer.css("padding-bottom", i + "px"),
|
||
|
this.trigger("reset-view");
|
||
|
}),
|
||
|
(u.prototype.getData = function (i) {
|
||
|
var e = this.options.data;
|
||
|
return (
|
||
|
(!this.searchText &&
|
||
|
!this.options.sortName &&
|
||
|
t.isEmptyObject(this.filterColumns) &&
|
||
|
t.isEmptyObject(this.filterColumnsPartial)) ||
|
||
|
(e = this.data),
|
||
|
i ? e.slice(this.pageFrom - 1, this.pageTo) : e
|
||
|
);
|
||
|
}),
|
||
|
(u.prototype.load = function (i) {
|
||
|
var e = !1;
|
||
|
this.options.pagination && "server" === this.options.sidePagination
|
||
|
? ((this.options.totalRows = i[this.options.totalField]),
|
||
|
(e = i.fixedScroll),
|
||
|
(i = i[this.options.dataField]))
|
||
|
: t.isArray(i) || ((e = i.fixedScroll), (i = i.data)),
|
||
|
this.initData(i),
|
||
|
this.initSearch(),
|
||
|
this.initPagination(),
|
||
|
this.initBody(e);
|
||
|
}),
|
||
|
(u.prototype.append = function (t) {
|
||
|
this.initData(t, "append"),
|
||
|
this.initSearch(),
|
||
|
this.initPagination(),
|
||
|
this.initSort(),
|
||
|
this.initBody(!0);
|
||
|
}),
|
||
|
(u.prototype.prepend = function (t) {
|
||
|
this.initData(t, "prepend"),
|
||
|
this.initSearch(),
|
||
|
this.initPagination(),
|
||
|
this.initSort(),
|
||
|
this.initBody(!0);
|
||
|
}),
|
||
|
(u.prototype.remove = function (i) {
|
||
|
var e,
|
||
|
o,
|
||
|
s = this.options.data.length;
|
||
|
if (i.hasOwnProperty("field") && i.hasOwnProperty("values")) {
|
||
|
for (e = s - 1; e >= 0; e--)
|
||
|
(o = this.options.data[e]).hasOwnProperty(i.field) &&
|
||
|
-1 !== t.inArray(o[i.field], i.values) &&
|
||
|
(this.options.data.splice(e, 1),
|
||
|
"server" === this.options.sidePagination &&
|
||
|
(this.options.totalRows -= 1));
|
||
|
s !== this.options.data.length &&
|
||
|
(this.initSearch(),
|
||
|
this.initPagination(),
|
||
|
this.initSort(),
|
||
|
this.initBody(!0));
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.removeAll = function () {
|
||
|
this.options.data.length > 0 &&
|
||
|
(this.options.data.splice(0, this.options.data.length),
|
||
|
this.initSearch(),
|
||
|
this.initPagination(),
|
||
|
this.initBody(!0));
|
||
|
}),
|
||
|
(u.prototype.getRowByUniqueId = function (t) {
|
||
|
var i,
|
||
|
e,
|
||
|
o,
|
||
|
s = this.options.uniqueId,
|
||
|
n = null;
|
||
|
for (i = this.options.data.length - 1; i >= 0; i--) {
|
||
|
if ((e = this.options.data[i]).hasOwnProperty(s)) o = e[s];
|
||
|
else {
|
||
|
if (!e._data.hasOwnProperty(s)) continue;
|
||
|
o = e._data[s];
|
||
|
}
|
||
|
if (
|
||
|
("string" == typeof o
|
||
|
? (t = t.toString())
|
||
|
: "number" == typeof o &&
|
||
|
(Number(o) === o && o % 1 == 0
|
||
|
? (t = parseInt(t))
|
||
|
: o === Number(o) && 0 !== o && (t = parseFloat(t))),
|
||
|
o === t)
|
||
|
) {
|
||
|
n = e;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return n;
|
||
|
}),
|
||
|
(u.prototype.removeByUniqueId = function (t) {
|
||
|
var i = this.options.data.length,
|
||
|
e = this.getRowByUniqueId(t);
|
||
|
e && this.options.data.splice(this.options.data.indexOf(e), 1),
|
||
|
i !== this.options.data.length &&
|
||
|
(this.initSearch(), this.initPagination(), this.initBody(!0));
|
||
|
}),
|
||
|
(u.prototype.updateByUniqueId = function (i) {
|
||
|
var e = this,
|
||
|
o = t.isArray(i) ? i : [i];
|
||
|
t.each(o, function (i, o) {
|
||
|
var s;
|
||
|
o.hasOwnProperty("id") &&
|
||
|
o.hasOwnProperty("row") &&
|
||
|
-1 !== (s = t.inArray(e.getRowByUniqueId(o.id), e.options.data)) &&
|
||
|
t.extend(e.options.data[s], o.row);
|
||
|
}),
|
||
|
this.initSearch(),
|
||
|
this.initPagination(),
|
||
|
this.initSort(),
|
||
|
this.initBody(!0);
|
||
|
}),
|
||
|
(u.prototype.refreshColumnTitle = function (i) {
|
||
|
i.hasOwnProperty("field") &&
|
||
|
i.hasOwnProperty("title") &&
|
||
|
((this.columns[this.fieldsColumnsIndex[i.field]].title = this.options
|
||
|
.escape
|
||
|
? h(i.title)
|
||
|
: i.title),
|
||
|
this.columns[this.fieldsColumnsIndex[i.field]].visible &&
|
||
|
(void 0 !== this.options.height ? this.$tableHeader : this.$header)
|
||
|
.find("th[data-field]")
|
||
|
.each(function (e) {
|
||
|
if (t(this).data("field") === i.field)
|
||
|
return t(t(this).find(".th-inner")[0]).text(i.title), !1;
|
||
|
}));
|
||
|
}),
|
||
|
(u.prototype.insertRow = 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));
|
||
|
}),
|
||
|
(u.prototype.updateRow = function (i) {
|
||
|
var e = this,
|
||
|
o = t.isArray(i) ? i : [i];
|
||
|
t.each(o, function (i, o) {
|
||
|
o.hasOwnProperty("index") &&
|
||
|
o.hasOwnProperty("row") &&
|
||
|
t.extend(e.options.data[o.index], o.row);
|
||
|
}),
|
||
|
this.initSearch(),
|
||
|
this.initPagination(),
|
||
|
this.initSort(),
|
||
|
this.initBody(!0);
|
||
|
}),
|
||
|
(u.prototype.initHiddenRows = function () {
|
||
|
this.hiddenRows = [];
|
||
|
}),
|
||
|
(u.prototype.showRow = function (t) {
|
||
|
this.toggleRow(t, !0);
|
||
|
}),
|
||
|
(u.prototype.hideRow = function (t) {
|
||
|
this.toggleRow(t, !1);
|
||
|
}),
|
||
|
(u.prototype.toggleRow = function (i, e) {
|
||
|
var o, s;
|
||
|
i.hasOwnProperty("index")
|
||
|
? (o = this.getData()[i.index])
|
||
|
: i.hasOwnProperty("uniqueId") &&
|
||
|
(o = this.getRowByUniqueId(i.uniqueId)),
|
||
|
o &&
|
||
|
((s = t.inArray(o, this.hiddenRows)),
|
||
|
e || -1 !== s
|
||
|
? e && s > -1 && this.hiddenRows.splice(s, 1)
|
||
|
: this.hiddenRows.push(o),
|
||
|
this.initBody(!0));
|
||
|
}),
|
||
|
(u.prototype.getHiddenRows = function (i) {
|
||
|
var e = this,
|
||
|
o = this.getData(),
|
||
|
s = [];
|
||
|
return (
|
||
|
t.each(o, function (i, o) {
|
||
|
t.inArray(o, e.hiddenRows) > -1 && s.push(o);
|
||
|
}),
|
||
|
(this.hiddenRows = s),
|
||
|
s
|
||
|
);
|
||
|
}),
|
||
|
(u.prototype.mergeCells = function (i) {
|
||
|
var e,
|
||
|
o,
|
||
|
s,
|
||
|
n = i.index,
|
||
|
a = t.inArray(i.field, this.getVisibleFields()),
|
||
|
r = i.rowspan || 1,
|
||
|
l = i.colspan || 1,
|
||
|
h = this.$body.find(">tr");
|
||
|
if (
|
||
|
(this.options.detailView && !this.options.cardView && (a += 1),
|
||
|
(s = h.eq(n).find(">td").eq(a)),
|
||
|
!(n < 0 || a < 0 || n >= this.data.length))
|
||
|
) {
|
||
|
for (e = n; e < n + r; e++)
|
||
|
for (o = a; o < a + l; o++) h.eq(e).find(">td").eq(o).hide();
|
||
|
s.attr("rowspan", r).attr("colspan", l).show();
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.updateCell = function (t) {
|
||
|
t.hasOwnProperty("index") &&
|
||
|
t.hasOwnProperty("field") &&
|
||
|
t.hasOwnProperty("value") &&
|
||
|
((this.data[t.index][t.field] = t.value),
|
||
|
!1 !== t.reinit && (this.initSort(), this.initBody(!0)));
|
||
|
}),
|
||
|
(u.prototype.updateCellById = function (i) {
|
||
|
var e = this;
|
||
|
if (
|
||
|
i.hasOwnProperty("id") &&
|
||
|
i.hasOwnProperty("field") &&
|
||
|
i.hasOwnProperty("value")
|
||
|
) {
|
||
|
var o = t.isArray(i) ? i : [i];
|
||
|
t.each(o, function (i, o) {
|
||
|
var s;
|
||
|
-1 !== (s = t.inArray(e.getRowByUniqueId(o.id), e.options.data)) &&
|
||
|
(e.data[s][o.field] = o.value);
|
||
|
}),
|
||
|
!1 !== i.reinit && (this.initSort(), this.initBody(!0));
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.getOptions = function () {
|
||
|
return t.extend(!0, {}, this.options);
|
||
|
}),
|
||
|
(u.prototype.getSelections = function () {
|
||
|
var i = this;
|
||
|
return t.grep(this.options.data, function (t) {
|
||
|
return !0 === t[i.header.stateField];
|
||
|
});
|
||
|
}),
|
||
|
(u.prototype.getAllSelections = function () {
|
||
|
var i = this;
|
||
|
return t.grep(this.options.data, function (t) {
|
||
|
return t[i.header.stateField];
|
||
|
});
|
||
|
}),
|
||
|
(u.prototype.checkAll = function () {
|
||
|
this.checkAll_(!0);
|
||
|
}),
|
||
|
(u.prototype.uncheckAll = function () {
|
||
|
this.checkAll_(!1);
|
||
|
}),
|
||
|
(u.prototype.checkInvert = function () {
|
||
|
var i = this.$selectItem.filter(":enabled"),
|
||
|
e = i.filter(":checked");
|
||
|
i.each(function () {
|
||
|
t(this).prop("checked", !t(this).prop("checked"));
|
||
|
}),
|
||
|
this.updateRows(),
|
||
|
this.updateSelected(),
|
||
|
this.trigger("uncheck-some", e),
|
||
|
(e = this.getSelections()),
|
||
|
this.trigger("check-some", e);
|
||
|
}),
|
||
|
(u.prototype.checkAll_ = function (t) {
|
||
|
var i;
|
||
|
t || (i = this.getSelections()),
|
||
|
this.$selectAll.add(this.$selectAll_).prop("checked", t),
|
||
|
this.$selectItem.filter(":enabled").prop("checked", t),
|
||
|
this.updateRows(),
|
||
|
t && (i = this.getSelections()),
|
||
|
this.trigger(t ? "check-all" : "uncheck-all", i);
|
||
|
}),
|
||
|
(u.prototype.check = function (t) {
|
||
|
this.check_(!0, t);
|
||
|
}),
|
||
|
(u.prototype.uncheck = function (t) {
|
||
|
this.check_(!1, t);
|
||
|
}),
|
||
|
(u.prototype.check_ = function (t, i) {
|
||
|
var e = this.$selectItem
|
||
|
.filter(s('[data-index="%s"]', i))
|
||
|
.prop("checked", t);
|
||
|
(this.data[i][this.header.stateField] = t),
|
||
|
this.updateSelected(),
|
||
|
this.trigger(t ? "check" : "uncheck", this.data[i], e);
|
||
|
}),
|
||
|
(u.prototype.checkBy = function (t) {
|
||
|
this.checkBy_(!0, t);
|
||
|
}),
|
||
|
(u.prototype.uncheckBy = function (t) {
|
||
|
this.checkBy_(!1, t);
|
||
|
}),
|
||
|
(u.prototype.checkBy_ = function (i, e) {
|
||
|
if (e.hasOwnProperty("field") && e.hasOwnProperty("values")) {
|
||
|
var o = this,
|
||
|
n = [];
|
||
|
t.each(this.options.data, function (a, r) {
|
||
|
if (!r.hasOwnProperty(e.field)) return !1;
|
||
|
if (-1 !== t.inArray(r[e.field], e.values)) {
|
||
|
var l = o.$selectItem
|
||
|
.filter(":enabled")
|
||
|
.filter(s('[data-index="%s"]', a))
|
||
|
.prop("checked", i);
|
||
|
(r[o.header.stateField] = i),
|
||
|
n.push(r),
|
||
|
o.trigger(i ? "check" : "uncheck", r, l);
|
||
|
}
|
||
|
}),
|
||
|
this.updateSelected(),
|
||
|
this.trigger(i ? "check-some" : "uncheck-some", n);
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.destroy = function () {
|
||
|
this.$el.insertBefore(this.$container),
|
||
|
t(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") || "");
|
||
|
}),
|
||
|
(u.prototype.showLoading = function () {
|
||
|
this.$tableLoading.show();
|
||
|
}),
|
||
|
(u.prototype.hideLoading = function () {
|
||
|
this.$tableLoading.hide();
|
||
|
}),
|
||
|
(u.prototype.togglePagination = function () {
|
||
|
this.options.pagination = !this.options.pagination;
|
||
|
var t = this.$toolbar.find('button[name="paginationSwitch"] i');
|
||
|
this.options.pagination
|
||
|
? t.attr(
|
||
|
"class",
|
||
|
this.options.iconsPrefix +
|
||
|
" " +
|
||
|
this.options.icons.paginationSwitchDown
|
||
|
)
|
||
|
: t.attr(
|
||
|
"class",
|
||
|
this.options.iconsPrefix +
|
||
|
" " +
|
||
|
this.options.icons.paginationSwitchUp
|
||
|
),
|
||
|
this.updatePagination();
|
||
|
}),
|
||
|
(u.prototype.toggleFullscreen = function () {
|
||
|
this.$el.closest(".bootstrap-table").toggleClass("fullscreen");
|
||
|
}),
|
||
|
(u.prototype.refresh = 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.initServer(t && t.silent, t && t.query, t && t.url),
|
||
|
this.trigger("refresh", t);
|
||
|
}),
|
||
|
(u.prototype.resetWidth = function () {
|
||
|
this.options.showHeader && this.options.height && this.fitHeader(),
|
||
|
this.options.showFooter && !this.options.cardView && this.fitFooter();
|
||
|
}),
|
||
|
(u.prototype.showColumn = function (t) {
|
||
|
this.toggleColumn(this.fieldsColumnsIndex[t], !0, !0);
|
||
|
}),
|
||
|
(u.prototype.hideColumn = function (t) {
|
||
|
this.toggleColumn(this.fieldsColumnsIndex[t], !1, !0);
|
||
|
}),
|
||
|
(u.prototype.getHiddenColumns = function () {
|
||
|
return t.grep(this.columns, function (t) {
|
||
|
return !t.visible;
|
||
|
});
|
||
|
}),
|
||
|
(u.prototype.getVisibleColumns = function () {
|
||
|
return t.grep(this.columns, function (t) {
|
||
|
return t.visible;
|
||
|
});
|
||
|
}),
|
||
|
(u.prototype.toggleAllColumns = function (i) {
|
||
|
var e = this;
|
||
|
if (
|
||
|
(t.each(this.columns, function (t, o) {
|
||
|
e.columns[t].visible = i;
|
||
|
}),
|
||
|
this.initHeader(),
|
||
|
this.initSearch(),
|
||
|
this.initPagination(),
|
||
|
this.initBody(),
|
||
|
this.options.showColumns)
|
||
|
) {
|
||
|
var o = this.$toolbar.find(".keep-open input").prop("disabled", !1);
|
||
|
o.filter(":checked").length <= this.options.minimumCountColumns &&
|
||
|
o.filter(":checked").prop("disabled", !0);
|
||
|
}
|
||
|
}),
|
||
|
(u.prototype.showAllColumns = function () {
|
||
|
this.toggleAllColumns(!0);
|
||
|
}),
|
||
|
(u.prototype.hideAllColumns = function () {
|
||
|
this.toggleAllColumns(!1);
|
||
|
}),
|
||
|
(u.prototype.filterBy = function (i) {
|
||
|
(this.filterColumns = t.isEmptyObject(i) ? {} : i),
|
||
|
(this.options.pageNumber = 1),
|
||
|
this.initSearch(),
|
||
|
this.updatePagination();
|
||
|
}),
|
||
|
(u.prototype.scrollTo = function (t) {
|
||
|
if (
|
||
|
("string" == typeof t &&
|
||
|
(t = "bottom" === t ? this.$tableBody[0].scrollHeight : 0),
|
||
|
"number" == typeof t && this.$tableBody.scrollTop(t),
|
||
|
void 0 === t)
|
||
|
)
|
||
|
return this.$tableBody.scrollTop();
|
||
|
}),
|
||
|
(u.prototype.getScrollPosition = function () {
|
||
|
return this.scrollTo();
|
||
|
}),
|
||
|
(u.prototype.selectPage = function (t) {
|
||
|
t > 0 &&
|
||
|
t <= this.options.totalPages &&
|
||
|
((this.options.pageNumber = t), this.updatePagination());
|
||
|
}),
|
||
|
(u.prototype.prevPage = function () {
|
||
|
this.options.pageNumber > 1 &&
|
||
|
(this.options.pageNumber--, this.updatePagination());
|
||
|
}),
|
||
|
(u.prototype.nextPage = function () {
|
||
|
this.options.pageNumber < this.options.totalPages &&
|
||
|
(this.options.pageNumber++, this.updatePagination());
|
||
|
}),
|
||
|
(u.prototype.toggleView = function () {
|
||
|
(this.options.cardView = !this.options.cardView), this.initHeader();
|
||
|
var t = this.$toolbar.find('button[name="toggle"] i');
|
||
|
this.options.cardView
|
||
|
? (t.removeClass(this.options.icons.toggleOff),
|
||
|
t.addClass(this.options.icons.toggleOn))
|
||
|
: (t.removeClass(this.options.icons.toggleOn),
|
||
|
t.addClass(this.options.icons.toggleOff)),
|
||
|
this.initBody(),
|
||
|
this.trigger("toggle", this.options.cardView);
|
||
|
}),
|
||
|
(u.prototype.refreshOptions = function (i) {
|
||
|
l(this.options, i, !0) ||
|
||
|
((this.options = t.extend(this.options, i)),
|
||
|
this.trigger("refresh-options", this.options),
|
||
|
this.destroy(),
|
||
|
this.init());
|
||
|
}),
|
||
|
(u.prototype.resetSearch = function (t) {
|
||
|
var i = this.$toolbar.find(".search input");
|
||
|
i.val(t || ""), this.onSearch({ currentTarget: i });
|
||
|
}),
|
||
|
(u.prototype.expandRow_ = function (t, i) {
|
||
|
var e = this.$body.find(s('> tr[data-index="%s"]', i));
|
||
|
e.next().is("tr.detail-view") === !t &&
|
||
|
e.find("> td > .detail-icon").click();
|
||
|
}),
|
||
|
(u.prototype.expandRow = function (t) {
|
||
|
this.expandRow_(!0, t);
|
||
|
}),
|
||
|
(u.prototype.collapseRow = function (t) {
|
||
|
this.expandRow_(!1, t);
|
||
|
}),
|
||
|
(u.prototype.expandAllRows = function (i) {
|
||
|
if (i) {
|
||
|
var e = this.$body.find(s('> tr[data-index="%s"]', 0)),
|
||
|
o = this,
|
||
|
n = null,
|
||
|
a = !1,
|
||
|
r = -1;
|
||
|
if (
|
||
|
(e.next().is("tr.detail-view")
|
||
|
? e.next().next().is("tr.detail-view") ||
|
||
|
(e.next().find(".detail-icon").click(), (a = !0))
|
||
|
: (e.find("> td > .detail-icon").click(), (a = !0)),
|
||
|
a)
|
||
|
)
|
||
|
try {
|
||
|
r = setInterval(function () {
|
||
|
(n = o.$body.find("tr.detail-view").last().find(".detail-icon"))
|
||
|
.length > 0
|
||
|
? n.click()
|
||
|
: clearInterval(r);
|
||
|
}, 1);
|
||
|
} catch (t) {
|
||
|
clearInterval(r);
|
||
|
}
|
||
|
} else
|
||
|
for (var l = this.$body.children(), h = 0; h < l.length; h++)
|
||
|
this.expandRow_(!0, t(l[h]).data("index"));
|
||
|
}),
|
||
|
(u.prototype.collapseAllRows = function (i) {
|
||
|
if (i) this.expandRow_(!1, 0);
|
||
|
else
|
||
|
for (var e = this.$body.children(), o = 0; o < e.length; o++)
|
||
|
this.expandRow_(!1, t(e[o]).data("index"));
|
||
|
}),
|
||
|
(u.prototype.updateFormatText = function (t, i) {
|
||
|
this.options[s("format%s", t)] &&
|
||
|
("string" == typeof i
|
||
|
? (this.options[s("format%s", t)] = function () {
|
||
|
return i;
|
||
|
})
|
||
|
: "function" == typeof i && (this.options[s("format%s", t)] = i)),
|
||
|
this.initToolbar(),
|
||
|
this.initPagination(),
|
||
|
this.initBody();
|
||
|
});
|
||
|
var f = [
|
||
|
"getOptions",
|
||
|
"getSelections",
|
||
|
"getAllSelections",
|
||
|
"getData",
|
||
|
"load",
|
||
|
"append",
|
||
|
"prepend",
|
||
|
"remove",
|
||
|
"removeAll",
|
||
|
"insertRow",
|
||
|
"updateRow",
|
||
|
"updateCell",
|
||
|
"updateByUniqueId",
|
||
|
"removeByUniqueId",
|
||
|
"getRowByUniqueId",
|
||
|
"showRow",
|
||
|
"hideRow",
|
||
|
"getHiddenRows",
|
||
|
"mergeCells",
|
||
|
"refreshColumnTitle",
|
||
|
"checkAll",
|
||
|
"uncheckAll",
|
||
|
"checkInvert",
|
||
|
"check",
|
||
|
"uncheck",
|
||
|
"checkBy",
|
||
|
"uncheckBy",
|
||
|
"refresh",
|
||
|
"resetView",
|
||
|
"resetWidth",
|
||
|
"destroy",
|
||
|
"showLoading",
|
||
|
"hideLoading",
|
||
|
"showColumn",
|
||
|
"hideColumn",
|
||
|
"getHiddenColumns",
|
||
|
"getVisibleColumns",
|
||
|
"showAllColumns",
|
||
|
"hideAllColumns",
|
||
|
"filterBy",
|
||
|
"scrollTo",
|
||
|
"getScrollPosition",
|
||
|
"selectPage",
|
||
|
"prevPage",
|
||
|
"nextPage",
|
||
|
"togglePagination",
|
||
|
"toggleView",
|
||
|
"refreshOptions",
|
||
|
"resetSearch",
|
||
|
"expandRow",
|
||
|
"collapseRow",
|
||
|
"expandAllRows",
|
||
|
"collapseAllRows",
|
||
|
"updateFormatText",
|
||
|
"updateCellById",
|
||
|
];
|
||
|
(t.fn.bootstrapTable = function (i) {
|
||
|
var e,
|
||
|
o = Array.prototype.slice.call(arguments, 1);
|
||
|
return (
|
||
|
this.each(function () {
|
||
|
var s = t(this),
|
||
|
n = s.data("bootstrap.table"),
|
||
|
a = t.extend({}, u.DEFAULTS, s.data(), "object" == typeof i && i);
|
||
|
if ("string" == typeof i) {
|
||
|
if (t.inArray(i, f) < 0) throw new Error("Unknown method: " + i);
|
||
|
if (!n) return;
|
||
|
(e = n[i].apply(n, o)),
|
||
|
"destroy" === i && s.removeData("bootstrap.table");
|
||
|
}
|
||
|
n || s.data("bootstrap.table", (n = new u(this, a)));
|
||
|
}),
|
||
|
void 0 === e ? this : e
|
||
|
);
|
||
|
}),
|
||
|
(t.fn.bootstrapTable.Constructor = u),
|
||
|
(t.fn.bootstrapTable.defaults = u.DEFAULTS),
|
||
|
(t.fn.bootstrapTable.columnDefaults = u.COLUMN_DEFAULTS),
|
||
|
(t.fn.bootstrapTable.locales = u.LOCALES),
|
||
|
(t.fn.bootstrapTable.methods = f),
|
||
|
(t.fn.bootstrapTable.utils = {
|
||
|
bootstrapVersion: i,
|
||
|
sprintf: s,
|
||
|
compareObjects: l,
|
||
|
calculateObjectValue: r,
|
||
|
getItemField: c,
|
||
|
objectKeys: function () {
|
||
|
var t, i, e, o;
|
||
|
Object.keys ||
|
||
|
(Object.keys =
|
||
|
((t = Object.prototype.hasOwnProperty),
|
||
|
(i = !{ toString: null }.propertyIsEnumerable("toString")),
|
||
|
(o = (e = [
|
||
|
"toString",
|
||
|
"toLocaleString",
|
||
|
"valueOf",
|
||
|
"hasOwnProperty",
|
||
|
"isPrototypeOf",
|
||
|
"propertyIsEnumerable",
|
||
|
"constructor",
|
||
|
]).length),
|
||
|
function (s) {
|
||
|
if (
|
||
|
"object" != typeof s &&
|
||
|
("function" != typeof s || null === s)
|
||
|
)
|
||
|
throw new TypeError("Object.keys called on non-object");
|
||
|
var n,
|
||
|
a,
|
||
|
r = [];
|
||
|
for (n in s) t.call(s, n) && r.push(n);
|
||
|
if (i) for (a = 0; a < o; a++) t.call(s, e[a]) && r.push(e[a]);
|
||
|
return r;
|
||
|
}));
|
||
|
},
|
||
|
isIEBrowser: d,
|
||
|
}),
|
||
|
t(function () {
|
||
|
t('[data-bs-toggle="table"]').bootstrapTable();
|
||
|
});
|
||
|
})(jQuery);
|