UNPKG

@progress/kendo-angular-spreadsheet

Version:

A Spreadsheet Component for Angular

212 lines (211 loc) 8.86 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { AfterViewInit, ElementRef, EventEmitter, NgZone, OnChanges, SimpleChanges, ViewContainerRef } from '@angular/core'; import { CellDefaultStyle, ExcelExportSettings, SheetDescriptor, SpreadsheetWidget } from '@progress/kendo-spreadsheet-common'; import { IntlService } from '@progress/kendo-angular-intl'; import { SVGIcon } from '@progress/kendo-svg-icons'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { PopupService } from '@progress/kendo-angular-popup'; import { ContextMenuSelectEvent, MenuItem } from '@progress/kendo-angular-menu'; import { DialogService } from '@progress/kendo-angular-dialog'; import { SpreadsheetService } from './common/spreadsheet.service'; import { SpreadsheetToolsService } from './tools/tools.service'; import { SheetInfo, SpreadsheetActiveSheetChangeEvent, SpreadsheetChangeEvent, SpreadsheetExcelExportEvent, SpreadsheetExcelImportEvent, SpreadsheetMainMenuItem } from './models'; import { ErrorHandlingService } from './common/error-handling.service'; import * as i0 from "@angular/core"; /** * Represents the [Kendo UI Spreadsheet component for Angular]({% slug overview_spreadsheet %}). * * @example * ```html * <kendo-spreadsheet [sheets]="sheets"></kendo-spreadsheet> * ``` * * @remarks * Supported children components are: {@link CustomMessagesComponent} */ export declare class SpreadsheetComponent implements AfterViewInit, OnChanges { private ngZone; private intl; private host; private localization; private spreadsheetService; private toolsService; private errorService; private dialogService; private popupService; private container; private formulaBarInputRef; private formulaCellInputRef; private nameBoxRef; dialogContainer: ViewContainerRef; private contextMenu; hostClass: boolean; role: string; /** * The menu items configuration. */ set menuItems(items: SpreadsheetMainMenuItem[]); get menuItems(): any[]; /** * Sets the overflow option of the built-in Toolbar components. * @default false */ overflow: boolean; /** * Sets the height of the formula list container. * Accepts same values as the CSS [`style.height`](https://developer.mozilla.org/en-US/docs/Web/CSS/height) property. * * @default '300px' */ formulaListMaxHeight: string; /** * The name of the currently active sheet. Must match one of the sheet names. */ set activeSheet(value: string); get activeSheet(): string; /** * An array of `SheetDescriptor` objects that describe the sheets in the Spreadsheet. */ set sheets(value: SheetDescriptor[]); get sheetsInfo(): SheetInfo[]; /** * The number of columns in the document. * * @default 50 */ columns: number; /** * The initial column width in pixels. * * @default 100 */ columnWidth: number; /** * The initial styles applies to the sheet cells. */ defaultCellStyle: CellDefaultStyle; /** * The height of the header row in pixels. * * @default 30 */ headerHeight: number; /** * The width of the header column in pixels. * * @default 32 */ headerWidth: number; /** * The initial row height in pixels. * * @default 30 */ rowHeight: number; /** * The number of rows in the document. * * @default 200 */ rows: number; /** * An object containing any images used in the Spreadsheet. The keys should be image IDs (they are referenced by this ID in `sheets.drawings`), * and the values should be image URLs. The image URLs can be either [`data URLs`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs) * (in which case the images are fully contained by the JSON), or external URLs. */ images: { [name: string]: string; }; /** * Configures the Excel export settings of the Spreadsheet. */ excel: ExcelExportSettings; /** * Fired when a value in the Spreadsheet is changed. Exposes the `SpreadsheetWidget` instance and the selected `Range` as event data. */ change: EventEmitter<SpreadsheetChangeEvent>; /** * Fired when the selected range format is changed from the UI. Exposes the `SpreadsheetWidget` instance and the selected `Range` as event data. */ formatChange: EventEmitter<SpreadsheetChangeEvent>; /** * Fired when the selection is changed by the end user. Exposes the `SpreadsheetWidget` instance and the selected `Range` as event data. */ selectionChange: EventEmitter<SpreadsheetChangeEvent>; /** * Fired when the end user clicks the Export to Excel toolbar button. * The event is preventable and exposes the `Workbook` object, a `preventDefault` method * (if invoked, the generated file will not be saved), and the `SpreadsheetWidget` instance. */ excelExport: EventEmitter<SpreadsheetExcelExportEvent>; /** * Fired when the end user clicks the Open toolbar button. * The event is preventable and exposes the selected `File` or `Blob`, a `preventDefault` method * (if invoked, the selected file will not be loaded), and the `SpreadsheetWidget` instance. */ excelImport: EventEmitter<SpreadsheetExcelImportEvent>; /** * Fired when the active sheet is about to change. * The event exposes the new active `Sheet` and the `SpreadsheetWidget` instance. */ activeSheetChange: EventEmitter<SpreadsheetActiveSheetChangeEvent>; formulaFxIcon: SVGIcon; folderOpenIcon: SVGIcon; downloadIcon: SVGIcon; selectedMenuItem: any; get spreadsheetWidget(): SpreadsheetWidget; showLicenseWatermark: boolean; contextMenuItems: MenuItem[]; private _sheetsInfo; private _activeSheet; private _menuItems; private currentRange; private subs; private popupRef; constructor(ngZone: NgZone, intl: IntlService, host: ElementRef, localization: LocalizationService, spreadsheetService: SpreadsheetService, toolsService: SpreadsheetToolsService, errorService: ErrorHandlingService, dialogService: DialogService, popupService: PopupService, container: ViewContainerRef); ngAfterViewInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** * @hidden */ onContextMenu(e: any): void; /** * @hidden */ onContextMenuSelect(e: ContextMenuSelectEvent): void; /** * @hidden */ onKeyDown: (e: KeyboardEvent) => void; /** * @hidden */ messageFor(key: string): string; /** * @hidden */ onMenuItemSelect(e: any): void; private onChange; private onSelectionChange; private onChangeFormat; private onExcelExport; private onExcelImport; private onActiveSheetChanged; private updateState; private onMessage; private updateActiveSheet; private onSheetsChanged; private get options(); private contextMenuItemsForTarget; private openLinkDialog; private configureSheets; private registerEditors; private isValidFormula; private createDate; static ɵfac: i0.ɵɵFactoryDeclaration<SpreadsheetComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<SpreadsheetComponent, "kendo-spreadsheet", ["kendo-spreadsheet"], { "menuItems": { "alias": "menuItems"; "required": false; }; "overflow": { "alias": "overflow"; "required": false; }; "formulaListMaxHeight": { "alias": "formulaListMaxHeight"; "required": false; }; "activeSheet": { "alias": "activeSheet"; "required": false; }; "sheets": { "alias": "sheets"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "columnWidth": { "alias": "columnWidth"; "required": false; }; "defaultCellStyle": { "alias": "defaultCellStyle"; "required": false; }; "headerHeight": { "alias": "headerHeight"; "required": false; }; "headerWidth": { "alias": "headerWidth"; "required": false; }; "rowHeight": { "alias": "rowHeight"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "images": { "alias": "images"; "required": false; }; "excel": { "alias": "excel"; "required": false; }; }, { "change": "change"; "formatChange": "formatChange"; "selectionChange": "selectionChange"; "excelExport": "excelExport"; "excelImport": "excelImport"; "activeSheetChange": "activeSheetChange"; }, never, never, true, never>; }