Files
everything/EveryThing/wwwroot/vendor/libs/bootstrap-table/extensions/group-by-v2/group-by-v2.js
David Štaleker db0cc8d3de prvi
2025-07-18 05:33:16 +02:00

1 line
4.6 KiB
JavaScript

!function(t,e){var o=function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},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=409)}({409:function(t,e,o){o(410)},410: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:"",groupByFormatter:void 0});var n=t.fn.bootstrapTable.Constructor,i=n.prototype.initSort,p=n.prototype.initBody,u=n.prototype.updateSelected;n.prototype.initSort=function(){i.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]]}),n=0;t.each(r,function(t,e){o.push({id:n,name:t,data:e}),e.forEach(function(t){t._data||(t._data={}),t._data["parent-index"]=n}),n++})}},n.prototype.initBody=function(){if(e=!0,p.apply(this,Array.prototype.slice.apply(arguments)),this.options.groupBy&&""!==this.options.groupByField){var n=this,i=!1,u=0;this.columns.forEach(function(t){t.checkbox?i=!0:t.visible&&(u+=1)}),this.options.detailView&&!this.options.cardView&&(u+=1),o.forEach(function(e){var o=[];o.push(r('<tr class="info groupBy expanded" data-group-index="%s">',e.id)),n.options.detailView&&!n.options.cardView&&o.push('<td class="detail"></td>'),i&&o.push('<td class="bs-checkbox">','<input name="btSelectGroup" type="checkbox" />',"</td>");var p=e.name;"function"==typeof n.options.groupByFormatter&&(p=n.options.groupByFormatter(e.name,e.id,e.data)),o.push("<td",r(' colspan="%s"',u),">",p,"</td>"),o.push("</tr>"),n.$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);n.$selectGroup.push({group:e,item:n.$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"),n.$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");n[r?"checkGroup":"uncheckGroup"](t(this).closest("tr").data("group-index"))})}e=!1,this.updateSelected()},n.prototype.updateSelected=function(){e||(u.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)}))},n.prototype.getGroupSelections=function(e){var o=this;return t.grep(this.data,function(t){return t[o.header.stateField]&&t._data["parent-index"]===e})},n.prototype.checkGroup=function(t){this.checkGroup_(t,!0)},n.prototype.uncheckGroup=function(t){this.checkGroup_(t,!1)},n.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)}});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 n in o)r[0]&&(r[0][n]=o[n]),r[1]&&"__esModule"!==n&&(r[1][n]=o[n]),r[2]&&(r[2][n]=o[n])}}(this);