akita
akita copied to clipboard
Expose PaginatorPlugin.pagination in the public interface
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[x] Support request
[ ] Other... Please describe:
Current behavior
Some of the information about current pagination state are private and cannot be easily accessed using PaginatorPlugin class interface.
More specifically this property PaginatorPlugin.pagination: https://github.com/datorama/akita/blob/a7f1015aedb258c21b708d0a63e8cbd5ccb7bf21/libs/akita/src/lib/plugins/paginator/paginatorPlugin.ts#L46
Expected behavior
Informations about the current state of the pagination like: perPage, total, lastPage, which are calculated and stored within the PaginatorPlugin are accessible with the class interface.
What is the motivation / use case for changing the behaviour?
Consider visual pagination components presenting information like:
- "Page 1 of 15"
- "Items found: 164"
Currently the implementation requires extending the Paginator or calculating the information elsewhere, despite it is already done but not publicly exposed in the PaginatorPlugin.
Environment
Angular version: 11.0.9
@datorama/akita: 6.2.0
You're getting it in the selectPage query: https://github.com/datorama/akita/blob/a7f1015aedb258c21b708d0a63e8cbd5ccb7bf21/libs/akita/src/lib/plugins/paginator/paginatorPlugin.ts#L323