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
7.3 KiB
JavaScript
7 lines
7.3 KiB
JavaScript
3 years ago
|
/*
|
||
|
* bootstrap-table - v1.12.1 - 2018-03-12
|
||
|
* https://github.com/wenzhixin/bootstrap-table
|
||
|
* Copyright (c) 2018 zhixin wen
|
||
|
* Licensed MIT License
|
||
|
*/
|
||
|
!function(a){"use strict";var b={sortOrder:"bs.table.sortOrder",sortName:"bs.table.sortName",pageNumber:"bs.table.pageNumber",pageList:"bs.table.pageList",columns:"bs.table.columns",searchText:"bs.table.searchText",filterControl:"bs.table.filterControl"},c=function(a){var b=a.$header;return a.options.height&&(b=a.$tableHeader),b},d=function(a){var b="select, input";return a.options.height&&(b="table select, table input"),b},e=function(){return!!navigator.cookieEnabled},f=function(a,b){for(var c=-1,d=0;d<b.length;d++)if(a.toLowerCase()===b[d].toLowerCase()){c=d;break}return c},g=function(a,b,c){if(a.options.cookie&&e()&&""!==a.options.cookieIdTable&&-1!==f(b,a.options.cookiesEnabled)){switch(b=a.options.cookieIdTable+"."+b,a.options.cookieStorage){case"cookieStorage":document.cookie=[b,"=",c,"; expires="+j(a.options.cookieExpire),a.options.cookiePath?"; path="+a.options.cookiePath:"",a.options.cookieDomain?"; domain="+a.options.cookieDomain:"",a.options.cookieSecure?"; secure":""].join("");case"localStorage":localStorage.setItem(b,c);break;case"sessionStorage":sessionStorage.setItem(b,c);break;default:return!1}return!0}},h=function(a,b,c){if(!c)return null;if(-1===f(c,a.options.cookiesEnabled))return null;switch(c=b+"."+c,a.options.cookieStorage){case"cookieStorage":var d="; "+document.cookie,e=d.split("; "+c+"=");return 2===e.length?e.pop().split(";").shift():null;case"localStorage":return localStorage.getItem(c);case"sessionStorage":return sessionStorage.getItem(c);default:return null}},i=function(a,b,c){switch(c=b+"."+c,a.options.cookieStorage){case"cookieStorage":document.cookie=[encodeURIComponent(c),"=","; expires=Thu, 01 Jan 1970 00:00:00 GMT",a.options.cookiePath?"; path="+a.options.cookiePath:"",a.options.cookieDomain?"; domain="+a.options.cookieDomain:""].join("");break;case"localStorage":localStorage.removeItem(c);break;case"sessionStorage":sessionStorage.removeItem(c)}return!0},j=function(a){var b=a.replace(/[0-9]*/,"");switch(a=a.replace(/[A-Za-z]{1,2}/,""),b.toLowerCase()){case"s":a=+a;break;case"mi":a=60*a;break;case"h":a=60*a*60;break;case"d":a=24*a*60*60;break;case"m":a=30*a*24*60*60;break;case"y":a=365*a*24*60*60;break;default:a=void 0}if(!a)return"";var c=new Date;return c.setTime(c.getTime()+1e3*a),c.toGMTString()},k=function(e){setTimeout(function(){var f=JSON.parse(h(e,e.options.cookieIdTable,b.filterControl));if(!e.options.filterControlValuesLoaded&&f){var g={},i=c(e),j=d(e),k=function(b,c){a(c).each(function(c,d){""!==d.text&&(a(b).val(d.text),g[d.field]=d.text)})};i.find(j).each(function(){var b=a(this).closest("[data-field]").data("field"),c=a.grep(f,function(a){return a.field===b});k(this,c)}),e.initColumnSearch(g),e.options.filterControlValuesLoaded=!0,e.initServer()}},250)};a.extend(a.fn.bootstrapTable.defaults,{cookie:!1,cookieExpire:"2h",cookiePath:null,cookieDomain:null,cookieSecure:null,cookieIdTable:"",cookiesEnabled:["bs.table.sortOrder","bs.table.sortName","bs.table.pageNumber","bs.table.pageList","bs.table.columns","bs.table.searchText","bs.table.filterControl"],cookieStorage:"cookieStorage",filterControls:[],filterControlValuesLoaded:!1}),a.fn.bootstrapTable.methods.push("getCookies"),a.fn.bootstrapTable.methods.push("deleteCookie"),a.extend(a.fn.bootstrapTable.utils,{setCookie:g,getCookie:h});var l=a.fn.bootstrapTable.Constructor,m=l.prototype.init,n=l.prototype.initTable,o=l.prototype.initServer,p=l.prototype.onSort,q=l.prototype.onPageNumber,r=l.prototype.onPageListChange,s=l.prototype.onPagePre,t=l.prototype.onPageNext,u=l.prototype.toggleColumn,v=l.prototype.selectPage,w=l.prototype.onSearch;l.prototype.init=function(){if(this.options.filterControls=[],this.options.filterControlValuesLoaded=!1,this.options.cookiesEnabled="string"==typeof this.options.cookiesEnabled?this.options.cookiesEnabled.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.cookiesEnabled,this.options.filterControl){var a=this;this.$el.on("column-search.bs.table",function(c,d,e){for(var f=!0,h=0;h<a.options.filterControls.length;h++)if(a.options.filterControls[h].field===d){
|