manage QCalendar customization classes from wrapper
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
William Buezas 2024-04-16 10:47:16 -03:00
parent e36949ad07
commit 813bab4e9d
4 changed files with 96 additions and 91 deletions

View File

@ -12,12 +12,23 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
viewCustomization: {
type: String,
default: '',
},
}); });
const $q = useQuasar(); const $q = useQuasar();
// El objetivo de asignar las clases de personalización desde el wrapper es no tener conflictos entre vistas que usen el mismo componente
const viewCustomizationClasses = {
workerCalendar: 'worker-calendar-customizations',
};
const containerClasses = computed(() => { const containerClasses = computed(() => {
const classes = ['main-container-background']; const classes = ['main-container-background'];
if (viewCustomizationClasses[$props.viewCustomization])
classes.push(viewCustomizationClasses[$props.viewCustomization]);
if ($props.bordered) classes.push('--bordered'); if ($props.bordered) classes.push('--bordered');
if ($props.transparentBackground) classes.push('transparent-background'); if ($props.transparentBackground) classes.push('transparent-background');
else classes.push($q.dark.isActive ? '--dark' : '--light'); else classes.push($q.dark.isActive ? '--dark' : '--light');
@ -33,6 +44,8 @@ const containerClasses = computed(() => {
</template> </template>
<style lang="scss"> <style lang="scss">
@import '../../css/quasar.variables.scss';
:root { :root {
// Cambia los colores del día actual del calendario por los de salix // Cambia los colores del día actual del calendario por los de salix
--calendar-border-current-dark: #84d0e2 2px solid; --calendar-border-current-dark: #84d0e2 2px solid;
@ -40,6 +53,35 @@ const containerClasses = computed(() => {
--calendar-current-color-dark: #84d0e2; --calendar-current-color-dark: #84d0e2;
} }
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
.q-dark div .q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
background-color: $primary !important;
color: white !important;
}
.q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
background-color: $primary !important;
color: white !important;
}
.q-calendar-month__head--weekday {
// Transforma los nombres de los días de la semana a mayúsculas
text-transform: capitalize;
}
.transparent-background {
--calendar-background-dark: transparent;
--calendar-background: transparent;
--calendar-outside-background-dark: transparent;
}
.q-calendar__button {
&:hover {
background-color: var(--vn-accent-color);
cursor: pointer;
}
}
.main-container-background { .main-container-background {
--calendar-current-background-dark: transparent; --calendar-current-background-dark: transparent;
@ -56,15 +98,60 @@ const containerClasses = computed(() => {
} }
} }
.q-calendar-month__head--weekday { .worker-calendar-customizations {
// Transforma los nombres de los días de la semana a mayúsculas .q-calendar__button {
text-transform: capitalize; width: 32px;
height: 32px;
font-size: 13px;
&:hover {
background-color: var(--vn-accent-color);
cursor: pointer;
}
} }
.transparent-background { .q-calendar-month__week--days > div:nth-child(6),
--calendar-background-dark: transparent; .q-calendar-month__week--days > div:nth-child(7) {
--calendar-background: transparent; // Cambia el color de los días sábado y domingo
--calendar-outside-background-dark: transparent; color: #777777;
}
.q-calendar-month__week--wrapper {
margin-bottom: 4px;
}
.q-calendar-month__workweek {
height: 32px;
display: flex;
justify-content: center;
}
.q-calendar__button--bordered {
color: $info !important;
}
.q-calendar-month__day--content {
position: absolute;
top: 1;
left: 0;
display: flex;
justify-content: center;
align-items: center;
}
.q-outside .calendar-event {
display: none;
}
.q-calendar-month__workweek,
.q-calendar-month__head--workweek,
.q-calendar-month__head--weekday.q-calendar__center.q-calendar__ellipsis {
text-transform: capitalize;
color: #777;
font-weight: bold;
font-size: 0.8rem;
text-align: center;
}
} }
.nav-container { .nav-container {

View File

@ -161,14 +161,3 @@ input::-webkit-inner-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
} }
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
.q-dark div .q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
background-color: $primary !important;
color: white !important;
}
.q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
background-color: $primary !important;
color: white !important;
}

View File

@ -178,6 +178,7 @@ watch(_year, (newValue) => {
class="outline" class="outline"
bordered bordered
transparent-background transparent-background
view-customization="workerCalendar"
> >
<template #header> <template #header>
<span class="full-width text-center text-body1 q-py-sm">{{ <span class="full-width text-center text-body1 q-py-sm">{{
@ -222,52 +223,6 @@ watch(_year, (newValue) => {
</template> </template>
<style lang="scss"> <style lang="scss">
@import '../../../css/quasar.variables.scss';
.q-calendar__button {
width: 32px;
height: 32px;
font-size: 13px;
&:hover {
background-color: var(--vn-accent-color);
cursor: pointer;
}
}
.q-calendar-month__week--days > div:nth-child(6),
.q-calendar-month__week--days > div:nth-child(7) {
// Cambia el color de los días sábado y domingo
color: #777777;
}
.q-calendar-month__week--wrapper {
margin-bottom: 4px;
}
.q-calendar-month__workweek {
height: 32px;
display: flex;
justify-content: center;
}
.q-calendar__button--bordered {
color: $info !important;
}
.q-calendar-month__day--content {
position: absolute;
top: 1;
left: 0;
display: flex;
justify-content: center;
align-items: center;
}
.q-outside .calendar-event {
display: none;
}
.calendar-event { .calendar-event {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -290,15 +245,6 @@ watch(_year, (newValue) => {
opacity: 0.8; opacity: 0.8;
} }
} }
.q-calendar-month__workweek,
.q-calendar-month__head--workweek,
.q-calendar-month__head--weekday.q-calendar__center.q-calendar__ellipsis {
text-transform: capitalize;
color: #777;
font-weight: bold;
font-size: 0.8rem;
text-align: center;
}
</style> </style>
<i18n> <i18n>

View File

@ -152,16 +152,6 @@ const paintWorkWeeks = async () => {
</template> </template>
<style lang="scss"> <style lang="scss">
.main-container-background {
&.--dark {
background-color: var(--calendar-background-dark);
}
&.--light {
background-color: var(--calendar-background);
}
}
.confirmed { .confirmed {
color: #97b92f; color: #97b92f;
} }
@ -178,11 +168,4 @@ const paintWorkWeeks = async () => {
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
} }
.q-calendar__button {
&:hover {
background-color: var(--vn-accent-color);
cursor: pointer;
}
}
</style> </style>