-
Notifications
You must be signed in to change notification settings - Fork 8
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
Table #559
Table #559
Conversation
WIP: table working after renaming `mat` to `ts` WIP: working after adding directive/component suffix’ WIP: sorting working with MatSort WIP: copy/paste sort module working WIP: comments update, file names update, basic styles in place WIP: table usage docs WIP: clean up more, add TsSort docs WIP: setting up demo for fetching real data
Material removed the open/close event emitters in favor of a single \`openedChanged\` emitter. BREAKING CHANGE: 1. \`open\` and \`closed\` event emitters removed 2. \`change\` emitter renamed to match \`selectionChange\` to match the material API
BREAKING CHANGE: \`TsPaginationComponent\` has been renamed to \`TsPaginatorComponent\`
Codecov Report
@@ Coverage Diff @@
## master #559 +/- ##
======================================
Coverage 100% 100%
======================================
Files 37 45 +8
Lines 758 895 +137
Branches 143 158 +15
======================================
+ Hits 758 895 +137
Continue to review full report at Codecov.
|
@coreyterminator @atlwendy I'd love some extra eyes on this prior to merge. Especially on the markdown file denoting how to use the table. I want to make sure the table makes sense and is usable for you guys.
|
@coreyterminator @atlwendy I'm going ahead with this merge as it's got some items I need back in master. I would still love a review on the usage docs post-merge when you get time 🙏 |
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.
A lot here to digest/understand still... first patch of questions :)
(change)="isChanged($event)" | ||
[formControl]="myForm.get('myChoices1')" | ||
(openedChange)="openStateChange($event)" | ||
(selectionChange)="isChanged($event)" |
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.
Why is (close)
removed here?
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.
Material removed/changed a few of their event emitters to make their API consistent back during their 2.0.0
stable push. We just never picked up those changes until now.
Part of angular/components#6677
}); | ||
|
||
// Fetch new data anytime the sort is changed, the page is changed, or the records shown per | ||
// page is changed |
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.
You refetch new data even when page is changed? Would that be confusing to users if new data come in and mess with the page number?
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.
If we don't fetch new data, then there is no page change at all. We aren't paging through tons of rows locally; we are getting exactly the page we request from the server. So if the user clicks the pagination to go to the next page, we pass that 'next page' index to the server and ask for those records.
import { TsTableModule } from './table/table.module'; | ||
import { TsToggleModule } from './toggle/toggle.module'; | ||
import { TsTooltipModule } from './tooltip/tooltip.module'; | ||
import { TsValidationMessagesModule } from './validation-messages/validation-messages.module'; |
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.
The linter also reorder for you, alphabetically!
host: { | ||
class: 'ts-paginator', | ||
}, | ||
changeDetection: ChangeDetectionStrategy.OnPush, |
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.
Why is here .OnPush
- CheckOnce not CheckAlways?
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.
This basically tells Angular to only run change detection when an @Input
value changes. You are in essence promising to not do anything to mutate the state internally. This is much more performant since the change detection cycle doesn't have to check everything each time.
The few times where we need to do something internally in a component that uses this changeDetection
strategy we manually tell the change detector to check for changes using changeDetectorRef.markForCheck()
.
export type TsSortDirection | ||
= 'asc' | ||
| 'desc' | ||
| '' |
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.
Does ''
mean no sorting?
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.
Yep!
TODO: Generate docs before merge.
PR Overview
Pagination
toPaginator
ts-lint
fix with correct glob@angular/cdk/testing
)refactor
commit can now trigger a breaking changeThis release will include BREAKING CHANGES
TsPagination
(rename)TsSelect
(event emitters changed).