You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create Angular mixins for fractional-width columns and groupable columns (#1587)
# 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
- Create `mixinFractionalWidthColumnAPI` function that allows a
`NimbleTableColumnBaseDirective` to claim support for being fractional
width (i.e. inputs for `fractionalWidth` and `minPixelWidth`). This
function is exported from the existing `@ni/nimble-angular/table-column`
entry point.
- Create `mixinGroupableColumnAPI` function that allows a
`NimbleTableColumnBaseDirective` to claim support for being groupable
(i.e. inputs for `groupIndex` and `groupingDisabled`). This function is
exported from the existing `@ni/nimble-angular/table-column` entry
point.
- Update existing table columns to use these new mixins
- These changes required making `renderer` and `elementRef` public
(though marked as internal) in `NimbleTableColumnBaseDirective` because
otherwise TS error 4094 is triggered. This is related to the
`mixinFractionalWidthColumnAPI` and `mixinGroupableColumnAPI` functions
having an implicit return type and that inferred type including
`NimbleTableColumnBaseDirective`. [The scenario I was hitting is
described in this TypeScript
issue](microsoft/TypeScript#30355).
## 🧪 Testing
- Verified existing unit tests are passing
- Verified Angular example app still works as expected
## ✅ Checklist
<!--- Review the list and put an x in the boxes that apply or ~~strike
through~~ around items that don't (along with an explanation). -->
- [ ] I have updated the project documentation to reflect my changes or
determined no changes are needed.
---------
Co-authored-by: Milan Raj <[email protected]>
Copy file name to clipboardExpand all lines: angular-workspace/projects/ni/nimble-angular/table-column/date-text/nimble-table-column-date-text.directive.ts
Copy file name to clipboardExpand all lines: angular-workspace/projects/ni/nimble-angular/table-column/enum-text/nimble-table-column-enum-text.directive.ts
0 commit comments