import type { LegendTitle } from '@visactor/vrender-components'; import type { Datum, IOrientType, IPadding, IRectMarkSpec, ISymbolMarkSpec, ITextMarkSpec, StringOrNumber } from '../../typings'; import type { IComponent } from '../interface'; import type { IComponentSpec } from '../base/interface'; import type { IDiscreteLegendSpec } from './discrete/interface'; import type { IColorLegendSpec, ISizeLegendSpec } from './continuous/interface'; export type ILegend = IComponent & { getLegendData: () => Datum[]; getSelectedData: () => StringOrNumber[]; setSelectedData: (d: StringOrNumber[]) => void; }; export interface IDiscreteLegend extends ILegend { getLegendDefaultData: (originalData?: boolean) => StringOrNumber[]; } export type NoVisibleMarkStyle = Omit; export type ITitle = { textStyle?: NoVisibleMarkStyle; style?: NoVisibleMarkStyle; shape?: { visible?: boolean; space?: number; style?: NoVisibleMarkStyle; }; background?: { visible?: boolean; style?: Omit, 'visible' | 'width' | 'height'>; }; } & Omit; export type ILegendCommonSpec = { visible?: boolean; orient?: IOrientType; position?: 'start' | 'middle' | 'end'; layout?: 'horizontal' | 'vertical'; filter?: boolean; customFilter?: (data: any, selectedRange: StringOrNumber[], datumField: string) => any; title?: ITitle; background?: { visible?: boolean; padding?: IPadding | number | number[]; style?: Omit, 'visible' | 'width' | 'height'>; }; interactive?: boolean; } & Omit; export type ILegendSpec = IDiscreteLegendSpec | IColorLegendSpec | ISizeLegendSpec;