You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7 lines
11 KiB
Plaintext

11 months ago
/*
* bootstrap-table - v1.11.1 - 2017-02-22
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2017 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";var b=a.fn.bootstrapTable.utils.sprintf,c=a.fn.bootstrapTable.utils.objectKeys,d=function(a){return a.get(a.length-1).options},e=function(a,c){for(var e=d(a),f=0;f<e.length;f++)""!==e[f].value&&(c.hasOwnProperty(e[f].value)?a.find(b("option[value='%s']",e[f].value)).show():a.find(b("option[value='%s']",e[f].value)).hide())},f=function(b,c,d){c=a.trim(c),b=a(b.get(b.length-1)),h(b,c)||b.append(a("<option></option>").attr("value",c).text(a("<div />").html(d).text()))},g=function(b){var c=b.find("option:gt(0)");c.sort(function(b,c){return b=a(b).text().toLowerCase(),c=a(c).text().toLowerCase(),a.isNumeric(b)&&a.isNumeric(c)&&(b=parseFloat(b),c=parseFloat(c)),b>c?1:c>b?-1:0}),b.find("option:gt(0)").remove(),b.append(c)},h=function(a,b){for(var c=d(a),e=0;e<c.length;e++)if(c[e].value===b.toString())return!0;return!1},i=function(a){a.$tableHeader.css("height","77px")},j=function(a){var b=a.$header;return a.options.height&&(b=a.$tableHeader),b},k=function(a){var b="select, input";return a.options.height&&(b="table select, table input"),b},l=function(b){if(a.fn.bootstrapTable.utils.isIEBrowser()){if(a(b).is("input")){var c=0;if("selectionStart"in b)c=b.selectionStart;else if("selection"in document){b.focus();var d=document.selection.createRange(),e=document.selection.createRange().text.length;d.moveStart("character",-b.value.length),c=d.text.length-e}return c}return-1}return-1},m=function(b,c){a.fn.bootstrapTable.utils.isIEBrowser()&&(void 0!==b.setSelectionRange?b.setSelectionRange(c,c):a(b).val(b.value))},n=function(b){var c=j(b),d=k(b);b.options.valuesFilterControl=[],c.find(d).each(function(){b.options.valuesFilterControl.push({field:a(this).closest("[data-field]").data("field"),value:a(this).val(),position:l(a(this).get(0))})})},o=function(b){var c=null,d=[],e=j(b),f=k(b);b.options.valuesFilterControl.length>0&&e.find(f).each(function(){c=a(this).closest("[data-field]").data("field"),d=a.grep(b.options.valuesFilterControl,function(a){return a.field===c}),d.length>0&&(a(this).val(d[0].value),m(a(this).get(0),d[0].position))})},p=function(){var b=[],c=document.cookie.match(/(?:bs.table.)(\w*)/g);return c?(a.each(c,function(c,d){/./.test(d)&&(d=d.split(".").pop()),-1===a.inArray(d,b)&&b.push(d)}),b):void 0},q=function(b){var c=b.data,d=(b.pageTo<b.options.data.length?b.options.data.length:b.pageTo,function(a){return a.filterControl&&"select"===a.filterControl.toLowerCase()&&a.searchable}),h=function(a){return void 0===a.filterData||"column"===a.filterData.toLowerCase()},i=function(a){return a&&a.length>0},j=b.options.pagination?"server"===b.options.sidePagination?b.pageTo:b.options.totalRows:b.pageTo;a.each(b.header.fields,function(k,l){var m=b.columns[a.fn.bootstrapTable.utils.getFieldIndex(b.columns,l)],n=a(".bootstrap-table-filter-control-"+r(m.field));if(d(m)&&h(m)&&i(n)){0===n.get(n.length-1).options.length&&f(n,"","");for(var o={},p=0;j>p;p++){var q=c[p][l],s=a.fn.bootstrapTable.utils.calculateObjectValue(b.header,b.header.formatters[k],[q,c[p],p],q);o[s]=q}for(var t in o)f(n,o[t],t);g(n),b.options.hideUnusedSelectOptions&&e(n,o)}})},r=function(a){return String(a).replace(/(:|\.|\[|\]|,)/g,"\\$1")},s=function(c,d){var e,h,i=!1,j=0;a.each(c.columns,function(b,j){if(e="hidden",h=[],j.visible){if(j.filterControl){h.push('<div class="filter-control">');var k=j.filterControl.toLowerCase();j.searchable&&c.options.filterTemplate[k]&&(i=!0,e="visible",h.push(c.options.filterTemplate[k](c,j.field,e,j.filterControlPlaceholder)))}else h.push('<div class="no-filter-control"></div>');if(a.each(d.children().children(),function(b,c){return c=a(c),c.data("field")===j.field?(c.find(".fht-cell").append(h.join("")),!1):void 0}),void 0!==j.filterData&&"column"!==j.filterData.toLowerCase()){var l,m,n=v(u,j.filterData.substring(0,j.filterData.indexOf(":")));if(null===n)throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, json, url. Use like this: var: {key: "value"}');l=j.filterData.substring(j.filterData.indexOf(":")+1,j.filterData.length),m=a(".bootstrap-table-filter-control-