-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(virtual-scroll): fix several small bugs #13597
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
fixes include: * ensure content wrapper is at least as wide as the viewport * run change detection when data source emits but the data length remains the same * improve error message when no virtual scroll strategy is provided * add docs on using a custom virtual scroll strategy
throw Error('Error cdk-virtual-scroll-viewport: You must specify a VirtualScrollStrategy.' + | ||
' Either set the itemSize property or see the "Scrolling strategies" section at' + | ||
' https://material.angular.io/cdk/scrolling for more on setting a virtual' + | ||
' scrolling strategy'); |
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.
Since only the fixed-size is supported directly, I would just make the error
cdk-virtual-scroll-viewport requires the "itemSize" property to be set.
When autoSize
is supported, the message can be updated. Even though you can also specify a custom strategy, I believe 99% of users will only ever use the built-in ones.
src/cdk/scrolling/scrolling.md
Outdated
same API as [`*ngFor`](https://angular.io/api/common/NgForOf). In addition to the viewport and | ||
virtual for, a `VirtualScrollStrategy` must be provided to the viewport. This is most easily | ||
accomplished by setting the `itemSize` property on the viewport (for more see | ||
[scrolling strategies](#scrolling-strategies)). The simplest usage just specifies the list of items: |
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.
In this section of the docs, I wouldn't mention the strategy and just say that itemSize
is required. Then, in the section below you can talk about custom 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.
LGTM
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
src/cdk/scrolling/scrolling.md
Outdated
@@ -111,3 +111,13 @@ that the parent does not introduce additional space (e.g. via `margin` or `paddi | |||
interfere with the scrolling. | |||
|
|||
<!-- example(cdk-virtual-scroll-dl) --> | |||
|
|||
### Scrolling strategies | |||
In order to determine how large the overall content is and what porting of it actually needs to be |
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.
porting -> portion
src/cdk/scrolling/scrolling.md
Outdated
### Scrolling strategies | ||
In order to determine how large the overall content is and what porting of it actually needs to be | ||
rendered at any given time the viewport relies on a `VirtualScrollStrategy` being provided. The | ||
simplest way to provide this is to use the `itemSize` directive on the viewport |
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 -> it
@Optional() dir: Directionality, | ||
scrollDispatcher: ScrollDispatcher) { | ||
super(elementRef, scrollDispatcher, ngZone, dir); | ||
|
||
if (!this._scrollStrategy) { |
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.
Since it's the constructor you can use just if (!_scrollStrategy)
.
src/cdk/scrolling/scrolling.md
Outdated
|
||
<!-- example(cdk-virtual-scroll-overview) --> | ||
|
||
`*cdkVirtualFor` makes the following context variables available to the template: |
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 like this line got duplicated.
* fix(virtual-scroll): fix several small bugs fixes include: * ensure content wrapper is at least as wide as the viewport * run change detection when data source emits but the data length remains the same * improve error message when no virtual scroll strategy is provided * add docs on using a custom virtual scroll strategy * address comments * address feedback
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. |
fixes include: