@sisense/sdk-ui 1.24.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 (58) hide show
  1. package/dist/ai.cjs +18 -17
  2. package/dist/ai.js +444 -438
  3. package/dist/analytics-composer.cjs +35 -35
  4. package/dist/analytics-composer.js +281 -261
  5. package/dist/derive-chart-family-BlFbAr2V.js +44435 -0
  6. package/dist/derive-chart-family-C_c2ZQQd.cjs +271 -0
  7. package/dist/index.cjs +112 -132
  8. package/dist/index.js +8160 -7302
  9. package/dist/packages/sdk-ui/src/ai/chat-config.d.ts +4 -2
  10. package/dist/packages/sdk-ui/src/analytics-composer/common/stringify-props.d.ts +5 -0
  11. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/execute-query-composer.d.ts +8 -0
  12. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/to-execute-query-code.d.ts +2 -0
  13. package/dist/packages/sdk-ui/src/analytics-composer/index.d.ts +5 -0
  14. package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +9 -2
  15. package/dist/packages/sdk-ui/src/analytics-composer/widget/to-widget-code.d.ts +1 -1
  16. package/dist/packages/sdk-ui/src/api/rest-api.d.ts +13 -1
  17. package/dist/packages/sdk-ui/src/api/types/dashboard-dto.d.ts +9 -4
  18. package/dist/packages/sdk-ui/src/chart-data-processor/data-table-date-period.d.ts +1 -4
  19. package/dist/packages/sdk-ui/src/common-filters/cascading-utils.d.ts +3 -1
  20. package/dist/packages/sdk-ui/src/common-filters/common-filters-connector.d.ts +4 -3
  21. package/dist/packages/sdk-ui/src/common-filters/types.d.ts +25 -0
  22. package/dist/packages/sdk-ui/src/common-filters/use-common-filters.d.ts +8 -9
  23. package/dist/packages/sdk-ui/src/common-filters/use-convert-filter-relations.d.ts +26 -0
  24. package/dist/packages/sdk-ui/src/dashboard/dashboard-helpers.d.ts +40 -10
  25. package/dist/packages/sdk-ui/src/dashboard/dashboard.d.ts +2 -2
  26. package/dist/packages/sdk-ui/src/dashboard/types.d.ts +5 -5
  27. package/dist/packages/sdk-ui/src/dashboard/use-composed-dashboard.d.ts +4 -4
  28. package/dist/packages/sdk-ui/src/filters/components/filters-panel/filters-panel.d.ts +3 -3
  29. package/dist/packages/sdk-ui/src/filters/components/member-filter-tile/member-list.d.ts +1 -1
  30. package/dist/packages/sdk-ui/src/filters/helpers.d.ts +122 -0
  31. package/dist/packages/sdk-ui/src/filters/index.d.ts +1 -0
  32. package/dist/packages/sdk-ui/src/models/dashboard/dashboard-model.d.ts +2 -2
  33. package/dist/packages/sdk-ui/src/models/dashboard/get-dashboard-model.d.ts +2 -1
  34. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-dto-utils.d.ts +1 -1
  35. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-utils.d.ts +2 -2
  36. package/dist/packages/sdk-ui/src/models/dashboard/types.d.ts +3 -0
  37. package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model-reducer.d.ts +2 -2
  38. package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model.d.ts +2 -0
  39. package/dist/packages/sdk-ui/src/query/date-formats/apply-date-format.d.ts +1 -0
  40. package/dist/packages/sdk-ui/src/query-execution/utils.d.ts +3 -0
  41. package/dist/packages/sdk-ui/src/utils/extract-widget-ids.d.ts +2 -0
  42. package/dist/packages/sdk-ui/src/utils/filter-relations.d.ts +64 -0
  43. package/dist/packages/sdk-ui/src/utils/filters-comparator.d.ts +5 -0
  44. package/dist/packages/sdk-ui/src/utils/filters.d.ts +0 -1
  45. package/dist/packages/sdk-ui/src/widget-by-id/translate-dashboard-filters.d.ts +178 -178
  46. package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-filters.d.ts +17 -17
  47. package/dist/packages/sdk-ui/src/widget-by-id/use-get-dashboard-model-and-widget-model.d.ts +13 -0
  48. package/dist/packages/sdk-ui/src/widget-by-id/utils.d.ts +4 -4
  49. package/dist/useQuery-BYxzPyc5.cjs +870 -0
  50. package/dist/useQuery-P9b5LtGq.js +80529 -0
  51. package/dist/widget-composer-DPsDPrFM.cjs +237 -0
  52. package/dist/{widget-composer-L8kmRhgX.js → widget-composer-DXM5t9rq.js} +128 -138
  53. package/package.json +8 -8
  54. package/dist/useQuery-CIeSzN0Z.js +0 -7945
  55. package/dist/useQuery-LqaaNBLw.cjs +0 -175
  56. package/dist/widget-composer-CvgsMHyb.cjs +0 -237
  57. package/dist/widget-model-translator-CYeCKnTa.js +0 -116687
  58. package/dist/widget-model-translator-_Z-8UaTN.cjs +0 -917
@@ -8,9 +8,11 @@ export interface ChatConfig {
8
8
  */
9
9
  enableFollowupQuestions: boolean;
10
10
  /**
11
- * Number of recommended queries that should be shown in a chat session
11
+ * Number of recommended queries that should initially be shown in a chat session
12
12
  *
13
- * If not specified, the default value is `4`
13
+ * If not specified, the default value is `4`.
14
+ *
15
+ * Set to `0` to disable initial recommendations.
14
16
  */
15
17
  numOfRecommendations: number;
16
18
  /**
@@ -0,0 +1,5 @@
1
+ import { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
2
+ import { ChartDataOptions } from '../../types';
3
+ export declare function stringifyDataOptions(dataOptions: ChartDataOptions): string;
4
+ export declare function stringifyDataSource(dataSource: DataSource | undefined): string;
5
+ export declare function stringifyExtraImports(filters: Filter[] | FilterRelations): string;
@@ -0,0 +1,8 @@
1
+ import { ExecuteQueryCodeParams } from '../types.js';
2
+ /**
3
+ * Converts query params to CSDK code.
4
+ *
5
+ * @param queryParams - queryParams params
6
+ * @returns CSDK code string
7
+ */
8
+ export declare const toExecuteQueryCode: (executeQueryCodeParams: ExecuteQueryCodeParams) => string;
@@ -0,0 +1,2 @@
1
+ import { ExecuteQueryCodeParams } from '../types.js';
2
+ export declare const toExecuteQueryCode: ({ queryParams, uiFramework, }: ExecuteQueryCodeParams) => string;
@@ -10,3 +10,8 @@ export * as widgetComposer from './widget/widget-composer';
10
10
  * @internal
11
11
  */
12
12
  export * as dashboardComposer from './dashboard/dashboard-composer';
13
+ /**
14
+ * Utility functions to compose props and code for executing queries.
15
+ * @internal
16
+ */
17
+ export * as executeQueryComposer from './execute-query/execute-query-composer';
@@ -1,5 +1,6 @@
1
1
  import { WidgetProps } from '../props';
2
2
  import { ChartDataOptions } from '../types';
3
+ import { ExecuteQueryParams } from '../query-execution';
3
4
  import { MetadataItem } from '@sisense/sdk-data';
4
5
  import { DynamicChartType } from '../chart-options-processor/translations/types.js';
5
6
  export type KeysOfUnion<T> = T extends T ? keyof T : never;
@@ -85,7 +86,7 @@ export type UiFramework = 'react' | 'vue' | 'angular';
85
86
  * Code Template Key
86
87
  * @internal
87
88
  */
88
- export type CodeTemplateKey = 'baseChartTmpl' | 'chartTmpl' | 'chartWidgetTmpl' | 'widgetByIdTmpl' | 'executeQueryByWidgetIdTmpl' | 'executeQueryWidgetTmpl';
89
+ export type CodeTemplateKey = 'baseChartTmpl' | 'chartTmpl' | 'chartWidgetTmpl' | 'widgetByIdTmpl' | 'executeQueryByWidgetIdTmpl' | 'executeQueryTmpl';
89
90
  /**
90
91
  * Code Templates
91
92
  * @internal
@@ -118,7 +119,7 @@ export type WidgetCodeConfig = BaseCodeConfig & {
118
119
  * Client-side Widget Code Params
119
120
  * @internal
120
121
  */
121
- export type ClientSideWidgetCodeParams = WidgetCodeConfig & {
122
+ export type ClientSideWidgetCodeParams = BaseCodeConfig & {
122
123
  widgetProps: WidgetProps;
123
124
  };
124
125
  /**
@@ -151,3 +152,9 @@ export declare const isByIdWidgetCodeParams: (params: WidgetCodeParams) => param
151
152
  export type WidgetPropsConfig = {
152
153
  useCustomizedStyleOptions?: boolean;
153
154
  };
155
+ /**
156
+ * @internal
157
+ */
158
+ export type ExecuteQueryCodeParams = BaseCodeConfig & {
159
+ queryParams: ExecuteQueryParams;
160
+ };
@@ -1,3 +1,3 @@
1
1
  import { ByIdWidgetCodeParams, ClientSideWidgetCodeParams } from '../types.js';
2
2
  export declare const toWidgetCodeById: ({ dashboardOid, widgetOid, uiFramework, chartType, includeChart, }: ByIdWidgetCodeParams) => string;
3
- export declare const toWidgetCodeClientSide: ({ widgetProps, uiFramework, includeChart, }: ClientSideWidgetCodeParams) => string;
3
+ export declare const toWidgetCodeClientSide: ({ widgetProps, uiFramework, }: ClientSideWidgetCodeParams) => string;
@@ -21,7 +21,19 @@ export declare class RestApi {
21
21
  /**
22
22
  * Get all dashboards
23
23
  */
24
- getDashboards: (options?: GetDashboardsOptions) => Promise<DashboardDto[] | undefined>;
24
+ getDashboards: (options?: GetDashboardsOptions) => Promise<({
25
+ oid: string;
26
+ title: string;
27
+ datasource: import("@sisense/sdk-data").JaqlDataSource;
28
+ widgets?: WidgetDto[] | undefined;
29
+ filters?: (import("./types/dashboard-dto").FilterDto | import("./types/dashboard-dto").CascadingFilterDto)[] | undefined;
30
+ filterRelations?: {
31
+ datasource: string;
32
+ filterRelations: import("@sisense/sdk-data").FilterRelationsModelNode;
33
+ }[] | undefined;
34
+ layout?: import("./types/dashboard-dto").LayoutDto | undefined;
35
+ style?: import("./types/dashboard-dto").DashboardStyleDto | undefined;
36
+ } & import("../utils/utility-types").AnyObject)[]>;
25
37
  /**
26
38
  * Get a specific dashboard
27
39
  */
@@ -1,9 +1,9 @@
1
1
  import { WidgetDto } from '../../widget-by-id/types';
2
- import { FilterJaql, FilterRelationsModel, JaqlDataSource } from '@sisense/sdk-data';
2
+ import { FilterJaql, FilterRelationsModel, FilterRelationsModelNode, JaqlDataSource } from '@sisense/sdk-data';
3
3
  import { AnyObject } from '../../utils/utility-types';
4
4
  /** @internal */
5
5
  export type LayoutDto = {
6
- columns: {
6
+ columns?: {
7
7
  width: number;
8
8
  cells?: {
9
9
  subcells: {
@@ -23,9 +23,12 @@ export type FilterDto = {
23
23
  disabled?: boolean;
24
24
  locked?: boolean;
25
25
  };
26
+ type CascadeLevel = FilterJaql & {
27
+ instanceid?: string;
28
+ };
26
29
  export type CascadingFilterDto = {
27
30
  isCascading: true;
28
- levels: FilterJaql[];
31
+ levels: CascadeLevel[];
29
32
  instanceid?: string;
30
33
  disabled?: boolean;
31
34
  locked?: boolean;
@@ -48,8 +51,10 @@ export type DashboardDto = {
48
51
  widgets?: WidgetDto[];
49
52
  filters?: Array<FilterDto | CascadingFilterDto>;
50
53
  filterRelations?: {
51
- filterRelations: FilterRelationsModel;
54
+ datasource: string;
55
+ filterRelations: FilterRelationsModel | FilterRelationsModelNode;
52
56
  }[];
53
57
  layout?: LayoutDto;
54
58
  style?: DashboardStyleDto;
55
59
  } & AnyObject;
60
+ export {};
@@ -1,7 +1,4 @@
1
- export type SystemSettings = {
2
- language: string;
3
- };
4
- export declare const getBaseDateFnsLocale: (systemSettings?: SystemSettings) => Locale;
1
+ export declare const getBaseDateFnsLocale: (language?: string) => Locale;
5
2
  export declare enum DatePeriod {
6
3
  YEAR = "years",
7
4
  QUARTER = "quarters",
@@ -14,7 +14,9 @@ export declare function flattenCascadingFilters(filters: Filter[]): {
14
14
  * @param originalFilters - Original filters with maybe cascading filters.
15
15
  * @returns reassembled filters.
16
16
  */
17
- export declare function reassembleCascadingFilters(updatedFilters: PureFilter[], originalFilters: (PureFilter | CascadingFilter)[]): (PureFilter | CascadingFilter)[];
17
+ export declare function reassembleCascadingFilters(updatedFilters: PureFilter[], originalFilters: (PureFilter | CascadingFilter)[], config?: {
18
+ shouldResetFiltersDeeperThanModified?: boolean;
19
+ }): (PureFilter | CascadingFilter)[];
18
20
  /**
19
21
  * Converts cascading filters to pure filters and vice versa.
20
22
  *
@@ -4,14 +4,15 @@ import { CommonFiltersOptions } from './types.js';
4
4
  import { WidgetTypeInternal } from '../models/widget/types';
5
5
  import { OpenMenuFn } from '../common/components/menu/types';
6
6
  import { TFunction } from '@sisense/sdk-common';
7
- type CommonFiltersToWidgetConnectProps = Pick<ChartWidgetProps, 'filters' | 'highlights' | 'onDataPointClick' | 'onDataPointsSelected' | 'onDataPointContextMenu'> & {
7
+ type CommonFiltersConnectionProps = Pick<ChartWidgetProps, 'highlights' | 'onDataPointClick' | 'onDataPointsSelected' | 'onDataPointContextMenu'> & {
8
+ filters: Filter[];
8
9
  renderToolbar: RenderToolbarHandler;
9
10
  };
10
11
  /**
11
- * Prepares common filters to be used in widget connect props
12
+ * Prepares common filters for connection to widget props
12
13
  *
13
14
  * @param filters - Pure filters (non-cascading)
14
15
  * @param setFilters - Function to set updated pure filters (non-cascading)
15
16
  */
16
- export declare function prepareCommonFiltersToWidgetConnectProps(commonFilters: Filter[], updateCommonFilters: (filters: Filter[]) => void, widgetType: WidgetTypeInternal, dataOptions: ChartDataOptions | PivotTableDataOptions, options: CommonFiltersOptions, translate: TFunction, openMenu?: OpenMenuFn): CommonFiltersToWidgetConnectProps;
17
+ export declare function prepareCommonFiltersConnectionProps(commonFilters: Filter[], updateCommonFilters: (filters: Filter[]) => void, widgetType: WidgetTypeInternal, dataOptions: ChartDataOptions | PivotTableDataOptions, options: CommonFiltersOptions, translate: TFunction, openMenu?: OpenMenuFn): CommonFiltersConnectionProps;
17
18
  export {};
@@ -11,16 +11,41 @@ export declare enum CommonFiltersApplyMode {
11
11
  * Options for common filters defined at the dashboard level to be applied to certain widgets.
12
12
  */
13
13
  export type CommonFiltersOptions = {
14
+ /**
15
+ * Apply mode for common filters: 'highlight' or 'filter'.
16
+ */
14
17
  applyMode?: `${CommonFiltersApplyMode}`;
18
+ /**
19
+ * Boolean flag whether widget interactions – for example, selection of bars on a bar chart –
20
+ * should affect common filters.
21
+ *
22
+ * If not specified, the default value is `true`.
23
+ */
15
24
  shouldAffectFilters?: boolean;
25
+ /**
26
+ * Filters to ignore when applying common filters.
27
+ */
16
28
  ignoreFilters?: FiltersIgnoringRules;
29
+ /**
30
+ * Boolean flag whether to apply all background filters as slice filters ignoring "disabled" state and "ignoreFilters" rules
31
+ *
32
+ * If not specified, the default value is `true`.
33
+ */
17
34
  forceApplyBackgroundFilters?: boolean;
18
35
  };
19
36
  /**
20
37
  * Filters ignoring rules.
21
38
  */
22
39
  export type FiltersIgnoringRules = {
40
+ /**
41
+ * Boolean flag whether to ignore all filters.
42
+ *
43
+ * If not specified, the default value is `false`.
44
+ */
23
45
  all?: boolean;
46
+ /**
47
+ * Filter GUIDs to ignore.
48
+ */
24
49
  ids?: string[];
25
50
  };
26
51
  /** @internal */
@@ -1,17 +1,16 @@
1
- /// <reference types="react" />
2
- import { type Filter } from '@sisense/sdk-data';
1
+ import { FilterRelations, type Filter } from '@sisense/sdk-data';
3
2
  import { CommonFiltersOptions } from './types.js';
4
3
  import { WidgetProps } from '../props.js';
5
4
  import { BeforeMenuOpenHandler, OpenMenuFn } from '../common/components/menu/types.js';
6
5
  /** @internal */
7
- export declare const useCommonFilters: ({ initialFilters, openMenu, onBeforeMenuOpen, onFiltersChange, }?: {
8
- initialFilters?: Filter[] | undefined;
6
+ export declare const useCommonFilters: ({ initialFilters: initialCommonFiltersOrFilterRelations, openMenu, onBeforeMenuOpen, onFiltersChange, }?: {
7
+ initialFilters?: Filter[] | FilterRelations | undefined;
9
8
  openMenu?: OpenMenuFn | undefined;
10
9
  onBeforeMenuOpen?: BeforeMenuOpenHandler | undefined;
11
- onFiltersChange?: ((filters: Filter[]) => void) | undefined;
10
+ onFiltersChange?: ((filters: Filter[] | FilterRelations) => void) | undefined;
12
11
  }) => {
13
- filters: Filter[];
14
- setFilters: import("react").Dispatch<import("react").SetStateAction<Filter[]>>;
15
- addFilter: (newFilter: Filter) => void;
16
- connectToWidgetProps: (widget: WidgetProps, options?: CommonFiltersOptions) => WidgetProps;
12
+ filters: Filter[] | FilterRelations;
13
+ setFilters: (filtersOrFilterRelations: Filter[] | FilterRelations) => void;
14
+ addFilter: (filter: Filter) => void;
15
+ connectToWidgetProps: (widgetProps: WidgetProps, options?: CommonFiltersOptions) => WidgetProps;
17
16
  };
@@ -0,0 +1,26 @@
1
+ import { Filter, FilterRelations } from '@sisense/sdk-data';
2
+ /**
3
+ * Result of the FilterRelations conversion.
4
+ */
5
+ type UseFilterRelationsConversionResult = {
6
+ /** The current filters or filter relations. */
7
+ filtersOrFilterRelations: Filter[] | FilterRelations;
8
+ /** The current regular filters without relations. */
9
+ regularFilters: Filter[];
10
+ /** Adds a new filter to the current filters (recalculates relations if needed). */
11
+ addFilter: (filter: Filter) => void;
12
+ /** Completely replaces the current filters and relations with new ones. */
13
+ setFiltersOrFilterRelations: (filtersOrFilterRelations: Filter[] | FilterRelations) => void;
14
+ /** Completely replaces the current filters with new ones (recalculates relations if needed). */
15
+ setFilters: (filters: Filter[]) => void;
16
+ /** Calculates relations for some other filters based on current relations and applies them */
17
+ applyRelationsToOtherFilters: (otherFilters: Filter[]) => Filter[] | FilterRelations;
18
+ };
19
+ /**
20
+ * Hook for handling conversion between regular filters and filter relations.
21
+ *
22
+ * @param initialFiltersOrFilterRelations - Initial filters or filter relations.
23
+ * @returns The result of the conversion. See {@link UseFilterRelationsConversionResult}.
24
+ */
25
+ export declare function useConvertFilterRelations(initialFiltersOrFilterRelations: Filter[] | FilterRelations, onFiltersChange?: (filters: Filter[] | FilterRelations) => void): UseFilterRelationsConversionResult;
26
+ export {};
@@ -1,5 +1,5 @@
1
- import { Filter } from '@sisense/sdk-data';
2
1
  import { DashboardProps } from './types';
2
+ import { Filter, FilterRelations } from '@sisense/sdk-data';
3
3
  /**
4
4
  * Creates a new dashboard instance with its filters replaced by a new set of filters.
5
5
  *
@@ -13,10 +13,10 @@ import { DashboardProps } from './types';
13
13
  * const updatedDashboard = replaceFilters(existingDashboard, newFilters);
14
14
  * ```
15
15
  * @param dashboard - The original dashboard (`DashboardProps`) whose filters are to be replaced.
16
- * @param newFilters - An array of new filters to set on the dashboard.
16
+ * @param newFilters - An array of new filters or filter relations to set on the dashboard.
17
17
  * @returns A new dashboard instance with the updated filters.
18
18
  */
19
- export declare const replaceFilters: (dashboard: DashboardProps, newFilters: Filter[]) => DashboardProps;
19
+ export declare const replaceFilters: (dashboard: DashboardProps, newFilters: Filter[] | FilterRelations) => DashboardProps;
20
20
  /**
21
21
  * Creates a new dashboard instance with an additional filter added to its existing filters.
22
22
  *
@@ -52,19 +52,31 @@ export declare const addFilter: (dashboard: DashboardProps, newFilter: Filter) =
52
52
  */
53
53
  export declare const addFilters: (dashboard: DashboardProps, newFilters: Filter[]) => DashboardProps;
54
54
  /**
55
- * Creates a new dashboard instance with a specific filter modified.
55
+ * Creates a new dashboard instance with a specific filter replaced.
56
56
  *
57
- * This function searches for a filter with the same GUID as the provided `filterToModify` and replaces it with `newFilter`.
57
+ * This function searches for a filter with the same GUID as the provided `filterToReplace` and replaces it with `newFilter`.
58
58
  * This function does not modify the original dashboard; instead, it returns a new dashboard with the updated filters.
59
59
  *
60
60
  * @example
61
- * Modify a filter in a dashboard.
61
+ * Replace a filter in a dashboard.
62
62
  * ```ts
63
63
  * const existingDashboard: DashboardProps = {...};
64
- * const filterToModify: Filter = {...};
64
+ * const filterToReplace: Filter = {...};
65
65
  * const newFilter: Filter = {...};
66
- * const updatedDashboard = modifyFilter(existingDashboard, filterToModify, newFilter);
66
+ * const updatedDashboard = replaceFilter(existingDashboard, filterToReplace, newFilter);
67
67
  * ```
68
+ * @param dashboard - The original dashboard (`DashboardProps`) containing the filter to be replaced.
69
+ * @param filterToReplace - The existing filter to be replaced.
70
+ * @param newFilter - The new filter to replace the existing one.
71
+ * @returns A new dashboard instance with the specified filter replaced.
72
+ */
73
+ export declare const replaceFilter: (dashboard: DashboardProps, filterToReplace: Filter, newFilter: Filter) => DashboardProps;
74
+ /**
75
+ * Creates a new dashboard instance with a specific filter modified.
76
+ * Alias for `replaceFilter`.
77
+ *
78
+ * @deprecated Use {@link replaceFilter} instead
79
+ *
68
80
  * @param dashboard - The original dashboard (`DashboardProps`) containing the filter to modify.
69
81
  * @param filterToModify - The existing filter to be modified.
70
82
  * @param newFilter - The new filter to replace the existing one.
@@ -85,7 +97,25 @@ export declare const modifyFilter: (dashboard: DashboardProps, filterToModify: F
85
97
  * const updatedDashboard = removeFilter(existingDashboard, filterToRemove);
86
98
  * ```
87
99
  * @param dashboard - The original dashboard (`DashboardProps`) from which to remove the filter.
88
- * @param filter - The filter to be removed.
100
+ * @param filterToRemove - The filter to be removed.
89
101
  * @returns A new dashboard instance with the specified filter removed.
90
102
  */
91
- export declare const removeFilter: (dashboard: DashboardProps, filter: Filter) => DashboardProps;
103
+ export declare const removeFilter: (dashboard: DashboardProps, filterToRemove: Filter) => DashboardProps;
104
+ /**
105
+ * Creates a new dashboard instance with multiple filters removed.
106
+ *
107
+ * This function removes all filters with the same GUID as the provided filters from the dashboard's filters.
108
+ * This function does not modify the original dashboard; instead, it returns a new dashboard with the updated filters.
109
+ *
110
+ * @example
111
+ * Remove multiple filters from a dashboard.
112
+ * ```ts
113
+ * const existingDashboard: DashboardProps = {...};
114
+ * const filtersToRemove: Filter[] = [{...}, {...}, ...];
115
+ * const updatedDashboard = removeFilters(existingDashboard, filtersToRemove);
116
+ * ```
117
+ * @param dashboard - The original dashboard (`DashboardProps`) from which the specified filters are removed.
118
+ * @param filtersToRemove - An array of filters to remove.
119
+ * @returns A new dashboard instance with the specified filters removed.
120
+ */
121
+ export declare const removeFilters: (dashboard: DashboardProps, filtersToRemove: Filter[]) => DashboardProps;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { DashboardProps } from '../dashboard/types';
3
- import { Filter } from '@sisense/sdk-data';
3
+ import { Filter, FilterRelations } from '@sisense/sdk-data';
4
4
  export declare enum DashboardChangeType {
5
5
  /** Dashboard filters have been updated */
6
6
  FILTERS_UPDATE = "FILTERS.UPDATE",
@@ -9,7 +9,7 @@ export declare enum DashboardChangeType {
9
9
  }
10
10
  export type DashboardChangeAction = {
11
11
  type: DashboardChangeType.FILTERS_UPDATE;
12
- payload: Filter[];
12
+ payload: Filter[] | FilterRelations;
13
13
  } | {
14
14
  type: DashboardChangeType.UI_FILTERS_PANEL_COLLAPSE;
15
15
  payload: boolean;
@@ -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,8 +31,8 @@ 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
37
  /**
38
38
  * Callback to receive changes
@@ -95,7 +95,7 @@ export interface DashboardProps {
95
95
  /** The widgets to render in the dashboard */
96
96
  widgets: WidgetProps[];
97
97
  /** The dashboard filters to be applied to each of the widgets based on the widget filter options */
98
- filters?: Filter[];
98
+ filters?: Filter[] | FilterRelations;
99
99
  /** The default data source to use for the dashboard */
100
100
  defaultDataSource?: DataSource;
101
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
  };
@@ -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
  };
@@ -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>;
@@ -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';
@@ -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>;