box-ui-elements-mlh
Version:
54 lines (52 loc) • 1.78 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 AnnotatorContext from "./AnnotatorContext";
import {
Action,
Annotator,
AnnotationActionEvent,
AnnotatorState,
GetMatchPath,
MatchParams,
Status
} from "./types";
declare var ANNOTATIONS_PATH: any; // "/:sidebar/annotations/:fileVersionId/:annotationId?"
export interface WithAnnotationsProps {
onAnnotator: (annotator: Annotator) => void;
onPreviewDestroy: () => void;
}
export interface ComponentWithAnnotations {
emitActiveChangeEvent: (id: string | null) => void;
emitRemoveEvent: (id: string) => void;
getAction: (eventData: AnnotationActionEvent) => Action;
getAnnotationsPath: (fileVersionId?: string, annotationId?: string) => string;
getMatchPath: GetMatchPath;
handleActiveChange: (annotationId: string | null) => void;
handleAnnotationChangeEvent: (id: string | null) => void;
handleAnnotationCreate: (eventData: AnnotationActionEvent) => void;
handleAnnotator: (annotator: Annotator) => void;
handleAnnotatorEvent: (x: {
event: string,
data?: mixed,
...
}) => void;
handlePreviewDestroy: () => void;
}
export type WithAnnotationsComponent<P> = React.ComponentClass<
P & WithAnnotationsProps
>;
declare var defaultState: AnnotatorState;
declare type WithHistoryProps = {
history?: History,
...
};
declare type ResultProps<P> = P & WithAnnotationsProps & WithHistoryProps;
declare export default function withAnnotations<P: { [key: string]: any }>(
WrappedComponent: React.ComponentType<P>
): WithAnnotationsComponent<P>;