UNPKG

17.9 kBJavaScriptView Raw
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.20.1
5 * @homepage https://bootstrap-table.com
6 * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
7 * @license MIT
8 */
9
10!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,a,s=function(t){return t&&t.Math==Math&&t},u=s("object"==typeof globalThis&&globalThis)||s("object"==typeof window&&window)||s("object"==typeof self&&self)||s("object"==typeof n&&n)||function(){return this}()||Function("return this")(),c=function(t){try{return!!t()}catch(t){return!0}},f=!c((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=!c((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),l=Function.prototype.call,h=p?l.bind(l):function(){return l.apply(l,arguments)},d={}.propertyIsEnumerable,y=Object.getOwnPropertyDescriptor,g={f:y&&!d.call({1:2},1)?function(t){var e=y(this,t);return!!e&&e.enumerable}:d},b=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},v=Function.prototype,m=v.bind,w=v.call,S=p&&m.bind(w,w),O=p?function(t){return t&&S(t)}:function(t){return t&&function(){return w.apply(t,arguments)}},j=O({}.toString),x=O("".slice),P=function(t){return x(j(t),8,-1)},T=u.Object,C=O("".split),E=c((function(){return!T("z").propertyIsEnumerable(0)}))?function(t){return"String"==P(t)?C(t,""):T(t)}:T,A=u.TypeError,z=function(t){if(null==t)throw A("Can't call method on "+t);return t},N=function(t){return E(z(t))},W=function(t){return"function"==typeof t},R=function(t){return"object"==typeof t?null!==t:W(t)},F=function(t){return W(t)?t:void 0},I=function(t,e){return arguments.length<2?F(u[t]):u[t]&&u[t][e]},L=O({}.isPrototypeOf),M=I("navigator","userAgent")||"",D=u.process,_=u.Deno,k=D&&D.versions||_&&_.version,q=k&&k.v8;q&&(a=(i=q.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!a&&M&&(!(i=M.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=M.match(/Chrome\/(\d+)/))&&(a=+i[1]);var G=a,V=!!Object.getOwnPropertySymbols&&!c((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&G&&G<41})),J=V&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,B=u.Object,H=J?function(t){return"symbol"==typeof t}:function(t){var e=I("Symbol");return W(e)&&L(e.prototype,B(t))},U=u.String,$=u.TypeError,K=function(t){if(W(t))return t;throw $(function(t){try{return U(t)}catch(t){return"Object"}}(t)+" is not a function")},Q=u.TypeError,X=Object.defineProperty,Y=function(t,e){try{X(u,t,{value:e,configurable:!0,writable:!0})}catch(r){u[t]=e}return e},Z="__core-js_shared__",tt=u[Z]||Y(Z,{}),et=o((function(t){(t.exports=function(t,e){return tt[t]||(tt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.22.4",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE",source:"https://github.com/zloirock/core-js"})})),rt=u.Object,nt=function(t){return rt(z(t))},ot=O({}.hasOwnProperty),it=Object.hasOwn||function(t,e){return ot(nt(t),e)},at=0,st=Math.random(),ut=O(1..toString),ct=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ut(++at+st,36)},ft=et("wks"),pt=u.Symbol,lt=pt&&pt.for,ht=J?pt:pt&&pt.withoutSetter||ct,dt=function(t){if(!it(ft,t)||!V&&"string"!=typeof ft[t]){var e="Symbol."+t;V&&it(pt,t)?ft[t]=pt[t]:ft[t]=J&&lt?lt(e):ht(e)}return ft[t]},yt=u.TypeError,gt=dt("toPrimitive"),bt=function(t,e){if(!R(t)||H(t))return t;var r,n,o=null==(r=t[gt])?void 0:K(r);if(o){if(void 0===e&&(e="default"),n=h(o,t,e),!R(n)||H(n))return n;throw yt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var r,n;if("string"===e&&W(r=t.toString)&&!R(n=h(r,t)))return n;if(W(r=t.valueOf)&&!R(n=h(r,t)))return n;if("string"!==e&&W(r=t.toString)&&!R(n=h(r,t)))return n;throw Q("Can't convert object to primitive value")}(t,e)},vt=function(t){var e=bt(t,"string");return H(e)?e:e+""},mt=u.document,wt=R(mt)&&R(mt.createElement),St=!f&&!c((function(){return 7!=Object.defineProperty((t="div",wt?mt.createElement(t):{}),"a",{get:function(){return 7}}).a;var t})),Ot=Object.getOwnPropertyDescriptor,jt={f:f?Ot:function(t,e){if(t=N(t),e=vt(e),St)try{return Ot(t,e)}catch(t){}if(it(t,e))return b(!h(g.f,t,e),t[e])}},xt=f&&c((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Pt=u.String,Tt=u.TypeError,Ct=function(t){if(R(t))return t;throw Tt(Pt(t)+" is not an object")},Et=u.TypeError,At=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,Nt="enumerable",Wt="configurable",Rt="writable",Ft={f:f?xt?function(t,e,r){if(Ct(t),e=vt(e),Ct(r),"function"==typeof t&&"prototype"===e&&"value"in r&&Rt in r&&!r.writable){var n=zt(t,e);n&&n.writable&&(t[e]=r.value,r={configurable:Wt in r?r.configurable:n.configurable,enumerable:Nt in r?r.enumerable:n.enumerable,writable:!1})}return At(t,e,r)}:At:function(t,e,r){if(Ct(t),e=vt(e),Ct(r),St)try{return At(t,e,r)}catch(t){}if("get"in r||"set"in r)throw Et("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},It=f?function(t,e,r){return Ft.f(t,e,b(1,r))}:function(t,e,r){return t[e]=r,t},Lt=Function.prototype,Mt=f&&Object.getOwnPropertyDescriptor,Dt=it(Lt,"name"),_t={EXISTS:Dt,PROPER:Dt&&"something"===function(){}.name,CONFIGURABLE:Dt&&(!f||f&&Mt(Lt,"name").configurable)},kt=O(Function.toString);W(tt.inspectSource)||(tt.inspectSource=function(t){return kt(t)});var qt,Gt,Vt,Jt,Bt=tt.inspectSource,Ht=u.WeakMap,Ut=W(Ht)&&/native code/.test(Bt(Ht)),$t=et("keys"),Kt={},Qt="Object already initialized",Xt=u.TypeError,Yt=u.WeakMap;if(Ut||tt.state){var Zt=tt.state||(tt.state=new Yt),te=O(Zt.get),ee=O(Zt.has),re=O(Zt.set);qt=function(t,e){if(ee(Zt,t))throw new Xt(Qt);return e.facade=t,re(Zt,t,e),e},Gt=function(t){return te(Zt,t)||{}},Vt=function(t){return ee(Zt,t)}}else{var ne=$t[Jt="state"]||($t[Jt]=ct(Jt));Kt[ne]=!0,qt=function(t,e){if(it(t,ne))throw new Xt(Qt);return e.facade=t,It(t,ne,e),e},Gt=function(t){return it(t,ne)?t[ne]:{}},Vt=function(t){return it(t,ne)}}var oe={set:qt,get:Gt,has:Vt,enforce:function(t){return Vt(t)?Gt(t):qt(t,{})},getterFor:function(t){return function(e){var r;if(!R(e)||(r=Gt(e)).type!==t)throw Xt("Incompatible receiver, "+t+" required");return r}}},ie=o((function(t){var e=Ft.f,r=_t.CONFIGURABLE,n=oe.enforce,o=oe.get,i=!c((function(){return 8!==e((function(){}),"length",{value:8}).length})),a=String(String).split("String"),s=t.exports=function(t,o,s){"Symbol("===String(o).slice(0,7)&&(o="["+String(o).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),s&&s.getter&&(o="get "+o),s&&s.setter&&(o="set "+o),(!it(t,"name")||r&&t.name!==o)&&e(t,"name",{value:o,configurable:!0}),i&&s&&it(s,"arity")&&t.length!==s.arity&&e(t,"length",{value:s.arity});var u=n(t);return it(u,"source")||(u.source=a.join("string"==typeof o?o:"")),t};Function.prototype.toString=s((function(){return W(this)&&o(this).source||Bt(this)}),"toString")})),ae=function(t,e,r,n){var o=!!n&&!!n.unsafe,i=!!n&&!!n.enumerable,a=!!n&&!!n.noTargetGet,s=n&&void 0!==n.name?n.name:e;return W(r)&&ie(r,s,n),t===u?(i?t[e]=r:Y(e,r),t):(o?!a&&t[e]&&(i=!0):delete t[e],i?t[e]=r:It(t,e,r),t)},se=Math.ceil,ue=Math.floor,ce=function(t){var e=+t;return e!=e||0===e?0:(e>0?ue:se)(e)},fe=Math.max,pe=Math.min,le=function(t,e){var r=ce(t);return r<0?fe(r+e,0):pe(r,e)},he=Math.min,de=function(t){return(e=t.length)>0?he(ce(e),9007199254740991):0;var e},ye=function(t){return function(e,r,n){var o,i=N(e),a=de(i),s=le(n,a);if(t&&r!=r){for(;a>s;)if((o=i[s++])!=o)return!0}else for(;a>s;s++)if((t||s in i)&&i[s]===r)return t||s||0;return!t&&-1}},ge={includes:ye(!0),indexOf:ye(!1)},be=ge.indexOf,ve=O([].push),me=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),we=Object.getOwnPropertyNames||function(t){return function(t,e){var r,n=N(t),o=0,i=[];for(r in n)!it(Kt,r)&&it(n,r)&&ve(i,r);for(;e.length>o;)it(n,r=e[o++])&&(~be(i,r)||ve(i,r));return i}(t,me)},Se={f:we},Oe={f:Object.getOwnPropertySymbols},je=O([].concat),xe=I("Reflect","ownKeys")||function(t){var e=Se.f(Ct(t)),r=Oe.f;return r?je(e,r(t)):e},Pe=function(t,e,r){for(var n=xe(e),o=Ft.f,i=jt.f,a=0;a<n.length;a++){var s=n[a];it(t,s)||r&&it(r,s)||o(t,s,i(e,s))}},Te=/#|\.prototype\./,Ce=function(t,e){var r=Ae[Ee(t)];return r==Ne||r!=ze&&(W(e)?c(e):!!e)},Ee=Ce.normalize=function(t){return String(t).replace(Te,".").toLowerCase()},Ae=Ce.data={},ze=Ce.NATIVE="N",Ne=Ce.POLYFILL="P",We=Ce,Re=jt.f,Fe=function(t,e){var r,n,o,i,a,s=t.target,c=t.global,f=t.stat;if(r=c?u:f?u[s]||Y(s,{}):(u[s]||{}).prototype)for(n in e){if(i=e[n],o=t.noTargetGet?(a=Re(r,n))&&a.value:r[n],!We(c?n:s+(f?".":"#")+n,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;Pe(i,o)}(t.sham||o&&o.sham)&&It(i,"sham",!0),ae(r,n,i,t)}},Ie=Array.isArray||function(t){return"Array"==P(t)},Le={};Le[dt("toStringTag")]="z";var Me="[object z]"===String(Le),De=dt("toStringTag"),_e=u.Object,ke="Arguments"==P(function(){return arguments}()),qe=Me?P:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=_e(t),De))?r:ke?P(e):"Object"==(n=P(e))&&W(e.callee)?"Arguments":n},Ge=function(){},Ve=[],Je=I("Reflect","construct"),Be=/^\s*(?:class|function)\b/,He=O(Be.exec),Ue=!Be.exec(Ge),$e=function(t){if(!W(t))return!1;try{return Je(Ge,Ve,t),!0}catch(t){return!1}},Ke=function(t){if(!W(t))return!1;switch(qe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ue||!!He(Be,Bt(t))}catch(t){return!0}};Ke.sham=!0;var Qe=!Je||c((function(){var t;return $e($e.call)||!$e(Object)||!$e((function(){t=!0}))||t}))?Ke:$e,Xe=function(t,e,r){var n=vt(e);n in t?Ft.f(t,n,b(0,r)):t[n]=r},Ye=dt("species"),Ze=function(t){return G>=51||!c((function(){var e=[];return(e.constructor={})[Ye]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},tr=O([].slice),er=Ze("slice"),rr=dt("species"),nr=u.Array,or=Math.max;Fe({target:"Array",proto:!0,forced:!er},{slice:function(t,e){var r,n,o,i=N(this),a=de(i),s=le(t,a),u=le(void 0===e?a:e,a);if(Ie(i)&&(r=i.constructor,(Qe(r)&&(r===nr||Ie(r.prototype))||R(r)&&null===(r=r[rr]))&&(r=void 0),r===nr||void 0===r))return tr(i,s,u);for(n=new(void 0===r?nr:r)(or(u-s,0)),o=0;s<u;s++,o++)s in i&&Xe(n,o,i[s]);return n.length=o,n}});var ir=u.String,ar=function(t){if("Symbol"===qe(t))throw TypeError("Cannot convert a Symbol value to a string");return ir(t)},sr="\t\n\v\f\r                 \u2028\u2029\ufeff",ur=O("".replace),cr="["+sr+"]",fr=RegExp("^"+cr+cr+"*"),pr=RegExp(cr+cr+"*$"),lr=function(t){return function(e){var r=ar(z(e));return 1&t&&(r=ur(r,fr,"")),2&t&&(r=ur(r,pr,"")),r}},hr={start:lr(1),end:lr(2),trim:lr(3)}.trim,dr=u.parseInt,yr=u.Symbol,gr=yr&&yr.iterator,br=/^[+-]?0x/i,vr=O(br.exec),mr=8!==dr(sr+"08")||22!==dr(sr+"0x16")||gr&&!c((function(){dr(Object(gr))}))?function(t,e){var r=hr(ar(t));return dr(r,e>>>0||(vr(br,r)?16:10))}:dr;Fe({global:!0,forced:parseInt!=mr},{parseInt:mr});var wr,Sr,Or=ge.indexOf,jr=O([].indexOf),xr=!!jr&&1/jr([1],1,-0)<0,Pr=!!(Sr=[]["indexOf"])&&c((function(){Sr.call(null,wr||function(){return 1},1)}));Fe({target:"Array",proto:!0,forced:xr||!Pr},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return xr?jr(this,t,e)||0:Or(this,t,e)}});var Tr=O(O.bind),Cr=dt("species"),Er=u.Array,Ar=function(t,e){return new(function(t){var e;return Ie(t)&&(e=t.constructor,(Qe(e)&&(e===Er||Ie(e.prototype))||R(e)&&null===(e=e[Cr]))&&(e=void 0)),void 0===e?Er:e}(t))(0===e?0:e)},zr=O([].push),Nr=function(t){var e=1==t,r=2==t,n=3==t,o=4==t,i=6==t,a=7==t,s=5==t||i;return function(u,c,f,l){for(var h,d,y=nt(u),g=E(y),b=function(t,e){return K(t),void 0===e?t:p?Tr(t,e):function(){return t.apply(e,arguments)}}(c,f),v=de(g),m=0,w=l||Ar,S=e?w(u,v):r||a?w(u,0):void 0;v>m;m++)if((s||m in g)&&(d=b(h=g[m],m,y),t))if(e)S[m]=d;else if(d)switch(t){case 3:return!0;case 5:return h;case 6:return m;case 2:zr(S,h)}else switch(t){case 4:return!1;case 7:zr(S,h)}return i?-1:n||o?o:S}},Wr={forEach:Nr(0),map:Nr(1),filter:Nr(2),some:Nr(3),every:Nr(4),find:Nr(5),findIndex:Nr(6),filterReject:Nr(7)}.filter;Fe({target:"Array",proto:!0,forced:!Ze("filter")},{filter:function(t){return Wr(this,t,arguments.length>1?arguments[1]:void 0)}});var Rr=Me?{}.toString:function(){return"[object "+qe(this)+"]"};Me||ae(Object.prototype,"toString",Rr,{unsafe:!0});var Fr=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 Ir=r.default.fn.bootstrapTable.Constructor,Lr=Ir.prototype.init,Mr=Ir.prototype.onSearch,Dr=Ir.prototype.onSort,_r=Ir.prototype.onPageListChange;Ir.prototype.init=function(){this.initPipeline();for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];Lr.apply(this,Array.prototype.slice.apply(e))},Ir.prototype.initPipeline=function(){this.cacheRequestJSON={},this.cacheWindows=[],this.currWindow=0,this.resetCache=!0},Ir.prototype.onSearch=function(){this.options.usePipeline&&(this.resetCache=!0),Mr.apply(this,Array.prototype.slice.apply(arguments))},Ir.prototype.onSort=function(){this.options.usePipeline&&(this.resetCache=!0),Dr.apply(this,Array.prototype.slice.apply(arguments))},Ir.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,_r.apply(this,Array.prototype.slice.apply(arguments))},Ir.prototype.calculatePipelineSize=function(t,e){return 0===e?0:Math.ceil(t/e)*e},Ir.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}}},Ir.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}},Ir.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},Ir.prototype.initServer=function(t,e,n){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),n||this.options.url||this.options.ajax){var u=!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 c=this.cacheWindows[this.currWindow];this.resetCache||s.offset<c.lower||s.offset>c.upper?(u=!0,this.setCurrWindow(s.offset),s.drawOffset=s.offset,s.offset=this.cacheWindows[this.currWindow].lower):u=!1}else u=!0,s.drawOffset=s.offset;else 0===s.limit&&delete s.limit;if(this.resetCache&&(u=!0,this.resetCache=!1),this.options.usePipeline&&u&&(s.drawLimit=s.limit,s.limit=this.options.pipelineSize),!u){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(r.default.isEmptyObject(this.filterColumnsPartial)||(s.filter=JSON.stringify(this.filterColumnsPartial,null)),i=Fr.calculateObjectValue(this.options,this.options.queryParams,[s],i),r.default.extend(i,e||{}),!1!==i){t||this.$tableLoading.show();var p=this;o=r.default.extend({},Fr.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=Fr.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(s.drawOffset),e=p.drawFromCache(s.drawOffset,s.drawLimit),p.trigger("cached-data-reset",e)),p.load(e),p.trigger("load-success",e),t||p.hideLoading()},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.hideLoading()}}),this.options.ajax?Fr.calculateObjectValue(this,this.options.ajax,[o],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=r.default.ajax(o))}}}}));