import { EventStore , parseEvents } from './event-store' ; import { EventInput } from './event-parse' ; import { DateSpanApi } from './date-span' ; import { EventApi } from '../api/EventApi' ; import { SplittableProps } from '../component/event-splitting' ; import { CalendarContext } from '../CalendarContext' ; export type ConstraintInput = 'businessHours' | string | EventInput | EventInput [ ] ; export type Constraint = 'businessHours' | string | EventStore | false ; export type OverlapFunc = ( ( stillEvent : EventApi , movingEvent : EventApi | null ) => boolean ) ; export type AllowFunc = ( span : DateSpanApi , movingEvent : EventApi | null ) => boolean ; export type isPropsValidTester = ( props : SplittableProps , context : CalendarContext ) => boolean ; export function normalizeConstraint ( input , context ) { if ( Array . isArray ( input ) ) { return parseEvents ( input , null , context , true ) ; } if ( typeof input === 'object' && input ) { return parseEvents ( [ input ] , null , context , true ) ; } if ( input != null ) { return String ( input ) ; } return null ; }