import{e as s}from"./links.C2upUfsO.js";const a={data(){return{resultsPerPage:20,orderBy:null,orderDir:null,searchTerm:"",pageNumber:1,filter:"all",wpTableKey:0,wpTableLoading:!1}},methods:{refreshTable(){return this.wpTableLoading=!0,this.processFetchTableData().then(()=>this.wpTableLoading=!1)},processAdditionalFilters({filters:e}){this.wpTableLoading=!0,this.selectedFilters=e,this.processFetchTableData(e).then(()=>this.wpTableLoading=!1)},processSearch(e){typeof e=="object"&&(e=e.target.value),this.pageNumber=1,this.searchTerm=e,this.wpTableLoading=!0,this.processFetchTableData().then(()=>this.wpTableLoading=!1)},processPagination(e){this.pageNumber=e,this.wpTableLoading=!0,this.processFetchTableData().then(()=>this.wpTableLoading=!1)},processFilterTable(e){this.filter=e.slug,this.searchTerm="",this.pageNumber=1,this.wpTableLoading=!0,this.resetSelectedFilters(),this.processFetchTableData().then(()=>this.wpTableLoading=!1)},processChangeItemsPerPage(e){this.pageNumber=1,this.resultsPerPage=e,this.wpTableLoading=!0,s().changeItemsPerPage({slug:this.changeItemsPerPageSlug,value:e}).then(()=>this.processFetchTableData().then(()=>this.$scrollTo(`#${this.tableId}`,{offset:-110}))).then(()=>this.wpTableLoading=!1)},processSort(e,t){t.target.blur(),this.orderBy=e.slug,this.orderDir=this.orderBy!==e.slug?e.sortDir:e.sortDir==="asc"?"desc":"asc",this.wpTableLoading=!0,this.processFetchTableData().then(()=>this.wpTableLoading=!1)},processFetchTableData(e){return this.fetchData({slug:this.slug||null,orderBy:this.orderBy,orderDir:this.orderDir,limit:this.resultsPerPage,offset:this.pageNumber===1?0:(this.pageNumber-1)*this.resultsPerPage,searchTerm:this.searchTerm,filter:this.filter,additionalFilters:e||this.selectedFilters})},resetSelectedFilters(){}},created(){const e=s();this.resultsPerPage=e.settings.tablePagination[this.changeItemsPerPageSlug]||this.resultsPerPage}};export{a as W};
