@@ -35,7 +35,7 @@ declare module "react-image-annotation" {
3535 id ?: number ;
3636 } ;
3737 }
38- interface IAnnotationProps {
38+ interface IAnnotationProps < T > {
3939 src : string ;
4040 alt ?: string ;
4141 innerRef ?: ( e : any ) => any ;
@@ -44,45 +44,53 @@ declare module "react-image-annotation" {
4444 onMouseMove ?: ( e : React . MouseEvent ) => any ;
4545 onClick ?: ( e : React . MouseEvent ) => any ;
4646
47- annotations : IAnnotation [ ] ;
47+ annotations : T [ ] ;
4848 type ?: string ;
4949 selectors ?: ISelector [ ] ;
5050
51- value : IAnnotation | { } ;
51+ value : T | { } ;
5252 onChange ?: ( e : any ) => any ;
5353 onSubmit ?: ( e : any ) => any ;
5454
55- activeAnnotationComparator ?: ( annotation : IAnnotation ) => boolean ;
56- activeAnnotations ?: IAnnotation [ ] ;
55+ activeAnnotationComparator ?: ( annotation : T ) => boolean ;
56+ activeAnnotations ?: T [ ] ;
5757
5858 disableAnnotation ?: boolean ;
5959 disableSelector ?: boolean ;
60- renderSelector ?: (
61- { annotation, active } : { annotation : IAnnotation ; active : boolean }
62- ) => any ;
60+ renderSelector ?: ( {
61+ annotation,
62+ active,
63+ } : {
64+ annotation : T ;
65+ active : boolean ;
66+ } ) => any ;
6367 disableEditor ?: boolean ;
64- renderEditor ?: (
65- {
66- annotation,
67- onChange,
68- onSubmit
69- } : {
70- annotation : IAnnotation ;
71- onChange : ( annotation : IAnnotation | { } ) => any ;
72- onSubmit : ( e ?: any ) => any ;
73- }
74- ) => any ;
68+ renderEditor ?: ( {
69+ annotation,
70+ onChange,
71+ onSubmit,
72+ } : {
73+ annotation : T ;
74+ onChange : ( annotation : T | { } ) => any ;
75+ onSubmit : ( e ?: any ) => any ;
76+ } ) => any ;
7577
76- renderHighlight ?: (
77- { annotation, active } : { annotation : IAnnotation ; active : boolean }
78- ) => any ;
79- renderContent ?: ( { annotation } : { annotation : IAnnotation } ) => any ;
78+ renderHighlight ?: ( {
79+ key,
80+ annotation,
81+ active,
82+ } : {
83+ key : string ;
84+ annotation : T ;
85+ active : boolean ;
86+ } ) => any ;
87+ renderContent ?: ( { annotation } : { annotation : T } ) => any ;
8088
8189 disableOverlay ?: boolean ;
8290 renderOverlay ?: ( ) => any ;
8391 allowTouch : boolean ;
8492 }
8593
86- class Annotation extends React . Component < IAnnotationProps , { } > { }
94+ class Annotation < T > extends React . Component < IAnnotationProps < T > , { } > { }
8795 export default Annotation ;
8896}
0 commit comments