diff --git a/README.md b/README.md
index 6403ec1..d8e9f7f 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,6 @@ yarn add react-xlsx-wrapper@latest
- [Simple Excel Export](examples/simple_excel_export_01.md)
- [Excel Export with Dataset](examples/simple_excel_export_02.md)
-- [Excel Export with Custom Download Button](examples/with_custom_download_element.md)
- [Excel Export with custom cells style](examples/styled_excel_sheet.md)
## Excel Props
diff --git a/dist/ExcelPlugin/components/ExcelFileNew.js b/dist/ExcelPlugin/components/ExcelFile.js
similarity index 100%
rename from dist/ExcelPlugin/components/ExcelFileNew.js
rename to dist/ExcelPlugin/components/ExcelFile.js
diff --git a/dist/index.js b/dist/index.js
index 56ff49a..bf34838 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -9,11 +9,11 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ExcelColumn = exports.ExcelSheet = void 0;
-var ExcelFileNew_1 = __importDefault(require("./ExcelPlugin/components/ExcelFileNew"));
+var ExcelFile_1 = __importDefault(require("./ExcelPlugin/components/ExcelFile"));
var ExcelSheet_1 = __importDefault(require("./ExcelPlugin/elements/ExcelSheet"));
exports.ExcelSheet = ExcelSheet_1.default;
var ExcelColumn_1 = __importDefault(require("./ExcelPlugin/elements/ExcelColumn"));
exports.ExcelColumn = ExcelColumn_1.default;
-ExcelFileNew_1.default.ExcelSheet = ExcelSheet_1.default;
-ExcelFileNew_1.default.ExcelColumn = ExcelColumn_1.default;
-exports.default = ExcelFileNew_1.default;
\ No newline at end of file
+ExcelFile_1.default.ExcelSheet = ExcelSheet_1.default;
+ExcelFile_1.default.ExcelColumn = ExcelColumn_1.default;
+exports.default = ExcelFile_1.default;
\ No newline at end of file
diff --git a/examples/with_custom_download_element.md b/examples/with_custom_download_element.md
deleted file mode 100644
index 0fdd703..0000000
--- a/examples/with_custom_download_element.md
+++ /dev/null
@@ -1,65 +0,0 @@
-```javascript
-import React from "react";
-import {ExcelFile, ExcelSheet, ExcelColumn} from 'react-xlsx-wrapper';
-
-const dataSet1 = [
- {
- name: "Johson",
- amount: 30000,
- sex: 'M',
- is_married: true
- },
- {
- name: "Monika",
- amount: 355000,
- sex: 'F',
- is_married: false
- },
- {
- name: "John",
- amount: 250000,
- sex: 'M',
- is_married: false
- },
- {
- name: "Josef",
- amount: 450500,
- sex: 'M',
- is_married: true
- }
-];
-
-var dataSet2 = [
- {
- name: "Johnson",
- total: 25,
- remainig: 16
- },
- {
- name: "Josef",
- total: 25,
- remainig: 7
- }
-];
-
-class Download extends React.Component {
- render() {
- return (
- Download Data}>
-
-
-
-
- col.is_married ? "Married" : "Single"}/>
-
-
-
-
-
-
-
- );
- }
-}
-```
diff --git a/src-js/ExcelPlugin/components/ExcelFileNew.js b/src-js/ExcelPlugin/components/ExcelFile.js
similarity index 100%
rename from src-js/ExcelPlugin/components/ExcelFileNew.js
rename to src-js/ExcelPlugin/components/ExcelFile.js
diff --git a/src-js/index.js b/src-js/index.js
index 3675ba3..0c0959b 100644
--- a/src-js/index.js
+++ b/src-js/index.js
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExcelColumn = exports.ExcelSheet = void 0;
-const ExcelFileNew_1 = __importDefault(require("./ExcelPlugin/components/ExcelFileNew"));
+const ExcelFile_1 = __importDefault(require("./ExcelPlugin/components/ExcelFile"));
const ExcelSheet_1 = __importDefault(require("./ExcelPlugin/elements/ExcelSheet"));
exports.ExcelSheet = ExcelSheet_1.default;
const ExcelColumn_1 = __importDefault(require("./ExcelPlugin/elements/ExcelColumn"));
exports.ExcelColumn = ExcelColumn_1.default;
-ExcelFileNew_1.default.ExcelSheet = ExcelSheet_1.default;
-ExcelFileNew_1.default.ExcelColumn = ExcelColumn_1.default;
-exports.default = ExcelFileNew_1.default;
+ExcelFile_1.default.ExcelSheet = ExcelSheet_1.default;
+ExcelFile_1.default.ExcelColumn = ExcelColumn_1.default;
+exports.default = ExcelFile_1.default;
diff --git a/src/ExcelPlugin/components/ExcelFileNew.tsx b/src/ExcelPlugin/components/ExcelFile.tsx
similarity index 92%
rename from src/ExcelPlugin/components/ExcelFileNew.tsx
rename to src/ExcelPlugin/components/ExcelFile.tsx
index 3812214..b381330 100644
--- a/src/ExcelPlugin/components/ExcelFileNew.tsx
+++ b/src/ExcelPlugin/components/ExcelFile.tsx
@@ -3,9 +3,7 @@ import { utils, writeFile } from "xlsx-js-style";
import type { BookType, WorkSheet } from "xlsx-js-style";
import { excelSheetFromAoA, excelSheetFromDataSet } from "../utils/DataUtil";
import type {
- DataProps,
ExcelColumnProps,
- ExcelSheetData,
ExcelSheetProps,
ExcelValue,
} from "react-xlsx-wrapper";
@@ -15,7 +13,7 @@ interface ExcelFileProps {
filename?: string;
fileExtension?: BookType;
element?: React.ReactNode;
- children: React.ReactElement>[];
+ children: React.ReactElement[];
}
class ExcelFile extends React.Component {
@@ -39,9 +37,7 @@ class ExcelFile extends React.Component {
}
}
- createSheetData = (
- sheet: React.ReactElement>
- ) => {
+ createSheetData = (sheet: React.ReactElement) => {
const columns = sheet.props.children;
const sheetData = [
React.Children.map(
@@ -52,14 +48,13 @@ class ExcelFile extends React.Component {
const data = sheet.props.data;
if (!data) throw new Error("No data provided");
- data.forEach((row: DataProps) => {
+ data.forEach((row: any) => {
let sheetRow: ExcelValue[] = [];
React.Children.forEach(
columns,
(column: React.ReactElement) => {
- const getValue = (row: DataProps) =>
- row[column.props.value as string];
+ const getValue = (row: any) => row[column.props.value as string];
const itemValue = getValue(row);
sheetRow.push(isNaN(Number(itemValue)) ? itemValue || "" : itemValue);
}
diff --git a/src/ExcelPlugin/elements/ExcelSheet.tsx b/src/ExcelPlugin/elements/ExcelSheet.tsx
index 960f76a..e6015b8 100644
--- a/src/ExcelPlugin/elements/ExcelSheet.tsx
+++ b/src/ExcelPlugin/elements/ExcelSheet.tsx
@@ -1,18 +1,16 @@
import React, { Component } from "react";
import ExcelColumn from "./ExcelColumn";
-import type { DataProps, ExcelValue, ExcelSheetData } from "react-xlsx-wrapper";
+import type { ExcelValue, ExcelSheetData } from "react-xlsx-wrapper";
-export interface ExcelSheetProps {
+export interface ExcelSheetProps {
name: string;
- data?: D[];
- dataSet?: DS[];
+ data?: any[];
+ dataSet?: ExcelSheetData[];
value: ExcelValue[] | (() => void);
children: React.ReactElement[];
}
-export default class ExcelSheet extends Component<
- ExcelSheetProps
-> {
- constructor(props: ExcelSheetProps) {
+export default class ExcelSheet extends Component {
+ constructor(props: ExcelSheetProps) {
super(props);
if (!props.children.every((child) => child.type === ExcelColumn)) {
diff --git a/src/index.ts b/src/index.ts
index 8947706..6bdd560 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,4 +1,4 @@
-import ExcelFile from "./ExcelPlugin/components/ExcelFileNew";
+import ExcelFile from "./ExcelPlugin/components/ExcelFile";
import ExcelSheet from "./ExcelPlugin/elements/ExcelSheet";
import ExcelColumn from "./ExcelPlugin/elements/ExcelColumn";
diff --git a/types/index.d.ts b/types/index.d.ts
index 226ffe0..9e104d5 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -1,9 +1,5 @@
declare module 'react-xlsx-wrapper' {
import * as React from 'react';
-
- export type DataProps = {
- [key: string]: ExcelValue;
- };
export interface ExcelFileProps {
filename?: string;
@@ -12,10 +8,10 @@ declare module 'react-xlsx-wrapper' {
children?: Array | React.ReactElement; // Array;
}
- export interface ExcelSheetProps {
+ export interface ExcelSheetProps {
name: string;
- data?: D[];
- dataSet?: DS[];
+ data?: any[];
+ dataSet?: ExcelSheetData[];
value: ExcelValue[] | (() => void);
children: React.ReactElement | Array;
}
@@ -140,7 +136,7 @@ declare module 'react-xlsx-wrapper' {
export class ExcelColumn extends React.Component {
}
- export class ExcelSheet extends React.Component, any> {
+ export class ExcelSheet extends React.Component {
}
export class ExcelFile extends React.Component {