import { DataVariable, GraphicVariable, RecordSet } from '@dvl-fw/core'; import { Store } from '@ngrx/store'; import { Operator } from '@ngx-dino/core'; import { Observable } from 'rxjs'; import { ApplicationState } from '../../shared/store'; /** * Data source interface */ export interface DataSource { id: string; label: string; description?: string; parent: RecordSet; children: DataSource[]; childrenHidden: boolean; columns: DataVariable[]; data: Observable; operator: Operator; level: number; hidden: boolean; hiddenData: boolean; numRows: number; streamId: string; } export declare class DataService { private store; /** * Behavior subject to emit an updated data source */ private dataSourcesChange; /** * Allowed label size in the table cells (after which the label is truncated and an ellipsis is added) */ maxCellStringLength: number; /** * Observable from the dataSourcesChange BehaviorSubject to emit an updated data-source */ dataSourcesChanged: Observable; /** * Data sources array to hold all data sources */ dataSources: DataSource[]; /** * Creates an instance of data service. * @param store instance of Store which provides access to the ApplicationState */ constructor(store: Store); private updateData; /** * Gets a flat array of data sources * @param dataSources array of data-sources * @returns flat array of data sources */ getFlatArrayOfDataSources(dataSources: DataSource[]): DataSource[]; /** * Constructs a hierarchy of data-sources * @param dataSources array of data-sources * @param id id of data-source * @param level level of hierarchy * @returns an array of data-sources with hierarchical information */ getChildrenForRecord(dataSources: DataSource[], id: string, level: number): DataSource[]; /** * Gets data sources with info on their children * @param dataSources array of data-sources * @param level level of hierarchy in the hierarchy of data-sources * @returns array of data-sources with their children information */ getDataSourceWithChildren(dataSources: DataSource[], level: number): DataSource[]; /** * Toggles the children of a data source * @param children array of children data-sources */ toggleChildren(children: DataSource[]): void; /** * Toggles the data table * @param dataSource the data-source associated with the data-table */ toggleDataTable(dataSource: DataSource): void; /** * Function that adds display variables to be used in the table. * This includes the value to display in the cell and the value to * display in the tooltip (if any). * @param item the source data to display in the table * @returns a new item with additional display variables */ private injectDisplayVariables; /** * Gets data mapping operator * @param dataVariables array of data-variables * @param graphicVariables array of graphic-variables * @param recordSetId record-set-id associated with * @returns data variable to graphic variable mapping operator */ getDataMappingOperator(dataVariables: DataVariable[], graphicVariables: GraphicVariable[], recordSetId: string): Operator; }