import type { FSheetChart } from './f-chart'; import { SheetTypes } from '@univerjs/core'; import { FWorksheet } from '@univerjs/sheets/facade'; /** @ignore */ export interface IFWorksheetChartSheetMixin { /** * Returns this worksheet's effective type without modifying its snapshot. * A missing type is read as Grid, including historical snapshots that omit it. * * @returns {SheetTypes} The effective Grid or Chart Sheet type. * @example * ```ts * const fWorkbook = univerAPI.getActiveWorkbook(); * const fWorksheet = fWorkbook?.getActiveSheet(); * if (fWorksheet?.getSheetType() === univerAPI.Enum.SheetTypes.CHART) { * console.log('Active sheet is a Chart Sheet'); * } * ``` */ getSheetType(): SheetTypes; /** * Returns the primary chart created together with this Chart Sheet. * Charts inserted on Grid and moved into the Chart Sheet are children and do not replace its primary. * Use {@link FWorksheet.getCharts} to get the primary and every child chart. * * @returns {FSheetChart | null} The primary chart, or null for a Grid worksheet or a missing primary. * @example * ```ts * // Sales Report is an existing Chart Sheet created with insertChartSheet. * const fWorkbook = univerAPI.getActiveWorkbook(); * const fChartSheet = fWorkbook?.getSheetByName('Sales Report'); * const fPrimaryChart = fChartSheet?.getPrimaryChart(); * if (fPrimaryChart) { * // Update only the primary chart, leaving child charts unchanged. * fPrimaryChart.setTitle('Monthly sales'); * } * ``` */ getPrimaryChart(): FSheetChart | null; } /** @ignore */ export declare class FWorksheetChartSheetMixin extends FWorksheet implements IFWorksheetChartSheetMixin { getSheetType(): SheetTypes; getPrimaryChart(): FSheetChart | null; } declare module '@univerjs/sheets/facade' { interface FWorksheet extends IFWorksheetChartSheetMixin { } }