22
33// TypeScript Version: 2.2
44declare module 'react-data-export' {
5- import * as React from 'react'
6-
7- export interface ExcelFileProps {
8- filename ?: string ;
9- fileExtension ?: string ;
10- element ?: any ; //Download Element
11- children ?: Array < React . ReactChild > | React . ReactChild ; // Array<ExcelSheetProps>;
12- }
13-
14- export interface ExcelSheetProps {
15- name : string ;
16- data ?: Array < object > ;
17- dataSet ?: Array < ExcelSheetData > ;
18- value ?: Array < string > | Function ;
19- children ?: Array < React . ReactChild > | React . ReactChild ; // Array<ExcelColumnProps>
20- }
21-
22- export interface ExcelSheetData {
23- xSteps ?: number ;
24- ySteps ?: number ;
25- columns : Array < string > ;
26- data : Array < ExcelCellData > ;
27- }
28-
29- export type ExcelCellData = ExcelValue | ExcelCell | Array < ExcelValue > ;
30- export type ExcelValue = string | number | Date | boolean ;
31-
32- export interface ExcelCell {
33- value : ExcelCell ;
34- style : ExcelStyle ;
35- }
36-
37- export interface ExcelColumnProps {
38- label : string ;
39- value : number | boolean | string | Function ;
40- }
41-
42- export interface ExcelStyle {
43- fill ?: ExcelCellFillType ;
44- font ?: ExcelFont ;
45- numFmt ?: ExcelNumFormat ;
46- alignment ?: ExcelAlignment ;
47- border ?: ExcelBorder ;
48- }
49-
50- /* ExcelCell Fill Type */
51- export type ExcelCellPatternType = "solid" | "none" ;
52-
53- export interface ExcelColorSpec {
54- auto ?: number ; //default 1
55- rgb ?: string ; //hex ARGB color
56- theme ?: ExcelTheme ;
57- indexed ?: number ;
58- }
59-
60- export interface ExcelTheme {
61- theme : string ;
62- tint : string ;
63- }
64-
65- export interface ExcelCellFillType {
66- patternType ?: ExcelCellPatternType ;
67- fgColor ?: ExcelColorSpec ;
68- bgColor ?: ExcelColorSpec ;
69- }
70-
71- /* Excel Font */
72- export interface ExcelFont {
73- name ?: string ; // default `"Calibri"`
74- sz ?: number ; //font size in points default 11
75- color ?: ExcelColorSpec ;
76- bold ?: boolean ;
77- underline ?: boolean ;
78- italic ?: boolean ;
79- strike ?: boolean ;
80- outline ?: boolean ;
81- shadow ?: boolean ;
82- vertAlign ?: boolean ;
83- }
84-
85- /* ExcelNumFormat */
86- export type ExcelNumFormat = "0" | "0.00%" | "0.0%" | "0.00%;\\(0.00%\\);\\-;@" | "m/dd/yy" | string ;
87-
88- /* ExcelAlignment */
89- export interface ExcelAlignment {
90- vertical ?: ExcelAlignmentType ;
91- horizontal ?: ExcelAlignmentType ;
92- wrapText ?: boolean ;
93- readingOrder ?: ExcelReadingOrder ;
94- textRotation ?: ExcelTextRotation ;
95- }
96-
97- export type ExcelTextRotation = 0 | 45 | 90 | 135 | 180 | 255 ;
98-
99- export enum ExcelReadingOrder { LeftToRight = 1 , RightToLeft }
100-
101- export type ExcelAlignmentType = "bottom" | "center" | "top" ;
102-
103- /* ExcelBorder */
104- export interface ExcelBorder {
105- style : ExcelBorderStyle ;
106- color : ExcelColorSpec ;
107- }
108-
109- export type ExcelBorderStyle =
110- "thin"
111- | "medium"
112- | "thick"
113- | "dotted"
114- | "hair"
115- | "dashed"
116- | "mediumDashed"
117- | "dashDot"
118- | "mediumDashDot"
119- | "dashDotDot"
120- | "mediumDashDotDot"
121- | "slantDashDot" ;
122-
123- export class ExcelColumn extends React . Component < ExcelColumnProps , any > {
124- }
125-
126- export class ExcelSheet extends React . Component < ExcelSheetProps , any > {
127- }
128-
129- export class ExcelFile extends React . Component < ExcelFileProps , any > {
130- }
131-
132- export namespace ReactExport {
5+ import * as React from 'react' ;
6+
7+ export interface ExcelFileProps {
8+ filename ?: string ;
9+ fileExtension ?: string ;
10+ element ?: any ; //Download Element
11+ children ?: Array < React . ReactElement > | React . ReactElement ; // Array<ExcelSheetProps>;
12+ }
13+
14+ export interface ExcelSheetProps {
15+ name : string ;
16+ data ?: Array < object > ;
17+ dataSet ?: Array < ExcelSheetData > ;
18+ value ?: Array < string > | Function ;
19+ children ?: Array < React . ReactElement > | React . ReactElement ; // Array<ExcelColumnProps>
20+ }
21+
22+ export interface ExcelSheetData {
23+ xSteps ?: number ;
24+ ySteps ?: number ;
25+ columns : Array < string > | Array < ExcelCellHeader > ;
26+ data : Array < Array < ExcelCellData > > ;
27+ }
28+
29+ export type ExcelCellData = ExcelValue | ExcelCell | Array < ExcelValue > ;
30+ export type ExcelValue = string | number | Date | boolean ;
31+
32+ export interface ExcelCellHeader {
33+ title : string ;
34+ style ?: ExcelStyle ;
35+ }
36+
37+ export interface ExcelCell {
38+ value : ExcelValue ;
39+ style ?: ExcelStyle ;
40+ }
41+
42+ export interface ExcelColumnProps {
43+ label : string ;
44+ value : number | boolean | string | Function ;
45+ }
46+
47+ export interface ExcelStyle {
48+ fill ?: ExcelCellFillType ;
49+ font ?: ExcelFont ;
50+ numFmt ?: ExcelNumFormat ;
51+ alignment ?: ExcelAlignment ;
52+ border ?: ExcelBorder ;
53+ }
54+
55+ /* ExcelCell Fill Type */
56+ export type ExcelCellPatternType = "solid" | "none" ;
57+
58+ export interface ExcelColorSpec {
59+ auto ?: number ; //default 1
60+ rgb ?: string ; //hex ARGB color
61+ theme ?: ExcelTheme ;
62+ indexed ?: number ;
63+ }
64+
65+ export interface ExcelTheme {
66+ theme : string ;
67+ tint : string ;
68+ }
69+
70+ export interface ExcelCellFillType {
71+ patternType ?: ExcelCellPatternType ;
72+ fgColor ?: ExcelColorSpec ;
73+ bgColor ?: ExcelColorSpec ;
74+ }
75+
76+ /* Excel Font */
77+ export interface ExcelFont {
78+ name ?: string ; // default `"Calibri"`
79+ sz ?: number ; //font size in points default 11
80+ color ?: ExcelColorSpec ;
81+ bold ?: boolean ;
82+ underline ?: boolean ;
83+ italic ?: boolean ;
84+ strike ?: boolean ;
85+ outline ?: boolean ;
86+ shadow ?: boolean ;
87+ vertAlign ?: boolean ;
88+ }
89+
90+ /* ExcelNumFormat */
91+ export type ExcelNumFormat = "0" | "0.00%" | "0.0%" | "0.00%;\\(0.00%\\);\\-;@" | "m/dd/yy" | string ;
92+
93+ /* ExcelAlignment */
94+ export interface ExcelAlignment {
95+ vertical ?: ExcelAlignmentType ;
96+ horizontal ?: ExcelAlignmentType ;
97+ wrapText ?: boolean ;
98+ readingOrder ?: ExcelReadingOrder ;
99+ textRotation ?: ExcelTextRotation ;
100+ }
101+
102+ export type ExcelTextRotation = 0 | 45 | 90 | 135 | 180 | 255 ;
103+
104+ export enum ExcelReadingOrder { LeftToRight = 1 , RightToLeft }
105+
106+ export type ExcelAlignmentType = "bottom" | "center" | "top" ;
107+
108+ /* ExcelBorder */
109+ export interface ExcelBorder {
110+ style : ExcelBorderStyle ;
111+ color : ExcelColorSpec ;
112+ }
113+
114+ export type ExcelBorderStyle =
115+ "thin"
116+ | "medium"
117+ | "thick"
118+ | "dotted"
119+ | "hair"
120+ | "dashed"
121+ | "mediumDashed"
122+ | "dashDot"
123+ | "mediumDashDot"
124+ | "dashDotDot"
125+ | "mediumDashDotDot"
126+ | "slantDashDot" ;
127+
128+ export class ExcelColumn extends React . Component < ExcelColumnProps , any > {
129+ }
130+
131+ export class ExcelSheet extends React . Component < ExcelSheetProps , any > {
132+ }
133+
133134 export class ExcelFile extends React . Component < ExcelFileProps , any > {
134135 }
135- }
136- export default ReactExport
137- }
136+
137+ export namespace ReactExport {
138+ export class ExcelFile extends React . Component < ExcelFileProps , any > {
139+ static ExcelSheet : React . ElementType < ExcelSheetProps > ;
140+ static ExcelColumn : React . ElementType < ExcelColumnProps > ;
141+ }
142+ }
143+ export default ReactExport
144+ }
0 commit comments