-
Notifications
You must be signed in to change notification settings - Fork 2
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
Allow to provide initial order per DataTable column #1564
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1564 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 62 62
Lines 1036 1041 +5
Branches 394 397 +3
=========================================
+ Hits 1036 1041 +5 ☔ View full report in Codecov by Sentry. |
bd5a6b7
to
4eb0958
Compare
@@ -74,7 +74,7 @@ describe('DataTable', () => { | |||
); | |||
} | |||
|
|||
const createComponent = (Component, props = {}) => { | |||
const createComponent = ({ Component = DataTable, ...props } = {}) => { |
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.
Not directly related with the main changes in this PR, but to avoid duplicating createComponent(DataTable)
over and over, I added a new Component
pseudo-prop/option here, which defaults to DataTable
.
With this, we can just call createComponent()
or createComponent(props)
in most of the cases, and when a different component is needed, we can additionally pass createComponent({ Component: Whatever, ...otherProps })
.
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.
I had some feedback on the name, but looks good otherwise.
4eb0958
to
abd4469
Compare
Add a new
initialColumnsOrderDir
prop toDataTable
which is a partial record mapping column names with an order direction.When a column becomes ordered, instead of always defaulting to
ascending
order, we now first check if that column is defined there. If not defined, we fall back to initially order inascending
direction.default-order-dir-2024-05-27_14.22.45.mp4