UNPKG

@progress/kendo-react-excel-export

Version:

React Excel export helps you export and save data to Excel files and customize or filter the output. KendoReact Excel Export package

60 lines (59 loc) 2.02 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as g from "react"; import * as n from "react-dom/server"; const d = (t, e, r) => (l) => { r(e, l); const s = n.renderToStaticMarkup(/* @__PURE__ */ g.createElement(t, { ...e })), o = Number(s); return isNaN(o) ? s : o; }, f = (t, e) => { t.$implicit = t.group = e, t.field = e.field, t.value = e.value, t.aggregates = e.aggregates; }, u = (t, e) => { t.group = e.group, t.$implicit = t.aggregates = e; }, C = (t, e) => { }, F = (t) => { const e = []; let r = 0; const p = (l, s, o) => { l.forEach((i) => { if (i.level === o) { const a = new O(i, r); if (s.push(a), i.children && i.children.length > 1) { const h = a.columns = []; p(i.children, h, o + 1); } else r++; } }); }; return p(t, e, 0), e; }; class O { constructor(e, r) { this.columns = null, this.title = e.title, this.field = e.field, this.hidden = e.hidden, this.locked = e.locked, this.width = e.width, this.headerCellOptions = e.headerCellOptions, this.cellOptions = e.cellOptions, this.groupHeaderCellOptions = e.groupHeaderCellOptions, this.groupFooterCellOptions = e.groupFooterCellOptions, this.footerCellOptions = e.footerCellOptions, e.footer && (this.footerTemplate = d( e.footer, { $implicit: e, column: e, columnIndex: r }, C )), e.groupFooter && (this.groupFooterTemplate = d( e.groupFooter, { column: e, field: e.field }, u )), e.groupHeader && (this.groupHeaderTemplate = d(e.groupHeader, {}, f)); } } export { O as ExporterColumn, F as toExporterColumns };