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