-
Notifications
You must be signed in to change notification settings - Fork 33
feat: DH-19413: Support expandable columns in grids v0.85 #2524
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
feat: DH-19413: Support expandable columns in grids v0.85 #2524
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/v0.85 #2524 +/- ##
=================================================
+ Coverage 47.36% 47.77% +0.41%
=================================================
Files 710 711 +1
Lines 39527 39632 +105
Branches 10064 9901 -163
=================================================
+ Hits 18721 18935 +214
+ Misses 20751 20684 -67
+ Partials 55 13 -42
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Looks good overall, just the one comment about how the type predicate probably shouldn't only return true
if hasExpandableColumns
is true
.
45891ec
to
44393cc
Compare
packages/iris-grid/src/mousehandlers/IrisGridContextMenuHandler.tsx
Outdated
Show resolved
Hide resolved
packages/iris-grid/src/IrisGrid.tsx
Outdated
if (width != null && name != null) { | ||
namedUserColumnWidths.set(name, width); | ||
} | ||
metricCalculator.resetColumnWidth(modelIndex); |
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.
We probably need to reset the calculated column width as well...
Really what we should do is allow for keys to be provided for both row and columns, and then methods can accept the keys instead of the model index... we're kind of gluing this on top by bringing the logic back up. Though I don't think we should do that all right now...
Though - I do think we can keep this contained in the IrisGridMetricCalculator
, by overriding getMetrics
, and doing something like:
getMetrics(state: IrisGridMetricState): GridMetrics {
const { model } = state;
// Check the column name map to see if we need to update things
const metrics = super.getMetrics(state);
// Update column name map
return metrics;
}
I think that would simplify things...
*/ | ||
setColumnWidth(column: ModelIndex, size: number): void { | ||
setColumnWidth( | ||
state: GridMetricState, |
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.
So we were discussing how this is a breaking change in GridMetricCalculator
... and I'm just going to put some of my thoughts here for posterity.
- At some point we probably should refactor the Grid API and clean things up, like a v2. Like some of the points on our Discussion board: Grid V2 #587
- If I were to refactor
GridMetricCalculator
, I think I would remove the set/getters for user column width, and just pass that in as part of the state (like everything else). That would be more consistent.- Probably also refactor all methods to be
protected
- so you can override functionality, but discourage calling it directly... the metrics should be stored/shared outside of the calculator.
- Probably also refactor all methods to be
- However, I'm not exactly keen on doing all that for this change...
- I think for this change, just retain the model from
getMetrics
, and use that... and if you have somewhere that's getting called first, just add a new method with the new signature, e.g.setColumnWidthWithState()
...
Thoughts?
164189a
to
0c1f05f
Compare
07b5aa0
to
76c5ad7
Compare
76c5ad7
to
19cc746
Compare
Merge this after #2537