-
Notifications
You must be signed in to change notification settings - Fork 4
Feature: custom pagination page select #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
597114f
abc3129
97c9e3b
f6df696
34c9bed
804dc25
346429b
2483e6c
6199c8d
422b140
d6d03f9
4a371c6
7f89f7e
d5a4503
11a0ed1
b697eed
727daef
eeca5f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,7 +29,12 @@ import Row from "./components/Row"; | |||||||||
| import useRowSelection from "./hooks/useRowSelection"; | ||||||||||
| import styles from "./BulkEditTable.module.less"; | ||||||||||
| import CustomTablePagination from "../tables/components/CustomTablePagination"; | ||||||||||
| import parsePaginationPosition from "../tables/components/pagination-position"; | ||||||||||
| import showConfirmDialog from "../showConfirmDialog"; | ||||||||||
| import { | ||||||||||
| RESPONSIVE_TABLE_SX, | ||||||||||
| getActionsMenuBreakpoint | ||||||||||
| } from "../tables/components/table-styles"; | ||||||||||
|
|
||||||||||
| const BulkEditTable = ({ | ||||||||||
| options, | ||||||||||
|
|
@@ -42,6 +47,8 @@ const BulkEditTable = ({ | |||||||||
| currentPage, | ||||||||||
| onPageChange, | ||||||||||
| onPerPageChange, | ||||||||||
| paginationPosition, | ||||||||||
| pageSliderVisible, | ||||||||||
| idKey, | ||||||||||
| onEdit, | ||||||||||
| onDelete, | ||||||||||
|
|
@@ -64,6 +71,9 @@ const BulkEditTable = ({ | |||||||||
| reset | ||||||||||
| } = useRowSelection(idKey); | ||||||||||
|
|
||||||||||
| const collapseActions = (onEdit ? 1 : 0) + (onDelete ? 1 : 0) >= 2; | ||||||||||
| const actionsBreakpoint = getActionsMenuBreakpoint(columns.length); | ||||||||||
|
|
||||||||||
| const dataIds = data.map((row) => row[idKey]).join(","); | ||||||||||
|
|
||||||||||
| // reset selection/edit state whenever the set of rows shown changes | ||||||||||
|
|
@@ -108,22 +118,50 @@ const BulkEditTable = ({ | |||||||||
| } | ||||||||||
| }; | ||||||||||
|
|
||||||||||
| const showPagination = !!(perPage && currentPage && onPageChange); | ||||||||||
| const { showTop, showBottom } = parsePaginationPosition(paginationPosition); | ||||||||||
| const renderPagination = (showRange) => ( | ||||||||||
| <CustomTablePagination | ||||||||||
| totalRows={totalRows} | ||||||||||
| perPage={perPage} | ||||||||||
| currentPage={currentPage} | ||||||||||
| onPageChange={onPageChange} | ||||||||||
| onPerPageChange={onPerPageChange} | ||||||||||
| showRange={showRange} | ||||||||||
| pageSliderVisible={pageSliderVisible} | ||||||||||
| /> | ||||||||||
| ); | ||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <Box sx={{ width: "100%" }}> | ||||||||||
| <Toolbar | ||||||||||
| editEnabled={editEnabled} | ||||||||||
| hasSelection={selectedRows.length > 0} | ||||||||||
| onEdit={enterEditMode} | ||||||||||
| onApply={handleUpdateEvents} | ||||||||||
| onCancel={cancel} | ||||||||||
| /> | ||||||||||
| <Box | ||||||||||
| sx={{ | ||||||||||
| display: "flex", | ||||||||||
| alignItems: "center", | ||||||||||
| justifyContent: "space-between", | ||||||||||
| flexWrap: "wrap", | ||||||||||
| gap: 1.5, | ||||||||||
| mb: 2 | ||||||||||
| }} | ||||||||||
| > | ||||||||||
| <Toolbar | ||||||||||
| editEnabled={editEnabled} | ||||||||||
| selectedCount={selectedRows.length} | ||||||||||
| onEdit={enterEditMode} | ||||||||||
| onApply={handleUpdateEvents} | ||||||||||
| onCancel={cancel} | ||||||||||
| /> | ||||||||||
| {showPagination && showTop && ( | ||||||||||
| <Box sx={{ display: { xs: "none", sm: "block" } }}>{renderPagination(false)}</Box> | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '35,175p' src/components/mui/BulkEditTable/BulkEditTable.js
sed -n '215,245p' src/components/mui/BulkEditTable/BulkEditTable.jsRepository: OpenStackweb/openstack-uicore-foundation Length of output: 5345 🏁 Script executed: sed -n '1,120p' src/components/mui/tables/components/pagination-position.jsRepository: OpenStackweb/openstack-uicore-foundation Length of output: 1311 Keep top-only pagination available on mobile. When Proposed fix- <Box sx={{ display: { xs: "none", sm: "block" } }}>{renderPagination(false)}</Box>
+ <Box sx={{ display: { xs: showBottom ? "none" : "block", sm: "block" } }}>
+ {renderPagination(false)}
+ </Box>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| )} | ||||||||||
| </Box> | ||||||||||
| <Paper elevation={0} sx={{ width: "100%", mb: 2 }}> | ||||||||||
| <TableContainer | ||||||||||
| component={Paper} | ||||||||||
| className={styles.tableWrapper} | ||||||||||
| sx={{ borderRadius: 0, boxShadow: "none" }} | ||||||||||
| > | ||||||||||
| <Table> | ||||||||||
| <Table sx={RESPONSIVE_TABLE_SX}> | ||||||||||
| <TableHead sx={{ backgroundColor: "#EAEDF4" }}> | ||||||||||
| <TableRow> | ||||||||||
| <TableCell | ||||||||||
|
|
@@ -142,7 +180,6 @@ const BulkEditTable = ({ | |||||||||
| </TableCell> | ||||||||||
| {columns.map((col, i) => { | ||||||||||
| const sortable = !!col.sortable; | ||||||||||
| const colWidth = col.width ?? ""; | ||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <Heading | ||||||||||
|
|
@@ -152,7 +189,7 @@ const BulkEditTable = ({ | |||||||||
| sortable={sortable} | ||||||||||
| columnIndex={i} | ||||||||||
| columnKey={col.columnKey} | ||||||||||
| width={colWidth} | ||||||||||
| col={col} | ||||||||||
| key={`heading_${col.columnKey}`} | ||||||||||
| > | ||||||||||
| {col.header ?? col.label ?? col.value} | ||||||||||
|
|
@@ -187,20 +224,14 @@ const BulkEditTable = ({ | |||||||||
| columns={columns} | ||||||||||
| onEdit={onEdit} | ||||||||||
| onDelete={onDelete ? handleDelete : null} | ||||||||||
| collapseActions={collapseActions} | ||||||||||
| actionsBreakpoint={actionsBreakpoint} | ||||||||||
| /> | ||||||||||
| ))} | ||||||||||
| </TableBody> | ||||||||||
| </Table> | ||||||||||
| </TableContainer> | ||||||||||
| {perPage && currentPage && onPageChange && ( | ||||||||||
| <CustomTablePagination | ||||||||||
| totalRows={totalRows} | ||||||||||
| perPage={perPage} | ||||||||||
| currentPage={currentPage} | ||||||||||
| onPageChange={onPageChange} | ||||||||||
| onPerPageChange={onPerPageChange} | ||||||||||
| /> | ||||||||||
| )} | ||||||||||
| {showPagination && showBottom && renderPagination(true)} | ||||||||||
| </Paper> | ||||||||||
| </Box> | ||||||||||
| ); | ||||||||||
|
|
@@ -218,6 +249,8 @@ BulkEditTable.propTypes = { | |||||||||
| currentPage: PropTypes.number, | ||||||||||
| onPageChange: PropTypes.func, | ||||||||||
| onPerPageChange: PropTypes.func, | ||||||||||
| paginationPosition: PropTypes.string, | ||||||||||
| pageSliderVisible: PropTypes.bool, | ||||||||||
| onEdit: PropTypes.func, | ||||||||||
| onDelete: PropTypes.func, | ||||||||||
| getName: PropTypes.func, | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: OpenStackweb/openstack-uicore-foundation
Length of output: 5073
🏁 Script executed:
Repository: OpenStackweb/openstack-uicore-foundation
Length of output: 1018
🤖 get_repo_knowledge executed:
get_repo_knowledge OpenStackweb/openstack-uicore-foundation /tmp/coderabbit-repo-knowledge/openstackweb-openstack-uicore-foundation-c47b4da1Length of output: 736
Use an unpublished package version.
The registry already contains
5.0.61-beta.8. Publishing this package version again will fail because npm does not allow an existing version to be overwritten. Select the next unpublished beta version according to the release process. Thelatesttag at5.0.62does not by itself require beta builds to satisfy^5.0.62.🤖 Prompt for AI Agents