UNPKG

15.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.18.0
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=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 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}},u=!i((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})),c={}.propertyIsEnumerable,a=Object.getOwnPropertyDescriptor,f={f:a&&!c.call({1:2},1)?function(t){var e=a(this,t);return!!e&&e.enumerable}:c},l=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},s={}.toString,p=function(t){return s.call(t).slice(8,-1)},d="".split,h=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==p(t)?d.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 h(y(t))},v=function(t){return"object"==typeof t?null!==t:"function"==typeof t},b=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,w=function(t,e){return m.call(t,e)},O=o.document,j=v(O)&&v(O.createElement),S=function(t){return j?O.createElement(t):{}},T=!u&&!i((function(){return 7!=Object.defineProperty(S("div"),"a",{get:function(){return 7}}).a})),x=Object.getOwnPropertyDescriptor,E={f:u?x:function(t,e){if(t=g(t),e=b(e,!0),T)try{return x(t,e)}catch(t){}if(w(t,e))return l(!f.f.call(t,e),t[e])}},R=function(t){if(!v(t))throw TypeError(String(t)+" is not an object");return t},A=Object.defineProperty,P={f:u?A:function(t,e,r){if(R(t),e=b(e,!0),R(r),T)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}},k=u?function(t,e,r){return P.f(t,e,l(1,r))}:function(t,e,r){return t[e]=r,t},C=function(t,e){try{k(o,t,e)}catch(r){o[t]=e}return e},_="__core-js_shared__",I=o[_]||C(_,{}),M=Function.toString;"function"!=typeof I.inspectSource&&(I.inspectSource=function(t){return M.call(t)});var V,F,N,D=I.inspectSource,L=o.WeakMap,q="function"==typeof L&&/native code/.test(D(L)),B=r((function(t){(t.exports=function(t,e){return I[t]||(I[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.0",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})),H=0,W=Math.random(),$=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++H+W).toString(36)},z=B("keys"),G=function(t){return z[t]||(z[t]=$(t))},X={},K=o.WeakMap;if(q){var Q=new K,Y=Q.get,J=Q.has,U=Q.set;V=function(t,e){return U.call(Q,t,e),e},F=function(t){return Y.call(Q,t)||{}},N=function(t){return J.call(Q,t)}}else{var Z=G("state");X[Z]=!0,V=function(t,e){return k(t,Z,e),e},F=function(t){return w(t,Z)?t[Z]:{}},N=function(t){return w(t,Z)}}var tt,et,rt={set:V,get:F,has:N,enforce:function(t){return N(t)?F(t):V(t,{})},getterFor:function(t){return function(e){var r;if(!v(e)||(r=F(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},nt=r((function(t){var e=rt.get,r=rt.enforce,n=String(String).split("String");(t.exports=function(t,e,i,u){var c=!!u&&!!u.unsafe,a=!!u&&!!u.enumerable,f=!!u&&!!u.noTargetGet;"function"==typeof i&&("string"!=typeof e||w(i,"name")||k(i,"name",e),r(i).source=n.join("string"==typeof e?e:"")),t!==o?(c?!f&&t[e]&&(a=!0):delete t[e],a?t[e]=i:k(t,e,i)):a?t[e]=i:C(e,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||D(this)}))})),ot=o,it=function(t){return"function"==typeof t?t:void 0},ut=function(t,e){return arguments.length<2?it(ot[t])||it(o[t]):ot[t]&&ot[t][e]||o[t]&&o[t][e]},ct=Math.ceil,at=Math.floor,ft=function(t){return isNaN(t=+t)?0:(t>0?at:ct)(t)},lt=Math.min,st=function(t){return t>0?lt(ft(t),9007199254740991):0},pt=Math.max,dt=Math.min,ht=function(t){return function(e,r,n){var o,i=g(e),u=st(i.length),c=function(t,e){var r=ft(t);return r<0?pt(r+e,0):dt(r,e)}(n,u);if(t&&r!=r){for(;u>c;)if((o=i[c++])!=o)return!0}else for(;u>c;c++)if((t||c in i)&&i[c]===r)return t||c||0;return!t&&-1}},yt={includes:ht(!0),indexOf:ht(!1)}.indexOf,gt=function(t,e){var r,n=g(t),o=0,i=[];for(r in n)!w(X,r)&&w(n,r)&&i.push(r);for(;e.length>o;)w(n,r=e[o++])&&(~yt(i,r)||i.push(r));return i},vt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bt=vt.concat("length","prototype"),mt={f:Object.getOwnPropertyNames||function(t){return gt(t,bt)}},wt={f:Object.getOwnPropertySymbols},Ot=ut("Reflect","ownKeys")||function(t){var e=mt.f(R(t)),r=wt.f;return r?e.concat(r(t)):e},jt=function(t,e){for(var r=Ot(e),n=P.f,o=E.f,i=0;i<r.length;i++){var u=r[i];w(t,u)||n(t,u,o(e,u))}},St=/#|\.prototype\./,Tt=function(t,e){var r=Et[xt(t)];return r==At||r!=Rt&&("function"==typeof e?i(e):!!e)},xt=Tt.normalize=function(t){return String(t).replace(St,".").toLowerCase()},Et=Tt.data={},Rt=Tt.NATIVE="N",At=Tt.POLYFILL="P",Pt=Tt,kt=E.f,Ct=function(t,e){var r,n,i,u,c,a=t.target,f=t.global,l=t.stat;if(r=f?o:l?o[a]||C(a,{}):(o[a]||{}).prototype)for(n in e){if(u=e[n],i=t.noTargetGet?(c=kt(r,n))&&c.value:r[n],!Pt(f?n:a+(l?".":"#")+n,t.forced)&&void 0!==i){if(typeof u==typeof i)continue;jt(u,i)}(t.sham||i&&i.sham)&&k(u,"sham",!0),nt(r,n,u,t)}},_t=Array.isArray||function(t){return"Array"==p(t)},It=function(t){return Object(y(t))},Mt=function(t,e,r){var n=b(e);n in t?P.f(t,n,l(0,r)):t[n]=r},Vt=!!Object.getOwnPropertySymbols&&!i((function(){return!String(Symbol())})),Ft=Vt&&!Symbol.sham&&"symbol"==typeof Symbol(),Nt=B("wks"),Dt=o.Symbol,Lt=Ft?Dt:$,qt=function(t){return w(Nt,t)||(Vt&&w(Dt,t)?Nt[t]=Dt[t]:Nt[t]=Lt("Symbol."+t)),Nt[t]},Bt=qt("species"),Ht=function(t,e){var r;return _t(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!_t(r.prototype)?v(r)&&null===(r=r[Bt])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===e?0:e)},Wt=ut("navigator","userAgent")||"",$t=o.process,zt=$t&&$t.versions,Gt=zt&&zt.v8;Gt?et=(tt=Gt.split("."))[0]+tt[1]:Wt&&(!(tt=Wt.match(/Edge\/(\d+)/))||tt[1]>=74)&&(tt=Wt.match(/Chrome\/(\d+)/))&&(et=tt[1]);var Xt=et&&+et,Kt=qt("species"),Qt=function(t){return Xt>=51||!i((function(){var e=[];return(e.constructor={})[Kt]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Yt=qt("isConcatSpreadable"),Jt=9007199254740991,Ut="Maximum allowed index exceeded",Zt=Xt>=51||!i((function(){var t=[];return t[Yt]=!1,t.concat()[0]!==t})),te=Qt("concat"),ee=function(t){if(!v(t))return!1;var e=t[Yt];return void 0!==e?!!e:_t(t)};Ct({target:"Array",proto:!0,forced:!Zt||!te},{concat:function(t){var e,r,n,o,i,u=It(this),c=Ht(u,0),a=0;for(e=-1,n=arguments.length;e<n;e++)if(ee(i=-1===e?u:arguments[e])){if(a+(o=st(i.length))>Jt)throw TypeError(Ut);for(r=0;r<o;r++,a++)r in i&&Mt(c,a,i[r])}else{if(a>=Jt)throw TypeError(Ut);Mt(c,a++,i)}return c.length=a,c}});var re=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)}},ne=[].push,oe=function(t){var e=1==t,r=2==t,n=3==t,o=4==t,i=6==t,u=5==t||i;return function(c,a,f,l){for(var s,p,d=It(c),y=h(d),g=re(a,f,3),v=st(y.length),b=0,m=l||Ht,w=e?m(c,v):r?m(c,0):void 0;v>b;b++)if((u||b in y)&&(p=g(s=y[b],b,d),t))if(e)w[b]=p;else if(p)switch(t){case 3:return!0;case 5:return s;case 6:return b;case 2:ne.call(w,s)}else if(o)return!1;return i?-1:n||o?o:w}},ie={forEach:oe(0),map:oe(1),filter:oe(2),some:oe(3),every:oe(4),find:oe(5),findIndex:oe(6)},ue=ie.filter,ce=Qt("filter"),ae=ce&&!i((function(){[].filter.call({length:-1,0:1},(function(t){throw t}))}));Ct({target:"Array",proto:!0,forced:!ce||!ae},{filter:function(t){return ue(this,t,arguments.length>1?arguments[1]:void 0)}});var fe,le=Object.keys||function(t){return gt(t,vt)},se=u?Object.defineProperties:function(t,e){R(t);for(var r,n=le(e),o=n.length,i=0;o>i;)P.f(t,r=n[i++],e[r]);return t},pe=ut("document","documentElement"),de=G("IE_PROTO"),he=function(){},ye=function(t){return"<script>"+t+"</"+"script>"},ge=function(){try{fe=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;ge=fe?function(t){t.write(ye("")),t.close();var e=t.parentWindow.Object;return t=null,e}(fe):((e=S("iframe")).style.display="none",pe.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(ye("document.F=Object")),t.close(),t.F);for(var r=vt.length;r--;)delete ge.prototype[vt[r]];return ge()};X[de]=!0;var ve=Object.create||function(t,e){var r;return null!==t?(he.prototype=R(t),r=new he,he.prototype=null,r[de]=t):r=ge(),void 0===e?r:se(r,e)},be=qt("unscopables"),me=Array.prototype;null==me[be]&&P.f(me,be,{configurable:!0,value:ve(null)});var we,Oe=ie.find,je="find",Se=!0;je in[]&&Array(1).find((function(){Se=!1})),Ct({target:"Array",proto:!0,forced:Se},{find:function(t){return Oe(this,t,arguments.length>1?arguments[1]:void 0)}}),we=je,me[be][we]=!0;var Te=f.f,xe=function(t){return function(e){for(var r,n=g(e),o=le(n),i=o.length,c=0,a=[];i>c;)r=o[c++],u&&!Te.call(n,r)||a.push(t?[r,n[r]]:n[r]);return a}},Ee={entries:xe(!0),values:xe(!1)}.entries;Ct({target:"Object",stat:!0},{entries:function(t){return Ee(t)}});var Re="\t\n\v\f\r                 \u2028\u2029\ufeff",Ae="["+Re+"]",Pe=RegExp("^"+Ae+Ae+"*"),ke=RegExp(Ae+Ae+"*$"),Ce=function(t){return function(e){var r=String(y(e));return 1&t&&(r=r.replace(Pe,"")),2&t&&(r=r.replace(ke,"")),r}},_e={start:Ce(1),end:Ce(2),trim:Ce(3)}.trim,Ie=o.parseInt,Me=/^[+-]?0[Xx]/,Ve=8!==Ie(Re+"08")||22!==Ie(Re+"0x16")?function(t,e){var r=_e(String(t));return Ie(r,e>>>0||(Me.test(r)?16:10))}:Ie;function Fe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function De(t){return(De=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Le(t,e){return(Le=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function qe(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Be(t,e,r){return(Be="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=De(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function He(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t))&&"[object Arguments]"!==Object.prototype.toString.call(t))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(n=(u=c.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}Ct({global:!0,forced:parseInt!=Ve},{parseInt:Ve}),t.akottr.dragtable.prototype._restoreState=function(t){for(var e=0,r=Object.entries(t);e<r.length;e++){var n=He(r[e],2),o=n[0],i=n[1],u=this.originalTable.el.find('th[data-field="'.concat(o,'"]'));this.originalTable.startIndex=u.prevAll().length+1,this.originalTable.endIndex=parseInt(i,10)+1,this._bubbleCols()}};var We=function(){Array.prototype.filter||(Array.prototype.filter=function(t){if(null==this)throw new TypeError;var e=Object(this),r=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var n=[],o=arguments.length>=2?arguments[1]:void 0,i=0;i<r;i++)if(i in e){var u=e[i];t.call(o,u,i,e)&&n.push(u)}return n})};t.extend(t.fn.bootstrapTable.defaults,{reorderableColumns:!1,maxMovingRows:10,onReorderColumn:function(t){return!1},dragaccept:null}),t.extend(t.fn.bootstrapTable.Constructor.EVENTS,{"reorder-column.bs.table":"onReorderColumn"}),t.fn.bootstrapTable.methods.push("orderColumns"),t.BootstrapTable=function(e){function r(){return Fe(this,r),qe(this,De(r).apply(this,arguments))}var n,o,i;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Le(t,e)}(r,e),n=r,(o=[{key:"initHeader",value:function(){for(var t,e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];(t=Be(De(r.prototype),"initHeader",this)).call.apply(t,[this].concat(n)),this.options.reorderableColumns&&this.makeRowsReorderable()}},{key:"_toggleColumn",value:function(){for(var t,e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];(t=Be(De(r.prototype),"_toggleColumn",this)).call.apply(t,[this].concat(n)),this.options.reorderableColumns&&this.makeRowsReorderable()}},{key:"toggleView",value:function(){for(var t,e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];(t=Be(De(r.prototype),"toggleView",this)).call.apply(t,[this].concat(n)),this.options.reorderableColumns&&(this.options.cardView||this.makeRowsReorderable())}},{key:"resetView",value:function(){for(var t,e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];(t=Be(De(r.prototype),"resetView",this)).call.apply(t,[this].concat(n)),this.options.reorderableColumns&&this.makeRowsReorderable()}},{key:"makeRowsReorderable",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{t(this.$el).dragtable("destroy")}catch(t){}t(this.$el).dragtable({maxMovingRows:this.options.maxMovingRows,dragaccept:this.options.dragaccept,clickDelay:200,dragHandle:".th-inner",restoreState:r||this.columnsSortOrder,beforeStop:function(r){var n={};r.el.find("th").each((function(e,r){n[t(r).data("field")]=e})),e.columnsSortOrder=n,e.options.cookie&&e.persistReorderColumnsState(e);var o=[],i=[],u=[],c=[],a=-1,f=[];if(e.$header.find("th:not(.detail)").each((function(e){o.push(t(this).data("field")),i.push(t(this).data("formatter"))})),o.length<e.columns.length){c=e.columns.filter((function(t){return!t.visible}));for(var l=0;l<c.length;l++)o.push(c[l].field),i.push(c[l].formatter)}for(var s=0;s<o.length;s++)-1!==(a=e.fieldsColumnsIndex[o[s]])&&(e.fieldsColumnsIndex[o[s]]=s,e.columns[a].fieldIndex=s,u.push(e.columns[a]));e.columns=u,We(),t.each(e.columns,(function(t,r){var n=!1,o=r.field;e.options.columns[0].filter((function(t){return!(!n&&t.field===o&&(f.push(t),n=!0,1))}))})),e.options.columns[0]=f,e.header.fields=o,e.header.formatters=i,e.initHeader(),e.initToolbar(),e.initSearchText(),e.initBody(),e.resetView(),e.trigger("reorder-column",o)}})}},{key:"orderColumns",value:function(t){this.columnsSortOrder=t,this.makeRowsReorderable()}}])&&Ne(n.prototype,o),i&&Ne(n,i),r}(t.BootstrapTable)}));