Skip to content
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

feat: created use-query-pagination prop #1194

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Neste arquivo (CHANGELOG.MD) você encontrará somente as mudanças referentes a
### Sobre os "BREAKING CHANGES"
Podemos ter pequenas breaking changes sem alterar o `major` version, apesar de serem pequenas, podem alterar o comportamento da funcionalidade caso não seja feita uma atualização, **preste muita atenção** nas breaking changes dentro das versões quando existirem.

## Nao publicado
### Adicionado
- `QasListView`: adicionado prop `use-query-pagination` para a paginação ser controlada internamente no componente, para o uso quando temos o caso de ter mais de um `QasListView` na mesma página.

## [3.17.0-beta.8] - 30-09-2024
### Corrigido
- `QasChartView`: corrigido altura mínima ao fazer fetch.
Expand Down
26 changes: 26 additions & 0 deletions docs/src/examples/QasListView/InternalPagination.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<qas-list-view v-model:fields="viewState.fields" v-model:results="viewState.results" :entity :use-query-pagination="false">
<template #header>
<qas-page-header title="Lista de materiais" :use-breadcrumbs="false">
<qas-btn icon="sym_r_add" label="Novo [item]" />
</qas-page-header>
</template>

<template #default>
<qas-table-generator :columns :fields="viewState.fields" :results="viewState.results" row-key="uuid" />
</template>
</qas-list-view>
</template>

<script setup>
import { useView } from '@bildvitta/composables'

const { viewState } = useView({ mode: 'list' })

const columns = [
'name',
'company'
]

const entity = 'users'
</script>
5 changes: 5 additions & 0 deletions docs/src/pages/components/list-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ Agora ao fazer o fetch, o valor da url enviada para a action do fetchList será

<doc-example file="QasListView/BeforeFetch" title="Controlando fetch" />
<doc-example file="QasListView/ExAutoRefetchOnDelete" title="Controle de refetch ao deletar automático" />

:::info
Ao utilizar mais de um list-view na mesma página que tenha paginação, é recomendado o uso da prop `use-query-pagination` como `false`, para as queries da paginação não se conflitarem, mantendo o controle internamente no componente.
:::
<doc-example file="QasListView/InternalPagination" title="Controle interno da paginação" />
18 changes: 9 additions & 9 deletions docs/src/store/mocks/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
{
"uuid": "62fc0a79-ddea-45b5-8d21-be6f0502923296",
"isActive": false,
"isActive": true,
"company": "Sed occaecati cupiditate.",
"name": "Quaerat veritatis aut voluptatem enim.",
"email": "Jillian_Wilkinson97@gmail.com",
Expand All @@ -72,7 +72,7 @@
},
{
"uuid": "2f8856d0-8eca-4e41-8146-63ed2a4f23ff4c",
"isActive": false,
"isActive": true,
"company": "Dolores minus iusto quo et dolorem eveniet nesciunt.",
"name": "Maiores animi non asperiores recusandae dolor exercitationem ut.",
"email": "Rafael91@hotmail.com",
Expand All @@ -83,7 +83,7 @@
},
{
"uuid": "5bda242f-5e99-43dd-af6a-093d68cee1235f",
"isActive": false,
"isActive": true,
"company": "Excepturi ad nihil est.",
"name": "Ullam eligendi dolor a placeat.",
"email": "Katelyn_Bernhard76@gmail.com",
Expand All @@ -94,7 +94,7 @@
},
{
"uuid": "620c8045-acc8-4c53-b083-fe7ed991233cf5",
"isActive": false,
"isActive": true,
"company": "Quis ea voluptas recusandae omnis.",
"name": "Debitis maiores itaque sit et recusandae et eveniet.",
"email": "Syble42@yahoo.com",
Expand All @@ -105,7 +105,7 @@
},
{
"uuid": "82f18f90-d5f9-486f-8b7b-b95745fa123d57",
"isActive": false,
"isActive": true,
"company": "Quia qui blanditiis est minus ut quia dolores expedita aut.",
"name": "Deleniti est quaerat qui dolores blanditiis qui vel maxime.",
"email": "Felipe94@yahoo.com",
Expand All @@ -116,7 +116,7 @@
},
{
"uuid": "570e003f-bb7d-4dae-a336-8f187c73242501",
"isActive": false,
"isActive": true,
"company": "Voluptate omnis et.",
"name": "Enim aut labore autem tempore cumque laborum ut.",
"email": "Antone.Bednar30@yahoo.com",
Expand All @@ -127,7 +127,7 @@
},
{
"uuid": "943e4923-12c0-473e-a07f-63eb28201a3491",
"isActive": false,
"isActive": true,
"company": "Occaecati et velit magnam et recusandae rerum autem et voluptas.",
"name": "Illo quam ad ratione.",
"email": "Emmalee_McGlynn@gmail.com",
Expand All @@ -138,7 +138,7 @@
},
{
"uuid": "ce2e298a-be37-408f-a789-4c7b18b4132432bc",
"isActive": false,
"isActive": true,
"company": "Atque cum illum debitis consequatur exercitationem dolorum corporis.",
"name": "Incidunt perferendis error iusto ut.",
"email": "Heloise_Hegmann@hotmail.com",
Expand All @@ -149,7 +149,7 @@
},
{
"uuid": "62fc0a79-ddea-45b5-8d21-be6f0502929645",
"isActive": false,
"isActive": true,
"company": "Sed occaecati cupiditate.",
"name": "Quaerat veritatis aut voluptatem enim.",
"email": "Jillian_Wilkinson97@gmail.com",
Expand Down
14 changes: 12 additions & 2 deletions ui/src/components/list-view/QasListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ export default {
type: Boolean
},

useQueryPagination: {
default: true,
type: Boolean
},

useRefresh: {
default: true,
type: Boolean
Expand Down Expand Up @@ -182,8 +187,13 @@ export default {

methods: {
changePage () {
const query = { ...this.$route.query, page: this.page }
this.$router.push({ query })
if (this.useQueryPagination) {
const query = { ...this.$route.query, page: this.page }
eliasassuncao marked this conversation as resolved.
Show resolved Hide resolved

this.$router.push({ query })
} else {
this.fetchList({ page: this.page })
}
eliasassuncao marked this conversation as resolved.
Show resolved Hide resolved
},

async fetchList (externalPayload = {}) {
Expand Down
5 changes: 5 additions & 0 deletions ui/src/components/list-view/QasListView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ props:
default: true
type: Boolean

use-query-pagination:
desc: Controla se vai ter controla da paginação via query. Recomendado o uso como "false" em casos de ter mais de um list-view na mesma página.
default: true
type: Boolean

use-refresh:
desc: Controla o [pull-to-refresh](https://quasar.dev/vue-components/pull-to-refresh#basic).
default: true
Expand Down