frappe-ui 0.1.271 → 0.1.273
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/frappe/drive/components/MoveDialog.vue +1 -1
- package/frappe/drive/components/RenameDialog.vue +1 -1
- package/package.json +1 -1
- package/src/components/Calendar/Calendar.vue +20 -2
- package/src/components/Calendar/CalendarDaily.vue +14 -8
- package/src/components/Calendar/CalendarMonthEvent.vue +88 -0
- package/src/components/Calendar/CalendarMonthly.vue +21 -27
- package/src/components/Calendar/CalendarTimeMarker.vue +1 -1
- package/src/components/Calendar/CalendarWeekDayEvent.vue +342 -0
- package/src/components/Calendar/CalendarWeekly.vue +26 -57
- package/src/components/Calendar/EventModalContent.vue +4 -19
- package/src/components/Calendar/NewEventModal.vue +1 -1
- package/src/components/Calendar/ShowMoreCalendarEvent.vue +12 -9
- package/src/components/Calendar/style.css +44 -0
- package/src/components/Calendar/useEventBase.js +149 -0
- package/src/components/ListView/ListRow.vue +30 -5
- package/src/components/TextEditor/commands.js +1 -1
- package/src/resources/documentResource.js +15 -11
- package/src/components/Calendar/CalendarEvent.vue +0 -662
- package/src/components/Calendar/FloatingPopover.vue +0 -46
|
@@ -49,7 +49,7 @@ const open = ref(true)
|
|
|
49
49
|
const newTitle = ref('')
|
|
50
50
|
const file_ext = ref('')
|
|
51
51
|
|
|
52
|
-
if (props.entity.is_group || props.entity.doc) {
|
|
52
|
+
if (props.entity.is_group || props.entity.doc || props.entity.is_link) {
|
|
53
53
|
newTitle.value = props.entity.title
|
|
54
54
|
} else {
|
|
55
55
|
const parts = props.entity.title.split('.')
|
package/package.json
CHANGED
|
@@ -62,14 +62,22 @@
|
|
|
62
62
|
:currentMonthDates="currentMonthDates"
|
|
63
63
|
:config="overrideConfig"
|
|
64
64
|
@setCurrentDate="(d) => updateCurrentDate(d)"
|
|
65
|
-
|
|
65
|
+
>
|
|
66
|
+
<template #event-popover-content="slotProps">
|
|
67
|
+
<slot name="event-popover-content" v-bind="slotProps" />
|
|
68
|
+
</template>
|
|
69
|
+
</CalendarMonthly>
|
|
66
70
|
|
|
67
71
|
<CalendarWeekly
|
|
68
72
|
v-else-if="activeView === 'Week'"
|
|
69
73
|
:events="events"
|
|
70
74
|
:weeklyDates="datesInWeeks[week]"
|
|
71
75
|
:config="overrideConfig"
|
|
72
|
-
|
|
76
|
+
>
|
|
77
|
+
<template #event-popover-content="slotProps">
|
|
78
|
+
<slot name="event-popover-content" v-bind="slotProps" />
|
|
79
|
+
</template>
|
|
80
|
+
</CalendarWeekly>
|
|
73
81
|
|
|
74
82
|
<CalendarDaily
|
|
75
83
|
v-else-if="activeView === 'Day'"
|
|
@@ -83,6 +91,9 @@
|
|
|
83
91
|
v-bind="{ parseDateWithDay, currentDate, fullDay }"
|
|
84
92
|
/>
|
|
85
93
|
</template>
|
|
94
|
+
<template #event-popover-content="slotProps">
|
|
95
|
+
<slot name="event-popover-content" v-bind="slotProps" />
|
|
96
|
+
</template>
|
|
86
97
|
</CalendarDaily>
|
|
87
98
|
|
|
88
99
|
<NewEventModal
|
|
@@ -121,6 +132,7 @@ import CalendarWeekly from './CalendarWeekly.vue'
|
|
|
121
132
|
import CalendarDaily from './CalendarDaily.vue'
|
|
122
133
|
import NewEventModal from './NewEventModal.vue'
|
|
123
134
|
import useEventModal from './composables/useEventModal'
|
|
135
|
+
import { isAnyPopoverOpen } from './useEventBase.js'
|
|
124
136
|
|
|
125
137
|
const props = defineProps({
|
|
126
138
|
events: {
|
|
@@ -321,6 +333,11 @@ function openModal(data) {
|
|
|
321
333
|
}
|
|
322
334
|
|
|
323
335
|
function handleCellClick(e, date, time = '', isFullDay = false) {
|
|
336
|
+
if (isAnyPopoverOpen.value) {
|
|
337
|
+
isAnyPopoverOpen.value = false
|
|
338
|
+
return
|
|
339
|
+
}
|
|
340
|
+
|
|
324
341
|
const data = {
|
|
325
342
|
e,
|
|
326
343
|
view: activeView.value,
|
|
@@ -623,6 +640,7 @@ function getVisibleRange() {
|
|
|
623
640
|
const weekDates = datesInWeeks.value[week.value] || []
|
|
624
641
|
if (!weekDates.length) return null
|
|
625
642
|
const orderedWeek = [...weekDates].sort((a, b) => a - b)
|
|
643
|
+
const start = dayjs(orderedWeek[0]).startOf('day')
|
|
626
644
|
const end = dayjs(orderedWeek[orderedWeek.length - 1]).endOf('day')
|
|
627
645
|
return {
|
|
628
646
|
startDate: toDateString(start),
|
|
@@ -29,16 +29,19 @@
|
|
|
29
29
|
calendarActions.handleCellClick($event, currentDate, '', true)
|
|
30
30
|
"
|
|
31
31
|
>
|
|
32
|
-
<
|
|
32
|
+
<CalendarWeekDayEvent
|
|
33
33
|
v-for="(calendarEvent, idx) in !showCollapsable || !isCollapsed
|
|
34
34
|
? dayFullDayEvents
|
|
35
35
|
: dayFullDayEvents.slice(0, 4)"
|
|
36
|
-
class="w-[21%] cursor-pointer"
|
|
37
36
|
:event="{ ...calendarEvent, idx }"
|
|
38
37
|
:key="calendarEvent.id"
|
|
39
38
|
:date="currentDate"
|
|
40
39
|
@click.stop
|
|
41
|
-
|
|
40
|
+
>
|
|
41
|
+
<template #event-popover-content="slotProps">
|
|
42
|
+
<slot name="event-popover-content" v-bind="slotProps" />
|
|
43
|
+
</template>
|
|
44
|
+
</CalendarWeekDayEvent>
|
|
42
45
|
<Button
|
|
43
46
|
v-if="showCollapsable && isCollapsed && dayFullDayEvents.length > 4"
|
|
44
47
|
:label="dayFullDayEvents.length - 4 + ' more'"
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
<div
|
|
71
74
|
class="calendar-column relative border-l-[1px] border-outline-gray-1"
|
|
72
75
|
:class="[config.noBorder ? '' : ' border-r-[1px]']"
|
|
76
|
+
data-time-grid
|
|
73
77
|
>
|
|
74
78
|
<!-- Day Grid -->
|
|
75
79
|
<div
|
|
@@ -87,15 +91,18 @@
|
|
|
87
91
|
:style="{ height: `${hourHeight}px` }"
|
|
88
92
|
/>
|
|
89
93
|
</div>
|
|
90
|
-
<
|
|
94
|
+
<CalendarWeekDayEvent
|
|
91
95
|
v-for="(calendarEvent, idx) in timedEvents[
|
|
92
96
|
parseDate(currentDate)
|
|
93
97
|
]"
|
|
94
|
-
class="absolute mb-2 cursor-pointer"
|
|
95
98
|
:event="calendarEvent"
|
|
96
99
|
:key="calendarEvent.id"
|
|
97
100
|
:date="currentDate"
|
|
98
|
-
|
|
101
|
+
>
|
|
102
|
+
<template #event-popover-content="slotProps">
|
|
103
|
+
<slot name="event-popover-content" v-bind="slotProps" />
|
|
104
|
+
</template>
|
|
105
|
+
</CalendarWeekDayEvent>
|
|
99
106
|
<!-- Current time Marker -->
|
|
100
107
|
<CalendarTimeMarker :date="currentDate" />
|
|
101
108
|
</div>
|
|
@@ -107,16 +114,15 @@
|
|
|
107
114
|
|
|
108
115
|
<script setup>
|
|
109
116
|
import { computed, inject, onMounted, ref, watch } from 'vue'
|
|
110
|
-
import CalendarEvent from './CalendarEvent.vue'
|
|
111
117
|
import CalendarTimeMarker from './CalendarTimeMarker.vue'
|
|
112
118
|
import { Button } from '../Button'
|
|
113
119
|
import {
|
|
114
120
|
parseDate,
|
|
115
|
-
parseDateWithDay,
|
|
116
121
|
twelveHoursFormat,
|
|
117
122
|
twentyFourHoursFormat,
|
|
118
123
|
} from './calendarUtils'
|
|
119
124
|
import useCalendarData from './composables/useCalendarData'
|
|
125
|
+
import CalendarWeekDayEvent from './CalendarWeekDayEvent.vue'
|
|
120
126
|
|
|
121
127
|
const props = defineProps({
|
|
122
128
|
events: {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Popover placement="left" transition="default" @open="registerDeleteShortcut" @close="unregisterDeleteShortcut">
|
|
3
|
+
<template #target="{ togglePopover, isOpen }">
|
|
4
|
+
<div
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
class="event flex gap-1.5 min-h-6 mx-px rounded p-[5px] transition-all duration-75 w-full overflow-hidden"
|
|
7
|
+
:class="{ active: activeEvent == (props.event?.id || props.event?.name) }"
|
|
8
|
+
:style="eventBgStyle"
|
|
9
|
+
@click.stop="handleEventClick($event, togglePopover, isOpen)"
|
|
10
|
+
@dblclick.prevent="handleEventEdit($event)"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
v-if="props.event.fromTime"
|
|
14
|
+
class="event-border w-[2px] rounded shrink-0"
|
|
15
|
+
:style="eventBorderStyle"
|
|
16
|
+
/>
|
|
17
|
+
<div class="relative flex h-full select-none items-start gap-2 overflow-hidden">
|
|
18
|
+
<div v-if="config.showIcon && eventIcons[props.event.type]">
|
|
19
|
+
<component :is="eventIcons[props.event.type]" class="h-4 w-4 text-black" />
|
|
20
|
+
</div>
|
|
21
|
+
<p class="text-sm font-medium truncate" :class="{ italic: !props.event.title }">
|
|
22
|
+
{{ props.event.title || '[No title]' }}
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<template #body-main="{ close }">
|
|
29
|
+
<slot
|
|
30
|
+
name="event-popover-content"
|
|
31
|
+
:calendarEvent
|
|
32
|
+
:date
|
|
33
|
+
:isEditMode="config.isEditMode"
|
|
34
|
+
:close
|
|
35
|
+
>
|
|
36
|
+
<EventModalContent
|
|
37
|
+
:calendarEvent="calendarEvent"
|
|
38
|
+
:date="date"
|
|
39
|
+
:isEditMode="config.isEditMode"
|
|
40
|
+
@close="close"
|
|
41
|
+
@edit="
|
|
42
|
+
(e) => {
|
|
43
|
+
close()
|
|
44
|
+
handleEventEdit(e)
|
|
45
|
+
}
|
|
46
|
+
"
|
|
47
|
+
@delete="
|
|
48
|
+
() => {
|
|
49
|
+
close()
|
|
50
|
+
handleEventDelete()
|
|
51
|
+
}
|
|
52
|
+
"
|
|
53
|
+
/>
|
|
54
|
+
</slot>
|
|
55
|
+
</template>
|
|
56
|
+
</Popover>
|
|
57
|
+
|
|
58
|
+
<NewEventModal v-model="showEventModal" :event="updatedEvent" />
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script setup>
|
|
62
|
+
import './style.css'
|
|
63
|
+
|
|
64
|
+
import EventModalContent from './EventModalContent.vue'
|
|
65
|
+
import NewEventModal from './NewEventModal.vue'
|
|
66
|
+
import Popover from '../Popover/Popover.vue'
|
|
67
|
+
import { eventProps, useEventBase } from './useEventBase.js'
|
|
68
|
+
|
|
69
|
+
const props = defineProps(eventProps)
|
|
70
|
+
|
|
71
|
+
defineOptions({ inheritAttrs: false })
|
|
72
|
+
|
|
73
|
+
const {
|
|
74
|
+
activeEvent,
|
|
75
|
+
config,
|
|
76
|
+
calendarEvent,
|
|
77
|
+
updatedEvent,
|
|
78
|
+
eventIcons,
|
|
79
|
+
showEventModal,
|
|
80
|
+
eventBgStyle,
|
|
81
|
+
eventBorderStyle,
|
|
82
|
+
handleEventClick,
|
|
83
|
+
handleEventEdit,
|
|
84
|
+
handleEventDelete,
|
|
85
|
+
registerDeleteShortcut,
|
|
86
|
+
unregisterDeleteShortcut,
|
|
87
|
+
} = useEventBase(props)
|
|
88
|
+
</script>
|
|
@@ -27,23 +27,16 @@
|
|
|
27
27
|
isWeekend(date, config) && 'bg-surface-gray-1',
|
|
28
28
|
]"
|
|
29
29
|
@dragover.prevent
|
|
30
|
-
@
|
|
30
|
+
@dragenter.prevent
|
|
31
31
|
@drop="onDrop($event, date)"
|
|
32
32
|
@click="calendarActions.handleCellClick($event, date)"
|
|
33
33
|
>
|
|
34
|
-
<div
|
|
35
|
-
class="flex
|
|
36
|
-
:class="isCurrentMonth(date) ? 'text-gray-700' : 'text-gray-200'"
|
|
37
|
-
>
|
|
38
|
-
<div
|
|
39
|
-
class="flex gap-0.5 w-full flex-col items-center text-xs text-right"
|
|
40
|
-
>
|
|
34
|
+
<div class="flex justify-center font-normal">
|
|
35
|
+
<div class="flex gap-0.5 w-full flex-col items-center text-xs text-right">
|
|
41
36
|
<span
|
|
42
|
-
class="
|
|
37
|
+
class="w-full flex justify-between items-center"
|
|
43
38
|
:class="[
|
|
44
|
-
date.toDateString() === new Date().toDateString()
|
|
45
|
-
? 'p-[3px] pb-0.5'
|
|
46
|
-
: 'p-2',
|
|
39
|
+
date.toDateString() === new Date().toDateString() ? 'p-[3px] pb-0.5' : 'p-2',
|
|
47
40
|
]"
|
|
48
41
|
>
|
|
49
42
|
<div></div>
|
|
@@ -74,33 +67,38 @@
|
|
|
74
67
|
class="flex w-full flex-col justify-between"
|
|
75
68
|
v-if="timedEvents[parseDate(date)]?.length <= maxEventsInCell"
|
|
76
69
|
>
|
|
77
|
-
<
|
|
70
|
+
<CalendarMonthEvent
|
|
78
71
|
v-for="calendarEvent in timedEvents[parseDate(date)]"
|
|
79
72
|
:event="calendarEvent"
|
|
80
73
|
:date="date"
|
|
81
|
-
class="
|
|
74
|
+
class="mb-2 cursor-pointer"
|
|
82
75
|
:key="calendarEvent.id"
|
|
83
76
|
:draggable="config.isEditMode"
|
|
84
77
|
@dragstart="onDragStart($event, calendarEvent.id)"
|
|
85
78
|
@dragend="$event.target.style.opacity = '1'"
|
|
86
79
|
@dragover.prevent
|
|
87
|
-
|
|
80
|
+
>
|
|
81
|
+
<template #event-popover-content="slotProps">
|
|
82
|
+
<slot name="event-popover-content" v-bind="slotProps" />
|
|
83
|
+
</template>
|
|
84
|
+
</CalendarMonthEvent>
|
|
88
85
|
</div>
|
|
89
86
|
<div v-else class="flex w-full flex-col justify-between">
|
|
90
87
|
<ShowMoreCalendarEvent
|
|
91
88
|
v-if="timedEvents[parseDate(date)]"
|
|
92
|
-
class="z-10 cursor-pointer"
|
|
93
89
|
:draggable="config.isEditMode"
|
|
94
|
-
@dragstart="
|
|
95
|
-
onDragStart($event, timedEvents[parseDate(date)][0].id)
|
|
96
|
-
"
|
|
90
|
+
@dragstart="onDragStart($event, timedEvents[parseDate(date)][0].id)"
|
|
97
91
|
@dragend="$event.target.style.opacity = '1'"
|
|
98
92
|
@dragover.prevent
|
|
99
93
|
:events="timedEvents[parseDate(date)]"
|
|
100
94
|
:date="date"
|
|
101
95
|
:totalEventsCount="timedEvents[parseDate(date)].length"
|
|
102
96
|
@showMoreEvents="emit('setCurrentDate', date)"
|
|
103
|
-
|
|
97
|
+
>
|
|
98
|
+
<template #event-popover-content="slotProps">
|
|
99
|
+
<slot name="event-popover-content" v-bind="slotProps" />
|
|
100
|
+
</template>
|
|
101
|
+
</ShowMoreCalendarEvent>
|
|
104
102
|
</div>
|
|
105
103
|
</div>
|
|
106
104
|
</div>
|
|
@@ -112,10 +110,10 @@
|
|
|
112
110
|
<script setup>
|
|
113
111
|
import { daysList, parseDate, isWeekend } from './calendarUtils'
|
|
114
112
|
import { inject } from 'vue'
|
|
115
|
-
import CalendarEvent from './CalendarEvent.vue'
|
|
116
113
|
import useCalendarData from './composables/useCalendarData'
|
|
117
114
|
import { computed } from 'vue'
|
|
118
115
|
import ShowMoreCalendarEvent from './ShowMoreCalendarEvent.vue'
|
|
116
|
+
import CalendarMonthEvent from './CalendarMonthEvent.vue'
|
|
119
117
|
const props = defineProps({
|
|
120
118
|
events: {
|
|
121
119
|
type: Object,
|
|
@@ -136,13 +134,9 @@ const props = defineProps({
|
|
|
136
134
|
|
|
137
135
|
const emit = defineEmits(['setCurrentDate'])
|
|
138
136
|
|
|
139
|
-
const timedEvents = computed(
|
|
140
|
-
() => useCalendarData(props.events, 'Month').timedEvents.value,
|
|
141
|
-
)
|
|
137
|
+
const timedEvents = computed(() => useCalendarData(props.events, 'Month').timedEvents.value)
|
|
142
138
|
|
|
143
|
-
const maxEventsInCell = computed(() =>
|
|
144
|
-
props.currentMonthDates.length > 35 ? 1 : 2,
|
|
145
|
-
)
|
|
139
|
+
const maxEventsInCell = computed(() => (props.currentMonthDates.length > 35 ? 1 : 2))
|
|
146
140
|
|
|
147
141
|
function isCurrentMonth(date) {
|
|
148
142
|
return date.getMonth() === props.currentMonth
|