Create Angular mixins for fractional-width columns and groupable columns #1587
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
🤨 Rationale
Resolves #1211
In Angular, we didn't have a solution for the code duplication that came with multiple columns being fractional width and groupable. This PR creates mixins for fractional width columns and groupable columns to reduce the amount of duplication. There is still the potential for future code reduction within the tests, but I decided that coming up to a solution single-sourcing more of our test code was out of scope for this PR.
👩💻 Implementation
mixinFractionalWidthColumnAPI
function that allows aNimbleTableColumnBaseDirective
to claim support for being fractional width (i.e. inputs forfractionalWidth
andminPixelWidth
). This function is exported from the existing@ni/nimble-angular/table-column
entry point.mixinGroupableColumnAPI
function that allows aNimbleTableColumnBaseDirective
to claim support for being groupable (i.e. inputs forgroupIndex
andgroupingDisabled
). This function is exported from the existing@ni/nimble-angular/table-column
entry point.renderer
andelementRef
public (though marked as internal) inNimbleTableColumnBaseDirective
because otherwise TS error 4094 is triggered. This is related to themixinFractionalWidthColumnAPI
andmixinGroupableColumnAPI
functions having an implicit return type and that inferred type includingNimbleTableColumnBaseDirective
. The scenario I was hitting is described in this TypeScript issue.🧪 Testing
✅ Checklist