11 lines
11 KiB
JavaScript
11 lines
11 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(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.find.js"),require("core-js/modules/es.array.index-of.js"),require("core-js/modules/es.array.reverse.js"),require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.parse-int.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.array.index-of.js","core-js/modules/es.array.reverse.js","core-js/modules/es.object.assign.js","core-js/modules/es.object.to-string.js","core-js/modules/es.parse-int.js","jquery"],t):t(null,null,null,null,null,null,null,(e="undefined"!=typeof globalThis?globalThis:e||self).jQuery)}(this,(function(e,t,i,o,n,s,r,d){"use strict";function l(e,t,i){return t=h(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,i||[],h(e).constructor):t.apply(e,i))}function a(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,p(o.key),o)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var o=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=h(e)););return e}(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(arguments.length<3?e:i):n.value}},f.apply(null,arguments)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(u=function(){return!!e})()}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function p(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var o=i.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}var x=d.fn.bootstrapTable.utils;Object.assign(d.fn.bootstrapTable.defaults,{fixedColumns:!1,fixedNumber:0,fixedRightNumber:0}),d.BootstrapTable=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),l(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),a(t,[{key:"fixedColumnsSupported",value:function(){return this.options.fixedColumns&&!this.options.detailView&&!this.options.cardView}},{key:"initContainer",value:function(){f(h(t.prototype),"initContainer",this).call(this),this.fixedColumnsSupported()&&(this.options.fixedNumber&&(this.$tableContainer.append('<div class="fixed-columns"></div>'),this.$fixedColumns=this.$tableContainer.find(".fixed-columns")),this.options.fixedRightNumber&&(this.$tableContainer.append('<div class="fixed-columns-right"></div>'),this.$fixedColumnsRight=this.$tableContainer.find(".fixed-columns-right")))}},{key:"initBody",value:function(){for(var e,i=arguments.length,o=new Array(i),n=0;n<i;n++)o[n]=arguments[n];(e=f(h(t.prototype),"initBody",this)).call.apply(e,[this].concat(o)),this.$fixedColumns&&this.$fixedColumns.length&&this.$fixedColumns.toggle(this.fixedColumnsSupported()),this.$fixedColumnsRight&&this.$fixedColumnsRight.length&&this.$fixedColumnsRight.toggle(this.fixedColumnsSupported()),this.fixedColumnsSupported()&&(this.options.showHeader&&this.options.height||(this.initFixedColumnsBody(),this.initFixedColumnsEvents()))}},{key:"trigger",value:function(){for(var e,i=arguments.length,o=new Array(i),n=0;n<i;n++)o[n]=arguments[n];(e=f(h(t.prototype),"trigger",this)).call.apply(e,[this].concat(o)),this.fixedColumnsSupported()&&("post-header"===o[0]?this.initFixedColumnsHeader():"scroll-body"===o[0]&&(this.needFixedColumns&&this.options.fixedNumber&&this.$fixedBody.scrollTop(this.$tableBody.scrollTop()),this.needFixedColumns&&this.options.fixedRightNumber&&this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop())))}},{key:"updateSelected",value:function(){var e=this;f(h(t.prototype),"updateSelected",this).call(this),this.fixedColumnsSupported()&&this.$tableBody.find("tr").each((function(t,i){var o=d(i),n=o.data("index"),s=o.attr("class"),r='[name="'.concat(e.options.selectItemName,'"]'),l=o.find(r);if(void 0!==n){var a=function(t,i){var o=i.find('tr[data-index="'.concat(n,'"]'));o.attr("class",s),l.length&&o.find(r).prop("checked",l.prop("checked")),e.$selectAll.length&&t.add(i).find('[name="btSelectAll"]').prop("checked",e.$selectAll.prop("checked"))};e.$fixedBody&&e.options.fixedNumber&&a(e.$fixedHeader,e.$fixedBody),e.$fixedBodyRight&&e.options.fixedRightNumber&&a(e.$fixedHeaderRight,e.$fixedBodyRight)}}))}},{key:"hideLoading",value:function(){f(h(t.prototype),"hideLoading",this).call(this),this.needFixedColumns&&this.options.fixedNumber&&this.$fixedColumns.find(".fixed-table-loading").hide(),this.needFixedColumns&&this.options.fixedRightNumber&&this.$fixedColumnsRight.find(".fixed-table-loading").hide()}},{key:"initFixedColumnsHeader",value:function(){var e=this;this.options.height?this.needFixedColumns=this.$tableHeader.outerWidth(!0)<this.$tableHeader.find("table").outerWidth(!0):this.needFixedColumns=this.$tableBody.outerWidth(!0)<this.$tableBody.find("table").outerWidth(!0);var t=function(t,i){return t.find(".fixed-table-header").remove(),t.append(e.$tableHeader.clone(!0)),t.css({width:e.getFixedColumnsWidth(i)}),t.find(".fixed-table-header")};this.needFixedColumns&&this.options.fixedNumber?(this.$fixedHeader=t(this.$fixedColumns),this.$fixedHeader.css("margin-right","")):this.$fixedColumns&&this.$fixedColumns.html("").css("width",""),this.needFixedColumns&&this.options.fixedRightNumber?(this.$fixedHeaderRight=t(this.$fixedColumnsRight,!0),this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find("table").width())):this.$fixedColumnsRight&&this.$fixedColumnsRight.html("").css("width",""),this.initFixedColumnsBody(),this.initFixedColumnsEvents()}},{key:"initFixedColumnsBody",value:function(){var e=this,t=function(t,i){t.find(".fixed-table-body").remove(),t.append(e.$tableBody.clone(!0)),t.find(".fixed-table-body table").removeAttr("id");var o=t.find(".fixed-table-body"),n=e.$tableBody.get(0),s=n.scrollWidth>n.clientWidth?x.getScrollBarWidth():0,r=e.$tableContainer.outerHeight(!0)-s-1;return t.css({height:r}),o.css({height:r-i.height()}),o};this.needFixedColumns&&this.options.fixedNumber&&(this.$fixedBody=t(this.$fixedColumns,this.$fixedHeader)),this.needFixedColumns&&this.options.fixedRightNumber&&(this.$fixedBodyRight=t(this.$fixedColumnsRight,this.$fixedHeaderRight),this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find("table").width()),this.$fixedBodyRight.css("overflow-y",this.options.height?"auto":"hidden"))}},{key:"getFixedColumnsWidth",value:function(e){var t=this.getVisibleFields(),i=0,o=this.options.fixedNumber,n=0;e&&(t=t.reverse(),o=this.options.fixedRightNumber,n=parseInt(this.$tableHeader.css("margin-right"),10));for(var s=0;s<o;s++)i+=this.$header.find('th[data-field="'.concat(t[s],'"]')).outerWidth(!0);return i+n+1}},{key:"initFixedColumnsEvents",value:function(){var e=this,t=function(t,i){var o='tr[data-index="'.concat(d(t.currentTarget).data("index"),'"]'),n=e.$tableBody.find(o);e.$fixedBody&&(n=n.add(e.$fixedBody.find(o))),e.$fixedBodyRight&&(n=n.add(e.$fixedBodyRight.find(o))),n.css("background-color",i?d(t.currentTarget).css("background-color"):"")};this.$tableBody.find("tr").hover((function(e){t(e,!0)}),(function(e){t(e,!1)}));var i="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>-1?"DOMMouseScroll":"mousewheel";this.needFixedColumns&&this.options.fixedNumber&&(this.$fixedBody.find("tr").hover((function(e){t(e,!0)}),(function(e){t(e,!1)})),this.$fixedBody[0].addEventListener(i,(function(t){!function(t,i){var o,n,s,r,d,l=(n=0,s=0,r=0,d=0,"detail"in(o=t)&&(s=o.detail),"wheelDelta"in o&&(s=-o.wheelDelta/120),"wheelDeltaY"in o&&(s=-o.wheelDeltaY/120),"wheelDeltaX"in o&&(n=-o.wheelDeltaX/120),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(n=s,s=0),r=10*n,d=10*s,"deltaY"in o&&(d=o.deltaY),"deltaX"in o&&(r=o.deltaX),(r||d)&&o.deltaMode&&(1===o.deltaMode?(r*=40,d*=40):(r*=800,d*=800)),r&&!n&&(n=r<1?-1:1),d&&!s&&(s=d<1?-1:1),{spinX:n,spinY:s,pixelX:r,pixelY:d}),a=Math.ceil(l.pixelY),f=e.$tableBody.scrollTop()+a;(a<0&&f>0||a>0&&f<i.scrollHeight-i.clientHeight)&&t.preventDefault(),e.$tableBody.scrollTop(f),e.$fixedBody&&e.$fixedBody.scrollTop(f),e.$fixedBodyRight&&e.$fixedBodyRight.scrollTop(f)}(t,e.$fixedBody[0])}))),this.needFixedColumns&&this.options.fixedRightNumber&&(this.$fixedBodyRight.find("tr").hover((function(e){t(e,!0)}),(function(e){t(e,!1)})),this.$fixedBodyRight.off("scroll").on("scroll",(function(){var t=e.$fixedBodyRight.scrollTop();e.$tableBody.scrollTop(t),e.$fixedBody&&e.$fixedBody.scrollTop(t)}))),this.options.filterControl&&d(this.$fixedColumns).off("keyup change").on("keyup change",(function(t){var i=d(t.target),o=i.val(),n=i.parents("th").data("field"),s=e.$header.find('th[data-field="'.concat(n,'"]'));if(i.is("input"))s.find("input").val(o);else if(i.is("select")){var r=s.find("select");r.find("option[selected]").removeAttr("selected"),r.find('option[value="'.concat(o,'"]')).attr("selected",!0)}e.triggerSearch()}))}},{key:"renderStickyHeader",value:function(){if(this.options.stickyHeader&&(this.$stickyContainer=this.$container.find(".sticky-header-container"),f(h(t.prototype),"renderStickyHeader",this).call(this),this.needFixedColumns&&this.options.fixedNumber&&this.$fixedColumns.css("z-index",101).find(".sticky-header-container").css("right","").width(this.$fixedColumns.outerWidth()),this.needFixedColumns&&this.options.fixedRightNumber)){var e=this.$fixedColumnsRight.find(".sticky-header-container");this.$fixedColumnsRight.css("z-index",101),e.css("left","").scrollLeft(e.find(".table").outerWidth()).width(this.$fixedColumnsRight.outerWidth())}}},{key:"matchPositionX",value:function(){this.options.stickyHeader&&this.$stickyContainer.eq(0).scrollLeft(this.$tableBody.scrollLeft())}}])}(d.BootstrapTable)}));
|