-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) - O3-3189 - add hook to handle server-side pagination (#1114)
* (feat) - O3-3189 - add hook to handle server-side pagination * add mocks * address PR comments
- Loading branch information
Showing
11 changed files
with
742 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/framework/esm-framework/docs/interfaces/OpenMRSPaginatedResponse.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[@openmrs/esm-framework](../API.md) / OpenMRSPaginatedResponse | ||
|
||
# Interface: OpenMRSPaginatedResponse<T\> | ||
|
||
## Type parameters | ||
|
||
| Name | | ||
| :------ | | ||
| `T` | | ||
|
||
## Table of contents | ||
|
||
### UI Properties | ||
|
||
- [links](OpenMRSPaginatedResponse.md#links) | ||
- [results](OpenMRSPaginatedResponse.md#results) | ||
- [totalCount](OpenMRSPaginatedResponse.md#totalcount) | ||
|
||
## UI Properties | ||
|
||
### links | ||
|
||
• **links**: { `rel`: ``"prev"`` \| ``"next"`` ; `uri`: `string` }[] | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerPagination.ts:8](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerPagination.ts#L8) | ||
|
||
___ | ||
|
||
### results | ||
|
||
• **results**: `T`[] | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerPagination.ts:7](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerPagination.ts#L7) | ||
|
||
___ | ||
|
||
### totalCount | ||
|
||
• **totalCount**: `number` | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerPagination.ts:9](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerPagination.ts#L9) |
127 changes: 127 additions & 0 deletions
127
packages/framework/esm-framework/docs/interfaces/UseServerInfiniteReturnObject.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
[@openmrs/esm-framework](../API.md) / UseServerInfiniteReturnObject | ||
|
||
# Interface: UseServerInfiniteReturnObject<T\> | ||
|
||
## Type parameters | ||
|
||
| Name | | ||
| :------ | | ||
| `T` | | ||
|
||
## Table of contents | ||
|
||
### UI Properties | ||
|
||
- [data](UseServerInfiniteReturnObject.md#data) | ||
- [error](UseServerInfiniteReturnObject.md#error) | ||
- [hasMore](UseServerInfiniteReturnObject.md#hasmore) | ||
- [isLoading](UseServerInfiniteReturnObject.md#isloading) | ||
- [isValidating](UseServerInfiniteReturnObject.md#isvalidating) | ||
- [mutate](UseServerInfiniteReturnObject.md#mutate) | ||
- [totalCount](UseServerInfiniteReturnObject.md#totalcount) | ||
|
||
### UI Methods | ||
|
||
- [loadMore](UseServerInfiniteReturnObject.md#loadmore) | ||
|
||
## UI Properties | ||
|
||
### data | ||
|
||
• **data**: `undefined` \| `T`[] | ||
|
||
The data fetched from the server so far. Note that this array contains | ||
the aggregate of data from all fetched pages. Unless hasMore == false, | ||
this array does not contain the complete data set. | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerInfinite.ts:13](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L13) | ||
|
||
___ | ||
|
||
### error | ||
|
||
• **error**: `any` | ||
|
||
from useSWRInfinite | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerInfinite.ts:33](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L33) | ||
|
||
___ | ||
|
||
### hasMore | ||
|
||
• **hasMore**: `boolean` | ||
|
||
Whether there are more results in the data set that have not been fetched yet. | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerInfinite.ts:23](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L23) | ||
|
||
___ | ||
|
||
### isLoading | ||
|
||
• **isLoading**: `boolean` | ||
|
||
from useSWRInfinite | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerInfinite.ts:48](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L48) | ||
|
||
___ | ||
|
||
### isValidating | ||
|
||
• **isValidating**: `boolean` | ||
|
||
from useSWRInfinite | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerInfinite.ts:43](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L43) | ||
|
||
___ | ||
|
||
### mutate | ||
|
||
• **mutate**: `KeyedMutator`<[`FetchResponse`](FetchResponse.md)<[`OpenMRSPaginatedResponse`](OpenMRSPaginatedResponse.md)<`T`\>\>[]\> | ||
|
||
from useSWRInfinite | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerInfinite.ts:38](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L38) | ||
|
||
___ | ||
|
||
### totalCount | ||
|
||
• **totalCount**: `undefined` \| `number` | ||
|
||
The total number of rows in the data set. | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerInfinite.ts:18](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L18) | ||
|
||
## UI Methods | ||
|
||
### loadMore | ||
|
||
▸ **loadMore**(): `void` | ||
|
||
callback function to make another fetch of next page's data set. | ||
|
||
#### Returns | ||
|
||
`void` | ||
|
||
#### Defined in | ||
|
||
[packages/framework/esm-react-utils/src/useServerInfinite.ts:28](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L28) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.