UNPKG

15.8 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.2
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 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},c=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")(),a=function(t){try{return!!t()}catch(t){return!0}},f=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),u={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,l={f:s&&!u.call({1:2},1)?function(t){var e=s(this,t);return!!e&&e.enumerable}:u},d=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},h={}.toString,y=function(t){return h.call(t).slice(8,-1)},p="".split,v=a((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==y(t)?p.call(t,""):Object(t)}:Object,b=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},g=function(t){return v(b(t))},m=function(t){return"object"==typeof t?null!==t:"function"==typeof t},k=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")},w={}.hasOwnProperty,O=function(t,e){return w.call(t,e)},S=c.document,j=m(S)&&m(S.createElement),$=function(t){return j?S.createElement(t):{}},T=!f&&!a((function(){return 7!=Object.defineProperty($("div"),"a",{get:function(){return 7}}).a})),C=Object.getOwnPropertyDescriptor,P={f:f?C:function(t,e){if(t=g(t),e=k(e,!0),T)try{return C(t,e)}catch(t){}if(O(t,e))return d(!l.f.call(t,e),t[e])}},E=function(t){if(!m(t))throw TypeError(String(t)+" is not an object");return t},_=Object.defineProperty,H={f:f?_:function(t,e,n){if(E(t),e=k(e,!0),E(n),T)try{return _(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}},x=f?function(t,e,n){return H.f(t,e,d(1,n))}:function(t,e,n){return t[e]=n,t},A=function(t,e){try{x(c,t,e)}catch(n){c[t]=e}return e},R="__core-js_shared__",B=c[R]||A(R,{}),M=Function.toString;"function"!=typeof B.inspectSource&&(B.inspectSource=function(t){return M.call(t)});var L,I,q,F=B.inspectSource,N=c.WeakMap,z="function"==typeof N&&/native code/.test(F(N)),D=o((function(t){(t.exports=function(t,e){return B[t]||(B[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.8.1",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),X=0,Y=Math.random(),W=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++X+Y).toString(36)},V=D("keys"),G=function(t){return V[t]||(V[t]=W(t))},K={},Q=c.WeakMap;if(z){var J=B.state||(B.state=new Q),U=J.get,Z=J.has,tt=J.set;L=function(t,e){return e.facade=t,tt.call(J,t,e),e},I=function(t){return U.call(J,t)||{}},q=function(t){return Z.call(J,t)}}else{var et=G("state");K[et]=!0,L=function(t,e){return e.facade=t,x(t,et,e),e},I=function(t){return O(t,et)?t[et]:{}},q=function(t){return O(t,et)}}var nt,rt,ot={set:L,get:I,has:q,enforce:function(t){return q(t)?I(t):L(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}}},it=o((function(t){var e=ot.get,n=ot.enforce,r=String(String).split("String");(t.exports=function(t,e,o,i){var a,f=!!i&&!!i.unsafe,u=!!i&&!!i.enumerable,s=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||O(o,"name")||x(o,"name",e),(a=n(o)).source||(a.source=r.join("string"==typeof e?e:""))),t!==c?(f?!s&&t[e]&&(u=!0):delete t[e],u?t[e]=o:x(t,e,o)):u?t[e]=o:A(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||F(this)}))})),ct=c,at=function(t){return"function"==typeof t?t:void 0},ft=function(t,e){return arguments.length<2?at(ct[t])||at(c[t]):ct[t]&&ct[t][e]||c[t]&&c[t][e]},ut=Math.ceil,st=Math.floor,lt=function(t){return isNaN(t=+t)?0:(t>0?st:ut)(t)},dt=Math.min,ht=function(t){return t>0?dt(lt(t),9007199254740991):0},yt=Math.max,pt=Math.min,vt=function(t){return function(e,n,r){var o,i=g(e),c=ht(i.length),a=function(t,e){var n=lt(t);return n<0?yt(n+e,0):pt(n,e)}(r,c);if(t&&n!=n){for(;c>a;)if((o=i[a++])!=o)return!0}else for(;c>a;a++)if((t||a in i)&&i[a]===n)return t||a||0;return!t&&-1}},bt={includes:vt(!0),indexOf:vt(!1)}.indexOf,gt=function(t,e){var n,r=g(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++])&&(~bt(i,n)||i.push(n));return i},mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],kt=mt.concat("length","prototype"),wt={f:Object.getOwnPropertyNames||function(t){return gt(t,kt)}},Ot={f:Object.getOwnPropertySymbols},St=ft("Reflect","ownKeys")||function(t){var e=wt.f(E(t)),n=Ot.f;return n?e.concat(n(t)):e},jt=function(t,e){for(var n=St(e),r=H.f,o=P.f,i=0;i<n.length;i++){var c=n[i];O(t,c)||r(t,c,o(e,c))}},$t=/#|\.prototype\./,Tt=function(t,e){var n=Pt[Ct(t)];return n==_t||n!=Et&&("function"==typeof e?a(e):!!e)},Ct=Tt.normalize=function(t){return String(t).replace($t,".").toLowerCase()},Pt=Tt.data={},Et=Tt.NATIVE="N",_t=Tt.POLYFILL="P",Ht=Tt,xt=P.f,At=function(t,e){var n,r,o,i,a,f=t.target,u=t.global,s=t.stat;if(n=u?c:s?c[f]||A(f,{}):(c[f]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(a=xt(n,r))&&a.value:n[r],!Ht(u?r:f+(s?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;jt(i,o)}(t.sham||o&&o.sham)&&x(i,"sham",!0),it(n,r,i,t)}},Rt=Array.isArray||function(t){return"Array"==y(t)},Bt=function(t){return Object(b(t))},Mt=function(t,e,n){var r=k(e);r in t?H.f(t,r,d(0,n)):t[r]=n},Lt=!!Object.getOwnPropertySymbols&&!a((function(){return!String(Symbol())})),It=Lt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,qt=D("wks"),Ft=c.Symbol,Nt=It?Ft:Ft&&Ft.withoutSetter||W,zt=function(t){return O(qt,t)||(Lt&&O(Ft,t)?qt[t]=Ft[t]:qt[t]=Nt("Symbol."+t)),qt[t]},Dt=zt("species"),Xt=function(t,e){var n;return Rt(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Rt(n.prototype)?m(n)&&null===(n=n[Dt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},Yt=ft("navigator","userAgent")||"",Wt=c.process,Vt=Wt&&Wt.versions,Gt=Vt&&Vt.v8;Gt?rt=(nt=Gt.split("."))[0]+nt[1]:Yt&&(!(nt=Yt.match(/Edge\/(\d+)/))||nt[1]>=74)&&(nt=Yt.match(/Chrome\/(\d+)/))&&(rt=nt[1]);var Kt,Qt=rt&&+rt,Jt=zt("species"),Ut=zt("isConcatSpreadable"),Zt=9007199254740991,te="Maximum allowed index exceeded",ee=Qt>=51||!a((function(){var t=[];return t[Ut]=!1,t.concat()[0]!==t})),ne=(Kt="concat",Qt>=51||!a((function(){var t=[];return(t.constructor={})[Jt]=function(){return{foo:1}},1!==t[Kt](Boolean).foo}))),re=function(t){if(!m(t))return!1;var e=t[Ut];return void 0!==e?!!e:Rt(t)};At({target:"Array",proto:!0,forced:!ee||!ne},{concat:function(t){var e,n,r,o,i,c=Bt(this),a=Xt(c,0),f=0;for(e=-1,r=arguments.length;e<r;e++)if(re(i=-1===e?c:arguments[e])){if(f+(o=ht(i.length))>Zt)throw TypeError(te);for(n=0;n<o;n++,f++)n in i&&Mt(a,f,i[n])}else{if(f>=Zt)throw TypeError(te);Mt(a,f++,i)}return a.length=f,a}});var oe,ie=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)}},ce=[].push,ae=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,c=7==t,a=5==t||i;return function(f,u,s,l){for(var d,h,y=Bt(f),p=v(y),b=ie(u,s,3),g=ht(p.length),m=0,k=l||Xt,w=e?k(f,g):n||c?k(f,0):void 0;g>m;m++)if((a||m in p)&&(h=b(d=p[m],m,y),t))if(e)w[m]=h;else if(h)switch(t){case 3:return!0;case 5:return d;case 6:return m;case 2:ce.call(w,d)}else switch(t){case 4:return!1;case 7:ce.call(w,d)}return i?-1:r||o?o:w}},fe={forEach:ae(0),map:ae(1),filter:ae(2),some:ae(3),every:ae(4),find:ae(5),findIndex:ae(6),filterOut:ae(7)},ue=Object.keys||function(t){return gt(t,mt)},se=f?Object.defineProperties:function(t,e){E(t);for(var n,r=ue(e),o=r.length,i=0;o>i;)H.f(t,n=r[i++],e[n]);return t},le=ft("document","documentElement"),de=G("IE_PROTO"),he=function(){},ye=function(t){return"<script>"+t+"</"+"script>"},pe=function(){try{oe=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;pe=oe?function(t){t.write(ye("")),t.close();var e=t.parentWindow.Object;return t=null,e}(oe):((e=$("iframe")).style.display="none",le.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(ye("document.F=Object")),t.close(),t.F);for(var n=mt.length;n--;)delete pe.prototype[mt[n]];return pe()};K[de]=!0;var ve=Object.create||function(t,e){var n;return null!==t?(he.prototype=E(t),n=new he,he.prototype=null,n[de]=t):n=pe(),void 0===e?n:se(n,e)},be=zt("unscopables"),ge=Array.prototype;null==ge[be]&&H.f(ge,be,{configurable:!0,value:ve(null)});var me,ke=Object.defineProperty,we={},Oe=function(t){throw t},Se=fe.find,je="find",$e=!0,Te=function(t,e){if(O(we,t))return we[t];e||(e={});var n=[][t],r=!!O(e,"ACCESSORS")&&e.ACCESSORS,o=O(e,0)?e[0]:Oe,i=O(e,1)?e[1]:void 0;return we[t]=!!n&&!a((function(){if(r&&!f)return!0;var t={length:-1};r?ke(t,1,{enumerable:!0,get:Oe}):t[1]=1,n.call(t,o,i)}))}(je);function Ce(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ee(t){return(Ee=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _e(t,e){return(_e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function He(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 xe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Ee(t);if(e){var o=Ee(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return He(this,n)}}function Ae(t,e,n){return(Ae="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ee(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}je in[]&&Array(1).find((function(){$e=!1})),At({target:"Array",proto:!0,forced:$e||!Te},{find:function(t){return Se(this,t,arguments.length>1?arguments[1]:void 0)}}),me=je,ge[be][me]=!0;var Re=n.default.fn.bootstrapTable.utils;n.default.extend(n.default.fn.bootstrapTable.defaults,{stickyHeader:!1,stickyHeaderOffsetY:0,stickyHeaderOffsetLeft:0,stickyHeaderOffsetRight:0}),n.default.BootstrapTable=function(t){!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&&_e(t,e)}(c,t);var e,r,o,i=xe(c);function c(){return Ce(this,c),i.apply(this,arguments)}return e=c,(r=[{key:"initHeader",value:function(){for(var t,e=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];if((t=Ae(Ee(c.prototype),"initHeader",this)).call.apply(t,[this].concat(o)),this.options.stickyHeader){this.$tableBody.find(".sticky-header-container,.sticky_anchor_begin,.sticky_anchor_end").remove(),this.$el.before('<div class="sticky-header-container"></div>'),this.$el.before('<div class="sticky_anchor_begin"></div>'),this.$el.after('<div class="sticky_anchor_end"></div>'),this.$header.addClass("sticky-header"),this.$stickyContainer=this.$tableBody.find(".sticky-header-container"),this.$stickyBegin=this.$tableBody.find(".sticky_anchor_begin"),this.$stickyEnd=this.$tableBody.find(".sticky_anchor_end"),this.$stickyHeader=this.$header.clone(!0,!0);var a=Re.getEventName("resize.sticky-header-table",this.$el.attr("id")),f=Re.getEventName("scroll.sticky-header-table",this.$el.attr("id"));n.default(window).off(a).on(a,(function(){return e.renderStickyHeader()})),n.default(window).off(f).on(f,(function(){return e.renderStickyHeader()})),this.$tableBody.off("scroll").on("scroll",(function(){return e.matchPositionX()}))}}},{key:"onColumnSearch",value:function(t){var e=t.currentTarget,n=t.keyCode;Ae(Ee(c.prototype),"onColumnSearch",this).call(this,{currentTarget:e,keyCode:n}),this.renderStickyHeader()}},{key:"resetView",value:function(){for(var t,e=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];(t=Ae(Ee(c.prototype),"resetView",this)).call.apply(t,[this].concat(o)),n.default(".bootstrap-table.fullscreen").off("scroll").on("scroll",(function(){return e.renderStickyHeader()}))}},{key:"horizontalScroll",value:function(){var t=this;Ae(Ee(c.prototype),"horizontalScroll",this).call(this),this.$tableBody.on("scroll",(function(){return t.matchPositionX()}))}},{key:"renderStickyHeader",value:function(){var t=this,e=this;this.$stickyHeader=this.$header.clone(!0,!0),this.options.filterControl&&n.default(this.$stickyHeader).off("keyup change mouseup").on("keyup change mouse",(function(t){var r=n.default(t.target),o=r.val(),i=r.parents("th").data("field"),c=e.$header.find('th[data-field="'.concat(i,'"]'));if(r.is("input"))c.find("input").val(o);else if(r.is("select")){var a=c.find("select");a.find("option[selected]").removeAttr("selected"),a.find('option[value="'.concat(o,'"]')).attr("selected",!0)}e.triggerSearch()}));var r=n.default(window).scrollTop(),o=this.$stickyBegin.offset().top-this.options.stickyHeaderOffsetY,i=this.$stickyEnd.offset().top-this.options.stickyHeaderOffsetY-this.$header.height();if(r>o&&r<=i){this.$stickyHeader.find("tr:eq(0)").find("th").each((function(e,r){n.default(r).css("min-width",t.$header.find("tr:eq(0)").find("th").eq(e).css("width"))})),this.$stickyContainer.show().addClass("fix-sticky fixed-table-container");var c=this.options.stickyHeaderOffsetLeft,a=this.options.stickyHeaderOffsetRight;this.$el.closest(".bootstrap-table").hasClass("fullscreen")&&(c=0,a=0),this.$stickyContainer.css("top","".concat(this.options.stickyHeaderOffsetY)),this.$stickyContainer.css("left","".concat(c)),this.$stickyContainer.css("right","".concat(a)),this.$stickyTable=n.default("<table/>"),this.$stickyTable.addClass(this.options.classes),this.$stickyContainer.html(this.$stickyTable.append(this.$stickyHeader)),this.matchPositionX()}else this.$stickyContainer.removeClass("fix-sticky").hide()}},{key:"matchPositionX",value:function(){this.$stickyContainer.scrollLeft(this.$tableBody.scrollLeft())}}])&&Pe(e.prototype,r),o&&Pe(e,o),c}(n.default.BootstrapTable)}));