-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(cdk/collections): extract view repeater strategies #19964
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
Conversation
4da1980
to
62829de
Compare
0706a2a
to
f8f33eb
Compare
5ea2236
to
7e50f47
Compare
src/cdk/table/table.ts
Outdated
providers: [{provide: CDK_TABLE, useExisting: CdkTable}] | ||
providers: [ | ||
{provide: CDK_TABLE, useExisting: CdkTable}, | ||
{provide: _VIEW_REPEATER_STRATEGY, useClass: DisposeViewRepeaterStrategy}, |
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.
Providing this directly might still end up with the problem of always including the code for DisposeViewRepeaterStrategy
even when it's not being used. Is this a temporary thing until we have a directive API for switching between rending strategies?
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.
Yes, this is temporary. The virtual scroll table PR will introduce a directive-based API to replace it.
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.
Cool- can you add a TODO here to make that explicit?
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.
Done
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
1 similar comment
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
ae357b4
to
8b99d2c
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
29e13bf
to
a02a01e
Compare
a02a01e
to
7235609
Compare
The failing tests are related to the MDC |
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.
LGTM
*/ | ||
export class _RecycleViewRepeaterStrategy<T, R, C extends _ViewRepeaterItemContext<T>> | ||
implements _ViewRepeater<T, R, C> { | ||
differ: IterableDiffer<C>; |
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.
Is this used anywhere? I don't see it
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 differ was abstracted out of the repeater strategy. I'll remove it.
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.
LGTM aside from minor remaining comments; I'll leave it to @mmalerba for final approval
src/cdk/scrolling/virtual-for-of.ts
Outdated
get cdkVirtualForTemplateCacheSize() { | ||
return this._viewRepeater.viewCacheSize; | ||
} | ||
set cdkVirtualForTemplateCacheSize(size: number | string) { |
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 should just be number
, and you can add this to the bottom of this class to tell Angular to accept other data types:
static ngAcceptInputType_cdkVirtualForTemplateCacheSize: NumberInput;
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.
Done
7235609
to
3bdeaff
Compare
@mmalerba The latest revisions are complete. |
@MichaelJamesParsons looks like the PR just needs to be rebased |
3bdeaff
to
261f1ba
Compare
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.
LGTM
Looks like there's a lint issue that needs to be fixed, otherwise ready to go |
261f1ba
to
3410779
Compare
…orOf and CDK table.
3410779
to
3c5137f
Compare
@googlebot ping |
In angular#19964 and angular#19750 some breaking constructor changes were made which eventually got released as a part of a patch branch which doesn't follow our breaking changes policy. These changes make the new constructor parameters optional and add fallbacks to the old behavior. Fixes angular#20422.
In angular#19964 and angular#19750 some breaking constructor changes were made which eventually got released as a part of a patch branch which doesn't follow our breaking changes policy. These changes make the new constructor parameters optional and add fallbacks to the old behavior. Fixes angular#20422.
In angular#19964 and angular#19750 some breaking constructor changes were made which eventually got released as a part of a patch branch which doesn't follow our breaking changes policy. These changes make the new constructor parameters optional and add fallbacks to the old behavior. Fixes angular#20422.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
A
ViewRepeater
implements a strategy for rendering a list of elements inside a commonViewContainerRef
. It encapsulates all the business logic pertaining to inserting, moving, and deleting embedded views. This PR extracts existing strategies fromvirtualForOf
and the CDK table, so we can reuse them in upcoming virtual scroll work.Summary
virtualForOf
and CDK table.virtualForOf
and CDK table to use the strategies.For now, this API will be internal until we've tested it with enough components to know it's stable.