@@ -35,7 +35,7 @@ declare module "react-image-annotation" {
35
35
id ?: number ;
36
36
} ;
37
37
}
38
- interface IAnnotationProps {
38
+ interface IAnnotationProps < T > {
39
39
src : string ;
40
40
alt ?: string ;
41
41
innerRef ?: ( e : any ) => any ;
@@ -44,45 +44,53 @@ declare module "react-image-annotation" {
44
44
onMouseMove ?: ( e : React . MouseEvent ) => any ;
45
45
onClick ?: ( e : React . MouseEvent ) => any ;
46
46
47
- annotations : IAnnotation [ ] ;
47
+ annotations : T [ ] ;
48
48
type ?: string ;
49
49
selectors ?: ISelector [ ] ;
50
50
51
- value : IAnnotation | { } ;
51
+ value : T | { } ;
52
52
onChange ?: ( e : any ) => any ;
53
53
onSubmit ?: ( e : any ) => any ;
54
54
55
- activeAnnotationComparator ?: ( annotation : IAnnotation ) => boolean ;
56
- activeAnnotations ?: IAnnotation [ ] ;
55
+ activeAnnotationComparator ?: ( annotation : T ) => boolean ;
56
+ activeAnnotations ?: T [ ] ;
57
57
58
58
disableAnnotation ?: boolean ;
59
59
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 ;
63
67
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 ;
75
77
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 ;
80
88
81
89
disableOverlay ?: boolean ;
82
90
renderOverlay ?: ( ) => any ;
83
91
allowTouch : boolean ;
84
92
}
85
93
86
- class Annotation extends React . Component < IAnnotationProps , { } > { }
94
+ class Annotation < T > extends React . Component < IAnnotationProps < T > , { } > { }
87
95
export default Annotation ;
88
96
}
0 commit comments