agenda: centralize FullCalendar touch defaults
Sem long-press delays customizados, tap em slot vazio precisa de 1000ms antes de disparar select — diverge totalmente do mouse (clique abre na hora). Mesmo problema em eventDrop. Move pra utils/fcDefaults.js e aplica nos 4 calendars (AgendaCalendar, AgendaClinicMosaic, AgendaTerapeutaPage, MelissaAgenda no proximo commit). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import interactionPlugin from '@fullcalendar/interaction';
|
|||||||
import dayGridPlugin from '@fullcalendar/daygrid';
|
import dayGridPlugin from '@fullcalendar/daygrid';
|
||||||
|
|
||||||
import ProgressSpinner from 'primevue/progressspinner';
|
import ProgressSpinner from 'primevue/progressspinner';
|
||||||
|
import { FC_TOUCH_DEFAULTS } from '@/features/agenda/utils/fcDefaults';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
// UI
|
// UI
|
||||||
@@ -71,6 +72,7 @@ const calendarOptions = computed(() => {
|
|||||||
const maxTime = isWorkHours ? props.slotMaxTime : '23:59:59';
|
const maxTime = isWorkHours ? props.slotMaxTime : '23:59:59';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
...FC_TOUCH_DEFAULTS,
|
||||||
plugins: [timeGridPlugin, interactionPlugin, dayGridPlugin],
|
plugins: [timeGridPlugin, interactionPlugin, dayGridPlugin],
|
||||||
initialView: initialView.value,
|
initialView: initialView.value,
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import dayGridPlugin from '@fullcalendar/daygrid';
|
|||||||
import listPlugin from '@fullcalendar/list';
|
import listPlugin from '@fullcalendar/list';
|
||||||
import interactionPlugin from '@fullcalendar/interaction';
|
import interactionPlugin from '@fullcalendar/interaction';
|
||||||
import ptBrLocale from '@fullcalendar/core/locales/pt-br';
|
import ptBrLocale from '@fullcalendar/core/locales/pt-br';
|
||||||
|
import { FC_TOUCH_DEFAULTS } from '@/features/agenda/utils/fcDefaults';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
view: { type: String, default: 'day' }, // 'day' | 'week' | 'month'
|
view: { type: String, default: 'day' }, // 'day' | 'week' | 'month'
|
||||||
@@ -258,6 +259,7 @@ function emitDebug(col) {
|
|||||||
|
|
||||||
function buildFcOptions(ownerId) {
|
function buildFcOptions(ownerId) {
|
||||||
const base = {
|
const base = {
|
||||||
|
...FC_TOUCH_DEFAULTS,
|
||||||
plugins: [timeGridPlugin, dayGridPlugin, listPlugin, interactionPlugin],
|
plugins: [timeGridPlugin, dayGridPlugin, listPlugin, interactionPlugin],
|
||||||
locale: ptBrLocale,
|
locale: ptBrLocale,
|
||||||
timeZone: props.timezone,
|
timeZone: props.timezone,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import dayGridPlugin from '@fullcalendar/daygrid';
|
|||||||
import listPlugin from '@fullcalendar/list';
|
import listPlugin from '@fullcalendar/list';
|
||||||
import interactionPlugin from '@fullcalendar/interaction';
|
import interactionPlugin from '@fullcalendar/interaction';
|
||||||
import ptBrLocale from '@fullcalendar/core/locales/pt-br';
|
import ptBrLocale from '@fullcalendar/core/locales/pt-br';
|
||||||
|
import { FC_TOUCH_DEFAULTS } from '@/features/agenda/utils/fcDefaults';
|
||||||
|
|
||||||
import AgendaEventDialog from '@/features/agenda/components/AgendaEventDialog.vue';
|
import AgendaEventDialog from '@/features/agenda/components/AgendaEventDialog.vue';
|
||||||
import BloqueioDialog from '@/features/agenda/components/BloqueioDialog.vue';
|
import BloqueioDialog from '@/features/agenda/components/BloqueioDialog.vue';
|
||||||
@@ -672,6 +673,7 @@ const _initSlotMax = slotMaxTime.value;
|
|||||||
const fcOptions = computed(() => ({
|
const fcOptions = computed(() => ({
|
||||||
plugins: [timeGridPlugin, dayGridPlugin, listPlugin, interactionPlugin],
|
plugins: [timeGridPlugin, dayGridPlugin, listPlugin, interactionPlugin],
|
||||||
locale: ptBrLocale,
|
locale: ptBrLocale,
|
||||||
|
...FC_TOUCH_DEFAULTS,
|
||||||
timeZone: timezone.value,
|
timeZone: timezone.value,
|
||||||
|
|
||||||
headerToolbar: false,
|
headerToolbar: false,
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* FullCalendar shared defaults.
|
||||||
|
*
|
||||||
|
* Centraliza opções que devem se aplicar a TODAS as instâncias do
|
||||||
|
* FullCalendar do sistema (MelissaAgenda, AgendaTerapeutaPage,
|
||||||
|
* AgendaClinicMosaic, e futuras). Se aparecer outra agenda, basta:
|
||||||
|
*
|
||||||
|
* import { FC_TOUCH_DEFAULTS } from '@/features/agenda/utils/fcDefaults';
|
||||||
|
* const fcOptions = { ...FC_TOUCH_DEFAULTS, ...resto };
|
||||||
|
*
|
||||||
|
* Sem isso, tablet/touch fica sem paridade com mouse — ver detalhe abaixo.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defaults pra paridade touch ↔ mouse no FullCalendar.
|
||||||
|
*
|
||||||
|
* Por padrão o FC exige long-press de 1000ms no touch antes de disparar
|
||||||
|
* `select` ou `eventDrop` — no mouse, qualquer clique/drag funciona na hora.
|
||||||
|
* Zerar os dois delays faz tap se comportar igual clique do mouse.
|
||||||
|
*
|
||||||
|
* - selectLongPressDelay: 0 → tap em slot vazio dispara `select` na hora
|
||||||
|
* (abre o AgendaEventDialog igual ao desktop)
|
||||||
|
* - eventLongPressDelay: 0 → tap-and-drag em evento existente já move/resize
|
||||||
|
* sem precisar segurar 1s
|
||||||
|
*
|
||||||
|
* O FC continua diferenciando tap curto (select de 1 slot) de tap+drag
|
||||||
|
* (select de range) automaticamente — não há perda de funcionalidade.
|
||||||
|
*/
|
||||||
|
export const FC_TOUCH_DEFAULTS = Object.freeze({
|
||||||
|
selectLongPressDelay: 0,
|
||||||
|
eventLongPressDelay: 0
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user