UNPKG

react-export-table-to-excel

Version:

It allows you to export an HTML table just by sending the table reference and the name with which you want the file to be saved

17 lines (16 loc) 1.01 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.downloadExcel = exports.useDownloadExcel = exports.DownloadTableExcel = void 0; const react_1 = __importDefault(require("react")); const useExcel_1 = require("./hooks/useExcel"); Object.defineProperty(exports, "useDownloadExcel", { enumerable: true, get: function () { return useExcel_1.useDownloadExcel; } }); const lib_1 = require("./lib"); Object.defineProperty(exports, "downloadExcel", { enumerable: true, get: function () { return lib_1.downloadExcel; } }); const DownloadTableExcel = ({ currentTableRef, filename, sheet, children, }) => { const { onDownload } = (0, useExcel_1.useDownloadExcel)({ currentTableRef, filename, sheet }); return react_1.default.createElement("span", { onClick: onDownload }, children); }; exports.DownloadTableExcel = DownloadTableExcel;