@sisense/sdk-ui 1.6.0 → 1.7.1

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 (53) hide show
  1. package/dist/ai/api/chat-api-provider.d.ts +1 -1
  2. package/dist/ai/api/chat-history.d.ts +18 -0
  3. package/dist/ai/api/errors.d.ts +2 -0
  4. package/dist/ai/api/hooks.d.ts +2 -13
  5. package/dist/ai/api/types.d.ts +11 -9
  6. package/dist/ai/chat-style-provider.d.ts +15 -0
  7. package/dist/ai/chatbot.d.ts +7 -0
  8. package/dist/ai/{error-page.d.ts → common/error-container.d.ts} +1 -1
  9. package/dist/ai/suggestions/suggestion-item.d.ts +1 -2
  10. package/dist/ai/use-chat-session.d.ts +1 -0
  11. package/dist/ai.js +2064 -3702
  12. package/dist/alert-box/alert-box.d.ts +1 -1
  13. package/dist/app/client-application.d.ts +40 -0
  14. package/dist/app/settings/settings.d.ts +1 -1
  15. package/dist/boxplot-utils.d.ts +2 -1
  16. package/dist/chart-options-processor/common-highcharts-option-service.d.ts +1 -1
  17. package/dist/chart-options-processor/translations/base-design-options.d.ts +1 -0
  18. package/dist/charts/indicator/indicator-legacy-chart-options/legacy-chart-options-to-theme-settings-dictionary.d.ts +2 -0
  19. package/dist/charts/indicator/indicator-legacy-chart-options/override-with-value-color.d.ts +1 -2
  20. package/dist/common/hooks/use-fetch.d.ts +42 -0
  21. package/dist/const.d.ts +1 -0
  22. package/dist/dashboard-widget/dashboard-widget.d.ts +2 -1
  23. package/dist/dynamic-size-container/dynamic-size-container.d.ts +4 -3
  24. package/dist/formulas/use-get-shared-formula.d.ts +2 -1
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +4707 -4459
  27. package/dist/models/dashboard/use-get-dashboard-model.d.ts +2 -1
  28. package/dist/models/dashboard/use-get-dashboard-models.d.ts +2 -1
  29. package/dist/models/widget/use-get-widget-model.d.ts +2 -1
  30. package/dist/models/widget/widget-model.d.ts +2 -1
  31. package/dist/pivot-table/formatters/data-cell-formatters/data-cell-value-formatter.d.ts +3 -0
  32. package/dist/pivot-table/formatters/data-cell-formatters/index.d.ts +1 -0
  33. package/dist/pivot-table/formatters/header-cell-formatters/header-cell-value-formatter.d.ts +3 -0
  34. package/dist/pivot-table/formatters/header-cell-formatters/index.d.ts +1 -0
  35. package/dist/pivot-table/formatters/index.d.ts +2 -0
  36. package/dist/pivot-table/formatters/types.d.ts +4 -0
  37. package/dist/pivot-table/formatters/utils.d.ts +5 -0
  38. package/dist/pivot-table/sorting-utils.d.ts +56 -0
  39. package/dist/pivot-table/use-apply-pivot-table-formatting.d.ts +11 -0
  40. package/dist/pivot-table/use-get-pivot-table-query.d.ts +1 -1
  41. package/dist/props.d.ts +3 -2
  42. package/dist/query/execute-query.d.ts +5 -5
  43. package/dist/query-execution/execute-query-by-widget-id.d.ts +2 -1
  44. package/dist/query-execution/index.d.ts +2 -1
  45. package/dist/query-execution/query-params-comparator.d.ts +8 -0
  46. package/dist/query-execution/types.d.ts +7 -0
  47. package/dist/query-execution/use-execute-query-by-widget-id.d.ts +2 -1
  48. package/dist/query-execution/use-execute-query.d.ts +3 -10
  49. package/dist/query-execution/use-query-cache.d.ts +10 -0
  50. package/dist/sisense-context/sisense-query-client-provider.d.ts +2 -0
  51. package/dist/{with-tracking-e2a077f9.js → useQuery-a7ee8c12.js} +70365 -58171
  52. package/dist/utils/create-cache.d.ts +33 -0
  53. package/package.json +8 -8
@@ -96,7 +96,8 @@ export type DashboardModelSuccessState = {
96
96
  ```
97
97
  * @param params - Parameters of the dashboard to be retrieved
98
98
  * @returns Dashboard load state that contains the status of the execution, the result dashboard model, or the error if any
99
- * @group Fusion Assets
99
+ * @group Fusion Embed
100
+ * @fusionEmbed
100
101
  */
101
102
  export declare const useGetDashboardModel: (params: GetDashboardModelParams) => DashboardModelState;
102
103
  /**
@@ -81,7 +81,8 @@ export type DashboardModelsSuccessState = {
81
81
  ```
82
82
  * @param params - Parameters of the dashboards to be retrieved
83
83
  * @returns Load state that contains the status of the execution, the result dashboards, or the error if any
84
- * @group Fusion Assets
84
+ * @group Fusion Embed
85
+ * @fusionEmbed
85
86
  */
86
87
  export declare const useGetDashboardModels: (params?: GetDashboardModelsParams | undefined) => DashboardModelsState;
87
88
  /**
@@ -93,7 +93,8 @@ export type WidgetModelSuccessState = {
93
93
  ```
94
94
  * @param params - Parameters of the widget to be retrieved
95
95
  * @returns Widget load state that contains the status of the execution, the result widget model, or the error if one has occurred
96
- * @group Fusion Assets
96
+ * @group Fusion Embed
97
+ * @fusionEmbed
97
98
  */
98
99
  export declare const useGetWidgetModel: (params: GetWidgetModelParams) => WidgetModelState;
99
100
  /**
@@ -11,7 +11,8 @@ export type WidgetDataOptions = ChartDataOptions | TableDataOptions;
11
11
  /**
12
12
  * Model of Sisense widget defined in the abstractions of Compose SDK.
13
13
  *
14
- * @group Fusion Assets
14
+ * @group Fusion Embed
15
+ * @fusionEmbed
15
16
  */
16
17
  export declare class WidgetModel {
17
18
  /**
@@ -0,0 +1,3 @@
1
+ import { type PivotTableDataOptions } from '../../../chart-data-options/types.js';
2
+ import { type DataCellFormatter } from '../types.js';
3
+ export declare const createDataCellValueFormatter: (dataOptions: PivotTableDataOptions) => DataCellFormatter;
@@ -0,0 +1 @@
1
+ export { createDataCellValueFormatter } from './data-cell-value-formatter.js';
@@ -0,0 +1,3 @@
1
+ import type { PivotTableDataOptions } from '../../../chart-data-options/types.js';
2
+ import type { DateFormatter, HeaderCellFormatter } from '../types.js';
3
+ export declare const createHeaderCellValueFormatter: (dataOptions: PivotTableDataOptions, dateFormatter: DateFormatter) => HeaderCellFormatter;
@@ -0,0 +1 @@
1
+ export { createHeaderCellValueFormatter } from './header-cell-value-formatter.js';
@@ -0,0 +1,2 @@
1
+ export * from './data-cell-formatters';
2
+ export * from './header-cell-formatters';
@@ -0,0 +1,4 @@
1
+ import type { JaqlPanel, PivotDataNode, PivotTreeNode } from '@sisense/sdk-pivot-client';
2
+ export type DataCellFormatter = (cell: PivotDataNode, rowItem: PivotTreeNode, columnItem: PivotTreeNode, jaqlPanelItem: JaqlPanel) => void;
3
+ export type HeaderCellFormatter = (cell: PivotTreeNode, jaqlPanelItem: JaqlPanel) => void;
4
+ export type DateFormatter = (date: Date, format: string) => string;
@@ -0,0 +1,5 @@
1
+ import { type Column } from '@sisense/sdk-data';
2
+ import { type PivotTableDataOptions, type StyledColumn, type AnyColumn } from '../../chart-data-options/types';
3
+ export declare const getPivotDataOptionByJaqlIndex: (dataOptions: PivotTableDataOptions, dataOptionIndex?: number) => AnyColumn | undefined;
4
+ export declare const getNumberFormatConfig: (dataOption?: AnyColumn) => Required<import("../..").NumberFormatConfig>;
5
+ export declare const getDateFormatConfig: (dataOption: Column | StyledColumn) => string;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * This file contain sorting functionality ported from the existing Analytics.
3
+ * It directly works with pivot JAQL to apply sorting.
4
+ *
5
+ * It will be fully refactored soon by using a different approach of applying sorting on Pivot internal data options.
6
+ */
7
+ import { JaqlRequest, type SortingSettingsChangePayload } from '@sisense/sdk-pivot-client';
8
+ export declare function normalizeJaqlSorting(jaql: JaqlRequest): {
9
+ metadata: (import("@sisense/sdk-pivot-client").JaqlPanel | {
10
+ jaql: {
11
+ sortDetails: {
12
+ initialized: boolean;
13
+ field: any;
14
+ dir: any;
15
+ measurePath: null;
16
+ sortingLastDimension: any;
17
+ };
18
+ title: string;
19
+ dim: string;
20
+ datatype: string;
21
+ sort?: string | null | undefined;
22
+ type?: string | undefined;
23
+ table?: string | undefined;
24
+ column?: string | undefined;
25
+ };
26
+ panel: string;
27
+ field?: {
28
+ id?: string | undefined;
29
+ index?: number | undefined;
30
+ } | undefined;
31
+ disabled?: boolean | undefined;
32
+ hierarchies?: string[] | undefined;
33
+ format?: {
34
+ subtotal?: boolean | undefined;
35
+ width?: number | undefined;
36
+ databars?: boolean | undefined;
37
+ color?: {
38
+ type: string;
39
+ color?: string | undefined;
40
+ conditions?: {
41
+ color: string;
42
+ operator: string;
43
+ expression: string | Record<string, any>;
44
+ }[] | undefined;
45
+ } | undefined;
46
+ } | undefined;
47
+ })[];
48
+ datasource?: import("@sisense/sdk-pivot-client/dist/data-load/types").JaqlDatasource | undefined;
49
+ queryGuid?: string | undefined;
50
+ grandTotals?: {
51
+ title: string;
52
+ columns?: boolean | undefined;
53
+ rows?: boolean | undefined;
54
+ } | null | undefined;
55
+ };
56
+ export declare function prepareSortedJaql(jaql: JaqlRequest, { type, settings, sortDetails, isSingleRowTree }: SortingSettingsChangePayload): JaqlRequest;
@@ -0,0 +1,11 @@
1
+ import { type DataService } from '@sisense/sdk-pivot-client';
2
+ import { type PivotTableDataOptions } from '../chart-data-options/types';
3
+ /**
4
+ * A hook that applies formatting over pivot table cells.
5
+ *
6
+ * @internal
7
+ */
8
+ export declare const useApplyPivotTableFormatting: ({ dataService, dataOptions, }: {
9
+ dataService: DataService;
10
+ dataOptions: PivotTableDataOptions;
11
+ }) => void;
@@ -1,5 +1,5 @@
1
1
  import { PivotTableProps } from '../props';
2
- import { JaqlRequest } from '@sisense/sdk-pivot-client';
2
+ import { type JaqlRequest } from '@sisense/sdk-pivot-client';
3
3
  /**
4
4
  * A hook that returns the JAQL request object from pivot table props.
5
5
  *
package/dist/props.d.ts CHANGED
@@ -4,9 +4,10 @@ import { HighchartsOptions } from './chart-options-processor/chart-options-servi
4
4
  import { ComponentType, PropsWithChildren, ReactNode } from 'react';
5
5
  import { IndicatorChartDataOptions, BoxplotChartCustomDataOptions, BoxplotChartDataOptions, ScatterChartDataOptions, TableDataOptions, ScattermapChartDataOptions, AreamapChartDataOptions, PivotTableDataOptions } from './chart-data-options/types';
6
6
  import { AppConfig } from './app/client-application';
7
- import { ExecuteQueryParams, QueryByWidgetIdState, QueryState } from './query-execution';
7
+ import { ExecuteQueryParams, QueryByWidgetIdState } from './query-execution';
8
8
  import { FiltersMergeStrategy } from './dashboard-widget/types';
9
9
  import { HookEnableParam } from './common/hooks/types';
10
+ import { ExecuteQueryResult } from './query-execution/types';
10
11
  export type { MenuItemSection, HighchartsOptions };
11
12
  /**
12
13
  * Configurations for Sisense Context
@@ -99,7 +100,7 @@ export interface ExecuteQueryProps {
99
100
  /** {@inheritDoc ExecuteQueryParams.offset} */
100
101
  offset?: number;
101
102
  /** Function as child component that is called to render the query results */
102
- children?: (queryState: QueryState) => ReactNode;
103
+ children?: (queryResult: ExecuteQueryResult) => ReactNode;
103
104
  /** Callback function that is evaluated when query results are ready */
104
105
  onDataChanged?: (data: QueryResultData) => void;
105
106
  /** {@inheritDoc ExecuteQueryParams.onBeforeQuery} */
@@ -1,3 +1,4 @@
1
+ import { CreateCacheKeyFn } from '../utils/create-cache';
1
2
  import { Attribute, Measure, PivotAttribute, PivotMeasure, PivotQueryResultData, QueryResultData } from '@sisense/sdk-data';
2
3
  import type { QueryDescription as InternalQueryDescription, PivotQueryDescription as InternalPivotQueryDescription, QueryExecutionConfig } from '@sisense/sdk-query-client';
3
4
  import { ClientApplication } from '../app/client-application';
@@ -25,12 +26,11 @@ export type PivotQueryDescription = Partial<Omit<InternalPivotQueryDescription,
25
26
  values?: (Measure | PivotMeasure)[];
26
27
  };
27
28
  /** @internal */
28
- export declare const QUERY_DEFAULT_LIMIT = 20000;
29
- /** @internal */
30
- export declare const QUERY_DEFAULT_OFFSET = 0;
31
- /** @internal */
32
- export declare const executeQuery: (queryDescription: QueryDescription, app: ClientApplication, executionConfig?: QueryExecutionConfig) => Promise<QueryResultData>;
29
+ export declare function executeQuery(queryDescription: QueryDescription, app: ClientApplication, executionConfig?: QueryExecutionConfig): Promise<QueryResultData>;
33
30
  /** @internal */
34
31
  export declare const executeCsvQuery: (queryDescription: QueryDescription, app: ClientApplication, executionConfig?: QueryExecutionConfig) => Promise<Blob>;
35
32
  /** @internal */
36
33
  export declare const executePivotQuery: (queryDescription: PivotQueryDescription, app: ClientApplication, executionConfig?: QueryExecutionConfig) => Promise<PivotQueryResultData>;
34
+ export declare const createExecuteQueryCacheKey: CreateCacheKeyFn<typeof executeQuery>;
35
+ export declare const executeQueryWithCache: typeof executeQuery;
36
+ export declare const clearExecuteQueryCache: (specificKey?: string | undefined) => void;
@@ -33,6 +33,7 @@ import { ExecuteQueryByWidgetIdProps } from '../props';
33
33
  * ```
34
34
  * @param props - ExecuteQueryByWidgetId properties
35
35
  * @returns ExecuteQueryByWidgetId component
36
- * @group Fusion Assets
36
+ * @group Fusion Embed
37
+ * @fusionEmbed
37
38
  */
38
39
  export declare const ExecuteQueryByWidgetId: FunctionComponent<ExecuteQueryByWidgetIdProps>;
@@ -4,4 +4,5 @@ export { useExecuteCsvQuery } from './use-execute-csv-query';
4
4
  export { ExecuteQueryByWidgetId } from './execute-query-by-widget-id';
5
5
  export { useExecuteQueryByWidgetId, executeQueryByWidgetId, } from './use-execute-query-by-widget-id';
6
6
  export { useExecutePivotQuery } from './use-execute-pivot-query';
7
- export type { QueryState, QueryLoadingState, QuerySuccessState, QueryErrorState, CsvQueryState, CsvQueryLoadingState, CsvQuerySuccessState, CsvQueryErrorState, PivotQueryState, PivotQueryLoadingState, PivotQuerySuccessState, PivotQueryErrorState, ExecuteQueryParams, ExecuteCsvQueryParams, ExecuteCSVQueryConfig, ExecuteQueryByWidgetIdParams, QueryByWidgetIdState, ExecutePivotQueryParams, } from './types';
7
+ export { useQueryCache } from './use-query-cache';
8
+ export type { QueryState, QueryLoadingState, QuerySuccessState, QueryErrorState, CsvQueryState, CsvQueryLoadingState, CsvQuerySuccessState, CsvQueryErrorState, PivotQueryState, PivotQueryLoadingState, PivotQuerySuccessState, PivotQueryErrorState, ExecuteQueryParams, ExecuteQueryResult, ExecuteCsvQueryParams, ExecuteCSVQueryConfig, ExecuteQueryByWidgetIdParams, QueryByWidgetIdState, ExecutePivotQueryParams, } from './types';
@@ -0,0 +1,8 @@
1
+ import { ExecuteQueryParams } from '../index.js';
2
+ /**
3
+ * Checks if the query parameters have changed by deep comparison.
4
+ *
5
+ * @param prevParams - Previous query parameters
6
+ * @param newParams - New query parameters
7
+ */
8
+ export declare function isQueryParamsChanged(prevParams: ExecuteQueryParams | undefined, newParams: ExecuteQueryParams): boolean;
@@ -207,6 +207,13 @@ export interface ExecuteQueryParams {
207
207
  */
208
208
  onBeforeQuery?: (jaql: any) => any | Promise<any>;
209
209
  }
210
+ /**
211
+ * Result of a query execution.
212
+ */
213
+ export type ExecuteQueryResult = QueryState & {
214
+ /** Function to refetch the query */
215
+ refetch: () => void;
216
+ };
210
217
  /** Configuration for {@link useExecuteCsvQuery} hook. */
211
218
  export type ExecuteCSVQueryConfig = {
212
219
  /**
@@ -28,7 +28,8 @@ import { ExecuteQueryByWidgetIdParams, QueryByWidgetIdState } from './types';
28
28
  * See also hook {@link useExecuteQuery}, which execute a query specified in code.
29
29
  * @param params - Parameters to identify the target widget
30
30
  * @returns Query state that contains the status of the query execution, the result data, the constructed query parameters, or the error if any occurred
31
- * @group Fusion Assets
31
+ * @group Fusion Embed
32
+ * @fusionEmbed
32
33
  */
33
34
  export declare const useExecuteQueryByWidgetId: (params: ExecuteQueryByWidgetIdParams) => QueryByWidgetIdState;
34
35
  /**
@@ -1,4 +1,4 @@
1
- import { ExecuteQueryParams, QueryState } from './types';
1
+ import { ExecuteQueryParams, ExecuteQueryResult } from './types';
2
2
  /**
3
3
  * React hook that executes a data query.
4
4
  * This approach, which offers an alternative to {@link ExecuteQuery} component, is similar to React Query's `useQuery` hook.
@@ -31,17 +31,10 @@ import { ExecuteQueryParams, QueryState } from './types';
31
31
  * @returns Query state that contains the status of the query execution, the result data, or the error if any occurred
32
32
  * @group Queries
33
33
  */
34
- export declare const useExecuteQuery: (params: ExecuteQueryParams) => QueryState;
34
+ export declare const useExecuteQuery: (params: ExecuteQueryParams) => ExecuteQueryResult;
35
35
  /**
36
36
  * {@link useExecuteQuery} without tracking to be used inside other hooks or components in Compose SDK.
37
37
  *
38
38
  * @internal
39
39
  */
40
- export declare function useExecuteQueryInternal(params: ExecuteQueryParams): QueryState;
41
- /**
42
- * Checks if the query parameters have changed by deep comparison.
43
- *
44
- * @param prevParams - Previous query parameters
45
- * @param newParams - New query parameters
46
- */
47
- export declare function isQueryParamsChanged(prevParams: ExecuteQueryParams | undefined, newParams: ExecuteQueryParams): boolean;
40
+ export declare function useExecuteQueryInternal(params: ExecuteQueryParams): ExecuteQueryResult;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * React hook that returns the instance to manage query cache.
3
+ *
4
+ * @returns Query cache
5
+ * @group Queries
6
+ * @alpha
7
+ */
8
+ export declare function useQueryCache(): {
9
+ clear: () => void;
10
+ } | undefined;
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren, type FunctionComponent } from 'react';
2
+ export declare const SisenseQueryClientProvider: FunctionComponent<PropsWithChildren>;