• Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 9 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A pure React implementation of a drag and drop scheduler

Codetree

Legit Scheduler

A pure React implementation of a drag and drop scheduler

Usage

Install it:

$ npm install --save legit-scheduler

Import it:

import Scheduler from 'legit-scheduler'

The scheduler component has three required props: events - An array of event objects resources - An array of resources width - The width of the scheduler container, in pixels. An integer.

The resources array is just strings:

['Resource 1', 'Resource 2', 'Resource 3']

The events array is an array of objects:

{
  title: 'A great event',  // Required: The title of the event
  startDate: '2016-01-24', // Required: The start date, must be in the format of "YYYY-MM-DD"
  duration: 4,             // Required: The duration of the event in days
  resource: 'Resource 1',  // Required: The name of the resource the event belongs to. Must match the resource name from the resources prop
  id: '3829-fds89',        // Required: A unique identifier. This can be anything you want as long as it's unique
  disabled: false,         // Optional: Whether or not this event can be moved (it can still be resized). Defaults to false.
  styles: {}               // Optional: An object of styles to apply to the event object
}

The scheduler component also takes more optional props:

onEventChanged - A call back that is fired when the event is moved. It receives an object containing the new event props
onEventResized - A call back that is fired when the event is resized. It receives an object containing the new event props
onEventClicked - A call back that is fired when the event is clicked. It receives an object containing the event props
onCellClicked - A call back that is fired when an empty cell on the scheduler is clicked. It receives the date and resource name as props
onRangeChanged - A call back that is fired when the date range is changed. It receives a DateRange object with the new range.
from - Either a date string or a RangeDate object defining the start date for the range. to - Either a date string or a RangeDate object defining the end date for the range.

Development

$ npm install
$ npm run example

Visit: localhost:8080/example

More Repositories

1

tests

Chainable, easy to read, React testing library
JavaScript
248
star
2

react-fetch

Component wrapper for isomorphic-fetch, passes response to children
JavaScript
120
star
3

ReactJSNews

Everything from reactjsnews.com :)
CSS
119
star
4

modal

a react modal that lets you easily customize the css
JavaScript
92
star
5

legible

the cleanest way to make http requests in js / node
JavaScript
47
star
6

image

an img tag, with lazy loading
JavaScript
47
star
7

redux-save

Full featured middleware for handling async actions and automagically saving data (For RN & Web)
JavaScript
32
star
8

table

the simplest, most hands-off table helper
JavaScript
31
star
9

context-menu

Replace the native right-click context menu with your own info
JavaScript
30
star
10

popover

Popovers for React
JavaScript
29
star
11

immutable-proxy

JavaScript
28
star
12

redux-tutorial

code from a tutorial
JavaScript
26
star
13

forms

Form and schema builder for React **not ready for use yet**
JavaScript
16
star
14

tabs

tabs, done right
JavaScript
14
star
15

fader

a HOC that will fade a component in and out
JavaScript
11
star
16

override-decorator

Simple override decorator for ES7
JavaScript
4
star
17

enzymed

decorators and automatic testing for enzyme by airbnb
JavaScript
3
star
18

rubyfill

An (opinionated) collection of Ruby'ish polyfills for JavaScript
JavaScript
2
star
19

accordion

A simple accordion component based on Thoughbot's accordion in refills
JavaScript
1
star
20

cards

A simple component to render cards from the Thoughtbot Refills library
JavaScript
1
star
21

id

a small utility for generating unique id's (useful for React)
JavaScript
1
star