box-ui-elements
Version:
Box UI Elements
98 lines (94 loc) • 3.31 kB
Flow
/**
* Flowtype definitions for withAnnotations.tsx
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.10.0
*/
import * as React from "react";
import getProp from "lodash/get";
import { generatePath, match as matchType, matchPath } from "react-router-dom";
import { Location } from "history";
import AnnotatorContext from "./AnnotatorContext";
import {
Action,
Annotator,
AnnotationActionEvent,
AnnotatorState,
GetMatchPath,
MatchParams,
Status
} from "./types";
import { SidebarNavigation } from '../types/SidebarNavigation';
import { type FeatureConfig } from '../feature-checking';
export type ActiveChangeEvent = {
annotationId: string | null,
fileVersionId: string,
...
};
export type ActiveChangeEventHandler = (event: ActiveChangeEvent) => void;
export type ComponentWithAnnotations = {
emitActiveAnnotationChangeEvent: (id: string | null) => void,
emitAnnotationRemoveEvent: (id: string, isStartEvent?: boolean) => void,
emitAnnotationReplyCreateEvent: (
reply: Object,
requestId: string,
annotationId: string,
isStartEvent?: boolean
) => void,
emitAnnotationReplyDeleteEvent: (
id: string,
annotationId: string,
isStartEvent?: boolean
) => void,
emitAnnotationReplyUpdateEvent: (
reply: Object,
annotationId: string,
isStartEvent?: boolean
) => void,
emitAnnotationUpdateEvent: (
annotation: Object,
isStartEvent?: boolean
) => void,
getAction: (eventData: AnnotationActionEvent) => Action,
getAnnotationsPath?: (
fileVersionId?: string,
annotationId?: string | null
) => string,
getMatchPath?: GetMatchPath,
handleActiveChange: ActiveChangeEventHandler,
handleAnnotationChangeEvent: (id: string | null) => void,
handleAnnotationCreate: (eventData: AnnotationActionEvent) => void,
handleAnnotationDelete: (eventData: AnnotationActionEvent) => void,
handleAnnotationFetchError: (x: {
error: Error,
...
}) => void,
handleAnnotationReplyCreate: (eventData: AnnotationActionEvent) => void,
handleAnnotationReplyDelete: (eventData: AnnotationActionEvent) => void,
handleAnnotationReplyUpdate: (eventData: AnnotationActionEvent) => void,
handleAnnotationUpdate: (eventData: AnnotationActionEvent) => void,
handleAnnotator: (annotator: Annotator) => void,
handlePreviewDestroy: (shouldReset?: boolean) => void,
...
};
export type WithAnnotationsProps = {
features?: FeatureConfig;
location?: Location,
onAnnotator: (annotator: Annotator) => void,
onError?: (
error: Error,
code: string,
contextInfo?: { [key: string]: mixed, ... }
) => void,
onPreviewDestroy: (shouldReset?: boolean) => void,
routerDisabled?: boolean;
sidebarNavigation?: SidebarNavigation;
...
};
export type WithAnnotationsComponent<P> = React.ComponentClass<
P & WithAnnotationsProps
>;
declare var ANNOTATIONS_PATH: any; // "/:sidebar/annotations/:fileVersionId/:annotationId?"
declare var defaultState: AnnotatorState;
declare export default function withAnnotations<P: { [key: string]: any }>(
WrappedComponent: React.ComponentType<P>
): WithAnnotationsComponent<P>;