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.1
  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 n(t,e){return t(e={exports:{}},e.exports),e.exports}var r=function(t){return t&&t.Math==Math&&t},o=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("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 n,r;if(e&&"function"==typeof(n=t.toString)&&!v(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!v(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!v(r=n.call(t)))return r;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,n){if(C(t),e=w(e,!0),C(n),x)try{return T(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},A=s?function(t,e,n){return W.f(t,e,f(1,n))}:function(t,e,n){return t[e]=n,t},N=function(t,e){try{A(o,t,e)}catch(n){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=n((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 n;if(!v(e)||(n=M(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},nt=n((function(t){var e=et.get,n=et.enforce,r=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),n(i).source=r.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)}))})),rt=o,ot=function(t){return"function"==typeof t?t:void 0},it=function(t,e){return arguments.length<2?ot(rt[t])||ot(o[t]):rt[t]&&rt[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 n=ct(t);return n<0?pt(n+e,0):lt(n,e)},dt=function(t){return function(e,n,r){var o,i=g(e),s=ft(i.length),a=ht(r,s);if(t&&n!=n){for(;s>a;)if((o=i[a++])!=o)return!0}else for(;s>a;a++)if((t||a in i)&&i[a]===n)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 n,r=g(t),o=0,i=[];for(n in r)!b(G,n)&&b(r,n)&&i.push(n);for(;e.length>o;)b(r,n=e[o++])&&(~gt(i,n)||i.push(n));return i}(t,vt)}},mt={f:Object.getOwnPropertySymbols},bt=it("Reflect","ownKeys")||function(t){var e=wt.f(C(t)),n=mt.f;return n?e.concat(n(t)):e},St=function(t,e){for(var n=bt(e),r=W.f,o=P.f,i=0;i<n.length;i++){var s=n[i];b(t,s)||r(t,s,o(e,s))}},Ot=/#|\.prototype\./,xt=function(t,e){var n=Pt[jt(t)];return n==Tt||n!=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 n,r,i,s,a,c=t.target,u=t.global,f=t.stat;if(n=u?o:f?o[c]||N(c,{}):(o[c]||{}).prototype)for(r in e){if(s=e[r],i=t.noTargetGet?(a=At(n,r))&&a.value:n[r],!Wt(u?r:c+(f?".":"#")+r,t.forced)&&void 0!==i){if(typeof s==typeof i)continue;St(s,i)}(t.sham||i&&i.sham)&&A(s,"sham",!0),nt(n,r,s,t)}},zt=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function")}(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,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 n;return Et(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Et(n.prototype)?v(n)&&null===(n=n[qt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},Dt=[].push,Vt=function(t){var e=1==t,n=2==t,r=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):n?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:r||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,ne=yt.indexOf,re=[].indexOf,oe=!!re&&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?re.apply(this,arguments)||0:ne(this,t,arguments.length>1?arguments[1]:void 0)}});var se=function(t,e,n){var r=w(e);r in t?W.f(t,r,f(0,n)):t[r]=n},ae=_t("species"),ce=[].slice,ue=Math.max;Nt({target:"Array",proto:!0,forced:!Xt("slice")},{slice:function(t,e){var n,r,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(n=i.constructor)||n!==Array&&!Et(n.prototype)?v(n)&&null===(n=n[ae])&&(n=void 0):n=void 0,n===Array||void 0===n))return ce.call(i,a,c);for(r=new(void 0===n?Array:n)(ue(c-a,0)),o=0;a<c;a++,o++)a in i&&se(r,o,i[a]);return r.length=o,r}});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 n=String(y(e));return 1&t&&(n=n.replace(le,"")),2&t&&(n=n.replace(he,"")),n}},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 n=ye(String(t));return ge(n,e>>>0||(ve.test(n)?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.onSearch,xe=be.prototype.onSort,je=be.prototype.onPageListChange;be.prototype.init=function(){this.initPipeline();for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];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(){this.options.usePipeline&&(this.resetCache=!0),Oe.apply(this,Array.prototype.slice.apply(arguments))},be.prototype.onSort=function(){this.options.usePipeline&&(this.resetCache=!0),xe.apply(this,Array.prototype.slice.apply(arguments))},be.prototype.onPageListChange=function(e){var n=t(e.currentTarget),r=parseInt(n.text());this.options.pipelineSize=this.calculatePipelineSize(this.options.pipelineSize,r),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 n=e*this.options.pipelineSize;this.cacheWindows[e]={lower:n,upper:n+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,n){var r=t.extend(!0,{},this.cacheRequestJSON),o=e-this.cacheWindows[this.currWindow].lower,i=o+n;return r.rows=r.rows.slice(o,i),r},be.prototype.initServer=function(e,n,r){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),r||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,n||{}),!1!==i){e||this.$tableLoading.show();var p=this;o=t.extend({},me.calculateObjectValue(null,this.options.ajaxOptions),{type:this.options.method,url:r||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(n){n=me.calculateObjectValue(p.options,p.options.responseHandler,[n],n),p.options.usePipeline&&(p.cacheRequestJSON=t.extend(!0,{},n),p.options.totalRows=n[p.options.totalField],p.setCacheWindows(),p.setCurrWindow(a.drawOffset),n=p.drawFromCache(a.drawOffset,a.drawLimit),p.trigger("cached-data-reset",n)),p.load(n),p.trigger("load-success",n),e||p.$tableLoading.hide()},error:function(t){var n=[];"server"===p.options.sidePagination&&((n={})[p.options.totalField]=0,n[p.options.dataField]=[]),p.load(n),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))}}}}));