From 35515cccbe8d5f5f1819206abcc1f64d49372b26 Mon Sep 17 00:00:00 2001 From: Suvesh K Date: Tue, 16 May 2023 00:33:55 +0000 Subject: [PATCH] fixes: #179 #146 --- dist/index.d.ts | 144 +++++++++++++++++++++++++++++++++++++++++++++++ types/index.d.ts | 4 +- 2 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 dist/index.d.ts diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 00000000..32918e9f --- /dev/null +++ b/dist/index.d.ts @@ -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; // Array; + } + + export interface ExcelSheetProps { + name: string; + data?: Array; + dataSet?: Array; + value?: Array | Function; + children?: Array | React.ReactElement; // Array + } + + export interface ExcelSheetData { + xSteps?: number; + ySteps?: number; + columns: Array | Array; + data: Array>; + } + + export type ExcelCellData = ExcelValue | ExcelCell | Array; + 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 { + } + + export class ExcelSheet extends React.Component { + } + + export class ExcelFile extends React.Component { + } + + export namespace ReactExport { + export class ExcelFile extends React.Component { + static ExcelSheet: React.ElementType; + static ExcelColumn: React.ElementType; + } + } + export default ReactExport + } \ No newline at end of file diff --git a/types/index.d.ts b/types/index.d.ts index 32918e9f..093257a1 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,7 +1,7 @@ /* index.d.ts (C) react-data-export */ // TypeScript Version: 2.2 -declare module 'react-data-export' { +// declare module 'react-data-export' { import * as React from 'react'; export interface ExcelFileProps { @@ -141,4 +141,4 @@ declare module 'react-data-export' { } } export default ReactExport - } \ No newline at end of file +// } \ No newline at end of file