import{r as t,h as e}from"./p-0d5a2e05.js";var s=undefined&&undefined.__rest||function(t,e){var s={};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0)s[i]=t[i];if(t!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,i=Object.getOwnPropertySymbols(t);o<i.length;o++){if(e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o]))s[i[o]]=t[i[o]]}return s};const i=class{constructor(e){t(this,e);this.data=[{selected:true},{selected:true}];this.rowDivider=true;this.showSelectCheckBox=true;this.alternate=true;this.cells=[{propertyName:"test",isFilter:false,isSort:false,title:"Test",type:"propertyName",colSpan:1},{propertyName:"test",isFilter:false,isSort:false,title:"Test",type:"propertyName",colSpan:1}];this.contained=true;this.sortedData=[];this.direction=false;this.sortData=(t="up",e,s)=>{if(t==="up"){const t=[...this.data.sort(((t,s)=>s[e]>t[e]?1:t[e]>s[e]?-1:0))];this.sortedData=t}else if(t==="down"){const t=[...this.data.sort(((t,s)=>t[e]>s[e]?1:s[e]>t[e]?-1:0))];this.sortedData=t}this.cells[s].sort=t=="down"?"up":"down"};this.handleSelectedRowChanges=(t,e)=>{const s=[...this.data];s[e].selected=t;this.sortedData=s;if(this.getSelectedRows){this.getSelectedRows({selectedRows:s.filter((t=>t.selected)),currentSelectedRow:s[e],currentSelectedRowIndex:e})}};this.selectAll=t=>{const e=[...this.data];e.forEach((e=>e.selected=t));this.sortedData=e;if(this.getSelectedRows){this.getSelectedRows({selectedRows:e})}}}componentDidLoad(){if(document.dir){if(document.dir==="rtl")this.direction=true;else this.direction=false}else if(document.documentElement.lang){if(document.documentElement.lang==="ar")this.direction=true;else this.direction=false}else this.direction=false}componentDidUpdate(){const t=[...this.data.map((t=>{t.selected=false;return t}))];this.sortedData=t}render(){return e("div",{key:"107004bda04af910ca676793f70d54bb0815e68e",class:`table-wrapper ${this.contained?"table-contained":""}`},e("table",{key:"49fad2c1d8b354069f52880a2be393e05e6387e0",class:` azm-table ${this.contained?"table-contained":""}`,style:{direction:this.direction?"rtl":"ltr"}},e("thead",{key:"2a088a496c8d85fa26a9ba8ee6f8b938b661e113"},e("tr",{key:"86cec9cdeb92ddf2dc2d2d7a037387d6849cf788",class:`${this.rowDivider?"row-divider":""}`},this.showSelectCheckBox&&e("th",{key:"25cfaad2b3b0c6f7dcf49314be4d3780cb0ea51f",style:{width:"20px"}},e("dga-checkbox",{key:"9e574d2ccac71b8aac46f9e6ee83eee7c542e0aa",showBorderOnFocusAndFocusOute:false,value:"true",onChange:t=>this.selectAll(t.target.checked)})),this.cells.map(((t,i)=>{var{sort:o,isSort:a,propertyName:n,type:c}=t,r=s(t,["sort","isSort","propertyName","type"]);return e("th",{key:i},e("span",null,e("span",{class:"text"},r.title),e("span",{class:"icon-wrapper"},a&&o=="up"&&c=="propertyName"&&e("button",{class:"btn btn--sort btn--icon btn--md",onClick:()=>this.sortData("up",n,i)},e("dga-icon",{icon:"SortByUp02Icon"})),a&&(!o||o=="down")&&c=="propertyName"&&e("button",{class:"btn btn--sort btn--icon btn--md",onClick:()=>this.sortData("down",n,i)},e("dga-icon",{icon:"SortByDown02Icon"})),r.isFilter&&e("button",{class:"btn btn--sort btn--icon btn--md ",onClick:()=>this.pressOnFilter&&this.pressOnFilter(n)},e("dga-icon",{icon:"FilterIcon"})))))})))),e("tbody",{key:"801fac253d5abbfd1d914a53b665fa114522df43"},this.sortedData.map(((t,i)=>e("tr",{class:`${this.rowDivider?"row-divider":""} ${this.alternate?"alternate":""} ${t.selected?"row-selected":""} `,key:i},this.showSelectCheckBox&&e("td",null,e("dga-checkbox",{name:i+"checkboxSelection",value:t.selected,id:i+"checkboxSelection",showBorderOnFocusAndFocusOute:false,onChange:t=>this.handleSelectedRowChanges(t.target.checked,i),checked:t.selected})),this.cells.map(((i,o)=>{var{El:a}=i,n=s(i,["El"]);return e("td",{key:o,colSpan:n.colSpan?n.colSpan:1},n.type==="element"&&a?e(a,Object.assign({},t)):t[n.propertyName])}))))))))}};export{i as dga_data_table_updated};
//# sourceMappingURL=p-a5a61e0b.entry.js.map