UNPKG

igniteui-angular-spreadsheet

Version:

Ignite UI Angular spreadsheet component for displaying and editing Microsoft Excel workbooks for modern web apps.

1,080 lines (1,074 loc) 134 kB
/* THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE: https://www.infragistics.com/legal/license/igultimate-la https://www.infragistics.com/legal/license/igultimate-eula GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company. */ import { EventEmitter, Output, Component, ViewChild, Input, ChangeDetectionStrategy, ViewContainerRef } from '@angular/core'; import { AngularRenderer } from "igniteui-angular-core"; import { toPoint, fromPoint, ensureBool, toSpinal, initializePropertiesFromCss, NamePatcher } from "igniteui-angular-core"; import { TypeRegistrar } from "igniteui-angular-core"; import { Spreadsheet } from './Spreadsheet'; import { SpreadsheetCss } from './SpreadsheetCss'; import { RendererContainer } from './RendererContainer'; import { IgxComponentRendererContainerComponent } from "igniteui-angular-core"; import { delegateCombine } from "igniteui-angular-core"; import { IgxSpreadsheetActionExecutedEventArgs } from './igx-spreadsheet-action-executed-event-args'; import { IgxSpreadsheetActionExecutingEventArgs } from './igx-spreadsheet-action-executing-event-args'; import { IgxSpreadsheetActiveCellChangedEventArgs } from './igx-spreadsheet-active-cell-changed-event-args'; import { IgxSpreadsheetActivePaneChangedEventArgs } from './igx-spreadsheet-active-pane-changed-event-args'; import { IgxSpreadsheetActiveTableChangedEventArgs } from './igx-spreadsheet-active-table-changed-event-args'; import { IgxSpreadsheetActiveWorksheetChangedEventArgs } from './igx-spreadsheet-active-worksheet-changed-event-args'; import { IgxSpreadsheetContextMenuOpeningEventArgs } from './igx-spreadsheet-context-menu-opening-event-args'; import { IgxSpreadsheetEditModeExitingEventArgs } from './igx-spreadsheet-edit-mode-exiting-event-args'; import { IgxSpreadsheetEditModeExitedEventArgs } from './igx-spreadsheet-edit-mode-exited-event-args'; import { IgxSpreadsheetEditModeEnteringEventArgs } from './igx-spreadsheet-edit-mode-entering-event-args'; import { IgxSpreadsheetEditModeEnteredEventArgs } from './igx-spreadsheet-edit-mode-entered-event-args'; import { IgxSpreadsheetEditModeValidationErrorEventArgs } from './igx-spreadsheet-edit-mode-validation-error-event-args'; import { IgxSpreadsheetEditRangePasswordNeededEventArgs } from './igx-spreadsheet-edit-range-password-needed-event-args'; import { IgxSpreadsheetHyperlinkExecutingEventArgs } from './igx-spreadsheet-hyperlink-executing-event-args'; import { IgxSpreadsheetSelectionChangedEventArgs } from './igx-spreadsheet-selection-changed-event-args'; import { IgxSpreadsheetUserPromptDisplayingEventArgs } from './igx-spreadsheet-user-prompt-displaying-event-args'; import { IgxSpreadsheetWorkbookDirtiedEventArgs } from './igx-spreadsheet-workbook-dirtied-event-args'; import * as i0 from "@angular/core"; /** * Custom control that displays one or more worksheets. */ export let IgxSpreadsheetComponent = /*@__PURE__*/ (() => { class IgxSpreadsheetComponent { // #region Constructor constructor(_renderer, _elRef, _ngZone, _componentFactoryResolver, _injector) { //super(); this._renderer = _renderer; this._elRef = _elRef; this._ngZone = _ngZone; this._componentFactoryResolver = _componentFactoryResolver; this._injector = _injector; this._zoneRunner = null; this.__p = null; this._hasUserValues = new Set(); this._stylingContainer = null; this._stylingParent = null; this._inStyling = false; this._contextMenuOpening = null; this._ActionExecuted = null; this._ActionExecuting = null; this._activeCellChanged = null; this._activePaneChanged = null; this._activeTableChanged = null; this._activeWorksheetChanged = null; this._editModeExiting = null; this._editModeExited = null; this._editModeEntering = null; this._editModeEntered = null; this._editModeValidationError = null; this._editRangePasswordNeeded = null; this._hyperlinkExecuting = null; this._selectionChanged = null; this._userPromptDisplaying = null; this._workbookDirtied = null; if (this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this)); } this._zoneRunner = (act) => this._ngZone.run(act); this._implementation = this.createImplementation(); this._container = _renderer.createElement("div"); _renderer.appendChild(_elRef.element.nativeElement, this._container); _renderer.setStyle(this._container, "display", "block"); _renderer.setStyle(this._container, "width", "100%"); _renderer.setStyle(this._container, "height", "100%"); var root; root = this._container; if (this._container.nativeElement != null) { root = this._container.nativeElement; } var ren = new AngularRenderer(root, this._renderer, window.document, this._ngZone, false, {}); this._wrapper = ren; var spreadsheet = this.i; spreadsheet.css = new SpreadsheetCss(); spreadsheet.createRendererContainer = () => this._createContainer(); this._spreadsheet = spreadsheet; spreadsheet.provideContainer(ren); spreadsheet.onInitialized(); ren.addSizeWatcher(() => { this._spreadsheet.containerResized(); }); } set height(value) { this._height = value; this._renderer.setStyle(this._elRef.element.nativeElement, "height", value); this._spreadsheet.containerResized(); } get height() { return this._height; } set width(value) { this._width = value; this._renderer.setStyle(this._elRef.element.nativeElement, "width", value); this._spreadsheet.containerResized(); } get width() { return this._width; } // #endregion Constructor ngOnDestroy() { this._spreadsheet.destroy(); this._wrapper.destroy(); } createImplementation() { return new Spreadsheet(); } _createContainer() { var factory = this._componentFactoryResolver.resolveComponentFactory(IgxComponentRendererContainerComponent); var componentRef = this._dynamicContent.createComponent(factory); var container = new RendererContainer(() => componentRef.destroy()); container.initialize(componentRef.instance, componentRef.location.nativeElement); return container; } ngAfterContentInit() { this.i.containerResized(); this.i.styleUpdated(); } _runInZone(act) { if (this._zoneRunner != null) { this._zoneRunner(act); } else { act(); } } /** * @hidden */ get i() { return this._implementation; } /** * @hidden */ static _createFromInternal(internal) { if (!internal) { return null; } if (!internal.$type) { return null; } let name = internal.$type.name; let externalName = "Igx" + name + "Component"; if (!TypeRegistrar.isRegistered(externalName)) { return null; } return TypeRegistrar.create(externalName); } /** * Returns an array of the panes for the activeWorksheet. */ get panes() { return this.i._getPanesAsArray(); } /** * Returns or sets a boolean indicating whether the scroll lock key is toggled. * This property is used when certain keys are pressed while the control has focus. For example * if an arrow key is pressed while the scroll lock is enabled the cell area will be scrolled rather than changing * the active cell. * Note: * This property is not maintained/changed by the control. It is just queried when * performing actions that consider whether the scroll lock is enabled. */ get isScrollLocked() { return this.i.isScrollLocked; } set isScrollLocked(v) { this.i.isScrollLocked = ensureBool(v); } /** * Returns or sets the active cell within the selected worksheet. */ get activeCell() { return this.i.activeCell; } set activeCell(v) { this.i.activeCell = v; } /** * Returns an object that represents the pane with the focus. */ get activePane() { return this.i.activePane; } set activePane(v) { this.i.activePane = v; } /** * Returns an object that represents the current selection of the * activePane. */ get activeSelection() { return this.i.activeSelection; } set activeSelection(v) { this.i.activeSelection = v; } /** * Returns an object used to get the formatting of the * activeCell and where modifications are applied to the entire * activeSelection. * Any changes made to this object will affect all the objects in the selection. So for example, the * Font.Name may return "Arial" because the active cell has that as its resolved font name even though the other * cells are using a different font but if you set the Font.Name of this object to "Arial" then all the objects * affected by the selection will have their Font.Name updated to that value. */ get activeSelectionCellRangeFormat() { return this.i.activeSelectionCellRangeFormat; } /** * Returns the * ig.excel.WorksheetTable associated with the * activeCell of the * activeWorksheet. */ get activeTable() { return this.i.activeTable; } set activeTable(v) { this.i.activeTable = v; } /** * Returns or sets the Worksheet from the * workbook whose content should be displayed within the control. */ get activeWorksheet() { return this.i.activeWorksheet; } set activeWorksheet(v) { this.i.activeWorksheet = v; } /** * Returns or sets a boolean indicating whether the spreadsheet allows adding worksheets. */ get allowAddWorksheet() { return this.i.allowAddWorksheet; } set allowAddWorksheet(v) { this.i.allowAddWorksheet = ensureBool(v); } /** * Returns or sets a boolean indicating whether the spreadsheet allows adding worksheets. * Note: * if this property is set to false and the current * workbook is performing async calculations, the spreadsheet will cancel them. */ get allowAsyncCalculations() { return this.i.allowAsyncCalculations; } set allowAsyncCalculations(v) { this.i.allowAsyncCalculations = ensureBool(v); } /** * Returns or sets a boolean indicating whether the spreadsheet allows deleting worksheets. */ get allowDeleteWorksheet() { return this.i.allowDeleteWorksheet; } set allowDeleteWorksheet(v) { this.i.allowDeleteWorksheet = ensureBool(v); } /** * Returns or sets a boolean indicating if the grid lines are displayed in the selected worksheets. */ get areGridlinesVisible() { return this.i.areGridlinesVisible; } set areGridlinesVisible(v) { this.i.areGridlinesVisible = ensureBool(v); } /** * Returns or sets a boolean indicating if the row and column headers are displayed for the selected worksheets. */ get areHeadersVisible() { return this.i.areHeadersVisible; } set areHeadersVisible(v) { this.i.areHeadersVisible = ensureBool(v); } /** * Returns an enumeration used to indicate the current edit mode state. */ get cellEditMode() { return this.i.cellEditMode; } set cellEditMode(v) { this.i.cellEditMode = v; } /** * Returns or sets the object that will provide the chart visualization for display within the * Spreadsheet * By default charts are not displayed within the spreadsheet. To display charts one should set this * property to an instance of a * SpreadsheetChartAdapter * which is in a separate reference since it relies upon * the chart and other data visualization controls. */ get chartAdapter() { return this.i.chartAdapter; } set chartAdapter(v) { this.i.chartAdapter = v; } /** * Returns or sets an enumeration indicating the direction of the cell adjacent to the * activeCell that should be activated when the enter key is pressed. * This property is only used if the * isEnterKeyNavigationEnabled is set to true. Also, the reverse direction is * navigated when Shift + Enter are pressed. */ get enterKeyNavigationDirection() { return this.i.enterKeyNavigationDirection; } set enterKeyNavigationDirection(v) { this.i.enterKeyNavigationDirection = v; } /** * Returns or sets the number of decimal places by which a whole number typed in during edit mode should be adjusted when * isFixedDecimalEnabled is true */ get fixedDecimalPlaceCount() { return this.i.fixedDecimalPlaceCount; } set fixedDecimalPlaceCount(v) { this.i.fixedDecimalPlaceCount = +v; } /** * Returns or sets a boolean indicating whether the adjacent cell indicated by the * enterKeyNavigationDirection should be navigated to when the enter key is pressed. */ get isEnterKeyNavigationEnabled() { return this.i.isEnterKeyNavigationEnabled; } set isEnterKeyNavigationEnabled(v) { this.i.isEnterKeyNavigationEnabled = ensureBool(v); } /** * Returns or sets a boolean indicating whether a fixed decimal place is automatically added when a whole number is entered while in edit mode. */ get isFixedDecimalEnabled() { return this.i.isFixedDecimalEnabled; } set isFixedDecimalEnabled(v) { this.i.isFixedDecimalEnabled = ensureBool(v); } /** * Returns or sets a boolean indicating if the formula bar is displayed within the * Spreadsheet. */ get isFormulaBarVisible() { return this.i.isFormulaBarVisible; } set isFormulaBarVisible(v) { this.i.isFormulaBarVisible = ensureBool(v); } /** * Returns a boolean indicating if the control is currently editing the value of the * activeCell */ get isInEditMode() { return this.i.isInEditMode; } set isInEditMode(v) { this.i.isInEditMode = ensureBool(v); } /** * Returns or sets a boolean indicating whether the control is in "End mode". * End mode is a mode that affects certain keyboard navigation such as navigating with the arrow keys. For example when in * end mode and one presses the right arrow, the * activeCell will be changed to be the first cell to the right of the current ActiveCell * that has a value (even if the value is ""). If there were no cells to the right with a value then it would activate the right most cell in that row. End * mode will end automatically such as when one presses an arrow key. */ get isInEndMode() { return this.i.isInEndMode; } set isInEndMode(v) { this.i.isInEndMode = ensureBool(v); } /** * Returns a boolean indicating if the current * workbook is performing asynchronous calculations. */ get isPerformingAsyncCalculations() { return this.i.isPerformingAsyncCalculations; } set isPerformingAsyncCalculations(v) { this.i.isPerformingAsyncCalculations = ensureBool(v); } /** * Returns a boolean indicating if the user is currently editing the name of the active worksheet. */ get isRenamingWorksheet() { return this.i.isRenamingWorksheet; } set isRenamingWorksheet(v) { this.i.isRenamingWorksheet = ensureBool(v); } /** * Returns or sets a boolean indicating whether undo is enabled for the control. */ get isUndoEnabled() { return this.i.isUndoEnabled; } set isUndoEnabled(v) { this.i.isUndoEnabled = ensureBool(v); } /** * Returns or sets the width of the name box within the formula bar. */ get nameBoxWidth() { return this.i.nameBoxWidth; } set nameBoxWidth(v) { this.i.nameBoxWidth = +v; } /** * Returns or sets a value indicating how the selection is updated when interacting with the cells via the mouse or keyboard. */ get selectionMode() { return this.i.selectionMode; } set selectionMode(v) { this.i.selectionMode = v; } /** * Returns or sets an array of the Worksheets whose tabs are selected. */ get selectedWorksheets() { return this.i.selectedWorksheets; } set selectedWorksheets(v) { if (v && !Array.isArray(v) && typeof (v) == "string") { const re = /\s*(?:,|\s|$)\s*/gm; v = v.split(re); } this.i.selectedWorksheets = v; } /** * Returns or sets the UndoManager. * Note: * this property can not be set to null. */ get undoManager() { return this.i.undoManager; } set undoManager(v) { this.i.undoManager = v; } /** * Returns or sets the position of the screen tip used to display the input message for the data validation rule associated with the active cell. */ get validationInputMessagePosition() { return fromPoint(this.i.validationInputMessagePosition); } set validationInputMessagePosition(v) { this.i.validationInputMessagePosition = toPoint(v); } /** * Returns or sets the * workbook whose information is displayed in the control. */ get workbook() { return this.i.workbook; } set workbook(v) { this.i.workbook = v; } /** * Returns or sets the magnification of the selected worksheets. */ get zoomLevel() { return this.i.zoomLevel; } set zoomLevel(v) { this.i.zoomLevel = +v; } findByName(name) { if (this.findEphemera) { if (name && name.indexOf("@@e:") == 0) { return this.findEphemera(name); } } return null; } get hasUserValues() { return this._hasUserValues; } __m(propertyName) { if (!this._inStyling) { this._hasUserValues.add(propertyName); } } _styling(container, component, parent) { if (this._inStyling) { return; } this._inStyling = true; this._stylingContainer = container; this._stylingParent = component; let genericPrefix = ""; let typeName = this.i.$type.name; if (typeName.indexOf("Xam") === 0) { typeName = typeName.substring(3); } genericPrefix = toSpinal("SpreadsheetComponent"); let additionalPrefixes = []; let prefix = toSpinal(typeName); additionalPrefixes.push(prefix + "-"); let b = this.i.$type.baseType; while (b && b.name != "Object" && b.name != "Base" && b.name != "Control" && b.Name != "DependencyObject" && b.Name != "FrameworkElement") { typeName = b.name; if (typeName.indexOf("Xam") === 0) { typeName = typeName.substring(3); } let basePrefix = toSpinal(typeName); additionalPrefixes.push(basePrefix + "-"); b = b.baseType; } if (parent) { let parentTypeName = parent.i.$type.name; if (parentTypeName.indexOf("Xam") === 0) { parentTypeName = parentTypeName.substring(3); } let parentPrefix = toSpinal(parentTypeName); additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-"); additionalPrefixes.push(parentPrefix + "-" + prefix + "-"); } initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes); if (this._otherStyling) { this._otherStyling(container, component, parent); } this._inStyling = false; } /** * Notifies the spreadsheet that the container object has been resized. */ containerResized() { this.i.containerResized(); } /** * Executes the specified action. * @param action * Identifies the action to be performed. */ executeAction(action) { let iv = this.i.executeCommand(action); return (iv); } /** * Forces the spreadsheet to synchronously perform any deferred work. */ flush() { this.i.flush(); } /** * Notifies the spreadsheet that style information used for rendering may have been updated. */ styleUpdated() { this.i.styleUpdated(); } /** * Returns an object with information about the visual state of the spreadsheet. */ exportVisualData() { let iv = this.i.exportVisualData(); return (iv); } /** * Invoked when a contextmenu is being opened for the * Spreadsheet. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.menuArea" argType="string" Get the [area](ig.spreadsheet.SpreadsheetContextMenuArea) for which the menu is being displayed. */ get contextMenuOpening() { if (this._contextMenuOpening == null) { this._contextMenuOpening = new EventEmitter(); this.i.contextMenuOpening = delegateCombine(this.i.contextMenuOpening, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetContextMenuOpeningEventArgs(); outerArgs._provideImplementation(e); if (this.beforeContextMenuOpening) { this.beforeContextMenuOpening(this, outerArgs); } this._contextMenuOpening.emit({ sender: this, args: outerArgs }); }); }); } return this._contextMenuOpening; } /** * Invoked when an action is executed on the * Spreadsheet. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.action" argType="string" Gets the [action](ig.spreadsheet.SpreadsheetAction) that was executed. */ get ActionExecuted() { if (this._ActionExecuted == null) { this._ActionExecuted = new EventEmitter(); this.i.actionExecuted = delegateCombine(this.i.actionExecuted, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetActionExecutedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeActionExecuted) { this.beforeActionExecuted(this, outerArgs); } this._ActionExecuted.emit({ sender: this, args: outerArgs }); }); }); } return this._ActionExecuted; } /** * Invoked when an action is about to be executed by the * Spreadsheet. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.action" argType="string" Gets the [action](ig.spreadsheet.SpreadsheetAction) that is about to be executed. */ get ActionExecuting() { if (this._ActionExecuting == null) { this._ActionExecuting = new EventEmitter(); this.i.actionExecuting = delegateCombine(this.i.actionExecuting, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetActionExecutingEventArgs(); outerArgs._provideImplementation(e); if (this.beforeActionExecuting) { this.beforeActionExecuting(this, outerArgs); } this._ActionExecuting.emit({ sender: this, args: outerArgs }); }); }); } return this._ActionExecuting; } /** * Invoked when the * activeCell of the * Spreadsheet has changed. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.oldValue" argType="string" Gets the previous active cell. * eventArgument="ui.newValue" argType="string" Gets the current active cell. */ get activeCellChanged() { if (this._activeCellChanged == null) { this._activeCellChanged = new EventEmitter(); this.i.activeCellChanged = delegateCombine(this.i.activeCellChanged, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetActiveCellChangedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeActiveCellChanged) { this.beforeActiveCellChanged(this, outerArgs); } this._activeCellChanged.emit({ sender: this, args: outerArgs }); }); }); } return this._activeCellChanged; } /** * Invoked when the * activePane of the * Spreadsheet has changed. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.oldActivePane" argType="object" Gets the previous active [pane](ig.spreadsheet.SpreadsheetPane). * eventArgument="ui.newActivePane" argType="object" Gets the current active [pane](ig.spreadsheet.SpreadsheetPane). * eventArgument="ui.activeCell" argType="string" Gets the active cell of the new active pane or null if there is no active pane. * eventArgument="ui.visibleRange" argType="string" Gets the current visible range of the new active pane or null if there is no active pane. */ get activePaneChanged() { if (this._activePaneChanged == null) { this._activePaneChanged = new EventEmitter(); this.i.activePaneChanged = delegateCombine(this.i.activePaneChanged, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetActivePaneChangedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeActivePaneChanged) { this.beforeActivePaneChanged(this, outerArgs); } this._activePaneChanged.emit({ sender: this, args: outerArgs }); }); }); } return this._activePaneChanged; } /** * Invoked when the * activeTable of the * Spreadsheet has changed. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.oldActiveTable" argType="object" Gets the previous active [Table](ig.excel.WorksheetTable). * eventArgument="ui.newActiveTable" argType="object" Gets the current active [Table](ig.excel.WorksheetTable). */ get activeTableChanged() { if (this._activeTableChanged == null) { this._activeTableChanged = new EventEmitter(); this.i.activeTableChanged = delegateCombine(this.i.activeTableChanged, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetActiveTableChangedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeActiveTableChanged) { this.beforeActiveTableChanged(this, outerArgs); } this._activeTableChanged.emit({ sender: this, args: outerArgs }); }); }); } return this._activeTableChanged; } /** * Invoked when the * activeWorksheet of the * Spreadsheet has changed. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.oldActiveWorksheet" argType="object" Gets the previous active [worksheet](ig.excel.Worksheet). * eventArgument="ui.oldActiveWorksheetName" argType="string" Gets the name of the previous active worksheet or null if oldActiveWorksheet is null. * eventArgument="ui.newActiveWorksheet" argType="object" Gets the current active [worksheet](ig.excel.Worksheet). * eventArgument="ui.newActiveWorksheetName" argType="string" Gets the name of the new active worksheet or null if newActiveWorksheet is null. */ get activeWorksheetChanged() { if (this._activeWorksheetChanged == null) { this._activeWorksheetChanged = new EventEmitter(); this.i.activeWorksheetChanged = delegateCombine(this.i.activeWorksheetChanged, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetActiveWorksheetChangedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeActiveWorksheetChanged) { this.beforeActiveWorksheetChanged(this, outerArgs); } this._activeWorksheetChanged.emit({ sender: this, args: outerArgs }); }); }); } return this._activeWorksheetChanged; } /** * Invoked when the * Spreadsheet is about to end the in-place editing of the * activeCell. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.acceptChanges" argType="bool" Get or set a boolean indicating whether the changes will be made to the cell's value when edit mode ends. * eventArgument="ui.canCancel" argType="bool" Get a boolean indicating if the edit mode is being forced to exit edit mode in which case it cannot be cancelled. * eventArgument="ui.cell" argType="string" Gets the cell for which the control is exiting edit mode. * eventArgument="ui.editText" argType="string" Gets the edit text that will be used to update the cell(s). */ get editModeExiting() { if (this._editModeExiting == null) { this._editModeExiting = new EventEmitter(); this.i.editModeExiting = delegateCombine(this.i.editModeExiting, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetEditModeExitingEventArgs(); outerArgs._provideImplementation(e); if (this.beforeEditModeExiting) { this.beforeEditModeExiting(this, outerArgs); } this._editModeExiting.emit({ sender: this, args: outerArgs }); }); }); } return this._editModeExiting; } /** * Invoked when the * Spreadsheet has ended the in-place editing of the * activeCell. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.cell" argType="string" Gets the cell for which the control has exited edit mode. */ get editModeExited() { if (this._editModeExited == null) { this._editModeExited = new EventEmitter(); this.i.editModeExited = delegateCombine(this.i.editModeExited, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetEditModeExitedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeEditModeExited) { this.beforeEditModeExited(this, outerArgs); } this._editModeExited.emit({ sender: this, args: outerArgs }); }); }); } return this._editModeExited; } /** * Invoked when the * Spreadsheet is about to start in-place editing of the * activeCell. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.cell" argType="string" Gets the cell for which the control is going into edit mode. */ get editModeEntering() { if (this._editModeEntering == null) { this._editModeEntering = new EventEmitter(); this.i.editModeEntering = delegateCombine(this.i.editModeEntering, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetEditModeEnteringEventArgs(); outerArgs._provideImplementation(e); if (this.beforeEditModeEntering) { this.beforeEditModeEntering(this, outerArgs); } this._editModeEntering.emit({ sender: this, args: outerArgs }); }); }); } return this._editModeEntering; } /** * Invoked when the * Spreadsheet has started in-place editing of the * activeCell. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.cell" argType="string" Gets the cell for which the control has entered edit mode. */ get editModeEntered() { if (this._editModeEntered == null) { this._editModeEntered = new EventEmitter(); this.i.editModeEntered = delegateCombine(this.i.editModeEntered, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetEditModeEnteredEventArgs(); outerArgs._provideImplementation(e); if (this.beforeEditModeEntered) { this.beforeEditModeEntered(this, outerArgs); } this._editModeEntered.emit({ sender: this, args: outerArgs }); }); }); } return this._editModeEntered; } /** * Invoked when the * Spreadsheet is exiting edit mode and the new value for the * activeCell is not valid based on the criteria of that cell's * ig.excel.DataValidationRule. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.action" argType="string" Get or set the [action](ig.spreadsheet.SpreadsheetEditModeValidationErrorAction) to take in response to the failed validation. * eventArgument="ui.canStayInEditMode" argType="bool" Get a boolean indicating whether the cell is allowed to stay in edit mode. * eventArgument="ui.cell" argType="string" Gets the cell for which the control is in edit mode. * eventArgument="ui.validationRule" argType="string" Get the [rule](ig.excel.DataValidationRule) which failed validation. * The EditModeValidationError is raised while exiting edit mode if the new value for the * activeCell is not valid based on the criteria of that cell's * ig.excel.DataValidationRule. * Since the rule needs to evaluate the value of the cell and potentially other cell's in the Worksheet, the value is first applied to the cell(s) and then is validated. By default if the event is not handled and the * showErrorMessageForInvalidValue is true, a message box will be displayed to the end user to determine what action to take. One can handle this event and specify the action that should * be taken using the action. * Note: * The validation rule will not be evaluated if edit mode is being cancelled such as when the user presses Escape to cancel edit. * Note: * The action will default to * AcceptChange * if the ShowErrorMessageForInvalidValue of the validationRule is false; otherwise it will default to * ShowPrompt * . * Note: * Like Microsoft Excel, only the validation rule of the active cell is considered even if the update is affecting other cells in the selection. */ get editModeValidationError() { if (this._editModeValidationError == null) { this._editModeValidationError = new EventEmitter(); this.i.editModeValidationError = delegateCombine(this.i.editModeValidationError, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetEditModeValidationErrorEventArgs(); outerArgs._provideImplementation(e); if (this.beforeEditModeValidationError) { this.beforeEditModeValidationError(this, outerArgs); } this._editModeValidationError.emit({ sender: this, args: outerArgs }); }); }); } return this._editModeValidationError; } /** * Invoked when the * Spreadsheet is performing an operation on a protected Worksheet and there is a single range that may be unlocked to allow the operation to be performed. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.ranges" argType="array" Get an array of [protected range](ig.excel.WorksheetProtectedRange) objects that should be unlocked. * eventArgument="ui.unprotect" argType="object" Get a parameterless function that may be invoked to unlock the associated ranges. */ get editRangePasswordNeeded() { if (this._editRangePasswordNeeded == null) { this._editRangePasswordNeeded = new EventEmitter(); this.i.editRangePasswordNeeded = delegateCombine(this.i.editRangePasswordNeeded, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetEditRangePasswordNeededEventArgs(); outerArgs._provideImplementation(e); if (this.beforeEditRangePasswordNeeded) { this.beforeEditRangePasswordNeeded(this, outerArgs); } this._editRangePasswordNeeded.emit({ sender: this, args: outerArgs }); }); }); } return this._editRangePasswordNeeded; } /** * Invoked when a hyperlink is being followed in the * Spreadsheet. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.hyperlink" argType="object" Get the [hyperlink](ig.excel.WorksheetHyperlink) to be executed. */ get hyperlinkExecuting() { if (this._hyperlinkExecuting == null) { this._hyperlinkExecuting = new EventEmitter(); this.i.hyperlinkExecuting = delegateCombine(this.i.hyperlinkExecuting, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetHyperlinkExecutingEventArgs(); outerArgs._provideImplementation(e); if (this.beforeHyperlinkExecuting) { this.beforeHyperlinkExecuting(this, outerArgs); } this._hyperlinkExecuting.emit({ sender: this, args: outerArgs }); }); }); } return this._hyperlinkExecuting; } /** * Invoked when the selection for a * ig.spreadsheet.SpreadsheetPane of the * Spreadsheet is changed. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.pane" argType="object" Get the [pane](ig.spreadsheet.SpreadsheetPane) for which the selection has changed. */ get selectionChanged() { if (this._selectionChanged == null) { this._selectionChanged = new EventEmitter(); this.i.selectionChanged = delegateCombine(this.i.selectionChanged, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetSelectionChangedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeSelectionChanged) { this.beforeSelectionChanged(this, outerArgs); } this._selectionChanged.emit({ sender: this, args: outerArgs }); }); }); } return this._selectionChanged; } /** * Invoked when the user will be prompted with a message regarding an operation that is being performed. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * eventArgument="ui.canCancel" argType="bool" Get a boolean indicating if the operation that triggered the prompt can be cancelled. * eventArgument="ui.displayMessage" argType="bool" Get a boolean indicating if a message will be displayed to the end user. * eventArgument="ui.exception" argType="object" Gets the exception for the error, if there was one. * eventArgument="ui.message" argType="string" Get or set the message that will be displayed. * eventArgument="ui.trigger" argType="string" Get the [action](ig.spreadsheet.SpreadsheetUserPromptTrigger) that caused the prompt to be displayed. */ get userPromptDisplaying() { if (this._userPromptDisplaying == null) { this._userPromptDisplaying = new EventEmitter(); this.i.userPromptDisplaying = delegateCombine(this.i.userPromptDisplaying, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetUserPromptDisplayingEventArgs(); outerArgs._provideImplementation(e); if (this.beforeUserPromptDisplaying) { this.beforeUserPromptDisplaying(this, outerArgs); } this._userPromptDisplaying.emit({ sender: this, args: outerArgs }); }); }); } return this._userPromptDisplaying; } /** * Invoked when a change has been made to the * workbook that might require a save. * eventArgument="evt" argType="event" jQuery event object. * eventArgument="ui.owner" argType="object" Gets a reference to the spreadsheet widget. * Note: * This event is invoked asynchronously with regards to the change(s) that * have occurred. Also some changes alone are not considered to dirty the Workbook even though it * does change state on the Workbook or one of its subobjects. An example of that would be a zoom * type operation (e.g. changing the * magnificationInNormalView). */ get workbookDirtied() { if (this._workbookDirtied == null) { this._workbookDirtied = new EventEmitter(); this.i.workbookDirtied = delegateCombine(this.i.workbookDirtied, (o, e) => { this._runInZone(() => { let outerArgs = new IgxSpreadsheetWorkbookDirtiedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeWorkbookDirtied) { this.beforeWorkbookDirtied(this, outerArgs); } this._workbookDirtied.emit({ sender: this, args: outerArgs }); }); }); }