1 line
No EOL
4.1 KiB
JavaScript
Executable file
1 line
No EOL
4.1 KiB
JavaScript
Executable file
!function(t,e){var o=function(t){var e={};function o(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},o.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=341)}({340:function(t,e){!function(t){"use strict";var e,o,r=function(t){var e=arguments,o=!0,r=1;return t=t.replace(/%s/g,function(){var t=e[r++];return void 0===t?(o=!1,""):t}),o?t:""};t.extend(t.fn.bootstrapTable.defaults,{groupBy:!1,groupByField:""});var i=t.fn.bootstrapTable.Constructor,n=i.prototype.initSort,p=i.prototype.initBody,c=i.prototype.updateSelected;i.prototype.initSort=function(){n.apply(this,Array.prototype.slice.apply(arguments));var e=this;if(o=[],this.options.groupBy&&""!==this.options.groupByField){this.options.sortName!=this.options.groupByField&&this.data.sort(function(t,o){return t[e.options.groupByField].localeCompare(o[e.options.groupByField])});var e=this,r=function(t,e){var o={};return t.forEach(function(t){var r=e(t);o[r]=o[r]||[],o[r].push(t)}),o}(e.data,function(t){return[t[e.options.groupByField]]}),i=0;t.each(r,function(t,e){o.push({id:i,name:t}),e.forEach(function(t){t._data||(t._data={}),t._data["parent-index"]=i}),i++})}},i.prototype.initBody=function(){if(e=!0,p.apply(this,Array.prototype.slice.apply(arguments)),this.options.groupBy&&""!==this.options.groupByField){var i=this,n=!1,c=0;this.columns.forEach(function(t){t.checkbox?n=!0:t.visible&&(c+=1)}),this.options.detailView&&!this.options.cardView&&(c+=1),o.forEach(function(e){var o=[];o.push(r('<tr class="info groupBy expanded" data-group-index="%s">',e.id)),i.options.detailView&&!i.options.cardView&&o.push('<td class="detail"></td>'),n&&o.push('<td class="bs-checkbox">','<input name="btSelectGroup" type="checkbox" />',"</td>"),o.push("<td",r(' colspan="%s"',c),">",e.name,"</td>"),o.push("</tr>"),i.$body.find("tr[data-parent-index="+e.id+"]:first").before(t(o.join("")))}),this.$selectGroup=[],this.$body.find('[name="btSelectGroup"]').each(function(){var e=t(this);i.$selectGroup.push({group:e,item:i.$selectItem.filter(function(){return t(this).closest("tr").data("parent-index")===e.closest("tr").data("group-index")})})}),this.$container.off("click",".groupBy").on("click",".groupBy",function(){t(this).toggleClass("expanded"),i.$body.find("tr[data-parent-index="+t(this).closest("tr").data("group-index")+"]").toggleClass("hidden")}),this.$container.off("click",'[name="btSelectGroup"]').on("click",'[name="btSelectGroup"]',function(e){e.stopImmediatePropagation();var o=t(this),r=o.prop("checked");i[r?"checkGroup":"uncheckGroup"](t(this).closest("tr").data("group-index"))})}e=!1,this.updateSelected()},i.prototype.updateSelected=function(){e||(c.apply(this,Array.prototype.slice.apply(arguments)),this.options.groupBy&&""!==this.options.groupByField&&this.$selectGroup.forEach(function(t){var e=t.item.filter(":enabled").length===t.item.filter(":enabled").filter(":checked").length;t.group.prop("checked",e)}))},i.prototype.getGroupSelections=function(e){var o=this;return t.grep(this.data,function(t){return t[o.header.stateField]&&t._data["parent-index"]===e})},i.prototype.checkGroup=function(t){this.checkGroup_(t,!0)},i.prototype.uncheckGroup=function(t){this.checkGroup_(t,!1)},i.prototype.checkGroup_=function(e,o){var r;o||(r=this.getGroupSelections(e)),this.$selectItem.filter(function(){return t(this).closest("tr").data("parent-index")===e}).prop("checked",o),this.updateRows(),this.updateSelected(),o&&(r=this.getGroupSelections(e)),this.trigger(o?"check-all":"uncheck-all",r)}}(jQuery)},341:function(t,e,o){o(340)}});if("object"==typeof o){var r=["object"==typeof module&&"object"==typeof module.exports?module.exports:null,"undefined"!=typeof window?window:null,t&&t!==window?t:null];for(var i in o)r[0]&&(r[0][i]=o[i]),r[1]&&"__esModule"!==i&&(r[1][i]=o[i]),r[2]&&(r[2][i]=o[i])}}(this); |