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