Skip to content

Commit

Permalink
update to quasar 0.16 and ensure compatibility; cleanup and add watch…
Browse files Browse the repository at this point in the history
…es for changes to the eventsArray and startDate to hopefully better catch page refreshes; add function to get a string version of an event ID which should allow for IDs that are not integers; remove the "blankCalendarEvent" variables in favor of just checking to see if an eventObject is empty; make sure empty array and object properties are defined by a function (thank you @dreglad)
  • Loading branch information
Chris Benjamin committed May 24, 2018
1 parent 2ea4384 commit 38d9f89
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 117 deletions.
92 changes: 46 additions & 46 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
{
"name": "quasar-calendar",
"version": "0.2.2",
"description": "A full display calendar for the Quasar vue.js framework",
"keywords": [
"vue",
"quasar",
"quasar-framework",
"calendar"
],
"bugs": "https://github.com/stormseed/quasar-calendar/issues",
"repository": {
"type": "git",
"url": "https://github.com/stormseed/quasar-calendar.git"
},
"homepage": "https://github.com/stormseed/quasar-calendar",
"author": "Chris Benjamin <[email protected]>",
"license": "MIT",
"main": "src/index.js",
"files": [
"src/index.js",
"src/**/*js",
"src/**/*vue",
"src/**/*styl",
"package.json"
],
"dependencies": {
"lodash.has": "^4.5.2",
"luxon": "^0.5.8"
},
"devDependencies": {
"babel-eslint": "8.2.1",
"eslint": "4.15.0",
"eslint-config-standard": "10.2.1",
"eslint-friendly-formatter": "3.0.0",
"eslint-loader": "1.7.1",
"eslint-plugin-html": "^4.0.2",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-node": "5.2.0",
"eslint-plugin-promise": "3.4.0",
"eslint-plugin-standard": "3.0.1",
"eslint-plugin-vue": "4.0.0",
"quasar-cli": "^0.15.7"
},
"peerDependencies": {
"quasar-framework": "^0.15.6"
}
"name": "quasar-calendar",
"version": "0.2.3",
"description": "A full display calendar for the Quasar vue.js framework",
"keywords": [
"vue",
"quasar",
"quasar-framework",
"calendar"
],
"bugs": "https://github.com/stormseed/quasar-calendar/issues",
"repository": {
"type": "git",
"url": "https://github.com/stormseed/quasar-calendar.git"
},
"homepage": "https://github.com/stormseed/quasar-calendar",
"author": "Chris Benjamin <[email protected]>",
"license": "MIT",
"main": "src/index.js",
"files": [
"src/index.js",
"src/**/*js",
"src/**/*vue",
"src/**/*styl",
"package.json"
],
"dependencies": {
"lodash.has": "^4.5.2",
"luxon": "^1.2.1"
},
"devDependencies": {
"babel-eslint": "^8.2.3",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.0.0",
"eslint-plugin-html": "^4.0.3",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.1.0",
"eslint-plugin-vue": "^4.5.0",
"quasar-cli": "^0.16.1"
},
"peerDependencies": {
"quasar-framework": "^0.16.0"
}
}
14 changes: 13 additions & 1 deletion src/components/calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
eventArray: {
type: Array,
default: []
default: () => []
},
eventRef: {
type: String,
Expand Down Expand Up @@ -234,12 +234,24 @@
switchToSingleDay: function (params) {
this.setTimePeriod(params)
this.$refs.fullCalendarTabs.selectTab('tab-single-day-component')
},
doUpdate: function () {
this.mountSetDate()
}
},
mounted () {
this.mountSetDate()
this.parseEventList()
this.setupEventsHandling()
},
watch: {
startDate: 'handleStartChange',
eventArray: function () {
this.getPassedInEventArray()
},
parsedEvents: function () {
this.getPassedInParsedEvents()
}
}
}
</script>
Expand Down
22 changes: 12 additions & 10 deletions src/components/calendar/CalendarAgenda.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<calendar-agenda-event
v-if="dateGetEvents(forwardDate, true)"
v-for="thisEvent in dateGetEvents(forwardDate)"
:key="makeDT(forwardDate).toISODate() + thisEvent.id.toString()"
:key="makeDT(forwardDate).toISODate() + getEventIdString(thisEvent)"
:event-object="thisEvent"
:event-ref="eventRef"
:calendar-locale="calendarLocale"
Expand Down Expand Up @@ -110,7 +110,7 @@
class="full-width"
v-if="dateGetEvents(forwardDate)"
v-for="thisEvent in dateGetEvents(forwardDate, true)"
:key="makeDT(forwardDate).toISODate() + thisEvent.id.toString()"
:key="makeDT(forwardDate).toISODate() + getEventIdString(thisEvent)"
>
<calendar-agenda-event
:event-object="thisEvent"
Expand Down Expand Up @@ -247,9 +247,9 @@
this.localNumDays += this.numJumpDays
done()
},
handleStartChange: function (val, oldVal) {
this.doUpdate()
},
// handleStartChange: function (val, oldVal) {
// this.doUpdate()
// },
doUpdate: function () {
this.mountSetDate()
},
Expand Down Expand Up @@ -294,11 +294,13 @@
)
},
watch: {
startYear: 'handleStartChange',
startMonth: 'handleStartChange',
startDay: 'handleStartChange',
eventArray: 'getPassedInEventArray',
parsedEvents: 'getPassedInParsedEvents'
startDate: 'handleStartChange',
eventArray: function () {
this.getPassedInEventArray()
},
parsedEvents: function () {
this.getPassedInParsedEvents()
}
}
}
</script>
Expand Down
20 changes: 2 additions & 18 deletions src/components/calendar/CalendarAgendaEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
props: {
eventObject: {
type: Object,
default: this.blankCalendarEvent
default: () => {}
},
agendaStyle: {
type: String,
Expand Down Expand Up @@ -93,23 +93,7 @@
},
mixins: [CalendarMixin],
data () {
return {
blankCalendarEvent: {
id: 0,
summary: '...',
description: '...',
start: {
dateTime: '2020-01-01 00:00:00',
isAllDay: false,
timeZone: 'America/New_York'
},
end: {
dateTime: '2020-01-01 01:00:00',
isAllDay: false,
timeZone: 'American/New_York'
}
}
}
return {}
},
computed: {},
methods: {
Expand Down
16 changes: 8 additions & 8 deletions src/components/calendar/CalendarAllDayEvents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
>
<calendar-event
v-for="thisEvent in dateGetEvents(addDaysToDate(workingDate, addDays - 1))"
:key="makeDT(addDaysToDate(workingDate, addDays - 1)).toISODate() + thisEvent.id.toString()"
:key="makeDT(addDaysToDate(workingDate, addDays - 1)).toISODate() + getEventIdString(thisEvent)"
v-if="thisEvent.start.isAllDay"
:event-object="thisEvent"
:show-time="false"
Expand All @@ -28,8 +28,8 @@
import CalendarMixin from './mixins/CalendarMixin'
import CalendarEventMixin from './mixins/CalendarEventMixin'
import CalendarEvent from './CalendarEvent'
import { date } from 'quasar'
const { DateTime } = require('luxon')
// import { date } from 'quasar'
// const { DateTime } = require('luxon')
export default {
name: 'CalendarAllDayEvents',
props: {
Expand All @@ -39,7 +39,7 @@
},
parsed: {
type: Object,
default: {}
default: () => {}
},
numberOfDays: {
type: Number,
Expand Down Expand Up @@ -67,12 +67,12 @@
computed: {
cellWidth: function () {
return this.calculateDayCellWidth(this.numberOfDays)
},
}
},
methods: {
handleStartChange: function (val, oldVal) {
this.doUpdate()
},
// handleStartChange: function (val, oldVal) {
// this.doUpdate()
// },
doUpdate: function () {
this.mountSetDate()
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/calendar/CalendarDayColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div
v-if="dateEvents.length > 0"
v-for="eventObject in dateEvents"
:key="makeDT(workingDate).toISODate() + eventObject.id.toString()"
:key="makeDT(workingDate).toISODate() + getEventIdString(eventObject)"
:class="calculateDayEventClass(eventObject)"
:style="calculateDayEventStyle(eventObject)"
>
Expand Down Expand Up @@ -44,7 +44,7 @@
},
dateEvents: {
type: Array,
default: []
default: () => []
},
columnCssClass: {
type: String,
Expand Down
21 changes: 2 additions & 19 deletions src/components/calendar/CalendarEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

<script>
import {
date,
QBtn,
QTooltip
} from 'quasar'
Expand All @@ -36,7 +35,7 @@
props: {
eventObject: {
type: Object,
default: this.blankCalendarEvent
default: () => {}
},
color: {
type: String,
Expand Down Expand Up @@ -76,23 +75,7 @@
},
mixins: [CalendarMixin, CalendarEventMixin],
data () {
return {
blankCalendarEvent: {
id: 0,
summary: '...',
description: '...',
start: {
dateTime: '2020-01-01 00:00:00',
isAllDay: false,
timeZone: 'America/New_York'
},
end: {
dateTime: '2020-01-01 01:00:00',
isAllDay: false,
timeZone: 'American/New_York'
}
}
}
return {}
},
computed: {
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/calendar/CalendarEventDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
props: {
eventObject: {
type: Object,
default: this.blankCalendarEvent
default: () => {}
},
calendarLocale: {
type: String,
Expand Down
7 changes: 3 additions & 4 deletions src/components/calendar/CalendarMonth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
import CalendarMixin from './mixins/CalendarMixin'
import CalendarEventMixin from './mixins/CalendarEventMixin'
import {
date,
QBtn,
QTooltip,
QTabs,
Expand Down Expand Up @@ -186,9 +185,9 @@
// console.debug('monthGetDateEvents called with %s, returning %O', this.formatToSqlDate(dateObject), this.stripObject(returnVal))
return returnVal
},
handleStartChange: function (val, oldVal) {
debounce(this.doUpdate, 300)
},
// handleStartChange: function (val, oldVal) {
// debounce(this.doUpdate, 300)
// },
doUpdate: function () {
this.mountSetDate()
this.generateCalendarCellArray()
Expand Down
8 changes: 4 additions & 4 deletions src/components/calendar/CalendarMultiDay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
v-for="thisDate in weekDateArray"
:key="makeDT(thisDate).toISODate()"
:start-date="thisDate"
:date-events="dateGetEvents(thisDate)"
:date-events="dateGetEvents(thisDate, true)"
column-css-class="calendar-day-column-content"
:style="{ 'width': dayCellWidth }"
:event-ref="eventRef"
Expand Down Expand Up @@ -242,9 +242,9 @@
return this.makeDT(this.workingDate).toFormat('MMMM yyyy')
}
},
handleStartChange: function (val, oldVal) {
this.doUpdate()
},
// handleStartChange: function (val, oldVal) {
// this.doUpdate()
// },
doUpdate: function () {
this.mountSetDate()
this.buildWeekDateArray(this.numDays, this.sundayFirstDayOfWeek)
Expand Down
Loading

0 comments on commit 38d9f89

Please sign in to comment.