/** * The **Export Menu** — an *Export ▾* launcher in the grid's tools strip that * opens a dropdown of output formats (CSV / JSON / Excel / PDF). * * The exact counterpart of {@link import('./import-menu').ImportMenu}, and a * **pure UI** component in the same mould: it owns no export logic, never * touches grid data, and forwards a chosen format to its host through * {@link ExportMenuDeps.onSelectFormat}. The host (the grid) runs the actual * export through the {@link import('../export/export-service').ExportService}. * * One deliberate behaviour: **every configured format is shown, whether or not * an exporter is registered for it.** Hiding Excel because the host has not * installed `xlsx` would present an incomplete product as a complete one and * leave nobody any way to discover the capability; showing it and explaining the * one-time setup when it is clicked is the honest version. Formats that need * setup are marked with a small "Setup" hint rather than being disabled, so the * click that produces the explanation is still available. * * Every visual is class-driven — all colours, spacing, radii and typography come * from theme CSS variables (see `export-menu.css.ts`); the component sets no * inline styles. * * @packageDocumentation */ import type { IconRenderer } from '../icons/icon-renderer'; import type { ExportFeatureConfig, ExportFormat } from '../export/export.types'; /** Collaborators the {@link ExportMenu} needs from the grid, injected as a DI bag. */ export interface ExportMenuDeps { /** Renders themed, registry-backed icons. */ readonly iconRenderer: IconRenderer; /** The formats to offer, in order (from `GridOptions.export.formats`). */ readonly getFormats: () => readonly ExportFormat[]; /** * Whether an exporter is currently registered for a format. Drives only the * "Setup" hint — never whether the entry is rendered. */ readonly isAvailable: (format: ExportFormat) => boolean; /** Invoked with the chosen format. The host runs the export. */ readonly onSelectFormat: (format: ExportFormat) => void; } /** * Floating Export launcher + dropdown. Opt-in via `GridOptions.export.enabled`, * and vetoed by the toolbar's `showExportButton: false`. */ export declare class ExportMenu { private readonly deps; private wrapperEl; private launcherEl; private menuEl; private itemEls; private isOpen; private readonly boundOutsideDown; private readonly boundKeydown; constructor(deps: ExportMenuDeps); /** * Builds the launcher and dropdown and docks them into the grid. Call once * per grid instance. * * @param wrapperEl - The `.pg-grid` root element the dropdown floats over. * @param toolsRightEl - The `.pg-grid__tools__right` region the launcher docks * into, so it lays out beside the other launchers instead of stacking. * @param config - The resolved `GridOptions.export` configuration. */ mount(wrapperEl: HTMLElement, toolsRightEl: HTMLElement, config: ExportFeatureConfig): void; /** * Opens the dropdown. Idempotent. * * The items are rebuilt on every open so the "Setup" hints reflect exporters * registered *after* the grid was created — a host that lazy-loads `xlsx` * should not need a re-render for Excel to stop advertising setup. */ open(): void; /** Closes the dropdown. Idempotent. */ close(): void; /** Toggles the dropdown. */ toggle(): void; /** Tears down DOM and listeners. */ destroy(): void; private buildLauncher; private buildMenu; /** Rebuilds the dropdown's entries against the current formats and availability. */ private rebuildItems; private buildItem; private onKeydown; } /** * Normalises `GridOptions.export` into a config object, or `null` when the * toolbar dropdown must not be built. * * One place for the shorthand, so `true`, `{ enabled: true }` and an explicit * `{ enabled: false }` cannot be read three different ways by three callers — * the same contract {@link import('./columns-manager-launcher').resolveColumnsManagerConfig} * provides for the Columns Manager. * * @param option - The raw option, in any of its accepted forms. */ export declare function resolveExportConfig(option: boolean | ExportFeatureConfig | undefined): ExportFeatureConfig | null; //# sourceMappingURL=export-menu.d.ts.map