mivita/resources/assets/vendor/libs/bootstrap-table/extensions/sticky-header/sticky-header.js
2018-10-29 09:39:31 +01:00

1 line
No EOL
3 KiB
JavaScript
Executable file

!function(e,t){var o=function(e){var t={};function o(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=313)}({312:function(e,t){!function(e){"use strict";var t=e.fn.bootstrapTable.utils.sprintf;e.extend(e.fn.bootstrapTable.defaults,{stickyHeader:!1});var o=3;try{o=parseInt(e.fn.dropdown.Constructor.VERSION,10)}catch(e){}var i=o>3?"d-none":"hidden",r=e.fn.bootstrapTable.Constructor,n=r.prototype.initHeader;r.prototype.initHeader=function(){var o=this;if(n.apply(this,Array.prototype.slice.apply(arguments)),this.options.stickyHeader){var r=this.$tableBody.find("table"),s=r.attr("id"),d=r.attr("id")+"-sticky-header",a=d+"-sticky-header-container",c=d+"_sticky_anchor_begin",f=d+"_sticky_anchor_end";r.before(t('<div id="%s" class="%s"></div>',a,i)),r.before(t('<div id="%s"></div>',c)),r.after(t('<div id="%s"></div>',f)),r.find("thead").attr("id",d),this.$stickyHeader=e(e("#"+d).clone(!0,!0)),this.$stickyHeader.removeAttr("id"),e(window).on("resize."+s,r,l),e(window).on("scroll."+s,r,l),r.closest(".fixed-table-container").find(".fixed-table-body").on("scroll."+s,r,p),this.$el.on("all.bs.table",function(t){o.$stickyHeader=e(e("#"+d).clone(!0,!0)),o.$stickyHeader.removeAttr("id")})}function l(t){var r=t.data,n=r.find("thead").attr("id");if(r.length<1||e("#"+s).length<1)return e(window).off("resize."+s),e(window).off("scroll."+s),void r.closest(".fixed-table-container").find(".fixed-table-body").off("scroll."+s);var d="0";o.options.stickyHeaderOffsetY&&(d=o.options.stickyHeaderOffsetY.replace("px",""));var l=e(window).scrollTop(),u=e("#"+c).offset().top-d,y=e("#"+f).offset().top-d-e("#"+n).css("height").replace("px","");if(l>u&&l<=y){e.each(o.$stickyHeader.find("tr").eq(0).find("th"),function(t,o){e(o).css("min-width",e("#"+n+" tr").eq(0).find("th").eq(t).css("width"))}),e("#"+a).removeClass(i).addClass("fix-sticky fixed-table-container"),e("#"+a).css("top",d+"px");var h=e('<div style="position:absolute;width:100%;overflow-x:hidden;" />');e("#"+a).html(h.append(o.$stickyHeader)),p(t)}else e("#"+a).removeClass("fix-sticky").addClass(i)}function p(t){var o=t.data,i=o.find("thead").attr("id");e("#"+a).css("width",+o.closest(".fixed-table-body").css("width").replace("px","")+1),e("#"+a+" thead").parent().scrollLeft(Math.abs(e("#"+i).position().left))}}}(jQuery)},313:function(e,t,o){o(312)}});if("object"==typeof o){var i=["object"==typeof module&&"object"==typeof module.exports?module.exports:null,"undefined"!=typeof window?window:null,e&&e!==window?e:null];for(var r in o)i[0]&&(i[0][r]=o[r]),i[1]&&"__esModule"!==r&&(i[1][r]=o[r]),i[2]&&(i[2][r]=o[r])}}(this);