@sisense/sdk-ui-vue 1.32.0 → 1.33.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 (40) hide show
  1. package/dist/ai.cjs +388 -0
  2. package/dist/ai.d.ts +1 -0
  3. package/dist/ai.js +3838 -0
  4. package/dist/index.cjs +1 -1063
  5. package/dist/index.js +1277 -105403
  6. package/dist/packages/sdk-ui-vue/src/ai/components/chatbot.d.ts +73 -0
  7. package/dist/packages/sdk-ui-vue/src/ai/components/get-nlg-insights.d.ts +90 -0
  8. package/dist/packages/sdk-ui-vue/src/ai/components/index.d.ts +2 -0
  9. package/dist/packages/sdk-ui-vue/src/ai/composables/index.d.ts +3 -0
  10. package/dist/packages/sdk-ui-vue/src/ai/composables/use-get-nlg-insights.d.ts +45 -0
  11. package/dist/packages/sdk-ui-vue/src/ai/composables/use-get-nlq-result.d.ts +42 -0
  12. package/dist/packages/sdk-ui-vue/src/ai/composables/use-get-query-recommendations.d.ts +50 -0
  13. package/dist/packages/sdk-ui-vue/src/ai/index.d.ts +4 -0
  14. package/dist/packages/sdk-ui-vue/src/ai/providers/ai-context-provider.d.ts +60 -0
  15. package/dist/packages/sdk-ui-vue/src/ai/providers/index.d.ts +1 -0
  16. package/dist/packages/sdk-ui-vue/src/ai/sdk-ui-core-exports.d.ts +1 -0
  17. package/dist/packages/sdk-ui-vue/src/components/charts/chart.d.ts +4 -4
  18. package/dist/packages/sdk-ui-vue/src/components/dashboard/dashboard-by-id.d.ts +9 -8
  19. package/dist/packages/sdk-ui-vue/src/components/dashboard/dashboard.d.ts +13 -8
  20. package/dist/packages/sdk-ui-vue/src/components/widgets/chart-widget.d.ts +4 -4
  21. package/dist/packages/sdk-ui-vue/src/components/widgets/dashboard-widget.d.ts +4 -4
  22. package/dist/packages/sdk-ui-vue/src/components/widgets/widget-by-id.d.ts +4 -4
  23. package/dist/packages/sdk-ui-vue/src/composables/use-tracking.d.ts +15 -15
  24. package/dist/packages/sdk-ui-vue/src/lib.d.ts +1 -0
  25. package/dist/packages/sdk-ui-vue/src/providers/plugins-provider.d.ts +6 -2
  26. package/dist/packages/sdk-ui-vue/src/providers/sisense-context-provider.d.ts +2 -5
  27. package/dist/packages/sdk-ui-vue/src/providers/theme-provider.d.ts +2 -11
  28. package/dist/packages/sdk-ui-vue/src/sdk-ui-core-exports.d.ts +2 -2
  29. package/dist/packages/sdk-ui-vue/src/setup-helper.d.ts +13 -1
  30. package/dist/packages/sdk-ui-vue/src/types/dashboard-config.d.ts +24 -0
  31. package/dist/packages/sdk-ui-vue/src/types/index.d.ts +2 -0
  32. package/dist/packages/sdk-ui-vue/src/types/maybe-ref.d.ts +14 -0
  33. package/dist/packages/sdk-ui-vue/src/utilities/dashboard-helpers.d.ts +105 -0
  34. package/dist/packages/sdk-ui-vue/src/utilities/dashboard-model-translator.d.ts +37 -0
  35. package/dist/packages/sdk-ui-vue/src/utilities/index.d.ts +23 -0
  36. package/dist/packages/sdk-ui-vue/src/utilities/widget-model-translator.d.ts +247 -0
  37. package/dist/use-tracking-2d715e05.js +105710 -0
  38. package/dist/use-tracking-bc424435.cjs +1066 -0
  39. package/package.json +15 -2
  40. package/dist/packages/sdk-ui-vue/src/types.d.ts +0 -6
@@ -1,40 +1,40 @@
1
1
  /**
2
- * A Vue composable function `useTracking` designed to track the usage of hooks within Vue applications
3
- * using the Sisense SDK. It sends tracking information to the server whenever a specified hook is used,
2
+ * A Vue composable function `useTracking` designed to track the usage of composables within Vue applications
3
+ * using the Sisense SDK. It sends tracking information to the server whenever a specified composable is used,
4
4
  * helping in the analysis and optimization of application performance and usage patterns. This composable
5
- * is intended for internal use and aids in monitoring the integration and efficiency of Sisense SDK hooks.
5
+ * is intended for internal use and aids in monitoring the integration and efficiency of Sisense SDK composables.
6
6
  *
7
- * @param {string} hookName - The name of the hook being tracked. This identifier is used to log the hook
8
- * event uniquely, facilitating the collection of usage data for specific hooks within the application.
7
+ * @param {string} composableName - The name of the composable being tracked. This identifier is used to log the composable
8
+ * event uniquely, facilitating the collection of usage data for specific composables within the application.
9
9
  *
10
10
  * @example
11
- * How to use `useTracking` to track the usage of a custom hook:
11
+ * How to use `useTracking` to track the usage of a custom composable:
12
12
  * ```javascript
13
13
  * import { useTracking } from '@sisense/sdk-ui-vue';
14
14
  *
15
- * // Example hook that utilizes useTracking for monitoring its usage
16
- * export const useCustomHook = () => {
17
- * const { hasTrackedRef } = useTracking('useCustomHook');
15
+ * // Example composable that utilizes useTracking for monitoring its usage
16
+ * export const useCustomComposable = () => {
17
+ * const { hasTrackedRef } = useTracking('useCustomComposable');
18
18
  *
19
- * // Hook implementation...
19
+ * // composable implementation...
20
20
  *
21
21
  * return {
22
- * // Return values of your custom hook
22
+ * // Return values of your custom composable
23
23
  * };
24
24
  * };
25
25
  * ```
26
26
  *
27
27
  * The composable returns an object containing:
28
- * - `hasTrackedRef`: A Vue ref that indicates whether the tracking for the hook has been successfully
28
+ * - `hasTrackedRef`: A Vue ref that indicates whether the tracking for the composable has been successfully
29
29
  * sent to the server. It starts as `false` and is set to `true` once tracking is completed, preventing
30
30
  * duplicate tracking events.
31
31
  *
32
- * This internal utility composable is essential for maintaining insights into the usage of custom hooks
32
+ * This internal utility composable is essential for maintaining insights into the usage of custom composables
33
33
  * within applications leveraging the Sisense SDK, enabling developers and analysts to understand and optimize
34
- * hook interactions and performance.
34
+ * composable interactions and performance.
35
35
  *
36
36
  * @internal
37
37
  */
38
- export declare const useTracking: (hookName: string) => {
38
+ export declare const useTracking: (composableName: string) => {
39
39
  hasTrackedRef: import("vue").Ref<boolean>;
40
40
  };
@@ -10,3 +10,4 @@ export { type DrilldownWidgetProps } from './components/drilldown-widget';
10
10
  export * from './sdk-ui-core-exports';
11
11
  export * from './components/widgets';
12
12
  export * from './components/dashboard';
13
+ export * from './utilities';
@@ -16,8 +16,12 @@ export declare const getPluginsContext: () => Ref<{
16
16
  * @group Contexts
17
17
  * @internal
18
18
  */
19
- export declare const createPluginsContextConnector: (context: CustomPluginsContext) => {
20
- prepareContext(): Promise<CustomPluginsContext>;
19
+ export declare const createPluginsContextConnector: () => {
20
+ prepareContext(): Promise<{
21
+ pluginMap: Map<string, import("@sisense/sdk-ui-preact").PluginComponent<import("@sisense/sdk-ui-preact").PluginComponentProps<import("@sisense/sdk-ui-preact").GenericDataOptions, any>>> & Omit<Map<string, import("@sisense/sdk-ui-preact").PluginComponent<import("@sisense/sdk-ui-preact").PluginComponentProps<import("@sisense/sdk-ui-preact").GenericDataOptions, any>>>, keyof Map<any, any>>;
22
+ registerPlugin: (pluginType: string, plugin: import("@sisense/sdk-ui-preact").PluginComponent<import("@sisense/sdk-ui-preact").PluginComponentProps<import("@sisense/sdk-ui-preact").GenericDataOptions, any>>) => void;
23
+ getPlugin: (pluginType: string) => import("@sisense/sdk-ui-preact").PluginComponent<import("@sisense/sdk-ui-preact").PluginComponentProps<import("@sisense/sdk-ui-preact").GenericDataOptions, any>> | undefined;
24
+ }>;
21
25
  renderContextProvider: (contextData: CustomPluginsContext<any>, children: import("preact").VNode<{}>, error?: Error | undefined) => import("preact").VNode<{}>;
22
26
  };
23
27
  /**
@@ -1,5 +1,5 @@
1
1
  import type { PropType, Ref } from 'vue';
2
- import type { SisenseContextProviderProps as SisenseContextProviderPropsPreact } from '@sisense/sdk-ui-preact';
2
+ import type { ContextConnector, SisenseContextProviderProps as SisenseContextProviderPropsPreact } from '@sisense/sdk-ui-preact';
3
3
  import { type CustomSisenseContext } from '@sisense/sdk-ui-preact';
4
4
  /**
5
5
  * Configurations and authentication for Sisense Context.
@@ -21,10 +21,7 @@ export declare const getSisenseContext: () => Ref<import("@sisense/sdk-ui/dist/p
21
21
  * Creates Sisense context connector
22
22
  * @internal
23
23
  */
24
- export declare const createSisenseContextConnector: (context: CustomSisenseContext) => {
25
- prepareContext(): Promise<import("@sisense/sdk-ui/dist/packages/sdk-ui/src/sisense-context/sisense-context").SisenseContextPayload>;
26
- renderContextProvider: (contextData: import("@sisense/sdk-ui/dist/packages/sdk-ui/src/sisense-context/sisense-context").SisenseContextPayload | undefined, children: import("preact").VNode<{}>, error?: Error | undefined) => import("preact").VNode<{}>;
27
- };
24
+ export declare const createSisenseContextConnector: () => ContextConnector<CustomSisenseContext>;
28
25
  /**
29
26
  * Sisense Context Provider Component allowing you to connect to
30
27
  * a Sisense instance and provide that context
@@ -1,5 +1,5 @@
1
1
  import type { PropType, Ref } from 'vue';
2
- import type { CompleteThemeSettings, ThemeProviderProps as ThemeProviderPropsPreact } from '@sisense/sdk-ui-preact';
2
+ import type { CompleteThemeSettings, ContextConnector, CustomThemeProviderProps, ThemeProviderProps as ThemeProviderPropsPreact } from '@sisense/sdk-ui-preact';
3
3
  /**
4
4
  * {@inheritDoc @sisense/sdk-ui!ThemeProviderProps}
5
5
  */
@@ -13,16 +13,7 @@ export declare const getThemeContext: () => Ref<CompleteThemeSettings> | undefin
13
13
  * Creates theme context connector
14
14
  * @internal
15
15
  */
16
- export declare const createThemeContextConnector: (themeSettings?: CompleteThemeSettings) => {
17
- prepareContext(): Promise<{
18
- themeSettings: CompleteThemeSettings;
19
- skipTracking: boolean;
20
- }>;
21
- renderContextProvider: (contextData: {
22
- themeSettings: CompleteThemeSettings;
23
- skipTracking?: boolean | undefined;
24
- }, children: import("preact").VNode<{}>, error?: Error | undefined) => import("preact").VNode<{}>;
25
- };
16
+ export declare const createThemeContextConnector: () => ContextConnector<CustomThemeProviderProps['context']>;
26
17
  /**
27
18
  * Theme provider, which allows you to adjust the look and feel of child components.
28
19
  *
@@ -1,2 +1,2 @@
1
- export { boxWhiskerProcessResult, widgetModelTranslator, dashboardModelTranslator, dashboardHelpers, } from '@sisense/sdk-ui-preact';
2
- export type { ChartType, CartesianChartType, CategoricalChartType, ScatterChartType, IndicatorChartType, BoxplotChartType, ScattermapChartType, AreamapChartType, TableType, AreaSubtype, LineSubtype, PieSubtype, PolarSubtype, StackableSubtype, BoxplotSubtype, WidgetType, CartesianWidgetType, CategoricalWidgetType, TabularWidgetType, CommonWidgetProps, WidgetProps, ExecuteQueryByWidgetIdParams, ExecuteQueryParams, GetWidgetModelParams, GetSharedFormulaParams, GetDashboardModelParams, UseGetSharedFormulaParams, GetDashboardModelsParams, GetHierarchyModelsParams, ChartDataOptions, CartesianChartDataOptions, CategoricalChartDataOptions, ScatterChartDataOptions, IndicatorChartDataOptions, BoxplotChartDataOptions, BoxplotChartCustomDataOptions, ScattermapChartDataOptions, AreamapChartDataOptions, TableDataOptions, PivotTableDataOptions, WidgetDataOptions, NumberFormatConfig, DecimalScale, DataColorCondition, ConditionalDataColorOptions, DataColorOptions, RangeDataColorOptions, UniformDataColorOptions, ValueToColorMap, MultiColumnValueToColorMap, SortDirection, BoxWhiskerType, ScattermapLocationLevel, StyledColumn, StyledMeasureColumn, PivotRowsSort, ChartStyleOptions, LineStyleOptions, AreaStyleOptions, StackableStyleOptions, PieStyleOptions, FunnelStyleOptions, PolarStyleOptions, IndicatorStyleOptions, NumericSimpleIndicatorStyleOptions, NumericBarIndicatorStyleOptions, GaugeIndicatorStyleOptions, ScatterStyleOptions, TreemapStyleOptions, SunburstStyleOptions, BoxplotStyleOptions, ScattermapStyleOptions, AreamapStyleOptions, ChartWidgetStyleOptions, WidgetStyleOptions, DashboardWidgetStyleOptions, WidgetByIdStyleOptions, TableStyleOptions, PivotTableStyleOptions, AreaRangeStyleOptions, DataLimits, Legend, Markers, Labels, IndicatorComponents, ScatterMarkerSize, LineWidth, AxisLabel, Convolution, SeriesLabels, X2Title, ScattermapMarkers, WidgetModel, DashboardModel, BeforeRenderHandler, DataPoint, ScatterDataPoint, HighchartsOptions, BoxplotDataPoint, IndicatorBeforeRenderHandler, IndicatorRenderOptions, DashboardLayoutOptions, DashboardConfig, WidgetsPanelLayout, WidgetsPanelColumnLayout, WidgetId, WidgetsOptions, AppConfig, DateConfig, MenuItemSection, MonthOfYear, DayOfWeek, DateLevel, ThemeOid, GetDashboardModelOptions, GetDashboardModelsOptions, SeriesChartType, MenuPosition, ThemeSettings, Color, ColorPaletteTheme, Navigator, DrilldownOptions, DrilldownSelection, Member, FilterVariant, CriteriaFilterType, } from '@sisense/sdk-ui-preact';
1
+ export { boxWhiskerProcessResult } from '@sisense/sdk-ui-preact';
2
+ export type { ChartType, CartesianChartType, CategoricalChartType, ScatterChartType, IndicatorChartType, BoxplotChartType, ScattermapChartType, AreamapChartType, TableType, AreaSubtype, LineSubtype, PieSubtype, PolarSubtype, StackableSubtype, BoxplotSubtype, WidgetType, CartesianWidgetType, CategoricalWidgetType, TabularWidgetType, CommonWidgetProps, WidgetProps, ExecuteQueryByWidgetIdParams, ExecuteQueryParams, GetWidgetModelParams, GetSharedFormulaParams, GetDashboardModelParams, UseGetSharedFormulaParams, GetDashboardModelsParams, GetHierarchyModelsParams, ChartDataOptions, CartesianChartDataOptions, CategoricalChartDataOptions, ScatterChartDataOptions, IndicatorChartDataOptions, BoxplotChartDataOptions, BoxplotChartCustomDataOptions, ScattermapChartDataOptions, AreamapChartDataOptions, TableDataOptions, PivotTableDataOptions, WidgetDataOptions, NumberFormatConfig, DecimalScale, DataColorCondition, ConditionalDataColorOptions, DataColorOptions, RangeDataColorOptions, UniformDataColorOptions, ValueToColorMap, MultiColumnValueToColorMap, SortDirection, BoxWhiskerType, ScattermapLocationLevel, StyledColumn, StyledMeasureColumn, PivotRowsSort, ChartStyleOptions, LineStyleOptions, AreaStyleOptions, StackableStyleOptions, PieStyleOptions, FunnelStyleOptions, PolarStyleOptions, IndicatorStyleOptions, NumericSimpleIndicatorStyleOptions, NumericBarIndicatorStyleOptions, GaugeIndicatorStyleOptions, ScatterStyleOptions, TreemapStyleOptions, SunburstStyleOptions, BoxplotStyleOptions, ScattermapStyleOptions, AreamapStyleOptions, ChartWidgetStyleOptions, WidgetStyleOptions, DashboardWidgetStyleOptions, WidgetByIdStyleOptions, TableStyleOptions, PivotTableStyleOptions, AreaRangeStyleOptions, DataLimits, Legend, Markers, Labels, IndicatorComponents, ScatterMarkerSize, LineWidth, AxisLabel, Convolution, SeriesLabels, X2Title, ScattermapMarkers, WidgetModel, DashboardModel, BeforeRenderHandler, DataPoint, ScatterDataPoint, HighchartsOptions, BoxplotDataPoint, IndicatorBeforeRenderHandler, IndicatorRenderOptions, DashboardLayoutOptions, WidgetsPanelLayout, WidgetsPanelColumnLayout, WidgetId, WidgetsOptions, AppConfig, DateConfig, MenuItemSection, MonthOfYear, DayOfWeek, DateLevel, ThemeOid, GetDashboardModelOptions, GetDashboardModelsOptions, SeriesChartType, MenuPosition, ThemeSettings, Color, ColorPaletteTheme, Navigator, DrilldownOptions, DrilldownSelection, Member, FilterVariant, CriteriaFilterType, } from '@sisense/sdk-ui-preact';
@@ -1,4 +1,16 @@
1
1
  import { type Slots } from 'vue';
2
+ import { type ContextConnector } from '@sisense/sdk-ui-preact';
3
+ export declare function createDefaultContextConnectors(): (ContextConnector<import("@sisense/sdk-ui/dist/packages/sdk-ui/src/sisense-context/sisense-context").SisenseContextPayload> | ContextConnector<{
4
+ themeSettings: import("@sisense/sdk-ui-preact").CompleteThemeSettings;
5
+ skipTracking?: boolean | undefined;
6
+ }> | {
7
+ prepareContext(): Promise<{
8
+ pluginMap: Map<string, import("@sisense/sdk-ui-preact").PluginComponent<import("@sisense/sdk-ui-preact").PluginComponentProps<import("@sisense/sdk-ui-preact").GenericDataOptions, any>>> & Omit<Map<string, import("@sisense/sdk-ui-preact").PluginComponent<import("@sisense/sdk-ui-preact").PluginComponentProps<import("@sisense/sdk-ui-preact").GenericDataOptions, any>>>, keyof Map<any, any>>;
9
+ registerPlugin: (pluginType: string, plugin: import("@sisense/sdk-ui-preact").PluginComponent<import("@sisense/sdk-ui-preact").PluginComponentProps<import("@sisense/sdk-ui-preact").GenericDataOptions, any>>) => void;
10
+ getPlugin: (pluginType: string) => import("@sisense/sdk-ui-preact").PluginComponent<import("@sisense/sdk-ui-preact").PluginComponentProps<import("@sisense/sdk-ui-preact").GenericDataOptions, any>> | undefined;
11
+ }>;
12
+ renderContextProvider: (contextData: import("@sisense/sdk-ui-preact").CustomPluginsContext<any>, children: import("preact").VNode<{}>, error?: Error | undefined) => import("preact").VNode<{}>;
13
+ })[];
2
14
  export declare function getRawData<T>(data: T): T;
3
15
  export declare function toDeepRaw<T>(data: T): T;
4
16
  /**
@@ -6,7 +18,7 @@ export declare function toDeepRaw<T>(data: T): T;
6
18
  *
7
19
  * @internal
8
20
  */
9
- export declare const setupHelper: <P, C>(component: C, props: P) => (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
+ export declare const setupHelper: <P, C>(component: C, props: P, createContextConnectorsFn?: () => ContextConnector<any>[]) => (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
10
22
  [key: string]: any;
11
23
  }>) | null;
12
24
  /**
@@ -0,0 +1,24 @@
1
+ import type { DashboardConfig as DashboardConfigPreact, DashboardByIdConfig as DashboardByIdConfigPreact, DashboardFiltersPanelConfig as DashboardFiltersPanelConfigPreact } from '@sisense/sdk-ui-preact';
2
+ /**
3
+ * {@inheritDoc @sisense/sdk-ui!DashboardFiltersPanelConfig}
4
+ */
5
+ export interface DashboardFiltersPanelConfig extends Omit<DashboardFiltersPanelConfigPreact, 'actions'> {
6
+ }
7
+ /**
8
+ * {@inheritDoc @sisense/sdk-ui!DashboardConfig}
9
+ */
10
+ export interface DashboardConfig extends Omit<DashboardConfigPreact, 'filtersPanel'> {
11
+ /**
12
+ * {@inheritDoc @sisense/sdk-ui!DashboardConfig.filtersPanel}
13
+ */
14
+ filtersPanel?: DashboardFiltersPanelConfig;
15
+ }
16
+ /**
17
+ * {@inheritDoc @sisense/sdk-ui!DashboardByIdConfig}
18
+ */
19
+ export interface DashboardByIdConfig extends Omit<DashboardByIdConfigPreact, 'filtersPanel'> {
20
+ /**
21
+ * {@inheritDoc @sisense/sdk-ui!DashboardByIdConfig.filtersPanel}
22
+ */
23
+ filtersPanel?: DashboardFiltersPanelConfig;
24
+ }
@@ -0,0 +1,2 @@
1
+ export * from './maybe-ref';
2
+ export * from './dashboard-config';
@@ -0,0 +1,14 @@
1
+ import type { Ref } from 'vue';
2
+ export type MaybeRef<T> = Ref<T> | T;
3
+ export type MaybeWithRefs<T extends object> = {
4
+ [Property in keyof T]: MaybeRef<T[Property]>;
5
+ };
6
+ export type MaybeRefOrWithRefs<T extends Object> = MaybeRef<T> | MaybeWithRefs<T>;
7
+ /**
8
+ * Converts all non-function properties of `T` into Vue refs while keeping function properties specified by `Fns` unchanged.
9
+ *
10
+ * @internal
11
+ */
12
+ export type ToRefsExceptFns<T, Fns extends keyof T> = {
13
+ [K in keyof Omit<T, Fns>]: Ref<T[K]>;
14
+ } & Pick<T, Fns>;
@@ -0,0 +1,105 @@
1
+ import type { Filter, FilterRelations } from '@sisense/sdk-data';
2
+ import type { DashboardProps } from '../components/dashboard';
3
+ /**
4
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.replaceFilters}
5
+ *
6
+ * @example
7
+ * Replace all filters on a dashboard with a new set of filters.
8
+ * ```ts
9
+ * const existingDashboard: DashboardProps = {...}
10
+ * const newFilters: Filter[] = [{...}, {...}, ...];
11
+ * const updatedDashboard = dashboardHelpers.replaceFilters(existingDashboard, newFilters);
12
+ * ```
13
+ * @param dashboard - The original dashboard (`DashboardProps`) whose filters are to be replaced.
14
+ * @param newFilters - An array of new filters or filter relations to set on the dashboard.
15
+ * @returns A new dashboard instance with the updated filters.
16
+ */
17
+ export declare const replaceFilters: (dashboard: DashboardProps, newFilters: Filter[] | FilterRelations) => DashboardProps;
18
+ /**
19
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.addFilter}
20
+ *
21
+ * @example
22
+ * Add a new filter to a dashboard.
23
+ * ```ts
24
+ * const existingDashboard: DashboardProps = {...};
25
+ * const newFilter: Filter = {...};
26
+ * const updatedDashboard = dashboardHelpers.addFilter(existingDashboard, newFilter);
27
+ * ```
28
+ * @param dashboard - The original dashboard (`DashboardProps`) to which the filter will be added.
29
+ * @param newFilter - The filter to add to the dashboard.
30
+ * @returns A new dashboard instance with the new filter added.
31
+ */
32
+ export declare const addFilter: (dashboard: DashboardProps, newFilter: Filter) => DashboardProps;
33
+ /**
34
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.addFilters}
35
+ *
36
+ * @example
37
+ * Add multiple new filters to a dashboard.
38
+ * ```ts
39
+ * const existingDashboard: DashboardProps = {...};
40
+ * const newFilters: Filter[] = [{...}, {...}, ...];
41
+ * const updatedDashboard = dashboardHelpers.addFilters(existingDashboard, newFilters);
42
+ * ```
43
+ * @param dashboard - The original dashboard (`DashboardProps`) to which the filters will be added.
44
+ * @param newFilters - An array of filters to add to the dashboard.
45
+ * @returns A new dashboard instance with the new filters added.
46
+ */
47
+ export declare const addFilters: (dashboard: DashboardProps, newFilters: Filter[]) => DashboardProps;
48
+ /**
49
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.replaceFilter}
50
+ *
51
+ * @example
52
+ * Replace a filter in a dashboard.
53
+ * ```ts
54
+ * const existingDashboard: DashboardProps = {...};
55
+ * const filterToReplace: Filter = {...};
56
+ * const newFilter: Filter = {...};
57
+ * const updatedDashboard = dashboardHelpers.replaceFilter(existingDashboard, filterToReplace, newFilter);
58
+ * ```
59
+ * @param dashboard - The original dashboard (`DashboardProps`) containing the filter to be replaced.
60
+ * @param filterToReplace - The existing filter to be replaced.
61
+ * @param newFilter - The new filter to replace the existing one.
62
+ * @returns A new dashboard instance with the specified filter replaced.
63
+ */
64
+ export declare const replaceFilter: (dashboard: DashboardProps, filterToReplace: Filter, newFilter: Filter) => DashboardProps;
65
+ /**
66
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.modifyFilter}
67
+ *
68
+ * @deprecated Use {@link replaceFilter} instead
69
+ *
70
+ * @param dashboard - The original dashboard (`DashboardProps`) containing the filter to modify.
71
+ * @param filterToModify - The existing filter to be modified.
72
+ * @param newFilter - The new filter to replace the existing one.
73
+ * @returns A new dashboard instance with the specified filter modified.
74
+ */
75
+ export declare const modifyFilter: (dashboard: DashboardProps, filterToModify: Filter, newFilter: Filter) => DashboardProps;
76
+ /**
77
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.removeFilter}
78
+ *
79
+ * @example
80
+ * Remove a filter from a dashboard.
81
+ * ```ts
82
+ * const existingDashboard: DashboardProps = {...};
83
+ * const filterToRemove: Filter = {...};
84
+ * const updatedDashboard = dashboardHelpers.removeFilter(existingDashboard, filterToRemove);
85
+ * ```
86
+ * @param dashboard - The original dashboard (`DashboardProps`) from which to remove the filter.
87
+ * @param filterToRemove - The filter to be removed.
88
+ * @returns A new dashboard instance with the specified filter removed.
89
+ */
90
+ export declare const removeFilter: (dashboard: DashboardProps, filterToRemove: Filter) => DashboardProps;
91
+ /**
92
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.removeFilters}
93
+ *
94
+ * @example
95
+ * Remove multiple filters from a dashboard.
96
+ * ```ts
97
+ * const existingDashboard: DashboardProps = {...};
98
+ * const filtersToRemove: Filter[] = [{...}, {...}, ...];
99
+ * const updatedDashboard = dashboardHelpers.removeFilters(existingDashboard, filtersToRemove);
100
+ * ```
101
+ * @param dashboard - The original dashboard (`DashboardProps`) from which the specified filters are removed.
102
+ * @param filtersToRemove - An array of filters to remove.
103
+ * @returns A new dashboard instance with the specified filters removed.
104
+ */
105
+ export declare const removeFilters: (dashboard: DashboardProps, filtersToRemove: Filter[]) => DashboardProps;
@@ -0,0 +1,37 @@
1
+ import { type DashboardModel } from '@sisense/sdk-ui-preact';
2
+ import type { DashboardProps } from '../components/dashboard';
3
+ /**
4
+ * Translates {@link DashboardModel} to {@link DashboardProps}.
5
+ *
6
+ * @example
7
+ * ```vue
8
+ <script setup lang="ts">
9
+ import { dashboardModelTranslator, useGetDashboardModel, Dashboard } from '@sisense/sdk-ui-vue';
10
+ import { computed } from 'vue';
11
+
12
+ const { dashboard } = useGetDashboardModel({
13
+ dashboardOid: 'your-dashboard-oid',
14
+ includeWidgets: true,
15
+ includeFilters: true,
16
+ });
17
+
18
+ const dashboardProps = computed(() =>
19
+ dashboard.value ? dashboardModelTranslator.toDashboardProps(dashboard.value) : null,
20
+ );
21
+ </script>
22
+
23
+ <template>
24
+ <Dashboard
25
+ v-if="dashboardProps"
26
+ :title="dashboardProps.title"
27
+ :layoutOptions="dashboardProps.layoutOptions"
28
+ :widgets="dashboardProps.widgets"
29
+ :filters="dashboardProps.filters"
30
+ :defaultDataSource="dashboardProps.defaultDataSource"
31
+ :widgetsOptions="dashboardProps.widgetsOptions"
32
+ :styleOptions="dashboardProps.styleOptions"
33
+ />
34
+ </template>
35
+ * ```
36
+ */
37
+ export declare function toDashboardProps(dashboardModel: DashboardModel): DashboardProps;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * {@inheritDoc @sisense/sdk-ui!dashboardModelTranslator}
3
+ *
4
+ * @group Fusion Assets
5
+ * @fusionEmbed
6
+ * @shortDescription Utility functions to translate a Fusion dashboard model from and to other dashboard data structures
7
+ */
8
+ export * as dashboardModelTranslator from './dashboard-model-translator';
9
+ /**
10
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers}
11
+ *
12
+ * @group Dashboards
13
+ * @shortDescription Utility functions to manipulate dashboard elements
14
+ */
15
+ export * as dashboardHelpers from './dashboard-helpers';
16
+ /**
17
+ * {@inheritDoc @sisense/sdk-ui!widgetModelTranslator}
18
+ *
19
+ * @group Fusion Assets
20
+ * @fusionEmbed
21
+ * @shortDescription Utility functions to translate a Fusion widget model from and to other widget data structures
22
+ */
23
+ export * as widgetModelTranslator from './widget-model-translator';
@@ -0,0 +1,247 @@
1
+ import { type WidgetModel, type TextWidgetProps, type ExecutePivotQueryParams, type ExecuteQueryParams, type PivotTableWidgetProps } from '@sisense/sdk-ui-preact';
2
+ import type { ChartProps, PivotTableProps, TableProps } from '../components/charts';
3
+ import type { ChartWidgetProps } from '../components/widgets';
4
+ /**
5
+ * Translates a {@link WidgetModel} to the parameters for executing a query for the widget.
6
+ *
7
+ * @example
8
+ * ```vue
9
+ <script setup lang="ts">
10
+ import { widgetModelTranslator, useGetWidgetModel, useExecuteQuery } from '@sisense/sdk-ui-vue';
11
+ import { computed } from 'vue';
12
+
13
+ const { data: widgetModel } = useGetWidgetModel({
14
+ dashboardOid: 'your-dashboard-oid',
15
+ widgetOid: 'your-widget-oid',
16
+ });
17
+
18
+ const executeQueryParams = computed(() =>
19
+ widgetModel.value
20
+ ? widgetModelTranslator.toExecuteQueryParams(widgetModel.value)
21
+ : { enabled: false },
22
+ );
23
+
24
+ const { data, isLoading, isError } = useExecuteQuery(executeQueryParams);
25
+ </script>
26
+ * ```
27
+ *
28
+ * Note: this method is not supported for getting pivot query.
29
+ * Use {@link toExecutePivotQueryParams} instead for getting query parameters for the pivot widget.
30
+ */
31
+ export declare const toExecuteQueryParams: (widgetModel: WidgetModel) => ExecuteQueryParams;
32
+ /**
33
+ * Translates a {@link WidgetModel} to the parameters for executing a query for the pivot widget.
34
+ *
35
+ * @example
36
+ * ```vue
37
+ <script setup lang="ts">
38
+ import { widgetModelTranslator, useGetWidgetModel, useExecuteQuery } from '@sisense/sdk-ui-vue';
39
+ import { computed } from 'vue';
40
+
41
+ const { data: widgetModel } = useGetWidgetModel({
42
+ dashboardOid: 'your-dashboard-oid',
43
+ widgetOid: 'your-widget-oid',
44
+ });
45
+
46
+ const executePivotQueryParams = computed(() =>
47
+ widgetModel.value ? widgetModelTranslator.toExecutePivotQueryParams(widgetModel.value): { enabled: false },
48
+ );
49
+
50
+ const { data, isLoading, isError } = useExecutePivotQuery(executePivotQueryParams);
51
+ </script>
52
+ * ```
53
+ *
54
+ * Note: this method is supported only for getting pivot query.
55
+ * Use {@link toExecuteQueryParams} instead for getting query parameters for non-pivot widgets.
56
+ */
57
+ export declare const toExecutePivotQueryParams: (widgetModel: WidgetModel) => ExecutePivotQueryParams;
58
+ /**
59
+ * Translates a {@link WidgetModel} to the props for rendering a chart.
60
+ *
61
+ * @example
62
+ * ```vue
63
+ <script setup lang="ts">
64
+ import { widgetModelTranslator, useGetWidgetModel, Chart } from '@sisense/sdk-ui-vue';
65
+ import { computed } from 'vue';
66
+
67
+ const { data: widgetModel } = useGetWidgetModel({
68
+ dashboardOid: 'your-dashboard-oid',
69
+ widgetOid: 'your-widget-oid',
70
+ });
71
+
72
+ const chartProps = computed(() =>
73
+ widgetModel.value ? widgetModelTranslator.toChartProps(widgetModel.value) : null,
74
+ );
75
+ </script>
76
+
77
+ <template>
78
+ <Chart
79
+ v-if="chartProps"
80
+ :chartType="chartProps.chartType"
81
+ :dataSet="chartProps.dataSet"
82
+ :dataOptions="chartProps.dataOptions"
83
+ :filters="chartProps.filters"
84
+ :highlights="chartProps.highlights"
85
+ :styleOptions="chartProps.styleOptions"
86
+ />
87
+ </template>
88
+ * ```
89
+ *
90
+ * Note: this method is not supported for pivot widgets.
91
+ * Use {@link toPivotTableProps} instead for getting props for the {@link PivotTable}.
92
+ */
93
+ export declare function toChartProps(widgetModel: WidgetModel): ChartProps;
94
+ /**
95
+ * Translates a {@link WidgetModel} to the props for rendering a table.
96
+ *
97
+ * @example
98
+ * ```vue
99
+ <script setup lang="ts">
100
+ import { widgetModelTranslator, useGetWidgetModel, Table } from '@sisense/sdk-ui-vue';
101
+ import { computed } from 'vue';
102
+
103
+ const { data: widgetModel } = useGetWidgetModel({
104
+ dashboardOid: 'your-dashboard-oid',
105
+ widgetOid: 'your-widget-oid',
106
+ });
107
+
108
+ const tableProps = computed(() =>
109
+ widgetModel.value ? widgetModelTranslator.toTableProps(widgetModel.value) : null,
110
+ );
111
+ </script>
112
+
113
+ <template>
114
+ <Table
115
+ v-if="tableProps"
116
+ :dataSet="tableProps.dataSet"
117
+ :dataOptions="tableProps.dataOptions"
118
+ :filters="tableProps.filters"
119
+ :styleOptions="tableProps.styleOptions"
120
+ />
121
+ </template>
122
+ * ```
123
+ *
124
+ * Note: this method is not supported for chart and pivot widgets.
125
+ * Use {@link toChartProps} instead for getting props for the {@link Chart}.
126
+ * Use {@link toPivotTableProps} instead for getting props for the {@link PivotTable}.
127
+ */
128
+ export declare function toTableProps(widgetModel: WidgetModel): TableProps;
129
+ /**
130
+ * Translates a {@link WidgetModel} to the props for rendering a pivot table.
131
+ *
132
+ * @example
133
+ * ```vue
134
+ <script setup lang="ts">
135
+ import { widgetModelTranslator, useGetWidgetModel, PivotTable } from '@sisense/sdk-ui-vue';
136
+ import { computed } from 'vue';
137
+
138
+ const { data: widgetModel } = useGetWidgetModel({
139
+ dashboardOid: 'your-dashboard-oid',
140
+ widgetOid: 'your-widget-oid',
141
+ });
142
+
143
+ const pivotTableProps = computed(() =>
144
+ widgetModel.value ? widgetModelTranslator.toPivotTableProps(widgetModel.value) : null,
145
+ );
146
+ </script>
147
+
148
+ <template>
149
+ <PivotTable
150
+ v-if="pivotTableProps"
151
+ :dataSet="pivotTableProps.dataSet"
152
+ :dataOptions="pivotTableProps.dataOptions"
153
+ :filters="pivotTableProps.filters"
154
+ :styleOptions="pivotTableProps.styleOptions"
155
+ />
156
+ </template>
157
+ * ```
158
+ *
159
+ * Note: this method is not supported for chart or table widgets.
160
+ * Use {@link toChartProps} instead for getting props for the {@link Chart}.
161
+ * Use {@link toTableProps} instead for getting props for the {@link Table}.
162
+ */
163
+ export declare function toPivotTableProps(widgetModel: WidgetModel): PivotTableProps;
164
+ /**
165
+ * Translates a {@link WidgetModel} to the props for rendering a chart widget.
166
+ *
167
+ * @example
168
+ * ```vue
169
+ <script setup lang="ts">
170
+ import { widgetModelTranslator, useGetWidgetModel, ChartWidget } from '@sisense/sdk-ui-vue';
171
+ import { computed } from 'vue';
172
+
173
+ const { data: widgetModel } = useGetWidgetModel({
174
+ dashboardOid: 'your-dashboard-oid',
175
+ widgetOid: 'your-widget-oid',
176
+ });
177
+
178
+ const chartWidgetProps = computed(() =>
179
+ widgetModel.value ? widgetModelTranslator.toChartWidgetProps(widgetModel.value) : null,
180
+ );
181
+ </script>
182
+
183
+ <template>
184
+ <ChartWidget
185
+ v-if="chartWidgetProps"
186
+ :chartType="chartWidgetProps.chartType"
187
+ :dataSource="chartWidgetProps.dataSource"
188
+ :dataOptions="chartWidgetProps.dataOptions"
189
+ :filters="chartWidgetProps.filters"
190
+ :highlights="chartWidgetProps.highlights"
191
+ :styleOptions="chartWidgetProps.styleOptions"
192
+ />
193
+ </template>
194
+ * ```
195
+ *
196
+ * Note: this method is not supported for pivot widgets.
197
+ */
198
+ export declare function toChartWidgetProps(widgetModel: WidgetModel): ChartWidgetProps;
199
+ /**
200
+ * Translates a {@link WidgetModel} to the props for rendering a pivot table widget.
201
+ *
202
+ * @example
203
+ * ```vue
204
+ <script setup lang="ts">
205
+ import { widgetModelTranslator, useGetWidgetModel } from '@sisense/sdk-ui-vue';
206
+ import { computed } from 'vue';
207
+
208
+ const { data: widgetModel } = useGetWidgetModel({
209
+ dashboardOid: 'your-dashboard-oid',
210
+ widgetOid: 'your-widget-oid',
211
+ });
212
+
213
+ const pivotTableWidgetProps = computed(() =>
214
+ widgetModel.value ? widgetModelTranslator.toPivotTableWidgetProps(widgetModel.value) : null,
215
+ );
216
+ </script>
217
+ * ```
218
+ *
219
+ * Note: this method is not supported for chart or table widgets.
220
+ * Use {@link toChartWidgetProps} instead for getting props for the {@link ChartWidget}.
221
+ */
222
+ export declare function toPivotTableWidgetProps(widgetModel: WidgetModel): PivotTableWidgetProps;
223
+ /**
224
+ * Translates a {@link WidgetModel} to the props for rendering a text widget.
225
+ *
226
+ * @example
227
+ * ```vue
228
+ <script setup lang="ts">
229
+ import { widgetModelTranslator, useGetWidgetModel } from '@sisense/sdk-ui-vue';
230
+ import { computed } from 'vue';
231
+
232
+ const { data: widgetModel } = useGetWidgetModel({
233
+ dashboardOid: 'your-dashboard-oid',
234
+ widgetOid: 'your-widget-oid',
235
+ });
236
+
237
+ const textWidgetProps = computed(() =>
238
+ widgetModel.value ? widgetModelTranslator.toTextWidgetProps(widgetModel.value) : null,
239
+ );
240
+ </script>
241
+ * ```
242
+ *
243
+ * Note: this method is not supported for chart or pivot widgets.
244
+ * Use {@link toChartWidgetProps} instead for getting props for the {@link ChartWidget}.
245
+ * Use {@link toPivotTableWidgetProps} instead for getting props for the pivot table widget.
246
+ */
247
+ export declare function toTextWidgetProps(widgetModel: WidgetModel): TextWidgetProps;