UNPKG

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