UNPKG

ag-charts-community

Version:

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

104 lines (103 loc) 3.5 kB
import { type BaseStyleTypeMap, type DynamicContext, type ElementID } from 'ag-charts-core'; import type { Direction } from 'ag-charts-types'; import type { ChartRegistry } from '../module/moduleContext'; import { BoundedTextWidget } from '../widget/boundedTextWidget'; import { ButtonWidget } from '../widget/buttonWidget'; import { GroupWidget } from '../widget/groupWidget'; import { ListWidget } from '../widget/listWidget'; import { NativeWidget } from '../widget/nativeWidget'; import { SliderWidget } from '../widget/sliderWidget'; import { SwitchWidget } from '../widget/switchWidget'; import { ToolbarWidget } from '../widget/toolbarWidget'; type ParentProperties<T = NativeWidget<HTMLDivElement>> = { readonly parent: T; } | { readonly domManagerId: string; readonly where: 'beforebegin' | 'afterend'; }; type ElemParams<T extends ProxyElementType> = { readonly type: T; readonly cursor?: BaseStyleTypeMap['cursor']; readonly classList?: string[]; }; type InteractParams<T extends ProxyElementType> = ElemParams<T> & { readonly tabIndex?: number; readonly domIndex?: number; }; type TranslationKey = { id: string; params?: Record<string, any>; }; type ContainerParams<T extends ProxyContainerType> = { readonly type: T; readonly domManagerId: string; readonly classList: string[]; readonly ariaLabel: TranslationKey | undefined; readonly role?: string; }; type ProxyMeta = { button: { params: ParentProperties<GroupWidget> & InteractParams<'button'> & { readonly textContent: string | TranslationKey; }; result: ButtonWidget; }; slider: { params: ParentProperties<ToolbarWidget | GroupWidget> & InteractParams<'slider'> & { readonly ariaLabel: TranslationKey; readonly role?: string; }; result: SliderWidget; }; text: { params: ParentProperties & ElemParams<'text'>; result: BoundedTextWidget; }; listswitch: { params: ParentProperties<ListWidget> & InteractParams<'listswitch'> & { readonly textContent: string; readonly ariaChecked: boolean; readonly ariaDescribedBy: ElementID; }; result: SwitchWidget; }; region: { params: ParentProperties<GroupWidget> & ElemParams<'region'> & { readonly role?: string; }; result: NativeWidget<HTMLDivElement>; }; toolbar: { params: ContainerParams<'toolbar'> & { readonly orientation: Direction; }; result: ToolbarWidget; }; group: { params: ContainerParams<'group'>; result: GroupWidget; }; list: { params: ContainerParams<'list'>; result: ListWidget; }; }; type ProxyElementType = 'button' | 'slider' | 'text' | 'listswitch' | 'region'; type ProxyContainerType = 'toolbar' | 'group' | 'list'; export declare class ProxyInteractionService { private readonly ctx; private readonly cleanup; constructor(ctx: DynamicContext<ChartRegistry>); destroy(): void; private addLocalisation; createProxyContainer<T extends ProxyContainerType>(args: { type: T; } & ProxyMeta[T]['params']): ProxyMeta[T]['result']; createProxyElement<T extends ProxyElementType>(args: { type: T; } & ProxyMeta[T]['params']): ProxyMeta[T]['result']; private initElement; private initInteract; private setParent; } export {};