import { Filter, FilterRelations } from '@sisense/sdk-data'; import type { WidgetsPanelLayout } from '../../domains/dashboarding/dashboard-model'; import type { DashboardPersistenceManager } from './persistence/types.js'; import { DashboardProps } from './types.js'; export type ComposableDashboardProps = Pick; export type UseComposedDashboardOptions = { /** * @internal */ onFiltersChange?: (filters: Filter[] | FilterRelations) => void; /** * Persistence manager for the dashboard * @sisenseInternal */ persistence?: DashboardPersistenceManager; /** * Runtime edit mode state. When provided (e.g. by Dashboard), used for duplicate-widget visibility * instead of only config.widgetsPanel.editMode.isEditing. * @internal * * @deprecated Temporal workaround. Edit mode (with history management) should be managed by the `useComposedDashboard` hook instead of the Dashboard component. */ isEditing?: boolean; }; /** * Result of the {@link useComposedDashboard} hook. */ export type ComposedDashboardResult = { /** The composable dashboard object containing the current state of the dashboard. */ dashboard: D; /** API to set filters on the dashboard. */ setFilters: (filters: Filter[] | FilterRelations) => void; /** API to set the layout of the widgets on the dashboard. */ setWidgetsLayout: (newLayout: WidgetsPanelLayout) => void; }; /** * {@link useComposedDashboard} without tracking to be used inside other hooks or components in Compose SDK. * * @internal */ export declare function useComposedDashboardInternal(initialDashboard: D, { onFiltersChange, persistence, isEditing: isEditingRuntime }?: UseComposedDashboardOptions): ComposedDashboardResult; /** * React hook that takes in separate dashboard elements and * composes them into a coordinated dashboard with change detection, cross filtering, and drill down. * * @example * ```ts * import { useComposedDashboard } from '@sisense/sdk-ui/dashboard/use-composed-dashboard.js'; * import { Widget } from '@sisense/sdk-ui'; * import { DashboardProps } from '../../dashboard/types.js'; * import { FilterTile } from '../../filters'; * * const CodeExample = () => { * const dashboardProps: DashboardProps = { ... }; * * const { * dashboard: { title, widgets, filters = [] } * } = useComposedDashboard(dashboardProps); * * return ( *
* {title} *
* {widgets.map((widget) => ( * * ))} *
* * {Array.isArray(filters) ? filters.map((filter) => ( * console.log('Updated filter', filter)} * /> * )) : null} *
* ); * } * export default CodeExample; * ``` * * @template {D extends ComposableDashboardProps | DashboardProps} D - The type parameter for a dashboard properties, restricted to ComposableDashboardProps or DashboardProps * @param {D} initialDashboard - set of properties for the Dashboard component * @param {UseComposedDashboardOptions} [options] - Options for the composable. * * @return {ComposedDashboardResult} An object containing the composed dashboard and APIs to interact with it. * @group Dashboards */ export declare const useComposedDashboard: (initialDashboard: D, options?: UseComposedDashboardOptions) => ComposedDashboardResult;