@invopop/popui 0.1.4-beta.19 → 0.1.4-beta.20

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.
@@ -42,7 +42,11 @@
42
42
  function handlePageInput(value: string) {
43
43
  const numValue = parseInt(value)
44
44
  if (numValue >= 1 && numValue <= totalPages) {
45
- table.setPageIndex(numValue - 1)
45
+ if (manualPagination) {
46
+ table.setPagination({ pageIndex: numValue - 1, pageSize: rowsPerPage })
47
+ } else {
48
+ table.setPageIndex(numValue - 1)
49
+ }
46
50
  onPageChange?.(numValue)
47
51
  }
48
52
  }
@@ -54,7 +58,11 @@
54
58
  target.value = `${currentPage}`
55
59
  } else if (value > totalPages) {
56
60
  target.value = `${totalPages}`
57
- table.setPageIndex(totalPages - 1)
61
+ if (manualPagination) {
62
+ table.setPagination({ pageIndex: totalPages - 1, pageSize: rowsPerPage })
63
+ } else {
64
+ table.setPageIndex(totalPages - 1)
65
+ }
58
66
  onPageChange?.(totalPages)
59
67
  }
60
68
  }
@@ -80,7 +88,11 @@
80
88
  size="md"
81
89
  icon={ScrollLeft}
82
90
  onclick={() => {
83
- table.setPageIndex(0)
91
+ if (manualPagination) {
92
+ table.setPagination({ pageIndex: 0, pageSize: rowsPerPage })
93
+ } else {
94
+ table.setPageIndex(0)
95
+ }
84
96
  onPageChange?.(1)
85
97
  }}
86
98
  disabled={currentPage === 1}
@@ -93,9 +105,10 @@
93
105
  icon={ArrowLeft}
94
106
  onclick={() => {
95
107
  const newPage = currentPage - 1
96
- // For manual pagination, use setPageIndex directly to avoid TanStack's internal checks
97
108
  if (manualPagination) {
98
- table.setPageIndex(newPage - 1)
109
+ // For manual pagination, bypass TanStack's navigation and use setPagination directly
110
+ // to avoid clamping issues with stale pageCount
111
+ table.setPagination({ pageIndex: newPage - 1, pageSize: rowsPerPage })
99
112
  } else {
100
113
  table.previousPage()
101
114
  }
@@ -130,9 +143,10 @@
130
143
  icon={ArrowRight}
131
144
  onclick={() => {
132
145
  const newPage = currentPage + 1
133
- // For manual pagination, use setPageIndex directly to avoid TanStack's internal checks
134
146
  if (manualPagination) {
135
- table.setPageIndex(newPage - 1)
147
+ // For manual pagination, bypass TanStack's navigation and use setPagination directly
148
+ // to avoid clamping issues with stale pageCount
149
+ table.setPagination({ pageIndex: newPage - 1, pageSize: rowsPerPage })
136
150
  } else {
137
151
  table.nextPage()
138
152
  }
@@ -147,7 +161,11 @@
147
161
  size="md"
148
162
  icon={ScrollRight}
149
163
  onclick={() => {
150
- table.setPageIndex(totalPages - 1)
164
+ if (manualPagination) {
165
+ table.setPagination({ pageIndex: totalPages - 1, pageSize: rowsPerPage })
166
+ } else {
167
+ table.setPageIndex(totalPages - 1)
168
+ }
151
169
  onPageChange?.(totalPages)
152
170
  }}
153
171
  disabled={currentPage === totalPages}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.4-beta.19",
4
+ "version": "0.1.4-beta.20",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },