import { RGBColor } from 'reducers/types'; import { Layer } from 'layers'; import { FieldDomain, Filter } from 'reducers/vis-state-updaters'; import { DataContainerInterface } from './data-container-interface'; import { ProtoDataset } from 'actions'; export type Field = { analyzerType: string; id?: string; name: string; displayName: string; format: string; type: string; fieldIdx: number; valueAccessor(v: { index: number; }): any; filterProps?: any; metadata?: any; }; export type GpuFilter = { filterRange: number[][]; filterValueUpdateTriggers: any; filterValueAccessor: (dc: DataContainerInterface) => (getIndex?: (any: any) => number, getData?: (dc: DataContainerInterface, d: any, fieldIndex: number) => any) => (d: any) => number; }; export type FieldPair = { defaultName: string; pair: { [key: string]: { fieldIdx: number; value: string; }; }; suffix: string[]; }; export type FilterRecord = { dynamicDomain: Filter[]; fixedDomain: Filter[]; cpu: Filter[]; gpu: Filter[]; }; export type FilterDatasetOpt = { cpuOnly?: boolean; ignoreDomain?: boolean; }; declare class KeplerTable { readonly id: string; type?: string; label: string; color: RGBColor; fields: Field[]; dataContainer: DataContainerInterface; allIndexes: number[]; filteredIndex: number[]; filteredIdxCPU?: number[]; filteredIndexForDomain: number[]; fieldPairs: FieldPair[]; gpuFilter: GpuFilter; filterRecord?: FilterRecord; filterRecordCPU?: FilterRecord; changedFilters?: any; sortColumn?: { [key: string]: string; }; sortOrder?: number[] | null; pinnedColumns?: string[]; supportedFilterTypes: string[] | undefined; metadata: object; constructor({ info, data, color, metadata, supportedFilterTypes }: { info?: ProtoDataset['info']; data: ProtoDataset['data']; color: RGBColor; metadata?: ProtoDataset['metadata']; supportedFilterTypes?: ProtoDataset['supportedFilterTypes']; }); /** * Get field * @param columnName */ getColumnField(columnName: string): Field | undefined; /** * Get fieldIdx * @param columnName */ getColumnFieldIdx(columnName: string): number; /** * Get the value of a cell */ getValue(columnName: string, rowIdx: number): any; /** * Updates existing field with a new object * @param fieldIdx * @param newField */ updateColumnField(fieldIdx: number, newField: Field): void; /** * Update dataset color by custom color * @param newColor */ updateTableColor(newColor: RGBColor): void; /** * Save filterProps to field and retrieve it * @param columnName */ getColumnFilterProps(columnName: string): Field['filterProps'] | null | undefined; /** * Apply filters to dataset, return the filtered dataset with updated `gpuFilter`, `filterRecord`, `filteredIndex`, `filteredIndexForDomain` * @param filters * @param layers * @param opt */ filterTable(filters: Filter[], layers: Layer[], opt?: FilterDatasetOpt): KeplerTable; /** * Apply filters to a dataset all on CPU, assign to `filteredIdxCPU`, `filterRecordCPU` * @param filters * @param layers */ filterTableCPU(filters: Filter[], layers: Layer[]): KeplerTable; /** * Calculate field domain based on field type and data * for Filter */ getColumnFilterDomain(field: Field): FieldDomain; /** * Get the domain of this column based on scale type */ getColumnLayerDomain(field: Field, scaleType: string): number[] | string[] | [number, number] | null; calculateLegend(leftField: any, rightField: any): { label: any; color: any; }[]; /** * Get a sample of rows to calculate layer boundaries */ /** * Parse cell value based on column type and return a string representation * Value the field value, type the field type */ /** * Assert whether field exist * @param fieldName * @param condition */ _assetField(fieldName: string, condition: any): void; } export declare function removeSuffixAndDelimiters(layerName: any, suffix: any): any; /** * Find point fields pairs from fields * * @param fields * @returns found point fields */ export declare function findPointFieldPairs(fields: Field[]): FieldPair[]; /** * * @param dataset * @param column * @param mode * @type */ export declare function sortDatasetByColumn(dataset: KeplerTable, column: string, mode?: string): KeplerTable; export declare function pinTableColumns(dataset: KeplerTable, column: string): KeplerTable; export declare function copyTable(original: T): T; /** * @type * @returns */ export declare function copyTableAndUpdate(original: T, options?: Partial): T; export default KeplerTable;