@meta-1/design 0.0.173 → 0.0.174

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meta-1/design",
3
- "version": "0.0.173",
3
+ "version": "0.0.174",
4
4
  "keywords": [
5
5
  "easykit",
6
6
  "design",
@@ -120,43 +120,81 @@ export const Pagination: FC<PaginationProps> = (props) => {
120
120
 
121
121
  const pageNumbers = generatePageNumbers(page, totalPage);
122
122
 
123
- if (simple) {
124
- // 简单模式渲染
123
+ // 渲染简单分页导航(只有上一页、当前页、下一页)
124
+ const renderSimplePagination = () => {
125
125
  return (
126
- <div className="flex items-center justify-center">
127
- <ShadcnPagination>
128
- <PaginationContent>
129
- {/* 上一页 */}
130
- <PaginationItem>
131
- <PaginationPrevious
132
- className={page === 1 ? "pointer-events-none opacity-50" : "cursor-pointer"}
133
- onClick={page === 1 ? undefined : () => onChange?.(page - 1)}
134
- size="default"
135
- />
136
- </PaginationItem>
137
-
138
- {/* 当前页 */}
139
- <PaginationItem>
140
- <PaginationLink isActive size="default">
141
- {page}
142
- </PaginationLink>
143
- </PaginationItem>
126
+ <PaginationContent>
127
+ {/* 上一页 */}
128
+ <PaginationItem>
129
+ <PaginationPrevious
130
+ className={page === 1 ? "pointer-events-none opacity-50" : "cursor-pointer"}
131
+ onClick={page === 1 ? undefined : () => onChange?.(page - 1)}
132
+ size="default"
133
+ />
134
+ </PaginationItem>
135
+
136
+ {/* 当前页 */}
137
+ <PaginationItem>
138
+ <PaginationLink isActive size="default">
139
+ {page}
140
+ </PaginationLink>
141
+ </PaginationItem>
142
+
143
+ {/* 下一页 */}
144
+ <PaginationItem>
145
+ <PaginationNext
146
+ className={page === totalPage ? "pointer-events-none opacity-50" : "cursor-pointer"}
147
+ onClick={page === totalPage ? undefined : () => onChange?.(page + 1)}
148
+ size="default"
149
+ />
150
+ </PaginationItem>
151
+ </PaginationContent>
152
+ );
153
+ };
144
154
 
145
- {/* 下一页 */}
146
- <PaginationItem>
147
- <PaginationNext
148
- className={page === totalPage ? "pointer-events-none opacity-50" : "cursor-pointer"}
149
- onClick={page === totalPage ? undefined : () => onChange?.(page + 1)}
155
+ // 渲染完整分页导航(包含所有页码)
156
+ const renderFullPagination = () => {
157
+ return (
158
+ <PaginationContent>
159
+ {/* 上一页 */}
160
+ <PaginationItem>
161
+ <PaginationPrevious
162
+ className={page === 1 ? "pointer-events-none opacity-50" : "cursor-pointer"}
163
+ onClick={page === 1 ? undefined : () => onChange?.(page - 1)}
164
+ size="default"
165
+ />
166
+ </PaginationItem>
167
+
168
+ {/* 页码数字 */}
169
+ {pageNumbers.map((pageNum, index) => (
170
+ <PaginationItem key={pageNum === "ellipsis" ? `ellipsis-${index}` : `page-${pageNum}`}>
171
+ {pageNum === "ellipsis" ? (
172
+ <PaginationEllipsis />
173
+ ) : (
174
+ <PaginationLink
175
+ className="cursor-pointer"
176
+ isActive={pageNum === page}
177
+ onClick={() => onChange?.(pageNum)}
150
178
  size="default"
151
- />
152
- </PaginationItem>
153
- </PaginationContent>
154
- </ShadcnPagination>
155
- </div>
179
+ >
180
+ {pageNum}
181
+ </PaginationLink>
182
+ )}
183
+ </PaginationItem>
184
+ ))}
185
+
186
+ {/* 下一页 */}
187
+ <PaginationItem>
188
+ <PaginationNext
189
+ className={page === totalPage ? "pointer-events-none opacity-50" : "cursor-pointer"}
190
+ onClick={page === totalPage ? undefined : () => onChange?.(page + 1)}
191
+ size="default"
192
+ />
193
+ </PaginationItem>
194
+ </PaginationContent>
156
195
  );
157
- }
196
+ };
158
197
 
159
- // 标准模式渲染
160
198
  return (
161
199
  <div className="flex items-center justify-center space-x-6">
162
200
  <ShadcnPagination>
@@ -168,43 +206,7 @@ export const Pagination: FC<PaginationProps> = (props) => {
168
206
  </div>
169
207
  ) : null}
170
208
  {/* 分页导航 */}
171
- <PaginationContent>
172
- {/* 上一页 */}
173
- <PaginationItem>
174
- <PaginationPrevious
175
- className={page === 1 ? "pointer-events-none opacity-50" : "cursor-pointer"}
176
- onClick={page === 1 ? undefined : () => onChange?.(page - 1)}
177
- size="default"
178
- />
179
- </PaginationItem>
180
-
181
- {/* 页码数字 */}
182
- {pageNumbers.map((pageNum, index) => (
183
- <PaginationItem key={pageNum === "ellipsis" ? `ellipsis-${index}` : `page-${pageNum}`}>
184
- {pageNum === "ellipsis" ? (
185
- <PaginationEllipsis />
186
- ) : (
187
- <PaginationLink
188
- className="cursor-pointer"
189
- isActive={pageNum === page}
190
- onClick={() => onChange?.(pageNum)}
191
- size="default"
192
- >
193
- {pageNum}
194
- </PaginationLink>
195
- )}
196
- </PaginationItem>
197
- ))}
198
-
199
- {/* 下一页 */}
200
- <PaginationItem>
201
- <PaginationNext
202
- className={page === totalPage ? "pointer-events-none opacity-50" : "cursor-pointer"}
203
- onClick={page === totalPage ? undefined : () => onChange?.(page + 1)}
204
- size="default"
205
- />
206
- </PaginationItem>
207
- </PaginationContent>
209
+ {simple ? renderSimplePagination() : renderFullPagination()}
208
210
  {/* 控制区域 */}
209
211
  {showSizeChanger || showQuickJumper ? (
210
212
  <div className="flex items-center space-x-3">