mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	These fixes are all auto generated and can be merged directly Fixes the following issues 1. Event used on components should be hypenated 2. Attribute orders in components 3. Use `unmounted` instead of `destroyed` 4. Add explicit `emits` declarations for components, autofixed [using this script](https://gist.github.com/scmmishra/6f549109b96400006bb69bbde392eddf) We ignore the top level v-if for now, we will fix it later
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<script setup>
 | 
						|
import { computed } from 'vue';
 | 
						|
import TableFooterResults from './TableFooterResults.vue';
 | 
						|
import TableFooterPagination from './TableFooterPagination.vue';
 | 
						|
const props = defineProps({
 | 
						|
  currentPage: {
 | 
						|
    type: Number,
 | 
						|
    default: 1,
 | 
						|
  },
 | 
						|
  pageSize: {
 | 
						|
    type: Number,
 | 
						|
    default: 25,
 | 
						|
  },
 | 
						|
  totalCount: {
 | 
						|
    type: Number,
 | 
						|
    default: 0,
 | 
						|
  },
 | 
						|
});
 | 
						|
 | 
						|
const emit = defineEmits(['pageChange']);
 | 
						|
const totalPages = computed(() => Math.ceil(props.totalCount / props.pageSize));
 | 
						|
const firstIndex = computed(() => props.pageSize * (props.currentPage - 1) + 1);
 | 
						|
const lastIndex = computed(() =>
 | 
						|
  Math.min(props.totalCount, props.pageSize * props.currentPage)
 | 
						|
);
 | 
						|
const isFooterVisible = computed(
 | 
						|
  () => props.totalCount && !(firstIndex.value > props.totalCount)
 | 
						|
);
 | 
						|
</script>
 | 
						|
 | 
						|
<!-- eslint-disable-next-line vue/no-root-v-if -->
 | 
						|
<template>
 | 
						|
  <footer
 | 
						|
    v-if="isFooterVisible"
 | 
						|
    class="flex items-center justify-between h-12 px-6"
 | 
						|
  >
 | 
						|
    <TableFooterResults
 | 
						|
      :first-index="firstIndex"
 | 
						|
      :last-index="lastIndex"
 | 
						|
      :total-count="totalCount"
 | 
						|
    />
 | 
						|
    <TableFooterPagination
 | 
						|
      v-if="totalCount"
 | 
						|
      :current-page="currentPage"
 | 
						|
      :total-pages="totalPages"
 | 
						|
      :total-count="totalCount"
 | 
						|
      :page-size="pageSize"
 | 
						|
      @page-change="emit('pageChange', $event)"
 | 
						|
    />
 | 
						|
  </footer>
 | 
						|
</template>
 |