import{a as m}from"./chunk-DUS4LJU5.js";import{a as p}from"./chunk-QMK5ZI2F.js";import{p as n}from"./chunk-2SZ4MB2K.js";import{t as d}from"./chunk-ZTKV4AIV.js";import{A as l,ca as r,ib as a,qa as c,rb as u}from"./chunk-FWZCAEAJ.js";var v=(()=>{let i=class i extends m{constructor(e){super(e),this.entitiesService=e,this.selectionEnabled=!0,this.selection=new n(!0,[]),this.confirmDialog=p()}getDataSource(e){return super.getDataSource(e).pipe(r(()=>this.selection=new n(!0,[])))}get columnsToDisplay(){return this.selectionEnabled?["select"].concat(super.columnsToDisplay):super.columnsToDisplay}set columnsToDisplay(e){super.columnsToDisplay=e}onDelete(e,t){t?.stopPropagation(),this.lumber.info("onDelete","Opening delete question dialog"),this.confirmDialog("DELETE_CONFIRMATION").then(o=>{o&&this.entitiesService.delete$(e).subscribe()})}onDeleteSelected(){this.lumber.info("onDeleteSelected","Opening delete question dialog"),this.lumber.info("onDeleteSelected","Selected entities:",this.selection.selected),this.confirmDialog("DELETE_ALL",`<ol><li>${d().mappedSource(this.selection.selected,this.nameMap).separator("</li><li>").build()}</li></ol>`).then(e=>{if(e){let t=[];for(let o of this.selection.selected)t.push(this.entitiesService.delete$(o.id));l(t).subscribe()}})}isAllSelected(){let e=this.selection.selected.length,t=this._dataSource.data.length;return e===t}toggleAllRows(){if(this.isAllSelected()){this.selection.clear();return}this.selection?.select(...this._dataSource.data)}};i.\u0275fac=function(t){return new(t||i)(a(null))},i.\u0275cmp=c({type:i,selectors:[["ng-component"]],features:[u],decls:0,vars:0,template:function(t,o){},encapsulation:2});let s=i;return s})();export{v as a};
