@apexhub/apex-ui-react-source 1.2.0 → 1.2.2
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/README.md +18 -4
- package/bin/apex-ui-react-source.mjs +208 -24
- package/dist/files/AGENTS.md +2 -2
- package/dist/files/_assets/table-empty.url.ts +1 -1
- package/dist/files/alert/Alert.tsx +2 -2
- package/dist/files/alert/alert.css +1 -0
- package/dist/files/alert/llm.txt +3 -3
- package/dist/files/alert/tokens.txt +1 -1
- package/dist/files/apex-provider/llm.txt +3 -2
- package/dist/files/auto-complete/llm.txt +1 -1
- package/dist/files/auto-complete/tokens.txt +1 -1
- package/dist/files/avatar/Avatar.tsx +1 -1
- package/dist/files/avatar/avatar.css +12 -1
- package/dist/files/avatar/llm.txt +1 -1
- package/dist/files/avatar/tokens.txt +1 -1
- package/dist/files/breadcrumb/Breadcrumb.tsx +17 -10
- package/dist/files/breadcrumb/breadcrumb.css +20 -10
- package/dist/files/breadcrumb/interface.ts +4 -4
- package/dist/files/breadcrumb/llm.txt +8 -8
- package/dist/files/breadcrumb/tokens.txt +46 -96
- package/dist/files/breadcrumb/variants.ts +6 -0
- package/dist/files/button/Button.tsx +25 -8
- package/dist/files/button/button.css +20 -2
- package/dist/files/button/interface.ts +7 -4
- package/dist/files/button/llm.txt +16 -8
- package/dist/files/button/tokens.txt +1 -1
- package/dist/files/button/variants.ts +8 -0
- package/dist/files/card/Card.tsx +8 -1
- package/dist/files/card/card-states.stories.css +42 -0
- package/dist/files/card/card.css +6 -1
- package/dist/files/card/interface.ts +3 -0
- package/dist/files/card/llm.txt +24 -1
- package/dist/files/card/tokens.txt +3 -1
- package/dist/files/cascader/cascader-data.ts +29 -8
- package/dist/files/cascader/cascader.css +45 -11
- package/dist/files/cascader/llm.txt +25 -6
- package/dist/files/cascader/tokens.txt +15 -7
- package/dist/files/cascader/variants.ts +1 -1
- package/dist/files/checkbox/Checkbox.tsx +26 -10
- package/dist/files/checkbox/checkbox.css +64 -22
- package/dist/files/checkbox/llm.txt +24 -13
- package/dist/files/checkbox/tokens.txt +10 -2
- package/dist/files/clear/clear.css +5 -2
- package/dist/files/collapse/llm.txt +1 -1
- package/dist/files/collapse/tokens.txt +1 -1
- package/dist/files/date-picker/RangePicker.tsx +5 -5
- package/dist/files/date-picker/Trigger.tsx +5 -5
- package/dist/files/date-picker/date-picker.css +53 -23
- package/dist/files/date-picker/llm.txt +7 -3
- package/dist/files/date-picker/tokens.txt +10 -10
- package/dist/files/divider/llm.txt +1 -1
- package/dist/files/divider/tokens.txt +1 -1
- package/dist/files/drawer/drawer.css +1 -0
- package/dist/files/drawer/llm.txt +2 -2
- package/dist/files/drawer/tokens.txt +2 -2
- package/dist/files/dropdown/llm.txt +1 -1
- package/dist/files/dropdown/tokens.txt +1 -1
- package/dist/files/form/form.css +10 -0
- package/dist/files/form/llm.txt +1 -1
- package/dist/files/form/tokens.txt +3 -1
- package/dist/files/grid/llm.txt +9 -9
- package/dist/files/image/ImagePreview.tsx +7 -6
- package/dist/files/image/image.css +0 -10
- package/dist/files/image/llm.txt +2 -2
- package/dist/files/image/tokens.txt +1 -1
- package/dist/files/input/input.css +14 -14
- package/dist/files/input/llm.txt +4 -2
- package/dist/files/input/tokens.txt +4 -4
- package/dist/files/input-number/InputNumber.tsx +2 -0
- package/dist/files/input-number/input-number.css +13 -1
- package/dist/files/input-number/llm.txt +8 -3
- package/dist/files/input-number/tokens.txt +4 -4
- package/dist/files/layout/llm.txt +1 -1
- package/dist/files/layout/tokens.txt +1 -1
- package/dist/files/llms.txt +18 -11
- package/dist/files/menu/Menu.tsx +5 -1
- package/dist/files/menu/llm.txt +19 -12
- package/dist/files/menu/menu.css +41 -15
- package/dist/files/menu/menu.figma.stories.css +39 -0
- package/dist/files/menu/tokens.txt +21 -8
- package/dist/files/message/llm.txt +1 -1
- package/dist/files/message/tokens.txt +1 -1
- package/dist/files/modal/Modal.tsx +1 -2
- package/dist/files/modal/interface.ts +1 -1
- package/dist/files/modal/llm.txt +9 -9
- package/dist/files/modal/tokens.txt +1 -1
- package/dist/files/notification/llm.txt +1 -1
- package/dist/files/notification/tokens.txt +1 -1
- package/dist/files/pagination/PageButton.tsx +2 -0
- package/dist/files/pagination/Pagination.tsx +149 -170
- package/dist/files/pagination/interface.ts +2 -2
- package/dist/files/pagination/llm.txt +18 -9
- package/dist/files/pagination/pagination.css +56 -17
- package/dist/files/pagination/tokens.txt +6 -4
- package/dist/files/popover/Popover.tsx +11 -3
- package/dist/files/popover/llm.txt +3 -3
- package/dist/files/popover/popover.css +30 -18
- package/dist/files/popover/popover.stories.css +6 -0
- package/dist/files/popover/tokens.txt +4 -14
- package/dist/files/progress/llm.txt +4 -4
- package/dist/files/progress/tokens.txt +1 -1
- package/dist/files/radio/llm.txt +38 -1
- package/dist/files/radio/radio.css +51 -14
- package/dist/files/radio/tokens.txt +11 -6
- package/dist/files/rate/llm.txt +1 -1
- package/dist/files/rate/tokens.txt +1 -1
- package/dist/files/select/llm.txt +8 -7
- package/dist/files/select/select.css +30 -16
- package/dist/files/select/tokens.txt +4 -4
- package/dist/files/skeleton/llm.txt +1 -1
- package/dist/files/skeleton/tokens.txt +1 -1
- package/dist/files/spin/llm.txt +1 -1
- package/dist/files/spin/tokens.txt +1 -1
- package/dist/files/steps/llm.txt +1 -1
- package/dist/files/steps/tokens.txt +1 -1
- package/dist/files/switch/llm.txt +1 -1
- package/dist/files/switch/tokens.txt +1 -1
- package/dist/files/table/constants.ts +2 -2
- package/dist/files/table/hooks/useRowSelection.tsx +3 -3
- package/dist/files/table/interface.ts +7 -7
- package/dist/files/table/llm.txt +16 -13
- package/dist/files/table/parts/TablePagination.tsx +8 -0
- package/dist/files/table/table.css +27 -10
- package/dist/files/table/tokenScopes.ts +2 -2
- package/dist/files/table/tokens.txt +2 -2
- package/dist/files/tabs/Tabs.tsx +1 -2
- package/dist/files/tabs/llm.txt +1 -1
- package/dist/files/tabs/tabs.css +3 -3
- package/dist/files/tabs/tokens.txt +1 -1
- package/dist/files/tag/interface.ts +2 -2
- package/dist/files/tag/llm.txt +7 -8
- package/dist/files/tag/tag.css +1 -1
- package/dist/files/tag/tokens.txt +1 -2
- package/dist/files/tag/variants.ts +12 -2
- package/dist/files/theme/aliases.css +1 -1
- package/dist/files/theme/component-tokens.css +7 -7
- package/dist/files/theme/primitives.css +1 -1
- package/dist/files/tooltip/Tooltip.tsx +2 -2
- package/dist/files/tooltip/llm.txt +1 -1
- package/dist/files/tooltip/tokens.txt +1 -1
- package/dist/files/tooltip/tooltip.css +2 -3
- package/dist/files/tree/Tree.tsx +8 -38
- package/dist/files/tree/llm.txt +11 -15
- package/dist/files/tree/tokens.txt +1 -3
- package/dist/files/tree/tree-data.ts +30 -2
- package/dist/files/tree/tree.css +17 -3
- package/dist/files/tree/variants.ts +4 -2
- package/dist/files/tree-select/llm.txt +32 -22
- package/dist/files/tree-select/tokens.txt +7 -6
- package/dist/files/tree-select/tree-select-data.ts +2 -1
- package/dist/files/tree-select/tree-select.css +61 -8
- package/dist/files/typography/llm.txt +1 -1
- package/dist/files/typography/tokens.txt +1 -1
- package/dist/files/upload/llm.txt +4 -2
- package/dist/files/upload/tokens.txt +5 -1
- package/dist/files/upload/upload.css +54 -11
- package/dist/manifest.json +155 -153
- package/package.json +6 -5
- package/template/_gitignore +5 -0
- package/template/index.html +12 -0
- package/template/src/App.tsx +25 -0
- package/template/src/main.tsx +14 -0
- package/template/tsconfig.app.json +22 -0
- package/template/tsconfig.json +4 -0
- package/template/tsconfig.node.json +16 -0
- package/template/vite.config.ts +8 -0
|
@@ -17,8 +17,6 @@ import { PaginationContext } from './context'
|
|
|
17
17
|
import type { PaginationProps } from './interface'
|
|
18
18
|
import { PageButton } from './PageButton'
|
|
19
19
|
import { PageSizeChanger } from './PageSizeChanger'
|
|
20
|
-
import { QuickJumper } from './QuickJumper'
|
|
21
|
-
import { TotalText } from './TotalText'
|
|
22
20
|
import { useResizeObserver } from './useResizeObserver'
|
|
23
21
|
import { paginationVariants } from './variants'
|
|
24
22
|
|
|
@@ -33,8 +31,6 @@ export const Pagination: React.FC<PaginationProps> = ({
|
|
|
33
31
|
pageSizeOptions,
|
|
34
32
|
disabled = false,
|
|
35
33
|
showSizeChanger,
|
|
36
|
-
showQuickJumper = false,
|
|
37
|
-
showTotal,
|
|
38
34
|
hideOnSinglePage = false,
|
|
39
35
|
itemRender,
|
|
40
36
|
responsive = false,
|
|
@@ -125,182 +121,165 @@ export const Pagination: React.FC<PaginationProps> = ({
|
|
|
125
121
|
const isPrevDisabled = disabled || safeCurrent === 1
|
|
126
122
|
const isNextDisabled = disabled || safeCurrent === totalPages
|
|
127
123
|
|
|
128
|
-
|
|
124
|
+
// showTotal / showQuickJumper 不在设计稿中,props 保留以兼容调用方但不渲染
|
|
129
125
|
const showSizeChangerFinal = effectiveShowSizeChanger && (!responsive || display.showSizeChanger)
|
|
130
|
-
const showQuickJumperFinal = showQuickJumper && (!responsive || display.showQuickJumper)
|
|
131
126
|
|
|
132
|
-
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
127
|
+
const paginationNav = (
|
|
128
|
+
<nav
|
|
129
|
+
ref={mergedRef}
|
|
130
|
+
role="navigation"
|
|
131
|
+
aria-label={locale.nav}
|
|
132
|
+
className={cn(
|
|
133
|
+
paginationVariants(),
|
|
134
|
+
'apex-text-pagination', // C1: font-size tokens
|
|
135
|
+
responsive && 'apex-responsive-pagination', // C1: responsive transition tokens
|
|
136
|
+
className,
|
|
137
|
+
)}
|
|
138
|
+
data-slot="pagination"
|
|
139
|
+
{...(disabled ? { 'data-disabled': '' } : {})}
|
|
140
|
+
{...(responsive ? { 'data-responsive-mode': responsiveMode } : {})}
|
|
141
|
+
style={style}
|
|
142
|
+
>
|
|
143
|
+
<ul className="apex-pagination__list" data-slot="pagination-list" role="list">
|
|
144
|
+
{/* prev – <li> is constant; only button node goes into itemRender (C2) */}
|
|
145
|
+
<li
|
|
146
|
+
className={cn('apex-pagination__item', 'apex-pagination__item--prev')}
|
|
147
|
+
data-slot="pagination-item-prev"
|
|
148
|
+
{...(isPrevDisabled ? { 'data-disabled': '' } : {})}
|
|
149
|
+
>
|
|
150
|
+
{renderItem(
|
|
151
|
+
safeCurrent - 1,
|
|
152
|
+
'prev',
|
|
153
|
+
<PageButton
|
|
154
|
+
page={safeCurrent - 1}
|
|
155
|
+
type="prev"
|
|
156
|
+
disabled={isPrevDisabled}
|
|
157
|
+
onClick={handlePageChange}
|
|
158
|
+
aria-label={locale.prevPage}
|
|
159
|
+
>
|
|
160
|
+
{'‹'}
|
|
161
|
+
</PageButton>,
|
|
162
|
+
)}
|
|
163
|
+
</li>
|
|
158
164
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
page={
|
|
171
|
-
|
|
172
|
-
disabled
|
|
173
|
-
onClick={handlePageChange}
|
|
174
|
-
aria-label={locale.prevPage}
|
|
165
|
+
{items.map((item) => {
|
|
166
|
+
if (item.type === 'page') {
|
|
167
|
+
return (
|
|
168
|
+
<li
|
|
169
|
+
key={`page-${item.page}`}
|
|
170
|
+
className={cn(
|
|
171
|
+
'apex-pagination__item',
|
|
172
|
+
'apex-pagination__item--page',
|
|
173
|
+
item.active && 'apex-pagination__item--active',
|
|
174
|
+
)}
|
|
175
|
+
data-slot="pagination-item"
|
|
176
|
+
data-page={String(item.page)}
|
|
177
|
+
{...(item.active ? { 'data-active': '' } : {})}
|
|
178
|
+
{...(disabled ? { 'data-disabled': '' } : {})}
|
|
175
179
|
>
|
|
176
|
-
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
{renderItem(
|
|
181
|
+
item.page,
|
|
182
|
+
'page',
|
|
183
|
+
<PageButton
|
|
184
|
+
page={item.page}
|
|
185
|
+
type="page"
|
|
186
|
+
active={item.active}
|
|
187
|
+
disabled={disabled}
|
|
188
|
+
onClick={handlePageChange}
|
|
189
|
+
aria-label={locale.pageButton(item.page)}
|
|
190
|
+
>
|
|
191
|
+
{item.page}
|
|
192
|
+
</PageButton>,
|
|
193
|
+
)}
|
|
194
|
+
</li>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
180
197
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
'
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
onClick={handlePageChange}
|
|
205
|
-
aria-label={locale.pageButton(item.page)}
|
|
206
|
-
>
|
|
207
|
-
{item.page}
|
|
208
|
-
</PageButton>,
|
|
209
|
-
)}
|
|
210
|
-
</li>
|
|
211
|
-
)
|
|
212
|
-
}
|
|
198
|
+
if (item.type === 'jump-prev') {
|
|
199
|
+
return (
|
|
200
|
+
<li
|
|
201
|
+
key="jump-prev"
|
|
202
|
+
className={cn('apex-pagination__item', 'apex-pagination__item--jump-prev')}
|
|
203
|
+
data-slot="pagination-item-jump-prev"
|
|
204
|
+
>
|
|
205
|
+
{renderItem(
|
|
206
|
+
item.page,
|
|
207
|
+
'jump-prev',
|
|
208
|
+
<PageButton
|
|
209
|
+
page={item.page}
|
|
210
|
+
type="jump-prev"
|
|
211
|
+
disabled={disabled}
|
|
212
|
+
onClick={handlePageChange}
|
|
213
|
+
aria-label={locale.prev5}
|
|
214
|
+
>
|
|
215
|
+
{'•••'}
|
|
216
|
+
</PageButton>,
|
|
217
|
+
)}
|
|
218
|
+
</li>
|
|
219
|
+
)
|
|
220
|
+
}
|
|
213
221
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
222
|
+
if (item.type === 'jump-next') {
|
|
223
|
+
return (
|
|
224
|
+
<li
|
|
225
|
+
key="jump-next"
|
|
226
|
+
className={cn('apex-pagination__item', 'apex-pagination__item--jump-next')}
|
|
227
|
+
data-slot="pagination-item-jump-next"
|
|
228
|
+
>
|
|
229
|
+
{renderItem(
|
|
230
|
+
item.page,
|
|
231
|
+
'jump-next',
|
|
232
|
+
<PageButton
|
|
233
|
+
page={item.page}
|
|
234
|
+
type="jump-next"
|
|
235
|
+
disabled={disabled}
|
|
236
|
+
onClick={handlePageChange}
|
|
237
|
+
aria-label={locale.next5}
|
|
238
|
+
>
|
|
239
|
+
{'•••'}
|
|
240
|
+
</PageButton>,
|
|
241
|
+
)}
|
|
242
|
+
</li>
|
|
243
|
+
)
|
|
244
|
+
}
|
|
237
245
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
<li
|
|
241
|
-
key="jump-next"
|
|
242
|
-
className={cn('apex-pagination__item', 'apex-pagination__item--jump-next')}
|
|
243
|
-
data-slot="pagination-item-jump-next"
|
|
244
|
-
>
|
|
245
|
-
{renderItem(
|
|
246
|
-
item.page,
|
|
247
|
-
'jump-next',
|
|
248
|
-
<PageButton
|
|
249
|
-
page={item.page}
|
|
250
|
-
type="jump-next"
|
|
251
|
-
disabled={disabled}
|
|
252
|
-
onClick={handlePageChange}
|
|
253
|
-
aria-label={locale.next5}
|
|
254
|
-
>
|
|
255
|
-
{'•••'}
|
|
256
|
-
</PageButton>,
|
|
257
|
-
)}
|
|
258
|
-
</li>
|
|
259
|
-
)
|
|
260
|
-
}
|
|
246
|
+
return null
|
|
247
|
+
})}
|
|
261
248
|
|
|
262
|
-
|
|
263
|
-
|
|
249
|
+
{/* next – same pattern as prev (C2) */}
|
|
250
|
+
<li
|
|
251
|
+
className={cn('apex-pagination__item', 'apex-pagination__item--next')}
|
|
252
|
+
data-slot="pagination-item-next"
|
|
253
|
+
{...(isNextDisabled ? { 'data-disabled': '' } : {})}
|
|
254
|
+
>
|
|
255
|
+
{renderItem(
|
|
256
|
+
safeCurrent + 1,
|
|
257
|
+
'next',
|
|
258
|
+
<PageButton
|
|
259
|
+
page={safeCurrent + 1}
|
|
260
|
+
type="next"
|
|
261
|
+
disabled={isNextDisabled}
|
|
262
|
+
onClick={handlePageChange}
|
|
263
|
+
aria-label={locale.nextPage}
|
|
264
|
+
>
|
|
265
|
+
{'›'}
|
|
266
|
+
</PageButton>,
|
|
267
|
+
)}
|
|
268
|
+
</li>
|
|
269
|
+
</ul>
|
|
264
270
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
<PageButton
|
|
275
|
-
page={safeCurrent + 1}
|
|
276
|
-
type="next"
|
|
277
|
-
disabled={isNextDisabled}
|
|
278
|
-
onClick={handlePageChange}
|
|
279
|
-
aria-label={locale.nextPage}
|
|
280
|
-
>
|
|
281
|
-
{'›'}
|
|
282
|
-
</PageButton>,
|
|
283
|
-
)}
|
|
284
|
-
</li>
|
|
285
|
-
</ul>
|
|
286
|
-
|
|
287
|
-
{showSizeChangerFinal && (
|
|
288
|
-
<PageSizeChanger
|
|
289
|
-
pageSize={pageSize}
|
|
290
|
-
onChange={handlePageSizeChange}
|
|
291
|
-
options={pageSizeOptions}
|
|
292
|
-
/>
|
|
293
|
-
)}
|
|
271
|
+
{showSizeChangerFinal && (
|
|
272
|
+
<PageSizeChanger
|
|
273
|
+
pageSize={pageSize}
|
|
274
|
+
onChange={handlePageSizeChange}
|
|
275
|
+
options={pageSizeOptions}
|
|
276
|
+
/>
|
|
277
|
+
)}
|
|
278
|
+
</nav>
|
|
279
|
+
)
|
|
294
280
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
currentPage={safeCurrent}
|
|
298
|
-
totalPages={totalPages}
|
|
299
|
-
onJump={handlePageChange}
|
|
300
|
-
/>
|
|
301
|
-
)}
|
|
302
|
-
</nav>
|
|
303
|
-
</PaginationContext.Provider>
|
|
281
|
+
return (
|
|
282
|
+
<PaginationContext.Provider value={contextValue}>{paginationNav}</PaginationContext.Provider>
|
|
304
283
|
)
|
|
305
284
|
}
|
|
306
285
|
|
|
@@ -31,9 +31,9 @@ export interface PaginationProps {
|
|
|
31
31
|
* 未传 → total > 50 时自动 true;显式 false → 永远关;显式 true → 永远开
|
|
32
32
|
*/
|
|
33
33
|
showSizeChanger?: boolean
|
|
34
|
-
/**
|
|
34
|
+
/** 兼容旧调用方;当前 React 设计不渲染快速跳转输入 */
|
|
35
35
|
showQuickJumper?: boolean
|
|
36
|
-
/**
|
|
36
|
+
/** 兼容旧调用方;当前 React 设计不渲染总数区域 */
|
|
37
37
|
showTotal?: ShowTotalFn
|
|
38
38
|
/** 总页数 ≤ 1 时不渲染整个组件 @default false */
|
|
39
39
|
hideOnSinglePage?: boolean
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Pagination:数据量较大、需要分批次浏览列表或表格时。
|
|
4
4
|
|
|
5
|
-
版本:`1.2.
|
|
5
|
+
版本:`1.2.2`。组件源码在本目录,属于当前项目。
|
|
6
6
|
|
|
7
7
|
公开导出:`Pagination`。
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ export default () => <Pagination total={85} defaultCurrent={1} />
|
|
|
19
19
|
## 何时使用
|
|
20
20
|
|
|
21
21
|
- 数据量较大、需要分批次浏览列表或表格时。
|
|
22
|
-
-
|
|
22
|
+
- 需要让用户切换每页条数时;Vue 版也支持快速跳转到指定页。
|
|
23
23
|
- 纯滚动加载场景不必使用 Pagination;仅一页时可配合 `hideOnSinglePage` 隐藏分页器。
|
|
24
24
|
|
|
25
25
|
## API
|
|
@@ -40,8 +40,8 @@ export default () => <Pagination total={85} defaultCurrent={1} />
|
|
|
40
40
|
| pageSizeOptions | pageSize 切换器的可选档位。 | `number[]` | 否 | `[10, 20, 50, 100]` |
|
|
41
41
|
| disabled | 整体禁用 | `boolean` | 否 | `false` |
|
|
42
42
|
| showSizeChanger | 显示 pageSize 切换器。<br>未传 → total > 50 时自动 true;显式 false → 永远关;显式 true → 永远开 | `boolean` | 否 | — |
|
|
43
|
-
| showQuickJumper |
|
|
44
|
-
| showTotal |
|
|
43
|
+
| showQuickJumper | 兼容旧调用方;当前 React 设计不渲染快速跳转输入 | `boolean` | 否 | — |
|
|
44
|
+
| showTotal | 兼容旧调用方;当前 React 设计不渲染总数区域 | `ShowTotalFn` | 否 | — |
|
|
45
45
|
| hideOnSinglePage | 总页数 ≤ 1 时不渲染整个组件 | `boolean` | 否 | `false` |
|
|
46
46
|
| itemRender | 自定义每项渲染。<br>所有可点项(prev/next/jump-prev/jump-next/page)都调用此函数。<br>业务方应用 React.cloneElement(originalElement, ...) 保留 a11y props。 | `ItemRender` | 否 | — |
|
|
47
47
|
| responsive | 开启容器宽度自适应(ResizeObserver 四档)。 | `boolean` | 否 | `false` |
|
|
@@ -87,7 +87,7 @@ type PageItemType = 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next'
|
|
|
87
87
|
|
|
88
88
|
### 每页条数切换
|
|
89
89
|
|
|
90
|
-
数据量较大时(默认 `total > 50`)会自动显示条数切换器,也可通过 `showSizeChanger`
|
|
90
|
+
数据量较大时(默认 `total > 50`)会自动显示条数切换器,也可通过 `showSizeChanger` 强制开启或关闭。
|
|
91
91
|
|
|
92
92
|
```tsx
|
|
93
93
|
import { Pagination } from '@/components/apex/pagination'
|
|
@@ -132,7 +132,9 @@ export default () => {
|
|
|
132
132
|
}
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
###
|
|
135
|
+
### 受控用法 (quick-jumper)
|
|
136
|
+
|
|
137
|
+
**快速跳转**
|
|
136
138
|
|
|
137
139
|
`showQuickJumper` 展示跳转输入框,输入页码后按 Enter 跳转。
|
|
138
140
|
|
|
@@ -155,14 +157,21 @@ export default () => {
|
|
|
155
157
|
}
|
|
156
158
|
```
|
|
157
159
|
|
|
158
|
-
###
|
|
160
|
+
### 受控用法 (show-total)
|
|
161
|
+
|
|
162
|
+
**显示总数**
|
|
159
163
|
|
|
160
164
|
`showTotal` 自定义总数展示文案,接收 `(total, range) => 自定义节点`。
|
|
161
165
|
|
|
162
166
|
```tsx
|
|
163
167
|
import { Pagination } from '@/components/apex/pagination'
|
|
164
168
|
|
|
165
|
-
export default () =>
|
|
169
|
+
export default () => (
|
|
170
|
+
<Pagination
|
|
171
|
+
total={128}
|
|
172
|
+
showTotal={(total, range) => `共 ${total} 条,当前 ${range[0]}-${range[1]}`}
|
|
173
|
+
/>
|
|
174
|
+
)
|
|
166
175
|
```
|
|
167
176
|
|
|
168
177
|
### 禁用
|
|
@@ -197,7 +206,7 @@ export default () => <Pagination total={50} disabled />
|
|
|
197
206
|
|
|
198
207
|
### `responsive` 如何工作?
|
|
199
208
|
|
|
200
|
-
开启后组件通过 ResizeObserver
|
|
209
|
+
开启后组件通过 ResizeObserver 监听容器宽度,按阈值自动调整布局;Vue 版会逐步隐藏总数与条数切换器,React 版只调整当前实际渲染的控件。默认 `false`,须显式传入 `responsive`。
|
|
201
210
|
|
|
202
211
|
### `pageSizeOptions` 可以自定义吗?
|
|
203
212
|
|
|
@@ -16,6 +16,20 @@
|
|
|
16
16
|
--pagination-button-spacing-height: var(--pagination-height);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/* `showTotal` is rendered beside the nav so the total never inherits the
|
|
20
|
+
paginator surface background. The pagination classes keep the generated
|
|
21
|
+
component tokens available to the total text without painting this shell. */
|
|
22
|
+
.apex-pagination__root.apex-pagination {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: var(--pagination-spacing-gap-text, var(--apex-spacing-16));
|
|
26
|
+
padding: 0;
|
|
27
|
+
border: 0;
|
|
28
|
+
border-radius: 0;
|
|
29
|
+
background: transparent;
|
|
30
|
+
height: auto;
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
/* 根容器 */
|
|
20
34
|
:where(.apex-pagination) {
|
|
21
35
|
display: inline-flex;
|
|
@@ -24,12 +38,13 @@
|
|
|
24
38
|
padding: var(--pagination-spacing-padding-y) var(--pagination-spacing-padding-x);
|
|
25
39
|
border-radius: var(--pagination-radius-radius);
|
|
26
40
|
background-color: var(--pagination-fill-default);
|
|
41
|
+
border: 1px solid var(--pagination-stroke-default);
|
|
27
42
|
margin: 0;
|
|
28
43
|
box-sizing: border-box;
|
|
29
44
|
width: fit-content;
|
|
30
|
-
height: calc(
|
|
45
|
+
min-height: calc(
|
|
31
46
|
var(--pagination-height) + var(--pagination-spacing-padding-y) +
|
|
32
|
-
var(--pagination-spacing-padding-y)
|
|
47
|
+
var(--pagination-spacing-padding-y) + 2px
|
|
33
48
|
);
|
|
34
49
|
}
|
|
35
50
|
|
|
@@ -62,6 +77,7 @@
|
|
|
62
77
|
.apex-pagination__total {
|
|
63
78
|
white-space: nowrap;
|
|
64
79
|
flex-shrink: 0;
|
|
80
|
+
color: var(--pagination-text-default);
|
|
65
81
|
}
|
|
66
82
|
|
|
67
83
|
/* 页码列表 */
|
|
@@ -88,10 +104,10 @@
|
|
|
88
104
|
display: inline-flex;
|
|
89
105
|
align-items: center;
|
|
90
106
|
justify-content: center;
|
|
91
|
-
min-width:var(--pagination-button-spacing-width);
|
|
92
|
-
width:
|
|
93
|
-
padding:
|
|
94
|
-
height:var(--pagination-button-spacing-height);
|
|
107
|
+
min-width: var(--pagination-button-spacing-width);
|
|
108
|
+
width: var(--pagination-button-spacing-width);
|
|
109
|
+
padding: 0;
|
|
110
|
+
height: var(--pagination-button-spacing-height);
|
|
95
111
|
border-radius: var(--pagination-button-radius-radius);
|
|
96
112
|
background-color: var(--pagination-button-fill-default);
|
|
97
113
|
border: none;
|
|
@@ -115,6 +131,39 @@
|
|
|
115
131
|
color: var(--pagination-button-text-active);
|
|
116
132
|
}
|
|
117
133
|
|
|
134
|
+
/* Figma uses a 16px single-line chevron for previous/next controls. Keep the
|
|
135
|
+
text fallback in the DOM for custom renderers, but draw the visual glyph
|
|
136
|
+
with the pagination icon color token. */
|
|
137
|
+
.apex-pagination-button[data-pagination-type='prev']::before,
|
|
138
|
+
.apex-pagination-button[data-pagination-type='next']::before {
|
|
139
|
+
content: '';
|
|
140
|
+
width: 6px;
|
|
141
|
+
height: 6px;
|
|
142
|
+
border: 0 solid currentColor;
|
|
143
|
+
border-inline-start-width: 1.5px;
|
|
144
|
+
border-block-end-width: 1.5px;
|
|
145
|
+
flex-shrink: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.apex-pagination-button[data-pagination-type='prev']::before {
|
|
149
|
+
transform: rotate(45deg);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.apex-pagination-button[data-pagination-type='next']::before {
|
|
153
|
+
transform: rotate(225deg);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.apex-pagination-button[data-pagination-type='prev'] .apex-button__content,
|
|
157
|
+
.apex-pagination-button[data-pagination-type='next'] .apex-button__content {
|
|
158
|
+
position: absolute;
|
|
159
|
+
width: 1px;
|
|
160
|
+
height: 1px;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
clip: rect(0 0 0 0);
|
|
163
|
+
clip-path: inset(50%);
|
|
164
|
+
white-space: nowrap;
|
|
165
|
+
}
|
|
166
|
+
|
|
118
167
|
.apex-pagination-button:focus-visible {
|
|
119
168
|
outline: 2px solid var(--pagination-button-fill-active);
|
|
120
169
|
}
|
|
@@ -225,17 +274,7 @@
|
|
|
225
274
|
|
|
226
275
|
/* ── responsive 隐藏规则(display: none;H8:不做动画)────────────────────── */
|
|
227
276
|
|
|
228
|
-
.apex-pagination[data-responsive-mode='xs'] .apex-pagination__total,
|
|
229
277
|
.apex-pagination[data-responsive-mode='xs'] .apex-pagination__size-changer,
|
|
230
|
-
.apex-pagination[data-responsive-mode='
|
|
231
|
-
display: none;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.apex-pagination[data-responsive-mode='sm'] .apex-pagination__size-changer,
|
|
235
|
-
.apex-pagination[data-responsive-mode='sm'] .apex-pagination__jumper {
|
|
236
|
-
display: none;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.apex-pagination[data-responsive-mode='md'] .apex-pagination__jumper {
|
|
278
|
+
.apex-pagination[data-responsive-mode='sm'] .apex-pagination__size-changer {
|
|
240
279
|
display: none;
|
|
241
280
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Pagination Token 明细
|
|
2
2
|
|
|
3
|
-
包:`@apexhub/apex-ui-react`;版本:`1.2.
|
|
3
|
+
包:`@apexhub/apex-ui-react`;版本:`1.2.2`(当前源码快照)。
|
|
4
4
|
|
|
5
5
|
按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
|
|
6
6
|
|
|
@@ -22,12 +22,14 @@
|
|
|
22
22
|
| `--pagination-button-radius-radius` | `border-radius` | `var(--apex-radius-8)` | `.apex-pagination-button.apex-default-pagination-button` |
|
|
23
23
|
| `--pagination-button-spacing-height` | `height` | `var(--apex-size-28)` | `.apex-pagination-button.apex-default-pagination-button` |
|
|
24
24
|
| `--pagination-button-spacing-height` | `height` | `var(--pagination-height)` | `.apex-pagination.apex-default-pagination` |
|
|
25
|
-
| `--pagination-button-spacing-
|
|
26
|
-
| `--pagination-button-spacing-width` | `min-width` | `var(--apex-size-28)` | `.apex-pagination-button.apex-default-pagination-button` |
|
|
25
|
+
| `--pagination-button-spacing-width` | `min-width`、`width` | `var(--apex-size-28)` | `.apex-pagination-button.apex-default-pagination-button` |
|
|
27
26
|
| `--pagination-button-text-active` | `color` | `var(--apex-text-neutral-primary)` | `.apex-pagination-button.apex-default-pagination-button` |
|
|
28
27
|
| `--pagination-button-text-hover` | `color` | `var(--apex-text-neutral-primary)` | `.apex-pagination-button.apex-default-pagination-button` |
|
|
29
28
|
| `--pagination-fill-default` | `background-color` | `var(--apex-fill-neutral-secondary)` | `.apex-pagination.apex-default-pagination` |
|
|
30
29
|
| `--pagination-radius-radius` | `border-radius` | `var(--apex-radius-8)` | `.apex-pagination.apex-default-pagination` |
|
|
31
30
|
| `--pagination-spacing-gap` | `gap` | `var(--apex-spacing-4)` | `.apex-pagination.apex-default-pagination` |
|
|
31
|
+
| `--pagination-spacing-gap-text` | `gap` | `var(--apex-spacing-16)` | `.apex-pagination.apex-default-pagination` |
|
|
32
32
|
| `--pagination-spacing-padding-x` | `padding` | `var(--apex-spacing-4)` | `.apex-pagination.apex-default-pagination` |
|
|
33
|
-
| `--pagination-spacing-padding-y` | `height`、`padding` | `var(--apex-spacing-4)` | `.apex-pagination.apex-default-pagination` |
|
|
33
|
+
| `--pagination-spacing-padding-y` | `min-height`、`padding` | `var(--apex-spacing-4)` | `.apex-pagination.apex-default-pagination` |
|
|
34
|
+
| `--pagination-stroke-default` | `border` | `var(--apex-stroke-neutral-tertiary)` | `.apex-pagination.apex-default-pagination` |
|
|
35
|
+
| `--pagination-text-default` | `color` | `var(--apex-text-neutral-disabled)` | `.apex-pagination.apex-default-pagination` |
|
|
@@ -274,6 +274,7 @@ export const Popover: React.FC<PopoverProps> = ({
|
|
|
274
274
|
{mergedTriggerChild}
|
|
275
275
|
</span>
|
|
276
276
|
|
|
277
|
+
{/* Theme scopes Tooltip surface tokens to these classes. */}
|
|
277
278
|
<AnchoredOverlayContent
|
|
278
279
|
overlay={overlay}
|
|
279
280
|
overlayKind="popover"
|
|
@@ -284,7 +285,14 @@ export const Popover: React.FC<PopoverProps> = ({
|
|
|
284
285
|
}}
|
|
285
286
|
data-slot="popover-content"
|
|
286
287
|
data-placement={placement}
|
|
287
|
-
className={cn(
|
|
288
|
+
className={cn(
|
|
289
|
+
'apex-popover',
|
|
290
|
+
'apex-default-popover',
|
|
291
|
+
'apex-tooltip',
|
|
292
|
+
'apex-default-tooltip',
|
|
293
|
+
'shadow',
|
|
294
|
+
className,
|
|
295
|
+
)}
|
|
288
296
|
// Portal events retain their React ancestry. Prevent interactions inside the
|
|
289
297
|
// popover from bubbling into a clickable parent of the trigger (for example,
|
|
290
298
|
// Select's selector when an overflow-tag preview covers it).
|
|
@@ -320,8 +328,8 @@ export const Popover: React.FC<PopoverProps> = ({
|
|
|
320
328
|
<svg
|
|
321
329
|
data-slot="popover-arrow"
|
|
322
330
|
className="apex-popover__arrow"
|
|
323
|
-
width={
|
|
324
|
-
height={
|
|
331
|
+
width={14}
|
|
332
|
+
height={7}
|
|
325
333
|
viewBox="0 0 30 10"
|
|
326
334
|
preserveAspectRatio="none"
|
|
327
335
|
aria-hidden
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Popover:需要在触发元素旁展示标题 + 正文,且正文内可包含链接、按钮等可交互元素时。
|
|
4
4
|
|
|
5
|
-
版本:`1.2.
|
|
5
|
+
版本:`1.2.2`。组件源码在本目录,属于当前项目。
|
|
6
6
|
|
|
7
7
|
公开导出:`Popover`。
|
|
8
8
|
|
|
@@ -27,7 +27,7 @@ export default () => (
|
|
|
27
27
|
|
|
28
28
|
- 需要在触发元素旁展示标题 + 正文,且正文内可包含链接、按钮等可交互元素时。
|
|
29
29
|
- 点击或悬停展开补充说明、快捷操作面板时。
|
|
30
|
-
-
|
|
30
|
+
- 默认内容适合简短的补充信息;宽面板可通过 `className` 调整宽度,并在接近可用边界时自动收缩。
|
|
31
31
|
- 若只需单行文字提示、无交互内容,请使用 Tooltip,而不是 Popover。
|
|
32
32
|
|
|
33
33
|
## API
|
|
@@ -232,4 +232,4 @@ v1 仅支持单值触发方式,避免组合触发带来的状态复杂度;
|
|
|
232
232
|
|
|
233
233
|
### Popover 内容有固定最大宽度吗?
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
React Popover 默认最小宽度为 80px、最大宽度为 420px,并受浮层可用空间限制。需要更宽的业务面板时,可通过 `className` 覆盖最大宽度,并确保内容在可用空间内布局。
|