bootstrap-table-pipeline.min.js 14 KB

12345678910
  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.18.0
  5. * @homepage https://bootstrap-table.com
  6. * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
  7. * @license MIT
  8. */
  9. !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&&Object.prototype.hasOwnProperty.call(t,"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=function(t){return t&&t.Math==Math&&t},o=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")(),i=function(t){try{return!!t()}catch(t){return!0}},s=!i((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})),a={}.propertyIsEnumerable,c=Object.getOwnPropertyDescriptor,u={f:c&&!a.call({1:2},1)?function(t){var e=c(this,t);return!!e&&e.enumerable}:a},f=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},p={}.toString,l=function(t){return p.call(t).slice(8,-1)},h="".split,d=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==l(t)?h.call(t,""):Object(t)}:Object,y=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},g=function(t){return d(y(t))},v=function(t){return"object"==typeof t?null!==t:"function"==typeof t},w=function(t,e){if(!v(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!v(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!v(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!v(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},m={}.hasOwnProperty,b=function(t,e){return m.call(t,e)},S=o.document,O=v(S)&&v(S.createElement),x=!s&&!i((function(){return 7!=Object.defineProperty((t="div",O?S.createElement(t):{}),"a",{get:function(){return 7}}).a;var t})),j=Object.getOwnPropertyDescriptor,P={f:s?j:function(t,e){if(t=g(t),e=w(e,!0),x)try{return j(t,e)}catch(t){}if(b(t,e))return f(!u.f.call(t,e),t[e])}},C=function(t){if(!v(t))throw TypeError(String(t)+" is not an object");return t},T=Object.defineProperty,W={f:s?T:function(t,e,r){if(C(t),e=w(e,!0),C(r),x)try{return T(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}},A=s?function(t,e,r){return W.f(t,e,f(1,r))}:function(t,e,r){return t[e]=r,t},N=function(t,e){try{A(o,t,e)}catch(r){o[t]=e}return e},z="__core-js_shared__",E=o[z]||N(z,{}),R=Function.toString;"function"!=typeof E.inspectSource&&(E.inspectSource=function(t){return R.call(t)});var L,M,F,I,_=E.inspectSource,q=o.WeakMap,k="function"==typeof q&&/native code/.test(_(q)),D=r((function(t){(t.exports=function(t,e){return E[t]||(E[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.0",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})),V=0,J=Math.random(),$=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++V+J).toString(36)},H=D("keys"),G={},B=o.WeakMap;if(k){var K=new B,Q=K.get,X=K.has,Y=K.set;L=function(t,e){return Y.call(K,t,e),e},M=function(t){return Q.call(K,t)||{}},F=function(t){return X.call(K,t)}}else{var U=H[I="state"]||(H[I]=$(I));G[U]=!0,L=function(t,e){return A(t,U,e),e},M=function(t){return b(t,U)?t[U]:{}},F=function(t){return b(t,U)}}var Z,tt,et={set:L,get:M,has:F,enforce:function(t){return F(t)?M(t):L(t,{})},getterFor:function(t){return function(e){var r;if(!v(e)||(r=M(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},rt=r((function(t){var e=et.get,r=et.enforce,n=String(String).split("String");(t.exports=function(t,e,i,s){var a=!!s&&!!s.unsafe,c=!!s&&!!s.enumerable,u=!!s&&!!s.noTargetGet;"function"==typeof i&&("string"!=typeof e||b(i,"name")||A(i,"name",e),r(i).source=n.join("string"==typeof e?e:"")),t!==o?(a?!u&&t[e]&&(c=!0):delete t[e],c?t[e]=i:A(t,e,i)):c?t[e]=i:N(e,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||_(this)}))})),nt=o,ot=function(t){return"function"==typeof t?t:void 0},it=function(t,e){return arguments.length<2?ot(nt[t])||ot(o[t]):nt[t]&&nt[t][e]||o[t]&&o[t][e]},st=Math.ceil,at=Math.floor,ct=function(t){return isNaN(t=+t)?0:(t>0?at:st)(t)},ut=Math.min,ft=function(t){return t>0?ut(ct(t),9007199254740991):0},pt=Math.max,lt=Math.min,ht=function(t,e){var r=ct(t);return r<0?pt(r+e,0):lt(r,e)},dt=function(t){return function(e,r,n){var o,i=g(e),s=ft(i.length),a=ht(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}},yt={includes:dt(!0),indexOf:dt(!1)},gt=yt.indexOf,vt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),wt={f:Object.getOwnPropertyNames||function(t){return function(t,e){var r,n=g(t),o=0,i=[];for(r in n)!b(G,r)&&b(n,r)&&i.push(r);for(;e.length>o;)b(n,r=e[o++])&&(~gt(i,r)||i.push(r));return i}(t,vt)}},mt={f:Object.getOwnPropertySymbols},bt=it("Reflect","ownKeys")||function(t){var e=wt.f(C(t)),r=mt.f;return r?e.concat(r(t)):e},St=function(t,e){for(var r=bt(e),n=W.f,o=P.f,i=0;i<r.length;i++){var s=r[i];b(t,s)||n(t,s,o(e,s))}},Ot=/#|\.prototype\./,xt=function(t,e){var r=Pt[jt(t)];return r==Tt||r!=Ct&&("function"==typeof e?i(e):!!e)},jt=xt.normalize=function(t){return String(t).replace(Ot,".").toLowerCase()},Pt=xt.data={},Ct=xt.NATIVE="N",Tt=xt.POLYFILL="P",Wt=xt,At=P.f,Nt=function(t,e){var r,n,i,s,a,c=t.target,u=t.global,f=t.stat;if(r=u?o:f?o[c]||N(c,{}):(o[c]||{}).prototype)for(n in e){if(s=e[n],i=t.noTargetGet?(a=At(r,n))&&a.value:r[n],!Wt(u?n:c+(f?".":"#")+n,t.forced)&&void 0!==i){if(typeof s==typeof i)continue;St(s,i)}(t.sham||i&&i.sham)&&A(s,"sham",!0),rt(r,n,s,t)}},zt=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)}},Et=Array.isArray||function(t){return"Array"==l(t)},Rt=!!Object.getOwnPropertySymbols&&!i((function(){return!String(Symbol())})),Lt=Rt&&!Symbol.sham&&"symbol"==typeof Symbol(),Mt=D("wks"),Ft=o.Symbol,It=Lt?Ft:$,_t=function(t){return b(Mt,t)||(Rt&&b(Ft,t)?Mt[t]=Ft[t]:Mt[t]=It("Symbol."+t)),Mt[t]},qt=_t("species"),kt=function(t,e){var r;return Et(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!Et(r.prototype)?v(r)&&null===(r=r[qt])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===e?0:e)},Dt=[].push,Vt=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(y(a)),g=d(h),v=zt(c,u,3),w=ft(g.length),m=0,b=f||kt,S=e?b(a,w):r?b(a,0):void 0;w>m;m++)if((s||m in g)&&(l=v(p=g[m],m,h),t))if(e)S[m]=l;else if(l)switch(t){case 3:return!0;case 5:return p;case 6:return m;case 2:Dt.call(S,p)}else if(o)return!1;return i?-1:n||o?o:S}},Jt={forEach:Vt(0),map:Vt(1),filter:Vt(2),some:Vt(3),every:Vt(4),find:Vt(5),findIndex:Vt(6)},$t=it("navigator","userAgent")||"",Ht=o.process,Gt=Ht&&Ht.versions,Bt=Gt&&Gt.v8;Bt?tt=(Z=Bt.split("."))[0]+Z[1]:$t&&(!(Z=$t.match(/Edge\/(\d+)/))||Z[1]>=74)&&(Z=$t.match(/Chrome\/(\d+)/))&&(tt=Z[1]);var Kt=tt&&+tt,Qt=_t("species"),Xt=function(t){return Kt>=51||!i((function(){var e=[];return(e.constructor={})[Qt]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Yt=Jt.filter,Ut=Xt("filter"),Zt=Ut&&!i((function(){[].filter.call({length:-1,0:1},(function(t){throw t}))}));Nt({target:"Array",proto:!0,forced:!Ut||!Zt},{filter:function(t){return Yt(this,t,arguments.length>1?arguments[1]:void 0)}});var te,ee,re=yt.indexOf,ne=[].indexOf,oe=!!ne&&1/[1].indexOf(1,-0)<0,ie=!(ee=[]["indexOf"])||!i((function(){ee.call(null,te||function(){throw 1},1)}));Nt({target:"Array",proto:!0,forced:oe||ie},{indexOf:function(t){return oe?ne.apply(this,arguments)||0:re(this,t,arguments.length>1?arguments[1]:void 0)}});var se=function(t,e,r){var n=w(e);n in t?W.f(t,n,f(0,r)):t[n]=r},ae=_t("species"),ce=[].slice,ue=Math.max;Nt({target:"Array",proto:!0,forced:!Xt("slice")},{slice:function(t,e){var r,n,o,i=g(this),s=ft(i.length),a=ht(t,s),c=ht(void 0===e?s:e,s);if(Et(i)&&("function"!=typeof(r=i.constructor)||r!==Array&&!Et(r.prototype)?v(r)&&null===(r=r[ae])&&(r=void 0):r=void 0,r===Array||void 0===r))return ce.call(i,a,c);for(n=new(void 0===r?Array:r)(ue(c-a,0)),o=0;a<c;a++,o++)a in i&&se(n,o,i[a]);return n.length=o,n}});var fe="\t\n\v\f\r                 \u2028\u2029\ufeff",pe="["+fe+"]",le=RegExp("^"+pe+pe+"*"),he=RegExp(pe+pe+"*$"),de=function(t){return function(e){var r=String(y(e));return 1&t&&(r=r.replace(le,"")),2&t&&(r=r.replace(he,"")),r}},ye={start:de(1),end:de(2),trim:de(3)}.trim,ge=o.parseInt,ve=/^[+-]?0[Xx]/,we=8!==ge(fe+"08")||22!==ge(fe+"0x16")?function(t,e){var r=ye(String(t));return ge(r,e>>>0||(ve.test(r)?16:10))}:ge;Nt({global:!0,forced:parseInt!=we},{parseInt:we});var me=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 be=t.fn.bootstrapTable.Constructor,Se=be.prototype.init,Oe=(be.prototype.initServer,be.prototype.onSearch),xe=be.prototype.onSort,je=be.prototype.onPageListChange;be.prototype.init=function(){this.initPipeline();for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];Se.apply(this,Array.prototype.slice.apply(e))},be.prototype.initPipeline=function(){this.cacheRequestJSON={},this.cacheWindows=[],this.currWindow=0,this.resetCache=!0},be.prototype.onSearch=function(t){this.options.usePipeline&&(this.resetCache=!0),Oe.apply(this,Array.prototype.slice.apply(arguments))},be.prototype.onSort=function(t){this.options.usePipeline&&(this.resetCache=!0),xe.apply(this,Array.prototype.slice.apply(arguments))},be.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,je.apply(this,Array.prototype.slice.apply(arguments))},be.prototype.calculatePipelineSize=function(t,e){return 0===e?0:Math.ceil(t/e)*e},be.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}}},be.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}},be.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},be.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=me.calculateObjectValue(this.options,this.options.queryParams,[a],i),t.extend(i,r||{}),!1!==i){e||this.$tableLoading.show();var p=this;o=t.extend({},me.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=me.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?me.calculateObjectValue(this,this.options.ajax,[o],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=t.ajax(o))}}}}));