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