import * as ArDesignerNs from '@grapecity/activereports/reportdesigner'; import * as ArViewerNs from '@grapecity/activereports/reportviewer'; import { Rdl, rdlxParams, ResourceLocator } from '@grapecity/activereports/core'; import { LoadResult, SearchOptions, CancellationToken, SearchStatus, SearchResult, ExportResult, FontDescriptor } from '@grapecity/activereports/reportviewer'; export interface DesignerProps { /** Sets the current report. */ report?: ArDesignerNs.Report; /** * Called on open report. * @returns Promise with report info or 'undefined' if operation was cancelled. */ onCreate?: () => Promise; /** * Called on opening report. * @returns Promise with report info or 'undefined' if operation was cancelled. */ onOpen?: () => Promise; /** * Called on saving report. * @param options Current report info. * @returns Promise with new report info if report was saved or 'undefined' if operation was cancelled. */ onSave?: (options: ArDesignerNs.SaveReportInfo) => Promise; /** * Called on saving report as new. * @param options Current report info. * @returns Promise with new report info if report was saved or 'undefined' if operation was cancelled. */ onSaveAs?: (options: ArDesignerNs.SaveNewReportInfo) => Promise; /** * Called on render current report. * @param report Current report info. * @param resourceLocator ResourceLocator instance. */ onRender?: (report: ArDesignerNs.ReportDefinition, resourceLocator?: Partial) => Promise; /** * Called on open custom file menu. */ onOpenFileMenu?: () => void; /** Sets the list of available images. */ imageList?: ArDesignerNs.ImageResourceInfo[]; /** Sets the list of available reports. */ reportList?: ArDesignerNs.ReportResourceInfo[]; /** Sets the list of available master reports. */ masterReportList?: ArDesignerNs.ReportResourceInfo[]; /** Sets the list of available reports. */ themeList?: ArDesignerNs.ThemeResourceInfo[]; /** Sets the list of datasource templates. */ dataSources?: ArDesignerNs.DataSourceTemplate[]; /** * Called before designer initialization. * @returns DesignerConfig to initialize designer instance. */ onInit?(): ArDesignerNs.DesignerConfig; } export interface DesignerMethods { /** * Sets report. * @param report Report to load. * @param whenDirty Action to perform in case of 'dirty' report. * @param isDirtyInitial Initial value for 'dirty' state after load. */ setReport(report: ArDesignerNs.Report, whenDirty?: ArDesignerNs.WhenDirty, isDirtyInitial?: boolean): Promise; /** * Gets report. * @returns Promise with current report information. */ getReport(): Promise; /** * Creates report. * @param reportInfo Report info. * @param whenDirty Action to perform in case of 'dirty' report. */ createReport(reportInfo: ArDesignerNs.NewReportInfo, whenDirty?: ArDesignerNs.WhenDirty): Promise; /** * Process command. * @param cmd Command name. */ processCommand(cmd: ArDesignerNs.DesignerCommand): Promise; /** * Returns focus to Designer. */ focus(): void; /** * Gets API to manipulate designer. */ getEditorAPI(): Promise; /** * Gets API for the menu and sidebar panels. */ getPanelsAPI(): Promise; /** * Gets API for notifications panel. */ getNotificationsAPI(): Promise; } export declare type DesignerType = DesignerProps & DesignerMethods; declare type IReport = Rdl.Report | string; declare type OpenReportInfo = { /** Report URI to be loaded into viewer. */ Uri?: string; /** Report parameters */ Params?: { [name: string]: rdlxParams.ParameterVariant[]; }; }; export interface ViewerProps { availableExports?: string[]; mouseMode?: ArViewerNs.ViewerMouseMode; renderMode?: ArViewerNs.ViewerRenderMode; viewMode?: ArViewerNs.ViewerViewMode | ArViewerNs.ViewMode; zoom?: ArViewerNs.ViewerZoomMode; fullscreen?: boolean; toolbarVisible?: boolean; sidebarVisible?: boolean; language?: string; /** UI theme */ theme?: ArViewerNs.UITheme; /** Initial UI themes settings */ themeConfig?: ArViewerNs.UIThemeConfig; exportsSettings?: Record; /** Layout of panels bar. Cannot be changed on the fly. */ panelsLayout?: ArViewerNs.PanelsLocation; /** Parameters panel location. */ parameterPanelLocation?: ArViewerNs.ParameterPanelLocation; /** Parameters panel behaviour. */ showParametersOnOpen?: ArViewerNs.ShowParametersOnOpen; /** Enables report data memoization if set to "true". */ memoizeData?: boolean; toolbarLayout?: ArViewerNs.ToolbarLayout; errorHandler?: ArViewerNs.Viewer['errorHandler']; /** Sets the report to open on component load. * * ```javascript * * ``` */ report?: OpenReportInfo; } export interface ViewerMethods { /** * Opens report from file or as definition (json string)). * * ```javascript * * viewer.open('report.json'); * ``` * * @param report The report template. Can be report URI, or report definition, or instance of PageReport class. * @param settings Additional settings for report (name, parameters). */ open(report: IReport, settings?: Partial): Promise; /** * Exports currently displayed report to specified output format. Returns object which contains result data as blob object | string and download function. So you could either use this blob object or download file immediately. Please note that you can specify settings in PDF export as plain list (like **{title: 'Title', author: 'Author Name', ownerPassword: '1'}** etc... * * ```javascript * var options = {filename:"Invoice List"}; * var cancelCallback = function(){ * return false; // continue export. Return true to cancel export process * } * viewer.export('pdf', options, {cancel: cancelCallback }).then(result => doSmthWithBlob(result.data)); * //or you can download file * viewer.export('pdf', options, {cancel: cancelCallback }).then(result => result.download('Invoice List')); * ``` * * @param format Export format identifier. One of 'pdf', 'xlsx', 'html', 'tabular-data'. * @param settings Format specific export settings. * @param params Additional export customization. */ export(format: string, settings: Record, params?: { cancel?: () => boolean; }): Promise; /** * Resets current viewer document */ resetDocument(): Promise; /** * Prints currently displayed report. */ print(): void; /** Gets the viewer component instance. */ Viewer(): ArViewerNs.Viewer; /** Gets current page number (1-based). Returns 0 if no document loaded. */ currentPage(): number; /** Gets the total number of pages available in report. */ pageCount(): number; /** Provides access to the "history" API. */ history(): ArViewerNs.HistoryApi; /** Gets the toolbar API */ toolbar(): ArViewerNs.Toolbar; /** Navigates to the first page. */ goToFirstPage(): void; /** Navigates to the previous page. */ goToPrevPage(): void; /** Navigates to the next page. */ goToNextPage(): void; /** Navigates to the last page. */ goToLastPage(): void; /** Navigates to the specified page (starting from 1). */ goToPage(pageNumber: number): void; /** Performs backToParent action which will return user to parent report. */ backToParent(): void; /** Performs refresh operation in report (re-render report). */ refresh(): void; /** Gets **true** if backToParent command is applicable to current document. */ canBackToParent(): boolean; /** * Register specified fonts in CSS and pdf export. Helps display export correctly on machines where fonts can be missed. */ registerFont(...fonts: FontDescriptor[]): void; /** * Performs search operation in currently rendered report. Allows you to create your own custom search pane. */ search(options: SearchOptions, resultFn: (result: SearchResult) => void, progressFn?: (progress: { pageIndex: number; pageCount: number | null; }) => void, cancel?: CancellationToken): Promise; /** * Highlights the search result returned by a search method. */ highlight(result: SearchResult | null): Promise; } export declare type ViewerType = ViewerProps & ViewerMethods; export {};