11 lines
7.2 KiB
JavaScript
11 lines
7.2 KiB
JavaScript
/**
|
|
* bootstrap-table - An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)
|
|
*
|
|
* @version v1.23.1
|
|
* @homepage https://bootstrap-table.com
|
|
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
|
|
* @license MIT
|
|
*/
|
|
|
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.find.js"),require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.object.to-string.js"),require("jquery")):"function"==typeof define&&define.amd?define(["core-js/modules/es.array.concat.js","core-js/modules/es.array.find.js","core-js/modules/es.object.assign.js","core-js/modules/es.object.to-string.js","jquery"],e):e(null,null,null,null,(t="undefined"!=typeof globalThis?globalThis:t||self).jQuery)}(this,(function(t,e,i,r,n){"use strict";function o(t,e,i){return e=a(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,l()?Reflect.construct(e,i||[],a(t).constructor):e.apply(t,i))}function s(t,e,i){return e&&function(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(r){var n=Object.getOwnPropertyDescriptor(r,e);return n.get?n.get.call(arguments.length<3?t:i):n.value}},c.apply(null,arguments)}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!t})()}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function d(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}var h=n.fn.bootstrapTable.utils;Object.assign(n.fn.bootstrapTable.defaults,{stickyHeader:!1,stickyHeaderOffsetY:0,stickyHeaderOffsetLeft:0,stickyHeaderOffsetRight:0}),n.BootstrapTable=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,e,arguments)}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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(e,t),s(e,[{key:"initHeader",value:function(){for(var t,i=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];if((t=c(a(e.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 l=h.getEventName("resize.sticky-header-table",this.$el.attr("id")),f=h.getEventName("scroll.sticky-header-table",this.$el.attr("id"));n(window).off(l).on(l,(function(){return i.renderStickyHeader()})),n(window).off(f).on(f,(function(){return i.renderStickyHeader()})),this.$tableBody.off("scroll").on("scroll",(function(){return i.matchPositionX()}))}}},{key:"onColumnSearch",value:function(t){var i=t.currentTarget,r=t.keyCode;c(a(e.prototype),"onColumnSearch",this).call(this,{currentTarget:i,keyCode:r}),this.options.stickyHeader&&this.renderStickyHeader()}},{key:"resetView",value:function(){for(var t,i=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];(t=c(a(e.prototype),"resetView",this)).call.apply(t,[this].concat(o)),this.options.stickyHeader&&n(".bootstrap-table.fullscreen").off("scroll").on("scroll",(function(){return i.renderStickyHeader()}))}},{key:"getCaret",value:function(){for(var t,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];if((t=c(a(e.prototype),"getCaret",this)).call.apply(t,[this].concat(r)),this.options.stickyHeader&&this.$stickyHeader){var s=this.$stickyHeader.find("th");this.$header.find("th").each((function(t,e){s.eq(t).find(".sortable").attr("class",n(e).find(".sortable").attr("class"))}))}}},{key:"horizontalScroll",value:function(){var t=this;c(a(e.prototype),"horizontalScroll",this).call(this),this.options.stickyHeader&&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(this.$stickyHeader).off("keyup change mouseup").on("keyup change mouse",(function(t){var i=n(t.target),r=i.val(),o=i.parents("th").data("field"),s=e.$header.find('th[data-field="'.concat(o,'"]'));if(i.is("input"))s.find("input").val(r);else if(i.is("select")){var c=s.find("select");c.find("option[selected]").removeAttr("selected"),c.find('option[value="'.concat(r,'"]')).attr("selected",!0)}e.triggerSearch()}));var i=n(window).scrollTop(),r=this.$stickyBegin.offset().top-this.options.stickyHeaderOffsetY,o=this.$stickyEnd.offset().top-this.options.stickyHeaderOffsetY-this.$header.height();if(i>r&&i<=o){this.$stickyHeader.find("tr").each((function(e,i){n(i).find("th").each((function(i,r){n(r).css("min-width",t.$header.find("tr:eq(".concat(e,")")).find("th:eq(".concat(i,")")).css("width"))}))})),this.$stickyContainer.show().addClass("fix-sticky fixed-table-container");var s=this.$tableBody[0].getBoundingClientRect(),c="100%",a=this.options.stickyHeaderOffsetLeft,l=this.options.stickyHeaderOffsetRight;a||(a=s.left),l||(c="".concat(s.width,"px")),this.$el.closest(".bootstrap-table").hasClass("fullscreen")&&(a=0,l=0,c="100%"),this.$stickyContainer.css("top","".concat(this.options.stickyHeaderOffsetY,"px")),this.$stickyContainer.css("left","".concat(a,"px")),this.$stickyContainer.css("right","".concat(l,"px")),this.$stickyContainer.css("width","".concat(c)),this.$stickyTable=n("<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())}}])}(n.BootstrapTable)}));
|