import type { Attribute } from '@sisense/sdk-data'; import { DataSource, Filter } from '@sisense/sdk-data'; import type { JumpToDashboardConfig, JumpToDashboardConfigForPivot } from '../../../domains/dashboarding/hooks/jtd/jtd-types'; import { ChartDataOptions, PivotTableDataOptions } from '../../../domains/visualizations/core/chart-data-options/types'; import { EmptyObject } from '../../../shared/utils/utility-types'; import { ChartType, DrilldownOptions, PivotTableDrilldownOptions, WidgetStyleOptions } from '../../../types'; import type { FilterWidgetFilterType } from '../components/filter-widget/types'; import type { WidgetConfig, WidgetType } from '../components/widget/types'; /** * Widget data options. */ export type WidgetDataOptions = ChartDataOptions | PivotTableDataOptions | EmptyObject; /** * Model of Sisense widget defined in the abstractions of Compose SDK. * * @group Fusion Assets * @fusionEmbed */ export interface WidgetModel { /** * Unique identifier of the widget. */ readonly oid: string; /** * Widget title. */ title: string; /** * Widget description. */ description: string; /** * Full name of the widget data source. */ dataSource: DataSource; /** * Widget type. */ widgetType: WidgetType; /** * Custom widget type. Only present for custom widgets. * * If this is a custom widget, this is typically the name/ID of the custom widget. */ customWidgetType: string; /** * Widget data options. */ dataOptions: WidgetDataOptions; /** * Widget style options. */ styleOptions: WidgetStyleOptions; /** * Widget configuration. */ config?: WidgetConfig; /** * Custom widget options. Only present for custom widgets. * * Contains widget-specific configuration that doesn't fit into standard style or data options. */ customOptions?: Record; /** * Widget filters. */ filters: Filter[]; /** * Widget highlights. */ highlights: Filter[]; /** * Widget chart type. */ chartType?: ChartType; /** * Widget drilldown options. */ drilldownOptions: DrilldownOptions | PivotTableDrilldownOptions; /** * Jump to Dashboard configuration for this widget, when the model was built from a Fusion * `WidgetDto` via `fromWidgetDto`. Populated with the same translation as dashboard * `fromDashboardDto` uses for `widgetsOptions` (via `translateWidgetsOptions` → * `jumpToDashboardConfigFromWidgetDto`). Omitted or `undefined` when the model is not * Fusion-sourced (e.g. from widget props) or the widget has no versioned JTD. * * @see {@link widgetModelTranslator.toJtdConfig} * @internal */ jtdConfig?: JumpToDashboardConfig | JumpToDashboardConfigForPivot; /** * Parsed filter widget field data extracted from the Fusion DTO. * Only present when `widgetType === 'filter'` and the model was built from a DTO. * * @internal */ filterWidgetData?: { attribute: Attribute; filterType: FilterWidgetFilterType; isMultiselect: boolean; }; } export declare const isWidgetModel: (widget: any) => widget is WidgetModel;