import { Dimension, Filter, FilterRelations, Measure } from '@sisense/sdk-data'; import { JtdTarget, JumpToDashboardConfig, JumpToDashboardConfigForPivot, TriggerMethod } from '../../../domains/dashboarding/hooks/jtd/jtd-types'; import { TabberConfig, TabbersConfig } from '../../../domains/dashboarding/hooks/use-tabber'; import { Panel, WidgetDto } from '../../../domains/widgets/components/widget-by-id/types'; import { RestApi } from '../../../infra/api/rest-api'; import { type CascadingFilterDto, DashboardDto, type FilterDto, type LayoutDto } from '../../../infra/api/types/dashboard-dto'; import type { SpecificWidgetOptions, WidgetsOptions, WidgetsPanelColumnLayout } from './types'; type WidgetJtdDtoSlice = Pick; export declare const translateLayout: (layout: LayoutDto) => WidgetsPanelColumnLayout; export declare function extractDashboardFilters(dashboardFilters: Array, filterRelationsDtoOptions?: DashboardDto['filterRelations']): Filter[] | FilterRelations; export declare const getJtdNavigateType: (widget: WidgetJtdDtoSlice) => TriggerMethod; export declare const convertDimensionsToDimIndexes: (widget: WidgetJtdDtoSlice, dimensionIds: string[]) => string[]; /** * Extract pivot targets configuration from widget DTO and build Map-based targets * * @param widget - Widget DTO with drillToDashboardConfig * @returns Map of dimensions/measures to their targets or undefined if no targets found * @internal */ export declare function extractPivotTargetsConfigFromWidgetDto(widget: WidgetJtdDtoSlice): Map | undefined; /** * Converts a Fusion {@link WidgetDto}'s `drillToDashboardConfig` into Compose SDK JumpToDashboardConfig | JumpToDashboardConfigForPivot * {@link JumpToDashboardConfig} {@link JumpToDashboardConfigForPivot} for use with {@link useJtdWidget} * * @param widget - Fusion widget DTO (or the subset of fields used for JTD translation) * @returns JTD config, or `undefined` when there is no versioned JTD DTO or the widget type does not support JTD * * @group Dashboards */ export declare function jumpToDashboardConfigFromWidgetDto(widget: WidgetJtdDtoSlice): JumpToDashboardConfig | JumpToDashboardConfigForPivot | undefined; export declare function translateWidgetsOptions(widgets?: WidgetDto[]): WidgetsOptions; /** * Applies {@link SpecificWidgetOptions} to a {@link WidgetDto}. * Merges filtersOptions and jtdConfig into the DTO for persistence. * * @internal */ export declare function withSpecificWidgetOptions(widgetOptions?: SpecificWidgetOptions): (widgetDto: WidgetDto) => WidgetDto; /** * The dashboard-level context held about a single widget, gathered from the * (separate) containers it can live in: `widgetsOptions[id]` * ({@link SpecificWidgetOptions}: common filters, JTD, partial DTO snapshot) and * `config.tabbers[id]` ({@link TabberConfig}: per-tab show/hide mapping). * * Consumed by {@link withDashboardWidgetContext} to re-project this context onto a * freshly-translated {@link WidgetDto} on add/duplicate, so dashboard-level config * survives the model → DTO write path. * * @internal */ export type WidgetContext = { /** Per-widget options from `widgetsOptions[id]`. */ options?: SpecificWidgetOptions; /** Tabber show/hide mapping from `config.tabbers[id]`. */ tabber?: TabberConfig; }; /** * Overlays a {@link TabberConfig} onto a tabber {@link WidgetDto}. * * The widget-level translator (`toTabberWidgetStyle`) rebuilds `style.tabs[]` with * tab names / `activeTab` / styling but empty `displayWidgetIds` — the widget model * does not know about other widgets' ids. This overlays the dashboard-level * show/hide mapping back onto those tabs by index. No-op for non-tabber DTOs or * when there is no tabber config. * * @internal */ export declare function withTabberWidgetConfig(tabberConfig?: TabberConfig): (widgetDto: WidgetDto) => WidgetDto; /** * Projects all dashboard-level {@link WidgetContext} for a widget onto a freshly * translated {@link WidgetDto}. Composes the per-container projections * ({@link withSpecificWidgetOptions} for `widgetsOptions`, {@link withTabberWidgetConfig} * for `config.tabbers`); each is last-write-wins and a no-op when its slice is absent. * * This is the single seam that re-attaches dashboard-level widget config on * add/duplicate; a new per-widget side-channel adds its projection here. * * @internal */ export declare function withDashboardWidgetContext(context: WidgetContext): (widgetDto: WidgetDto) => WidgetDto; export declare function translateTabbersOptions(widgets?: WidgetDto[]): TabbersConfig; /** * Replace all shared formulas, which defined by id references, in the dashboard with their actual values. * * @param dashboard - The dashboard DTO to replace shared formulas in * @param api - The REST API instance * @returns The dashboard DTO with shared formulas, defined by id references, replaced * @internal */ export declare function withSharedFormulas(dashboard: DashboardDto, api: RestApi): Promise; /** * Find dimension or measure by instanceId in widget panels and convert to proper type * * @param panels - Widget metadata panels to search * @param pivotDimension - Instance ID to find, this is not a PivotDimId, it is the instanceId of the dimension or measure * @returns Dimension/Measure object with optional location info or undefined if not found * @internal */ export declare function findDimensionByInstanceId(panels: Panel[], pivotDimension: string): Dimension | Measure | { dimension: Dimension; location: 'row' | 'column' | 'value'; } | undefined; export {};