import type { ChartSourceHeaderTitleType, ChartTypeBits, IChartConfig, IChartData, IChartDataSource, IChartSourceHeader, IChartSourceHeaderTitle, IUniverDataSet, OptionDataValue } from '@univerjs-pro/engine-chart'; import type { IRange } from '@univerjs/core'; import type { Observable } from 'rxjs'; export interface ISheetChartMetadata { isPrimary?: boolean; } export interface IDimensionDefinition { type?: 'number' | 'ordinal' | 'time' | 'float' | 'int'; name?: string; displayName?: string; } export type DimensionDefinitionLoose = IDimensionDefinition['name'] | IDimensionDefinition; export type { IUniverDataSet, OptionDataValue }; export interface IChartSourceRangeItem { range: IRange; subUnitId: string; unitId: string; } /** A Multi vector stores its pure body and an independent title; it has no Header band. */ export interface IChartSourceMultiRangeItem { /** Historical omission means none; canonical writers emit an explicit title source. */ header?: ISheetChartSourceHeaderTitle; range: IChartSourceRangeItem; } /** Complete Single input or ordered pure-body Multi vectors, with canonical workbook/sheet IDs. */ export type ISheetChartSourceRanges = ISheetChartSourceSingleRange | IChartSourceMultiRangeItem[]; export interface ISheetChartSourceSnapshot { revision: number; rangeRevision: number; rangeInfo: ISheetChartSourceRanges; dataSet: IUniverDataSet; isRowDirection: boolean; canSwitchOrient: boolean; } /** References retain their full range, read its final layer on the vector axis, and never remove body values. */ export type ISheetChartSourceHeaderTitle = IChartSourceHeaderTitle | { type: ChartSourceHeaderTitleType.Reference; source: IChartSourceRangeItem; }; /** Sheet retains common collections and adds references, including references within mixed values. */ export type ISheetChartSourceHeaderTitles = NonNullable | { type: ChartSourceHeaderTitleType.References; values: Partial>; } | { type: ChartSourceHeaderTitleType.Mixed; values: Partial>; }; export interface ISheetChartSourceSingleRange { /** Complete input rectangle, including any band; titles never rewrite this geometry. */ rangeInfo: IChartSourceRangeItem; isRowDirection?: boolean; /** Missing requests initial inference; explicit {} keeps every cell and supplies no default titles. */ header?: IChartSourceHeader; } export interface ISheetChartDataSource extends IChartDataSource { /** Canonical coherent runtime source state. Revision counters are never persisted. */ readonly snapshot$: Observable; /** * can switch the orient of the data, only single range or multi range all range has same value length can switch */ readonly canSwitchOrient$: Observable; readonly isRowDirection$: Observable; get isRowDirection(): boolean; /** * the range info of the chart source */ readonly rangeInfo$: Observable; canSwitchOrient(): boolean; dispose(): void; getRangeInfo(): ISheetChartSourceRanges; } export interface IChartConfigConverter { canConvert(type: ChartTypeBits): boolean; convert(type: ChartTypeBits, data: IChartData): IChartConfig; }