UNPKG

13.8 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.5
5 * @homepage https://bootstrap-table.com
6 * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
7 * @license MIT
8 */
9
10!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e((t=t||self).jQuery)}(this,(function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t,e){return t(e={exports:{}},e.exports),e.exports}var n,o,i,s,a="object",c=function(t){return t&&t.Math==Math&&t},u=c(typeof globalThis==a&&globalThis)||c(typeof window==a&&window)||c(typeof self==a&&self)||c(typeof e==a&&e)||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},p=!f((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})),l={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,d={f:h&&!l.call({1:2},1)?function(t){var e=h(this,t);return!!e&&e.enumerable}:l},y=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},g={}.toString,v=function(t){return g.call(t).slice(8,-1)},w="".split,m=f((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==v(t)?w.call(t,""):Object(t)}:Object,b=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},S=function(t){return m(b(t))},O=function(t){return"object"==typeof t?null!==t:"function"==typeof t},x=function(t,e){if(!O(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!O(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!O(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!O(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},j={}.hasOwnProperty,P=function(t,e){return j.call(t,e)},T=u.document,C=O(T)&&O(T.createElement),W=!p&&!f((function(){return 7!=Object.defineProperty((t="div",C?T.createElement(t):{}),"a",{get:function(){return 7}}).a;var t})),N=Object.getOwnPropertyDescriptor,A={f:p?N:function(t,e){if(t=S(t),e=x(e,!0),W)try{return N(t,e)}catch(t){}if(P(t,e))return y(!d.f.call(t,e),t[e])}},z=function(t){if(!O(t))throw TypeError(String(t)+" is not an object");return t},E=Object.defineProperty,R={f:p?E:function(t,e,r){if(z(t),e=x(e,!0),z(r),W)try{return E(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},_=p?function(t,e,r){return R.f(t,e,y(1,r))}:function(t,e,r){return t[e]=r,t},L=function(t,e){try{_(u,t,e)}catch(r){u[t]=e}return e},M=r((function(t){var e=u["__core-js_shared__"]||L("__core-js_shared__",{});(t.exports=function(t,r){return e[t]||(e[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.1.3",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})),F=M("native-function-to-string",Function.toString),I=u.WeakMap,q="function"==typeof I&&/native code/.test(F.call(I)),k=0,D=Math.random(),V=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++k+D).toString(36)},J=M("keys"),$={},H=u.WeakMap;if(q){var G=new H,B=G.get,K=G.has,Q=G.set;n=function(t,e){return Q.call(G,t,e),e},o=function(t){return B.call(G,t)||{}},i=function(t){return K.call(G,t)}}else{var X=J[s="state"]||(J[s]=V(s));$[X]=!0,n=function(t,e){return _(t,X,e),e},o=function(t){return P(t,X)?t[X]:{}},i=function(t){return P(t,X)}}var Y={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!O(e)||(r=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},U=r((function(t){var e=Y.get,r=Y.enforce,n=String(F).split("toString");M("inspectSource",(function(t){return F.call(t)})),(t.exports=function(t,e,o,i){var s=!!i&&!!i.unsafe,a=!!i&&!!i.enumerable,c=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||P(o,"name")||_(o,"name",e),r(o).source=n.join("string"==typeof e?e:"")),t!==u?(s?!c&&t[e]&&(a=!0):delete t[e],a?t[e]=o:_(t,e,o)):a?t[e]=o:L(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||F.call(this)}))})),Z=u,tt=function(t){return"function"==typeof t?t:void 0},et=Math.ceil,rt=Math.floor,nt=function(t){return isNaN(t=+t)?0:(t>0?rt:et)(t)},ot=Math.min,it=function(t){return t>0?ot(nt(t),9007199254740991):0},st=Math.max,at=Math.min,ct=function(t,e){var r=nt(t);return r<0?st(r+e,0):at(r,e)},ut=function(t){return function(e,r,n){var o,i=S(e),s=it(i.length),a=ct(n,s);if(t&&r!=r){for(;s>a;)if((o=i[a++])!=o)return!0}else for(;s>a;a++)if((t||a in i)&&i[a]===r)return t||a||0;return!t&&-1}},ft={includes:ut(!0),indexOf:ut(!1)},pt=ft.indexOf,lt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),ht={f:Object.getOwnPropertyNames||function(t){return function(t,e){var r,n=S(t),o=0,i=[];for(r in n)!P($,r)&&P(n,r)&&i.push(r);for(;e.length>o;)P(n,r=e[o++])&&(~pt(i,r)||i.push(r));return i}(t,lt)}},dt={f:Object.getOwnPropertySymbols},yt=function(t,e){return arguments.length<2?tt(Z[t])||tt(u[t]):Z[t]&&Z[t][e]||u[t]&&u[t][e]}("Reflect","ownKeys")||function(t){var e=ht.f(z(t)),r=dt.f;return r?e.concat(r(t)):e},gt=function(t,e){for(var r=yt(e),n=R.f,o=A.f,i=0;i<r.length;i++){var s=r[i];P(t,s)||n(t,s,o(e,s))}},vt=/#|\.prototype\./,wt=function(t,e){var r=bt[mt(t)];return r==Ot||r!=St&&("function"==typeof e?f(e):!!e)},mt=wt.normalize=function(t){return String(t).replace(vt,".").toLowerCase()},bt=wt.data={},St=wt.NATIVE="N",Ot=wt.POLYFILL="P",xt=wt,jt=A.f,Pt=function(t,e){var r,n,o,i,s,a=t.target,c=t.global,f=t.stat;if(r=c?u:f?u[a]||L(a,{}):(u[a]||{}).prototype)for(n in e){if(i=e[n],o=t.noTargetGet?(s=jt(r,n))&&s.value:r[n],!xt(c?n:a+(f?".":"#")+n,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;gt(i,o)}(t.sham||o&&o.sham)&&_(i,"sham",!0),U(r,n,i,t)}},Tt=function(t,e,r){if(function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function")}(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}},Ct=Array.isArray||function(t){return"Array"==v(t)},Wt=!!Object.getOwnPropertySymbols&&!f((function(){return!String(Symbol())})),Nt=u.Symbol,At=M("wks"),zt=function(t){return At[t]||(At[t]=Wt&&Nt[t]||(Wt?Nt:V)("Symbol."+t))},Et=zt("species"),Rt=function(t,e){var r;return Ct(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!Ct(r.prototype)?O(r)&&null===(r=r[Et])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===e?0:e)},_t=[].push,Lt=function(t){var e=1==t,r=2==t,n=3==t,o=4==t,i=6==t,s=5==t||i;return function(a,c,u,f){for(var p,l,h=Object(b(a)),d=m(h),y=Tt(c,u,3),g=it(d.length),v=0,w=f||Rt,S=e?w(a,g):r?w(a,0):void 0;g>v;v++)if((s||v in d)&&(l=y(p=d[v],v,h),t))if(e)S[v]=l;else if(l)switch(t){case 3:return!0;case 5:return p;case 6:return v;case 2:_t.call(S,p)}else if(o)return!1;return i?-1:n||o?o:S}},Mt={forEach:Lt(0),map:Lt(1),filter:Lt(2),some:Lt(3),every:Lt(4),find:Lt(5),findIndex:Lt(6)},Ft=zt("species"),It=function(t){return!f((function(){var e=[];return(e.constructor={})[Ft]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},qt=Mt.filter;Pt({target:"Array",proto:!0,forced:!It("filter")},{filter:function(t){return qt(this,t,arguments.length>1?arguments[1]:void 0)}});var kt,Dt,Vt=ft.indexOf,Jt=[].indexOf,$t=!!Jt&&1/[1].indexOf(1,-0)<0,Ht=!(Dt=[]["indexOf"])||!f((function(){Dt.call(null,kt||function(){throw 1},1)}));Pt({target:"Array",proto:!0,forced:$t||Ht},{indexOf:function(t){return $t?Jt.apply(this,arguments)||0:Vt(this,t,arguments.length>1?arguments[1]:void 0)}});var Gt=function(t,e,r){var n=x(e);n in t?R.f(t,n,y(0,r)):t[n]=r},Bt=zt("species"),Kt=[].slice,Qt=Math.max;Pt({target:"Array",proto:!0,forced:!It("slice")},{slice:function(t,e){var r,n,o,i=S(this),s=it(i.length),a=ct(t,s),c=ct(void 0===e?s:e,s);if(Ct(i)&&("function"!=typeof(r=i.constructor)||r!==Array&&!Ct(r.prototype)?O(r)&&null===(r=r[Bt])&&(r=void 0):r=void 0,r===Array||void 0===r))return Kt.call(i,a,c);for(n=new(void 0===r?Array:r)(Qt(c-a,0)),o=0;a<c;a++,o++)a in i&&Gt(n,o,i[a]);return n.length=o,n}});var Xt="\t\n\v\f\r                 \u2028\u2029\ufeff",Yt="["+Xt+"]",Ut=RegExp("^"+Yt+Yt+"*"),Zt=RegExp(Yt+Yt+"*$"),te=function(t){return function(e){var r=String(b(e));return 1&t&&(r=r.replace(Ut,"")),2&t&&(r=r.replace(Zt,"")),r}},ee={start:te(1),end:te(2),trim:te(3)}.trim,re=u.parseInt,ne=/^[+-]?0[Xx]/,oe=8!==re(Xt+"08")||22!==re(Xt+"0x16")?function(t,e){var r=ee(String(t));return re(r,e>>>0||(ne.test(r)?16:10))}:re;Pt({global:!0,forced:parseInt!=oe},{parseInt:oe});var ie=t.fn.bootstrapTable.utils;t.extend(t.fn.bootstrapTable.defaults,{usePipeline:!1,pipelineSize:1e3,onCachedDataHit:function(t){return!1},onCachedDataReset:function(t){return!1}}),t.extend(t.fn.bootstrapTable.Constructor.EVENTS,{"cached-data-hit.bs.table":"onCachedDataHit","cached-data-reset.bs.table":"onCachedDataReset"});var se=t.fn.bootstrapTable.Constructor,ae=se.prototype.init,ce=(se.prototype.initServer,se.prototype.onSearch),ue=se.prototype.onSort,fe=se.prototype.onPageListChange;se.prototype.init=function(){this.initPipeline();for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];ae.apply(this,Array.prototype.slice.apply(e))},se.prototype.initPipeline=function(){this.cacheRequestJSON={},this.cacheWindows=[],this.currWindow=0,this.resetCache=!0},se.prototype.onSearch=function(t){this.options.usePipeline&&(this.resetCache=!0),ce.apply(this,Array.prototype.slice.apply(arguments))},se.prototype.onSort=function(t){this.options.usePipeline&&(this.resetCache=!0),ue.apply(this,Array.prototype.slice.apply(arguments))},se.prototype.onPageListChange=function(e){var r=t(e.currentTarget),n=parseInt(r.text());this.options.pipelineSize=this.calculatePipelineSize(this.options.pipelineSize,n),this.resetCache=!0,fe.apply(this,Array.prototype.slice.apply(arguments))},se.prototype.calculatePipelineSize=function(t,e){return 0===e?0:Math.ceil(t/e)*e},se.prototype.setCacheWindows=function(){this.cacheWindows=[];for(var t=this.options.totalRows/this.options.pipelineSize,e=0;e<=t;e++){var r=e*this.options.pipelineSize;this.cacheWindows[e]={lower:r,upper:r+this.options.pipelineSize-1}}},se.prototype.setCurrWindow=function(t){this.currWindow=0;for(var e=0;e<this.cacheWindows.length;e++)if(this.cacheWindows[e].lower<=t&&t<=this.cacheWindows[e].upper){this.currWindow=e;break}},se.prototype.drawFromCache=function(e,r){var n=t.extend(!0,{},this.cacheRequestJSON),o=e-this.cacheWindows[this.currWindow].lower,i=o+r;return n.rows=n.rows.slice(o,i),n},se.prototype.initServer=function(e,r,n){var o,i={},s=this.header.fields.indexOf(this.options.sortName),a={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};if(this.header.sortNames[s]&&(a.sortName=this.header.sortNames[s]),this.options.pagination&&"server"===this.options.sidePagination&&(a.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,a.pageNumber=this.options.pageNumber),n||this.options.url||this.options.ajax){var c=!0;if("limit"===this.options.queryParamsType&&(a={searchText:a.searchText,sortName:a.sortName,sortOrder:a.sortOrder},this.options.pagination&&"server"===this.options.sidePagination))if(a.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,a.offset=(this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize)*(this.options.pageNumber-1),this.options.usePipeline)if(this.cacheWindows.length){var u=this.cacheWindows[this.currWindow];this.resetCache||a.offset<u.lower||a.offset>u.upper?(c=!0,this.setCurrWindow(a.offset),a.drawOffset=a.offset,a.offset=this.cacheWindows[this.currWindow].lower):c=!1}else c=!0,a.drawOffset=a.offset;else 0===a.limit&&delete a.limit;if(this.resetCache&&(c=!0,this.resetCache=!1),this.options.usePipeline&&c&&(a.drawLimit=a.limit,a.limit=this.options.pipelineSize),!c){var f=this.drawFromCache(a.offset,a.limit);return this.load(f),this.trigger("load-success",f),void this.trigger("cached-data-hit",f)}if(t.isEmptyObject(this.filterColumnsPartial)||(a.filter=JSON.stringify(this.filterColumnsPartial,null)),i=ie.calculateObjectValue(this.options,this.options.queryParams,[a],i),t.extend(i,r||{}),!1!==i){e||this.$tableLoading.show();var p=this;o=t.extend({},ie.calculateObjectValue(null,this.options.ajaxOptions),{type:this.options.method,url:n||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(i):i,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(r){r=ie.calculateObjectValue(p.options,p.options.responseHandler,[r],r),p.options.usePipeline&&(p.cacheRequestJSON=t.extend(!0,{},r),p.options.totalRows=r[p.options.totalField],p.setCacheWindows(),p.setCurrWindow(a.drawOffset),r=p.drawFromCache(a.drawOffset,a.drawLimit),p.trigger("cached-data-reset",r)),p.load(r),p.trigger("load-success",r),e||p.$tableLoading.hide()},error:function(t){var r=[];"server"===p.options.sidePagination&&((r={})[p.options.totalField]=0,r[p.options.dataField]=[]),p.load(r),p.trigger("load-error",t.status,t),e||p.$tableLoading.hide()}}),this.options.ajax?ie.calculateObjectValue(this,this.options.ajax,[o],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=t.ajax(o))}}}}));