docs(components): update method and parameter descriptions (#18075)

This commit is contained in:
Brandy Carney
2019-04-23 12:59:25 -04:00
committed by GitHub
parent bd96491d03
commit 464ec3b70a
56 changed files with 879 additions and 644 deletions

View File

@ -343,13 +343,9 @@ export default Example;
### `checkEnd() => void`
This method marks the tail the items array as dirty, so they can be re-rendered.
It's equivalent to calling:
```js
* virtualScroll.checkRange(lastItemLen);
* ```
Marks the tail of the items array as dirty, so they can be re-rendered.
It's equivalent to calling `checkRange(length)` where `length` is the
total length of the items.
#### Returns
@ -357,19 +353,21 @@ Type: `void`
### `checkRange(offset: number, len?: number) => void`
### `checkRange(offset: number, length?: number) => void`
This method marks a subset of items as dirty, so they can be re-rendered. Items should be marked as
dirty any time the content or their style changes.
Marks a subset of the items as dirty so they can be re-rendered.
Items should be marked as dirty any time the content or their style changes.
The subset of items to be updated can are specifing by an offset and a length.
The subset of items to be updated are specified by an offset and a length.
If a length is not provided it will check all of the items beginning at
the offset.
#### Parameters
| Name | Type | Description |
| -------- | -------- | ----------- |
| `offset` | `number` | |
| `len` | `number` | |
| Name | Type | Description |
| -------- | -------- | --------------------------------------------- |
| `offset` | `number` | The index of the item to start marking dirty. |
| `length` | `number` | The number of items to mark dirty. |
#### Returns
@ -383,9 +381,9 @@ Returns the position of the virtual item at the given index.
#### Parameters
| Name | Type | Description |
| ------- | -------- | ----------- |
| `index` | `number` | |
| Name | Type | Description |
| ------- | -------- | ---------------------- |
| `index` | `number` | The index of the item. |
#### Returns

View File

@ -177,6 +177,8 @@ export class VirtualScroll implements ComponentInterface {
/**
* Returns the position of the virtual item at the given index.
*
* @param index The index of the item.
*/
@Method()
positionForItem(index: number): Promise<number> {
@ -184,21 +186,26 @@ export class VirtualScroll implements ComponentInterface {
}
/**
* This method marks a subset of items as dirty, so they can be re-rendered. Items should be marked as
* dirty any time the content or their style changes.
* Marks a subset of the items as dirty so they can be re-rendered.
* Items should be marked as dirty any time the content or their style changes.
*
* The subset of items to be updated can are specifing by an offset and a length.
* The subset of items to be updated are specified by an offset and a length.
* If a length is not provided it will check all of the items beginning at
* the offset.
*
* @param offset The index of the item to start marking dirty.
* @param length The number of items to mark dirty.
*/
@Method()
checkRange(offset: number, len = -1) {
checkRange(offset: number, length = -1) {
// TODO: kind of hacky how we do in-place updated of the cells
// array. this part needs a complete refactor
if (!this.items) {
return;
}
const length = (len === -1)
const len = (length === -1)
? this.items.length - offset
: len;
: length;
const cellIndex = findCellIndex(this.cells, offset);
const cells = calcCells(
@ -209,7 +216,7 @@ export class VirtualScroll implements ComponentInterface {
this.approxHeaderHeight,
this.approxFooterHeight,
this.approxItemHeight,
cellIndex, offset, length
cellIndex, offset, len
);
console.debug('[virtual] cells recalculated', cells.length);
this.cells = inplaceUpdate(this.cells, cells, cellIndex);
@ -220,13 +227,9 @@ export class VirtualScroll implements ComponentInterface {
}
/**
* This method marks the tail the items array as dirty, so they can be re-rendered.
*
* It's equivalent to calling:
*
* ```js
* virtualScroll.checkRange(lastItemLen);
* ```
* Marks the tail of the items array as dirty, so they can be re-rendered.
* It's equivalent to calling `checkRange(length)` where `length` is the
* total length of the items.
*/
@Method()
checkEnd() {