bootstrap-table-fixed-columns.min.js 16 KB

12345678910
  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.15.0
  5. * @homepage https://bootstrap-table.com
  6. * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
  7. * @license MIT
  8. */
  9. (function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],b):(a=a||self,b(a.jQuery))})(this,function(a){'use strict';var n=Math.max,o=Math.min,p=Math.floor;function b(a,b){return b={exports:{}},a(b,b.exports),b.exports}function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function e(a,b,c){return b&&d(a.prototype,b),c&&d(a,c),a}function g(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&i(a,b)}function h(a){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},h(a)}function i(a,b){return i=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},i(a,b)}function j(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function k(a,b){return b&&("object"==typeof b||"function"==typeof b)?b:j(a)}function l(a,b){for(;!Object.prototype.hasOwnProperty.call(a,b)&&(a=h(a),null!==a););return a}function m(a,b,c){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(a,b,c){var d=l(a,b);if(d){var e=Object.getOwnPropertyDescriptor(d,b);return e.get?e.get.call(c):e.value}},m(a,b,c||a)}a=a&&a.hasOwnProperty("default")?a["default"]:a;var q,r,s,t={}.toString,u=function(a){return t.call(a).slice(8,-1)},v=Array.isArray||function(a){return"Array"==u(a)},w=function(a){return"object"==typeof a?null!==a:"function"==typeof a},x=function(a){if(a==null)throw TypeError("Can't call method on "+a);return a},y=function(a){return Object(x(a))},z=Math.ceil,A=function(a){return isNaN(a=+a)?0:(0<a?p:z)(a)},B=function(a){return 0<a?o(A(a),9007199254740991):0},C=function(a,b){if(!w(a))return a;var c,d;if(b&&"function"==typeof(c=a.toString)&&!w(d=c.call(a)))return d;if("function"==typeof(c=a.valueOf)&&!w(d=c.call(a)))return d;if(!b&&"function"==typeof(c=a.toString)&&!w(d=c.call(a)))return d;throw TypeError("Can't convert object to primitive value")},D=function(a){try{return!!a()}catch(a){return!0}},E=!D(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),F="object"==typeof window&&window&&window.Math==Math?window:"object"==typeof self&&self&&self.Math==Math?self:Function("return this")(),G=F.document,H=w(G)&&w(G.createElement),I=function(a){return H?G.createElement(a):{}},J=!E&&!D(function(){return 7!=Object.defineProperty(I("div"),"a",{get:function(){return 7}}).a}),K=function(a){if(!w(a))throw TypeError(a+" is not an object");return a},L=Object.defineProperty,M=E?L:function(a,b,c){if(K(a),b=C(b,!0),K(c),J)try{return L(a,b,c)}catch(a){}if("get"in c||"set"in c)throw TypeError("Accessors not supported");return"value"in c&&(a[b]=c.value),a},f={f:M},N=function(a,b){return{enumerable:!(1&a),configurable:!(2&a),writable:!(4&a),value:b}},O=function(a,b,c){var d=C(b);d in a?f.f(a,d,N(0,c)):a[d]=c},P=E?function(a,b,c){return f.f(a,b,N(1,c))}:function(a,b,c){return a[b]=c,a},Q=function(a,b){try{P(F,a,b)}catch(c){F[a]=b}return b},R=b(function(a){var b=F["__core-js_shared__"]||Q("__core-js_shared__",{});(a.exports=function(a,c){return b[a]||(b[a]=c===void 0?{}:c)})("versions",[]).push({version:"3.0.0",mode:"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),S=0,T=Math.random(),U=function(a){return"Symbol(".concat(a===void 0?"":a,")_",(++S+T).toString(36))},V=!D(function(){}),W=R("wks"),X=F.Symbol,Y=function(a){return W[a]||(W[a]=V&&X[a]||(V?X:U)("Symbol."+a))},Z=Y("species"),_=function(a,b){var c;return v(a)&&(c=a.constructor,"function"==typeof c&&(c===Array||v(c.prototype))?c=void 0:w(c)&&(c=c[Z],null===c&&(c=void 0))),new(void 0===c?Array:c)(0===b?0:b)},aa=Y("species"),ba={}.propertyIsEnumerable,ca=Object.getOwnPropertyDescriptor,da=ca&&!ba.call({1:2},1),ea=da?function(a){var b=ca(this,a);return!!b&&b.enumerable}:ba,fa={f:ea},ga="".split,ha=D(function(){return!Object("z").propertyIsEnumerable(0)})?function(a){return"String"==u(a)?ga.call(a,""):Object(a)}:Object,ia=function(a){return ha(x(a))},ja={}.hasOwnProperty,ka=function(a,b){return ja.call(a,b)},la=Object.getOwnPropertyDescriptor,ma=E?la:function(a,b){if(a=ia(a),b=C(b,!0),J)try{return la(a,b)}catch(a){}return ka(a,b)?N(!fa.f.call(a,b),a[b]):void 0},na={f:ma},oa=R("native-function-to-string",Function.toString),pa=F.WeakMap,qa="function"==typeof pa&&/native code/.test(oa.call(pa)),ra=R("keys"),sa=function(a){return ra[a]||(ra[a]=U(a))},ta={},ua=F.WeakMap,va=function(a){return s(a)?r(a):q(a,{})};if(qa){var wa=new ua,xa=wa.get,ya=wa.has,za=wa.set;q=function(a,b){return za.call(wa,a,b),b},r=function(a){return xa.call(wa,a)||{}},s=function(a){return ya.call(wa,a)}}else{var Aa=sa("state");ta[Aa]=!0,q=function(a,b){return P(a,Aa,b),b},r=function(a){return ka(a,Aa)?a[Aa]:{}},s=function(a){return ka(a,Aa)}}var Ba={set:q,get:r,has:s,enforce:va,getterFor:function(a){return function(b){var c;if(!w(b)||(c=r(b)).type!==a)throw TypeError("Incompatible receiver, "+a+" required");return c}}},Ca=b(function(a){var b=Ba.get,c=Ba.enforce,d=(oa+"").split("toString");R("inspectSource",function(a){return oa.call(a)}),(a.exports=function(a,b,e,f){var g=!!f&&!!f.unsafe,h=!!f&&!!f.enumerable,i=!!f&&!!f.noTargetGet;return("function"==typeof e&&("string"==typeof b&&!ka(e,"name")&&P(e,"name",b),c(e).source=d.join("string"==typeof b?b:"")),a===F)?void(h?a[b]=e:Q(b,e)):void(g?!i&&a[b]&&(h=!0):delete a[b],h?a[b]=e:P(a,b,e))})(Function.prototype,"toString",function(){return"function"==typeof this&&b(this).source||oa.call(this)})}),Da=function(a,b){var c=A(a);return 0>c?n(c+b,0):o(c,b)},Ea=function(a){return function(b,c,d){var e,f=ia(b),g=B(f.length),h=Da(d,g);if(a&&c!=c){for(;g>h;)if(e=f[h++],e!=e)return!0;}else for(;g>h;h++)if((a||h in f)&&f[h]===c)return a||h||0;return!a&&-1}}(!1),Fa=function(a,b){var c,d=ia(a),e=0,f=[];for(c in d)!ka(ta,c)&&ka(d,c)&&f.push(c);for(;b.length>e;)ka(d,c=b[e++])&&(~Ea(f,c)||f.push(c));return f},Ga=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ha=Ga.concat("length","prototype"),Ia=Object.getOwnPropertyNames||function(a){return Fa(a,Ha)},Ja={f:Ia},Ka=Object.getOwnPropertySymbols,La={f:Ka},Ma=F.Reflect,Na=Ma&&Ma.ownKeys||function(a){var b=Ja.f(K(a)),c=La.f;return c?b.concat(c(a)):b},Oa=function(a,b){for(var c,d=Na(b),e=f.f,g=na.f,h=0;h<d.length;h++)c=d[h],ka(a,c)||e(a,c,g(b,c))},Pa=/#|\.prototype\./,Qa=function(a,b){var c=Sa[Ra(a)];return!(c!=Ua)||c!=Ta&&("function"==typeof b?D(b):!!b)},Ra=Qa.normalize=function(a){return(a+"").replace(Pa,".").toLowerCase()},Sa=Qa.data={},Ta=Qa.NATIVE="N",Ua=Qa.POLYFILL="P",Va=na.f,Wa=function(a,b){var c,d,e,f,g,h,i=a.target,j=a.global,k=a.stat;if(d=j?F:k?F[i]||Q(i,{}):(F[i]||{}).prototype,d)for(e in b){if(g=b[e],a.noTargetGet?(h=Va(d,e),f=h&&h.value):f=d[e],c=Qa(j?e:i+(k?".":"#")+e,a.forced),!c&&void 0!==f){if(typeof g==typeof f)continue;Oa(g,f)}(a.sham||f&&f.sham)&&P(g,"sham",!0),Ca(d,e,g,a)}},Xa=Y("isConcatSpreadable"),Ya=9007199254740991,Za="Maximum allowed index exceeded",$a=!D(function(){var a=[];return a[Xa]=!1,a.concat()[0]!==a}),_a=function(a){return!D(function(){var b=[],c=b.constructor={};return c[aa]=function(){return{foo:1}},1!==b[a](Boolean).foo})}("concat"),ab=function(a){if(!w(a))return!1;var b=a[Xa];return b===void 0?v(a):!!b};Wa({target:"Array",proto:!0,forced:!$a||!_a},{concat:function(){var a,b,c,d,e,f=y(this),g=_(f,0),h=0;for(a=-1,c=arguments.length;a<c;a++)if(e=-1===a?f:arguments[a],ab(e)){if(d=B(e.length),h+d>Ya)throw TypeError(Za);for(b=0;b<d;b++,h++)b in e&&O(g,h,e[b])}else{if(h>=Ya)throw TypeError(Za);O(g,h++,e)}return g.length=h,g}});var bb=function(a){if("function"!=typeof a)throw TypeError(a+" is not a function");return a},cb=function(d,e,f){return(bb(d),void 0===e)?d:0===f?function(){return d.call(e)}:1===f?function(b){return d.call(e,b)}:2===f?function(c,a){return d.call(e,c,a)}:3===f?function(f,a,b){return d.call(e,f,a,b)}:function(){return d.apply(e,arguments)}},db=Object.keys||function(a){return Fa(a,Ga)},eb=E?Object.defineProperties:function(a,b){K(a);for(var c,d=db(b),e=d.length,g=0;e>g;)f.f(a,c=d[g++],b[c]);return a},fb=F.document,gb=fb&&fb.documentElement,hb=sa("IE_PROTO"),ib="prototype",jb=function(){},kb=function(){var a,b=I("iframe"),c=Ga.length,d="<",e="script",f=">";for(b.style.display="none",gb.appendChild(b),b.src="java"+e+":"+"",a=b.contentWindow.document,a.open(),a.write(d+e+f+"document.F=Object"+d+"/"+e+f),a.close(),kb=a.F;c--;)delete kb[ib][Ga[c]];return kb()},lb=Object.create||function(a,b){var c;return null===a?c=kb():(jb[ib]=K(a),c=new jb,jb[ib]=null,c[hb]=a),void 0===b?c:eb(c,b)};ta[hb]=!0;var mb=Y("unscopables"),nb=Array.prototype;nb[mb]==null&&P(nb,mb,lb(null));var ob=function(a,b){var c=1==a,d=4==a,e=6==a,f=b||_;return function(b,g,h){for(var i,j,k=y(b),l=ha(k),m=cb(g,h,3),n=B(l.length),o=0,p=c?f(b,n):2==a?f(b,0):void 0;n>o;o++)if((5==a||e||o in l)&&(i=l[o],j=m(i,o,k),a))if(c)p[o]=j;else if(j)switch(a){case 3:return!0;case 5:return i;case 6:return o;case 2:p.push(i);}else if(d)return!1;return e?-1:3==a||d?d:p}}(5),pb="find",qb=!0;pb in[]&&[,][pb](function(){qb=!1}),Wa({target:"Array",proto:!0,forced:qb},{find:function(a){return ob(this,a,1<arguments.length?arguments[1]:void 0)}}),function(a){nb[mb][a]=!0}(pb);var rb=function(a,b,c){var d,e,f=x(a)+"",g=A(b),h=f.length;return 0>g||g>=h?c?"":void 0:(d=f.charCodeAt(g),55296>d||56319<d||g+1===h||56320>(e=f.charCodeAt(g+1))||57343<e?c?f.charAt(g):d:c?f.slice(g,g+2):(d-55296<<10)+(e-56320)+65536)},sb=function(a,b,c){return b+(c?rb(a,b,!0).length:1)},tb=function(){var a=K(this),b="";return a.global&&(b+="g"),a.ignoreCase&&(b+="i"),a.multiline&&(b+="m"),a.unicode&&(b+="u"),a.sticky&&(b+="y"),b},ub=RegExp.prototype.exec,vb=String.prototype.replace,wb=ub,xb=function(){var a=/a/,b=/b*/g;return ub.call(a,"a"),ub.call(b,"a"),0!==a.lastIndex||0!==b.lastIndex}(),yb=/()??/.exec("")[1]!==void 0;(xb||yb)&&(wb=function(a){var b,c,d,e,f=this;return yb&&(c=new RegExp("^"+f.source+"$(?!\\s)",tb.call(f))),xb&&(b=f.lastIndex),d=ub.call(f,a),xb&&d&&(f.lastIndex=f.global?d.index+d[0].length:b),yb&&d&&1<d.length&&vb.call(d[0],c,function(){for(e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(d[e]=void 0)}),d});var zb=wb,Ab=function(a,b){var c=a.exec;if("function"==typeof c){var d=c.call(a,b);if("object"!=typeof d)throw TypeError("RegExp exec method returned something other than an Object or null");return d}if("RegExp"!==u(a))throw TypeError("RegExp#exec called on incompatible receiver");return zb.call(a,b)},Bb=Y("species"),Cb=!D(function(){var a=/./;return a.exec=function(){var a=[];return a.groups={a:"7"},a},"7"!=="".replace(a,"$<a>")}),Db=!D(function(){var a=/(?:)/,b=a.exec;a.exec=function(){return b.apply(this,arguments)};var c="ab".split(a);return 2!==c.length||"a"!==c[0]||"b"!==c[1]}),Eb=/\$([$&`']|\d\d?|<[^>]*>)/g,Fb=/\$([$&`']|\d\d?)/g,Gb=function(a){return a===void 0?a:a+""};(function(a,b,c,d){var e=Y(a),f=!D(function(){var b={};return b[e]=function(){return 7},7!=""[a](b)}),g=f&&!D(function(){var b=!1,c=/a/;return c.exec=function(){return b=!0,null},"split"===a&&(c.constructor={},c.constructor[Bb]=function(){return c}),c[e](""),!b});if(!f||!g||"replace"===a&&!Cb||"split"===a&&!Db){var h=/./[e],i=c(e,""[a],function(a,b,c,d,e){return b.exec===zb?f&&!e?{done:!0,value:h.call(b,c,d)}:{done:!0,value:a.call(c,b,d)}:{done:!1}}),j=i[0],k=i[1];Ca(String.prototype,a,j),Ca(RegExp.prototype,e,2==b?function(a,b){return k.call(a,this,b)}:function(a){return k.call(a,this)}),d&&P(RegExp.prototype[e],"sham",!0)}})("replace",2,function(a,b,c){function d(a,c,d,e,g,h){var i=d+a.length,j=e.length,f=Fb;return void 0!==g&&(g=y(g),f=Eb),b.call(h,f,function(b,h){var k;switch(h.charAt(0)){case"$":return"$";case"&":return a;case"`":return c.slice(0,d);case"'":return c.slice(i);case"<":k=g[h.slice(1,-1)];break;default:var l=+h;if(0==l)return b;if(l>j){var m=p(l/10);return 0===m?b:m<=j?void 0===e[m-1]?h.charAt(1):e[m-1]+h.charAt(1):b}k=e[l-1];}return void 0===k?"":k})}return[function(c,d){var e=x(this),f=c==null?void 0:c[a];return f===void 0?b.call(e+"",c,d):f.call(c,e,d)},function(a,e){var f=c(b,a,this,e);if(f.done)return f.value;var g=K(a),h=this+"",k="function"==typeof e;k||(e=e+"");var l=g.global;if(l){var m=g.unicode;g.lastIndex=0}for(var p,q=[];(p=Ab(g,h),null!==p)&&!(q.push(p),!l);){var r=p[0]+"";""==r&&(g.lastIndex=sb(h,B(g.lastIndex),m))}for(var s="",t=0,u=0;u<q.length;u++){p=q[u];for(var v=p[0]+"",w=n(o(A(p.index),h.length),0),x=[],y=1;y<p.length;y++)x.push(Gb(p[y]));var z=p.groups;if(k){var C=[v].concat(x,w,h);z!==void 0&&C.push(z);var D=e.apply(void 0,C)+""}else D=d(v,h,w,x,z,e);w>=t&&(s+=h.slice(t,w)+D,t=w+v.length)}return s+h.slice(t)}]}),a.extend(a.fn.bootstrapTable.defaults,{fixedColumns:!1,fixedNumber:1}),a.BootstrapTable=function(b){function d(){return c(this,d),k(this,h(d).apply(this,arguments))}return g(d,b),e(d,[{key:"fitHeader",value:function(){for(var b,c=arguments.length,e=Array(c),f=0;f<c;f++)e[f]=arguments[f];if(((b=m(h(d.prototype),"fitHeader",this)).call.apply(b,[this].concat(e)),!!this.options.fixedColumns)&&!this.$el.is(":hidden")){this.$container.find(".fixed-table-header-columns").remove(),this.$fixedHeader=a("<div class=\"fixed-table-header-columns\"></div>"),this.$fixedHeader.append(this.$tableHeader.find(">table").clone(!0)),this.$tableHeader.after(this.$fixedHeader);var g=this.getFixedColumnsWidth();this.$fixedHeader.css({top:0,width:g,height:this.$tableHeader.outerHeight(!0)}),this.initFixedColumnsBody(),this.$fixedBody.css({top:this.$tableHeader.outerHeight(!0),width:g,height:this.$tableBody.outerHeight(!0)-1}),this.initFixedColumnsEvents()}}},{key:"initBody",value:function(){for(var a,b=arguments.length,c=Array(b),e=0;e<b;e++)c[e]=arguments[e];(a=m(h(d.prototype),"initBody",this)).call.apply(a,[this].concat(c)),!this.options.fixedColumns||this.options.showHeader&&this.options.height||(this.initFixedColumnsBody(),this.$fixedBody.css({top:0,width:this.getFixedColumnsWidth(),height:this.$tableHeader.outerHeight(!0)+this.$tableBody.outerHeight(!0)}),this.initFixedColumnsEvents())}},{key:"initFixedColumnsBody",value:function(){this.$container.find(".fixed-table-body-columns").remove(),this.$fixedBody=a("<div class=\"fixed-table-body-columns\"></div>"),this.$fixedBody.append(this.$tableBody.find(">table").clone(!0)),this.$tableBody.after(this.$fixedBody)}},{key:"getFixedColumnsWidth",value:function(){for(var a=this.getVisibleFields(),b=0,c=0;c<this.options.fixedNumber;c++)b+=this.$header.find("th[data-field=\"".concat(a[c],"\"]")).outerWidth(!0);return b+1}},{key:"initFixedColumnsEvents",value:function(){var b=this;this.$tableBody.off("scroll.fixed-columns").on("scroll.fixed-columns",function(c){b.$fixedBody.find("table").css("top",-a(c.currentTarget).scrollTop())}),this.$body.find("> tr[data-index]").off("hover").hover(function(c){var d=a(c.currentTarget).data("index");b.$fixedBody.find("tr[data-index=\"".concat(d,"\"]")).css("background-color",a(c.currentTarget).css("background-color"))},function(c){var d=a(c.currentTarget).data("index"),e=b.$fixedBody.find("tr[data-index=\"".concat(d,"\"]"));e.attr("style",e.attr("style").replace(/background-color:.*;/,""))}),this.$fixedBody.find("tr[data-index]").off("hover").hover(function(c){var d=a(c.currentTarget).data("index");b.$body.find("tr[data-index=\"".concat(d,"\"]")).css("background-color",a(c.currentTarget).css("background-color"))},function(c){var d=a(c.currentTarget).data("index"),e=b.$body.find("> tr[data-index=\"".concat(d,"\"]"));e.attr("style",e.attr("style").replace(/background-color:.*;/,""))})}}]),d}(a.BootstrapTable)});