@soft-stech/bootsman-ui-shadcn 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,7 +21,7 @@ import {
21
21
  getSortedRowModel,
22
22
  useVueTable
23
23
  } from '@tanstack/vue-table'
24
- import { computed } from 'vue'
24
+ import { computed, watchEffect } from 'vue'
25
25
  import {
26
26
  BuiTable,
27
27
  BuiTableBody,
@@ -79,6 +79,7 @@ const table = useVueTable({
79
79
  onRowSelectionChange: (updaterOrValue) => {
80
80
  valueUpdater(updaterOrValue, rowSelection)
81
81
  },
82
+ autoResetPageIndex: false,
82
83
  manualPagination: props.manualPagination, // set to false to enable client-side pagination
83
84
  manualSorting: props.manualSorting,
84
85
  state: {
@@ -117,6 +118,13 @@ const pageIndex = computed({
117
118
  }
118
119
  })
119
120
 
121
+ watchEffect(() => {
122
+ const totalPages = table.getPageCount()
123
+ if (totalPages && totalPages < pageIndex.value) {
124
+ pageIndex.value = totalPages
125
+ }
126
+ })
127
+
120
128
  const groupedRows = computed<{ [key: string]: Row<TData>[] }>(() => {
121
129
  if (!props.groupBy) return null
122
130
 
@@ -188,7 +196,9 @@ function getGroupLabel(index: number) {
188
196
  </template>
189
197
  </template>
190
198
  <template v-else>
191
- <BuiTableEmpty :colspan="columns.length">No data</BuiTableEmpty>
199
+ <BuiTableEmpty :colspan="columns.length">
200
+ <slot name="nodata">No data</slot>
201
+ </BuiTableEmpty>
192
202
  </template>
193
203
  </BuiTableBody>
194
204
  <BuiTableFooter v-if="showPagination && table.getPageCount() > 1">