@progress/kendo-react-excel-export 6.1.1 → 7.0.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/npm/ColumnBase.d.ts → ColumnBase.d.ts} +4 -0
- package/{dist/es/ExcelExport.d.ts → ExcelExport.d.ts} +5 -1
- package/{dist/es/ExcelExportColumn.d.ts → ExcelExportColumn.d.ts} +4 -0
- package/{dist/npm/ExcelExportColumnGroup.d.ts → ExcelExportColumnGroup.d.ts} +4 -0
- package/{dist/npm/ExcelExportData.d.ts → ExcelExportData.d.ts} +4 -0
- package/LICENSE.md +1 -1
- package/dist/cdn/js/kendo-react-excel.js +8 -0
- package/index.d.ts +15 -0
- package/index.js +8 -0
- package/index.mjs +226 -0
- package/{dist/es/ooxml → ooxml}/CellOptionsInterface.d.ts +4 -0
- package/{dist/npm/ooxml → ooxml}/ExporterColumns.d.ts +4 -0
- package/{dist/es/ooxml → ooxml}/workbook.d.ts +4 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +28 -40
- package/{dist/npm/templates → templates}/ExcelExportFooter.d.ts +4 -0
- package/{dist/npm/templates → templates}/ExcelExportGroupFooter.d.ts +4 -0
- package/{dist/es/templates → templates}/ExcelExportGroupHeader.d.ts +4 -0
- package/about.md +0 -3
- package/dist/cdn/js/kendo-react-excel-export.js +0 -1
- package/dist/es/ColumnBase.d.ts +0 -38
- package/dist/es/ColumnBase.js +0 -1
- package/dist/es/ExcelExport.js +0 -193
- package/dist/es/ExcelExportColumn.js +0 -24
- package/dist/es/ExcelExportColumnGroup.d.ts +0 -11
- package/dist/es/ExcelExportColumnGroup.js +0 -17
- package/dist/es/ExcelExportData.d.ts +0 -13
- package/dist/es/ExcelExportData.js +0 -2
- package/dist/es/main.d.ts +0 -11
- package/dist/es/main.js +0 -9
- package/dist/es/ooxml/CellOptionsInterface.js +0 -2
- package/dist/es/ooxml/ExporterColumns.d.ts +0 -26
- package/dist/es/ooxml/ExporterColumns.js +0 -99
- package/dist/es/ooxml/workbook.js +0 -39
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/templates/ExcelExportFooter.d.ts +0 -14
- package/dist/es/templates/ExcelExportFooter.js +0 -27
- package/dist/es/templates/ExcelExportGroupFooter.d.ts +0 -17
- package/dist/es/templates/ExcelExportGroupFooter.js +0 -27
- package/dist/es/templates/ExcelExportGroupHeader.js +0 -27
- package/dist/npm/ColumnBase.js +0 -2
- package/dist/npm/ExcelExport.d.ts +0 -151
- package/dist/npm/ExcelExport.js +0 -196
- package/dist/npm/ExcelExportColumn.d.ts +0 -50
- package/dist/npm/ExcelExportColumn.js +0 -27
- package/dist/npm/ExcelExportColumnGroup.js +0 -20
- package/dist/npm/ExcelExportData.js +0 -3
- package/dist/npm/main.d.ts +0 -11
- package/dist/npm/main.js +0 -32
- package/dist/npm/ooxml/CellOptionsInterface.d.ts +0 -76
- package/dist/npm/ooxml/CellOptionsInterface.js +0 -3
- package/dist/npm/ooxml/ExporterColumns.js +0 -103
- package/dist/npm/ooxml/workbook.d.ts +0 -14
- package/dist/npm/ooxml/workbook.js +0 -45
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/templates/ExcelExportFooter.js +0 -30
- package/dist/npm/templates/ExcelExportGroupFooter.js +0 -30
- package/dist/npm/templates/ExcelExportGroupHeader.d.ts +0 -16
- package/dist/npm/templates/ExcelExportGroupHeader.js +0 -30
- package/dist/systemjs/kendo-react-excel-export.js +0 -1
- package/e2e-next/excelexport.basic.tests.ts +0 -23
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import { CellOptions } from './ooxml/CellOptionsInterface';
|
|
2
6
|
/**
|
|
3
7
|
* @hidden
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import * as React from 'react';
|
|
2
6
|
import * as PropTypes from 'prop-types';
|
|
3
7
|
import { WorkbookOptions } from '@progress/kendo-ooxml';
|
|
@@ -81,7 +85,7 @@ export interface ExcelExportProps {
|
|
|
81
85
|
/**
|
|
82
86
|
* Represents the return type of ExcelExportExportEvent.
|
|
83
87
|
*/
|
|
84
|
-
export
|
|
88
|
+
export type ExcelExportExportEvent = {
|
|
85
89
|
/**
|
|
86
90
|
* The target of the ExcelExportExportEvent from ExcelExport.
|
|
87
91
|
*/
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import * as React from 'react';
|
|
2
6
|
import { ColumnBase } from './ColumnBase';
|
|
3
7
|
import { CellOptions } from './ooxml/CellOptionsInterface';
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import * as React from 'react';
|
|
2
6
|
import { ColumnBase } from './ColumnBase';
|
|
3
7
|
export interface ExcelExportColumnGroupProps extends ColumnBase {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
/**
|
|
2
6
|
* The type that is expected for the ExcelExportComponent data.
|
|
3
7
|
*/
|
package/LICENSE.md
CHANGED
|
@@ -8,4 +8,4 @@ This is commercial software. To use it, you need to agree to the [**End User Lic
|
|
|
8
8
|
|
|
9
9
|
All available KendoReact commercial licenses may be obtained at the [KendoReact website](https://www.telerik.com/kendo-react-ui/pricing).
|
|
10
10
|
|
|
11
|
-
*Copyright ©
|
|
11
|
+
*Copyright © 2023 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.*
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
(function(i,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react"),require("prop-types"),require("@progress/kendo-file-saver"),require("@progress/kendo-ooxml"),require("react-dom/server"),require("@progress/kendo-licensing")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","@progress/kendo-file-saver","@progress/kendo-ooxml","react-dom/server","@progress/kendo-licensing"],c):(i=typeof globalThis<"u"?globalThis:i||self,c(i.KendoReactExcel={},i.React,i.PropTypes,i.KendoFileSaver,i.KendoOoxml,i.ReactDOMServer,i.KendoLicensing))})(this,function(i,c,w,v,u,T,P){"use strict";function h(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const p=h(c),r=h(w),R=h(u),F=h(T),y=h(P),f=(t,e,o)=>n=>{o(e,n);const a=F.renderToStaticMarkup(p.createElement(t,{...e})),l=Number(a);return isNaN(l)?a:l},D=(t,e)=>{t.$implicit=t.group=e,t.field=e.field,t.value=e.value,t.aggregates=e.aggregates},_=(t,e)=>{t.group=e.group,t.$implicit=t.aggregates=e},L=(t,e)=>{},U=t=>{const e=[];let o=0;const s=(n,a,l)=>{n.forEach(d=>{if(d.level===l){const k=new N(d,o);if(a.push(k),d.children&&d.children.length>1){const A=k.columns=[];s(d.children,A,l+1)}else o++}})};return s(t,e,0),e};class N{constructor(e,o){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=f(e.footer,{$implicit:e,column:e,columnIndex:o},L)),e.groupFooter&&(this.groupFooterTemplate=f(e.groupFooter,{column:e,field:e.field},_)),e.groupHeader&&(this.groupHeaderTemplate=f(e.groupHeader,{},D))}}const H=t=>Math.max(...t.map(e=>e.level))+1,C=t=>{const e=U(t.columns),s=new u.ExcelExporter({columns:e,data:t.data,filterable:t.filterable,groups:t.group,paddingCellOptions:t.paddingCellOptions,headerPaddingCellOptions:t.headerPaddingCellOptions,hierarchy:t.hierarchy?{depth:H(t.data),itemLevel:n=>n.level}:null,collapsible:t.collapsible}).workbook();return s.creator=t.creator,s.date=t.date,s.rtl=t.dir==="rtl",s},O=t=>new u.Workbook(t).toDataURL(),x=t=>t&&t.sheets,g={name:"@progress/kendo-react-excel-export",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class m extends p.Component{constructor(e){if(super(e),this.saveFile=o=>{v.saveAs(o,this.props.fileName,{forceProxy:this.props.forceProxy,proxyURL:this.props.proxyURL})},this.extractColumns=(o,s=0)=>Array.isArray(o)?o.map(n=>this.extractChild(n,s)):[o,this.extractChild(o,s)],this.extractChild=(o,s=0)=>p.isValidElement(o)?{...o.props,width:o.props.width&&parseInt(`${o.props.width}`,10),level:s,children:o.props.children&&this.extractColumns(o.props.children,s+1)}:{...o,level:s,children:o.children&&this.extractColumns(o.children,s+1)},this.getExportData=o=>{let s;return o?Array.isArray(o)?s={data:o}:s=o:s={data:this.props.data,group:this.props.group},s},typeof y<"u")y.validatePackage(g);else{let o=`License activation failed for ${g.name}
|
|
6
|
+
`;o+=`The @progress/kendo-licensing script is not loaded.
|
|
7
|
+
`,o+=`See ${g.licensingDocsUrl} for more information.
|
|
8
|
+
`,console.warn(o)}this.save=this.save.bind(this),this.toDataURL=this.toDataURL.bind(this),this.workbookOptions=this.workbookOptions.bind(this)}save(e,o){this.toDataURL(e,o).then((...s)=>{this.props.onExportComplete&&this.props.onExportComplete.call(void 0,{target:this}),this.saveFile(...s)})}toDataURL(e,o){const s=x(e)?e:this.workbookOptions(e,o);return O(s)}workbookOptions(e,o){const s=this.getExportData(e),n=this.props.children,a=n&&n.type&&n.type.displayName==="KendoReactGrid"&&n.props&&p.Children.toArray(n.props.children),l=this.extractColumns(a||o||this.props.columns||p.Children.toArray(n));return C({columns:l,data:s.data,group:s.group,filterable:this.props.filterable,creator:this.props.creator,date:this.props.date,dir:this.props.dir,hierarchy:this.props.hierarchy,paddingCellOptions:this.props.paddingCellOptions,headerPaddingCellOptions:this.props.headerPaddingCellOptions,collapsible:this.props.collapsible})}render(){return this.props.children||null}}m.propTypes={children:r.any,columns:r.arrayOf(r.any),creator:r.string,data:r.any,date:r.any,filterable:r.bool,fileName:r.string,forceProxy:r.bool,group:r.any,headerPaddingCellOptions:r.any,paddingCellOptions:r.any,proxyURL:r.string,dir:r.string,hierarchy:r.bool,collapsible:r.bool},m.defaultProps={fileName:"Export.xlsx",forceProxy:!1,collapsible:!1};const b=t=>null;b.propTypes={cellOptions:r.any,field:r.string,footerCellOptions:r.any,footer:r.oneOfType([r.func,r.element]),groupFooterCellOptions:r.any,groupFooter:r.oneOfType([r.func,r.element]),groupHeaderCellOptions:r.any,groupHeader:r.oneOfType([r.func,r.element]),headerCellOptions:r.any,hidden:r.bool,level:r.number,locked:r.bool,title:r.string,width:r.number};const E=t=>null;E.propTypes={children:r.oneOfType([r.arrayOf(r.element),r.element]),headerCellOptions:r.any,hidden:r.bool,level:r.number,locked:r.bool,title:r.string,width:r.number};class G extends p.PureComponent{}class K extends p.PureComponent{}class S extends p.PureComponent{}i.KendoOoxml=R,i.ExcelExport=m,i.ExcelExportColumn=b,i.ExcelExportColumnGroup=E,i.ExcelExportFooter=G,i.ExcelExportGroupFooter=K,i.ExcelExportGroupHeader=S,i.isWorkbookOptions=x,i.toDataURL=O,i.workbookOptions=C,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ExcelExport, type ExcelExportProps } from './ExcelExport';
|
|
6
|
+
import type { ExcelExportData } from './ExcelExportData';
|
|
7
|
+
import { ExcelExportColumn, type ExcelExportColumnProps } from './ExcelExportColumn';
|
|
8
|
+
import { ExcelExportColumnGroup, type ExcelExportColumnGroupProps } from './ExcelExportColumnGroup';
|
|
9
|
+
import type { ColumnBase } from './ColumnBase';
|
|
10
|
+
import { ExcelExportFooter, type ExcelExportFooterProps } from './templates/ExcelExportFooter';
|
|
11
|
+
import { ExcelExportGroupFooter, type ExcelExportGroupFooterProps } from './templates/ExcelExportGroupFooter';
|
|
12
|
+
import { ExcelExportGroupHeader, type ExcelExportGroupHeaderProps } from './templates/ExcelExportGroupHeader';
|
|
13
|
+
import * as KendoOoxml from '@progress/kendo-ooxml';
|
|
14
|
+
export { ExcelExport, ExcelExportData, ExcelExportProps, ExcelExportColumnGroup, ExcelExportColumnGroupProps, ExcelExportFooter, ExcelExportFooterProps, ExcelExportColumn, ExcelExportColumnProps, ColumnBase, ExcelExportGroupFooter, ExcelExportGroupFooterProps, ExcelExportGroupHeader, ExcelExportGroupHeaderProps, KendoOoxml };
|
|
15
|
+
export * from './ooxml/workbook';
|
package/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),w=require("prop-types"),P=require("@progress/kendo-file-saver"),u=require("@progress/kendo-ooxml"),T=require("react-dom/server"),R=require("@progress/kendo-licensing");function d(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const n=d(k),r=d(w),v=d(u),F=d(T),x=d(R),c=(t,e,o)=>i=>{o(e,i);const p=F.renderToStaticMarkup(n.createElement(t,{...e})),l=Number(p);return isNaN(l)?p:l},D=(t,e)=>{t.$implicit=t.group=e,t.field=e.field,t.value=e.value,t.aggregates=e.aggregates},_=(t,e)=>{t.group=e.group,t.$implicit=t.aggregates=e},U=(t,e)=>{},L=t=>{const e=[];let o=0;const s=(i,p,l)=>{i.forEach(a=>{if(a.level===l){const f=new N(a,o);if(p.push(f),a.children&&a.children.length>1){const E=f.columns=[];s(a.children,E,l+1)}else o++}})};return s(t,e,0),e};class N{constructor(e,o){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=c(e.footer,{$implicit:e,column:e,columnIndex:o},U)),e.groupFooter&&(this.groupFooterTemplate=c(e.groupFooter,{column:e,field:e.field},_)),e.groupHeader&&(this.groupHeaderTemplate=c(e.groupHeader,{},D))}}const H=t=>Math.max(...t.map(e=>e.level))+1,m=t=>{const e=L(t.columns),s=new u.ExcelExporter({columns:e,data:t.data,filterable:t.filterable,groups:t.group,paddingCellOptions:t.paddingCellOptions,headerPaddingCellOptions:t.headerPaddingCellOptions,hierarchy:t.hierarchy?{depth:H(t.data),itemLevel:i=>i.level}:null,collapsible:t.collapsible}).workbook();return s.creator=t.creator,s.date=t.date,s.rtl=t.dir==="rtl",s},C=t=>new u.Workbook(t).toDataURL(),O=t=>t&&t.sheets,h={name:"@progress/kendo-react-excel-export",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class g extends n.Component{constructor(e){if(super(e),this.saveFile=o=>{P.saveAs(o,this.props.fileName,{forceProxy:this.props.forceProxy,proxyURL:this.props.proxyURL})},this.extractColumns=(o,s=0)=>Array.isArray(o)?o.map(i=>this.extractChild(i,s)):[o,this.extractChild(o,s)],this.extractChild=(o,s=0)=>n.isValidElement(o)?{...o.props,width:o.props.width&&parseInt(`${o.props.width}`,10),level:s,children:o.props.children&&this.extractColumns(o.props.children,s+1)}:{...o,level:s,children:o.children&&this.extractColumns(o.children,s+1)},this.getExportData=o=>{let s;return o?Array.isArray(o)?s={data:o}:s=o:s={data:this.props.data,group:this.props.group},s},typeof x<"u")x.validatePackage(h);else{let o=`License activation failed for ${h.name}
|
|
6
|
+
`;o+=`The @progress/kendo-licensing script is not loaded.
|
|
7
|
+
`,o+=`See ${h.licensingDocsUrl} for more information.
|
|
8
|
+
`,console.warn(o)}this.save=this.save.bind(this),this.toDataURL=this.toDataURL.bind(this),this.workbookOptions=this.workbookOptions.bind(this)}save(e,o){this.toDataURL(e,o).then((...s)=>{this.props.onExportComplete&&this.props.onExportComplete.call(void 0,{target:this}),this.saveFile(...s)})}toDataURL(e,o){const s=O(e)?e:this.workbookOptions(e,o);return C(s)}workbookOptions(e,o){const s=this.getExportData(e),i=this.props.children,p=i&&i.type&&i.type.displayName==="KendoReactGrid"&&i.props&&n.Children.toArray(i.props.children),l=this.extractColumns(p||o||this.props.columns||n.Children.toArray(i));return m({columns:l,data:s.data,group:s.group,filterable:this.props.filterable,creator:this.props.creator,date:this.props.date,dir:this.props.dir,hierarchy:this.props.hierarchy,paddingCellOptions:this.props.paddingCellOptions,headerPaddingCellOptions:this.props.headerPaddingCellOptions,collapsible:this.props.collapsible})}render(){return this.props.children||null}}g.propTypes={children:r.any,columns:r.arrayOf(r.any),creator:r.string,data:r.any,date:r.any,filterable:r.bool,fileName:r.string,forceProxy:r.bool,group:r.any,headerPaddingCellOptions:r.any,paddingCellOptions:r.any,proxyURL:r.string,dir:r.string,hierarchy:r.bool,collapsible:r.bool};g.defaultProps={fileName:"Export.xlsx",forceProxy:!1,collapsible:!1};const y=t=>null;y.propTypes={cellOptions:r.any,field:r.string,footerCellOptions:r.any,footer:r.oneOfType([r.func,r.element]),groupFooterCellOptions:r.any,groupFooter:r.oneOfType([r.func,r.element]),groupHeaderCellOptions:r.any,groupHeader:r.oneOfType([r.func,r.element]),headerCellOptions:r.any,hidden:r.bool,level:r.number,locked:r.bool,title:r.string,width:r.number};const b=t=>null;b.propTypes={children:r.oneOfType([r.arrayOf(r.element),r.element]),headerCellOptions:r.any,hidden:r.bool,level:r.number,locked:r.bool,title:r.string,width:r.number};class G extends n.PureComponent{}class S extends n.PureComponent{}class A extends n.PureComponent{}exports.KendoOoxml=v;exports.ExcelExport=g;exports.ExcelExportColumn=y;exports.ExcelExportColumnGroup=b;exports.ExcelExportFooter=G;exports.ExcelExportGroupFooter=S;exports.ExcelExportGroupHeader=A;exports.isWorkbookOptions=O;exports.toDataURL=C;exports.workbookOptions=m;
|
package/index.mjs
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as l from "react";
|
|
6
|
+
import * as t from "prop-types";
|
|
7
|
+
import { saveAs as m } from "@progress/kendo-file-saver";
|
|
8
|
+
import { ExcelExporter as C, Workbook as y } from "@progress/kendo-ooxml";
|
|
9
|
+
import * as N from "@progress/kendo-ooxml";
|
|
10
|
+
import * as x from "react-dom/server";
|
|
11
|
+
import * as u from "@progress/kendo-licensing";
|
|
12
|
+
const d = (r, e, o) => (i) => {
|
|
13
|
+
o(e, i);
|
|
14
|
+
const n = x.renderToStaticMarkup(/* @__PURE__ */ l.createElement(r, { ...e })), p = Number(n);
|
|
15
|
+
return isNaN(p) ? n : p;
|
|
16
|
+
}, O = (r, e) => {
|
|
17
|
+
r.$implicit = r.group = e, r.field = e.field, r.value = e.value, r.aggregates = e.aggregates;
|
|
18
|
+
}, b = (r, e) => {
|
|
19
|
+
r.group = e.group, r.$implicit = r.aggregates = e;
|
|
20
|
+
}, k = (r, e) => {
|
|
21
|
+
}, E = (r) => {
|
|
22
|
+
const e = [];
|
|
23
|
+
let o = 0;
|
|
24
|
+
const s = (i, n, p) => {
|
|
25
|
+
i.forEach((a) => {
|
|
26
|
+
if (a.level === p) {
|
|
27
|
+
const c = new w(a, o);
|
|
28
|
+
if (n.push(c), a.children && a.children.length > 1) {
|
|
29
|
+
const f = c.columns = [];
|
|
30
|
+
s(a.children, f, p + 1);
|
|
31
|
+
} else
|
|
32
|
+
o++;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return s(r, e, 0), e;
|
|
37
|
+
};
|
|
38
|
+
class w {
|
|
39
|
+
constructor(e, o) {
|
|
40
|
+
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, {
|
|
41
|
+
$implicit: e,
|
|
42
|
+
column: e,
|
|
43
|
+
columnIndex: o
|
|
44
|
+
}, k)), e.groupFooter && (this.groupFooterTemplate = d(e.groupFooter, {
|
|
45
|
+
column: e,
|
|
46
|
+
field: e.field
|
|
47
|
+
}, b)), e.groupHeader && (this.groupHeaderTemplate = d(e.groupHeader, {}, O));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const P = (r) => Math.max(...r.map((e) => e.level)) + 1, T = (r) => {
|
|
51
|
+
const e = E(r.columns), s = new C({
|
|
52
|
+
columns: e,
|
|
53
|
+
data: r.data,
|
|
54
|
+
filterable: r.filterable,
|
|
55
|
+
groups: r.group,
|
|
56
|
+
paddingCellOptions: r.paddingCellOptions,
|
|
57
|
+
headerPaddingCellOptions: r.headerPaddingCellOptions,
|
|
58
|
+
hierarchy: r.hierarchy ? { depth: P(r.data), itemLevel: (i) => i.level } : null,
|
|
59
|
+
collapsible: r.collapsible
|
|
60
|
+
}).workbook();
|
|
61
|
+
return s.creator = r.creator, s.date = r.date, s.rtl = r.dir === "rtl", s;
|
|
62
|
+
}, R = (r) => new y(r).toDataURL(), v = (r) => r && r.sheets, h = {
|
|
63
|
+
name: "@progress/kendo-react-excel-export",
|
|
64
|
+
productName: "KendoReact",
|
|
65
|
+
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
66
|
+
publishDate: 1700573628,
|
|
67
|
+
version: "",
|
|
68
|
+
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
69
|
+
};
|
|
70
|
+
class g extends l.Component {
|
|
71
|
+
constructor(e) {
|
|
72
|
+
if (super(e), this.saveFile = (o) => {
|
|
73
|
+
m(o, this.props.fileName, {
|
|
74
|
+
forceProxy: this.props.forceProxy,
|
|
75
|
+
proxyURL: this.props.proxyURL
|
|
76
|
+
});
|
|
77
|
+
}, this.extractColumns = (o, s = 0) => Array.isArray(o) ? o.map((i) => this.extractChild(i, s)) : [o, this.extractChild(o, s)], this.extractChild = (o, s = 0) => l.isValidElement(o) ? {
|
|
78
|
+
...o.props,
|
|
79
|
+
width: o.props.width && parseInt(`${o.props.width}`, 10),
|
|
80
|
+
level: s,
|
|
81
|
+
children: o.props.children && this.extractColumns(o.props.children, s + 1)
|
|
82
|
+
} : {
|
|
83
|
+
...o,
|
|
84
|
+
level: s,
|
|
85
|
+
children: o.children && this.extractColumns(o.children, s + 1)
|
|
86
|
+
}, this.getExportData = (o) => {
|
|
87
|
+
let s;
|
|
88
|
+
return o ? Array.isArray(o) ? s = {
|
|
89
|
+
data: o
|
|
90
|
+
} : s = o : s = {
|
|
91
|
+
data: this.props.data,
|
|
92
|
+
group: this.props.group
|
|
93
|
+
}, s;
|
|
94
|
+
}, typeof u < "u")
|
|
95
|
+
u.validatePackage(h);
|
|
96
|
+
else {
|
|
97
|
+
let o = `License activation failed for ${h.name}
|
|
98
|
+
`;
|
|
99
|
+
o += `The @progress/kendo-licensing script is not loaded.
|
|
100
|
+
`, o += `See ${h.licensingDocsUrl} for more information.
|
|
101
|
+
`, console.warn(o);
|
|
102
|
+
}
|
|
103
|
+
this.save = this.save.bind(this), this.toDataURL = this.toDataURL.bind(this), this.workbookOptions = this.workbookOptions.bind(this);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Saves the data to Excel.
|
|
107
|
+
*
|
|
108
|
+
* @param exportData - An optional parameter. Can be the data that will be exported or the [`WorkbookOptions`]({% slug api_excel-export_workbookoptions %}).
|
|
109
|
+
* @param columns - An optional parameter. If present, it will be used instead of the columns prop or the child column components.
|
|
110
|
+
*/
|
|
111
|
+
save(e, o) {
|
|
112
|
+
this.toDataURL(e, o).then((...s) => {
|
|
113
|
+
this.props.onExportComplete && this.props.onExportComplete.call(void 0, { target: this }), this.saveFile(...s);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Returns a promise which will be resolved with the file data URI.
|
|
118
|
+
*
|
|
119
|
+
* @param exportData - The optional data or the [`WorkbookOptions`]({% slug api_excel-export_workbookoptions %}) that will be used to generate the data URI.
|
|
120
|
+
* @param externalColumns - The optional columns that will be used.
|
|
121
|
+
* @returns {Promise<string>} - The promise that will be resolved by the file data URI.
|
|
122
|
+
*/
|
|
123
|
+
toDataURL(e, o) {
|
|
124
|
+
const s = v(e) ? e : this.workbookOptions(e, o);
|
|
125
|
+
return R(s);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Based on the specified columns and data, returns [`WorkbookOptions`]({% slug api_excel-export_workbookoptions %}).
|
|
129
|
+
*
|
|
130
|
+
* @param exportData - The optional data that will be exported.
|
|
131
|
+
* @param externalColumns - The optional columns that will be used.
|
|
132
|
+
* @returns {WorkbookOptions} - The workbook options.
|
|
133
|
+
*/
|
|
134
|
+
// tslint:enable:max-line-length
|
|
135
|
+
workbookOptions(e, o) {
|
|
136
|
+
const s = this.getExportData(e), i = this.props.children, n = i && i.type && i.type.displayName === "KendoReactGrid" && i.props && l.Children.toArray(i.props.children), p = this.extractColumns(
|
|
137
|
+
n || o || this.props.columns || l.Children.toArray(i)
|
|
138
|
+
);
|
|
139
|
+
return T({
|
|
140
|
+
columns: p,
|
|
141
|
+
data: s.data,
|
|
142
|
+
group: s.group,
|
|
143
|
+
filterable: this.props.filterable,
|
|
144
|
+
creator: this.props.creator,
|
|
145
|
+
date: this.props.date,
|
|
146
|
+
dir: this.props.dir,
|
|
147
|
+
hierarchy: this.props.hierarchy,
|
|
148
|
+
paddingCellOptions: this.props.paddingCellOptions,
|
|
149
|
+
headerPaddingCellOptions: this.props.headerPaddingCellOptions,
|
|
150
|
+
collapsible: this.props.collapsible
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* @hidden
|
|
155
|
+
*/
|
|
156
|
+
render() {
|
|
157
|
+
return this.props.children || null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
g.propTypes = {
|
|
161
|
+
children: t.any,
|
|
162
|
+
columns: t.arrayOf(t.any),
|
|
163
|
+
creator: t.string,
|
|
164
|
+
data: t.any,
|
|
165
|
+
date: t.any,
|
|
166
|
+
filterable: t.bool,
|
|
167
|
+
fileName: t.string,
|
|
168
|
+
forceProxy: t.bool,
|
|
169
|
+
group: t.any,
|
|
170
|
+
headerPaddingCellOptions: t.any,
|
|
171
|
+
paddingCellOptions: t.any,
|
|
172
|
+
proxyURL: t.string,
|
|
173
|
+
dir: t.string,
|
|
174
|
+
hierarchy: t.bool,
|
|
175
|
+
collapsible: t.bool
|
|
176
|
+
};
|
|
177
|
+
g.defaultProps = {
|
|
178
|
+
fileName: "Export.xlsx",
|
|
179
|
+
forceProxy: !1,
|
|
180
|
+
collapsible: !1
|
|
181
|
+
};
|
|
182
|
+
const F = (r) => null;
|
|
183
|
+
F.propTypes = {
|
|
184
|
+
cellOptions: t.any,
|
|
185
|
+
field: t.string,
|
|
186
|
+
footerCellOptions: t.any,
|
|
187
|
+
footer: t.oneOfType([t.func, t.element]),
|
|
188
|
+
groupFooterCellOptions: t.any,
|
|
189
|
+
groupFooter: t.oneOfType([t.func, t.element]),
|
|
190
|
+
groupHeaderCellOptions: t.any,
|
|
191
|
+
groupHeader: t.oneOfType([t.func, t.element]),
|
|
192
|
+
headerCellOptions: t.any,
|
|
193
|
+
hidden: t.bool,
|
|
194
|
+
level: t.number,
|
|
195
|
+
locked: t.bool,
|
|
196
|
+
title: t.string,
|
|
197
|
+
width: t.number
|
|
198
|
+
};
|
|
199
|
+
const U = (r) => null;
|
|
200
|
+
U.propTypes = {
|
|
201
|
+
children: t.oneOfType([t.arrayOf(t.element), t.element]),
|
|
202
|
+
headerCellOptions: t.any,
|
|
203
|
+
hidden: t.bool,
|
|
204
|
+
level: t.number,
|
|
205
|
+
locked: t.bool,
|
|
206
|
+
title: t.string,
|
|
207
|
+
width: t.number
|
|
208
|
+
};
|
|
209
|
+
class H extends l.PureComponent {
|
|
210
|
+
}
|
|
211
|
+
class A extends l.PureComponent {
|
|
212
|
+
}
|
|
213
|
+
class G extends l.PureComponent {
|
|
214
|
+
}
|
|
215
|
+
export {
|
|
216
|
+
g as ExcelExport,
|
|
217
|
+
F as ExcelExportColumn,
|
|
218
|
+
U as ExcelExportColumnGroup,
|
|
219
|
+
H as ExcelExportFooter,
|
|
220
|
+
A as ExcelExportGroupFooter,
|
|
221
|
+
G as ExcelExportGroupHeader,
|
|
222
|
+
N as KendoOoxml,
|
|
223
|
+
v as isWorkbookOptions,
|
|
224
|
+
R as toDataURL,
|
|
225
|
+
T as workbookOptions
|
|
226
|
+
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import { WorkbookSheetRowCellBorderBottom, WorkbookSheetRowCellBorderLeft, WorkbookSheetRowCellBorderTop, WorkbookSheetRowCellBorderRight } from '@progress/kendo-ooxml';
|
|
2
6
|
/**
|
|
3
7
|
* The options for the Excel Export cell.
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import { CellOptions } from './CellOptionsInterface';
|
|
2
6
|
import { ExcelExportColumnProps } from '../ExcelExportColumn';
|
|
3
7
|
/**
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import { WorkbookOptions } from '@progress/kendo-ooxml';
|
|
2
6
|
import { ExcelExportProps } from '../ExcelExport';
|
|
3
7
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { PackageMetadata } from '@progress/kendo-licensing';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export declare const packageMetadata: PackageMetadata;
|
package/package.json
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-excel-export",
|
|
3
|
+
"version": "7.0.0-develop.2",
|
|
3
4
|
"description": "React Excel export helps you export and save data to Excel files and customize or filter the output. KendoReact Excel Export package",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
"author": "Progress",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
|
+
"homepage": "https://www.telerik.com/kendo-react-ui",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./index.mjs",
|
|
13
|
+
"require": "./index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@progress/kendo-licensing": "^1.3.0",
|
|
19
|
+
"@progress/kendo-data-query": "^1.0.0",
|
|
20
|
+
"@progress/kendo-react-common": "7.0.0-develop.2",
|
|
21
|
+
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
22
|
+
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
8
23
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"scripts": {
|
|
14
|
-
"test": "cd ../../ && npm run test -- --testPathPattern=/packages/excel/.*",
|
|
15
|
-
"start": "gulp start",
|
|
16
|
-
"build-package": "gulp build-package"
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@progress/kendo-file-saver": "^1.0.0",
|
|
26
|
+
"@progress/kendo-ooxml": "^1.6.3",
|
|
27
|
+
"prop-types": "^15.6.0"
|
|
17
28
|
},
|
|
18
|
-
"homepage": "https://www.telerik.com/kendo-react-ui",
|
|
19
29
|
"keywords": [
|
|
20
30
|
"Kendo UI",
|
|
21
31
|
"React",
|
|
@@ -29,37 +39,15 @@
|
|
|
29
39
|
"Telerik",
|
|
30
40
|
"Excel export"
|
|
31
41
|
],
|
|
32
|
-
"peerDependencies": {
|
|
33
|
-
"@progress/kendo-licensing": "^1.3.0",
|
|
34
|
-
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
35
|
-
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"@progress/kendo-file-saver": "^1.0.0",
|
|
39
|
-
"@progress/kendo-ooxml": "^1.6.3",
|
|
40
|
-
"prop-types": "^15.6.0"
|
|
41
|
-
},
|
|
42
42
|
"@progress": {
|
|
43
43
|
"friendlyName": "Excel Export",
|
|
44
44
|
"framework": "KendoReact"
|
|
45
45
|
},
|
|
46
|
-
"author": "Progress",
|
|
47
|
-
"license": "SEE LICENSE IN LICENSE.md",
|
|
48
46
|
"publishConfig": {
|
|
49
47
|
"access": "public"
|
|
50
48
|
},
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"@progress/kendo-react-dateinputs": "6.1.1",
|
|
57
|
-
"@progress/kendo-react-dropdowns": "6.1.1",
|
|
58
|
-
"@progress/kendo-react-grid": "6.1.1",
|
|
59
|
-
"@progress/kendo-react-indicators": "6.1.1",
|
|
60
|
-
"@progress/kendo-react-inputs": "6.1.1",
|
|
61
|
-
"@progress/kendo-react-intl": "6.1.1",
|
|
62
|
-
"@progress/kendo-react-treelist": "6.1.1"
|
|
63
|
-
},
|
|
64
|
-
"sideEffects": false
|
|
65
|
-
}
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/telerik/kendo-react.git"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import * as React from 'react';
|
|
2
6
|
import { ExcelExportColumnProps } from '../ExcelExportColumn';
|
|
3
7
|
/**
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import * as React from 'react';
|
|
2
6
|
import { ExcelExportColumnProps } from '../ExcelExportColumn';
|
|
3
7
|
import { AggregateResult, GroupResult } from '@progress/kendo-data-query';
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import * as React from 'react';
|
|
2
6
|
import { AggregateResult, GroupResult } from '@progress/kendo-data-query';
|
|
3
7
|
/**
|
package/about.md
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<a href="https://www.telerik.com/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-excel&utm_content=banner" target="_blank">
|
|
2
|
-
<img src="https://www.telerik.com/kendo-react-ui/components/npm-banner.svg" alt="KendoReact NPM Banner">
|
|
3
|
-
</a>
|