@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,5 +1,6 @@
1
1
  import { GetNlgQueryResultRequest } from '../../ai';
2
2
  export interface ChartInsightsProps {
3
+ summary: string;
3
4
  nlgRequest: GetNlgQueryResultRequest;
4
5
  }
5
- export declare const ChartInsights: ({ nlgRequest }: ChartInsightsProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const ChartInsights: ({ summary, nlgRequest }: ChartInsightsProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Filter } from '@sisense/sdk-data';
1
+ import { Filter, Data } from '@sisense/sdk-data';
2
2
  import type { NlqResponseData } from '../../ai';
3
3
  /**
4
4
  * Props for {@link NlqChartWidget} component.
@@ -15,6 +15,11 @@ export interface NlqChartWidgetProps {
15
15
  * The dashboard filters to be applied to the chart
16
16
  */
17
17
  filters?: Filter[];
18
+ /**
19
+ * A callback that allows to modify data immediately after it has been retrieved.
20
+ * Can be used to inject modification of queried data.
21
+ */
22
+ onDataReady?: (data: Data) => Data;
18
23
  }
19
24
  /**
20
25
  * React component that renders a chart widget based on NLQ response data.
@@ -38,4 +43,4 @@ export interface NlqChartWidgetProps {
38
43
  * @group Generative AI
39
44
  * @internal
40
45
  */
41
- export declare const NlqChartWidget: ({ nlqResponse, filters }: NlqChartWidgetProps) => import("react/jsx-runtime").JSX.Element;
46
+ export declare const NlqChartWidget: ({ nlqResponse, onDataReady, filters }: NlqChartWidgetProps) => import("react/jsx-runtime").JSX.Element;
@@ -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,3 @@
1
+ export default function ExclamationMarkBrandIcon({ fill, }: {
2
+ fill?: string | '#fa5656' | '#1de4eb';
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -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;
@@ -1,4 +1,5 @@
1
1
  import { ExpandedQueryModel, SimpleQueryModel } from '../types.js';
2
+ import { DynamicChartType } from '../../chart-options-processor/translations/types.js';
2
3
  export declare function toKebabCase(str: string): string;
3
4
  export declare function capitalizeFirstLetter(str: string): string;
4
5
  /**
@@ -11,3 +12,4 @@ export declare function sanitizeDimensionId(str: string): string;
11
12
  export declare function validateQueryModel(model: any): SimpleQueryModel;
12
13
  export declare function isEmptyQueryModel(queryModel: ExpandedQueryModel | undefined | null): boolean;
13
14
  export declare function escapeSingleQuotes(str?: string): string | undefined;
15
+ export declare function validateChartType(chartType: DynamicChartType): void;
@@ -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,6 +1,8 @@
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';
5
+ import { DynamicChartType } from '../chart-options-processor/translations/types.js';
4
6
  export type KeysOfUnion<T> = T extends T ? keyof T : never;
5
7
  export type AllPossibleChartOptionKeys = KeysOfUnion<ChartDataOptions>;
6
8
  export type AxesMappingKey = Exclude<AllPossibleChartOptionKeys, 'seriesToColorMap'>;
@@ -22,6 +24,8 @@ export interface ExpandedQueryModel {
22
24
  chartRecommendations: ChartRecommendations | {};
23
25
  jaql: {
24
26
  datasource: {
27
+ id?: string;
28
+ type?: 'elasticube' | 'live';
25
29
  title: string;
26
30
  };
27
31
  metadata: MetadataItem[];
@@ -82,7 +86,7 @@ export type UiFramework = 'react' | 'vue' | 'angular';
82
86
  * Code Template Key
83
87
  * @internal
84
88
  */
85
- export type CodeTemplateKey = 'baseChartTmpl' | 'chartTmpl' | 'chartWidgetTmpl' | 'widgetByIdTmpl';
89
+ export type CodeTemplateKey = 'baseChartTmpl' | 'chartTmpl' | 'chartWidgetTmpl' | 'widgetByIdTmpl' | 'executeQueryByWidgetIdTmpl' | 'executeQueryTmpl';
86
90
  /**
87
91
  * Code Templates
88
92
  * @internal
@@ -115,7 +119,7 @@ export type WidgetCodeConfig = BaseCodeConfig & {
115
119
  * Client-side Widget Code Params
116
120
  * @internal
117
121
  */
118
- export type ClientSideWidgetCodeParams = WidgetCodeConfig & {
122
+ export type ClientSideWidgetCodeParams = BaseCodeConfig & {
119
123
  widgetProps: WidgetProps;
120
124
  };
121
125
  /**
@@ -125,6 +129,7 @@ export type ClientSideWidgetCodeParams = WidgetCodeConfig & {
125
129
  export type ByIdWidgetCodeParams = WidgetCodeConfig & {
126
130
  dashboardOid: string;
127
131
  widgetOid: string;
132
+ chartType: DynamicChartType;
128
133
  };
129
134
  /**
130
135
  * Widget Code Params
@@ -147,3 +152,9 @@ export declare const isByIdWidgetCodeParams: (params: WidgetCodeParams) => param
147
152
  export type WidgetPropsConfig = {
148
153
  useCustomizedStyleOptions?: boolean;
149
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
- export declare const toWidgetCodeById: ({ dashboardOid, widgetOid, uiFramework, }: ByIdWidgetCodeParams) => string;
2
+ export declare const toWidgetCodeById: ({ dashboardOid, widgetOid, uiFramework, chartType, includeChart, }: ByIdWidgetCodeParams) => string;
3
3
  export declare const toWidgetCodeClientSide: ({ widgetProps, uiFramework, }: ClientSideWidgetCodeParams) => string;
@@ -2,6 +2,7 @@ import { WidgetProps } from '../../props.js';
2
2
  import { ExpandedQueryModel, WidgetCodeParams, WidgetPropsConfig } from '../types.js';
3
3
  /**
4
4
  * Converts query model to widget props.
5
+ *
5
6
  * @param queryModel - Expanded query model
6
7
  * @returns Widget props
7
8
  */
@@ -3,6 +3,7 @@ import { FeatureCollection as GeoJsonFeatureCollection } from 'geojson';
3
3
  import { type DataSource } from '@sisense/sdk-data';
4
4
  import { HierarchyDto, WidgetDto } from '../widget-by-id/types';
5
5
  import type { DashboardDto } from './types/dashboard-dto';
6
+ import { TranslatableError } from '../translation/translatable-error';
6
7
  import { PaletteDto } from '../api/types/palette-dto';
7
8
  import { GetHierarchiesOptions } from '../models/hierarchy/types';
8
9
  type GetDashboardsOptions = {
@@ -20,7 +21,19 @@ export declare class RestApi {
20
21
  /**
21
22
  * Get all dashboards
22
23
  */
23
- 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)[]>;
24
37
  /**
25
38
  * Get a specific dashboard
26
39
  */
@@ -53,6 +66,16 @@ export declare class RestApi {
53
66
  * Partially update a dashboard
54
67
  */
55
68
  patchDashboard: (dashboardOid: string, dashboard: Partial<DashboardDto>) => Promise<DashboardDto | undefined>;
69
+ /**
70
+ * Add widget to a dashboard
71
+ */
72
+ addWidgetToDashboard: (dashboardOid: string, widgetDto: WidgetDto) => Promise<WidgetDto | undefined>;
73
+ }
74
+ export declare const useRestApi: () => {
75
+ restApi: RestApi | undefined;
76
+ isReady: boolean;
77
+ };
78
+ export declare class RestApiNotReadyError extends TranslatableError {
79
+ constructor();
56
80
  }
57
- export declare const useGetApi: () => RestApi;
58
81
  export {};
@@ -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 {};
@@ -4,4 +4,4 @@ import { RegularChartProps } from '../props.js';
4
4
  * @param props
5
5
  * @returns
6
6
  */
7
- export declare const AdvancedChart: (props: RegularChartProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const AdvancedChart: (props: RegularChartProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,3 +1,4 @@
1
+ import { Data } from '@sisense/sdk-data';
1
2
  import { RegularChartProps } from '../props';
2
3
  /**
3
4
  *
@@ -5,3 +6,5 @@ import { RegularChartProps } from '../props';
5
6
  * @returns
6
7
  */
7
8
  export declare const RegularChart: (props: RegularChartProps) => import("react/jsx-runtime").JSX.Element | null;
9
+ /** Type guard for Data */
10
+ export declare function isData(data: any): data is Data;
@@ -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",
@@ -3,6 +3,7 @@ import { ChartType, OptionsWithAlerts, CompleteThemeSettings } from '../types';
3
3
  import { CategoricalChartData } from '../chart-data/types';
4
4
  import { HighchartsOptionsInternal } from './chart-options-service';
5
5
  import { ChartDataOptionsInternal } from '../chart-data-options/types';
6
+ import { TFunction } from '@sisense/sdk-common';
6
7
  /**
7
8
  * Convert intermediate chart data, data options, and design options
8
9
  * into pure highcharts config data.
@@ -13,4 +14,4 @@ import { ChartDataOptionsInternal } from '../chart-data-options/types';
13
14
  * @param dataOptions -
14
15
  * @param themeSettings -
15
16
  */
16
- export declare const getCategoricalChartOptions: (chartData: CategoricalChartData, chartType: ChartType, chartDesignOptions: ChartDesignOptions, dataOptions: ChartDataOptionsInternal, themeSettings?: CompleteThemeSettings) => OptionsWithAlerts<HighchartsOptionsInternal>;
17
+ export declare const getCategoricalChartOptions: (chartData: CategoricalChartData, chartType: ChartType, chartDesignOptions: ChartDesignOptions, dataOptions: ChartDataOptionsInternal, translate: TFunction, themeSettings?: CompleteThemeSettings) => OptionsWithAlerts<HighchartsOptionsInternal>;
@@ -3,4 +3,5 @@ import { HighchartsOptionsInternal } from '../../chart-options-service';
3
3
  import { CategoricalChartDataOptionsInternal } from '../../../chart-data-options/types';
4
4
  import { CompleteThemeSettings } from '../../../types';
5
5
  import { SunburstChartDesignOptions } from '../design-options';
6
- export declare function prepareSunburstOptions(chartData: CategoricalChartData, dataOptions: CategoricalChartDataOptionsInternal, designOptions: SunburstChartDesignOptions, themeSettings?: CompleteThemeSettings): HighchartsOptionsInternal;
6
+ import { TFunction } from '@sisense/sdk-common';
7
+ export declare function prepareSunburstOptions(chartData: CategoricalChartData, dataOptions: CategoricalChartDataOptionsInternal, designOptions: SunburstChartDesignOptions, translate: TFunction, themeSettings?: CompleteThemeSettings): HighchartsOptionsInternal;
@@ -3,4 +3,5 @@ import { HighchartsOptionsInternal } from '../../chart-options-service';
3
3
  import { CategoricalChartDataOptionsInternal } from '../../../chart-data-options/types';
4
4
  import { CompleteThemeSettings } from '../../../types';
5
5
  import { TreemapChartDesignOptions } from '../design-options';
6
- export declare function prepareTreemapOptions(chartData: CategoricalChartData, dataOptions: CategoricalChartDataOptionsInternal, designOptions: TreemapChartDesignOptions, themeSettings?: CompleteThemeSettings): HighchartsOptionsInternal;
6
+ import { TFunction } from '@sisense/sdk-common';
7
+ export declare function prepareTreemapOptions(chartData: CategoricalChartData, dataOptions: CategoricalChartDataOptionsInternal, designOptions: TreemapChartDesignOptions, translate: TFunction, themeSettings?: CompleteThemeSettings): HighchartsOptionsInternal;
@@ -2,11 +2,12 @@ import { CategoricalChartDataOptionsInternal } from '../../../chart-data-options
2
2
  import { TreemapChartDesignOptions } from '../design-options';
3
3
  import { TooltipSettings } from '../../tooltip';
4
4
  import { TooltipFormatterContextObject } from '@sisense/sisense-charts';
5
+ import { TFunction } from '@sisense/sdk-common';
5
6
  type TooltipFormatterOptions = {
6
7
  displayTotalContribution: boolean;
7
8
  displayColorCircles: boolean;
8
9
  shouldSkip: (context: TooltipFormatterContextObject) => boolean;
9
10
  };
10
- export declare const getTreemapTooltipSettings: (chartDataOptions: CategoricalChartDataOptionsInternal, designOptions: TreemapChartDesignOptions, formatterOptions?: TooltipFormatterOptions) => TooltipSettings;
11
- export declare function treemapTooltipFormatter(context: TooltipFormatterContextObject, chartDataOptions: CategoricalChartDataOptionsInternal, designOptions: TreemapChartDesignOptions, formatterOptions?: TooltipFormatterOptions): string | false;
11
+ export declare const getTreemapTooltipSettings: (chartDataOptions: CategoricalChartDataOptionsInternal, designOptions: TreemapChartDesignOptions, translate: TFunction, formatterOptions?: TooltipFormatterOptions) => TooltipSettings;
12
+ export declare function treemapTooltipFormatter(context: TooltipFormatterContextObject, chartDataOptions: CategoricalChartDataOptionsInternal, designOptions: TreemapChartDesignOptions, translate: TFunction, formatterOptions?: TooltipFormatterOptions): string | false;
12
13
  export {};
@@ -64,4 +64,6 @@ export declare const isTable: (chartType: ChartType | TableType) => chartType is
64
64
  export declare const isBoxplot: (chartType: ChartType) => chartType is "boxplot";
65
65
  export declare const isAreamap: (chartType: ChartType) => chartType is "areamap";
66
66
  export declare const isRange: (chartType: ChartType) => chartType is "arearange";
67
+ export declare const ALL_CHART_TYPES: readonly ["line", "area", "bar", "column", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "image", "scattermap", "arearange"];
68
+ export type DynamicChartType = (typeof ALL_CHART_TYPES)[number];
67
69
  export {};
@@ -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,2 +1,2 @@
1
1
  import { DashboardContainerProps } from '../../dashboard/types';
2
- export declare const DashboardContainer: ({ title, layoutOptions, config, widgets, filters, onFiltersChange, defaultDataSource, }: DashboardContainerProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const DashboardContainer: ({ title, layoutOptions, config, widgets, filters, onFiltersChange, defaultDataSource, onChange, }: DashboardContainerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const HorizontalCollapse: ({ collapsed, onCollapsedChange, children, }: {
3
+ collapsed?: boolean | undefined;
4
+ onCollapsedChange?: ((collapsed: boolean) => void) | undefined;
5
+ children: ReactNode;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -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,13 +1,18 @@
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
- FILTERS_UPDATE = "FILTERS.UPDATE"
6
+ FILTERS_UPDATE = "FILTERS.UPDATE",
7
+ /** Filters panel collapsed state changed */
8
+ UI_FILTERS_PANEL_COLLAPSE = "UI.FILTERS.PANEL.COLLAPSE"
7
9
  }
8
10
  export type DashboardChangeAction = {
9
11
  type: DashboardChangeType.FILTERS_UPDATE;
10
- payload: Filter[];
12
+ payload: Filter[] | FilterRelations;
13
+ } | {
14
+ type: DashboardChangeType.UI_FILTERS_PANEL_COLLAPSE;
15
+ payload: boolean;
11
16
  };
12
17
  /**
13
18
  * React component that renders a dashboard whose elements are customizable. It includes internal logic of applying common filters to widgets.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare const LS_KEY_FILTERS_PANEL_COLLAPSED = "csdk_dashboard_filters_panel_collapsed";
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare const useFiltersPanelCollapsedState: (initialState?: boolean, shouldUseLocalStorage?: boolean) => [boolean, (state: boolean) => void];