GithubHelp home page GithubHelp logo

stormseed / daykeep-calendar-quasar Goto Github PK

View Code? Open in Web Editor NEW
270.0 22.0 71.0 1.39 MB

A full event display calendar for the Quasar framework that has multiple viewing formats.

License: MIT License

JavaScript 75.12% Vue 23.40% CSS 1.47%

daykeep-calendar-quasar's Introduction

Daykeep Calendar

An event display calendar for the Quasar framework.

screenshot

Formerly known as Quasar Calendar, Daykeep Calendar for Quasar is a Quasar-flavored Vue.js calendar component.

Demo

You can see a demo of the calendar components with event data at:

Daykeep Calendar for Quasar demo

Setup

Version 1.0.x of Daykeep Calendar is intended to be used with Quasar Framework v1. For legacy versions of Quasar, you should use v0.3.x of Quasar Calendar.

yarn add @daykeep/calendar-quasar

Add Daykeep Calendar to your .vue page similar to a Quasar component

import { DaykeepCalendar } from '@daykeep/calendar-quasar'

or import individual components

import {
  DaykeepCalendarMonth,
  DaykeepCalendarAgenda,
  DaykeepCalendarMultiDay
} from '@daykeep/calendar-quasar'

In your template, you can just put in a calendar viewer using the current date as the start date

<daykeep-calendar />

Or you can pass in parameters to customize

<daykeep-calendar-month
  :start-date="Date('2019-01-01')"
  :event-array="someEventObject"
  :sunday-first-day-of-week="true"
  calendar-locale="fr"
  calendar-timezone="Europe/Paris"
  :allow-editing="false"
  :render-html="true"
/>

Event data format

The event data format is meant to be a subset of the Google Calendar v3 API (this is still a work in progress). Events should be passed in as an array of objects. Each object can have elements like in this example:

[
  {
    id: 1,
    summary: 'Test event',
    description: 'Some extra info goes here',
    location: 'Office of the Divine Randomness, 1232 Main St., Denver, CO',
    start: {
      dateTime: '2018-02-16T14:00:00', // ISO 8601 formatted
      timeZone: 'America/New_York' // Timezone listed as a separate IANA code
    },
    end: {
      dateTime: '2018-02-16T16:30:00',
      timeZone: 'American/New_York'
    },
    color: 'positive',
    attendees: [
      {
        id: 5,
        email: '[email protected]',
        displayName: 'John Q. Public',
        organizer: false,
        self: false,
        resource: false
      }
    ]
  },
  {
    id: 2,
    summary: 'Test all-day event',
    description: 'Some extra info goes here',
    start: {
      date: '2018-02-16' // A date variable indicates an all-day event
    },
    end: {
      date: '2018-02-19'
    }
  },
    {
      id: 3,
      summary: 'Some other test event',
      description: 'Some extra info goes here',
      start: {
        dateTime: '2018-02-17T10:00:00+0500', // timezone embedded in dateTime
      },
      end: {
        dateTime: '2018-02-17T12:30:00+0500',
      },
    },
]

Each object needs to have a unique ID. The date time should be in ISO 8601 format. A value in the optional timeZone field will override the timezone.

Calendar event referencing

Each calendar is given a random reference string so that we can distinguish between multiple calendars on a page. You can override this and pass in a string so that you can listen for events from that calendar. In this case, if we pass in the string MYCALENDAR, the Vue.js event click-event-MYCALENDAR would fire on the global event bus when a calendar event is clicked on.

Custom event detail handling

By default we use our own event detail popup when an event is clicked. You can override this and use your own by doing a few things:

  • Pass in an event reference string
  • Prevent the default event detail from showing up
  • Listen for a click event to trigger your own detail content

So to implement, be sure to have prevent-event-detail and event-ref set when you embed a calendar component:

<daykeep-calendar
  event-ref="MYCALENDAR"
  :prevent-event-detail="true"
  :event-array="someEventObject"
/>

And then somewhere be sure to be listening for a click event on that calendar:

this.$root.$on(
  'click-event-MYCALENDAR',
  function (eventDetailObject) {
    // do something here
  }
)

Event editing

Starting with v0.3 we are setting up the framework to allow for editing individual events. By default this functionality is turned off, but you can pass a value of true into the allow-editing parameter on one of the main calendar components. The functionality if very limited to start but we expect to be adding more features in the near future.

When an event is edited, a global event bus message in the format of update-event-MYCALENDAR is sent with the updated event information as the payload. You can listen for this to trigger a call to whatever API you are using for calendar communication. Right now when an update is detected the passed in eventArray array is updated and the array is parsed again.

Only a subset of fields are currently editable:

  • Start / end time and date
  • Is an all-day event
  • Summary / title
  • Description

Calendar Month Day Click Events

The DaykeepCalendarMonth component triggers a "click-day-{eventRef}" event when a calendar cell is clicked. The event data is an object describing the day, with a day, month, and year property each set to the appropriate value for the selected day.

So for a <daykeep-calendar-month> component with a "MYCALENDAR" event-ref:

this.$root.$on(
  'click-day-MYCALENDAR',
  function (day) {
    // do something here
  }
)

Individual Vue components

The usable components of DaykeepCalendar, DaykeepCalendarMonth, DaykeepCalendarMultiDay and DaykeepCalendarAgenda share the following properties:

Vue Property Type Description
start-date JavaScript Date or Luxon DateTime A JavaScript Date or Luxon DateTime object that passes in a starting display date for the calendar to display.
sunday-first-day-of-week Boolean If true this will force month and week calendars to start on a Sunday instead of the standard Monday.
calendar-locale String A string setting the locale. We use the Luxon package for this and they describe how to set this here. This will default to the user's system setting.
calendar-timezone String Manually set the timezone for the calendar. Many strings can be passed in including UTC or any valid IANA zone. This is better explained here.
event-ref String Give the calendar component a custom name so that events triggered on the global event bus can be watched.
prevent-event-detail Boolean Prevent the default event detail popup from appearing when an event is clicked in a calendar.
allow-editing Boolean Allows for individual events to be edited. See the editing section.
render-html Boolean Event descriptions render HTML tags and provide a WYSIWYG editor when editing. No HTML validation is performed so be sure to pass the data passed in does not present a security threat.
day-display-start-hour Number Will scroll to a defined start hour when a day / multi-day component is rendered. Pass in the hour of the day from 0-23, the default being 7. Current has no effect on the CalendarAgenda component.

In addition, each individual components have the following properties:

DaykeepCalendar

Vue Property Type Description
tab-labels Object Passing in an object with strings that will override the labels for the different calendar components. Set variables for month, week, threeDay, day and agenda. Eventually we will replace this with language files and will use the calendar-locale setting.

DaykeepCalendarMultiDay

Vue Property Type Description
num-days Number The number of days the multi-day calendar. A value of 1 will change the header to be more appropriate for a single day.
nav-days Number This is how many days the previous / next navigation buttons will jump.
force-start-of-week Boolean Default is false. This is appropriate if you have a week display (7 days) that you want to always start on the first day of the week.
day-cell-height Number Default is 5. How high in units (units defined below) an hour should be.
day-cell-height-unit String Default is rem. When combined with the day-cell-height above, this will determine the CSS-based height of an hour in a day.
show-half-hours Boolean Default is false. Show ticks and labels for half hour segments.

DaykeepCalendarAgenda

Vue Property Type Description
num-days Number The number of days to initially display and also the number of additional days to load up when the user scrolls to the bottom of the agenda.
scroll-height String Defaults to 200px, this is meant to define the size of the "block" style.

daykeep-calendar-quasar's People

Contributors

dreglad avatar lpmi-13 avatar sirbeagle avatar wooliet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

daykeep-calendar-quasar's Issues

Some parallel events jump to next day in multi-day view

There seems to be one or more formatting bugs which sets the left: css property incorrectly on parallel events. This results in some parallel events showing up on the wrong day lane in the multi-day calendar.

Looking in the source code, this issue seems related to how the events prop is parsed and in particular how these variables that are used for the css positioning are determined: thisEvent.numberOfOverlaps, thisEvent.overlapIteration, and thisEvent.overlapSegment.

quasar-cal-bug

I've gotten as far as having three and four side-by-side events showing properly by hacking the calculateDayEventStyle method like this:

if (thisEvent.numberOfOverlaps == 2 && thisEvent.overlapIteration != 1 && thisEvent.overlapSegment == 1) {
  style['left'] = (thisShift - 66.66) + '%'
} else if (thisEvent.numberOfOverlaps == 2 && thisEvent.overlapIteration == 1 && thisEvent.overlapSegment == 1) {
  style['left'] = (thisShift + 33.33) + '%'
} else if (thisEvent.numberOfOverlaps == 3) {
  style['left'] = (thisShift - 25) + '%'
} else {
  style['left'] = thisShift + '%'
}

I was hoping to see a pattern and derive a generalised fix, but so far I haven't found it. Any suggestions or explanation of these variables would be very helpful in debugging further. Thanks

Uncaught Error: Module parse failed: MyPath\node_modules\quasar-calendar\src\components\calendar\Calendar.vue Unexpected token (1:0)

Am getting above error while trying to render the calendar
Full error as it appears on console
List.vue?f2e3:8 Uncaught Error: Module parse failed: MyPath\node_modules\quasar-calendar\src\components\calendar\Calendar.vue Unexpected token (1:0) You may need an appropriate loader to handle this file type. | <template> | <div class="calendar-test"> | <q-tabs class="calendar-tabs" ref="fullCalendarTabs" inverted>

Rendering :
<calendar-month :start-date="new Date()" :events="demoEvents" :sunday-first-day-of-week="true" calendar-locale="fr" calendar-timezone="Europe/Paris" :allow-editing="false" />
What might be the problem?any help is highly appreciated .

Error in nextTick: "RangeError: Maximum call stack size exceeded" using agenda-style="block"

Hi @chris Benjamin, using the following code returns the error shown above

  <template>
  <q-page padding>
    <calendar-agenda
      :eventArray="eventos"
      agenda-style="block"
      :sunday-first-day-of-week="true"
      :allow-editing="false"
      :num-days="1"
      calendar-locale="es"
      calendar-timezone="America/Argentina/Buenos_Aires"
    >
  </calendar-agenda>
  </q-page>
</template>

<script>
import { Calendar } from 'quasar-calendar'
export default {
  data () {
    return {
      eventos: [
        {
          id: 1,
          summary: 'Test event',
          description: 'Some extra info goes here',
          location: 'Inaguración del mural Puto el que lee',
          start: {
            dateTime: '2018-06-12T14:00+02:00', 
            timeZone: 'America/Argentina/Buenos_Aires' 
          },
          end: {
            dateTime: '2018-06-12T16:30+02:00',
            timeZone: 'America/Argentina/Buenos_Aires'
          },
          color: 'primary'
        },
      ]
    }
  },
  components: {
    'calendar-agenda': Calendar
  }
}
</script>

Console shows

found in 
---> <QInfiniteScroll>
       <CalendarAgenda> at node_modules/quasar-calendar/src/components/calendar/CalendarAgenda.vue

When I change the property agenda-style to "dot" works great.
Thanks.

Support for IE 11

Great component. I was wondering if support for IE11 is planned? I'm getting "SCRIPT1010: Expected identifier" in node_modules/quasar-calendar/src/components/calendar/mixins/CalendarMixin.js
Thanks

add :key="index" to all v-for loops

I'm using quasar 0.15.10 and by default it uses eslint vue plugin which requires you to have keys for the for loops.

please add keys to the loops in you vue components

Thanks

Editing an existing all-day event changes it into not an all-day event

Configuration

I set the calendar to editable as instructed:

<CalendarMonth :event-array="events" :allow-editing="true" />

But when I edit some example event item like the one below, it converts from an all-day event into a non all-day event:

{
    id: 3,
    summary: '-300',
    color: 'negative',
    // description: 'Some extra info goes here',
    start: {
        date: '2018-11-16' // A date variable indicates an all-day event
    },
    end: {
        date: '2018-11-16'
    }
}

Problem

image
Image 1: An All day event with summary of "+236", found on November 1.

image
Image 2: App correctly recognizes it as an all-day event.

image
Image 3: November 1 entry suddenly includes text "12a".

image
Image 4: This is because the event entry converted from all-day into a non all-day event starting from 12:00 AM to 11:59PM.

Expected Behavior

Supposedly, changing the summary text of an all-day event only changes the summary text of the event, and does not convert it into a datetime to datetime event.

Quasar beta build error against "do upgrade" branch

We've been building against the calendar's "do upgrade" branch, and the latest quasar beta build fails with:

ERROR in ./node_modules/quasar-calendar/component/calendar/Calendar.vue?vue&type=style&index=0&lang=stylus& (./node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-2-0!./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-2-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-oneOf-2-2!./node_modules/stylus-loader??ref--6-oneOf-2-3!./node_modules/@quasar/app/lib/webpack/loader.quasar-stylus-variables.js!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/quasar-calendar/component/calendar/Calendar.vue?vue&type=style&index=0&lang=stylus&)
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
  ModuleBuildError: Module build failed (from ./node_modules/stylus-loader/index.js):
    Error: /Users/me/Projects/project/node_modules/stylus/lib/functions/index.styl:133:36
       129| 
       130| // lighten by the given amount
       131| 
       132| lighten(color, amount)
       133|   adjust(color, 'lightness', amount)
    -------------------------------------------^
       134| 
       135| // decrease opacity by amount
       136| 
    TypeError: expected rgba or hsla, but got ident:$grey-3
    

More info:

Possibly related

quasarframework/quasar#3966 (comment)

Quasar version succeeds

quasar - v1.0.0-beta.18
@quasar/app - v1.0.0-beta.19

Quasar version fails

quasar - 1.0.0-beta.20
@quasar/app - 1.0.0-beta.22

Calendar integration

package.json

"dependencies": {
    "quasar-calendar": "github:stormseed/quasar-calendar#do_upgrade_to_1.0"
}

quasar.conf.js

  return {
    boot: [
      'quasar-calendar'
    ],

src/boot/quasar-calendar.js

import {
  Calendar,
  CalendarMonth,
  CalendarMultiDay,
  CalendarAgenda
} from 'quasar-calendar/component';

export default async ({ Vue }) => {
  Vue.component('q-calendar', Calendar);
  Vue.component('q-calendar-month', CalendarMonth);
  Vue.component('q-calendar-multi-day', CalendarMultiDay);
  Vue.component('q-calendar-agenda', CalendarAgenda);
};

[Feature Request] Current time indicator

I'm building a simple appointment scheduler, and a time indicator much like the one found in Google Calendar would be nice to have. It should be displayed when the calendar is in week or day view.

image

CalendarEventMixin 'fullComponentRef'

Hi,

I've found a problem with implementing each of the components separately.

After I edit my event, it is calling the 'update-event-calendar' global event,
however within the CalendarEventMixin,

      if (dashHas(this._props, 'fullComponentRef')) {
        // this component has a calendar parent, so don't move forward
        return
      }

The event keeps getting caught in here, even though I haven't used the full calendar component.
When I console.log'd this._props, fullComponentRef was present (as undefined), but because it was present, it wouldn't update the calendar event details.

What I'm basically saying is, this if statement needs to be updated to simply check:
if (this._props.fullComponentRef)
(Tried and tested).

[Feature request] Dynamically load events

Your component is very promising, awesome job!

I would suggest to add the possibility of loading events dynamically, as for the Quasar DataTable component. Whenever the user changes the date range, an event (or an handler) is fired to retrieve the new calendar events from a backend server.

Also it would be nice to have a 'visible date range' object, with the start and end date time objects of the current view of the calendar.

Maybe it can help: i'm using **Quasar** in a **Laravel** based solution and used code below in `webpack.mix.js`

Maybe it can help: i'm using Quasar in a Laravel based solution and used code below in webpack.mix.js

.webpackConfig({
        resolve: {
            alias: {
                'quasar-framework': path.resolve(`node_modules/quasar-framework/dist/quasar.mat.esm.js`),
                'quasar': path.resolve(`node_modules/quasar-framework/dist/quasar.mat.esm.js`),
                'quasar-variables': path.resolve(`node_modules/quasar-framework/dist/core.variables.styl`),
                'variables.styl': path.resolve(`node_modules/quasar-framework/dist/core.variables.styl`),
                'quasar-stylus': path.resolve(`node_modules/quasar-framework/dist/quasar.mat.styl`)
            }
        }
    })

You can modify the aliases to meet your environment. quasar-calendar are using the quasar and variables.styl entries. If you read the Quasar theming page, in the code is written "variables" is a Webpack alias (provided out of the box by Quasar CLI)... so, if you are not using quasar-cli you must set the aliases to match.

Originally posted by @holzhey in #25 (comment)

allow for own template of events-detail modal

I have been using the calendar as a way to show jobs rather than events and don't really have a need for guests, can I use the same Google calendar API but change the modal layout to represent my info

Separate locale from date/time format

Currently, the date and time in the calendar is formatted on the the basis of the calendar-locale property. It would be nice to be able to handle language, date format and time format using separate properties. Perhaps with date and time format falling back to locale when these properties are not set.

Error in wiki

Instead of:
:events="someEventObject"

Should be:
:eventArray="someEventObject"

Question - Show events in calendar aftter load page f5 using vuex

Hi! i have a problem in calendar on display event after reload page f5 and after create new event and close my custom modal.
When i create a variable 'events' in data, and set the event object manualy worked perfectly. But, i'm using vuex, and flux is this : I'm call FetchSchedulings from my API in Mounted. Then i set the array of the events, in store.
In Computed i return my event list objects they aren't show in my calendar, but if i clicked in other route and return in my route then are load perfectly.
whats wrong ?

image

image

before f5.
image

After f5
image

thank you!

Scrollbar can be hidden on multi-day

When in a day / multi-day view, if there are events with times on the rightmost day then they will cover the q-scroll-area scrollbar. Scrolling with a mouse thumb wheel (and I would guess touch finger drag as well) still work but it's impossible to see or drag the actual scrollbar itself.

Displaying Multi-Day Events

I am using <calendar-month> and have an events-array property set to the data we want to
display.

Events that start and end on the same day seem to display fine. However, display of events that span multiple days does not seem to work with the data I'm providing.

One of the objects in events-array contains the data:

{
  start:  { dateTime: "2018-09-24T14:00:00.000Z" },
  end: { dateTime: "2018-09-25T20:00:00.000Z" }
}

It only shows a entry on the calendar for the start day. It does not show that the event spans across two days.

Is there something else I need to be doing? Is what I'm doing now wrong in some way?

Custom Day handling on CalendarMonth Component

@sirbeagle Hi Bro !, I wonder if there is some way to handle a click on a Day in the CalendarMonth component. I just want that when you click on the day it'll route to a new page with all events on that day. Some way to implement this ? CalendarAgenda (dot property) kinda of work that way on the demo.
I seen a computed property called "calendarDaysAreClickable" but i cant get the grip on it. Thanks in advance.

Visual bug a event is ovelapped by two events that aren't between each other

image

image

Good Day. Thank you for the work on this cool component! Today testing it out I found a visual bug that happens when there are more than two events next to each other but at least only one of them has shared time between the others but the others' don't. As you can see in the attached

This seems to be a problem when you check ovelapped events before giving them the style.

If I get to find a workaround for this I'll surely share it with you guys.

Edit: Oh well just noticed this may be the same bug as the one here #33

Server-side Rendering

Hey there!
Gotta say, this is an excellent Quasar plugin.

One thing I am wondering though,
Is there support for server-side rendering the event array?

For example, switching between months/weeks/agenda periods (etc), server-side render the results onto the calendar.

Cheers

Issues when num-days is less than 7

When num-days is set to an amount less than 7 on calendar-multi-day, nav-days should override the force-start-of-week default. A good example is when num-days & nav-days are set to 1. The day/date appears to show the selected date (for example Tuesday, February 12, 2019) but will show the events for the Monday of that week.

Unknown custom element: <calendar-month>

Hi, I have a problem when i try to use quasar-calendar. After install via npm and trying to use it in my code i got error:

Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.

Parse HTML in description

Currently I can't seem to put HTML line breaks <br> or links <a> in the description field for the calendar data. Is it planned to support that?

[Vue warn]: Unknown custom element: <calendar> - did you register the component correctly?

That's the message I get if I follow the instructions on the ReadMe:

< template>
  < q-page>
    < calendar />
  < /q-page>
< /template>
<script>
import { Calendar } from 'quasar-calendar'
</script>
quasar-calendar is in node_modules

There was this compiler warning (not crash)
warning in ./src/pages/Calendar.vue
17:2-16 "export 'default' (imported as 'vue_script') was not found in '!!babel-loader!../../node_modules/vue-loader/lib/selector?type=script&index=0!./Calendar.vue'

This is not a Q- to put in quasar.config.js, and there are no instructions to create a Vue component.
I must have missed something.

Problem in use component

I have a problem.
Create default app from vue-cli 3.0.0

npm install quasar-calendar
npm install quasar-framework
npm install --save quasar

npm run dev

vue-cli-service serve

INFO Starting development server...
94% after seal

ERROR Failed to compile with 13 errors 12:21:48
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.
Failed to resolve loader: stylus-loader
You may need to install it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.