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