@sisense/sdk-ui 1.23.0 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/ai.cjs +30 -29
  2. package/dist/ai.js +571 -558
  3. package/dist/analytics-composer.cjs +35 -35
  4. package/dist/analytics-composer.js +281 -261
  5. package/dist/{derive-chart-family-CTpRObm1.js → derive-chart-family-BlFbAr2V.js} +18111 -17793
  6. package/dist/{derive-chart-family-DcALKnKU.cjs → derive-chart-family-C_c2ZQQd.cjs} +108 -108
  7. package/dist/index.cjs +56 -75
  8. package/dist/index.js +5374 -5298
  9. package/dist/packages/sdk-ui/src/ai/chart/chart-insights.d.ts +2 -1
  10. package/dist/packages/sdk-ui/src/ai/chart/nlq-chart-widget.d.ts +7 -2
  11. package/dist/packages/sdk-ui/src/ai/chat-config.d.ts +4 -2
  12. package/dist/packages/sdk-ui/src/ai/icons/exclamation-mark-brand-icon.d.ts +3 -0
  13. package/dist/packages/sdk-ui/src/analytics-composer/common/stringify-props.d.ts +5 -0
  14. package/dist/packages/sdk-ui/src/analytics-composer/common/utils.d.ts +2 -0
  15. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/execute-query-composer.d.ts +8 -0
  16. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/to-execute-query-code.d.ts +2 -0
  17. package/dist/packages/sdk-ui/src/analytics-composer/index.d.ts +5 -0
  18. package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +13 -2
  19. package/dist/packages/sdk-ui/src/analytics-composer/widget/to-widget-code.d.ts +1 -1
  20. package/dist/packages/sdk-ui/src/analytics-composer/widget/widget-composer.d.ts +1 -0
  21. package/dist/packages/sdk-ui/src/api/rest-api.d.ts +25 -2
  22. package/dist/packages/sdk-ui/src/api/types/dashboard-dto.d.ts +9 -4
  23. package/dist/packages/sdk-ui/src/chart/advanced-chart.d.ts +1 -1
  24. package/dist/packages/sdk-ui/src/chart/regular-chart.d.ts +3 -0
  25. package/dist/packages/sdk-ui/src/chart-data-processor/data-table-date-period.d.ts +1 -4
  26. package/dist/packages/sdk-ui/src/chart-options-processor/category-chart-options.d.ts +2 -1
  27. package/dist/packages/sdk-ui/src/chart-options-processor/translations/sunburst/sunburst-options.d.ts +2 -1
  28. package/dist/packages/sdk-ui/src/chart-options-processor/translations/treemap/treemap-options.d.ts +2 -1
  29. package/dist/packages/sdk-ui/src/chart-options-processor/translations/treemap/treemap-tooltip.d.ts +3 -2
  30. package/dist/packages/sdk-ui/src/chart-options-processor/translations/types.d.ts +2 -0
  31. package/dist/packages/sdk-ui/src/common-filters/cascading-utils.d.ts +3 -1
  32. package/dist/packages/sdk-ui/src/common-filters/common-filters-connector.d.ts +4 -3
  33. package/dist/packages/sdk-ui/src/common-filters/types.d.ts +25 -0
  34. package/dist/packages/sdk-ui/src/common-filters/use-common-filters.d.ts +8 -9
  35. package/dist/packages/sdk-ui/src/common-filters/use-convert-filter-relations.d.ts +26 -0
  36. package/dist/packages/sdk-ui/src/dashboard/components/dashboard-container.d.ts +1 -1
  37. package/dist/packages/sdk-ui/src/dashboard/components/horizontal-collapse.d.ts +6 -0
  38. package/dist/packages/sdk-ui/src/dashboard/dashboard-helpers.d.ts +40 -10
  39. package/dist/packages/sdk-ui/src/dashboard/dashboard.d.ts +8 -3
  40. package/dist/packages/sdk-ui/src/dashboard/hooks/use-filters-panel-collapsed-state.d.ts +8 -0
  41. package/dist/packages/sdk-ui/src/dashboard/types.d.ts +24 -6
  42. package/dist/packages/sdk-ui/src/dashboard/use-composed-dashboard.d.ts +4 -4
  43. package/dist/packages/sdk-ui/src/decorators/component-decorators/with-error-boundary.d.ts +3 -1
  44. package/dist/packages/sdk-ui/src/error-boundary/error-boundary.d.ts +4 -2
  45. package/dist/packages/sdk-ui/src/filters/components/cascading-filter-tile/cascading-filter-tile.d.ts +2 -0
  46. package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +2 -0
  47. package/dist/packages/sdk-ui/src/filters/components/custom-filter-tile.d.ts +2 -0
  48. package/dist/packages/sdk-ui/src/filters/components/date-filter/date-range-filter-tile/date-range-filter-tile.d.ts +2 -0
  49. package/dist/packages/sdk-ui/src/filters/components/date-filter/relative-date-filter-tile/helpers.d.ts +6 -0
  50. package/dist/packages/sdk-ui/src/filters/components/date-filter/relative-date-filter-tile/relative-date-filter-tile.d.ts +2 -0
  51. package/dist/packages/sdk-ui/src/filters/components/date-filter/relative-date-filter-tile/relative-date-filter.d.ts +2 -1
  52. package/dist/packages/sdk-ui/src/filters/components/filter-tile.d.ts +1 -0
  53. package/dist/packages/sdk-ui/src/filters/components/filters-panel/filters-panel-tile.d.ts +3 -1
  54. package/dist/packages/sdk-ui/src/filters/components/filters-panel/filters-panel.d.ts +3 -3
  55. package/dist/packages/sdk-ui/src/filters/components/icons/trash-icon.d.ts +1 -1
  56. package/dist/packages/sdk-ui/src/filters/components/member-filter-tile/member-filter-tile.d.ts +2 -0
  57. package/dist/packages/sdk-ui/src/filters/components/member-filter-tile/member-list.d.ts +1 -1
  58. package/dist/packages/sdk-ui/src/filters/components/unsupported-filter-tile.d.ts +3 -1
  59. package/dist/packages/sdk-ui/src/filters/helpers.d.ts +122 -0
  60. package/dist/packages/sdk-ui/src/filters/index.d.ts +1 -0
  61. package/dist/packages/sdk-ui/src/index.d.ts +3 -1
  62. package/dist/packages/sdk-ui/src/models/dashboard/dashboard-model.d.ts +2 -2
  63. package/dist/packages/sdk-ui/src/models/dashboard/get-dashboard-model.d.ts +2 -1
  64. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-dto-utils.d.ts +1 -1
  65. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-utils.d.ts +2 -2
  66. package/dist/packages/sdk-ui/src/models/dashboard/types.d.ts +3 -0
  67. package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dasboard-model-utils.d.ts +2 -4
  68. package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model-reducer.d.ts +26 -18
  69. package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model.d.ts +3 -0
  70. package/dist/packages/sdk-ui/src/models/hierarchy/get-hierarchy-models.d.ts +6 -1
  71. package/dist/packages/sdk-ui/src/models/hierarchy/types.d.ts +3 -0
  72. package/dist/packages/sdk-ui/src/models/hierarchy/use-get-hierarchy-models.d.ts +4 -4
  73. package/dist/packages/sdk-ui/src/models/widget/widget-model-translator.d.ts +11 -1
  74. package/dist/packages/sdk-ui/src/pivot-table/hooks/use-render-pivot.d.ts +3 -1
  75. package/dist/packages/sdk-ui/src/props.d.ts +11 -3
  76. package/dist/packages/sdk-ui/src/query/date-formats/apply-date-format.d.ts +1 -0
  77. package/dist/packages/sdk-ui/src/query-execution/utils.d.ts +3 -0
  78. package/dist/packages/sdk-ui/src/sisense-context/sisense-context.d.ts +2 -0
  79. package/dist/packages/sdk-ui/src/table/table-component.d.ts +1 -1
  80. package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +10 -0
  81. package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +20 -0
  82. package/dist/packages/sdk-ui/src/utils/extract-widget-ids.d.ts +2 -0
  83. package/dist/packages/sdk-ui/src/utils/filter-relations.d.ts +64 -0
  84. package/dist/packages/sdk-ui/src/utils/filters-comparator.d.ts +5 -0
  85. package/dist/packages/sdk-ui/src/utils/filters.d.ts +0 -1
  86. package/dist/packages/sdk-ui/src/widget-by-id/translate-dashboard-filters.d.ts +178 -178
  87. package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-data-options.d.ts +2 -2
  88. package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-filters.d.ts +17 -17
  89. package/dist/packages/sdk-ui/src/widget-by-id/use-get-dashboard-model-and-widget-model.d.ts +13 -0
  90. package/dist/packages/sdk-ui/src/widget-by-id/utils.d.ts +13 -4
  91. package/dist/packages/sdk-ui/src/widgets/common/widget-container.d.ts +2 -0
  92. package/dist/packages/sdk-ui/src/widgets/common/widget-errors-and-warnings-context.d.ts +14 -0
  93. package/dist/packages/sdk-ui/src/widgets/common/widget-header-info-button.d.ts +3 -1
  94. package/dist/packages/sdk-ui/src/widgets/common/widget-header.d.ts +2 -0
  95. package/dist/useQuery-BYxzPyc5.cjs +870 -0
  96. package/dist/{useQuery-1xZMqnAI.js → useQuery-P9b5LtGq.js} +18768 -17547
  97. package/dist/widget-composer-DPsDPrFM.cjs +237 -0
  98. package/dist/widget-composer-DXM5t9rq.js +614 -0
  99. package/package.json +8 -8
  100. package/dist/packages/sdk-ui/src/dashboard/components/HorizontalCollapse.d.ts +0 -5
  101. package/dist/useQuery-D9rZ58KS.cjs +0 -821
  102. package/dist/widget-composer-B17DVa2A.cjs +0 -101
  103. package/dist/widget-composer-DqjH_6dw.js +0 -448
@@ -1,7 +1,7 @@
1
1
  import { DashboardStyleOptions, WidgetsOptions, WidgetsPanelLayout } from '../models';
2
2
  import { WidgetProps } from '../props';
3
- import { DataSource, Filter } from '@sisense/sdk-data';
4
3
  import { DashboardChangeAction } from '../dashboard/dashboard';
4
+ import { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
5
5
  export type { DashboardStyleOptions, WidgetsPanelColumnLayout } from '../models';
6
6
  /**
7
7
  * Props for the DashboardById component
@@ -19,7 +19,7 @@ export interface DashboardByIdProps {
19
19
  * Limitations:
20
20
  * - WAT authentication does not support persistence.
21
21
  * - As an alpha feature, currently only changes to dashboard filters are persisted.
22
- * @internal
22
+ * @alpha
23
23
  */
24
24
  persist?: boolean;
25
25
  }
@@ -31,9 +31,15 @@ export interface DashboardContainerProps {
31
31
  layoutOptions?: DashboardLayoutOptions;
32
32
  config?: DashboardConfig;
33
33
  widgets: WidgetProps[];
34
- filters: Filter[];
35
- onFiltersChange: (filters: Filter[]) => void;
34
+ filters: Filter[] | FilterRelations;
35
+ onFiltersChange: (filters: Filter[] | FilterRelations) => void;
36
36
  defaultDataSource?: DataSource;
37
+ /**
38
+ * Callback to receive changes
39
+ *
40
+ * @internal
41
+ */
42
+ onChange?: (action: DashboardChangeAction) => void;
37
43
  }
38
44
  /**
39
45
  * Dashboard configuration
@@ -42,7 +48,19 @@ export interface DashboardContainerProps {
42
48
  */
43
49
  export interface DashboardConfig {
44
50
  filtersPanel?: {
45
- isVisible: boolean;
51
+ isVisible?: boolean;
52
+ /**
53
+ * Boolean flag that controls the initial "collapsed" state of the filters panel.
54
+ *
55
+ * If not specified, the default value is `false`.
56
+ */
57
+ isCollapsedInitially?: boolean;
58
+ /**
59
+ * Setting this to true will use the isCollapsed state from local storage, if available, and store any changes to local storage.
60
+ * This state is shared across all dashboards.
61
+ * This state has a higher priority than "initialIsCollapsed" when enabled.
62
+ */
63
+ persistCollapsedStateToLocalStorage?: boolean;
46
64
  };
47
65
  toolbar?: {
48
66
  isVisible: boolean;
@@ -77,7 +95,7 @@ export interface DashboardProps {
77
95
  /** The widgets to render in the dashboard */
78
96
  widgets: WidgetProps[];
79
97
  /** The dashboard filters to be applied to each of the widgets based on the widget filter options */
80
- filters?: Filter[];
98
+ filters?: Filter[] | FilterRelations;
81
99
  /** The default data source to use for the dashboard */
82
100
  defaultDataSource?: DataSource;
83
101
  /** The options for each of the widgets */
@@ -1,11 +1,11 @@
1
1
  import { DashboardProps } from './types.js';
2
- import { Filter } from '@sisense/sdk-data';
2
+ import { Filter, FilterRelations } from '@sisense/sdk-data';
3
3
  export type ComposableDashboardProps = Pick<DashboardProps, 'filters' | 'widgets' | 'widgetsOptions'>;
4
4
  export type UseComposedDashboardOptions = {
5
5
  /**
6
6
  * @internal
7
7
  */
8
- onFiltersChange?: (filters: Filter[]) => void;
8
+ onFiltersChange?: (filters: Filter[] | FilterRelations) => void;
9
9
  };
10
10
  /**
11
11
  * {@link useComposedDashboard} without tracking to be used inside other hooks or components in Compose SDK.
@@ -15,7 +15,7 @@ export type UseComposedDashboardOptions = {
15
15
  */
16
16
  export declare function useComposedDashboardInternal<D extends ComposableDashboardProps | DashboardProps>(initialDashboard: D, { onFiltersChange }?: UseComposedDashboardOptions): {
17
17
  dashboard: D;
18
- setFilters: (filters: Filter[]) => void;
18
+ setFilters: (filters: Filter[] | FilterRelations) => void;
19
19
  };
20
20
  /**
21
21
  * React hook that takes in separate dashboard elements and
@@ -26,5 +26,5 @@ export declare function useComposedDashboardInternal<D extends ComposableDashboa
26
26
  */
27
27
  export declare const useComposedDashboard: <D extends DashboardProps | ComposableDashboardProps>(args_0: D, args_1?: UseComposedDashboardOptions | undefined) => {
28
28
  dashboard: D;
29
- setFilters: (filters: Filter[]) => void;
29
+ setFilters: (filters: Filter[] | FilterRelations) => void;
30
30
  };
@@ -2,4 +2,6 @@ import { ComponentDecorator } from './as-sisense-component';
2
2
  /**
3
3
  * Adds error boundary to the component
4
4
  */
5
- export declare const withErrorBoundary: ComponentDecorator<void>;
5
+ export declare const withErrorBoundary: ComponentDecorator<{
6
+ componentName: string;
7
+ }>;
@@ -1,5 +1,4 @@
1
1
  import { Component, ReactNode } from 'react';
2
- import { SisenseContextPayload } from '../sisense-context/sisense-context';
3
2
  import { AbstractTranslatableError } from '@sisense/sdk-common';
4
3
  /**
5
4
  * @internal
@@ -9,6 +8,8 @@ interface ErrorBoundaryProps {
9
8
  error?: AbstractTranslatableError | Error | string;
10
9
  children: ReactNode;
11
10
  resetKeys?: any[];
11
+ onError?: (error: Error) => void;
12
+ isContainerComponent?: boolean;
12
13
  }
13
14
  type ErrorBoundaryState = {
14
15
  error: AbstractTranslatableError | Error | string | null;
@@ -23,7 +24,8 @@ type ErrorBoundaryState = {
23
24
  */
24
25
  export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
25
26
  showErrorBox: boolean;
26
- context: SisenseContextPayload;
27
+ onError?: (error: Error) => void;
28
+ isContainerComponent: boolean;
27
29
  constructor(props: ErrorBoundaryProps);
28
30
  static getDerivedStateFromError(error: Error): {
29
31
  error: Error;
@@ -19,6 +19,8 @@ export interface CascadingFilterTileProps {
19
19
  arrangement?: FilterVariant;
20
20
  /** Callback returning filter object, or null for failure */
21
21
  onChange: (filter: Filter) => void;
22
+ /** Filter delete callback */
23
+ onDelete?: () => void;
22
24
  }
23
25
  /**
24
26
  * UI component representing group of cascading (dependent) filters.
@@ -14,6 +14,8 @@ export interface CriteriaFilterTileProps {
14
14
  arrangement?: FilterVariant;
15
15
  /** Callback returning filter object, or null for failure */
16
16
  onUpdate: (filter: Filter | null) => void;
17
+ /** Filter delete callback */
18
+ onDelete?: () => void;
17
19
  /** List of available measures to rank by. Required only for ranking filters. */
18
20
  measures?: Measure[];
19
21
  /**
@@ -15,6 +15,8 @@ export interface CustomFilterTileProps {
15
15
  * @param filter - Custom filter
16
16
  */
17
17
  onUpdate: (filter: Filter | null) => void;
18
+ /** Filter delete callback */
19
+ onDelete?: () => void;
18
20
  /** Design options for the tile @internal */
19
21
  tileDesignOptions?: FilterTileDesignOptions;
20
22
  }
@@ -38,6 +38,8 @@ export interface DateRangeFilterTileProps {
38
38
  * @param filter - Date range filter
39
39
  */
40
40
  onChange: (filter: Filter) => void;
41
+ /** Filter delete callback */
42
+ onDelete?: () => void;
41
43
  /**
42
44
  * List of filters this filter is dependent on.
43
45
  */
@@ -0,0 +1,6 @@
1
+ import { RelativeDateFilter as RelativeDateFilterType } from '@sisense/sdk-data';
2
+ import dayjs from 'dayjs';
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare function createAnchorDateFromRelativeDateFilter(filter: RelativeDateFilterType): dayjs.Dayjs;
@@ -18,6 +18,8 @@ export interface RelativeDateFilterTileProps {
18
18
  * @param filter - Relative date filter
19
19
  */
20
20
  onUpdate: (filter: Filter) => void;
21
+ /** Filter delete callback */
22
+ onDelete?: () => void;
21
23
  /**
22
24
  * Limit of the date range that can be selected.
23
25
  */
@@ -19,7 +19,8 @@ export interface RelativeDateFilterProps {
19
19
  */
20
20
  export declare const RelativeDateFilter: FunctionComponent<RelativeDateFilterProps>;
21
21
  export declare const DATE_OPS_MAP: {
22
- readonly [x: string]: "dateFilter.last" | "dateFilter.next";
22
+ readonly last: "dateFilter.last";
23
+ readonly next: "dateFilter.next";
23
24
  };
24
25
  export declare const DATE_LEVELS_MAP: {
25
26
  readonly [x: string]: "dateFilter.days" | "dateFilter.weeks" | "dateFilter.months" | "dateFilter.quarters" | "dateFilter.years";
@@ -29,6 +29,7 @@ interface Props {
29
29
  isDependent?: boolean;
30
30
  design?: FilterTileDesignOptions;
31
31
  onToggleDisabled?: () => void;
32
+ onDelete?: () => void;
32
33
  locked?: boolean;
33
34
  }
34
35
  /**
@@ -9,6 +9,8 @@ export type FiltersPanelTileProps = {
9
9
  filter: Filter;
10
10
  /** Callback to handle filter change */
11
11
  onChange: (filter: Filter | null) => void;
12
+ /** Filter delete callback */
13
+ onDelete?: () => void;
12
14
  /** Default data source used for filter tiles */
13
15
  defaultDataSource?: DataSource;
14
16
  };
@@ -17,4 +19,4 @@ export type FiltersPanelTileProps = {
17
19
  *
18
20
  * @internal
19
21
  */
20
- export declare const FiltersPanelTile: ({ filter, onChange, defaultDataSource, }: FiltersPanelTileProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const FiltersPanelTile: ({ filter, onChange, onDelete, defaultDataSource, }: FiltersPanelTileProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,14 @@
1
1
  /// <reference types="react" />
2
- import { DataSource, Filter } from '@sisense/sdk-data';
2
+ import { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
3
3
  /**
4
4
  * Props of the {@link FiltersPanel} component
5
5
  *
6
6
  */
7
7
  export type FiltersPanelProps = {
8
8
  /** Array of filters to display */
9
- filters: Filter[];
9
+ filters: Filter[] | FilterRelations;
10
10
  /** Callback to handle changes in filters */
11
- onFiltersChange: (filters: Filter[]) => void;
11
+ onFiltersChange: (filters: Filter[] | FilterRelations) => void;
12
12
  /** Default data source used for filter tiles */
13
13
  defaultDataSource?: DataSource;
14
14
  };
@@ -1,2 +1,2 @@
1
1
  import type { SVGProps } from 'react';
2
- export declare const TrashIcon: (props: Pick<SVGProps<SVGElement>, 'className' | 'width' | 'height'>) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const TrashIcon: (props: Pick<SVGProps<SVGElement>, 'className' | 'width' | 'height' | 'fill'>) => import("react/jsx-runtime").JSX.Element;
@@ -19,6 +19,8 @@ export interface MemberFilterTileProps {
19
19
  filter: Filter | null;
20
20
  /** Callback indicating when the source member filter object should be updated */
21
21
  onChange: (filter: Filter | null) => void;
22
+ /** Filter delete callback */
23
+ onDelete?: () => void;
22
24
  /** List of filters this filter is dependent on */
23
25
  parentFilters?: Filter[];
24
26
  /** Design options for the tile @internal */
@@ -7,7 +7,7 @@ export interface MemberListProps {
7
7
  checkAllMembers: () => void;
8
8
  uncheckAllMembers: () => void;
9
9
  excludeMembers: boolean;
10
- multiSelection: boolean;
10
+ enableMultiSelection: boolean;
11
11
  disabled: boolean;
12
12
  }
13
13
  export declare const MemberList: FunctionComponent<MemberListProps>;
@@ -3,10 +3,12 @@ import { Filter } from '@sisense/sdk-data';
3
3
  export type UnsupportedFilterTileProps = {
4
4
  filter: Filter;
5
5
  design?: FilterTileDesignOptions;
6
+ /** Filter delete callback */
7
+ onDelete?: () => void;
6
8
  };
7
9
  /**
8
10
  * Filter tile component that renders an unsupported filter (which is not recognized by the JAQL to Filter translation)
9
11
  *
10
12
  * @internal
11
13
  */
12
- export declare const UnsupportedFilterTile: ({ filter, design }: UnsupportedFilterTileProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const UnsupportedFilterTile: ({ filter, design, onDelete }: UnsupportedFilterTileProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,122 @@
1
+ import { Filter, FilterRelations } from '@sisense/sdk-data';
2
+ /**
3
+ * Returns a function that adds a filter to existing filters or filter relations.
4
+ *
5
+ * @param filter - The filter to add.
6
+ * @returns A function that takes existing filters or filter relations and returns updated filters or filter relations with the new filter added.
7
+ * @group Filter Utilities
8
+ * @example
9
+ * ```ts
10
+ * // Using with an array of filters
11
+ * const originalFilters = [filterByAgeRange];
12
+ * const updatedFilters = withAddedFilter(filterByCost)(originalFilters);
13
+ * // [filterByAgeRange, filterByCost]
14
+ *
15
+ * // Using with filter relations
16
+ * const originalFilterRelations = filterFactory.logic.or(filterByAgeRange, filterByRevenue);
17
+ * const updatedFilterRelations = withAddedFilter(filterByCost)(originalFilterRelations);
18
+ * // (filterByAgeRange OR filterByRevenue) AND filterByCost
19
+ * ```
20
+ * @internal
21
+ */
22
+ export declare function withAddedFilter(filter: Filter): (filters: Filter[] | FilterRelations | undefined) => Filter[] | FilterRelations;
23
+ /**
24
+ * Returns a function that adds multiple filters to existing filters or filter relations.
25
+ *
26
+ * @param filtersToAdd - An array of filters to add.
27
+ * @returns A function that takes existing filters or filter relations and returns updated filters or filter relations with the new filters added.
28
+ * @group Filter Utilities
29
+ * @example
30
+ * ```ts
31
+ * // Using with an array of filters
32
+ * const originalFilters = [filterByAgeRange];
33
+ * const updatedFilters = withAddedFilters([filterByCost, filterByRevenue])(originalFilters);
34
+ * // [filterByAgeRange, filterByCost, filterByRevenue]
35
+ *
36
+ * // Using with filter relations
37
+ * const originalFilterRelations = filterFactory.logic.or(filterByAgeRange, filterByRevenue);
38
+ * const updatedFilterRelations = withAddedFilters([filterByCost, filterByRevenue])(originalFilterRelations);
39
+ * // (filterByAgeRange OR filterByRevenue) AND filterByCost AND filterByRevenue
40
+ * ```
41
+ *
42
+ * @internal
43
+ */
44
+ export declare function withAddedFilters(filtersToAdd: Filter[]): (filters: Filter[] | FilterRelations | undefined) => Filter[] | FilterRelations;
45
+ /**
46
+ * Returns a function that removes a filter from existing filters or filter relations.
47
+ *
48
+ * @param filterToRemove - The filter to remove.
49
+ * @returns A function that takes existing filters or filter relations and returns updated filters or filter relations without the specified filter.
50
+ * @group Filter Utilities
51
+ * @example
52
+ * ```ts
53
+ * // Using with an array of filters
54
+ * const originalFilters = [filterByAgeRange, filterByRevenue, filterByCost];
55
+ * const updatedFilters = withoutFilter(filterByCost)(originalFilters);
56
+ * // [filterByAgeRange, filterByRevenue]
57
+ *
58
+ * // Using with filter relations
59
+ * const originalFilterRelations = filterFactory.logic.or(filterByAgeRange, filterByRevenue);
60
+ * const updatedFiltersRelations = withoutFilter(filterByRevenue)(originalFilterRelations);
61
+ * // filterByAgeRange
62
+ * ```
63
+ *
64
+ * @internal
65
+ */
66
+ export declare function withoutFilter(filterToRemove: Filter): (filters: Filter[] | FilterRelations | undefined) => Filter[] | FilterRelations;
67
+ /**
68
+ * Returns a function that removes multiple filters from existing filters or filter relations.
69
+ *
70
+ * @param filtersToRemove - An array of filters to remove.
71
+ * @returns A function that takes existing filters or filter relations and returns updated filters or filter relations without the specified filters.
72
+ * @group Filter Utilities
73
+ * @example
74
+ * ```ts
75
+ * // Using with an array of filters
76
+ * const originalFilters = [filterByAgeRange, filterByRevenue, filterByCost];
77
+ * const updatedFilters = withRemovedFilters([filterByRevenue, filterByCost])(originalFilters);
78
+ * // [filterByAgeRange]
79
+ *
80
+ * // Using with filter relations
81
+ * const originalFilterRelations = filterFactory.logic.or(filterByAgeRange, filterByRevenue);
82
+ * const updatedFiltersRelations = withRemovedFilters([filterByRevenue])(originalFilterRelations);
83
+ * // filterByAgeRange
84
+ * ```
85
+ *
86
+ * @internal
87
+ */
88
+ export declare function withoutFilters(filtersToRemove: Filter[]): (filters: Filter[] | FilterRelations | undefined) => Filter[] | FilterRelations;
89
+ /**
90
+ * Returns a function that replaces a filter with a new filter in existing filters or filter relations.
91
+ *
92
+ * @param filterToReplace - The filter to replace.
93
+ * @param newFilter - The new filter to use as a replacement.
94
+ * @returns A function that takes existing filters or filter relations and returns updated filters or filter relations with the filter replaced.
95
+ * @group Filter Utilities
96
+ * @example
97
+ * ```ts
98
+ * // Using with an array of filters
99
+ * const originalFilters = [filterByAgeRange, filterByRevenue];
100
+ * const updatedFilters = withReplacedFilter(filterByRevenue, filterByCost)(originalFilters);
101
+ * // [filterByAgeRange, filterByCost]
102
+ *
103
+ * // Using with filter relations
104
+ * const originalFilterRelations = filterFactory.logic.or(filterByAgeRange, filterByRevenue);
105
+ * const updatedFilterRelations = withReplacedFilter(filterByRevenue, filterByCost)(originalFilterRelations);
106
+ * // (filterByAgeRange OR filterByCost)
107
+ * ```
108
+ *
109
+ * @internal
110
+ */
111
+ export declare function withReplacedFilter(filterToReplace: Filter, newFilter: Filter): (filters: Filter[] | FilterRelations | undefined) => Filter[] | FilterRelations;
112
+ /**
113
+ * Finds a filter in an array of filters or filter relations.
114
+ * Returns the first filter that satisfies the provided search function.
115
+ * @group Filter Utilities
116
+ * @param filters - An array of filters or filter relations to search.
117
+ * @param searchFn - A function that takes a filter and returns a boolean indicating whether the filter satisfies the search criteria.
118
+ * @returns The first filter that satisfies the search function, or `undefined` if no filter is found.
119
+ *
120
+ * @internal
121
+ */
122
+ export declare function findFilter(filters: Filter[] | FilterRelations | undefined, searchFn: (filter: Filter) => boolean): Filter | undefined;
@@ -4,4 +4,5 @@ export * from './components/criteria-filter-tile';
4
4
  export * from './components/cascading-filter-tile';
5
5
  export * from './components/filters-panel';
6
6
  export * from './components/custom-filter-tile';
7
+ export * from './helpers';
7
8
  export { type FilterVariant } from './components/common/filter-utils';
@@ -5,7 +5,9 @@ export { ThemeProvider } from './theme-provider';
5
5
  export * from './dashboard';
6
6
  export { DashboardWidget } from './widget-by-id/dashboard-widget';
7
7
  export { WidgetById } from './widget-by-id/widget-by-id';
8
+ export { isChartWidgetProps, isPivotTableWidgetProps, isTextWidgetProps, isPluginWidgetProps, } from './widget-by-id/utils';
8
9
  export { type WidgetType, type CartesianWidgetType, type CategoricalWidgetType, type TabularWidgetType, type TextWidgetType, } from './widget-by-id/types';
10
+ export { getChartType } from './widget-by-id/utils';
9
11
  export * from './query-execution';
10
12
  export { executeQuery } from './query/execute-query';
11
13
  export { SisenseContextProvider } from './sisense-context/sisense-context-provider';
@@ -43,7 +45,7 @@ export { usePlugins } from './plugins-provider/plugins-provider';
43
45
  export { extractDimensionsAndMeasures, useExecutePluginQuery, } from './plugins-provider/use-execute-plugin-query';
44
46
  export { getThemeSettingsByOid } from './themes/theme-loader';
45
47
  export { getDefaultThemeSettings } from './theme-provider/default-theme-settings';
46
- export { useGetDashboardModel, useGetDashboardModels, getDashboardModel, getDashboardModels, useGetWidgetModel, getWidgetModel, translateToDashboardResponse, translateToDashboardsResponse, useGetHierarchyModels, getHierarchyModels, type DashboardModel, type GetDashboardModelParams, type GetDashboardModelsParams, type DashboardModelState, type DashboardModelLoadingState, type DashboardModelSuccessState, type DashboardModelErrorState, type DashboardModelsState, type DashboardModelsLoadingState, type DashboardModelsSuccessState, type DashboardModelsErrorState, type WidgetModel, type WidgetDataOptions, type WidgetModelState, type WidgetModelLoadingState, type WidgetModelErrorState, type WidgetModelSuccessState, type GetWidgetModelParams, type GetDashboardModelOptions, type GetDashboardModelsOptions, type WidgetsPanelColumnLayout as WidgetsPanelColumnLayout, type WidgetsPanelLayout as WidgetsPanelLayout, type WidgetId, type WidgetsOptions, type CommonFiltersOptions, type CommonFiltersApplyMode, type FiltersIgnoringRules, type HierarchyModel, type Hierarchy, type HierarchyId, type GetHierarchiesParams, type HierarchyModelsState, type HierarchyModelsLoadingState, type HierarchyModelsErrorState, type HierarchyModelsSuccessState, } from './models';
48
+ export { useGetDashboardModel, useGetDashboardModels, useDashboardModel, getDashboardModel, getDashboardModels, useGetWidgetModel, getWidgetModel, translateToDashboardResponse, translateToDashboardsResponse, useGetHierarchyModels, getHierarchyModels, type DashboardModel, type GetDashboardModelParams, type GetDashboardModelsParams, type DashboardModelState, type DashboardModelLoadingState, type DashboardModelSuccessState, type DashboardModelErrorState, type DashboardModelsState, type DashboardModelsLoadingState, type DashboardModelsSuccessState, type DashboardModelsErrorState, type WidgetModel, type WidgetDataOptions, type WidgetModelState, type WidgetModelLoadingState, type WidgetModelErrorState, type WidgetModelSuccessState, type GetWidgetModelParams, type GetDashboardModelOptions, type GetDashboardModelsOptions, type WidgetsPanelColumnLayout as WidgetsPanelColumnLayout, type WidgetsPanelLayout as WidgetsPanelLayout, type WidgetId, type WidgetsOptions, type CommonFiltersOptions, type CommonFiltersApplyMode, type FiltersIgnoringRules, type HierarchyModel, type Hierarchy, type HierarchyId, type GetHierarchyModelsParams, type HierarchyModelsState, type HierarchyModelsLoadingState, type HierarchyModelsErrorState, type HierarchyModelsSuccessState, UseDashboardModelActionType, } from './models';
47
49
  /**
48
50
  * Utility functions to translate a Fusion widget model from and to other widget data structures
49
51
  *
@@ -1,4 +1,4 @@
1
- import { DataSource, Filter } from '@sisense/sdk-data';
1
+ import { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
2
2
  import { DashboardStyleOptions, WidgetModel } from '../../models';
3
3
  import { type WidgetsOptions } from './types';
4
4
  import { DashboardLayoutOptions } from '../../dashboard';
@@ -42,7 +42,7 @@ export interface DashboardModel {
42
42
  *
43
43
  * @internal
44
44
  */
45
- filters: Filter[];
45
+ filters: Filter[] | FilterRelations;
46
46
  /**
47
47
  * Dashboard options for each of the widgets.
48
48
  *
@@ -1,4 +1,5 @@
1
1
  import { HttpClient } from '@sisense/sdk-rest-client';
2
+ import { DashboardModel } from '../../models/dashboard';
2
3
  import { CompleteThemeSettings } from '../../types';
3
4
  import { AppSettings } from '../../app/settings/settings';
4
5
  export interface GetDashboardModelOptions {
@@ -26,4 +27,4 @@ export interface GetDashboardModelOptions {
26
27
  * @returns The dashboard model
27
28
  * @internal
28
29
  */
29
- export declare function getDashboardModel(http: HttpClient, dashboardOid: string, options?: GetDashboardModelOptions, themeSettings?: CompleteThemeSettings, appSettings?: AppSettings): Promise<import('../../models/dashboard').DashboardModel>;
30
+ export declare function getDashboardModel(http: HttpClient, dashboardOid: string, options?: GetDashboardModelOptions, themeSettings?: CompleteThemeSettings, appSettings?: AppSettings): Promise<DashboardModel>;
@@ -2,8 +2,8 @@ import { Filter } from '@sisense/sdk-data';
2
2
  import { CascadingFilterDto, FilterDto } from '../../api/types/dashboard-dto';
3
3
  /**
4
4
  * Translates a {@link Filter} to a {@link FilterDto}.
5
- * @param filter
6
5
  *
6
+ * @param filter - The filter to translate.
7
7
  * @returns FilterDto
8
8
  *
9
9
  * @internal
@@ -1,7 +1,7 @@
1
1
  import { type LayoutDto, type FilterDto, type CascadingFilterDto } from '../../api/types/dashboard-dto';
2
2
  import type { WidgetsPanelColumnLayout, WidgetsOptions } from './types';
3
- import { Filter } from '@sisense/sdk-data';
3
+ import { Filter, FilterRelations, FilterRelationsModel, FilterRelationsModelNode } from '@sisense/sdk-data';
4
4
  import { WidgetDto } from '../../widget-by-id/types';
5
5
  export declare const translateLayout: (layout: LayoutDto) => WidgetsPanelColumnLayout;
6
- export declare function extractDashboardFilters(dashboardFilters: Array<FilterDto | CascadingFilterDto>): Filter[];
6
+ export declare function extractDashboardFilters(dashboardFilters: Array<FilterDto | CascadingFilterDto>, filterRelationsModel?: FilterRelationsModel | FilterRelationsModelNode): Filter[] | FilterRelations;
7
7
  export declare function translateWidgetsOptions(widgets?: WidgetDto[]): WidgetsOptions;
@@ -26,6 +26,9 @@ export interface WidgetsPanelColumnLayout {
26
26
  * Layout of dashboard widgets panel, which is a union of different layout algorithms
27
27
  */
28
28
  export type WidgetsPanelLayout = WidgetsPanelColumnLayout;
29
+ /**
30
+ * Widget ID
31
+ */
29
32
  export type WidgetId = string;
30
33
  /**
31
34
  * Options for widgets in a dashboard
@@ -3,20 +3,18 @@ import { DashboardChangeAction } from '../../../dashboard/dashboard';
3
3
  import { Authenticator } from '@sisense/sdk-rest-client';
4
4
  /**
5
5
  * Convert a dashboard change action to a use dashboard model action.
6
- * @param action - The dashboard change action to convert
7
6
  *
7
+ * @param action - The dashboard change action to convert
8
8
  * @returns The useDashboardModel action or null if the action is not supported
9
- *
10
9
  * @internal
11
10
  */
12
11
  export declare function dashboardChangeActionToUseDashboardModelAction(action: DashboardChangeAction): UseDashboardModelAction | null;
13
12
  /**
14
13
  * Check if the persistence is supported and log a warning if it is not.
14
+ *
15
15
  * @param authType - The authentication type
16
16
  * @param shouldWarn - Whether to log a warning
17
- *
18
17
  * @returns True if the persistence is supported, false otherwise
19
- *
20
18
  * @internal
21
19
  */
22
20
  export declare function checkPersistenceSupport(authType: Authenticator['type'], shouldWarn: boolean): boolean;
@@ -1,5 +1,5 @@
1
- import { DashboardModel } from '../../../models';
2
- import { Filter } from '@sisense/sdk-data';
1
+ import { DashboardModel, WidgetModel } from '../../../models';
2
+ import { Filter, FilterRelations } from '@sisense/sdk-data';
3
3
  import { RestApi } from '../../../api/rest-api';
4
4
  export type UseDashboardModelState = DashboardModel | null;
5
5
  /**
@@ -8,7 +8,8 @@ export type UseDashboardModelState = DashboardModel | null;
8
8
  * @internal
9
9
  */
10
10
  export declare enum UseDashboardModelActionTypeInternal {
11
- DASHBOARD_INIT = "DASHBOARD.INIT"
11
+ DASHBOARD_INIT = "DASHBOARD.INIT",
12
+ DASHBOARD_UPDATE_LAYOUT = "DASHBOARD.UPDATE_LAYOUT"
12
13
  }
13
14
  /**
14
15
  * Action types for the dashboard model state used in {@link useDashboardModel}.
@@ -16,14 +17,15 @@ export declare enum UseDashboardModelActionTypeInternal {
16
17
  * @internal
17
18
  */
18
19
  export declare enum UseDashboardModelActionType {
19
- FILTERS_UPDATE = "FILTERS.UPDATE"
20
+ FILTERS_UPDATE = "FILTERS.UPDATE",
21
+ ADD_WIDGET = "WIDGETS.ADD"
20
22
  }
21
23
  /**
22
24
  * Internal actions for the dashboard model state used in {@link useDashboardModel}.
23
25
  *
24
26
  * @internal
25
27
  */
26
- type UseDashboardModelInternalAction = UseDashboardModelAction | {
28
+ export type UseDashboardModelInternalAction = UseDashboardModelAction | {
27
29
  type: UseDashboardModelActionTypeInternal.DASHBOARD_INIT;
28
30
  payload: DashboardModel;
29
31
  };
@@ -32,32 +34,38 @@ type UseDashboardModelInternalAction = UseDashboardModelAction | {
32
34
  *
33
35
  * @internal
34
36
  */
35
- export type UseDashboardModelAction = {
37
+ export type UseDashboardModelAction = UseDashboardModelFilterUpdateAction | UseDashboardModelAddWidgetAction;
38
+ /**
39
+ * Filter update actions for the dashboard model state used in {@link useDashboardModel}.
40
+ *
41
+ * @internal
42
+ */
43
+ export type UseDashboardModelFilterUpdateAction = {
36
44
  type: UseDashboardModelActionType.FILTERS_UPDATE;
37
- payload: Filter[];
45
+ payload: Filter[] | FilterRelations;
38
46
  };
39
47
  /**
40
- * Reducer for the dashboard model state used in {@link useDashboardModel}.
41
- * @param state
42
- * @param action
48
+ * Add widget action for the dashboard model state used in {@link useDashboardModel}.
43
49
  *
44
50
  * @internal
45
51
  */
46
- export declare function dashboardReducer(state: UseDashboardModelState, action: UseDashboardModelInternalAction): UseDashboardModelState;
52
+ export type UseDashboardModelAddWidgetAction = {
53
+ type: UseDashboardModelActionType.ADD_WIDGET;
54
+ payload: WidgetModel;
55
+ };
47
56
  /**
48
- * Middleware connector for {@link persistDashboardModelMiddleware}.
49
- * @param restApi - The Sisense REST API instance
50
- * @param reducer - The dashboard model reducer
57
+ * Reducer for the dashboard model state used in {@link useDashboardModel}.
51
58
  *
59
+ * @param state
60
+ * @param action
52
61
  * @internal
53
62
  */
54
- export declare function withPersistDashboardModelMiddleware(restApi: RestApi, reducer: (state: UseDashboardModelState, action: UseDashboardModelInternalAction) => UseDashboardModelState): (state: UseDashboardModelState, action: UseDashboardModelInternalAction) => UseDashboardModelState;
63
+ export declare function dashboardReducer(state: UseDashboardModelState, action: UseDashboardModelInternalAction): UseDashboardModelState;
55
64
  /**
56
65
  * Middleware that persists the dashboard model changes to the Sisense server.
66
+ *
57
67
  * @param restApi - The Sisense REST API instance
58
68
  * @param reducer - The dashboard model reducer
59
- *
60
69
  * @internal
61
70
  */
62
- export declare function persistDashboardModelMiddleware(state: DashboardModel, action: UseDashboardModelAction, restApi: RestApi): Promise<import("../../..").DashboardDto | undefined> | Promise<null>;
63
- export {};
71
+ export declare function persistDashboardModelMiddleware(dashbordOid: string | undefined, action: UseDashboardModelInternalAction, restApi: RestApi): Promise<UseDashboardModelInternalAction>;
@@ -4,6 +4,7 @@ import { UseDashboardModelAction } from './use-dashboard-model-reducer';
4
4
  export interface UseDashboardModelParams extends GetDashboardModelParams {
5
5
  /**
6
6
  * Boolean flag indicating whether changes to the dashboard state should be saved to the dashboard in Fusion
7
+ *
7
8
  * @default true
8
9
  * @internal
9
10
  */
@@ -23,6 +24,7 @@ export declare const useDashboardModel: (args_0: UseDashboardModelParams) => {
23
24
  dashboard: import('../../../models').UseDashboardModelState;
24
25
  isLoading: boolean;
25
26
  isError: boolean;
27
+ error: Error | undefined;
26
28
  dispatchChanges: Dispatch<UseDashboardModelAction>;
27
29
  };
28
30
  /**
@@ -34,5 +36,6 @@ export declare function useDashboardModelInternal({ dashboardOid, includeWidgets
34
36
  dashboard: import('../../../models').UseDashboardModelState;
35
37
  isLoading: boolean;
36
38
  isError: boolean;
39
+ error: Error | undefined;
37
40
  dispatchChanges: Dispatch<UseDashboardModelAction>;
38
41
  };