ProSchedulerSign in

Timeline · Drag & drop

Conditional move and resize

Some assignments stay with their person (resourceEditable: false), some keep their dates (dragInTime: false) and can only be reassigned, some keep their length (resize: false).

Live demo

Drag a “stays with this person” bar up · Drag a “dates fixed” bar sideways, then to another row

Fullscreen
import { ProScheduler, type SchedulerEvent } from "@andreisaac/pro-scheduler"
import { studioAssignments, studioResources } from "./data/studio"
import { useEvents } from "./kit"

export function TimelineRestrictionsDemo() {
  const { events, handlers } = useEvents<SchedulerEvent>(() =>
    studioAssignments().map((event, i) => {
      if (i % 4 === 0) return { ...event, resourceEditable: false, title: `${event.title} · stays with this person` }
      if (i % 4 === 1) return { ...event, dragInTime: false, title: `${event.title} · dates fixed` }
      if (i % 4 === 2) return { ...event, resize: false, title: `${event.title} · fixed length` }
      return event
    })
  )

  return (
    <ProScheduler
      data={events}
      resources={studioResources}
      view={{ timeline: { type: "month" } }}
      height={540}
      {...handlers}
    />
  )
}

About this demo

Some assignments stay with their person (resourceEditable: false), some keep their dates (dragInTime: false) and can only be reassigned, some keep their length (resize: false).

Things to try

  • Drag a “stays with this person” bar up
  • Drag a “dates fixed” bar sideways, then to another row

The props behind it are explained in Rules and backgrounds.

Use ProScheduler in your project