UNPKG

14.2 kBJavaScriptView Raw
1/**
2 * bootstrap-table - An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)
3 *
4 * @version v1.15.3
5 * @homepage https://bootstrap-table.com
6 * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
7 * @license MIT
8 */
9
10(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],b):(a=a||self,b(a.jQuery))})(this,function(a){'use strict';var c=Math.max,d=Math.min,e=Math.ceil;function b(a,b){return b={exports:{}},a(b,b.exports),b.exports}a=a&&a.hasOwnProperty("default")?a["default"]:a;var g,h,i,j="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,k="object",l=function(a){return a&&a.Math==Math&&a},m=l(typeof globalThis==k&&globalThis)||l(typeof window==k&&window)||l(typeof self==k&&self)||l(typeof j==k&&j)||Function("return this")(),n=function(a){try{return!!a()}catch(a){return!0}},o=!n(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),p={}.propertyIsEnumerable,q=Object.getOwnPropertyDescriptor,r=q&&!p.call({1:2},1),s=r?function(a){var b=q(this,a);return!!b&&b.enumerable}:p,f={f:s},t=function(a,b){return{enumerable:!(1&a),configurable:!(2&a),writable:!(4&a),value:b}},u={}.toString,v=function(a){return u.call(a).slice(8,-1)},w="".split,x=n(function(){return!Object("z").propertyIsEnumerable(0)})?function(a){return"String"==v(a)?w.call(a,""):Object(a)}:Object,y=function(a){if(a==null)throw TypeError("Can't call method on "+a);return a},z=function(a){return x(y(a))},A=function(a){return"object"==typeof a?null!==a:"function"==typeof a},B=function(a,b){if(!A(a))return a;var c,d;if(b&&"function"==typeof(c=a.toString)&&!A(d=c.call(a)))return d;if("function"==typeof(c=a.valueOf)&&!A(d=c.call(a)))return d;if(!b&&"function"==typeof(c=a.toString)&&!A(d=c.call(a)))return d;throw TypeError("Can't convert object to primitive value")},C={}.hasOwnProperty,D=function(a,b){return C.call(a,b)},E=m.document,F=A(E)&&A(E.createElement),G=function(a){return F?E.createElement(a):{}},H=!o&&!n(function(){return 7!=Object.defineProperty(G("div"),"a",{get:function(){return 7}}).a}),I=Object.getOwnPropertyDescriptor,J=o?I:function(a,b){if(a=z(a),b=B(b,!0),H)try{return I(a,b)}catch(a){}return D(a,b)?t(!f.f.call(a,b),a[b]):void 0},K={f:J},L=function(a){if(!A(a))throw TypeError(a+" is not an object");return a},M=Object.defineProperty,N=o?M:function(a,b,c){if(L(a),b=B(b,!0),L(c),H)try{return M(a,b,c)}catch(a){}if("get"in c||"set"in c)throw TypeError("Accessors not supported");return"value"in c&&(a[b]=c.value),a},O={f:N},P=o?function(a,b,c){return O.f(a,b,t(1,c))}:function(a,b,c){return a[b]=c,a},Q=function(a,b){try{P(m,a,b)}catch(c){m[a]=b}return b},R=b(function(a){var b=m["__core-js_shared__"]||Q("__core-js_shared__",{});(a.exports=function(a,c){return b[a]||(b[a]=c===void 0?{}:c)})("versions",[]).push({version:"3.1.3",mode:"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),S=R("native-function-to-string",Function.toString),T=m.WeakMap,U="function"==typeof T&&/native code/.test(S.call(T)),V=0,W=Math.random(),X=function(a){return"Symbol("+((a===void 0?"":a)+"")+")_"+(++V+W).toString(36)},Y=R("keys"),Z=function(a){return Y[a]||(Y[a]=X(a))},_={},aa=m.WeakMap,ba=function(a){return i(a)?h(a):g(a,{})};if(U){var ca=new aa,da=ca.get,ea=ca.has,fa=ca.set;g=function(a,b){return fa.call(ca,a,b),b},h=function(a){return da.call(ca,a)||{}},i=function(a){return ea.call(ca,a)}}else{var ga=Z("state");_[ga]=!0,g=function(a,b){return P(a,ga,b),b},h=function(a){return D(a,ga)?a[ga]:{}},i=function(a){return D(a,ga)}}var ha={set:g,get:h,has:i,enforce:ba,getterFor:function(a){return function(b){var c;if(!A(b)||(c=h(b)).type!==a)throw TypeError("Incompatible receiver, "+a+" required");return c}}},ia=b(function(a){var b=ha.get,c=ha.enforce,d=(S+"").split("toString");R("inspectSource",function(a){return S.call(a)}),(a.exports=function(a,b,e,f){var g=!!f&&!!f.unsafe,h=!!f&&!!f.enumerable,i=!!f&&!!f.noTargetGet;return("function"==typeof e&&("string"==typeof b&&!D(e,"name")&&P(e,"name",b),c(e).source=d.join("string"==typeof b?b:"")),a===m)?void(h?a[b]=e:Q(b,e)):void(g?!i&&a[b]&&(h=!0):delete a[b],h?a[b]=e:P(a,b,e))})(Function.prototype,"toString",function(){return"function"==typeof this&&b(this).source||S.call(this)})}),ja=m,ka=function(a){return"function"==typeof a?a:void 0},la=Math.floor,ma=function(a){return isNaN(a=+a)?0:(0<a?la:e)(a)},na=function(a){return 0<a?d(ma(a),9007199254740991):0},oa=function(a,b){var e=ma(a);return 0>e?c(e+b,0):d(e,b)},pa=function(a){return function(b,c,d){var e,f=z(b),g=na(f.length),h=oa(d,g);if(a&&c!=c){for(;g>h;)if(e=f[h++],e!=e)return!0;}else for(;g>h;h++)if((a||h in f)&&f[h]===c)return a||h||0;return!a&&-1}},qa={includes:pa(!0),indexOf:pa(!1)},ra=qa.indexOf,sa=function(a,b){var c,d=z(a),e=0,f=[];for(c in d)!D(_,c)&&D(d,c)&&f.push(c);for(;b.length>e;)D(d,c=b[e++])&&(~ra(f,c)||f.push(c));return f},ta=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),ua=Object.getOwnPropertyNames||function(a){return sa(a,ta)},va={f:ua},wa=Object.getOwnPropertySymbols,xa={f:wa},ya=function(a,b){return 2>arguments.length?ka(ja[a])||ka(m[a]):ja[a]&&ja[a][b]||m[a]&&m[a][b]}("Reflect","ownKeys")||function(a){var b=va.f(L(a)),c=xa.f;return c?b.concat(c(a)):b},za=function(a,b){for(var c,d=ya(b),e=O.f,f=K.f,g=0;g<d.length;g++)c=d[g],D(a,c)||e(a,c,f(b,c))},Aa=/#|\.prototype\./,Ba=function(a,b){var c=Da[Ca(a)];return!(c!=Fa)||c!=Ea&&("function"==typeof b?n(b):!!b)},Ca=Ba.normalize=function(a){return(a+"").replace(Aa,".").toLowerCase()},Da=Ba.data={},Ea=Ba.NATIVE="N",Fa=Ba.POLYFILL="P",Ga=K.f,Ha=function(a,b){var c,d,e,f,g,h,i=a.target,j=a.global,k=a.stat;if(d=j?m:k?m[i]||Q(i,{}):(m[i]||{}).prototype,d)for(e in b){if(g=b[e],a.noTargetGet?(h=Ga(d,e),f=h&&h.value):f=d[e],c=Ba(j?e:i+(k?".":"#")+e,a.forced),!c&&void 0!==f){if(typeof g==typeof f)continue;za(g,f)}(a.sham||f&&f.sham)&&P(g,"sham",!0),ia(d,e,g,a)}},Ia=function(a){if("function"!=typeof a)throw TypeError(a+" is not a function");return a},Ja=function(d,e,f){return(Ia(d),void 0===e)?d:0===f?function(){return d.call(e)}:1===f?function(b){return d.call(e,b)}:2===f?function(c,a){return d.call(e,c,a)}:3===f?function(f,a,b){return d.call(e,f,a,b)}:function(){return d.apply(e,arguments)}},Ka=function(a){return Object(y(a))},La=Array.isArray||function(a){return"Array"==v(a)},Ma=!!Object.getOwnPropertySymbols&&!n(function(){return!(Symbol()+"")}),Na=m.Symbol,Oa=R("wks"),Pa=function(a){return Oa[a]||(Oa[a]=Ma&&Na[a]||(Ma?Na:X)("Symbol."+a))},Qa=Pa("species"),Ra=function(a,b){var c;return La(a)&&(c=a.constructor,"function"==typeof c&&(c===Array||La(c.prototype))?c=void 0:A(c)&&(c=c[Qa],null===c&&(c=void 0))),new(void 0===c?Array:c)(0===b?0:b)},Sa=[].push,Ta=function(a){var b=1==a,c=4==a,d=6==a;return function(e,f,g,h){for(var i,j,k=Ka(e),l=x(k),m=Ja(f,g,3),n=na(l.length),o=0,p=h||Ra,q=b?p(e,n):2==a?p(e,0):void 0;n>o;o++)if((5==a||d||o in l)&&(i=l[o],j=m(i,o,k),a))if(b)q[o]=j;else if(j)switch(a){case 3:return!0;case 5:return i;case 6:return o;case 2:Sa.call(q,i);}else if(c)return!1;return d?-1:3==a||c?c:q}},Ua={forEach:Ta(0),map:Ta(1),filter:Ta(2),some:Ta(3),every:Ta(4),find:Ta(5),findIndex:Ta(6)},Va=Pa("species"),Wa=function(a){return!n(function(){var b=[],c=b.constructor={};return c[Va]=function(){return{foo:1}},1!==b[a](Boolean).foo})},Xa=Ua.filter;Ha({target:"Array",proto:!0,forced:!Wa("filter")},{filter:function(a){return Xa(this,a,1<arguments.length?arguments[1]:void 0)}});var Ya=qa.indexOf,Za=[].indexOf,$a=!!Za&&0>1/[1].indexOf(1,-0),_a=function(a,b){var c=[][a];return!c||!n(function(){c.call(null,b||function(){throw 1},1)})}("indexOf");Ha({target:"Array",proto:!0,forced:$a||_a},{indexOf:function(a){return $a?Za.apply(this,arguments)||0:Ya(this,a,1<arguments.length?arguments[1]:void 0)}});var ab=function(a,b,c){var d=B(b);d in a?O.f(a,d,t(0,c)):a[d]=c},bb=Pa("species"),cb=[].slice;Ha({target:"Array",proto:!0,forced:!Wa("slice")},{slice:function(a,b){var d,e,f,g=z(this),h=na(g.length),i=oa(a,h),j=oa(void 0===b?h:b,h);if(La(g)&&(d=g.constructor,"function"==typeof d&&(d===Array||La(d.prototype))?d=void 0:A(d)&&(d=d[bb],null===d&&(d=void 0)),d===Array||void 0===d))return cb.call(g,i,j);for(e=new(void 0===d?Array:d)(c(j-i,0)),f=0;i<j;i++,f++)i in g&&ab(e,f,g[i]);return e.length=f,e}});var db="[\t\n\x0B\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]",eb=RegExp("^"+db+db+"*"),fb=RegExp(db+db+"*$"),gb=function(a){return function(b){var c=y(b)+"";return 1&a&&(c=c.replace(eb,"")),2&a&&(c=c.replace(fb,"")),c}},hb={start:gb(1),end:gb(2),trim:gb(3)},ib=hb.trim,jb=m.parseInt,kb=/^[+-]?0[Xx]/,lb=8!==jb("\t\n\x0B\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF08")||22!==jb("\t\n\x0B\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF0x16"),mb=lb?function(a,b){var c=ib(a+"");return jb(c,b>>>0||(kb.test(c)?16:10))}:jb;Ha({global:!0,forced:parseInt!=mb},{parseInt:mb});var nb=a.fn.bootstrapTable.utils;a.extend(a.fn.bootstrapTable.defaults,{usePipeline:!1,pipelineSize:1e3,onCachedDataHit:function(){return!1},onCachedDataReset:function(){return!1}}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"cached-data-hit.bs.table":"onCachedDataHit","cached-data-reset.bs.table":"onCachedDataReset"});var ob=a.fn.bootstrapTable.Constructor,pb=ob.prototype.init,qb=ob.prototype.initServer,rb=ob.prototype.onSearch,sb=ob.prototype.onSort,tb=ob.prototype.onPageListChange;ob.prototype.init=function(){this.initPipeline();for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];pb.apply(this,Array.prototype.slice.apply(b))},ob.prototype.initPipeline=function(){this.cacheRequestJSON={},this.cacheWindows=[],this.currWindow=0,this.resetCache=!0},ob.prototype.onSearch=function(){this.options.usePipeline&&(this.resetCache=!0),rb.apply(this,Array.prototype.slice.apply(arguments))},ob.prototype.onSort=function(){this.options.usePipeline&&(this.resetCache=!0),sb.apply(this,Array.prototype.slice.apply(arguments))},ob.prototype.onPageListChange=function(b){var c=a(b.currentTarget),d=parseInt(c.text());this.options.pipelineSize=this.calculatePipelineSize(this.options.pipelineSize,d),this.resetCache=!0,tb.apply(this,Array.prototype.slice.apply(arguments))},ob.prototype.calculatePipelineSize=function(a,b){return 0===b?0:e(a/b)*b},ob.prototype.setCacheWindows=function(){this.cacheWindows=[];for(var a,c=this.options.totalRows/this.options.pipelineSize,d=0;d<=c;d++)a=d*this.options.pipelineSize,this.cacheWindows[d]={lower:a,upper:a+this.options.pipelineSize-1}},ob.prototype.setCurrWindow=function(a){this.currWindow=0;for(var b=0;b<this.cacheWindows.length;b++)if(this.cacheWindows[b].lower<=a&&a<=this.cacheWindows[b].upper){this.currWindow=b;break}},ob.prototype.drawFromCache=function(b,c){var d=a.extend(!0,{},this.cacheRequestJSON),e=b-this.cacheWindows[this.currWindow].lower;return d.rows=d.rows.slice(e,e+c),d},ob.prototype.initServer=function(b,c,d){var e={},f=this.header.fields.indexOf(this.options.sortName),g={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder},h=null;if(this.header.sortNames[f]&&(g.sortName=this.header.sortNames[f]),this.options.pagination&&"server"===this.options.sidePagination&&(g.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,g.pageNumber=this.options.pageNumber),d||this.options.url||this.options.ajax){var i=!0;if("limit"===this.options.queryParamsType&&(g={searchText:g.searchText,sortName:g.sortName,sortOrder:g.sortOrder},this.options.pagination&&"server"===this.options.sidePagination))if(g.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,g.offset=(this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize)*(this.options.pageNumber-1),!this.options.usePipeline)0===g.limit&&delete g.limit;else if(!this.cacheWindows.length)i=!0,g.drawOffset=g.offset;else{var j=this.cacheWindows[this.currWindow];this.resetCache||g.offset<j.lower||g.offset>j.upper?(i=!0,this.setCurrWindow(g.offset),g.drawOffset=g.offset,g.offset=this.cacheWindows[this.currWindow].lower):i=!1}if(this.resetCache&&(i=!0,this.resetCache=!1),this.options.usePipeline&&i&&(g.drawLimit=g.limit,g.limit=this.options.pipelineSize),!i){var k=this.drawFromCache(g.offset,g.limit);return this.load(k),this.trigger("load-success",k),void this.trigger("cached-data-hit",k)}if(a.isEmptyObject(this.filterColumnsPartial)||(g.filter=JSON.stringify(this.filterColumnsPartial,null)),e=nb.calculateObjectValue(this.options,this.options.queryParams,[g],e),a.extend(e,c||{}),!1!==e){b||this.$tableLoading.show();var l=this;h=a.extend({},nb.calculateObjectValue(null,this.options.ajaxOptions),{type:this.options.method,url:d||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(e):e,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(c){c=nb.calculateObjectValue(l.options,l.options.responseHandler,[c],c),l.options.usePipeline&&(l.cacheRequestJSON=a.extend(!0,{},c),l.options.totalRows=c[l.options.totalField],l.setCacheWindows(),l.setCurrWindow(g.drawOffset),c=l.drawFromCache(g.drawOffset,g.drawLimit),l.trigger("cached-data-reset",c)),l.load(c),l.trigger("load-success",c),b||l.$tableLoading.hide()},error:function(a){var c=[];"server"===l.options.sidePagination&&(c={},c[l.options.totalField]=0,c[l.options.dataField]=[]),l.load(c),l.trigger("load-error",a.status,a),b||l.$tableLoading.hide()}}),this.options.ajax?nb.calculateObjectValue(this,this.options.ajax,[h],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=a.ajax(h))}}}});