4.0.0 • Published 1 year ago

scheduler-calendarr v4.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

scheduler-calendar

Scheduler Calendar Component for React Js

NPM JavaScript Style GuideDownloads

Installation

npm install --save scheduler-calendar

Usage

import React, { Component } from 'react'

import SchedulerCalendar from 'scheduler-calendar'
import 'scheduler-calendar/dist/index.css'

class Example extends Component {
  render() {
    return (
      <SchedulerCalendar
              availabilities={[
                {
                  day: "mon",
                  slots: [
                    {from: '09:00', to: '10:30'},
                    {from: '11:30', to: '13:00'},
                    {from: '14:30', to: '17:00'},
                  ],
                  comment: "Test comment"
                },
                {
                  day: "2021-01-26",
                  slots: [
                    {from: '09:00', to: '10:30'},
                    {from: '11:30', to: '19:00'},
                  ]
                },
              ]}
              availabilityType={'infinity'}
              duration={10}
              onIntervalChange={() => {}}
            />
    )
  }
}

SchedulerCalendar Props

PropTypeDescription
availabilitiesArrayList of availabilities. Eg. [{day: "mon", "slots": [{from: "11:00", to: "13:00"}], comment?: "Comment here"}]
durationnumberMinimum duration of time interval
onIntervalChangeFunctionCallback when a interval is updated and it's contains the array of updated values
availabilityTypestringvalues must be one of rolling (for number of days) or range or infinity
availabilityEndDateMomentend of date range when availability type is 'range'
availabilityStartDateMomentstart of date range when availability type is 'range'
availabilityRollingnumbernumber of rolling days when availability type is 'rolling'
initialRenderOfRowsnumberOptional. number of rows to render at initial
totalNumOfRowsnumberOptional. total number of rows for calendar
tableContainerStylestringOptional. to style calendar
dayContainerStylestringOptional. to style each cell of calendar
dayTextStylestringOptional. to style day text
intervalsWrapStylestringOptional. to style wrapper of interval shown in calendar
is24hourbooleanOptional. true if time in 24 hours
topHeaderStylestringOptional. to style header container
isBusinessDaysbooleanOptional. to avoid sundays and saturdays in rolling days
isDisabledDateLockedbooleanOptional. to turn off changing the availability for past date
stylesOfDayFunctionOptional. Callback with 3 parameters ( day: Date, isAvailable: Boolean, isRolling: Boolean ) for conditional styling
intervalStylesObjectOptional. To style each intervals inside a cell
customHeaderComponentFunctionFunction to return custom header
inputRefanyRef object
isCommentEnabledbooleanOptional. default false. to enable or disable comment sections for a day
isEditEnabledbooleanOptional. default true. to enable or disable edit availabilities

Screenshots

Authors

License

MIT © Stead