-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'update/calendar' of github-ren:YSHgroup/vue3-fullcalend…
…ar-bootstrap
- Loading branch information
Showing
9 changed files
with
162 additions
and
51 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
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 |
---|---|---|
@@ -1,7 +1,15 @@ | ||
export interface CustomEvent { | ||
id?: string | number | ||
title: string | ||
startDataTime: string | Date | ||
endDataTime: string | Date | ||
start: string | Date | null | ||
end: string | Date | null | ||
contentText?: string | ||
} | ||
export interface Timeslot { | ||
start: string | Date | null | ||
end: string | Date | null | ||
} | ||
export interface SelectedSlot { | ||
modal: boolean | ||
times: Timeslot | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import type * as FullCalendar from './builtInTypes' | ||
import type { CustomEvent } from './eventTypes' | ||
import type { CustomEvent, SelectedSlot } from './eventTypes' | ||
|
||
export type { FullCalendar, CustomEvent } | ||
export type { FullCalendar, CustomEvent, SelectedSlot } |
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 |
---|---|---|
@@ -1,5 +1,17 @@ | ||
import type { FullCalendar as F } from '@/interfaces' | ||
import { useCalendarStore } from '@/stores/calendar' | ||
|
||
export const handleDateClick = (arg: F.DateClickArg) => { | ||
alert('Date click! ' + arg.dateStr) | ||
console.log('Date click! ', arg) | ||
} | ||
|
||
export const handleSelect = (selectionInfo: any) => { | ||
const calendarStore = useCalendarStore() | ||
calendarStore.setSelectedSlot({ | ||
modal: true, | ||
times: { | ||
start: selectionInfo.start, | ||
end: selectionInfo.end | ||
} | ||
}) | ||
} |
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 |
---|---|---|
@@ -1,39 +1,63 @@ | ||
import { ref, computed } from 'vue' | ||
import { createPinia, defineStore } from 'pinia' | ||
import type { CustomEvent } from '@/interfaces' | ||
import type { CustomEvent, SelectedSlot } from '@/interfaces' | ||
|
||
export const pinia = createPinia() | ||
|
||
export const useCalendarStore = defineStore('calendar', () => { | ||
const calendarApi = ref() | ||
const modal = ref(false) | ||
const addedEvents = ref<CustomEvent[]>([]) | ||
const calendarApi = ref() | ||
const modal = ref(false) | ||
const addedEvents = ref<CustomEvent[]>([]) | ||
const selectedSlot = ref<SelectedSlot>({modal: false, times: { | ||
start: null, | ||
end: null | ||
}}) | ||
|
||
const getCalendarApi = computed(() => calendarApi.value) | ||
const getAddedEvents = computed(() => addedEvents.value) | ||
const getCalendarApi = computed(() => calendarApi.value) | ||
const getAddedEvents = computed(() => addedEvents.value) | ||
const getSelectedSlot = computed(() => selectedSlot.value) | ||
|
||
const setCalendarApi = (value: any) => { | ||
calendarApi.value = value | ||
} | ||
const setModal = () => { | ||
modal.value = !modal.value | ||
} | ||
const setAddedEvents = (value: CustomEvent | string | number , type: string) => { | ||
const id = addedEvents.value.length | ||
const newEvent = { ...value as CustomEvent, id } | ||
const setCalendarApi = (value: any) => { | ||
calendarApi.value = value | ||
} | ||
const setModal = () => { | ||
modal.value = !modal.value | ||
} | ||
const setAddedEvents = ( | ||
value: CustomEvent | string | number, | ||
type: string | ||
) => { | ||
const id = addedEvents.value.length | ||
const newEvent = { ...(value as CustomEvent), id, backgroundColor: 'chocolate' } | ||
|
||
switch (type) { | ||
case 'add': | ||
addedEvents.value.push(newEvent as CustomEvent) | ||
break | ||
case 'delete': | ||
delete addedEvents.value[value as any] | ||
break | ||
default: | ||
break | ||
} | ||
addedEvents.value.push() | ||
} | ||
switch (type) { | ||
case 'add': | ||
addedEvents.value.push(newEvent as CustomEvent) | ||
calendarApi.value && calendarApi.value.addEvent(newEvent) | ||
break | ||
case 'delete': | ||
delete addedEvents.value[value as any] | ||
break | ||
default: | ||
break | ||
} | ||
addedEvents.value.push() | ||
} | ||
const setSelectedSlot = (value: any) => { | ||
selectedSlot.value = value | ||
} | ||
|
||
return { calendarApi, modal, addedEvents, getCalendarApi, getAddedEvents, setCalendarApi, setModal, setAddedEvents } | ||
}) | ||
return { | ||
calendarApi, | ||
modal, | ||
selectedSlot, | ||
addedEvents, | ||
getCalendarApi, | ||
getAddedEvents, | ||
getSelectedSlot, | ||
setCalendarApi, | ||
setModal, | ||
setAddedEvents, | ||
setSelectedSlot, | ||
} | ||
}) |
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 @@ | ||
// vite.config.ts | ||
import { fileURLToPath, URL } from "node:url"; | ||
import { defineConfig } from "file:///F:/Git%20hub%20work/Collaborator/vue3-fullcalendar-bootstrap/node_modules/vite/dist/node/index.js"; | ||
import vue from "file:///F:/Git%20hub%20work/Collaborator/vue3-fullcalendar-bootstrap/node_modules/@vitejs/plugin-vue/dist/index.mjs"; | ||
import vueJsx from "file:///F:/Git%20hub%20work/Collaborator/vue3-fullcalendar-bootstrap/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs"; | ||
import Components from "file:///F:/Git%20hub%20work/Collaborator/vue3-fullcalendar-bootstrap/node_modules/unplugin-vue-components/dist/vite.js"; | ||
import { BootstrapVueNextResolver } from "file:///F:/Git%20hub%20work/Collaborator/vue3-fullcalendar-bootstrap/node_modules/unplugin-vue-components/dist/resolvers.js"; | ||
import sass from "file:///F:/Git%20hub%20work/Collaborator/vue3-fullcalendar-bootstrap/node_modules/sass/sass.node.mjs"; | ||
var __vite_injected_original_import_meta_url = "file:///F:/Git%20hub%20work/Collaborator/vue3-fullcalendar-bootstrap/vite.config.ts"; | ||
var vite_config_default = defineConfig({ | ||
plugins: [ | ||
vue(), | ||
vueJsx(), | ||
Components({ | ||
resolvers: [BootstrapVueNextResolver()] | ||
// Automatically register the bootstrap components globally | ||
}) | ||
], | ||
resolve: { | ||
alias: { | ||
"@": fileURLToPath(new URL("./src", __vite_injected_original_import_meta_url)) | ||
} | ||
}, | ||
css: { | ||
preprocessorOptions: { | ||
scss: { | ||
implementation: sass | ||
} | ||
} | ||
}, | ||
base: process.env.NODE_ENV === "production" ? "/vue3-fullcalendar-bootstrap/" : "/" | ||
}); | ||
export { | ||
vite_config_default as default | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJGOlxcXFxHaXQgaHViIHdvcmtcXFxcQ29sbGFib3JhdG9yXFxcXHZ1ZTMtZnVsbGNhbGVuZGFyLWJvb3RzdHJhcFwiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9maWxlbmFtZSA9IFwiRjpcXFxcR2l0IGh1YiB3b3JrXFxcXENvbGxhY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