From d1dd7d673debea929500dbcd83762882cced5902 Mon Sep 17 00:00:00 2001 From: EugeniyKiyashko Date: Thu, 6 Feb 2020 13:55:55 +0300 Subject: [PATCH] =?UTF-8?q?ExcelJS=20-=20add=20do=D1=81=20comments=20for?= =?UTF-8?q?=20arguments=20of=20the=20'exportDataGrid'=20function=20(#11912?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/exporter/excel/excel.doc_comments.d.ts | 56 ------ js/exporter/excel/excel.doc_comments.js | 13 -- js/exporter/exceljs/excelExporter.d.ts | 226 ++++++++++++++++++++++ js/exporter/exceljs/excelExporter.js | 33 ++++ js/ui/data_grid.d.ts | 5 +- ts/dx.all.d.ts | 58 ++++++ 6 files changed, 321 insertions(+), 70 deletions(-) create mode 100644 js/exporter/exceljs/excelExporter.d.ts diff --git a/js/exporter/excel/excel.doc_comments.d.ts b/js/exporter/excel/excel.doc_comments.d.ts index 6fccd2189e9a..45a5137dc5bf 100644 --- a/js/exporter/excel/excel.doc_comments.d.ts +++ b/js/exporter/excel/excel.doc_comments.d.ts @@ -1,59 +1,3 @@ -import { - dxDataGridColumn -} from '../../ui/data_grid'; - -export interface ExcelDataGridCell { - /** - * @docid ExcelDataGridCell.column - * @type dxDataGridColumn - * @prevFileNamespace DevExpress.exporter - * @public - */ - column?: dxDataGridColumn; - /** - * @docid ExcelDataGridCell.data - * @type object - * @prevFileNamespace DevExpress.exporter - * @public - */ - data?: any; - /** - * @docid ExcelDataGridCell.groupIndex - * @type number - * @prevFileNamespace DevExpress.exporter - * @public - */ - groupIndex?: number; - /** - * @docid ExcelDataGridCell.groupSummaryItems - * @type Array - * @prevFileNamespace DevExpress.exporter - * @public - */ - groupSummaryItems?: Array<{ name?: string, value?: any }>; - /** - * @docid ExcelDataGridCell.rowType - * @type string - * @prevFileNamespace DevExpress.exporter - * @public - */ - rowType?: string; - /** - * @docid ExcelDataGridCell.totalSummaryItemName - * @type string - * @prevFileNamespace DevExpress.exporter - * @public - */ - totalSummaryItemName?: string; - /** - * @docid ExcelDataGridCell.value - * @type any - * @prevFileNamespace DevExpress.exporter - * @public - */ - value?: any; -} - export interface ExcelFont { /** * @docid ExcelFont.bold diff --git a/js/exporter/excel/excel.doc_comments.js b/js/exporter/excel/excel.doc_comments.js index 417fea0b06ff..55f999021e87 100644 --- a/js/exporter/excel/excel.doc_comments.js +++ b/js/exporter/excel/excel.doc_comments.js @@ -2,16 +2,3 @@ * @name ExcelFont * @type object */ - -/** -* @name ExcelDataGridCell -* @type object -*/ -/** -* @name ExcelDataGridCell.groupSummaryItems.name -* @type string -*/ -/** -* @name ExcelDataGridCell.groupSummaryItems.value -* @type any -*/ diff --git a/js/exporter/exceljs/excelExporter.d.ts b/js/exporter/exceljs/excelExporter.d.ts new file mode 100644 index 000000000000..bb7cb26e591c --- /dev/null +++ b/js/exporter/exceljs/excelExporter.d.ts @@ -0,0 +1,226 @@ +import dxDataGrid, { dxDataGridColumn } from '../../ui/data_grid'; + +export interface ExcelDataGridCell { + /** + * @docid ExcelDataGridCell.column + * @type dxDataGridColumn + * @prevFileNamespace DevExpress.exporter + * @public + */ + column?: dxDataGridColumn; + /** + * @docid ExcelDataGridCell.data + * @type Object + * @prevFileNamespace DevExpress.exporter + * @public + */ + data?: any; + /** + * @docid ExcelDataGridCell.groupIndex + * @type number + * @prevFileNamespace DevExpress.exporter + * @public + */ + groupIndex?: number; + /** + * @docid ExcelDataGridCell.groupSummaryItems + * @type Array + * @prevFileNamespace DevExpress.exporter + * @public + */ + groupSummaryItems?: Array<{ name?: string, value?: any }>; + /** + * @docid ExcelDataGridCell.rowType + * @type string + * @prevFileNamespace DevExpress.exporter + * @public + */ + rowType?: string; + /** + * @docid ExcelDataGridCell.totalSummaryItemName + * @type string + * @prevFileNamespace DevExpress.exporter + * @public + */ + totalSummaryItemName?: string; + /** + * @docid ExcelDataGridCell.value + * @type any + * @prevFileNamespace DevExpress.exporter + * @public + */ + value?: any; +} + +export interface CellAddress { + /** + * @docid CellAddress.row + * @type number + * @prevFileNamespace DevExpress.exporter + * @public + */ + row?: number; + /** + * @docid CellAddress.column + * @type number + * @prevFileNamespace DevExpress.exporter + * @public + */ + column?: number; +} + +export interface CellsRange { + /** + * @docid CellsRange.from + * @type CellAddress + * @prevFileNamespace DevExpress.exporter + * @public + */ + from?: CellAddress; + /** + * @docid CellsRange.to + * @type CellAddress + * @prevFileNamespace DevExpress.exporter + * @public + */ + to?: CellAddress; +} + +export interface ExportLoadPanel { + /** + * @docid ExportLoadPanel.enabled + * @type boolean + * @default true + */ + enabled?: boolean; + /** + * @docid ExportLoadPanel.text + * @type string + * @default "Exporting..." + */ + text?: string; + /** + * @docid ExportLoadPanel.width + * @type number + * @default 200 + */ + width?: number; + /** + * @docid ExportLoadPanel.height + * @type number + * @default 90 + */ + height?: number; + /** + * @docid ExportLoadPanel.showIndicator + * @type boolean + * @default true + */ + showIndicator?: boolean; + /** + * @docid ExportLoadPanel.indicatorSrc + * @type string + * @default "" + */ + indicatorSrc?: string; + /** + * @docid ExportLoadPanel.showPane + * @type boolean + * @default true + */ + showPane?: boolean; + /** + * @docid ExportLoadPanel.shading + * @type boolean + * @default false + */ + shading?: boolean; + /** + * @docid ExportLoadPanel.shadingColor + * @type string + * @default '' + */ + shadingColor?: string; +} + +export interface ExportDataGridProps { + /** + * @docid ExportDataGridProps.component + * @type dxDataGrid + * @default undefined + * @prevFileNamespace DevExpress.exporter + * @public + */ + component?: dxDataGrid; + /** + * @docid ExportDataGridProps.worksheet + * @type Object + * @default undefined + * @prevFileNamespace DevExpress.exporter + * @public + */ + worksheet?: object; + /** + * @docid ExportDataGridProps.topLeftCell + * @type CellAddress + * @default { row: 1, column: 1 } + * @prevFileNamespace DevExpress.exporter + * @public + */ + topLeftCell?: CellAddress; + /** + * @docid ExportDataGridProps.selectedRowsOnly + * @type boolean + * @default false + * @prevFileNamespace DevExpress.exporter + * @public + */ + selectedRowsOnly?: boolean; + /** + * @docid ExportDataGridProps.autoFilterEnabled + * @type boolean + * @default false + * @prevFileNamespace DevExpress.exporter + * @public + */ + autoFilterEnabled?: boolean; + /** + * @docid ExportDataGridProps.keepColumnWidths + * @type boolean + * @default true + * @prevFileNamespace DevExpress.exporter + * @public + */ + keepColumnWidths?: boolean; + /** + * @docid ExportDataGridProps.customizeCell + * @type function(options) + * @type_function_param1 options:Object + * @type_function_param1_field1 gridCell:ExcelDataGridCell + * @type_function_param1_field2 excelCell:Object + * @prevFileNamespace DevExpress.exporter + * @public + */ + customizeCell?: ((options: { gridCell?: ExcelDataGridCell, excelCell?: object}) => any); + /** + * @docid ExportDataGridProps.loadPanel + * @type ExportLoadPanel + * @prevFileNamespace DevExpress.exporter + * @public + */ + loadPanel?: ExportLoadPanel; +} + +/** + * @docid excelExporter.exportDataGrid + * @publicName exportDataGrid(options) + * @param1 options:ExportDataGridProps + * @return Promise + * @namespace DevExpress.excelExporter + * @module exceljs/excelExporter/exportDataGrid + * @static + * @prevFileNamespace DevExpress.exporter + * @public + */ +export function exportDataGrid(options: ExportDataGridProps): Promise; + diff --git a/js/exporter/exceljs/excelExporter.js b/js/exporter/exceljs/excelExporter.js index 74c25eab4db2..67bed8dfcbeb 100644 --- a/js/exporter/exceljs/excelExporter.js +++ b/js/exporter/exceljs/excelExporter.js @@ -1,3 +1,36 @@ import { exportDataGrid } from './exportDataGrid'; +/** +* @name excelExporter +* @section utils +*/ +/** +* @name CellAddress +* @type object +*/ +/** +* @name ExportDataGridProps +* @type object +*/ +/** +* @name CellsRange +* @type object +*/ +/** +* @name ExportLoadPanel +* @type object +*/ +/** +* @name ExcelDataGridCell +* @type object +*/ +/** +* @name ExcelDataGridCell.groupSummaryItems.name +* @type string +*/ +/** +* @name ExcelDataGridCell.groupSummaryItems.value +* @type any +*/ + export { exportDataGrid }; diff --git a/js/ui/data_grid.d.ts b/js/ui/data_grid.d.ts index 332a0ea0c32c..2a77cbfda162 100644 --- a/js/ui/data_grid.d.ts +++ b/js/ui/data_grid.d.ts @@ -19,7 +19,10 @@ import { } from '../events/index'; import { - ExcelDataGridCell, + ExcelDataGridCell +} from '../exporter/exceljs/excelExporter'; + +import { ExcelFont } from '../exporter/excel/excel.doc_comments'; diff --git a/ts/dx.all.d.ts b/ts/dx.all.d.ts index 0b335f1661a7..8b0ccbac33f8 100644 --- a/ts/dx.all.d.ts +++ b/ts/dx.all.d.ts @@ -1574,7 +1574,25 @@ declare module DevExpress.events { /** @name events.triggerHandler(element, event, extraParameters) */ export function triggerHandler(element: Element | Array, event: string | event, extraParameters: any): void; } +declare module DevExpress.excelExporter { + /** @name excelExporter.exportDataGrid(options) */ + export function exportDataGrid(options: DevExpress.exporter.ExportDataGridProps): Promise & JQueryPromise; +} declare module DevExpress.exporter { + /** @name CellAddress */ + export interface CellAddress { + /** @name CellAddress.column */ + column?: number; + /** @name CellAddress.row */ + row?: number; + } + /** @name CellsRange */ + export interface CellsRange { + /** @name CellsRange.from */ + from?: CellAddress; + /** @name CellsRange.to */ + to?: CellAddress; + } /** @name ExcelDataGridCell */ export interface ExcelDataGridCell { /** @name ExcelDataGridCell.column */ @@ -1607,6 +1625,46 @@ declare module DevExpress.exporter { /** @name ExcelFont.underline */ underline?: 'double' | 'doubleAccounting' | 'none' | 'single' | 'singleAccounting'; } + /** @name ExportDataGridProps */ + export interface ExportDataGridProps { + /** @name ExportDataGridProps.autoFilterEnabled */ + autoFilterEnabled?: boolean; + /** @name ExportDataGridProps.component */ + component?: DevExpress.ui.dxDataGrid; + /** @name ExportDataGridProps.customizeCell */ + customizeCell?: ((options: { gridCell?: ExcelDataGridCell, excelCell?: any }) => any); + /** @name ExportDataGridProps.keepColumnWidths */ + keepColumnWidths?: boolean; + /** @name ExportDataGridProps.loadPanel */ + loadPanel?: ExportLoadPanel; + /** @name ExportDataGridProps.selectedRowsOnly */ + selectedRowsOnly?: boolean; + /** @name ExportDataGridProps.topLeftCell */ + topLeftCell?: CellAddress; + /** @name ExportDataGridProps.worksheet */ + worksheet?: any; + } + /** @name ExportLoadPanel */ + export interface ExportLoadPanel { + /** @name ExportLoadPanel.enabled */ + enabled?: boolean; + /** @name ExportLoadPanel.height */ + height?: number; + /** @name ExportLoadPanel.indicatorSrc */ + indicatorSrc?: string; + /** @name ExportLoadPanel.shading */ + shading?: boolean; + /** @name ExportLoadPanel.shadingColor */ + shadingColor?: string; + /** @name ExportLoadPanel.showIndicator */ + showIndicator?: boolean; + /** @name ExportLoadPanel.showPane */ + showPane?: boolean; + /** @name ExportLoadPanel.text */ + text?: string; + /** @name ExportLoadPanel.width */ + width?: number; + } } declare module DevExpress.fileManagement { /** @name CustomFileSystemProvider.Options */