@finos/legend-data-cube
Version:
95 lines • 5.61 kB
TypeScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DataCubeConfiguration } from '../../core/model/DataCubeConfiguration.js';
import { type DataCubeSnapshot, type DataCubeSnapshotSortColumn } from '../../core/DataCubeSnapshot.js';
import { type DataCubeColumn } from '../../core/model/DataCubeColumn.js';
import { DataCubeSnapshotController } from '../../services/DataCubeSnapshotService.js';
import { type DataCubeColumnPinPlacement, DataCubeQuerySortDirection } from '../../core/DataCubeQueryEngine.js';
import type { DefaultMenuItem, GetContextMenuItemsParams, GetMainMenuItemsParams, MenuItemDef } from 'ag-grid-community';
import type { DataCubeViewState } from '../DataCubeViewState.js';
import { type DataCubeFilterEditorConditionTreeNode, type DataCubeFilterEditorTree } from '../../core/filter/DataCubeQueryFilterEditorState.js';
/**
* This query editor state is responsible for capturing updates to the data cube query
* caused by interactions with the grid which are either not captured by the server-side row model
* datasource, e.g. column pinning, column visibility changes, etc or done programatically via grid
* context menu. Think of this as a companion state for grid editor which bridges the gap between
* ag-grid state and data cube query state.
*
* More technically, this handles interactions that result in instant (not batched) change to the query.
* For example, in the editor, users can make changes to multiple parts of the query, but until they are
* explicit applied, these changes will not impact the query; whereas here a change immediately take effect.
*
* NOTE: since typically, each grid action causes a new snapshot to be created,
* we MUST NEVER use the editor here, as it could potentially create illegal state
* while the editor is still in the middle of a modification that has not been applied.
*/
export declare class DataCubeGridControllerState extends DataCubeSnapshotController {
readonly view: DataCubeViewState;
constructor(view: DataCubeViewState);
configuration: DataCubeConfiguration;
menuBuilder?: ((params: GetContextMenuItemsParams<unknown, {
view: DataCubeViewState;
}> | GetMainMenuItemsParams<unknown, {
view: DataCubeViewState;
}>, fromHeader: boolean) => (DefaultMenuItem | MenuItemDef)[]) | undefined;
getColumnConfiguration(colName: string | undefined): import("../../core/model/DataCubeConfiguration.js").DataCubeColumnConfiguration | undefined;
filterTree: DataCubeFilterEditorTree;
/**
* Add a new filter condition to the root of the filter tree.
* 1. If the root is empty, add a new AND group with the condition as the root
* 2. If the root is an AND group, add the condition to the root
* 3. If the root is an OR group, create a new AND group with the condition and
* wrapping the current root and set that as the new root
*/
addNewFilterCondition(condition: DataCubeFilterEditorConditionTreeNode): void;
clearFilters(): void;
selectColumns: DataCubeColumn[];
leafExtendedColumns: DataCubeColumn[];
groupExtendedColumns: DataCubeColumn[];
pinColumn(colName: string | undefined, placement: DataCubeColumnPinPlacement | undefined): void;
rearrangeColumns(columns: string[]): void;
removeAllPins(): void;
showColumn(colName: string | undefined, isVisible: boolean): void;
horizontalPivotColumns: DataCubeColumn[];
horizontalPivotCastColumns: DataCubeColumn[];
private get horizontalPivotResultColumns();
getHorizontalPivotableColumn(colName: string): import("../../core/model/DataCubeConfiguration.js").DataCubeColumnConfiguration | undefined;
setHorizontalPivotOnColumn(colName: string): void;
addHorizontalPivotOnColumn(colName: string): void;
clearAllHorizontalPivots(): void;
excludeColumnFromHorizontalPivot(colName: string): void;
includeColumnInHorizontalPivot(colName: string): void;
verticalPivotColumns: DataCubeColumn[];
getVerticalPivotableColumn(colName: string): import("../../core/model/DataCubeConfiguration.js").DataCubeColumnConfiguration | undefined;
setVerticalPivotOnColumn(colName: string): void;
addVerticalPivotOnColumn(colName: string): void;
removeVerticalPivotOnColumn(colName: string): void;
clearAllVerticalPivots(): void;
collapseAllPaths(): void;
expandPath(path: string): void;
collapsePath(path: string): void;
sortColumns: DataCubeSnapshotSortColumn[];
getSortableColumn(colName: string | undefined): DataCubeColumn | undefined;
setSortByColumn(colName: string, direction: DataCubeQuerySortDirection): void;
addSortByColumn(colName: string, direction: DataCubeQuerySortDirection): void;
clearSortByColumn(colName: string): void;
clearAllSorts(): void;
getSnapshotSubscriberName(): string;
applySnapshot(snapshot: DataCubeSnapshot, previousSnapshot: DataCubeSnapshot | undefined): Promise<void>;
private propagateChanges;
private applyChanges;
}
//# sourceMappingURL=DataCubeGridControllerState.d.ts.map