This commit is contained in:
romankko2 committed 2022-12-16 15:23:32 +01:00
commit 9d70fe378d
3 files changed
+444 -355

No files matched your search

+437 -348
View File
@@ -1,434 +1,523 @@
<template lang="pug"> <template lang="pug">
.vuecal__event( .vuecal__event(
:class="eventClasses" :class="eventClasses",
:style="eventStyles" :style="eventStyles",
:eventId="`event-id-${event.id}`" :eventId="`event-id-${event.id}`",
tabindex="0" tabindex="0",
@focus="focusEvent" @focus="focusEvent",
@keypress.enter.stop="onEnterKeypress" @keypress.enter.stop="onEnterKeypress",
@mouseenter="onMouseEnter" @mouseenter="onMouseEnter",
@mouseleave="onMouseLeave" @mouseleave="onMouseLeave",
@touchstart.stop="onTouchStart" @touchstart.stop="onTouchStart",
@mousedown="onMouseDown($event) /* Don't stop mousedown propagation. See in onMouseDown(). */" @mousedown="onMouseDown($event) /* Don't stop mousedown propagation. See in onMouseDown(). */",
@mouseup="onMouseUp" @mouseup="onMouseUp",
@touchend="onMouseUp" @touchend="onMouseUp",
@touchmove="onTouchMove" @touchmove="onTouchMove",
@dblclick="onDblClick" @dblclick="onDblClick",
:draggable="draggable" :draggable="draggable",
@dragstart="draggable && onDragStart($event)" @dragstart="draggable && onDragStart($event)",
@dragend="draggable && onDragEnd()") @dragend="draggable && onDragEnd()"
.vuecal__event-delete( )
v-if="vuecal.editEvents.delete && event.deletable" .vuecal__event-delete(
@click.stop="deleteEvent" v-if="vuecal.editEvents.delete && event.deletable",
@touchstart.stop="touchDeleteEvent") {{ vuecal.texts.deleteEvent }} @click.stop="deleteEvent",
slot(name="event" :event="event" :view="view.id") @touchstart.stop="touchDeleteEvent"
//- Force contenteditable="false" for new events without content. ) {{ vuecal.texts.deleteEvent }}
.vuecal__event-resize-handle( slot(name="event", :event="event", :view="view.id")
v-if="resizable" //- Force contenteditable="false" for new events without content.
contenteditable="false" .vuecal__event-resize-handle(
@mousedown.stop.prevent="onResizeHandleMouseDown" v-if="resizable",
@touchstart.stop.prevent="onResizeHandleMouseDown") contenteditable="false",
@mousedown.stop.prevent="onResizeHandleMouseDown",
@touchstart.stop.prevent="onResizeHandleMouseDown"
)
</template> </template>
<script> <script>
export default { export default {
inject: ['vuecal', 'utils', 'modules', 'view', 'domEvents', 'editEvents'], inject: ["vuecal", "utils", "modules", "view", "domEvents", "editEvents"],
props: { props: {
cellFormattedDate: { type: String, default: '' }, cellFormattedDate: { type: String, default: "" },
event: { type: Object, default: () => ({}) }, event: { type: Object, default: () => ({}) },
cellEvents: { type: Array, default: () => [] }, cellEvents: { type: Array, default: () => [] },
overlaps: { type: Array, default: () => [] }, overlaps: { type: Array, default: () => [] },
// If multiple simultaneous events, the events are placed from left to right from the // If multiple simultaneous events, the events are placed from left to right from the
// one starting first to the last. (See utils/event.js > checkCellOverlappingEvents) // one starting first to the last. (See utils/event.js > checkCellOverlappingEvents)
eventPosition: { type: Number, default: 0 }, eventPosition: { type: Number, default: 0 },
overlapsStreak: { type: Number, default: 0 }, overlapsStreak: { type: Number, default: 0 },
allDay: { type: Boolean, default: false } // Is the event displayed in the all-day bar. allDay: { type: Boolean, default: false }, // Is the event displayed in the all-day bar.
}, },
data: () => ({ data: () => ({
// Event touch detection with 30px threshold. // Event touch detection with 30px threshold.
touch: { touch: {
dragThreshold: 30, // px. dragThreshold: 30, // px.
startX: 0, startX: 0,
startY: 0, startY: 0,
// Detect if the event touch start + touch end was a drag or a tap. // Detect if the event touch start + touch end was a drag or a tap.
// If it was a drag, don't call the event-click handler. // If it was a drag, don't call the event-click handler.
dragged: false dragged: false,
} },
}), }),
methods: { methods: {
/** /**
* On event mousedown. * On event mousedown.
* Do not prevent propagation to trigger cell mousedown which highlights the cell if not highlighted. * Do not prevent propagation to trigger cell mousedown which highlights the cell if not highlighted.
*/ */
onMouseDown (e, touch = false) { onMouseDown(e, touch = false) {
// Prevent a double mouse down on touch devices. // Prevent a double mouse down on touch devices.
if ('ontouchstart' in window && !touch) return false if ("ontouchstart" in window && !touch) return false;
const { clickHoldAnEvent, focusAnEvent, resizeAnEvent, dragAnEvent } = this.domEvents const { clickHoldAnEvent, focusAnEvent, resizeAnEvent, dragAnEvent } =
this.domEvents;
// If the delete button is already out and event is on focus then delete event. // If the delete button is already out and event is on focus then delete event.
// Return true so the event-click function (if any) is not called. // Return true so the event-click function (if any) is not called.
if (focusAnEvent._eid === this.event._eid && clickHoldAnEvent._eid === this.event._eid) { if (
return true focusAnEvent._eid === this.event._eid &&
} clickHoldAnEvent._eid === this.event._eid
) {
return true;
}
// Focus the clicked event. // Focus the clicked event.
this.focusEvent() this.focusEvent();
clickHoldAnEvent._eid = null // Reinit click hold on each click. clickHoldAnEvent._eid = null; // Reinit click hold on each click.
// Show event delete button. // Show event delete button.
if (this.vuecal.editEvents.delete && this.event.deletable) { if (this.vuecal.editEvents.delete && this.event.deletable) {
clickHoldAnEvent.timeoutId = setTimeout(() => { clickHoldAnEvent.timeoutId = setTimeout(() => {
if (!resizeAnEvent._eid && !dragAnEvent._eid) { if (!resizeAnEvent._eid && !dragAnEvent._eid) {
clickHoldAnEvent._eid = this.event._eid clickHoldAnEvent._eid = this.event._eid;
this.event.deleting = true this.event.deleting = true;
} }
}, clickHoldAnEvent.timeout) }, clickHoldAnEvent.timeout);
} }
}, },
/** /**
* The mouseup handler is global (whole document) and initialized in index.vue on mounted. * The mouseup handler is global (whole document) and initialized in index.vue on mounted.
* It handles the mouseup on cell, events, and everything. * It handles the mouseup on cell, events, and everything.
* All mouseup on event, should be put there to avoid conflicts with other cases. * All mouseup on event, should be put there to avoid conflicts with other cases.
* This function is also called on touchend on the event. * This function is also called on touchend on the event.
*/ */
onMouseUp (e) { onMouseUp(e) {
// Don't allow mouseup to be fired on different event than mousedown for the onEventClick function. // Don't allow mouseup to be fired on different event than mousedown for the onEventClick function.
if (this.domEvents.focusAnEvent._eid === this.event._eid && !this.touch.dragged) { if (
// This is used in the global mouseup handler. this.domEvents.focusAnEvent._eid === this.event._eid &&
this.domEvents.focusAnEvent.mousedUp = true !this.touch.dragged
} ) {
this.touch.dragged = false // After the touchend happens, reset the dragged flag. // This is used in the global mouseup handler.
}, this.domEvents.focusAnEvent.mousedUp = true;
}
this.touch.dragged = false; // After the touchend happens, reset the dragged flag.
},
onMouseEnter (e) { onMouseEnter(e) {
e.preventDefault() e.preventDefault();
this.vuecal.emitWithEvent('event-mouse-enter', this.event) this.vuecal.emitWithEvent("event-mouse-enter", this.event);
}, },
onMouseLeave (e) { onMouseLeave(e) {
e.preventDefault() e.preventDefault();
this.vuecal.emitWithEvent('event-mouse-leave', this.event) this.vuecal.emitWithEvent("event-mouse-leave", this.event);
}, },
// Detect if user taps on an event or drags it. If dragging, don't fire the event-click handler (if any). // Detect if user taps on an event or drags it. If dragging, don't fire the event-click handler (if any).
onTouchMove (e) { onTouchMove(e) {
// Skip the maths if there is no event click handler. // Skip the maths if there is no event click handler.
if (typeof this.vuecal.onEventClick !== 'function') return if (typeof this.vuecal.onEventClick !== "function") return;
const { clientX, clientY } = e.touches[0] const { clientX, clientY } = e.touches[0];
const { startX, startY, dragThreshold } = this.touch const { startX, startY, dragThreshold } = this.touch;
if (Math.abs(clientX - startX) > dragThreshold || Math.abs(clientY - startY) > dragThreshold) { if (
this.touch.dragged = true Math.abs(clientX - startX) > dragThreshold ||
} Math.abs(clientY - startY) > dragThreshold
}, ) {
this.touch.dragged = true;
}
},
onTouchStart (e) { onTouchStart(e) {
this.touch.startX = e.touches[0].clientX this.touch.startX = e.touches[0].clientX;
this.touch.startY = e.touches[0].clientY this.touch.startY = e.touches[0].clientY;
this.onMouseDown(e, true) this.onMouseDown(e, true);
}, },
onEnterKeypress (e) { onEnterKeypress(e) {
if (typeof this.vuecal.onEventClick === 'function') return this.vuecal.onEventClick(this.event, e) if (typeof this.vuecal.onEventClick === "function")
}, return this.vuecal.onEventClick(this.event, e);
},
onDblClick (e) { onDblClick(e) {
if (typeof this.vuecal.onEventDblclick === 'function') return this.vuecal.onEventDblclick(this.event, e) if (typeof this.vuecal.onEventDblclick === "function")
}, return this.vuecal.onEventDblclick(this.event, e);
},
onDragStart (e) { onDragStart(e) {
this.dnd && this.dnd.eventDragStart(e, this.event) console.log(`ID from dragStart: ${this.event.id}`)
}, this.event.draggingStatic = false
onDragEnd () { this.dnd && this.dnd.eventDragStart(e, this.event);
this.dnd && this.dnd.eventDragEnd(this.event) },
},
onResizeHandleMouseDown () { onDragEnd() {
this.focusEvent() this.dnd && this.dnd.eventDragEnd(this.event);
},
this.domEvents.dragAnEvent._eid = null onResizeHandleMouseDown() {
this.domEvents.resizeAnEvent = Object.assign(this.domEvents.resizeAnEvent, { this.focusEvent();
_eid: this.event._eid,
start: (this.segment || this.event).start,
split: this.event.split || null,
segment: !!this.segment && this.utils.date.formatDateLite(this.segment.start),
originalEnd: new Date((this.segment || this.event).end),
originalEndTimeMinutes: this.event.endTimeMinutes
})
this.event.resizing = true this.domEvents.dragAnEvent._eid = null;
}, this.domEvents.resizeAnEvent = Object.assign(
this.domEvents.resizeAnEvent,
{
_eid: this.event._eid,
start: (this.segment || this.event).start,
split: this.event.split || null,
segment:
!!this.segment &&
this.utils.date.formatDateLite(this.segment.start),
originalEnd: new Date((this.segment || this.event).end),
originalEndTimeMinutes: this.event.endTimeMinutes,
}
);
deleteEvent (touch = false) { this.event.resizing = true;
// Prevent a double mouse down on touch devices. },
if ('ontouchstart' in window && !touch) return false
this.utils.event.deleteAnEvent(this.event) deleteEvent(touch = false) {
}, // Prevent a double mouse down on touch devices.
if ("ontouchstart" in window && !touch) return false;
touchDeleteEvent (event) { this.utils.event.deleteAnEvent(this.event);
this.deleteEvent(true) },
},
cancelDeleteEvent () { touchDeleteEvent(event) {
this.event.deleting = false this.deleteEvent(true);
}, },
focusEvent () { cancelDeleteEvent() {
const { focusAnEvent } = this.domEvents this.event.deleting = false;
const focusedEvent = focusAnEvent._eid },
// If event is already focus cancel refocusing. focusEvent() {
if (focusedEvent === this.event._eid) return const { focusAnEvent } = this.domEvents;
// Unfocus previous event if any. const focusedEvent = focusAnEvent._eid;
else if (focusedEvent) {
const event = this.view.events.find(e => e._eid === focusedEvent)
if (event) event.focused = false
}
// Cancel delete on previous event if any. // If event is already focus cancel refocusing.
this.vuecal.cancelDelete() if (focusedEvent === this.event._eid) return;
// Unfocus previous event if any.
else if (focusedEvent) {
const event = this.view.events.find((e) => e._eid === focusedEvent);
if (event) event.focused = false;
}
this.vuecal.emitWithEvent('event-focus', this.event) // Cancel delete on previous event if any.
this.vuecal.cancelDelete();
focusAnEvent._eid = this.event._eid this.vuecal.emitWithEvent("event-focus", this.event);
this.event.focused = true
}
},
computed: { focusAnEvent._eid = this.event._eid;
eventDimensions () { this.event.focused = true;
const { startTimeMinutes, endTimeMinutes } = this.segment || this.event },
},
// Top of event. computed: {
let minutesFromTop = startTimeMinutes - this.vuecal.timeFrom eventDimensions() {
const top = Math.max(Math.round(minutesFromTop * this.vuecal.timeCellHeight / this.vuecal.timeStep), 0) const { startTimeMinutes, endTimeMinutes } = this.segment || this.event;
// Bottom of event. // Top of event.
minutesFromTop = Math.min(endTimeMinutes, this.vuecal.timeTo) - this.vuecal.timeFrom let minutesFromTop = startTimeMinutes - this.vuecal.timeFrom;
const bottom = Math.round(minutesFromTop * this.vuecal.timeCellHeight / this.vuecal.timeStep) const top = Math.max(
Math.round(
(minutesFromTop * this.vuecal.timeCellHeight) / this.vuecal.timeStep
),
0
);
const height = Math.max(bottom - top, 5) // Min height is 5px. // Bottom of event.
minutesFromTop =
Math.min(endTimeMinutes, this.vuecal.timeTo) - this.vuecal.timeFrom;
const bottom = Math.round(
(minutesFromTop * this.vuecal.timeCellHeight) / this.vuecal.timeStep
);
return { top, height } const height = Math.max(bottom - top, 5); // Min height is 5px.
},
eventStyles () { return { top, height };
if (this.event.allDay || !this.vuecal.time || !this.event.endTimeMinutes || this.view.id === 'month' || this.allDay) return {} },
// let width = 100 / Math.min(this.overlaps.length + 1, this.overlapsStreak)
// let left = (100 - ((this.overlaps.length + 1) * 10 )) * this.eventPosition
let width = 100 - (this.eventPosition * 10)
let left = 10 * this.eventPosition / 2
let zIdnex = (this.eventPosition + 1) * 10
let background = this.event.master_task_color
if (this.vuecal.minEventWidth && width < this.vuecal.minEventWidth) { eventStyles() {
width = this.vuecal.minEventWidth if (
left = ((100 - this.vuecal.minEventWidth) / this.overlaps.length) * this.eventPosition this.event.allDay ||
} !this.vuecal.time ||
!this.event.endTimeMinutes ||
this.view.id === "month" ||
this.allDay
)
return {};
// let width = 100 / Math.min(this.overlaps.length + 1, this.overlapsStreak)
// let left = (100 - ((this.overlaps.length + 1) * 10 )) * this.eventPosition
let width = 100 - this.eventPosition * 10;
let left = (10 * this.eventPosition) / 2;
let zIdnex = (this.eventPosition + 1) * 10;
let background = this.event.master_task_color;
const { top, height } = this.eventDimensions if (this.vuecal.minEventWidth && width < this.vuecal.minEventWidth) {
width = this.vuecal.minEventWidth;
left =
((100 - this.vuecal.minEventWidth) / this.overlaps.length) *
this.eventPosition;
}
return { const { top, height } = this.eventDimensions;
"background": background,
"z-index": `${zIdnex}`,
top: `${top}px`,
height: `${height}px`,
width: `${width}%`,
left: (this.event.left && `${this.event.left}px`) || `${left}%`
}
},
// Don't rely on global variables otherwise whenever it would change all the events would be redrawn. return {
eventClasses () { background: background,
const { isFirstDay, isLastDay } = this.segment || {} "z-index": `${zIdnex}`,
top: `${top}px`,
height: `${height}px`,
width: `${width}%`,
left: (this.event.left && `${this.event.left}px`) || `${left}%`,
};
},
return { // Don't rely on global variables otherwise whenever it would change all the events would be redrawn.
[this.event.class]: !!this.event.class, eventClasses() {
'event-blocker': this.event.is_blocker, const { isFirstDay, isLastDay } = this.segment || {};
'vuecal__event--focus': this.event.focused,
'vuecal__event--resizing': this.event.resizing, return {
'vuecal__event--background': this.event.background, [this.event.class]: !!this.event.class,
'vuecal__event--deletable': this.event.deleting, "event-blocker": this.event.is_blocker,
'vuecal__event--all-day': this.event.allDay, "vuecal__event--focus": this.event.focused,
// Only apply the dragging class on the event copy that is being dragged. "vuecal__event--resizing": this.event.resizing,
'vuecal__event--dragging': !this.event.draggingStatic && this.event.dragging, "vuecal__event--background": this.event.background,
// Only apply the static class on the event original that remains static while a copy is being dragged. "vuecal__event--deletable": this.event.deleting,
// Sometimes when dragging fast the static class would get stuck and events stays invisible, "vuecal__event--all-day": this.event.allDay,
// So if dragging is false disable the static class as well. // Only apply the dragging class on the event copy that is being dragged.
'vuecal__event--static': this.event.dragging && this.event.draggingStatic, "vuecal__event--dragging":
// Multiple days events. !this.event.draggingStatic && this.event.dragging,
'vuecal__event--multiple-days': !!this.segment, // Only apply the static class on the event original that remains static while a copy is being dragged.
'event-start': this.segment && isFirstDay && !isLastDay, // Sometimes when dragging fast the static class would get stuck and events stays invisible,
'event-middle': this.segment && !isFirstDay && !isLastDay, // So if dragging is false disable the static class as well.
'event-end': this.segment && isLastDay && !isFirstDay "vuecal__event--static":
} this.event.dragging && this.event.draggingStatic,
}, // Multiple days events.
// When multiple-day events, a segment is a portion of event spanning on 1 day. "vuecal__event--multiple-days": !!this.segment,
segment () { "event-start": this.segment && isFirstDay && !isLastDay,
return (this.event.segments && this.event.segments[this.cellFormattedDate]) || null "event-middle": this.segment && !isFirstDay && !isLastDay,
}, "event-end": this.segment && isLastDay && !isFirstDay,
draggable () { };
const { draggable, background, daysCount } = this.event },
return this.vuecal.editEvents.drag && draggable && !background && daysCount === 1 // When multiple-day events, a segment is a portion of event spanning on 1 day.
}, segment() {
resizable () { return (
const { editEvents, time } = this.vuecal (this.event.segments && this.event.segments[this.cellFormattedDate]) ||
return (editEvents.resize && this.event.resizable && time && !this.allDay && null
(!this.segment || (this.segment && this.segment.isLastDay)) && this.view.id !== 'month') );
}, },
// Drag & drop module. draggable() {
dnd () { const { draggable, background, daysCount } = this.event;
return this.modules.dnd return (
} this.vuecal.editEvents.drag &&
} draggable &&
} !background &&
daysCount === 1
);
},
resizable() {
const { editEvents, time } = this.vuecal;
return (
editEvents.resize &&
this.event.resizable &&
time &&
!this.allDay &&
(!this.segment || (this.segment && this.segment.isLastDay)) &&
this.view.id !== "month"
);
},
// Drag & drop module.
dnd() {
return this.modules.dnd;
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
.vuecal__event { .vuecal__event {
color: #666; color: #666;
background-color: rgba(248, 248, 248, 0.8); background-color: rgba(248, 248, 248, 0.8);
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
left: 0; left: 0;
width: 100%; width: 100%;
z-index: 1; z-index: 1;
transition: box-shadow 0.3s, left 0.3s, width 0.3s; transition: box-shadow 0.3s, left 0.3s, width 0.3s;
overflow: hidden;// For sliding delete button. overflow: hidden; // For sliding delete button.
// If nothing is shown inside, still make the event visible. // If nothing is shown inside, still make the event visible.
.vuecal--no-time & {min-height: 8px;} .vuecal--no-time & {
min-height: 8px;
}
.vuecal:not(.vuecal--dragging-event) &:hover {z-index: 2;} .vuecal:not(.vuecal--dragging-event) &:hover {
z-index: 2;
}
// Reactivate user selection in events. // Reactivate user selection in events.
.vuecal__cell & * {user-select: text;} .vuecal__cell & * {
user-select: text;
}
.vuecal--view-with-time &:not(&--all-day) {position: absolute;} .vuecal--view-with-time &:not(&--all-day) {
position: absolute;
}
.vuecal--view-with-time .vuecal__bg &--all-day { .vuecal--view-with-time .vuecal__bg &--all-day {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
z-index: 0; z-index: 0;
opacity: 0.6; opacity: 0.6;
width: auto; width: auto;
right: 0; right: 0;
} }
.vuecal--view-with-time .vuecal__all-day &--all-day { .vuecal--view-with-time .vuecal__all-day &--all-day {
position: relative; position: relative;
left: 0; left: 0;
} }
&--background {z-index: 0;} &--background {
&--focus, &:focus {box-shadow: 1px 1px 6px rgba(0,0,0,0.2);z-index: 3;outline: none;} z-index: 0;
}
&--focus,
&:focus {
box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.2);
z-index: 3;
outline: none;
}
&.vuecal__event--dragging {opacity: 0.7;} &.vuecal__event--dragging {
&.vuecal__event--static {opacity: 0;transition: opacity 0.1s;} opacity: 0.7;
}
&.vuecal__event--static {
opacity: 0;
transition: opacity 0.1s;
}
} }
// Firefox sets a half opacity already, so don't dim the element being dragged. // Firefox sets a half opacity already, so don't dim the element being dragged.
@-moz-document url-prefix() { @-moz-document url-prefix() {
.vuecal__event.vuecal__event--dragging {opacity: 1;} .vuecal__event.vuecal__event--dragging {
opacity: 1;
}
} }
.vuecal__event-resize-handle { .vuecal__event-resize-handle {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
height: 1em; height: 1em;
background-color: rgba(255, 255, 255, 0.3); background-color: rgba(255, 255, 255, 0.3);
opacity: 0; opacity: 0;
transform: translateY(110%); transform: translateY(110%);
transition: 0.3s; transition: 0.3s;
cursor: ns-resize; cursor: ns-resize;
.vuecal__event:hover &, .vuecal__event:hover &,
.vuecal__event:focus &, .vuecal__event:focus &,
.vuecal__event--focus &, .vuecal__event--focus &,
.vuecal__event--resizing & {opacity: 1;transform: translateY(0);} .vuecal__event--resizing & {
.vuecal__event--dragging & {display: none;} opacity: 1;
transform: translateY(0);
}
.vuecal__event--dragging & {
display: none;
}
} }
.vuecal__event-delete { .vuecal__event-delete {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 1.4em; height: 1.4em;
line-height: 1.4em; line-height: 1.4em;
background-color: rgba(221, 51, 51, 0.85); background-color: rgba(221, 51, 51, 0.85);
color: #fff; color: #fff;
z-index: 0; z-index: 0;
cursor: pointer; cursor: pointer;
transform: translateY(-110%); transform: translateY(-110%);
transition: 0.3s; transition: 0.3s;
.vuecal__event & {user-select: none;} .vuecal__event & {
user-select: none;
}
.vuecal--full-height-delete & { .vuecal--full-height-delete & {
height: auto; height: auto;
bottom: 0; bottom: 0;
&:before { &:before {
content: ''; content: "";
width: 1.7em; width: 1.7em;
height: 1.8em; height: 1.8em;
display: block; display: block;
background-image: url('data:image/svg+xml;utf8,<svg width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.5a10.5 10.5 0 100 21 10.5 10.5 0 000-21zm5 14.1c.2 0 .2.2.2.2l-.1.3-1 1-.3.1h-.2L12 13.5l-3.5 3.6h-.3-.3l-1-1v-.4-.2l3.6-3.6-3.6-3.5A.4.4 0 017 8l1-1 .3-.2c.1 0 .2 0 .2.2l3.6 3.5L15.6 7l.2-.2c.1 0 .2 0 .3.2l1 1v.5L13.5 12z" fill="%23fff" opacity=".9"/></svg>'); background-image: url('data:image/svg+xml;utf8,<svg width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.5a10.5 10.5 0 100 21 10.5 10.5 0 000-21zm5 14.1c.2 0 .2.2.2.2l-.1.3-1 1-.3.1h-.2L12 13.5l-3.5 3.6h-.3-.3l-1-1v-.4-.2l3.6-3.6-3.6-3.5A.4.4 0 017 8l1-1 .3-.2c.1 0 .2 0 .2.2l3.6 3.5L15.6 7l.2-.2c.1 0 .2 0 .3.2l1 1v.5L13.5 12z" fill="%23fff" opacity=".9"/></svg>');
} }
} }
.vuecal__event--deletable & {transform: translateY(0);z-index: 1;} .vuecal__event--deletable & {
.vuecal__event--deletable.vuecal__event--dragging & { transform: translateY(0);
opacity: 0; z-index: 1;
transition: none; }
} .vuecal__event--deletable.vuecal__event--dragging & {
opacity: 0;
transition: none;
}
} }
.vuecal--month-view .vuecal__event-title { .vuecal--month-view .vuecal__event-title {
font-size: 0.85em; font-size: 0.85em;
} }
.vuecal--short-events .vuecal__event-title { .vuecal--short-events .vuecal__event-title {
text-align: left; text-align: left;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
padding: 0 3px; padding: 0 3px;
} }
.vuecal__event-title, .vuecal__event-title,
.vuecal__event-content { .vuecal__event-content {
hyphens: auto; hyphens: auto;
} }
.vuecal__event-title--edit { .vuecal__event-title--edit {
border-bottom: 1px solid transparent; border-bottom: 1px solid transparent;
text-align: center; text-align: center;
transition: 0.3s; transition: 0.3s;
color: inherit; color: inherit;
background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M442 150l-39 39-80-80 39-39q6-6 15-6t15 6l50 50q6 6 6 15t-6 15zM64 368l236-236 80 80-236 236H64v-80z" fill="%23000" opacity=".4"/></svg>'); background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M442 150l-39 39-80-80 39-39q6-6 15-6t15 6l50 50q6 6 6 15t-6 15zM64 368l236-236 80 80-236 236H64v-80z" fill="%23000" opacity=".4"/></svg>');
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 120% 0.15em; background-position: 120% 0.15em;
background-size: 0.4em; background-size: 0.4em;
outline: none; outline: none;
width: 100%; width: 100%;
&:hover, &:focus { &:hover,
border-color: rgba(0, 0, 0, 0.4); &:focus {
background-position: 99% 0.15em; border-color: rgba(0, 0, 0, 0.4);
background-size: 1.2em; background-position: 99% 0.15em;
} background-size: 1.2em;
}
} }
</style> </style>
@@ -233,7 +233,7 @@ export default {
width: 10px width: 10px
// HEADING // HEADING
.vuecal__weekdays-headings, .vuecal__weekdays-headings,
.vuecal__cell:before .vuecal__cell:before
border: none border: none
@@ -328,7 +328,7 @@ export default {
.event-initials-wrapper .event-initials-wrapper
margin-bottom: 0 margin-bottom: 0
.event-initials .event-initials
margin-right: 0 margin-right: 0
h3 h3
font-size: 14px !important font-size: 14px !important
@@ -337,7 +337,7 @@ export default {
white-space: nowrap white-space: nowrap
overflow: hidden overflow: hidden
margin: 0 margin: 0
.event-initials-date .event-initials-date
display: none !important display: none !important
+4 -4
View File
@@ -5,9 +5,9 @@
<Z-timeline :calData="timelineData" :calConfig="config" @eventMoved="onEventMoved" /> <Z-timeline :calData="timelineData" :calConfig="config" @eventMoved="onEventMoved" />
</W-loadable> </W-loadable>
<v-snackbar <v-snackbar
v-model="errorToast" v-model="errorToast"
:timeout="2000" :timeout="2000"
color="red" color="red"
:rounded="true" :rounded="true"
> >
@@ -80,7 +80,7 @@ export default {
}, },
async onEventMoved(event) { async onEventMoved(event) {
console.log(event) console.log(`ID from dragStop: ${event.event.id}`)
// try { // try {
// await this.$axios.post_auth_data(`v1/overview/tasks/${event.event.id}`, {start: event.event.start, end: event.event.end}) // await this.$axios.post_auth_data(`v1/overview/tasks/${event.event.id}`, {start: event.event.start, end: event.event.end})
// } catch(error) { // } catch(error) {