-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1085 from bildvitta/feature/stepper
Feature/stepper
- Loading branch information
Showing
19 changed files
with
347 additions
and
28 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<div class="container spaced"> | ||
<qas-stepper v-model="model"> | ||
<template #default="{ next, previous }"> | ||
<q-step caption="example" :done="model > 1" :name="1" prefix="1" title="Página 1"> | ||
<div class="q-mb-md">Conteúdo da Página 1</div> | ||
|
||
<div class="column items-start q-gutter-sm"> | ||
<qas-btn label="Próximo" @click="next" /> | ||
</div> | ||
</q-step> | ||
|
||
<q-step :done="model > 2" :name="2" prefix="2" title="Página 2"> | ||
<div class="q-mb-md">Conteúdo da Página 2</div> | ||
|
||
<div class="column items-start q-gutter-sm"> | ||
<qas-btn label="Voltar" @click="previous" /> | ||
<qas-btn label="Próximo" @click="next" /> | ||
</div> | ||
</q-step> | ||
|
||
<q-step :name="3" prefix="3" title="Página 3"> | ||
<div class="q-mb-md">Conteúdo da Página 3</div> | ||
|
||
<div class="column items-start q-gutter-sm"> | ||
<qas-btn label="Voltar" @click="previous" /> | ||
</div> | ||
</q-step> | ||
</template> | ||
</qas-stepper> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { ref } from 'vue' | ||
defineOptions({ name: 'Basic' }) | ||
const model = ref(2) | ||
</script> |
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,40 @@ | ||
<template> | ||
<div class="container spaced"> | ||
<qas-stepper v-model="model" disable> | ||
<template #default="{ next, previous }"> | ||
<q-step caption="example 1" :done="model > 1" icon="sym_r_article" :name="1" title="Página 1"> | ||
<div class="q-mb-md">Conteúdo da Página 1</div> | ||
|
||
<div class="column items-start q-gutter-sm"> | ||
<qas-btn label="Próximo" @click="next" /> | ||
</div> | ||
</q-step> | ||
|
||
<q-step caption="example 2" :done="model > 2" icon="sym_r_description" :name="2" title="Página 2"> | ||
<div class="q-mb-md">Conteúdo da Página 2</div> | ||
|
||
<div class="column items-start q-gutter-sm"> | ||
<qas-btn label="Voltar" @click="previous" /> | ||
<qas-btn label="Próximo" @click="next" /> | ||
</div> | ||
</q-step> | ||
|
||
<q-step caption="example 3" icon="sym_r_news" :name="3" title="Página 3"> | ||
<div class="q-mb-md">Conteúdo da Página 3</div> | ||
|
||
<div class="column items-start q-gutter-sm"> | ||
<qas-btn label="Voltar" @click="previous" /> | ||
</div> | ||
</q-step> | ||
</template> | ||
</qas-stepper> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { ref } from 'vue' | ||
defineOptions({ name: 'Basic' }) | ||
const model = ref(2) | ||
</script> |
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,13 @@ | ||
--- | ||
title: QasStepper | ||
--- | ||
|
||
Componente wrapper do [QStepper](https://quasar.dev/vue-components/stepper#qstepper-api) | ||
|
||
<doc-api file="stepper/QasStepper" name="QasStepper" /> | ||
|
||
## Uso | ||
|
||
<doc-example file="QasStepper/Basic" title="Básico" /> | ||
|
||
<doc-example file="QasStepper/StepperWithIcon" title="Com ícone" /> |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,148 @@ | ||
<template> | ||
<div class="qas-stepper" :class="classes"> | ||
<q-stepper ref="stepper" v-model="model" active-color="primary" active-icon="none" animated :contracted="screen.untilLarge" done-color="primary" done-icon="none" flat :header-class="headerClass" inactive-color="grey-6" keep-alive> | ||
<template v-for="(_, name) in $slots" #[name]="context"> | ||
<slot :name="name" v-bind="getContext(context)" /> | ||
</template> | ||
</q-stepper> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { computed, ref } from 'vue' | ||
import { Spacing } from '../../enums/Spacing' | ||
import { gutterValidator } from '../../helpers/private/gutter-validator' | ||
import useScreen from '../../composables/use-screen' | ||
defineOptions({ name: 'QasStepper' }) | ||
const props = defineProps({ | ||
disable: { | ||
type: Boolean | ||
}, | ||
modelValue: { | ||
type: [Number, String], | ||
default: 0 | ||
}, | ||
spacing: { | ||
default: Spacing.Lg, | ||
type: [String, Boolean], | ||
validator: gutterValidator | ||
} | ||
}) | ||
const stepper = ref(null) | ||
const screen = useScreen() | ||
const emit = defineEmits(['update:modelValue']) | ||
defineExpose({ next, previous }) | ||
const model = computed({ | ||
get () { | ||
return props.modelValue | ||
}, | ||
set (modelValue) { | ||
return emit('update:modelValue', modelValue) | ||
} | ||
}) | ||
const classes = computed(() => ({ 'qas-stepper--disable': props.disable })) | ||
const headerClass = computed(() => `text-subtitle1 q-pb-${props.spacing}`) | ||
function getContext (context) { | ||
return { | ||
...context, | ||
next, | ||
previous | ||
} | ||
} | ||
function next () { | ||
if (props.disable) return | ||
stepper.value.next() | ||
} | ||
function previous () { | ||
if (props.disable) return | ||
stepper.value.previous() | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
.qas-stepper { | ||
.q-stepper { | ||
background-color: transparent; | ||
&__tab { | ||
padding: 0; | ||
} | ||
&__caption { | ||
@include set-typography($caption); | ||
color: $grey-6; | ||
} | ||
} | ||
&--disable { | ||
.q-stepper { | ||
&__title { | ||
color: $grey-6; | ||
} | ||
&__line::after, | ||
&__line::before, | ||
&__dot { | ||
background-color: $grey-6 !important; | ||
} | ||
} | ||
} | ||
.q-stepper--horizontal .q-stepper__line::before, | ||
.q-stepper--horizontal .q-stepper__line::after { | ||
height: 4px; | ||
border-radius: var(--qas-generic-border-radius); | ||
} | ||
.q-stepper__header--standard-labels .q-stepper__tab { | ||
min-height: auto; | ||
} | ||
.q-stepper__tab:nth-child(1), | ||
.q-stepper__tab--done { | ||
.q-stepper__line::after, | ||
.q-stepper__line::before { | ||
background-color: var(--q-primary); | ||
} | ||
} | ||
.q-stepper__tab:nth-child(2), | ||
.q-stepper__tab--active { | ||
.q-stepper__line::before { | ||
background-color: var(--q-primary); | ||
} | ||
} | ||
.q-stepper__nav, | ||
.q-stepper__step-inner { | ||
padding: 0; | ||
} | ||
.q-stepper__header--contracted .q-stepper__tab:first-child .q-stepper__dot, | ||
.q-stepper__header--contracted .q-stepper__tab:last-child .q-stepper__dot { | ||
transform: translateX(0); | ||
} | ||
.q-focus-helper { | ||
display: none; | ||
} | ||
} | ||
</style> |
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,36 @@ | ||
type: component | ||
|
||
meta: | ||
desc: Componente de stepper. | ||
|
||
props: | ||
disable: | ||
desc: Deixa o componente desabilitado. | ||
default: false | ||
type: Boolean | ||
|
||
spacing: | ||
desc: Espaçamento entre o stepper e o conteúdo da página. | ||
default: lg | ||
type: [String, Boolean] | ||
examples: [xs, sm, md, lg, xl, '2xl', '3xl', '4xl', '5xl', false] | ||
|
||
model-value: | ||
desc: Model do componente, responsável por controlar em qual step deverá ser exibido. | ||
model: true | ||
type: [Number, String] | ||
|
||
events: | ||
'@update:model-value -> function(value)': | ||
desc: Dispara quando o model-value altera, também usado para v-model. | ||
params: | ||
value: | ||
desc: Valor do mode-value. | ||
type: [Number, String] | ||
|
||
methods: | ||
'next: () => void': | ||
desc: Avança o stepper para o prõximo step. | ||
|
||
'previous: () => void': | ||
desc: Volta o stepper para o step anterior. |
Oops, something went wrong.