import { DataModel } from '@lumino/datagrid'; import { DataSource } from '../datasource'; /** * A View implementation for immutable in-memory JSON data. * * Note: Most of this is just repurposed from JSONModel, and can likely be * streamlined quite a bit. */ export declare class View { /** * Create a view with static JSON data. * * @param datasource - The datasource for initializing the view. */ constructor(datasource: DataSource | Readonly); /** * Get the row count for a region in the view. * * @param region - The row region of interest. * * @returns - The row count for the region. */ rowCount(region: DataModel.RowRegion): number; /** * Get the column count for a region in the view. * * @param region - The column region of interest. * * @returns - The column count for the region. */ columnCount(region: DataModel.ColumnRegion): number; /** * Get the metadata for a column in the view. * * @param region - The cell region of interest. * * @param column - The index of the column of interest. * * @returns The metadata for the column. */ metadata(region: DataModel.CellRegion, row: number, column: number): DataModel.Metadata; /** * Get the data value for a cell in the view. * * @param region - The cell region of interest. * * @param row - The row index of the cell of interest. * * @param column - The column index of the cell of interest. * * @param returns - The data value for the specified cell. * * #### Notes * A `missingValue` as defined by the schema is converted to `null`. */ data(region: DataModel.CellRegion, row: number, column: number): any; /** * Returns a reference to the dataset from this View. */ get dataset(): DataSource | Readonly; /** * Returns the index in the schema that relates to the index by region. * * @param region - The `CellRegion` of interest. * * @param index - The column index to look up. */ getSchemaIndex(region: DataModel.CellRegion, index: number): number; /** * Returns a Promise that resolves to an array of unique values contained in * the provided column index. * * @param column - The column to retrieve unique values for. */ uniqueValues(region: DataModel.CellRegion, column: string): any[]; protected readonly _data: DataSource | Readonly; protected readonly _bodyFields: DataSource.IField[]; protected readonly _headerFields: DataSource.IField[]; protected readonly _missingValues: Private.MissingValuesMap | null; } /** * The namespace for the `View` class statics. */ export declare namespace View { /** * An options object for initializing a view. */ interface IOptions { /** * The data source for the view. * * The data model takes full ownership of the data source. */ data: DataSource; } } /** * The namespace for the module implementation details. */ declare namespace Private { /** * An object which holds the results of splitting schema fields. */ interface ISplitFieldsResult { /** * The non-primary key fields to use for the grid body. */ bodyFields: DataSource.IField[]; /** * The primary key fields to use for the grid headers. */ headerFields: DataSource.IField[]; } /** * Split the schema fields into header and body fields. */ function splitFields(schema: DataSource.ISchema): ISplitFieldsResult; /** * A type alias for a missing value map. */ type MissingValuesMap = { [key: string]: boolean; }; /** * Create a missing values map for a schema. * * This returns `null` if there are no missing values. */ function createMissingMap(schema: DataSource.ISchema): MissingValuesMap | null; } export {};