UNPKG

ag-charts-community

Version:

Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue

62 lines (61 loc) 2.69 kB
import { type DynamicContext } from 'ag-charts-core'; import type { TextOrSegments } from 'ag-charts-types'; import type { ChartRegistry } from '../../module/moduleContext'; import type { Node } from '../../scene/node'; import type { Selection } from '../../scene/selection'; import type { SwitchWidget } from '../../widget/switchWidget'; import type { MouseWidgetEvent } from '../../widget/widgetEvents'; import type { Page } from '../gridLayout'; import type { Pagination } from '../pagination/pagination'; import type { CategoryLegendDatum } from './legendDatum'; import type { LegendMarkerLabel } from './legendMarkerLabel'; type ItemSelection = Selection<CategoryLegendDatum, LegendMarkerLabel>; type CategoryLegendDatumReader = { getItemLabel(datum: CategoryLegendDatum): TextOrSegments | undefined; }; interface ButtonListener { onClick(event: Event, datum: CategoryLegendDatum, proxyButton: SwitchWidget): void; onDoubleClick(event: Event, datum: CategoryLegendDatum): void; onHover(event: FocusEvent | MouseEvent, node: LegendMarkerLabel): void; onLeave(): void; onContextClick(widgetEvent: MouseWidgetEvent<'contextmenu'>, node: LegendMarkerLabel): void; } interface LegendDOMProxyUpdateParams { visible: boolean; interactive: boolean; ctx: Pick<ChartRegistry, 'proxyInteractionService' | 'localeManager'>; itemSelection: ItemSelection; group: Node; pagination: Pagination; oldPages: Page[] | undefined; newPages: Page[]; datumReader: CategoryLegendDatumReader; itemListener: ButtonListener; } type LegendDOMProxyPageChangeParams = Pick<LegendDOMProxyUpdateParams, 'itemSelection' | 'group' | 'pagination' | 'interactive'>; export declare class LegendDOMProxy { private readonly ctx; private dirty; private readonly itemList; private readonly itemDescription; private readonly paginationGroup; private prevButton?; private nextButton?; private shouldApplyHoverOnFocus; constructor(ctx: DynamicContext<ChartRegistry>, idPrefix: string); private initLegendList; update(params: LegendDOMProxyUpdateParams): void; private syncItemLabels; private updateVisibility; private updateItemProxyButtons; private updatePaginationProxyButtons; private createPaginationButtons; private destroyPaginationButtons; private onPageButton; onDataUpdate(oldData: CategoryLegendDatum[], newData: CategoryLegendDatum[]): void; onLocaleChanged(itemSelection: ItemSelection, datumReader: CategoryLegendDatumReader): void; onPageChange(params: LegendDOMProxyPageChangeParams): void; private getItemAriaText; private getItemAriaDescription; } export {};