forked from securedeveloper/react-data-export
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
2 changed files
with
146 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
/* index.d.ts (C) react-data-export */ | ||
|
||
// TypeScript Version: 2.2 | ||
declare module 'react-data-export' { | ||
import * as React from 'react'; | ||
|
||
export interface ExcelFileProps { | ||
filename?: string; | ||
fileExtension?: string; | ||
element?: any; //Download Element | ||
children?: Array<React.ReactElement> | React.ReactElement; // Array<ExcelSheetProps>; | ||
} | ||
|
||
export interface ExcelSheetProps { | ||
name: string; | ||
data?: Array<object>; | ||
dataSet?: Array<ExcelSheetData>; | ||
value?: Array<string> | Function; | ||
children?: Array<React.ReactElement> | React.ReactElement; // Array<ExcelColumnProps> | ||
} | ||
|
||
export interface ExcelSheetData { | ||
xSteps?: number; | ||
ySteps?: number; | ||
columns: Array<string> | Array<ExcelCellHeader>; | ||
data: Array<Array<ExcelCellData>>; | ||
} | ||
|
||
export type ExcelCellData = ExcelValue | ExcelCell | Array<ExcelValue>; | ||
export type ExcelValue = string | number | Date | boolean; | ||
|
||
export interface ExcelCellHeader { | ||
title: string; | ||
style?: ExcelStyle; | ||
} | ||
|
||
export interface ExcelCell { | ||
value: ExcelValue; | ||
style?: ExcelStyle; | ||
} | ||
|
||
export interface ExcelColumnProps { | ||
label: string; | ||
value: number | boolean | string | Function; | ||
} | ||
|
||
export interface ExcelStyle { | ||
fill?: ExcelCellFillType; | ||
font?: ExcelFont; | ||
numFmt?: ExcelNumFormat; | ||
alignment?: ExcelAlignment; | ||
border?: ExcelBorder; | ||
} | ||
|
||
/* ExcelCell Fill Type */ | ||
export type ExcelCellPatternType = "solid" | "none"; | ||
|
||
export interface ExcelColorSpec { | ||
auto?: number; //default 1 | ||
rgb?: string; //hex ARGB color | ||
theme?: ExcelTheme; | ||
indexed?: number; | ||
} | ||
|
||
export interface ExcelTheme { | ||
theme: string; | ||
tint: string; | ||
} | ||
|
||
export interface ExcelCellFillType { | ||
patternType?: ExcelCellPatternType; | ||
fgColor?: ExcelColorSpec; | ||
bgColor?: ExcelColorSpec; | ||
} | ||
|
||
/* Excel Font */ | ||
export interface ExcelFont { | ||
name?: string; // default `"Calibri"` | ||
sz?: number; //font size in points default 11 | ||
color?: ExcelColorSpec; | ||
bold?: boolean; | ||
underline?: boolean; | ||
italic?: boolean; | ||
strike?: boolean; | ||
outline?: boolean; | ||
shadow?: boolean; | ||
vertAlign?: boolean; | ||
} | ||
|
||
/* ExcelNumFormat */ | ||
export type ExcelNumFormat = "0" | "0.00%" | "0.0%" | "0.00%;\\(0.00%\\);\\-;@" | "m/dd/yy" | string; | ||
|
||
/* ExcelAlignment */ | ||
export interface ExcelAlignment { | ||
vertical?: ExcelAlignmentType; | ||
horizontal?: ExcelAlignmentType; | ||
wrapText?: boolean; | ||
readingOrder?: ExcelReadingOrder; | ||
textRotation?: ExcelTextRotation; | ||
} | ||
|
||
export type ExcelTextRotation = 0 | 45 | 90 | 135 | 180 | 255; | ||
|
||
export enum ExcelReadingOrder { LeftToRight = 1, RightToLeft} | ||
|
||
export type ExcelAlignmentType = "bottom" | "center" | "top"; | ||
|
||
/* ExcelBorder */ | ||
export interface ExcelBorder { | ||
style: ExcelBorderStyle; | ||
color: ExcelColorSpec; | ||
} | ||
|
||
export type ExcelBorderStyle = | ||
"thin" | ||
| "medium" | ||
| "thick" | ||
| "dotted" | ||
| "hair" | ||
| "dashed" | ||
| "mediumDashed" | ||
| "dashDot" | ||
| "mediumDashDot" | ||
| "dashDotDot" | ||
| "mediumDashDotDot" | ||
| "slantDashDot"; | ||
|
||
export class ExcelColumn extends React.Component<ExcelColumnProps, any> { | ||
} | ||
|
||
export class ExcelSheet extends React.Component<ExcelSheetProps, any> { | ||
} | ||
|
||
export class ExcelFile extends React.Component<ExcelFileProps, any> { | ||
} | ||
|
||
export namespace ReactExport { | ||
export class ExcelFile extends React.Component<ExcelFileProps, any> { | ||
static ExcelSheet: React.ElementType<ExcelSheetProps>; | ||
static ExcelColumn: React.ElementType<ExcelColumnProps>; | ||
} | ||
} | ||
export default ReactExport | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters