UNPKG

ag-grid-enterprise

Version:

Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue

120 lines (119 loc) • 6.83 kB
import type { AgColumn, CalculatedExpressionError, ColumnEventType, ColumnState, ColumnTreeBuild, HeaderPosition, ICalculatedColumnsService, NamedBean, RefreshCalculatedColumnsParams } from 'ag-grid-community'; import { BeanStub } from 'ag-grid-community'; type CalculatedColumnDialogRestoreFocusParams = { eventSource?: HTMLElement; headerPosition: HeaderPosition | null; }; export declare class CalculatedColumnsService extends BeanStub implements NamedBean, ICalculatedColumnsService { readonly beanName: "calculatedColsSvc"; /** Dynamic calc cols (API/dialog added), keyed by colId. Insertion order = tree append order. */ private readonly dynamicColumns; /** Added cols parked by `resetColumnState` so a later `applyColumnState` can restore them, by colId. */ private readonly inactiveDynamicColumns; /** Highest `calculated_N` index handed out to this grid, so {@link createUniqueColId} never reuses one. */ private lastCalculatedColIndex; private validationStatesByColId; private validationStatesInitialised; private lifecycleInitialised; private knownCalculatedColumns; private suppressValidationChecks; private readonly openDialogsByColId; private readonly liveCreationColumnIds; private readonly pendingLiveApplyUpdatesByColId; private readonly formulaErrorsByExpression; private userColumnSvc; postConstruct(): void; isEnabled(): boolean; getExpressionError(column: AgColumn): CalculatedExpressionError | undefined; refreshCalculatedColumns(params?: RefreshCalculatedColumnsParams): void; /** The column's definition as the user authored it. The dialog, the reference mapper, saved validation errors and * the created/changed/removed events all read this, so `processColDef` output never shows as, or hides, a user * edit. Validation state events read the built expression instead, as that is the one the grid evaluates. */ private getResolvedAuthoredColDef; isHighlightedColumn(column: AgColumn | null): boolean; private refreshCalculatedColumnHighlight; private refreshOpenDialogHighlights; private updateCalculatedColumn; private getFormulaError; private getFormulaExpressionError; /** `hasCol` defaults to the built columns; a build in progress passes its own, as `colsById` is only seeded * once the build finishes. */ private getInvalidColumnReference; openCalculatedColumnDialog(column: AgColumn | null | undefined, mode: 'add' | 'edit', focus?: boolean, restoreFocusParams?: CalculatedColumnDialogRestoreFocusParams): void; private addDynamicCalculatedColumn; removeCalculatedColumn(column: AgColumn | null | undefined): void; /** Records a created (API/dialog-added) calc col in the user-column layer. */ private recordCreatedColumn; private isLiveApplyMode; private getOptions; /** Records the user's changes to a `columnDefs`-declared calc col in the user-column layer. Properties * put back to the declared value are dropped, so reverting an edit persists nothing. */ private setDeclaredColOverride; contributeTo(build: ColumnTreeBuild): void; /** `colsById` is seeded after the build, so `processColDef` resolves columns against the ones built so far, the * auto group columns the incoming grouping keeps, and the dynamic columns spliced in alongside them. */ private createColDefProcessor; /** Row grouping is extracted from the build after `contributeTo`, and auto group columns are refreshed after that, * so `autoColSvc.columns` still holds the previous build's. Keep those the incoming grouping does not remove. * Dynamic columns are not in `builtColumns` yet, so their previous build's instances stand in for them. */ private getKeptAutoCols; private clearDynamicColumnInstances; resetDynamicColumnDefs(preserveCreatedColumns?: boolean): boolean; /** Takes ownership of restored user-column entries that describe calculated columns, so the dialog, * removal and event paths treat them exactly like ones added in this session. Entries the layer no * longer holds take their columns with them. */ adoptUserColumns(): boolean; /** A leaf in `groupId` to append a restored column after, so it is built into that group. Only columns * that survive the coming rebuild qualify: `colDefList` still holds the ones this restore dropped, and * anchoring to one of those would strand the new column at the top level. */ private findAnchorInGroup; restoreDynamicColumnDefs(state: ColumnState[]): boolean; private getOrCreateColumn; /** Applies `calculatedColumns.processColDef` to a dialog-created column's stored colDef. The result becomes the * column's own colDef (`userProvidedColDef`) on purpose, so data type and show-values-as reads see it; the * stored colDef is left untouched so the dialog and grid state only ever see the user's values. */ private processUserColDef; /** Rebuild the column tree for a calc-col mutation. Suppresses lifecycle/validation dispatch during the * rebuild so the imperative caller (or column-state op) emits its own events, not duplicates. */ refreshDynamicColumns(source: ColumnEventType): void; private createUniqueColId; private getUpdatedCalculatedColDef; private createDialogContext; private validateDialogDraft; private normaliseValidationErrors; private inspectDialogExpression; private showDialog; private refreshDialogValidation; private restoreFocusOnDialogClose; private scheduleLiveApplyUpdate; private getLiveApplyColDef; private flushLiveApplyUpdate; private cancelLiveApplyUpdate; private closeCalculatedColumnDialog; private finishLiveCreation; private getDefaultDraft; private getDataTypeOptions; private getValidConfiguredDataTypes; private getDataTypeDisplayName; private formatDataTypeName; private getExpressionPickers; private toDraft; /** The authored title: a `headerValueGetter` or `processColDef` name shown here would be saved back as the title. */ private getDraftHeaderName; private focusCalculatedColumn; private toColDef; private getExpressionValidationState; private getExpressionValidation; private forEachCalculatedColumn; /** Dialog/state rebuilds silently update the baseline so later declarative loads do not replay their changes. */ private checkColumnLifecycle; private dispatchChangedEvents; private checkValidationStates; private getEventCommonParams; private dispatchCreatedOrRemovedEvent; private dispatchExpressionChangedEvent; private dispatchValidationStateChangedEvent; private getFunctionSuggestions; private refreshCalculatedColumn; } export {};