feat(web-core): create usePagination composable #8267
+195
−72
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Introduces new
usePagination
composable allowing to separate the pagination logic from the component and allow full control over it.All the logic has been removed from the
UiTablePagination
which now only declares props, model and events.The composable takes an
id
which is used in URL and localStorage. This allows managing multiple pagination on the same page.The "show by" setting is stored in local storage. It accepts the value
-1
, which means "all records".The pagination system is based on the record index, not on "page". This allows sharing a link to a user using another "show by" value.
To simplify usage, the composable returns a
paginationBindings
object intended to be used withUiTablePagination
:The composable also returns a
seek
method, allowing to find a specific record and navigate to the page where it is.The
pageRecords
property of this composable will contain only the subset of records for the current page.Checklist
Fixes #007
,See xoa-support#42
,See https://...
)Introduced by
CHANGELOG.unreleased.md
Review process
Notes: