import { Selection as MosaicSelection } from '@uwdata/mosaic-core'; import { Cosmograph, CosmographData } from "../../cosmograph"; import { ICosmographInternalApi } from "../../cosmograph/internal"; import { FilteringClient } from "../../cosmograph/crossfilter/filtering-client"; export interface SelectionComponentConfig { useLinksData?: boolean; useQuantiles?: boolean; accessor?: string; disableStateMessages?: boolean; noDataMessage?: string | false; loadingMessage?: string | false; preserveSelectionOnUnmount?: boolean; id?: string; initialSelection?: unknown; } export interface SelectionUIComponent { setLoadingState?: () => void; setConfig: (config: TConfig) => void; destroy: () => void; } /** * Abstract class for data selection components in Cosmograph. * Provides common functionality for data filtering and UI component updates. */ export declare abstract class CosmographSelectionComponent> { private _dataUpdatedHandler; private _dataFilteredHandler; private _resetSelectionsHandler; protected _internalApi: ICosmographInternalApi; protected _isValidAccessor: boolean; protected _currentData?: CosmographData; protected _client?: FilteringClient; protected _uiComponent: TUIComponent; protected _config: TConfig; protected _targetElement: HTMLElement; private _abortController; private _readyPromise; private _isInitialLoad; /** * Constructs a filtering component that connects Cosmograph data to a UI component. * * @param cosmograph - The Cosmograph instance to connect to * @param targetElement - HTML element for rendering the UI component * @param config - Configuration for the filtering component */ constructor(cosmograph: Cosmograph, targetElement: HTMLElement, config: TConfig); protected abstract get defaultConfig(): TConfig; protected abstract get accessor(): string | undefined; protected abstract createUIComponent(targetElement: HTMLElement): TUIComponent; protected abstract createComponentConfig(config: Partial): TConfig; protected abstract onConfigUpdate(_oldConfig?: TConfig): Promise; protected abstract onDataFiltered(): void; protected onInitialize(): void; protected onResetClientSelections(): void; protected getCurrentData(): Promise | null; protected shouldUpdateComponentData(): Promise; /** * Determines if the component operates on links data instead of points data */ protected get useLinksData(): boolean; /** * Gets the accessors for point data */ protected get pointAccessors(): string[]; /** * Gets the accessors for link data */ protected get linkAccessors(): string[]; /** * Gets the current selection based on whether links or points data is being used */ protected get selection(): MosaicSelection; /** * Gets the name of the table being filtered */ protected get tableName(): string; private _initialize; private _getGlobalDisplayStateSettings; setConfig(config: Partial): Promise; protected fetchData(): Promise; /** * Returns a promise that resolves when the component has finished its asynchronous * initialization sequence. */ protected ready(): Promise; protected checkReady(fn: () => any): boolean; private _createClient; private _handleSelectionUpdate; private _onResetSelections; private _mergeWithDefaultConfig; /** * Removes the component and cleans up event listeners */ remove(): void; }